summaryrefslogtreecommitdiff
path: root/src/idl_gen_rust.cpp
diff options
context:
space:
mode:
authorbspeice <bspeice@users.noreply.github.com>2019-03-09 14:58:27 -0600
committerRobert <rw@users.noreply.github.com>2019-03-09 12:58:27 -0800
commit3968d0056865cb08c62b367470d18d633908565e (patch)
treea070f2ee3ee564dffd433c408111aa41ad8cebf1 /src/idl_gen_rust.cpp
parent4f10da8d99c1a7bc8c9c7d06d2092a689f171d29 (diff)
downloadflatbuffers-3968d0056865cb08c62b367470d18d633908565e.tar.gz
flatbuffers-3968d0056865cb08c62b367470d18d633908565e.tar.bz2
flatbuffers-3968d0056865cb08c62b367470d18d633908565e.zip
[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
Diffstat (limited to 'src/idl_gen_rust.cpp')
-rw-r--r--src/idl_gen_rust.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/idl_gen_rust.cpp b/src/idl_gen_rust.cpp
index ccfb376b..e8ecbbc4 100644
--- a/src/idl_gen_rust.cpp
+++ b/src/idl_gen_rust.cpp
@@ -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);