Skip to content

Commit

Permalink
Apply clippy::single_match suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 committed Oct 22, 2019
1 parent 7491468 commit bedbf3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions src/libstd/thread/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bedbf3b

Please sign in to comment.