From c3450e794764eeb799ae3534b93c6caca713424f Mon Sep 17 00:00:00 2001 From: Nicole L Date: Wed, 14 May 2025 16:24:38 -0700 Subject: [PATCH] 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. --- src/references/shared.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/references/shared.md b/src/references/shared.md index 57804056..3a37e51e 100644 --- a/src/references/shared.md +++ b/src/references/shared.md @@ -14,10 +14,10 @@ fn main() { let b = 'B'; let mut r: &char = &a; - dbg!(*r); + dbg!(r); r = &b; - dbg!(*r); + dbg!(r); } ```