Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy perf warnings #5241

Merged
merged 1 commit into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/ra_hir_ty/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ impl HirDisplay for ApplicationTy {
let data = (*datas)
.as_ref()
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
data.clone().subst(&self.parameters)
data.subst(&self.parameters)
}
};
write!(f, "impl ")?;
Expand Down Expand Up @@ -456,7 +456,7 @@ impl HirDisplay for Ty {
let data = (*datas)
.as_ref()
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
data.clone().subst(&opaque_ty.parameters)
data.subst(&opaque_ty.parameters)
}
};
write!(f, "impl ")?;
Expand Down
6 changes: 2 additions & 4 deletions crates/ra_hir_ty/src/infer/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ impl<'a> InferenceContext<'a> {
ctor: TypeCtor::Tuple { cardinality: num_args as u16 },
parameters,
});
let substs = Substs::build_for_generics(&generic_params)
.push(ty.clone())
.push(arg_ty.clone())
.build();
let substs =
Substs::build_for_generics(&generic_params).push(ty.clone()).push(arg_ty).build();

let trait_env = Arc::clone(&self.trait_env);
let implements_fn_trait =
Expand Down
2 changes: 1 addition & 1 deletion crates/ra_hir_ty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ impl Ty {
let data = (*it)
.as_ref()
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
data.clone().subst(&opaque_ty.parameters)
data.subst(&opaque_ty.parameters)
})
}
};
Expand Down
3 changes: 1 addition & 2 deletions crates/ra_hir_ty/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,7 @@ fn assoc_type_bindings_from_type_bound<'a>(
None => return SmallVec::<[GenericPredicate; 1]>::new(),
Some(t) => t,
};
let projection_ty =
ProjectionTy { associated_ty, parameters: super_trait_ref.substs.clone() };
let projection_ty = ProjectionTy { associated_ty, parameters: super_trait_ref.substs };
let mut preds = SmallVec::with_capacity(
binding.type_ref.as_ref().map_or(0, |_| 1) + binding.bounds.len(),
);
Expand Down
8 changes: 2 additions & 6 deletions crates/ra_syntax/src/ast/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,8 @@ impl ast::UseTree {
Some(it) => it,
None => return self.clone(),
};
let use_tree = make::use_tree(
suffix.clone(),
self.use_tree_list(),
self.alias(),
self.star_token().is_some(),
);
let use_tree =
make::use_tree(suffix, self.use_tree_list(), self.alias(), self.star_token().is_some());
let nested = make::use_tree_list(iter::once(use_tree));
return make::use_tree(prefix.clone(), Some(nested), None, false);

Expand Down
2 changes: 1 addition & 1 deletion crates/test_utils/src/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Fixture {
let components = meta.split_ascii_whitespace().collect::<Vec<_>>();

let path = components[0].to_string();
assert!(path.starts_with("/"));
assert!(path.starts_with('/'));

let mut krate = None;
let mut deps = Vec::new();
Expand Down