Skip to content

Commit a193536

Browse files
committed
RefCell::borrow_mut example should demonstrate mut
1 parent 62a3a6e commit a193536

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libcore/cell.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@ impl<T: ?Sized> RefCell<T> {
414414
///
415415
/// let c = RefCell::new(5);
416416
///
417-
/// let borrowed_five = c.borrow_mut();
417+
/// *c.borrow_mut() = 7;
418+
///
419+
/// assert_eq!(*c.borrow(), 7);
418420
/// ```
419421
///
420422
/// An example of panic:

0 commit comments

Comments
 (0)