forked from BigfootDev/flatbuffers
fixed invalid imports with --gen-all (#5895)
* fixed invalid imports with --gen-all * only excluding crate imports Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
This commit is contained in:
@@ -1786,14 +1786,17 @@ 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_ += "";
|
code_ += "";
|
||||||
for (auto it = parser_.included_files_.begin();
|
if (!parser_.opts.generate_all) {
|
||||||
it != parser_.included_files_.end(); ++it) {
|
for (auto it = parser_.included_files_.begin();
|
||||||
if (it->second.empty()) continue;
|
it != parser_.included_files_.end(); ++it) {
|
||||||
auto noext = flatbuffers::StripExtension(it->second);
|
if (it->second.empty()) continue;
|
||||||
auto basename = flatbuffers::StripPath(noext);
|
auto noext = flatbuffers::StripExtension(it->second);
|
||||||
|
auto basename = flatbuffers::StripPath(noext);
|
||||||
|
|
||||||
code_ += indent + "use crate::" + basename + "_generated::*;";
|
code_ += indent + "use crate::" + basename + "_generated::*;";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code_ += indent + "use std::mem;";
|
code_ += indent + "use std::mem;";
|
||||||
code_ += indent + "use std::cmp::Ordering;";
|
code_ += indent + "use std::cmp::Ordering;";
|
||||||
code_ += "";
|
code_ += "";
|
||||||
|
|||||||
Reference in New Issue
Block a user