From 29f3a797ceddc8d0b49bb5223521705ae490a3de Mon Sep 17 00:00:00 2001 From: Costin Lupu Date: Tue, 9 Jan 2024 09:14:23 +0100 Subject: [PATCH] Fix a Clippy warning reported for Rust 1.60 but not for 1.75 As reported by `cargo +1.60 clippy --fix --allow-dirty`. Signed-off-by: Costin Lupu --- src/common/commands_parser.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/commands_parser.rs b/src/common/commands_parser.rs index 0da9a7a1..fde3c4f6 100644 --- a/src/common/commands_parser.rs +++ b/src/common/commands_parser.rs @@ -583,10 +583,12 @@ mod tests { /// Parse the path of the JSON config file fn parse_config_file(args: &ArgMatches) -> NitroCliResult { - let config_file = args.value_of("config").ok_or(new_nitro_cli_failure!( - "`config` argument not found", - NitroCliErrorEnum::MissingArgument - ))?; + let config_file = args.value_of("config").ok_or_else(|| { + new_nitro_cli_failure!( + "`config` argument not found", + NitroCliErrorEnum::MissingArgument + ) + })?; Ok(config_file.to_string()) }