Skip to content

Commit 3258fab

Browse files
committed
Fix adjacent code
1 parent 0cbcc04 commit 3258fab

39 files changed

+76
-76
lines changed

clippy_dev/src/bless.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn update_reference_file(test_output_entry: &DirEntry, ignore_timestamp: bool) {
4343
if test_output_file != reference_file {
4444
// If a test run caused an output file to change, update the reference file
4545
println!("updating {}", reference_file_path.display());
46-
fs::copy(test_output_path, &reference_file_path).expect("Could not update reference file");
46+
fs::copy(test_output_path, reference_file_path).expect("Could not update reference file");
4747
}
4848
}
4949

clippy_dev/src/fmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn exec(
169169
if !context.check && !success {
170170
let stderr = std::str::from_utf8(&output.stderr).unwrap_or("");
171171
return Err(CliError::CommandFailed(
172-
format_command(&program, &dir, args),
172+
format_command(program, dir, args),
173173
String::from(stderr),
174174
));
175175
}
@@ -207,7 +207,7 @@ fn rustfmt_test(context: &FmtContext) -> Result<(), CliError> {
207207
Err(CliError::RustfmtNotInstalled)
208208
} else {
209209
Err(CliError::CommandFailed(
210-
format_command(program, &dir, args),
210+
format_command(program, dir, args),
211211
std::str::from_utf8(&output.stderr).unwrap_or("").to_string(),
212212
))
213213
}

clippy_dev/src/new_lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn create_test(lint: &LintData<'_>) -> io::Result<()> {
9898
fs::create_dir(&test_dir)?;
9999

100100
create_project_layout(lint.name, &test_dir, "fail", "Content that triggers the lint goes here")?;
101-
create_project_layout(lint.name, &test_dir, "pass", "This file should not trigger the lint")?;
101+
create_project_layout(lint.name, test_dir, "pass", "This file should not trigger the lint")?;
102102

103103
println!("Generated test directories: `{relative_test_dir}/pass`, `{relative_test_dir}/fail`");
104104
} else {

clippy_dev/src/serve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn mtime(path: impl AsRef<Path>) -> SystemTime {
4949
.into_iter()
5050
.flatten()
5151
.flatten()
52-
.map(|entry| mtime(&entry.path()))
52+
.map(|entry| mtime(entry.path()))
5353
.max()
5454
.unwrap_or(SystemTime::UNIX_EPOCH)
5555
} else {

clippy_lints/src/casts/cast_slice_different_sizes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, msrv: Optio
5454

5555
diag.span_suggestion(
5656
expr.span,
57-
&format!("replace with `ptr::slice_from_raw_parts{mutbl_fn_str}`"),
57+
format!("replace with `ptr::slice_from_raw_parts{mutbl_fn_str}`"),
5858
sugg,
5959
rustc_errors::Applicability::HasPlaceholders,
6060
);

clippy_lints/src/disallowed_methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedMethods {
106106
reason: Some(reason), ..
107107
} = conf
108108
{
109-
diag.note(&format!("{} (from clippy.toml)", reason));
109+
diag.note(format!("{} (from clippy.toml)", reason));
110110
}
111111
});
112112
}

clippy_lints/src/format_args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn check_format_in_format_args(cx: &LateContext<'_>, call_site: Span, name: Symb
114114
call_site,
115115
&format!("`format!` in `{}!` args", name),
116116
|diag| {
117-
diag.help(&format!(
117+
diag.help(format!(
118118
"combine the `format!(..)` arguments with the outer `{}!(..)` call",
119119
name
120120
));

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fn check_for_is_empty<'tcx>(
364364
db.span_note(span, "`is_empty` defined here");
365365
}
366366
if let Some(self_kind) = self_kind {
367-
db.note(&output.expected_sig(self_kind));
367+
db.note(output.expected_sig(self_kind));
368368
}
369369
});
370370
}

clippy_lints/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore, sess: &Se
417417

418418
let msrv = conf.msrv.as_ref().and_then(|s| {
419419
parse_msrv(s, None, None).or_else(|| {
420-
sess.err(&format!(
420+
sess.err(format!(
421421
"error reading Clippy's configuration file. `{}` is not a valid Rust version",
422422
s
423423
));
@@ -435,7 +435,7 @@ fn read_msrv(conf: &Conf, sess: &Session) -> Option<RustcVersion> {
435435
.and_then(|v| parse_msrv(&v, None, None));
436436
let clippy_msrv = conf.msrv.as_ref().and_then(|s| {
437437
parse_msrv(s, None, None).or_else(|| {
438-
sess.err(&format!(
438+
sess.err(format!(
439439
"error reading Clippy's configuration file. `{}` is not a valid Rust version",
440440
s
441441
));
@@ -447,7 +447,7 @@ fn read_msrv(conf: &Conf, sess: &Session) -> Option<RustcVersion> {
447447
if let Some(clippy_msrv) = clippy_msrv {
448448
// if both files have an msrv, let's compare them and emit a warning if they differ
449449
if clippy_msrv != cargo_msrv {
450-
sess.warn(&format!(
450+
sess.warn(format!(
451451
"the MSRV in `clippy.toml` and `Cargo.toml` differ; using `{}` from `clippy.toml`",
452452
clippy_msrv
453453
));
@@ -468,7 +468,7 @@ pub fn read_conf(sess: &Session) -> Conf {
468468
Ok(Some(path)) => path,
469469
Ok(None) => return Conf::default(),
470470
Err(error) => {
471-
sess.struct_err(&format!("error finding Clippy's configuration file: {}", error))
471+
sess.struct_err(format!("error finding Clippy's configuration file: {}", error))
472472
.emit();
473473
return Conf::default();
474474
},

clippy_lints/src/loops/explicit_counter_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub(super) fn check<'tcx>(
8080
applicability,
8181
);
8282

83-
diag.note(&format!(
83+
diag.note(format!(
8484
"`{}` is of type `{}`, making it ineligible for `Iterator::enumerate`",
8585
name, int_name
8686
));

0 commit comments

Comments
 (0)