1
Fork 0

clippy::perf fixes

This commit is contained in:
Matthias Krüger 2021-08-01 21:26:29 +02:00
parent 4e21ef2a4e
commit a953574ddb
3 changed files with 7 additions and 7 deletions

View file

@ -369,10 +369,10 @@ impl DebugCounters {
} }
return format!("({})", self.format_counter_kind(counter_kind)); 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())
} }
} }

View file

@ -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 // 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 // the user has written the self type with generics already which we (naively) do by looking
// for a "<" in `self_ty_name`. // 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, _ => 0,
}; };
let self_ty_generics = if self_ty_generics_count > 0 { let self_ty_generics = if self_ty_generics_count > 0 {

View file

@ -222,8 +222,8 @@ impl ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> {
let id_to_set = *ids.iter().min().unwrap(); let id_to_set = *ids.iter().min().unwrap();
// Sort the id list so that the algorithm is deterministic // Sort the id list so that the algorithm is deterministic
let mut ids = ids.into_iter().collect::<SmallVec<[_; 8]>>(); let mut ids = ids.into_iter().collect::<SmallVec<[usize; 8]>>();
ids.sort(); ids.sort_unstable();
let mut region = connected_regions.remove(&id_to_set).unwrap(); let mut region = connected_regions.remove(&id_to_set).unwrap();
region.idents.extend_from_slice(&idents_to_add); 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 each pair of impl blocks in the same connected region.
for (_id, region) in connected_regions.into_iter() { for (_id, region) in connected_regions.into_iter() {
let mut impl_blocks = let mut impl_blocks =
region.impl_blocks.into_iter().collect::<SmallVec<[_; 8]>>(); region.impl_blocks.into_iter().collect::<SmallVec<[usize; 8]>>();
impl_blocks.sort(); impl_blocks.sort_unstable();
for (i, &impl1_items_idx) in impl_blocks.iter().enumerate() { for (i, &impl1_items_idx) in impl_blocks.iter().enumerate() {
let &(&impl1_def_id, impl_items1) = &impls_items[impl1_items_idx]; let &(&impl1_def_id, impl_items1) = &impls_items[impl1_items_idx];
for &impl2_items_idx in impl_blocks[(i + 1)..].iter() { for &impl2_items_idx in impl_blocks[(i + 1)..].iter() {