diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-18 14:37:34 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-18 14:37:34 +0000 |
commit | cecf25b72f2af84fc1535cf52d6f3c1b52802565 (patch) | |
tree | 37c8dde0a459caacae6629da08d86be270469ef5 /crates/ra_hir_ty/src/traits/builtin.rs | |
parent | eab80cd961919b9321e1d34343ae3f3adb0502e5 (diff) | |
parent | f6816c253b96e8436f1156d6bd6b0942ee9fb4d3 (diff) |
Merge #3220
3220: Fix clippy warnings, update Cargo.toml versions r=matklad a=SomeoneToIgnore
In the `cargo xtask lint` ouptut, there were two interesting Clippy warnings that might be interesting to investigate further:
* warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
* warning: large size difference between variants
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/traits/builtin.rs')
-rw-r--r-- | crates/ra_hir_ty/src/traits/builtin.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir_ty/src/traits/builtin.rs b/crates/ra_hir_ty/src/traits/builtin.rs index dd41176f0..a537420a5 100644 --- a/crates/ra_hir_ty/src/traits/builtin.rs +++ b/crates/ra_hir_ty/src/traits/builtin.rs | |||
@@ -98,7 +98,7 @@ fn closure_fn_trait_impl_datum( | |||
98 | // the existence of the Fn trait has been checked before | 98 | // the existence of the Fn trait has been checked before |
99 | .expect("fn trait for closure impl missing"); | 99 | .expect("fn trait for closure impl missing"); |
100 | 100 | ||
101 | let num_args: u16 = match &db.body(data.def.into())[data.expr] { | 101 | let num_args: u16 = match &db.body(data.def)[data.expr] { |
102 | Expr::Lambda { args, .. } => args.len() as u16, | 102 | Expr::Lambda { args, .. } => args.len() as u16, |
103 | _ => { | 103 | _ => { |
104 | log::warn!("closure for closure type {:?} not found", data); | 104 | log::warn!("closure for closure type {:?} not found", data); |
@@ -118,11 +118,11 @@ fn closure_fn_trait_impl_datum( | |||
118 | let self_ty = Ty::apply_one(TypeCtor::Closure { def: data.def, expr: data.expr }, sig_ty); | 118 | let self_ty = Ty::apply_one(TypeCtor::Closure { def: data.def, expr: data.expr }, sig_ty); |
119 | 119 | ||
120 | let trait_ref = TraitRef { | 120 | let trait_ref = TraitRef { |
121 | trait_: trait_.into(), | 121 | trait_, |
122 | substs: Substs::build_for_def(db, trait_).push(self_ty).push(arg_ty).build(), | 122 | substs: Substs::build_for_def(db, trait_).push(self_ty).push(arg_ty).build(), |
123 | }; | 123 | }; |
124 | 124 | ||
125 | let output_ty_id = AssocTyValue::ClosureFnTraitImplOutput(data.clone()); | 125 | let output_ty_id = AssocTyValue::ClosureFnTraitImplOutput(data); |
126 | 126 | ||
127 | BuiltinImplData { | 127 | BuiltinImplData { |
128 | num_vars: num_args as usize + 1, | 128 | num_vars: num_args as usize + 1, |
@@ -137,9 +137,9 @@ fn closure_fn_trait_output_assoc_ty_value( | |||
137 | krate: CrateId, | 137 | krate: CrateId, |
138 | data: super::ClosureFnTraitImplData, | 138 | data: super::ClosureFnTraitImplData, |
139 | ) -> BuiltinImplAssocTyValueData { | 139 | ) -> BuiltinImplAssocTyValueData { |
140 | let impl_ = Impl::ClosureFnTraitImpl(data.clone()); | 140 | let impl_ = Impl::ClosureFnTraitImpl(data); |
141 | 141 | ||
142 | let num_args: u16 = match &db.body(data.def.into())[data.expr] { | 142 | let num_args: u16 = match &db.body(data.def)[data.expr] { |
143 | Expr::Lambda { args, .. } => args.len() as u16, | 143 | Expr::Lambda { args, .. } => args.len() as u16, |
144 | _ => { | 144 | _ => { |
145 | log::warn!("closure for closure type {:?} not found", data); | 145 | log::warn!("closure for closure type {:?} not found", data); |