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/infer.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/infer.rs')
-rw-r--r-- | crates/ra_hir_ty/src/infer.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs index a9d958c8b..76069eb9c 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/ra_hir_ty/src/infer.rs | |||
@@ -225,14 +225,14 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
225 | coerce_unsized_map: Self::init_coerce_unsized_map(db, &resolver), | 225 | coerce_unsized_map: Self::init_coerce_unsized_map(db, &resolver), |
226 | db, | 226 | db, |
227 | owner, | 227 | owner, |
228 | body: db.body(owner.into()), | 228 | body: db.body(owner), |
229 | resolver, | 229 | resolver, |
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | fn resolve_all(mut self) -> InferenceResult { | 233 | fn resolve_all(mut self) -> InferenceResult { |
234 | // FIXME resolve obligations as well (use Guidance if necessary) | 234 | // FIXME resolve obligations as well (use Guidance if necessary) |
235 | let mut result = mem::replace(&mut self.result, InferenceResult::default()); | 235 | let mut result = std::mem::take(&mut self.result); |
236 | for ty in result.type_of_expr.values_mut() { | 236 | for ty in result.type_of_expr.values_mut() { |
237 | let resolved = self.table.resolve_ty_completely(mem::replace(ty, Ty::Unknown)); | 237 | let resolved = self.table.resolve_ty_completely(mem::replace(ty, Ty::Unknown)); |
238 | *ty = resolved; | 238 | *ty = resolved; |
@@ -261,7 +261,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
261 | } | 261 | } |
262 | 262 | ||
263 | fn write_assoc_resolution(&mut self, id: ExprOrPatId, item: AssocItemId) { | 263 | fn write_assoc_resolution(&mut self, id: ExprOrPatId, item: AssocItemId) { |
264 | self.result.assoc_resolutions.insert(id, item.into()); | 264 | self.result.assoc_resolutions.insert(id, item); |
265 | } | 265 | } |
266 | 266 | ||
267 | fn write_pat_ty(&mut self, pat: PatId, ty: Ty) { | 267 | fn write_pat_ty(&mut self, pat: PatId, ty: Ty) { |
@@ -312,9 +312,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
312 | for obligation in obligations { | 312 | for obligation in obligations { |
313 | let in_env = InEnvironment::new(self.trait_env.clone(), obligation.clone()); | 313 | let in_env = InEnvironment::new(self.trait_env.clone(), obligation.clone()); |
314 | let canonicalized = self.canonicalizer().canonicalize_obligation(in_env); | 314 | let canonicalized = self.canonicalizer().canonicalize_obligation(in_env); |
315 | let solution = self | 315 | let solution = |
316 | .db | 316 | self.db.trait_solve(self.resolver.krate().unwrap(), canonicalized.value.clone()); |
317 | .trait_solve(self.resolver.krate().unwrap().into(), canonicalized.value.clone()); | ||
318 | 317 | ||
319 | match solution { | 318 | match solution { |
320 | Some(Solution::Unique(substs)) => { | 319 | Some(Solution::Unique(substs)) => { |