1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-16 07:36:05 +02:00

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.
This commit is contained in:
Nicole L 2025-05-14 16:24:38 -07:00 committed by GitHub
parent 428f51a106
commit c3450e7947
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,10 +14,10 @@ fn main() {
let b = 'B';
let mut r: &char = &a;
dbg!(*r);
dbg!(r);
r = &b;
dbg!(*r);
dbg!(r);
}
```