Skip to content

Commit c4182ea

Browse files
committed
Combine the two sss values into one
Signed-off-by: mulhern <amulhern@redhat.com>
1 parent 905b219 commit c4182ea

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/engine/strat_engine/crypt/shared.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ fn traverse_clevis_config<T>(
210210
recursion_limit: u64,
211211
tang_func: &dyn Fn(&Map<String, Value>) -> StratisResult<T>,
212212
tpm2_func: &dyn Fn(&Map<String, Value>) -> StratisResult<T>,
213-
sss_base: &T,
214-
sss_func: &dyn Fn(T, T) -> StratisResult<T>,
213+
sss: &(&T, &dyn Fn(T, T) -> StratisResult<T>),
215214
) -> StratisResult<T>
216215
where
217216
T: Clone,
@@ -233,17 +232,16 @@ where
233232
} else if pin == "sss" {
234233
if let Some(obj) = clevis_config.as_object() {
235234
if let Some(obj) = obj.get("pins").and_then(|val| val.as_object()) {
236-
obj.iter().try_fold(sss_base.clone(), |acc, (pin, config)| {
235+
obj.iter().try_fold(sss.0.clone(), |acc, (pin, config)| {
237236
let res = traverse_clevis_config(
238237
pin,
239238
config,
240239
recursion_limit - 1,
241240
tang_func,
242241
tpm2_func,
243-
sss_base,
244-
sss_func,
242+
sss,
245243
)?;
246-
sss_func(acc, res)
244+
sss.1(acc, res)
247245
})
248246
} else {
249247
Err(StratisError::Msg(
@@ -291,8 +289,7 @@ fn all_tang_configs_have_url_trust_info(
291289
.unwrap_or(false))
292290
},
293291
&|_| Ok(true),
294-
&true,
295-
&|acc, premise| Ok(acc && premise),
292+
&(&true, &|acc, premise| Ok(acc && premise)),
296293
)
297294
}
298295

0 commit comments

Comments
 (0)