[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}
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.rs}
|
||||||
extern crate flatbuffers;
|
extern crate flatbuffers;
|
||||||
|
|
||||||
|
#[allow(dead_code, unused_imports)]
|
||||||
#[path = "../../monster_test_generated.rs"]
|
#[path = "../../monster_test_generated.rs"]
|
||||||
mod monster_test_generated;
|
mod monster_test_generated;
|
||||||
pub use monster_test_generated::my_game;
|
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;
|
extern crate flatbuffers;
|
||||||
|
|
||||||
// import the generated code
|
// import the generated code
|
||||||
|
#[allow(dead_code, unused_imports)]
|
||||||
#[path = "./monster_generated.rs"]
|
#[path = "./monster_generated.rs"]
|
||||||
mod monster_generated;
|
mod monster_generated;
|
||||||
pub use monster_generated::my_game::sample::{get_root_as_monster,
|
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;
|
extern crate flatbuffers;
|
||||||
|
|
||||||
// import the generated code
|
// import the generated code
|
||||||
|
#[allow(dead_code, unused_imports)]
|
||||||
#[path = "./monster_generated.rs"]
|
#[path = "./monster_generated.rs"]
|
||||||
mod monster_generated;
|
mod monster_generated;
|
||||||
pub use monster_generated::my_game::sample::{get_root_as_monster,
|
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) {
|
void GenNamespaceImports(const int white_spaces) {
|
||||||
std::string indent = std::string(white_spaces, ' ');
|
std::string indent = std::string(white_spaces, ' ');
|
||||||
code_ += indent + "#![allow(dead_code)]";
|
|
||||||
code_ += indent + "#![allow(unused_imports)]";
|
|
||||||
code_ += "";
|
code_ += "";
|
||||||
code_ += indent + "use std::mem;";
|
code_ += indent + "use std::mem;";
|
||||||
code_ += indent + "use std::cmp::Ordering;";
|
code_ += indent + "use std::cmp::Ordering;";
|
||||||
|
@ -1792,6 +1790,7 @@ class RustGenerator : public BaseGenerator {
|
||||||
// open namespace parts to reach the ns namespace
|
// open namespace parts to reach the ns namespace
|
||||||
// in the previous example, E, then F, then G are opened
|
// in the previous example, E, then F, then G are opened
|
||||||
for (auto j = common_prefix_size; j != new_size; ++j) {
|
for (auto j = common_prefix_size; j != new_size; ++j) {
|
||||||
|
code_ += "#[allow(unused_imports, dead_code)]";
|
||||||
code_ += "pub mod " + MakeSnakeCase(ns->components[j]) + " {";
|
code_ += "pub mod " + MakeSnakeCase(ns->components[j]) + " {";
|
||||||
// Generate local namespace imports.
|
// Generate local namespace imports.
|
||||||
GenNamespaceImports(2);
|
GenNamespaceImports(2);
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// automatically generated by the FlatBuffers compiler, do not modify
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
@ -10,9 +8,8 @@ use std::cmp::Ordering;
|
||||||
extern crate flatbuffers;
|
extern crate flatbuffers;
|
||||||
use self::flatbuffers::EndianScalar;
|
use self::flatbuffers::EndianScalar;
|
||||||
|
|
||||||
|
#[allow(unused_imports, dead_code)]
|
||||||
pub mod my_game {
|
pub mod my_game {
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
@ -83,9 +80,8 @@ impl<'a: 'b, 'b> InParentNamespaceBuilder<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused_imports, dead_code)]
|
||||||
pub mod example_2 {
|
pub mod example_2 {
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
@ -158,9 +154,8 @@ impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
|
||||||
|
|
||||||
} // pub mod Example2
|
} // pub mod Example2
|
||||||
|
|
||||||
|
#[allow(unused_imports, dead_code)]
|
||||||
pub mod example {
|
pub mod example {
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// automatically generated by the FlatBuffers compiler, do not modify
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
@ -10,18 +8,16 @@ use std::cmp::Ordering;
|
||||||
extern crate flatbuffers;
|
extern crate flatbuffers;
|
||||||
use self::flatbuffers::EndianScalar;
|
use self::flatbuffers::EndianScalar;
|
||||||
|
|
||||||
|
#[allow(unused_imports, dead_code)]
|
||||||
pub mod namespace_a {
|
pub mod namespace_a {
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
extern crate flatbuffers;
|
extern crate flatbuffers;
|
||||||
use self::flatbuffers::EndianScalar;
|
use self::flatbuffers::EndianScalar;
|
||||||
|
#[allow(unused_imports, dead_code)]
|
||||||
pub mod namespace_b {
|
pub mod namespace_b {
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// automatically generated by the FlatBuffers compiler, do not modify
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
@ -10,9 +8,8 @@ use std::cmp::Ordering;
|
||||||
extern crate flatbuffers;
|
extern crate flatbuffers;
|
||||||
use self::flatbuffers::EndianScalar;
|
use self::flatbuffers::EndianScalar;
|
||||||
|
|
||||||
|
#[allow(unused_imports, dead_code)]
|
||||||
pub mod namespace_a {
|
pub mod namespace_a {
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
@ -198,9 +195,8 @@ impl<'a: 'b, 'b> SecondTableInABuilder<'a, 'b> {
|
||||||
|
|
||||||
} // pub mod NamespaceA
|
} // pub mod NamespaceA
|
||||||
|
|
||||||
|
#[allow(unused_imports, dead_code)]
|
||||||
pub mod namespace_c {
|
pub mod namespace_c {
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
|
@ -20,6 +20,7 @@ use bencher::Bencher;
|
||||||
|
|
||||||
extern crate flatbuffers;
|
extern crate flatbuffers;
|
||||||
|
|
||||||
|
#[allow(dead_code, unused_imports)]
|
||||||
#[path = "../../monster_test_generated.rs"]
|
#[path = "../../monster_test_generated.rs"]
|
||||||
mod monster_test_generated;
|
mod monster_test_generated;
|
||||||
pub use monster_test_generated::my_game;
|
pub use monster_test_generated::my_game;
|
||||||
|
|
|
@ -28,6 +28,7 @@ static A: TrackingAllocator = TrackingAllocator;
|
||||||
|
|
||||||
// import the flatbuffers generated code:
|
// import the flatbuffers generated code:
|
||||||
extern crate flatbuffers;
|
extern crate flatbuffers;
|
||||||
|
#[allow(dead_code, unused_imports)]
|
||||||
#[path = "../../monster_test_generated.rs"]
|
#[path = "../../monster_test_generated.rs"]
|
||||||
mod monster_test_generated;
|
mod monster_test_generated;
|
||||||
pub use monster_test_generated::my_game;
|
pub use monster_test_generated::my_game;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
extern crate flatbuffers;
|
extern crate flatbuffers;
|
||||||
|
|
||||||
|
#[allow(dead_code, unused_imports)]
|
||||||
#[path = "../../monster_test_generated.rs"]
|
#[path = "../../monster_test_generated.rs"]
|
||||||
mod monster_test_generated;
|
mod monster_test_generated;
|
||||||
pub use monster_test_generated::my_game;
|
pub use monster_test_generated::my_game;
|
||||||
|
|
|
@ -19,6 +19,7 @@ extern crate quickcheck;
|
||||||
|
|
||||||
extern crate flatbuffers;
|
extern crate flatbuffers;
|
||||||
|
|
||||||
|
#[allow(dead_code, unused_imports)]
|
||||||
#[path = "../../monster_test_generated.rs"]
|
#[path = "../../monster_test_generated.rs"]
|
||||||
mod monster_test_generated;
|
mod monster_test_generated;
|
||||||
pub use monster_test_generated::my_game;
|
pub use monster_test_generated::my_game;
|
||||||
|
|
Loading…
Reference in New Issue