about summary refs log tree commit diff
path: root/src/libcore/str
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-12-05 23:54:25 +0100
committerGitHub <noreply@github.com>2018-12-05 23:54:25 +0100
commit64371f1cfee8d5ec8552ac8ee4cbdb4cd2629b91 (patch)
tree87bdf3cb911fbad454292ca3383bfa6f772f3c5c /src/libcore/str
parent1594a4245ba9951039bb39bf5e3484605ab5d068 (diff)
parent9012af6f19d999869824e3b933de5f7b30986877 (diff)
downloadrust-64371f1cfee8d5ec8552ac8ee4cbdb4cd2629b91.tar.gz
rust-64371f1cfee8d5ec8552ac8ee4cbdb4cd2629b91.zip
Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN
Utilize `?` instead of `return None`.

None
Diffstat (limited to 'src/libcore/str')
-rw-r--r--src/libcore/str/mod.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 89efa120a6f..6c953d1b9a0 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -536,10 +536,9 @@ fn next_code_point_reverse<'a, I>(bytes: &mut I) -> Option<u32>
     where I: DoubleEndedIterator<Item = &'a u8>,
 {
     // Decode UTF-8
-    let w = match bytes.next_back() {
-        None => return None,
-        Some(&next_byte) if next_byte < 128 => return Some(next_byte as u32),
-        Some(&back_byte) => back_byte,
+    let w = match *bytes.next_back()? {
+        next_byte if next_byte < 128 => return Some(next_byte as u32),
+        back_byte => back_byte,
     };
 
     // Multibyte case follows