diff options
| author | Canop <cano.petrole@gmail.com> | 2020-10-03 10:29:11 +0200 |
|---|---|---|
| committer | Canop <cano.petrole@gmail.com> | 2020-10-23 11:41:19 +0200 |
| commit | cc8b77a7cf0e1179b148a70c8f760a7ba3c1debd (patch) | |
| tree | b8799ce12933d055b3b6a365933dc77cf0fc7bdc | |
| parent | 60a96cae336b621be3a5e01cf6c87649b327f836 (diff) | |
| download | rust-cc8b77a7cf0e1179b148a70c8f760a7ba3c1debd.tar.gz rust-cc8b77a7cf0e1179b148a70c8f760a7ba3c1debd.zip | |
fix naming unconsistency between function doc and prototype
| -rw-r--r-- | library/core/src/option.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 65575f4c41b..8fd3bfe77b8 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -566,8 +566,7 @@ impl<T> Option<T> { // Setting a new value ///////////////////////////////////////////////////////////////////////// - /// Inserts `v` into the option then returns a mutable reference - /// to the contained value. + /// Inserts `value` into the option then returns a mutable reference to it. /// /// # Example /// @@ -585,8 +584,8 @@ impl<T> Option<T> { /// ``` #[inline] #[unstable(feature = "option_insert", reason = "newly added", issue = "none")] - pub fn insert(&mut self, val: T) -> &mut T { - *self = Some(val); + pub fn insert(&mut self, value: T) -> &mut T { + *self = Some(value); match self { Some(v) => v, @@ -825,7 +824,7 @@ impl<T> Option<T> { // Entry-like operations to insert if None and return a reference ///////////////////////////////////////////////////////////////////////// - /// Inserts `v` into the option if it is [`None`], then + /// Inserts `value` into the option if it is [`None`], then /// returns a mutable reference to the contained value. /// /// # Examples @@ -844,12 +843,12 @@ impl<T> Option<T> { /// ``` #[inline] #[stable(feature = "option_entry", since = "1.20.0")] - pub fn get_or_insert(&mut self, val: T) -> &mut T { - self.get_or_insert_with(|| val) + pub fn get_or_insert(&mut self, value: T) -> &mut T { + self.get_or_insert_with(|| value) } - /// Inserts a value computed from `f` into the option if it is [`None`], then - /// returns a mutable reference to the contained value. + /// Inserts a value computed from `f` into the option if it is [`None`], + /// then returns a mutable reference to the contained value. /// /// # Examples /// |
