File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -240,8 +240,13 @@ let monster_size: int = 50;
240
240
~~~~
241
241
242
242
Local variables may shadow earlier declarations, as in the previous
243
- example in which ` my_favorite_value ` is first declared as a ` float `
244
- then a second ` my_favorite_value ` is declared as an int.
243
+ example in which ` monster_size ` is first declared as a ` float `
244
+ then a second ` monster_size ` is declared as an int. If you were to actually
245
+ compile this example though, the compiler will see that the second
246
+ ` monster_size ` is unused, assume that you have made a mistake, and issue
247
+ a warning. For occasions where unused variables are intentional, their
248
+ name may be prefixed with an underscore to silence the warning, like
249
+ ` let _monster_size = 50; ` .
245
250
246
251
Rust identifiers follow the same rules as C; they start with an alphabetic
247
252
character or an underscore, and after that may contain any sequence of
You can’t perform that action at this time.
0 commit comments