about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-11-23 15:25:47 +0100
committerGitHub <noreply@github.com>2020-11-23 15:25:47 +0100
commitb4db342f512fabde89a9010ea9239795724deee1 (patch)
tree61c890bc6f7af4e3c0ca4f90deade8298d2fa9e1 /compiler/rustc_trait_selection
parent32be3ae06a3ec9b97dff0a16e9fbb2e2f260601f (diff)
parente0871cc0bedc9e7c6b0104600727a7109a2a0659 (diff)
downloadrust-b4db342f512fabde89a9010ea9239795724deee1.tar.gz
rust-b4db342f512fabde89a9010ea9239795724deee1.zip
Rollup merge of #79325 - LingMan:try_op, r=jonas-schievink
Reduce boilerplate with the `?` operator

`@rustbot` modify labels to +C-cleanup.
Diffstat (limited to 'compiler/rustc_trait_selection')
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 4189a81632a..5b31998b7d3 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -2372,13 +2372,9 @@ impl<'o, 'tcx> Iterator for TraitObligationStackList<'o, 'tcx> {
     type Item = &'o TraitObligationStack<'o, 'tcx>;
 
     fn next(&mut self) -> Option<&'o TraitObligationStack<'o, 'tcx>> {
-        match self.head {
-            Some(o) => {
-                *self = o.previous;
-                Some(o)
-            }
-            None => None,
-        }
+        let o = self.head?;
+        *self = o.previous;
+        Some(o)
     }
 }