diff --git a/doc/pascal/lalrpop/build.rs b/doc/pascal/lalrpop/build.rs index 39efd67b1..cb856e3a9 100644 --- a/doc/pascal/lalrpop/build.rs +++ b/doc/pascal/lalrpop/build.rs @@ -3,6 +3,7 @@ extern crate lalrpop; fn main() { lalrpop::Configuration::new() .emit_comments(true) + .use_cargo_dir_conventions() .process_current_dir() .unwrap(); } diff --git a/lalrpop/src/lexer/intern_token/mod.rs b/lalrpop/src/lexer/intern_token/mod.rs index 57bbbb856..eadbd6c53 100644 --- a/lalrpop/src/lexer/intern_token/mod.rs +++ b/lalrpop/src/lexer/intern_token/mod.rs @@ -59,6 +59,7 @@ pub fn compile( ) -> io::Result<()> { let prefix = &grammar.prefix; + rust!(out, "#[cfg_attr(rustfmt, rustfmt_skip)]"); rust!(out, "mod {}intern_token {{", prefix); rust!(out, "#![allow(unused_imports)]"); try!(out.write_uses("", &grammar)); diff --git a/lalrpop/src/lr1/codegen/base.rs b/lalrpop/src/lr1/codegen/base.rs index 9da2c6c36..732061095 100644 --- a/lalrpop/src/lr1/codegen/base.rs +++ b/lalrpop/src/lr1/codegen/base.rs @@ -71,6 +71,7 @@ impl<'codegen, 'grammar, W: Write, C> CodeGenerator<'codegen, 'grammar, W, C> { F: FnOnce(&mut Self) -> io::Result<()>, { rust!(self.out, ""); + rust!(self.out, "#[cfg_attr(rustfmt, rustfmt_skip)]"); rust!(self.out, "mod {}parse{} {{", self.prefix, self.start_symbol); // these stylistic lints are annoying for the generated code, diff --git a/lalrpop/src/lr1/codegen/test_all.rs b/lalrpop/src/lr1/codegen/test_all.rs index 89db47fb5..e7327098f 100644 --- a/lalrpop/src/lr1/codegen/test_all.rs +++ b/lalrpop/src/lr1/codegen/test_all.rs @@ -48,6 +48,7 @@ impl<'ascent, 'grammar, W: Write> CodeGenerator<'ascent, 'grammar, W, TestAll> { self.write_parse_mod(|this| { try!(this.write_parser_fn()); + rust!(this.out, "#[cfg_attr(rustfmt, rustfmt_skip)]"); rust!(this.out, "mod {}ascent {{", this.prefix); try!(super::ascent::compile( this.grammar, @@ -67,6 +68,7 @@ impl<'ascent, 'grammar, W: Write> CodeGenerator<'ascent, 'grammar, W, TestAll> { rust!(this.out, "{}", pub_use); rust!(this.out, "}}"); + rust!(this.out, "#[cfg_attr(rustfmt, rustfmt_skip)]"); rust!(this.out, "mod {}parse_table {{", this.prefix); try!(super::parse_table::compile( this.grammar, diff --git a/lalrpop/src/rust/mod.rs b/lalrpop/src/rust/mod.rs index 12be4f2ce..928fba792 100644 --- a/lalrpop/src/rust/mod.rs +++ b/lalrpop/src/rust/mod.rs @@ -161,7 +161,6 @@ impl RustWrite { } pub fn write_module_attributes(&mut self, grammar: &Grammar) -> io::Result<()> { - rust!(self, "#![cfg_attr(rustfmt, rustfmt_skip)]"); for attribute in grammar.module_attributes.iter() { rust!(self, "{}", attribute); }