diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-23 19:56:35 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-23 19:56:35 +0100 |
| commit | 86a7fc840f11cd1f20fdf26d3071e34a2d4bc313 (patch) | |
| tree | 825af3e5f80cc4cb41aca59fe20467a382b2ae22 /compiler/rustc_borrowck/src/diagnostics | |
| parent | b6a23b853719c8c22c022993c9eb2871b09fc2b9 (diff) | |
| download | rust-86a7fc840f11cd1f20fdf26d3071e34a2d4bc313.tar.gz rust-86a7fc840f11cd1f20fdf26d3071e34a2d4bc313.zip | |
compiler: clippy::complexity fixes
Diffstat (limited to 'compiler/rustc_borrowck/src/diagnostics')
3 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index e1509da913a..3c6bd1d36fd 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -1559,7 +1559,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { // A bare path doesn't need a `let` assignment, it's already a simple // binding access. // As a new binding wasn't added, we don't need to modify the advancing call. - sugg.push((loop_span.with_hi(pat_span.lo()), format!("while let Some("))); + sugg.push((loop_span.with_hi(pat_span.lo()), "while let Some(".to_string())); sugg.push(( pat_span.shrink_to_hi().with_hi(head.span.lo()), ") = ".to_string(), diff --git a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs index b2c7a98142e..6beae61ca7f 100644 --- a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs +++ b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs @@ -134,14 +134,13 @@ impl OutlivesSuggestionBuilder { for (r, bound) in unified.into_iter() { if !unified_already.contains(fr) { - suggested.push(SuggestedConstraint::Equal(fr_name.clone(), bound)); + suggested.push(SuggestedConstraint::Equal(fr_name, bound)); unified_already.insert(r); } } if !other.is_empty() { - let other = - other.iter().map(|(_, rname)| rname.clone()).collect::<SmallVec<_>>(); + let other = other.iter().map(|(_, rname)| *rname).collect::<SmallVec<_>>(); suggested.push(SuggestedConstraint::Outlives(fr_name, other)) } } diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 50d22881c3e..e586c58781c 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -280,7 +280,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { .iter() .rfind(|param| param.def_id.to_def_id() == defid) .is_some() { - suggestions.push((bounded_span.shrink_to_hi(), format!(" + 'static"))); + suggestions.push((bounded_span.shrink_to_hi(), " + 'static".to_string())); } }); }); |
