Skip to content

Commit d79984d

Browse files
authored
Merge pull request #1637 from mo8it/fix-warnings
Run clippy --fix
2 parents c2eaa8f + 571bab2 commit d79984d

File tree

5 files changed

+35
-35
lines changed

5 files changed

+35
-35
lines changed

src/exercise.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ impl Exercise {
110110
pub fn compile(&self) -> Result<CompiledExercise, ExerciseOutput> {
111111
let cmd = match self.mode {
112112
Mode::Compile => Command::new("rustc")
113-
.args(&[self.path.to_str().unwrap(), "-o", &temp_file()])
113+
.args([self.path.to_str().unwrap(), "-o", &temp_file()])
114114
.args(RUSTC_COLOR_ARGS)
115115
.args(RUSTC_EDITION_ARGS)
116116
.output(),
117117
Mode::Test => Command::new("rustc")
118-
.args(&["--test", self.path.to_str().unwrap(), "-o", &temp_file()])
118+
.args(["--test", self.path.to_str().unwrap(), "-o", &temp_file()])
119119
.args(RUSTC_COLOR_ARGS)
120120
.args(RUSTC_EDITION_ARGS)
121121
.output(),
@@ -141,7 +141,7 @@ path = "{}.rs""#,
141141
// compilation failure, this would silently fail. But we expect
142142
// clippy to reflect the same failure while compiling later.
143143
Command::new("rustc")
144-
.args(&[self.path.to_str().unwrap(), "-o", &temp_file()])
144+
.args([self.path.to_str().unwrap(), "-o", &temp_file()])
145145
.args(RUSTC_COLOR_ARGS)
146146
.args(RUSTC_EDITION_ARGS)
147147
.output()
@@ -151,14 +151,14 @@ path = "{}.rs""#,
151151
// This is already fixed on Clippy's master branch. See this issue to track merging into Cargo:
152152
// https://github.com/rust-lang/rust-clippy/issues/3837
153153
Command::new("cargo")
154-
.args(&["clean", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
154+
.args(["clean", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
155155
.args(RUSTC_COLOR_ARGS)
156156
.output()
157157
.expect("Failed to run 'cargo clean'");
158158
Command::new("cargo")
159-
.args(&["clippy", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
159+
.args(["clippy", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
160160
.args(RUSTC_COLOR_ARGS)
161-
.args(&["--", "-D", "warnings", "-D", "clippy::float_cmp"])
161+
.args(["--", "-D", "warnings", "-D", "clippy::float_cmp"])
162162
.output()
163163
}
164164
}
@@ -183,7 +183,7 @@ path = "{}.rs""#,
183183
Mode::Test => "--show-output",
184184
_ => "",
185185
};
186-
let cmd = Command::new(&temp_file())
186+
let cmd = Command::new(temp_file())
187187
.arg(arg)
188188
.output()
189189
.expect("Failed to run 'run' command");
@@ -260,7 +260,7 @@ impl Display for Exercise {
260260

261261
#[inline]
262262
fn clean() {
263-
let _ignored = remove_file(&temp_file());
263+
let _ignored = remove_file(temp_file());
264264
}
265265

266266
#[cfg(test)]
@@ -270,7 +270,7 @@ mod test {
270270

271271
#[test]
272272
fn test_clean() {
273-
File::create(&temp_file()).unwrap();
273+
File::create(temp_file()).unwrap();
274274
let exercise = Exercise {
275275
name: String::from("example"),
276276
path: PathBuf::from("tests/fixture/state/pending_exercise.rs"),

src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn main() {
169169
let filter_cond = filters
170170
.split(',')
171171
.filter(|f| !f.trim().is_empty())
172-
.any(|f| e.name.contains(&f) || fname.contains(&f));
172+
.any(|f| e.name.contains(f) || fname.contains(f));
173173
let status = if e.looks_done() {
174174
exercises_done += 1;
175175
"Done"
@@ -429,7 +429,7 @@ fn watch(
429429

430430
fn rustc_exists() -> bool {
431431
Command::new("rustc")
432-
.args(&["--version"])
432+
.args(["--version"])
433433
.stdout(Stdio::null())
434434
.spawn()
435435
.and_then(|mut child| child.wait())
@@ -465,7 +465,7 @@ started, here's a couple of notes about how Rustlings operates:
465465
Got all that? Great! To get started, run `rustlings watch` in order to get the first
466466
exercise. Make sure to have your editor open!"#;
467467

468-
const FENISH_LINE: &str = r#"+----------------------------------------------------+
468+
const FENISH_LINE: &str = r"+----------------------------------------------------+
469469
| You made it to the Fe-nish line! |
470470
+-------------------------- ------------------------+
471471
\\/
@@ -490,12 +490,12 @@ If you noticed any issues, please don't hesitate to report them to our repo.
490490
You can also contribute your own exercises to help the greater community!
491491
492492
Before reporting an issue or contributing, please read our guidelines:
493-
https://github.com/rust-lang/rustlings/blob/main/CONTRIBUTING.md"#;
493+
https://github.com/rust-lang/rustlings/blob/main/CONTRIBUTING.md";
494494

495-
const WELCOME: &str = r#" welcome to...
495+
const WELCOME: &str = r" welcome to...
496496
_ _ _
497497
_ __ _ _ ___| |_| (_)_ __ __ _ ___
498498
| '__| | | / __| __| | | '_ \ / _` / __|
499499
| | | |_| \__ \ |_| | | | | | (_| \__ \
500500
|_| \__,_|___/\__|_|_|_| |_|\__, |___/
501-
|___/"#;
501+
|___/";

src/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl RustAnalyzerProject {
8686

8787
println!("Determined toolchain: {}\n", &toolchain);
8888

89-
self.sysroot_src = (std::path::Path::new(&*toolchain)
89+
self.sysroot_src = (std::path::Path::new(toolchain)
9090
.join("lib")
9191
.join("rustlib")
9292
.join("src")

src/verify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ fn compile_and_test(
134134

135135
// Compile the given Exercise and return an object with information
136136
// about the state of the compilation
137-
fn compile<'a, 'b>(
137+
fn compile<'a>(
138138
exercise: &'a Exercise,
139-
progress_bar: &'b ProgressBar,
139+
progress_bar: &ProgressBar,
140140
) -> Result<CompiledExercise<'a>, ()> {
141141
let compilation_result = exercise.compile();
142142

tests/integration_tests.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn verify_fails_if_some_fails() {
4444
fn run_single_compile_success() {
4545
Command::cargo_bin("rustlings")
4646
.unwrap()
47-
.args(&["run", "compSuccess"])
47+
.args(["run", "compSuccess"])
4848
.current_dir("tests/fixture/success/")
4949
.assert()
5050
.success();
@@ -54,7 +54,7 @@ fn run_single_compile_success() {
5454
fn run_single_compile_failure() {
5555
Command::cargo_bin("rustlings")
5656
.unwrap()
57-
.args(&["run", "compFailure"])
57+
.args(["run", "compFailure"])
5858
.current_dir("tests/fixture/failure/")
5959
.assert()
6060
.code(1);
@@ -64,7 +64,7 @@ fn run_single_compile_failure() {
6464
fn run_single_test_success() {
6565
Command::cargo_bin("rustlings")
6666
.unwrap()
67-
.args(&["run", "testSuccess"])
67+
.args(["run", "testSuccess"])
6868
.current_dir("tests/fixture/success/")
6969
.assert()
7070
.success();
@@ -74,7 +74,7 @@ fn run_single_test_success() {
7474
fn run_single_test_failure() {
7575
Command::cargo_bin("rustlings")
7676
.unwrap()
77-
.args(&["run", "testFailure"])
77+
.args(["run", "testFailure"])
7878
.current_dir("tests/fixture/failure/")
7979
.assert()
8080
.code(1);
@@ -84,7 +84,7 @@ fn run_single_test_failure() {
8484
fn run_single_test_not_passed() {
8585
Command::cargo_bin("rustlings")
8686
.unwrap()
87-
.args(&["run", "testNotPassed.rs"])
87+
.args(["run", "testNotPassed.rs"])
8888
.current_dir("tests/fixture/failure/")
8989
.assert()
9090
.code(1);
@@ -104,7 +104,7 @@ fn run_single_test_no_filename() {
104104
fn run_single_test_no_exercise() {
105105
Command::cargo_bin("rustlings")
106106
.unwrap()
107-
.args(&["run", "compNoExercise.rs"])
107+
.args(["run", "compNoExercise.rs"])
108108
.current_dir("tests/fixture/failure")
109109
.assert()
110110
.code(1);
@@ -114,7 +114,7 @@ fn run_single_test_no_exercise() {
114114
fn reset_single_exercise() {
115115
Command::cargo_bin("rustlings")
116116
.unwrap()
117-
.args(&["reset", "intro1"])
117+
.args(["reset", "intro1"])
118118
.assert()
119119
.code(0);
120120
}
@@ -135,7 +135,7 @@ fn reset_no_exercise() {
135135
fn get_hint_for_single_test() {
136136
Command::cargo_bin("rustlings")
137137
.unwrap()
138-
.args(&["hint", "testFailure"])
138+
.args(["hint", "testFailure"])
139139
.current_dir("tests/fixture/failure")
140140
.assert()
141141
.code(0)
@@ -171,7 +171,7 @@ fn all_exercises_require_confirmation() {
171171
fn run_compile_exercise_does_not_prompt() {
172172
Command::cargo_bin("rustlings")
173173
.unwrap()
174-
.args(&["run", "pending_exercise"])
174+
.args(["run", "pending_exercise"])
175175
.current_dir("tests/fixture/state")
176176
.assert()
177177
.code(0)
@@ -182,7 +182,7 @@ fn run_compile_exercise_does_not_prompt() {
182182
fn run_test_exercise_does_not_prompt() {
183183
Command::cargo_bin("rustlings")
184184
.unwrap()
185-
.args(&["run", "pending_test_exercise"])
185+
.args(["run", "pending_test_exercise"])
186186
.current_dir("tests/fixture/state")
187187
.assert()
188188
.code(0)
@@ -193,7 +193,7 @@ fn run_test_exercise_does_not_prompt() {
193193
fn run_single_test_success_with_output() {
194194
Command::cargo_bin("rustlings")
195195
.unwrap()
196-
.args(&["--nocapture", "run", "testSuccess"])
196+
.args(["--nocapture", "run", "testSuccess"])
197197
.current_dir("tests/fixture/success/")
198198
.assert()
199199
.code(0)
@@ -204,7 +204,7 @@ fn run_single_test_success_with_output() {
204204
fn run_single_test_success_without_output() {
205205
Command::cargo_bin("rustlings")
206206
.unwrap()
207-
.args(&["run", "testSuccess"])
207+
.args(["run", "testSuccess"])
208208
.current_dir("tests/fixture/success/")
209209
.assert()
210210
.code(0)
@@ -215,7 +215,7 @@ fn run_single_test_success_without_output() {
215215
fn run_rustlings_list() {
216216
Command::cargo_bin("rustlings")
217217
.unwrap()
218-
.args(&["list"])
218+
.args(["list"])
219219
.current_dir("tests/fixture/success")
220220
.assert()
221221
.success();
@@ -225,7 +225,7 @@ fn run_rustlings_list() {
225225
fn run_rustlings_list_no_pending() {
226226
Command::cargo_bin("rustlings")
227227
.unwrap()
228-
.args(&["list"])
228+
.args(["list"])
229229
.current_dir("tests/fixture/success")
230230
.assert()
231231
.success()
@@ -236,7 +236,7 @@ fn run_rustlings_list_no_pending() {
236236
fn run_rustlings_list_both_done_and_pending() {
237237
Command::cargo_bin("rustlings")
238238
.unwrap()
239-
.args(&["list"])
239+
.args(["list"])
240240
.current_dir("tests/fixture/state")
241241
.assert()
242242
.success()
@@ -247,7 +247,7 @@ fn run_rustlings_list_both_done_and_pending() {
247247
fn run_rustlings_list_without_pending() {
248248
Command::cargo_bin("rustlings")
249249
.unwrap()
250-
.args(&["list", "--solved"])
250+
.args(["list", "--solved"])
251251
.current_dir("tests/fixture/state")
252252
.assert()
253253
.success()
@@ -258,7 +258,7 @@ fn run_rustlings_list_without_pending() {
258258
fn run_rustlings_list_without_done() {
259259
Command::cargo_bin("rustlings")
260260
.unwrap()
261-
.args(&["list", "--unsolved"])
261+
.args(["list", "--unsolved"])
262262
.current_dir("tests/fixture/state")
263263
.assert()
264264
.success()

0 commit comments

Comments
 (0)