Skip to content

Commit

Permalink
Rollup merge of #111000 - JohnBobbo96:core_option_unneeded_function, …
Browse files Browse the repository at this point in the history
…r=jyn514

Remove unneeded function call in `core::option`.

r? `@jyn514`
  • Loading branch information
matthiaskrgr authored Apr 30, 2023
2 parents a422610 + a4f391d commit d8d24d4
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 d8d24d4

Please sign in to comment.