Skip to content

Commit

Permalink
Remove unneeded function call in core::option.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnBobbo96 committed Apr 29, 2023
1 parent 87b1f89 commit a4f391d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ impl<T> Option<T> {
{
match self {
Some(x) => x,
None => Default::default(),
None => T::default(),
}
}

Expand Down Expand Up @@ -1615,11 +1615,7 @@ impl<T> Option<T> {
where
T: Default,
{
fn default<T: Default>() -> T {
T::default()
}

self.get_or_insert_with(default)
self.get_or_insert_with(T::default)
}

/// Inserts a value computed from `f` into the option if it is [`None`],
Expand Down

0 comments on commit a4f391d

Please sign in to comment.