Simplify sample code for {Option, Result}::iter_mut

Fixes #28431
This commit is contained in:
Adolfo Ochagavía
2015-09-16 10:17:38 +02:00
parent 1fe126af2e
commit 804f024eda
2 changed files with 2 additions and 2 deletions

View File

@@ -541,7 +541,7 @@ impl<T> Option<T> {
/// ``` /// ```
/// let mut x = Some(4); /// let mut x = Some(4);
/// match x.iter_mut().next() { /// match x.iter_mut().next() {
/// Some(&mut ref mut v) => *v = 42, /// Some(v) => *v = 42,
/// None => {}, /// None => {},
/// } /// }
/// assert_eq!(x, Some(42)); /// assert_eq!(x, Some(42));

View File

@@ -538,7 +538,7 @@ impl<T, E> Result<T, E> {
/// ``` /// ```
/// let mut x: Result<u32, &str> = Ok(7); /// let mut x: Result<u32, &str> = Ok(7);
/// match x.iter_mut().next() { /// match x.iter_mut().next() {
/// Some(&mut ref mut x) => *x = 40, /// Some(v) => *v = 40,
/// None => {}, /// None => {},
/// } /// }
/// assert_eq!(x, Ok(40)); /// assert_eq!(x, Ok(40));