Skip to content

Commit 86a1496

Browse files
committed
dogfood: fix few lint issues
1 parent addf309 commit 86a1496

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
@@ -246,8 +246,10 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
246246
for (span, suggestion) in clone_spans {
247247
diag.span_suggestion(
248248
span,
249-
span.get_source_text(cx)
250-
.map_or("change the call to".to_owned(), |src| format!("change `{src}` to")),
249+
span.get_source_text(cx).map_or_else(
250+
|| "change the call to".to_owned(),
251+
|src| format!("change `{src}` to"),
252+
),
251253
suggestion,
252254
Applicability::Unspecified,
253255
);
@@ -275,8 +277,10 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
275277
for (span, suggestion) in clone_spans {
276278
diag.span_suggestion(
277279
span,
278-
span.get_source_text(cx)
279-
.map_or("change the call to".to_owned(), |src| format!("change `{src}` to")),
280+
span.get_source_text(cx).map_or_else(
281+
|| "change the call to".to_owned(),
282+
|src| format!("change `{src}` to"),
283+
),
280284
suggestion,
281285
Applicability::Unspecified,
282286
);

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)