diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 73ffc3f36ca..c38c68e1d58 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1007,7 +1007,7 @@ impl Option { { match self { Some(x) => x, - None => Default::default(), + None => T::default(), } } @@ -1615,11 +1615,7 @@ impl Option { where T: Default, { - fn 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`],