Skip to content

Commit d8d24d4

Browse files
authored
Rollup merge of #111000 - JohnBobbo96:core_option_unneeded_function, r=jyn514
Remove unneeded function call in `core::option`. r? `@jyn514`
2 parents a422610 + a4f391d commit d8d24d4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

library/core/src/option.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ impl<T> Option<T> {
10071007
{
10081008
match self {
10091009
Some(x) => x,
1010-
None => Default::default(),
1010+
None => T::default(),
10111011
}
10121012
}
10131013

@@ -1615,11 +1615,7 @@ impl<T> Option<T> {
16151615
where
16161616
T: Default,
16171617
{
1618-
fn default<T: Default>() -> T {
1619-
T::default()
1620-
}
1621-
1622-
self.get_or_insert_with(default)
1618+
self.get_or_insert_with(T::default)
16231619
}
16241620

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

0 commit comments

Comments
 (0)