Remove unneeded function call in core::option.

This commit is contained in:
John Bobbo 2023-04-29 14:52:46 -07:00
parent 87b1f891ea
commit a4f391d4de
No known key found for this signature in database
GPG Key ID: D5B1CA85E46C4709

View File

@ -1007,7 +1007,7 @@ impl<T> Option<T> {
{
match self {
Some(x) => x,
None => Default::default(),
None => T::default(),
}
}
@ -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`],