diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-08-01 21:26:29 +0200 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2021-08-01 23:44:54 +0200 |
| commit | a953574ddb85dcf25317a78fca7adfbb1f2c3d6c (patch) | |
| tree | de93666faae02926c8c3469e1442939c98d38522 | |
| parent | 4e21ef2a4eca12180e24a345d66066fc1e4e36da (diff) | |
| download | rust-a953574ddb85dcf25317a78fca7adfbb1f2c3d6c.tar.gz rust-a953574ddb85dcf25317a78fca7adfbb1f2c3d6c.zip | |
clippy::perf fixes
| -rw-r--r-- | compiler/rustc_mir/src/transform/coverage/debug.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/check/method/prelude2021.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_mir/src/transform/coverage/debug.rs b/compiler/rustc_mir/src/transform/coverage/debug.rs index 6fd7d29d777..464079656f9 100644 --- a/compiler/rustc_mir/src/transform/coverage/debug.rs +++ b/compiler/rustc_mir/src/transform/coverage/debug.rs @@ -369,10 +369,10 @@ impl DebugCounters { } return format!("({})", self.format_counter_kind(counter_kind)); } - return self.format_counter_kind(counter_kind).to_string(); + return self.format_counter_kind(counter_kind); } } - format!("#{}", operand.index().to_string()) + format!("#{}", operand.index()) } } diff --git a/compiler/rustc_typeck/src/check/method/prelude2021.rs b/compiler/rustc_typeck/src/check/method/prelude2021.rs index 9e3292d7821..b5bc9d3599a 100644 --- a/compiler/rustc_typeck/src/check/method/prelude2021.rs +++ b/compiler/rustc_typeck/src/check/method/prelude2021.rs @@ -265,7 +265,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Get the number of generics the self type has (if an Adt) unless we can determine that // the user has written the self type with generics already which we (naively) do by looking // for a "<" in `self_ty_name`. - Adt(def, _) if !self_ty_name.contains("<") => self.tcx.generics_of(def.did).count(), + Adt(def, _) if !self_ty_name.contains('<') => self.tcx.generics_of(def.did).count(), _ => 0, }; let self_ty_generics = if self_ty_generics_count > 0 { diff --git a/compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs b/compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs index f039790eca1..1c36335be81 100644 --- a/compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs +++ b/compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs @@ -222,8 +222,8 @@ impl ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> { let id_to_set = *ids.iter().min().unwrap(); // Sort the id list so that the algorithm is deterministic - let mut ids = ids.into_iter().collect::<SmallVec<[_; 8]>>(); - ids.sort(); + let mut ids = ids.into_iter().collect::<SmallVec<[usize; 8]>>(); + ids.sort_unstable(); let mut region = connected_regions.remove(&id_to_set).unwrap(); region.idents.extend_from_slice(&idents_to_add); @@ -266,8 +266,8 @@ impl ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> { // for each pair of impl blocks in the same connected region. for (_id, region) in connected_regions.into_iter() { let mut impl_blocks = - region.impl_blocks.into_iter().collect::<SmallVec<[_; 8]>>(); - impl_blocks.sort(); + region.impl_blocks.into_iter().collect::<SmallVec<[usize; 8]>>(); + impl_blocks.sort_unstable(); for (i, &impl1_items_idx) in impl_blocks.iter().enumerate() { let &(&impl1_def_id, impl_items1) = &impls_items[impl1_items_idx]; for &impl2_items_idx in impl_blocks[(i + 1)..].iter() { |
