Skip to content

Commit af7625a

Browse files
committed
dogfood: fix few lint issues
1 parent 55b107a commit af7625a

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,10 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
241241
for (span, suggestion) in clone_spans {
242242
diag.span_suggestion(
243243
span,
244-
span.get_source_text(cx)
245-
.map_or("change the call to".to_owned(), |src| format!("change `{src}` to")),
244+
span.get_source_text(cx).map_or_else(
245+
|| "change the call to".to_owned(),
246+
|src| format!("change `{src}` to"),
247+
),
246248
suggestion,
247249
Applicability::Unspecified,
248250
);
@@ -270,8 +272,10 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
270272
for (span, suggestion) in clone_spans {
271273
diag.span_suggestion(
272274
span,
273-
span.get_source_text(cx)
274-
.map_or("change the call to".to_owned(), |src| format!("change `{src}` to")),
275+
span.get_source_text(cx).map_or_else(
276+
|| "change the call to".to_owned(),
277+
|src| format!("change `{src}` to"),
278+
),
275279
suggestion,
276280
Applicability::Unspecified,
277281
);

clippy_utils/src/diagnostics.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ fn docs_link(diag: &mut Diag<'_, ()>, lint: &'static Lint) {
2222
{
2323
diag.help(format!(
2424
"for further information visit https://rust-lang.github.io/rust-clippy/{}/index.html#{lint}",
25-
&option_env!("RUST_RELEASE_NUM").map_or("master".to_string(), |n| {
26-
// extract just major + minor version and ignore patch versions
27-
format!("rust-{}", n.rsplit_once('.').unwrap().1)
28-
})
25+
&option_env!("RUST_RELEASE_NUM").map_or_else(
26+
|| "master".to_string(),
27+
|n| {
28+
// extract just major + minor version and ignore patch versions
29+
format!("rust-{}", n.rsplit_once('.').unwrap().1)
30+
}
31+
)
2932
));
3033
}
3134
}

0 commit comments

Comments
 (0)