Apply clippy::single_match suggestion

This commit is contained in:
Mateusz Mikuła 2019-09-05 14:08:06 +02:00 committed by Mateusz Mikuła
parent 7491468278
commit bedbf3bacb
2 changed files with 4 additions and 6 deletions

View file

@ -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 {

View file

@ -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<T>;
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)