1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-16 22:27:34 +02:00

Various small fixes (#1556)

Plus one more substantial comment on casting.
This commit is contained in:
Marshall Pierce
2023-12-05 16:06:42 -07:00
committed by GitHub
parent 8f9902cc3e
commit 6c5061bb90
16 changed files with 23 additions and 21 deletions

View File

@ -50,7 +50,7 @@ fn main() {
<details>
* You can show how the value of the block changes by changing the last line in the block. For instance, adding/removing a semicolon or using a `return`.
* Show that a variable's scope is limited by adding a b` in the inner block in the last example, and then trying to access it outside that block.
* Show that a variable's scope is limited by adding a `b` in the inner block in the last example, and then trying to access it outside that block.
* Shadowing is different from mutation, because after shadowing both variable's memory locations exist at the same time. Both are available under the same name, depending where you use it in the code.
* A shadowing variable can have a different type.
* Shadowing looks obscure at first, but is convenient for holding on to values after `.unwrap()`.