Skip to content

Commit b261cc6

Browse files
committed
chore: apply nightly rustfmt formatting
1 parent a5199b8 commit b261cc6

2 files changed

Lines changed: 22 additions & 20 deletions

File tree

crates/stackable-operator/src/config_overrides.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ pub trait KeyValueOverridesProvider {
6464
}
6565
}
6666

67-
impl KeyValueOverridesProvider
68-
for HashMap<String, HashMap<String, String>>
69-
{
67+
impl KeyValueOverridesProvider for HashMap<String, HashMap<String, String>> {
7068
fn get_key_value_overrides(&self, file: &str) -> BTreeMap<String, Option<String>> {
7169
self.get(file)
7270
.map(|entries| {
@@ -154,9 +152,8 @@ impl JsonConfigOverrides {
154152
.iter()
155153
.enumerate()
156154
.map(|(index, patch_str)| {
157-
serde_json::from_str(patch_str).context(
158-
DeserializeJsonPatchOperationSnafu { index },
159-
)
155+
serde_json::from_str(patch_str)
156+
.context(DeserializeJsonPatchOperationSnafu { index })
160157
})
161158
.collect::<Result<Vec<_>, _>>()?;
162159
json_patch::patch(&mut doc, &operations).context(ApplyJsonPatchSnafu)?;
@@ -204,12 +201,15 @@ mod tests {
204201

205202
let result = overrides.apply(&base).expect("merge patch should succeed");
206203

207-
assert_eq!(result["bundles"]["authz"]["polling"]["min_delay_seconds"], 3);
208-
assert_eq!(result["bundles"]["authz"]["polling"]["max_delay_seconds"], 5);
209204
assert_eq!(
210-
result["default_decision"],
211-
"/http/example/authz/allow"
205+
result["bundles"]["authz"]["polling"]["min_delay_seconds"],
206+
3
212207
);
208+
assert_eq!(
209+
result["bundles"]["authz"]["polling"]["max_delay_seconds"],
210+
5
211+
);
212+
assert_eq!(result["default_decision"], "/http/example/authz/allow");
213213
}
214214

215215
#[test]
@@ -265,9 +265,7 @@ mod tests {
265265
fn json_patch_invalid_operation_returns_error() {
266266
let base = json!({"foo": "bar"});
267267

268-
let overrides = JsonConfigOverrides::JsonPatches(vec![
269-
r#"{"not_an_op": true}"#.to_owned(),
270-
]);
268+
let overrides = JsonConfigOverrides::JsonPatches(vec![r#"{"not_an_op": true}"#.to_owned()]);
271269

272270
let result = overrides.apply(&base);
273271
assert!(
@@ -283,7 +281,9 @@ mod tests {
283281

284282
let overrides = JsonConfigOverrides::UserProvided(content.to_owned());
285283

286-
let result = overrides.apply(&base).expect("user provided should succeed");
284+
let result = overrides
285+
.apply(&base)
286+
.expect("user provided should succeed");
287287
assert_eq!(result, json!({"custom": true}));
288288
}
289289

@@ -313,8 +313,7 @@ mod tests {
313313

314314
#[test]
315315
fn key_value_overrides_provider_for_hashmap() {
316-
let mut config_overrides =
317-
HashMap::<String, HashMap<String, String>>::new();
316+
let mut config_overrides = HashMap::<String, HashMap<String, String>>::new();
318317
let mut file_overrides = HashMap::new();
319318
file_overrides.insert("key1".to_owned(), "value1".to_owned());
320319
file_overrides.insert("key2".to_owned(), "value2".to_owned());

crates/stackable-operator/src/role_utils.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ pub enum Error {
121121
deserialize = "T: Default + Deserialize<'de>, ProductSpecificCommonConfig: Default + Deserialize<'de>, ConfigOverrides: Default + Deserialize<'de>"
122122
)
123123
)]
124-
#[schemars(bound = "T: JsonSchema, ProductSpecificCommonConfig: JsonSchema, ConfigOverrides: Default + JsonSchema")]
124+
#[schemars(
125+
bound = "T: JsonSchema, ProductSpecificCommonConfig: JsonSchema, ConfigOverrides: Default + JsonSchema"
126+
)]
125127
pub struct CommonConfiguration<
126128
T,
127129
ProductSpecificCommonConfig,
@@ -329,8 +331,7 @@ pub struct Role<
329331
#[serde(default)]
330332
pub role_config: U,
331333

332-
pub role_groups:
333-
HashMap<String, RoleGroup<T, ProductSpecificCommonConfig, ConfigOverrides>>,
334+
pub role_groups: HashMap<String, RoleGroup<T, ProductSpecificCommonConfig, ConfigOverrides>>,
334335
}
335336

336337
impl<T, U, ProductSpecificCommonConfig, ConfigOverrides>
@@ -451,7 +452,9 @@ pub struct EmptyRoleConfig {}
451452
deserialize = "T: Default + Deserialize<'de>, ProductSpecificCommonConfig: Default + Deserialize<'de>, ConfigOverrides: Default + Deserialize<'de>"
452453
)
453454
)]
454-
#[schemars(bound = "T: JsonSchema, ProductSpecificCommonConfig: JsonSchema, ConfigOverrides: Default + JsonSchema")]
455+
#[schemars(
456+
bound = "T: JsonSchema, ProductSpecificCommonConfig: JsonSchema, ConfigOverrides: Default + JsonSchema"
457+
)]
455458
pub struct RoleGroup<
456459
T,
457460
ProductSpecificCommonConfig,

0 commit comments

Comments
 (0)