diff options
| author | klensy <klensy@users.noreply.github.com> | 2025-06-18 12:59:56 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2025-07-06 18:45:29 +0300 |
| commit | 86a14967f73f4c073e448dbbba34d56c8c94484a (patch) | |
| tree | fb7349799e9a61aac7d38abe8311b885ef1047ff | |
| parent | addf309a5a803e69c279c5eec90c33f562766e10 (diff) | |
| download | rust-86a14967f73f4c073e448dbbba34d56c8c94484a.tar.gz rust-86a14967f73f4c073e448dbbba34d56c8c94484a.zip | |
dogfood: fix few lint issues
| -rw-r--r-- | clippy_lints/src/needless_pass_by_value.rs | 12 | ||||
| -rw-r--r-- | clippy_utils/src/diagnostics.rs | 11 |
2 files changed, 15 insertions, 8 deletions
diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index c97ecce75b4..2006a824402 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -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, ); diff --git a/clippy_utils/src/diagnostics.rs b/clippy_utils/src/diagnostics.rs index dc240dd067b..1505c8a4b87 100644 --- a/clippy_utils/src/diagnostics.rs +++ b/clippy_utils/src/diagnostics.rs @@ -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) + } + ) )); } } |
