Skip to content

Commit 29a7057

Browse files
committed
Fix adjacent code
1 parent add771f commit 29a7057

40 files changed

+78
-78
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/large_enum_variant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant {
134134
|diag| {
135135
diag.span_label(
136136
def.variants[variants_size[0].ind].span,
137-
&format!("this variant is {} bytes", variants_size[0].size),
137+
format!("this variant is {} bytes", variants_size[0].size),
138138
);
139139
diag.span_note(
140140
def.variants[variants_size[1].ind].span,
141-
&format!("and the second-largest variant is {} bytes:", variants_size[1].size),
141+
format!("and the second-largest variant is {} bytes:", variants_size[1].size),
142142
);
143143

144144
let fields = def.variants[variants_size[0].ind].data.fields();

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
@@ -414,7 +414,7 @@ pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore, sess: &Se
414414

415415
let msrv = conf.msrv.as_ref().and_then(|s| {
416416
parse_msrv(s, None, None).or_else(|| {
417-
sess.err(&format!(
417+
sess.err(format!(
418418
"error reading Clippy's configuration file. `{}` is not a valid Rust version",
419419
s
420420
));
@@ -432,7 +432,7 @@ fn read_msrv(conf: &Conf, sess: &Session) -> Option<RustcVersion> {
432432
.and_then(|v| parse_msrv(&v, None, None));
433433
let clippy_msrv = conf.msrv.as_ref().and_then(|s| {
434434
parse_msrv(s, None, None).or_else(|| {
435-
sess.err(&format!(
435+
sess.err(format!(
436436
"error reading Clippy's configuration file. `{}` is not a valid Rust version",
437437
s
438438
));
@@ -444,7 +444,7 @@ fn read_msrv(conf: &Conf, sess: &Session) -> Option<RustcVersion> {
444444
if let Some(clippy_msrv) = clippy_msrv {
445445
// if both files have an msrv, let's compare them and emit a warning if they differ
446446
if clippy_msrv != cargo_msrv {
447-
sess.warn(&format!(
447+
sess.warn(format!(
448448
"the MSRV in `clippy.toml` and `Cargo.toml` differ; using `{}` from `clippy.toml`",
449449
clippy_msrv
450450
));
@@ -465,7 +465,7 @@ pub fn read_conf(sess: &Session) -> Conf {
465465
Ok(Some(path)) => path,
466466
Ok(None) => return Conf::default(),
467467
Err(error) => {
468-
sess.struct_err(&format!("error finding Clippy's configuration file: {}", error))
468+
sess.struct_err(format!("error finding Clippy's configuration file: {}", error))
469469
.emit();
470470
return Conf::default();
471471
},

0 commit comments

Comments
 (0)