@@ -32,51 +32,28 @@ impl Verbosity {
3232 }
3333}
3434
35- #[ derive( Debug , Clone , PartialEq , Eq , Ord , PartialOrd ) ]
36- pub enum Attribute {
37- DenyClippy ,
38- }
39-
40- impl Attribute {
41- fn code ( & self ) -> RustPrinter {
42- match self {
43- Attribute :: DenyClippy => line ( unit ( ) + "#[deny(clippy::all)]" ) ,
44- }
45- }
46- }
47-
4835#[ derive( Debug , Clone , PartialEq , Eq , Ord , PartialOrd ) ]
4936pub struct ModuleName {
5037 name : String ,
5138 verbosity : Verbosity ,
52- attributes : Vec < Attribute > ,
5339}
5440
5541impl ModuleName {
5642 fn code ( & self ) -> RustPrinter {
57- unit ( )
58- + self
59- . attributes
60- . iter ( )
61- . map ( |a| a. code ( ) )
62- . reduce ( |acc, e| acc + line ( e) )
63- . unwrap_or_else ( unit)
64- + line ( unit ( ) + self . verbosity . render ( ) + "mod " + escape_keywords ( & self . name ) + ";" )
43+ line ( unit ( ) + self . verbosity . render ( ) + "mod " + escape_keywords ( & self . name ) + ";" )
6544 }
6645
6746 pub fn new < S : Into < String > > ( s : S ) -> ModuleName {
6847 ModuleName {
6948 name : s. into ( ) ,
7049 verbosity : Verbosity :: Default ,
71- attributes : vec ! [ Attribute :: DenyClippy ] ,
7250 }
7351 }
7452
7553 pub fn new_pub < S : Into < String > > ( s : S ) -> ModuleName {
7654 ModuleName {
7755 name : s. into ( ) ,
7856 verbosity : Verbosity :: Pub ,
79- attributes : vec ! [ Attribute :: DenyClippy ] ,
8057 }
8158 }
8259
@@ -131,7 +108,8 @@ pub fn lib_gen(self_name: &str, modules: &[ModuleDef]) -> String {
131108 . reduce ( |acc, e| acc + e)
132109 . unwrap_or_else ( unit) ;
133110
134- let code = mods + NewLine + uses;
111+ let code =
112+ line ( unit ( ) + "#![deny(clippy::all)]" ) + NewLine + mods + NewLine + uses;
135113
136114 RustContext :: new ( ) . print_to_string ( code)
137115}
@@ -159,9 +137,9 @@ mod tests {
159137 ) ;
160138
161139 let expected = indoc ! { r#"
162- #[deny(clippy::all)]
140+ #![deny(clippy::all)]
141+
163142 mod abc;
164- #[deny(clippy::all)]
165143 mod xyz;
166144
167145 pub use lib::abc::B;
0 commit comments