diff options
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index a2dc92370..9228dd314 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -116,16 +116,16 @@ pub struct InferenceResult { | |||
116 | 116 | ||
117 | impl InferenceResult { | 117 | impl InferenceResult { |
118 | pub fn method_resolution(&self, expr: ExprId) -> Option<Function> { | 118 | pub fn method_resolution(&self, expr: ExprId) -> Option<Function> { |
119 | self.method_resolutions.get(&expr).map(|it| *it) | 119 | self.method_resolutions.get(&expr).copied() |
120 | } | 120 | } |
121 | pub fn field_resolution(&self, expr: ExprId) -> Option<StructField> { | 121 | pub fn field_resolution(&self, expr: ExprId) -> Option<StructField> { |
122 | self.field_resolutions.get(&expr).map(|it| *it) | 122 | self.field_resolutions.get(&expr).copied() |
123 | } | 123 | } |
124 | pub fn assoc_resolutions_for_expr(&self, id: ExprId) -> Option<ImplItem> { | 124 | pub fn assoc_resolutions_for_expr(&self, id: ExprId) -> Option<ImplItem> { |
125 | self.assoc_resolutions.get(&id.into()).map(|it| *it) | 125 | self.assoc_resolutions.get(&id.into()).copied() |
126 | } | 126 | } |
127 | pub fn assoc_resolutions_for_pat(&self, id: PatId) -> Option<ImplItem> { | 127 | pub fn assoc_resolutions_for_pat(&self, id: PatId) -> Option<ImplItem> { |
128 | self.assoc_resolutions.get(&id.into()).map(|it| *it) | 128 | self.assoc_resolutions.get(&id.into()).copied() |
129 | } | 129 | } |
130 | pub(crate) fn add_diagnostics( | 130 | pub(crate) fn add_diagnostics( |
131 | &self, | 131 | &self, |
@@ -239,8 +239,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
239 | &self.resolver, | 239 | &self.resolver, |
240 | type_ref, | 240 | type_ref, |
241 | ); | 241 | ); |
242 | let ty = self.insert_type_vars(ty); | 242 | self.insert_type_vars(ty) |
243 | ty | ||
244 | } | 243 | } |
245 | 244 | ||
246 | fn unify_substs(&mut self, substs1: &Substs, substs2: &Substs, depth: usize) -> bool { | 245 | fn unify_substs(&mut self, substs1: &Substs, substs2: &Substs, depth: usize) -> bool { |
@@ -973,8 +972,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
973 | 972 | ||
974 | for (arg_pat, arg_type) in args.iter().zip(arg_types.iter()) { | 973 | for (arg_pat, arg_type) in args.iter().zip(arg_types.iter()) { |
975 | let expected = if let Some(type_ref) = arg_type { | 974 | let expected = if let Some(type_ref) = arg_type { |
976 | let ty = self.make_ty(type_ref); | 975 | self.make_ty(type_ref) |
977 | ty | ||
978 | } else { | 976 | } else { |
979 | Ty::Unknown | 977 | Ty::Unknown |
980 | }; | 978 | }; |