[Rust] Don't use inner attributes for `allow` (#5212)
* Don't use inner attributes for `allow` Messes with being able to easily include elsewhere * Regenerate tests * No-op to retrigger CI * Add the rest of the `allow` attributes
This commit is contained in:
parent
4f10da8d99
commit
3968d00568
|
@ -68,6 +68,7 @@ It can be run by `cd`ing to the `rust_usage_test` directory and executing: `carg
|
|||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.rs}
|
||||
extern crate flatbuffers;
|
||||
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../monster_test_generated.rs"]
|
||||
mod monster_test_generated;
|
||||
pub use monster_test_generated::my_game;
|
||||
|
|
|
@ -495,6 +495,7 @@ The first step is to import/include the library, generated files, etc.
|
|||
extern crate flatbuffers;
|
||||
|
||||
// import the generated code
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "./monster_generated.rs"]
|
||||
mod monster_generated;
|
||||
pub use monster_generated::my_game::sample::{get_root_as_monster,
|
||||
|
@ -2042,6 +2043,7 @@ import './monster_my_game.sample_generated.dart' as myGame;
|
|||
extern crate flatbuffers;
|
||||
|
||||
// import the generated code
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "./monster_generated.rs"]
|
||||
mod monster_generated;
|
||||
pub use monster_generated::my_game::sample::{get_root_as_monster,
|
||||
|
|
|
@ -1749,8 +1749,6 @@ class RustGenerator : public BaseGenerator {
|
|||
|
||||
void GenNamespaceImports(const int white_spaces) {
|
||||
std::string indent = std::string(white_spaces, ' ');
|
||||
code_ += indent + "#![allow(dead_code)]";
|
||||
code_ += indent + "#![allow(unused_imports)]";
|
||||
code_ += "";
|
||||
code_ += indent + "use std::mem;";
|
||||
code_ += indent + "use std::cmp::Ordering;";
|
||||
|
@ -1792,6 +1790,7 @@ class RustGenerator : public BaseGenerator {
|
|||
// open namespace parts to reach the ns namespace
|
||||
// in the previous example, E, then F, then G are opened
|
||||
for (auto j = common_prefix_size; j != new_size; ++j) {
|
||||
code_ += "#[allow(unused_imports, dead_code)]";
|
||||
code_ += "pub mod " + MakeSnakeCase(ns->components[j]) + " {";
|
||||
// Generate local namespace imports.
|
||||
GenNamespaceImports(2);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
@ -10,9 +8,8 @@ use std::cmp::Ordering;
|
|||
extern crate flatbuffers;
|
||||
use self::flatbuffers::EndianScalar;
|
||||
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod my_game {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
@ -83,9 +80,8 @@ impl<'a: 'b, 'b> InParentNamespaceBuilder<'a, 'b> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod example_2 {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
@ -158,9 +154,8 @@ impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
|
|||
|
||||
} // pub mod Example2
|
||||
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod example {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
@ -10,18 +8,16 @@ use std::cmp::Ordering;
|
|||
extern crate flatbuffers;
|
||||
use self::flatbuffers::EndianScalar;
|
||||
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod namespace_a {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
extern crate flatbuffers;
|
||||
use self::flatbuffers::EndianScalar;
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod namespace_b {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
@ -10,9 +8,8 @@ use std::cmp::Ordering;
|
|||
extern crate flatbuffers;
|
||||
use self::flatbuffers::EndianScalar;
|
||||
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod namespace_a {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
@ -198,9 +195,8 @@ impl<'a: 'b, 'b> SecondTableInABuilder<'a, 'b> {
|
|||
|
||||
} // pub mod NamespaceA
|
||||
|
||||
#[allow(unused_imports, dead_code)]
|
||||
pub mod namespace_c {
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem;
|
||||
use std::cmp::Ordering;
|
||||
|
|
|
@ -20,6 +20,7 @@ use bencher::Bencher;
|
|||
|
||||
extern crate flatbuffers;
|
||||
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../monster_test_generated.rs"]
|
||||
mod monster_test_generated;
|
||||
pub use monster_test_generated::my_game;
|
||||
|
|
|
@ -28,6 +28,7 @@ static A: TrackingAllocator = TrackingAllocator;
|
|||
|
||||
// import the flatbuffers generated code:
|
||||
extern crate flatbuffers;
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../monster_test_generated.rs"]
|
||||
mod monster_test_generated;
|
||||
pub use monster_test_generated::my_game;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
extern crate flatbuffers;
|
||||
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../monster_test_generated.rs"]
|
||||
mod monster_test_generated;
|
||||
pub use monster_test_generated::my_game;
|
||||
|
|
|
@ -19,6 +19,7 @@ extern crate quickcheck;
|
|||
|
||||
extern crate flatbuffers;
|
||||
|
||||
#[allow(dead_code, unused_imports)]
|
||||
#[path = "../../monster_test_generated.rs"]
|
||||
mod monster_test_generated;
|
||||
pub use monster_test_generated::my_game;
|
||||
|
|
Loading…
Reference in New Issue