From bedbf3bacbff36a477dcf28523cbf6cab67e9e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Thu, 5 Sep 2019 14:08:06 +0200 Subject: [PATCH] Apply clippy::single_match suggestion --- src/libcore/option.rs | 5 ++--- src/libstd/thread/local.rs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 9eb29eae7f75a..89f2d7ab29c93 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -837,9 +837,8 @@ impl Option { #[inline] #[stable(feature = "option_entry", since = "1.20.0")] pub fn get_or_insert_with T>(&mut self, f: F) -> &mut T { - match *self { - None => *self = Some(f()), - _ => (), + if let None = *self { + *self = Some(f()); } match *self { diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index e92c0d1c58e41..cfaab4e22e9cf 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -509,9 +509,8 @@ pub mod os { pub unsafe fn get(&'static self, init: fn() -> T) -> Option<&'static T> { let ptr = self.os.get() as *mut Value; if ptr as usize > 1 { - match (*ptr).inner.get() { - Some(ref value) => return Some(value), - None => {}, + if let Some(ref value) = (*ptr).inner.get() { + return Some(value); } } self.try_initialize(init)