Skip to content

Commit c3450e7

Browse files
authored
Remove explicit derefs from shared ref slide (#2746)
When teaching I generally remove these. I emphasize that a reference can generally be used as if you have the referenced value directly, since in most cases you don't have to explicitly dereference a reference. On the next slide we show mutable references, and we need to use a deref when writing through a mutable reference, so I think that's the better place to point out the deref operator.
1 parent 428f51a commit c3450e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/references/shared.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ fn main() {
1414
let b = 'B';
1515
1616
let mut r: &char = &a;
17-
dbg!(*r);
17+
dbg!(r);
1818
1919
r = &b;
20-
dbg!(*r);
20+
dbg!(r);
2121
}
2222
```
2323

0 commit comments

Comments
 (0)