@@ -59,7 +59,7 @@ fn main() {
59
59
// Only types that implement fmt::Display can be formatted with `{}`. User-
60
60
// defined types do not implement fmt::Display by default.
61
61
62
- #[allow(dead_code)]
62
+ #[allow(dead_code)] // disable `dead_code` which warn against unused module
63
63
struct Structure(i32);
64
64
65
65
// This will not compile because `Structure` does not implement
@@ -89,6 +89,8 @@ for these types. To print text for custom types, more steps are required.
89
89
Implementing the ` fmt::Display ` trait automatically implements the
90
90
[ ` ToString ` ] trait which allows us to [ convert] the type to [ ` String ` ] [ string ] .
91
91
92
+ In * line 46* , ` #[allow(dead_code)] ` is an [ attribute] which only apply to the module after it.
93
+
92
94
### Activities
93
95
94
96
* Fix the issue in the above code (see FIXME) so that it runs without
@@ -102,8 +104,7 @@ Implementing the `fmt::Display` trait automatically implements the
102
104
103
105
### See also:
104
106
105
- [ ` std::fmt ` ] [ fmt ] , [ ` macros ` ] [ macros ] , [ ` struct ` ] [ structs ] ,
106
- and [ ` traits ` ] [ traits ]
107
+ [ ` std::fmt ` ] [ fmt ] , [ ` macros ` ] [ macros ] , [ ` struct ` ] [ structs ] , [ ` traits ` ] [ traits ] , and [ ` dead_code ` ] [ dead_code ]
107
108
108
109
[ fmt ] : https://doc.rust-lang.org/std/fmt/
109
110
[ macros ] : ../macros.md
@@ -112,3 +113,5 @@ and [`traits`][traits]
112
113
[ traits ] : https://doc.rust-lang.org/std/fmt/#formatting-traits
113
114
[ `ToString` ] : https://doc.rust-lang.org/std/string/trait.ToString.html
114
115
[ convert ] : ../conversion/string.md
116
+ [ attribute ] : ../attribute.md
117
+ [ dead_code ] : ../attribute/unused.md
0 commit comments