You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My use case for this is to turn off various lints for the LALRPOP generated file, as it violates a lot of pedantic/nursery clippy hints that I like to have in the rest of my project.
Currently, using a module attribute at the beginning of a file:
error: an inner attribute is not permitted in this context
--> out/generated.rs:3:1
|
3 | #![allow(clippy::all, clippy::pedantic, clippy::nursery)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 | use some_module::ImportantStruct;
| --------------------------------- the inner attribute doesn't annotate this `use` import
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
help: to annotate the `use` import, change the attribute from inner to outer style
|
3 - #![allow(clippy::all, clippy::pedantic, clippy::nursery)]
3 + #[allow(clippy::all, clippy::pedantic, clippy::nursery)]
|
This is confusing, because the generated file correctly contains the module attribute at the beginning of the file, just below the sha3 line. However, the generated code contains its module attributes (which includes an allow(clippy::all)) at the beginning of the contained mod __parse__GlobalNonterminal, where GlobalNonTerminal is the (only) pub-declared non-terminal of the grammar. Therefore, it should probably be possible to move these attributes down in in the generated code. After all, it seems like LALRPOP parses them correctly at the beginning of files; in other places they cause a syntax error.
The text was updated successfully, but these errors were encountered:
My use case for this is to turn off various lints for the LALRPOP generated file, as it violates a lot of pedantic/nursery clippy hints that I like to have in the rest of my project.
Currently, using a module attribute at the beginning of a file:
causes this error:
This is confusing, because the generated file correctly contains the module attribute at the beginning of the file, just below the
sha3
line. However, the generated code contains its module attributes (which includes anallow(clippy::all)
) at the beginning of the containedmod __parse__GlobalNonterminal
, whereGlobalNonTerminal
is the (only)pub
-declared non-terminal of the grammar. Therefore, it should probably be possible to move these attributes down in in the generated code. After all, it seems like LALRPOP parses them correctly at the beginning of files; in other places they cause a syntax error.The text was updated successfully, but these errors were encountered: