diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-30 16:25:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-30 16:25:48 +0200 |
| commit | d8d24d498f5404e29e83e564ffb095953740e467 (patch) | |
| tree | 2393888edadf1698e1f3b5e98e9db99f45a4935c | |
| parent | a42261086f14cb8560dc4425d5cc9669a6c87c9c (diff) | |
| parent | a4f391d4de1a0c86c11398718fd01b15f391e1cf (diff) | |
| download | rust-d8d24d498f5404e29e83e564ffb095953740e467.tar.gz rust-d8d24d498f5404e29e83e564ffb095953740e467.zip | |
Rollup merge of #111000 - JohnBobbo96:core_option_unneeded_function, r=jyn514
Remove unneeded function call in `core::option`. r? `@jyn514`
| -rw-r--r-- | library/core/src/option.rs | 8 |
1 files 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<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`], |
