Skip to content

Commit 2ad4eb2

Browse files
committed
Auto merge of rust-lang#95610 - createyourpersonalaccount:derefmut-docfix, r=Dylan-DPC
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.
2 parents 168a020 + 53887a5 commit 2ad4eb2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/ops/deref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl<T: ?Sized> const Deref for &mut T {
164164
///
165165
/// let mut x = DerefMutExample { value: 'a' };
166166
/// *x = 'b';
167-
/// assert_eq!('b', *x);
167+
/// assert_eq!('b', x.value);
168168
/// ```
169169
#[lang = "deref_mut"]
170170
#[doc(alias = "*")]

0 commit comments

Comments
 (0)