about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
diff options
context:
space:
mode:
authorLingMan <LingMan@users.noreply.github.com>2020-10-11 20:52:48 +0200
committerLingMan <LingMan@users.noreply.github.com>2020-11-23 00:58:53 +0100
commite0871cc0bedc9e7c6b0104600727a7109a2a0659 (patch)
tree3453f122f614415a525c195deddb08ae79fbf34f /compiler/rustc_trait_selection
parentc643dd2ec8fed2852f5eee8f776d657293a6a8f2 (diff)
downloadrust-e0871cc0bedc9e7c6b0104600727a7109a2a0659.tar.gz
rust-e0871cc0bedc9e7c6b0104600727a7109a2a0659.zip
Reduce boilerplate with the `?` operator
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 05ff9a6fb9c..e9e7e9520ee 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -2364,13 +2364,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)
     }
 }