Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/coerce.rs')
-rw-r--r--crates/hir-ty/src/infer/coerce.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/hir-ty/src/infer/coerce.rs b/crates/hir-ty/src/infer/coerce.rs
index db912c0eb6..962fc752a5 100644
--- a/crates/hir-ty/src/infer/coerce.rs
+++ b/crates/hir-ty/src/infer/coerce.rs
@@ -152,10 +152,8 @@ where
let snapshot = self.infcx().start_snapshot();
let result = f(self);
match result {
- Ok(_) => {}
- Err(_) => {
- self.infcx().rollback_to(snapshot);
- }
+ Ok(_) => self.infcx().commit_from(snapshot),
+ Err(_) => self.infcx().rollback_to(snapshot),
}
result
}