about summary refs log tree commit diff
path: root/src/libcore/option.rs
diff options
context:
space:
mode:
authorMateusz Mikuła <matti@marinelayer.io>2019-09-05 14:08:06 +0200
committerMateusz Mikuła <mati865@gmail.com>2019-10-22 19:23:10 +0200
commitbedbf3bacbff36a477dcf28523cbf6cab67e9e0a (patch)
treeb4f62607d9291f87d602c29e994eac6ea41040a0 /src/libcore/option.rs
parent749146827865dfe1f62ce757795415414bb75a15 (diff)
downloadrust-bedbf3bacbff36a477dcf28523cbf6cab67e9e0a.tar.gz
rust-bedbf3bacbff36a477dcf28523cbf6cab67e9e0a.zip
Apply clippy::single_match suggestion
Diffstat (limited to 'src/libcore/option.rs')
-rw-r--r--src/libcore/option.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 9eb29eae7f7..89f2d7ab29c 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -837,9 +837,8 @@ impl<T> Option<T> {
     #[inline]
     #[stable(feature = "option_entry", since = "1.20.0")]
     pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T {
-        match *self {
-            None => *self = Some(f()),
-            _ => (),
+        if let None = *self {
+            *self = Some(f());
         }
 
         match *self {