1
0
Fork 0
mirror of https://github.com/notohh/rustlings.git synced 2025-08-07 12:03:18 -04:00

Run clippy --fix

This commit is contained in:
mo8it 2023-08-26 23:07:20 +02:00
commit 571bab20c1
5 changed files with 35 additions and 35 deletions

View file

@ -110,12 +110,12 @@ impl Exercise {
pub fn compile(&self) -> Result<CompiledExercise, ExerciseOutput> {
let cmd = match self.mode {
Mode::Compile => Command::new("rustc")
.args(&[self.path.to_str().unwrap(), "-o", &temp_file()])
.args([self.path.to_str().unwrap(), "-o", &temp_file()])
.args(RUSTC_COLOR_ARGS)
.args(RUSTC_EDITION_ARGS)
.output(),
Mode::Test => Command::new("rustc")
.args(&["--test", self.path.to_str().unwrap(), "-o", &temp_file()])
.args(["--test", self.path.to_str().unwrap(), "-o", &temp_file()])
.args(RUSTC_COLOR_ARGS)
.args(RUSTC_EDITION_ARGS)
.output(),
@ -141,7 +141,7 @@ path = "{}.rs""#,
// compilation failure, this would silently fail. But we expect
// clippy to reflect the same failure while compiling later.
Command::new("rustc")
.args(&[self.path.to_str().unwrap(), "-o", &temp_file()])
.args([self.path.to_str().unwrap(), "-o", &temp_file()])
.args(RUSTC_COLOR_ARGS)
.args(RUSTC_EDITION_ARGS)
.output()
@ -151,14 +151,14 @@ path = "{}.rs""#,
// This is already fixed on Clippy's master branch. See this issue to track merging into Cargo:
// https://github.com/rust-lang/rust-clippy/issues/3837
Command::new("cargo")
.args(&["clean", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
.args(["clean", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
.args(RUSTC_COLOR_ARGS)
.output()
.expect("Failed to run 'cargo clean'");
Command::new("cargo")
.args(&["clippy", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
.args(["clippy", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
.args(RUSTC_COLOR_ARGS)
.args(&["--", "-D", "warnings", "-D", "clippy::float_cmp"])
.args(["--", "-D", "warnings", "-D", "clippy::float_cmp"])
.output()
}
}
@ -183,7 +183,7 @@ path = "{}.rs""#,
Mode::Test => "--show-output",
_ => "",
};
let cmd = Command::new(&temp_file())
let cmd = Command::new(temp_file())
.arg(arg)
.output()
.expect("Failed to run 'run' command");
@ -260,7 +260,7 @@ impl Display for Exercise {
#[inline]
fn clean() {
let _ignored = remove_file(&temp_file());
let _ignored = remove_file(temp_file());
}
#[cfg(test)]
@ -270,7 +270,7 @@ mod test {
#[test]
fn test_clean() {
File::create(&temp_file()).unwrap();
File::create(temp_file()).unwrap();
let exercise = Exercise {
name: String::from("example"),
path: PathBuf::from("tests/fixture/state/pending_exercise.rs"),