Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplanelad committed Dec 7, 2023
1 parent 231aebc commit bad8128
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions shellfirm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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##"["##,)?;

Expand All @@ -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##"]"##,)?;
Expand Down
10 changes: 5 additions & 5 deletions shellfirm/src/bin/cmd/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")),
}),
}
}
Expand All @@ -77,7 +77,7 @@ pub fn run_reset(config: &Config, force_selection: Option<usize>) -> shellfirm::
},
Err(e) => shellfirm::CmdExit {
code: exitcode::CONFIG,
message: Some(format!("reset settings error: {:?}", e)),
message: Some(format!("reset settings error: {e:?}")),
},
}
}
Expand All @@ -97,7 +97,7 @@ pub fn run_challenge(config: &Config, challenge: Option<Challenge>) -> Result<sh
}),
Err(e) => Ok(shellfirm::CmdExit {
code: exitcode::CONFIG,
message: Some(format!("change challenge error: {:?}", e)),
message: Some(format!("change challenge error: {e:?}")),
}),
}
}
Expand Down Expand Up @@ -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:?}")),
}),
}
}
Expand Down Expand Up @@ -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:?}")),
}),
}
}
Expand Down
4 changes: 2 additions & 2 deletions shellfirm/src/bin/shellfirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
};
Expand All @@ -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)
}
};
Expand Down
2 changes: 1 addition & 1 deletion shellfirm/src/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn challenge(
}

for description in descriptions {
eprintln!("* {}", description);
eprintln!("* {description}");
}
eprintln!();

Expand Down
4 changes: 2 additions & 2 deletions shellfirm/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions shellfirm/src/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn math_challenge() -> bool {
if answer == expected_answer {
break;
}
eprintln!("{}", WRONG_ANSWER);
eprintln!("{WRONG_ANSWER}");
}
true
}
Expand All @@ -53,7 +53,7 @@ pub fn enter_challenge() -> bool {
if answer == "\n" {
break;
}
eprintln!("{}", WRONG_ANSWER);
eprintln!("{WRONG_ANSWER}");
}
true
}
Expand All @@ -65,7 +65,7 @@ pub fn yes_challenge() -> bool {
if show_stdin_prompt().trim() == "yes" {
break;
}
eprintln!("{}", WRONG_ANSWER);
eprintln!("{WRONG_ANSWER}");
}
true
}
Expand Down

0 comments on commit bad8128

Please sign in to comment.