summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2023-08-26 23:07:20 +0200
committermo8it <mo8it@proton.me>2023-08-26 23:07:20 +0200
commit571bab20c1136adf1443b0fc1778341e923e06e5 (patch)
treeae95814458498d56e48b2e6407cf0d50f237d671 /src
parentc663f06669f5075806a2aff9f946a2d4463d1eeb (diff)
Run clippy --fix
Diffstat (limited to 'src')
-rw-r--r--src/exercise.rs18
-rw-r--r--src/main.rs12
-rw-r--r--src/project.rs2
-rw-r--r--src/verify.rs4
4 files changed, 18 insertions, 18 deletions
diff --git a/src/exercise.rs b/src/exercise.rs
index 2cde4e1..07251db 100644
--- a/src/exercise.rs
+++ b/src/exercise.rs
@@ -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"),
diff --git a/src/main.rs b/src/main.rs
index 0a9af2e..1a15086 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -169,7 +169,7 @@ fn main() {
let filter_cond = filters
.split(',')
.filter(|f| !f.trim().is_empty())
- .any(|f| e.name.contains(&f) || fname.contains(&f));
+ .any(|f| e.name.contains(f) || fname.contains(f));
let status = if e.looks_done() {
exercises_done += 1;
"Done"
@@ -429,7 +429,7 @@ fn watch(
fn rustc_exists() -> bool {
Command::new("rustc")
- .args(&["--version"])
+ .args(["--version"])
.stdout(Stdio::null())
.spawn()
.and_then(|mut child| child.wait())
@@ -465,7 +465,7 @@ started, here's a couple of notes about how Rustlings operates:
Got all that? Great! To get started, run `rustlings watch` in order to get the first
exercise. Make sure to have your editor open!"#;
-const FENISH_LINE: &str = r#"+----------------------------------------------------+
+const FENISH_LINE: &str = r"+----------------------------------------------------+
| You made it to the Fe-nish line! |
+-------------------------- ------------------------+
\\/
@@ -490,12 +490,12 @@ If you noticed any issues, please don't hesitate to report them to our repo.
You can also contribute your own exercises to help the greater community!
Before reporting an issue or contributing, please read our guidelines:
-https://github.com/rust-lang/rustlings/blob/main/CONTRIBUTING.md"#;
+https://github.com/rust-lang/rustlings/blob/main/CONTRIBUTING.md";
-const WELCOME: &str = r#" welcome to...
+const WELCOME: &str = r" welcome to...
_ _ _
_ __ _ _ ___| |_| (_)_ __ __ _ ___
| '__| | | / __| __| | | '_ \ / _` / __|
| | | |_| \__ \ |_| | | | | | (_| \__ \
|_| \__,_|___/\__|_|_|_| |_|\__, |___/
- |___/"#;
+ |___/";
diff --git a/src/project.rs b/src/project.rs
index ebebe27..bcbd7ad 100644
--- a/src/project.rs
+++ b/src/project.rs
@@ -86,7 +86,7 @@ impl RustAnalyzerProject {
println!("Determined toolchain: {}\n", &toolchain);
- self.sysroot_src = (std::path::Path::new(&*toolchain)
+ self.sysroot_src = (std::path::Path::new(toolchain)
.join("lib")
.join("rustlib")
.join("src")
diff --git a/src/verify.rs b/src/verify.rs
index f3f3b56..4e0df86 100644
--- a/src/verify.rs
+++ b/src/verify.rs
@@ -123,9 +123,9 @@ fn compile_and_test(exercise: &Exercise, run_mode: RunMode, verbose: bool, succe
// Compile the given Exercise and return an object with information
// about the state of the compilation
-fn compile<'a, 'b>(
+fn compile<'a>(
exercise: &'a Exercise,
- progress_bar: &'b ProgressBar,
+ progress_bar: &ProgressBar,
) -> Result<CompiledExercise<'a>, ()> {
let compilation_result = exercise.compile();