From 3024c1434a667425d30e4b0785857381323712aa Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Fri, 8 Dec 2017 17:32:04 -0800 Subject: Use Try syntax for Option in place of macros or match --- src/liballoc/string.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/liballoc/string.rs') diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index cd0f4a22e9c..ca493ab27e3 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1044,10 +1044,7 @@ impl String { #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn pop(&mut self) -> Option { - let ch = match self.chars().rev().next() { - Some(ch) => ch, - None => return None, - }; + let ch = self.chars().rev().next()?; let newlen = self.len() - ch.len_utf8(); unsafe { self.vec.set_len(newlen); -- cgit 1.4.1-3-g733a5