diff options
| author | bors <bors@rust-lang.org> | 2017-12-10 00:57:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-12-10 00:57:40 +0000 |
| commit | c89e206eedee079c4620eacbfb4e3bc6cf392fc8 (patch) | |
| tree | d362e737537921ce60a13c88139b708e63e29a01 /src/liballoc/vec.rs | |
| parent | 8db163e53dab4f188a60bf24b4d6ebeb1ea5cab1 (diff) | |
| parent | 3024c1434a667425d30e4b0785857381323712aa (diff) | |
| download | rust-c89e206eedee079c4620eacbfb4e3bc6cf392fc8.tar.gz rust-c89e206eedee079c4620eacbfb4e3bc6cf392fc8.zip | |
Auto merge of #46602 - mbrubeck:try, r=kennytm
Replace option_try macros and match with ? operator None
Diffstat (limited to 'src/liballoc/vec.rs')
| -rw-r--r-- | src/liballoc/vec.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index c29449a241e..9c7c8657716 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1423,10 +1423,7 @@ impl<T: PartialEq> Vec<T> { /// ``` #[unstable(feature = "vec_remove_item", reason = "recently added", issue = "40062")] pub fn remove_item(&mut self, item: &T) -> Option<T> { - let pos = match self.iter().position(|x| *x == *item) { - Some(x) => x, - None => return None, - }; + let pos = self.iter().position(|x| *x == *item)?; Some(self.remove(pos)) } } |
