Skip to content

Commit a726a87

Browse files
committed
explain why serialization statement won't fail
1 parent ad04934 commit a726a87

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

  • rust

rust/stackable-cockpit/src/platform/operator/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl OperatorSpec {
225225
let helm_values_yaml = if helm_values.is_empty() {
226226
None
227227
} else {
228-
Some(serde_yaml::to_string(&helm_values).expect("Value serialization should not fail"))
228+
Some(serde_yaml::to_string(&helm_values).expect("serializing a small YAML Mapping back to a YAML string can't fail"))
229229
};
230230

231231
// Install using Helm

rust/stackablectl/src/utils.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ use crate::constants::{HELM_REPO_URL_DEV, HELM_REPO_URL_STABLE, HELM_REPO_URL_TE
1313
#[derive(Debug, Snafu)]
1414
pub enum Error {
1515
#[snafu(display("failed to open or transfer values file '{path}'"))]
16-
FileTransfer {
17-
source: xfer::Error,
18-
path: String,
19-
},
16+
FileTransfer { source: xfer::Error, path: String },
2017

2118
#[snafu(display("operator values file '{path}' must be a YAML mapping at the top level"))]
2219
InvalidValueType { path: String },
2320

24-
#[snafu(display("value for key '{key}' in operator values file '{path}' must be a YAML mapping"))]
21+
#[snafu(display(
22+
"value for key '{key}' in operator values file '{path}' must be a YAML mapping"
23+
))]
2524
InvalidEntryType { key: String, path: String },
2625
}
2726

@@ -95,12 +94,7 @@ pub async fn load_operator_values(
9594

9695
let mapping = match value {
9796
Value::Mapping(mapping) => mapping,
98-
_ => {
99-
return InvalidValueTypeSnafu {
100-
path: path.clone(),
101-
}
102-
.fail()
103-
}
97+
_ => return InvalidValueTypeSnafu { path: path.clone() }.fail(),
10498
};
10599

106100
for (key, value) in &mapping {

0 commit comments

Comments
 (0)