aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/coerce.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/infer/coerce.rs')
-rw-r--r--crates/hir_ty/src/infer/coerce.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs
index 765a02b1c..03b97e7db 100644
--- a/crates/hir_ty/src/infer/coerce.rs
+++ b/crates/hir_ty/src/infer/coerce.rs
@@ -76,17 +76,17 @@ impl<'a> InferenceContext<'a> {
76 // way around first would mean we make the type variable `!`, instead of 76 // way around first would mean we make the type variable `!`, instead of
77 // just marking it as possibly diverging. 77 // just marking it as possibly diverging.
78 if self.coerce(&ty2, &ty1) { 78 if self.coerce(&ty2, &ty1) {
79 ty1.clone() 79 ty1
80 } else if self.coerce(&ty1, &ty2) { 80 } else if self.coerce(&ty1, &ty2) {
81 ty2.clone() 81 ty2
82 } else { 82 } else {
83 if let Some(id) = id { 83 if let Some(id) = id {
84 self.result 84 self.result
85 .type_mismatches 85 .type_mismatches
86 .insert(id.into(), TypeMismatch { expected: ty1.clone(), actual: ty2.clone() }); 86 .insert(id.into(), TypeMismatch { expected: ty1.clone(), actual: ty2 });
87 } 87 }
88 cov_mark::hit!(coerce_merge_fail_fallback); 88 cov_mark::hit!(coerce_merge_fail_fallback);
89 ty1.clone() 89 ty1
90 } 90 }
91 } 91 }
92 92
@@ -183,7 +183,7 @@ impl<'a> InferenceContext<'a> {
183 // details of coercion errors though, so I think it's useful to leave 183 // details of coercion errors though, so I think it's useful to leave
184 // the structure like it is. 184 // the structure like it is.
185 185
186 let canonicalized = self.canonicalize(from_ty.clone()); 186 let canonicalized = self.canonicalize(from_ty);
187 let autoderef = autoderef::autoderef( 187 let autoderef = autoderef::autoderef(
188 self.db, 188 self.db,
189 self.resolver.krate(), 189 self.resolver.krate(),
@@ -389,7 +389,7 @@ impl<'a> InferenceContext<'a> {
389 // The CoerceUnsized trait should have two generic params: Self and T. 389 // The CoerceUnsized trait should have two generic params: Self and T.
390 return Err(TypeError); 390 return Err(TypeError);
391 } 391 }
392 b.push(coerce_from.clone()).push(to_ty.clone()).build() 392 b.push(coerce_from).push(to_ty.clone()).build()
393 }; 393 };
394 394
395 let goal: InEnvironment<DomainGoal> = 395 let goal: InEnvironment<DomainGoal> =