dogfood: fix few lint issues

This commit is contained in:
klensy 2025-06-18 12:59:56 +03:00
parent addf309a5a
commit 86a14967f7
2 changed files with 15 additions and 8 deletions

View file

@ -246,8 +246,10 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
for (span, suggestion) in clone_spans {
diag.span_suggestion(
span,
span.get_source_text(cx)
.map_or("change the call to".to_owned(), |src| format!("change `{src}` to")),
span.get_source_text(cx).map_or_else(
|| "change the call to".to_owned(),
|src| format!("change `{src}` to"),
),
suggestion,
Applicability::Unspecified,
);
@ -275,8 +277,10 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
for (span, suggestion) in clone_spans {
diag.span_suggestion(
span,
span.get_source_text(cx)
.map_or("change the call to".to_owned(), |src| format!("change `{src}` to")),
span.get_source_text(cx).map_or_else(
|| "change the call to".to_owned(),
|src| format!("change `{src}` to"),
),
suggestion,
Applicability::Unspecified,
);

View file

@ -22,10 +22,13 @@ fn docs_link(diag: &mut Diag<'_, ()>, lint: &'static Lint) {
{
diag.help(format!(
"for further information visit https://rust-lang.github.io/rust-clippy/{}/index.html#{lint}",
&option_env!("RUST_RELEASE_NUM").map_or("master".to_string(), |n| {
// extract just major + minor version and ignore patch versions
format!("rust-{}", n.rsplit_once('.').unwrap().1)
})
&option_env!("RUST_RELEASE_NUM").map_or_else(
|| "master".to_string(),
|n| {
// extract just major + minor version and ignore patch versions
format!("rust-{}", n.rsplit_once('.').unwrap().1)
}
)
));
}
}