From a4f391d4de1a0c86c11398718fd01b15f391e1cf Mon Sep 17 00:00:00 2001 From: John Bobbo Date: Sat, 29 Apr 2023 14:52:46 -0700 Subject: [PATCH] Remove unneeded function call in `core::option`. --- library/core/src/option.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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`],