Rollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obk

more clippy::perf fixes
This commit is contained in:
Dylan DPC 2022-09-05 14:15:52 +05:30 committed by GitHub
commit e4534fe6fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 19 deletions

View file

@ -2367,9 +2367,9 @@ pub(crate) fn get_filtered_impls_for_reference<'a>(
let Some(v) = shared.cache.impls.get(&def_id) else { return (Vec::new(), Vec::new(), Vec::new()) };
// Since there is no "direct implementation" on the reference primitive type, we filter out
// every implementation which isn't a trait implementation.
let traits: Vec<_> = v.iter().filter(|i| i.inner_impl().trait_.is_some()).collect();
let traits = v.iter().filter(|i| i.inner_impl().trait_.is_some());
let (synthetic, concrete): (Vec<&Impl>, Vec<&Impl>) =
traits.into_iter().partition(|t| t.inner_impl().kind.is_auto());
traits.partition(|t| t.inner_impl().kind.is_auto());
let (blanket_impl, concrete): (Vec<&Impl>, _) =
concrete.into_iter().partition(|t| t.inner_impl().kind.is_blanket());

View file

@ -312,7 +312,7 @@ pub(super) fn write_shared(
if line.starts_with(&prefix) {
continue;
}
if line.ends_with(",") {
if line.ends_with(',') {
ret.push(line[..line.len() - 1].to_string());
} else {
// No comma (it's the case for the last added crate line)