about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-01-14 14:49:30 -0800
committerEsteban Küber <esteban@kuber.com.ar>2020-01-16 09:49:13 -0800
commit509cb33dbcdb631625288f72c359a35dde6524b7 (patch)
tree82c81cd4edecc5d44b4db29839f884f04b642ec1 /src/librustc
parent5b36c187dcbb8a4b6555fe046194f2b6deb74230 (diff)
downloadrust-509cb33dbcdb631625288f72c359a35dde6524b7.tar.gz
rust-509cb33dbcdb631625288f72c359a35dde6524b7.zip
review comments
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/traits/error_reporting/suggestions.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/librustc/traits/error_reporting/suggestions.rs b/src/librustc/traits/error_reporting/suggestions.rs
index 0a9747b631e..c2f562b4bc7 100644
--- a/src/librustc/traits/error_reporting/suggestions.rs
+++ b/src/librustc/traits/error_reporting/suggestions.rs
@@ -624,12 +624,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             } else {
                 // We still want to verify whether all the return types conform to each other.
                 for expr in &visitor.0 {
-                    if let Some(returned_ty) = tables.node_type_opt(expr.hir_id) {
-                        if let Some(ty) = last_ty {
-                            all_returns_have_same_type &= ty == returned_ty;
-                        }
-                        last_ty = Some(returned_ty);
-                    }
+                    let returned_ty = tables.node_type_opt(expr.hir_id);
+                    all_returns_have_same_type &= last_ty == returned_ty || last_ty.is_none();
+                    last_ty = returned_ty;
                 }
             }