diff --git a/shellfirm/build.rs b/shellfirm/build.rs index 9678474..62445e5 100644 --- a/shellfirm/build.rs +++ b/shellfirm/build.rs @@ -9,7 +9,7 @@ fn main() -> Result<()> { let dest_checks_path = Path::new(&out_dir).join("all-checks.yaml"); let dest_groups = Path::new(&out_dir).join("all_the_files.rs"); - let mut groups_names = File::create(&dest_groups)?; + let mut groups_names = File::create(dest_groups)?; writeln!(&mut groups_names, r##"["##,)?; @@ -26,7 +26,7 @@ fn main() -> Result<()> { .unwrap() .to_str() .expect("could not get file name"); - writeln!(&mut groups_names, r##""{name}","##, name = file_name)?; + writeln!(&mut groups_names, r##""{file_name}","##)?; } writeln!(&mut groups_names, r##"]"##,)?; diff --git a/shellfirm/src/bin/cmd/config.rs b/shellfirm/src/bin/cmd/config.rs index dbb67e5..654e242 100644 --- a/shellfirm/src/bin/cmd/config.rs +++ b/shellfirm/src/bin/cmd/config.rs @@ -64,7 +64,7 @@ pub fn run_update_groups( }), Err(e) => Ok(shellfirm::CmdExit { code: exitcode::CONFIG, - message: Some(format!("Could not update checks group. error: {}", e)), + message: Some(format!("Could not update checks group. error: {e}")), }), } } @@ -77,7 +77,7 @@ pub fn run_reset(config: &Config, force_selection: Option) -> shellfirm:: }, Err(e) => shellfirm::CmdExit { code: exitcode::CONFIG, - message: Some(format!("reset settings error: {:?}", e)), + message: Some(format!("reset settings error: {e:?}")), }, } } @@ -97,7 +97,7 @@ pub fn run_challenge(config: &Config, challenge: Option) -> Result Ok(shellfirm::CmdExit { code: exitcode::CONFIG, - message: Some(format!("change challenge error: {:?}", e)), + message: Some(format!("change challenge error: {e:?}")), }), } } @@ -131,7 +131,7 @@ pub fn run_ignore( }), Err(e) => Ok(shellfirm::CmdExit { code: exitcode::CONFIG, - message: Some(format!("update pattern ignore errors: {:?}", e)), + message: Some(format!("update pattern ignore errors: {e:?}")), }), } } @@ -165,7 +165,7 @@ pub fn run_deny( }), Err(e) => Ok(shellfirm::CmdExit { code: exitcode::CONFIG, - message: Some(format!("update pattern ignore errors: {:?}", e)), + message: Some(format!("update pattern ignore errors: {e:?}")), }), } } diff --git a/shellfirm/src/bin/shellfirm.rs b/shellfirm/src/bin/shellfirm.rs index b96f6cc..59a4091 100644 --- a/shellfirm/src/bin/shellfirm.rs +++ b/shellfirm/src/bin/shellfirm.rs @@ -24,7 +24,7 @@ fn main() { let config = match Config::new(None) { Ok(config) => config, Err(err) => { - eprintln!("Loading config error: {}", err); + eprintln!("Loading config error: {err}"); exit(1) } }; @@ -51,7 +51,7 @@ fn main() { let checks = match settings.get_active_checks() { Ok(c) => c, Err(e) => { - eprintln!("Could not load checks. err: Error: {}", e); + eprintln!("Could not load checks. err: Error: {e}"); exit(1) } }; diff --git a/shellfirm/src/checks.rs b/shellfirm/src/checks.rs index 867b6c8..3890384 100644 --- a/shellfirm/src/checks.rs +++ b/shellfirm/src/checks.rs @@ -83,7 +83,7 @@ pub fn challenge( } for description in descriptions { - eprintln!("* {}", description); + eprintln!("* {description}"); } eprintln!(); diff --git a/shellfirm/src/config.rs b/shellfirm/src/config.rs index 6b0a66d..74ecf6c 100644 --- a/shellfirm/src/config.rs +++ b/shellfirm/src/config.rs @@ -55,7 +55,7 @@ pub struct Settings { } impl fmt::Display for Challenge { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Math => write!(f, "Math"), Self::Enter => write!(f, "Enter"), @@ -103,7 +103,7 @@ impl Config { // compatibility if the folder $HOME/.shellfirm exists, shillfirm // continue work with that folder. If the folder does not exists, the default // use config dir - let homedir = p.join(format!(".{}", package_name)); + let homedir = p.join(format!(".{package_name}")); let conf_dir = dirs::config_dir().unwrap_or_else(|| homedir.clone()); if homedir.is_dir() { homedir diff --git a/shellfirm/src/prompt.rs b/shellfirm/src/prompt.rs index 8dd6c83..1cf09e9 100644 --- a/shellfirm/src/prompt.rs +++ b/shellfirm/src/prompt.rs @@ -40,7 +40,7 @@ pub fn math_challenge() -> bool { if answer == expected_answer { break; } - eprintln!("{}", WRONG_ANSWER); + eprintln!("{WRONG_ANSWER}"); } true } @@ -53,7 +53,7 @@ pub fn enter_challenge() -> bool { if answer == "\n" { break; } - eprintln!("{}", WRONG_ANSWER); + eprintln!("{WRONG_ANSWER}"); } true } @@ -65,7 +65,7 @@ pub fn yes_challenge() -> bool { if show_stdin_prompt().trim() == "yes" { break; } - eprintln!("{}", WRONG_ANSWER); + eprintln!("{WRONG_ANSWER}"); } true }