reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats)

This commit is contained in:
Matthias Krüger 2021-01-02 20:09:17 +01:00
parent 90ccf4f5ad
commit 8a90626a46
28 changed files with 89 additions and 91 deletions

View file

@ -351,8 +351,8 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
if let Some(data) = ty_to_fn.get(&ty) {
let (poly_trait, output) =
(data.0.as_ref().expect("as_ref failed").clone(), data.1.as_ref().cloned());
let new_ty = match &poly_trait.trait_ {
&Type::ResolvedPath {
let new_ty = match poly_trait.trait_ {
Type::ResolvedPath {
ref path,
ref param_names,
ref did,

View file

@ -179,12 +179,12 @@ crate fn get_real_types(
if arg.is_full_generic() {
let arg_s = Symbol::intern(&arg.print().to_string());
if let Some(where_pred) = generics.where_predicates.iter().find(|g| match g {
&WherePredicate::BoundPredicate { ref ty, .. } => ty.def_id() == arg.def_id(),
WherePredicate::BoundPredicate { ty, .. } => ty.def_id() == arg.def_id(),
_ => false,
}) {
let bounds = where_pred.get_bounds().unwrap_or_else(|| &[]);
for bound in bounds.iter() {
if let GenericBound::TraitBound(ref poly_trait, _) = *bound {
if let GenericBound::TraitBound(poly_trait, _) = bound {
for x in poly_trait.generic_params.iter() {
if !x.is_type() {
continue;