remove needless borrows

This commit is contained in:
Daniel Eades 2022-12-30 08:05:03 +00:00
parent 77051679d7
commit ed128872eb
53 changed files with 87 additions and 87 deletions

View file

@ -404,7 +404,7 @@ pub(crate) fn path_to_const(
args_lazy: impl FnOnce() -> Generics,
debruijn: DebruijnIndex,
) -> Option<Const> {
match resolver.resolve_path_in_value_ns_fully(db.upcast(), &path) {
match resolver.resolve_path_in_value_ns_fully(db.upcast(), path) {
Some(ValueNs::GenericParam(p)) => {
let ty = db.const_param_ty(p);
let args = args_lazy();

View file

@ -1335,7 +1335,7 @@ impl<'a> InferenceContext<'a> {
ty,
c,
ParamLoweringMode::Placeholder,
|| generics(this.db.upcast(), (&this.resolver).generic_def().unwrap()),
|| generics(this.db.upcast(), this.resolver.generic_def().unwrap()),
DebruijnIndex::INNERMOST,
)
},

View file

@ -153,7 +153,7 @@ impl<'a> InferenceContext<'a> {
) -> Ty {
let mut expected = self.resolve_ty_shallow(expected);
if is_non_ref_pat(&self.body, pat) {
if is_non_ref_pat(self.body, pat) {
let mut pat_adjustments = Vec::new();
while let Some((inner, _lifetime, mutability)) = expected.as_reference() {
pat_adjustments.push(expected.clone());

View file

@ -241,7 +241,7 @@ pub fn layout_of_ty(db: &dyn HirDatabase, ty: &Ty, krate: CrateId) -> Result<Lay
fn layout_of_unit(cx: &LayoutCx<'_>, dl: &TargetDataLayout) -> Result<Layout, LayoutError> {
cx.univariant::<RustcEnumVariantIdx, &&Layout>(
&dl,
dl,
&[],
&ReprOptions::default(),
StructKind::AlwaysSized,

View file

@ -12,8 +12,7 @@ use super::layout_of_ty;
fn eval_goal(ra_fixture: &str, minicore: &str) -> Result<Layout, LayoutError> {
// using unstable cargo features failed, fall back to using plain rustc
let mut cmd = std::process::Command::new("rustc");
cmd.args(&["-Z", "unstable-options", "--print", "target-spec-json"])
.env("RUSTC_BOOTSTRAP", "1");
cmd.args(["-Z", "unstable-options", "--print", "target-spec-json"]).env("RUSTC_BOOTSTRAP", "1");
let output = cmd.output().unwrap();
assert!(output.status.success(), "{}", output.status);
let stdout = String::from_utf8(output.stdout).unwrap();

View file

@ -780,7 +780,7 @@ impl<'a> TyLoweringContext<'a> {
|_, c, ty| {
const_or_path_to_chalk(
self.db,
&self.resolver,
self.resolver,
ty,
c,
self.type_param_mode,
@ -1852,7 +1852,7 @@ pub(crate) fn return_type_impl_traits(
let ctx_ret = TyLoweringContext::new(db, &resolver)
.with_impl_trait_mode(ImplTraitLoweringMode::Opaque)
.with_type_param_mode(ParamLoweringMode::Variable);
let _ret = (&ctx_ret).lower_ty(&data.ret_type);
let _ret = ctx_ret.lower_ty(&data.ret_type);
let generics = generics(db.upcast(), def.into());
let return_type_impl_traits =
ReturnTypeImplTraits { impl_traits: ctx_ret.opaque_type_data.into_inner() };

View file

@ -926,7 +926,7 @@ fn iterate_method_candidates_by_receiver(
while let Some((self_ty, _)) = autoderef.next() {
iterate_inherent_methods(
&self_ty,
&mut autoderef.table,
autoderef.table,
name,
Some(&receiver_ty),
Some(receiver_adjustments.clone()),
@ -941,7 +941,7 @@ fn iterate_method_candidates_by_receiver(
while let Some((self_ty, _)) = autoderef.next() {
iterate_trait_method_candidates(
&self_ty,
&mut autoderef.table,
autoderef.table,
traits_in_scope,
name,
Some(&receiver_ty),
@ -1246,7 +1246,7 @@ fn is_valid_candidate(
let expected_self_ty = TyBuilder::impl_self_ty(db, impl_id)
.fill_with_inference_vars(table)
.build();
table.unify(&expected_self_ty, &self_ty)
table.unify(&expected_self_ty, self_ty)
});
if !self_ty_matches {
cov_mark::hit!(const_candidate_self_type_mismatch);