mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
Improve doc example of DerefMut
It is more illustrative, after using `*x` to modify the field, to show in the assertion that the field has indeed been modified.
This commit is contained in:
parent
c1550e3f8c
commit
53887a5d9e
@ -164,7 +164,7 @@ impl<T: ?Sized> const Deref for &mut T {
|
|||||||
///
|
///
|
||||||
/// let mut x = DerefMutExample { value: 'a' };
|
/// let mut x = DerefMutExample { value: 'a' };
|
||||||
/// *x = 'b';
|
/// *x = 'b';
|
||||||
/// assert_eq!('b', *x);
|
/// assert_eq!('b', x.value);
|
||||||
/// ```
|
/// ```
|
||||||
#[lang = "deref_mut"]
|
#[lang = "deref_mut"]
|
||||||
#[doc(alias = "*")]
|
#[doc(alias = "*")]
|
||||||
|
Loading…
Reference in New Issue
Block a user