Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Right now the compiler generates inner attributes at the top of each generated source file:
#![allow(unused_imports)] #![allow(unused_extern_crates)] #![allow(clippy::too_many_arguments, clippy::type_complexity, clippy::vec_box)] #![cfg_attr(rustfmt, rustfmt_skip)]
If rust source files are generated by the project's build.rs file, then they must be included in the following way:
include!(concat!(env!("OUT_DIR"), "/service.rs"));
However, doing this leads to errors of the following form:
error: an inner attribute is not permitted in this context --> /thrift-test/target/debug/build/thrift-test-345cae8ce43a395d/out/service.rs:4:1 | 4 | #![allow(unused_imports)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... 9 | use std::cell::RefCell; | ----------------------- 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 | 4 - #![allow(unused_imports)] 4 + #[allow(unused_imports)]
Related: