mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-26 03:45:04 +00:00
Clippy perf warnings
Removes redundant clones
This commit is contained in:
parent
d4bc2f25de
commit
ebdee366b0
6 changed files with 9 additions and 16 deletions
|
@ -369,7 +369,7 @@ impl HirDisplay for ApplicationTy {
|
||||||
let data = (*datas)
|
let data = (*datas)
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
||||||
data.clone().subst(&self.parameters)
|
data.subst(&self.parameters)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
write!(f, "impl ")?;
|
write!(f, "impl ")?;
|
||||||
|
@ -456,7 +456,7 @@ impl HirDisplay for Ty {
|
||||||
let data = (*datas)
|
let data = (*datas)
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
||||||
data.clone().subst(&opaque_ty.parameters)
|
data.subst(&opaque_ty.parameters)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
write!(f, "impl ")?;
|
write!(f, "impl ")?;
|
||||||
|
|
|
@ -85,10 +85,8 @@ impl<'a> InferenceContext<'a> {
|
||||||
ctor: TypeCtor::Tuple { cardinality: num_args as u16 },
|
ctor: TypeCtor::Tuple { cardinality: num_args as u16 },
|
||||||
parameters,
|
parameters,
|
||||||
});
|
});
|
||||||
let substs = Substs::build_for_generics(&generic_params)
|
let substs =
|
||||||
.push(ty.clone())
|
Substs::build_for_generics(&generic_params).push(ty.clone()).push(arg_ty).build();
|
||||||
.push(arg_ty.clone())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let trait_env = Arc::clone(&self.trait_env);
|
let trait_env = Arc::clone(&self.trait_env);
|
||||||
let implements_fn_trait =
|
let implements_fn_trait =
|
||||||
|
|
|
@ -891,7 +891,7 @@ impl Ty {
|
||||||
let data = (*it)
|
let data = (*it)
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
||||||
data.clone().subst(&opaque_ty.parameters)
|
data.subst(&opaque_ty.parameters)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -720,8 +720,7 @@ fn assoc_type_bindings_from_type_bound<'a>(
|
||||||
None => return SmallVec::<[GenericPredicate; 1]>::new(),
|
None => return SmallVec::<[GenericPredicate; 1]>::new(),
|
||||||
Some(t) => t,
|
Some(t) => t,
|
||||||
};
|
};
|
||||||
let projection_ty =
|
let projection_ty = ProjectionTy { associated_ty, parameters: super_trait_ref.substs };
|
||||||
ProjectionTy { associated_ty, parameters: super_trait_ref.substs.clone() };
|
|
||||||
let mut preds = SmallVec::with_capacity(
|
let mut preds = SmallVec::with_capacity(
|
||||||
binding.type_ref.as_ref().map_or(0, |_| 1) + binding.bounds.len(),
|
binding.type_ref.as_ref().map_or(0, |_| 1) + binding.bounds.len(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -299,12 +299,8 @@ impl ast::UseTree {
|
||||||
Some(it) => it,
|
Some(it) => it,
|
||||||
None => return self.clone(),
|
None => return self.clone(),
|
||||||
};
|
};
|
||||||
let use_tree = make::use_tree(
|
let use_tree =
|
||||||
suffix.clone(),
|
make::use_tree(suffix, self.use_tree_list(), self.alias(), self.star_token().is_some());
|
||||||
self.use_tree_list(),
|
|
||||||
self.alias(),
|
|
||||||
self.star_token().is_some(),
|
|
||||||
);
|
|
||||||
let nested = make::use_tree_list(iter::once(use_tree));
|
let nested = make::use_tree_list(iter::once(use_tree));
|
||||||
return make::use_tree(prefix.clone(), Some(nested), None, false);
|
return make::use_tree(prefix.clone(), Some(nested), None, false);
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl Fixture {
|
||||||
let components = meta.split_ascii_whitespace().collect::<Vec<_>>();
|
let components = meta.split_ascii_whitespace().collect::<Vec<_>>();
|
||||||
|
|
||||||
let path = components[0].to_string();
|
let path = components[0].to_string();
|
||||||
assert!(path.starts_with("/"));
|
assert!(path.starts_with('/'));
|
||||||
|
|
||||||
let mut krate = None;
|
let mut krate = None;
|
||||||
let mut deps = Vec::new();
|
let mut deps = Vec::new();
|
||||||
|
|
Loading…
Reference in a new issue