summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormqy <meng.qingyou@gmail.com>2020-12-18 05:15:27 +0800
committerGitHub <noreply@github.com>2020-12-17 13:15:27 -0800
commit05192553f434d10c5f585aeb6a07a55a6ac702a5 (patch)
treea14138600c5d0a841c728fbc681abe2edd850ca0
parentf2511d7d49d35a9a3069600d887261cde74bdd32 (diff)
downloadflatbuffers-05192553f434d10c5f585aeb6a07a55a6ac702a5.tar.gz
flatbuffers-05192553f434d10c5f585aeb6a07a55a6ac702a5.tar.bz2
flatbuffers-05192553f434d10c5f585aeb6a07a55a6ac702a5.zip
Fix typos in usage/comments; Make rust generator respect to --filenam… (#6342)
* Fix typos in usage/comments; Make rust generator respect to --filename-suffix * run clang format
-rw-r--r--src/flatc.cpp6
-rw-r--r--src/idl_gen_rust.cpp5
-rw-r--r--src/idl_parser.cpp2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/flatc.cpp b/src/flatc.cpp
index 09acb076..d51120fe 100644
--- a/src/flatc.cpp
+++ b/src/flatc.cpp
@@ -132,10 +132,10 @@ std::string FlatCompiler::GetUsageString(const char *program_name) const {
" --no-js-exports Removes Node.js style export lines in JS.\n"
" --goog-js-export Uses goog.exports* for closure compiler exporting in JS.\n"
" --es6-js-export Uses ECMAScript 6 export style lines in JS.\n"
- " --go-namespace Generate the overrided namespace in Golang.\n"
- " --go-import Generate the overrided import for flatbuffers in Golang\n"
+ " --go-namespace Generate the overriding namespace in Golang.\n"
+ " --go-import Generate the overriding import for flatbuffers in Golang\n"
" (default is \"github.com/google/flatbuffers/go\").\n"
- " --raw-binary Allow binaries without file_indentifier to be read.\n"
+ " --raw-binary Allow binaries without file_identifier to be read.\n"
" This may crash flatc given a mismatched schema.\n"
" --size-prefixed Input binaries are size prefixed buffers.\n"
" --proto Input is a .proto, translate to .fbs.\n"
diff --git a/src/idl_gen_rust.cpp b/src/idl_gen_rust.cpp
index 3c17b5cc..04c779da 100644
--- a/src/idl_gen_rust.cpp
+++ b/src/idl_gen_rust.cpp
@@ -24,7 +24,7 @@
namespace flatbuffers {
// Convert a camelCaseIdentifier or CamelCaseIdentifier to a
-// snake_case_indentifier.
+// snake_case_identifier.
std::string MakeSnakeCase(const std::string &in) {
std::string s;
for (size_t i = 0; i < in.length(); i++) {
@@ -1907,7 +1907,8 @@ class RustGenerator : public BaseGenerator {
auto noext = flatbuffers::StripExtension(it->second);
auto basename = flatbuffers::StripPath(noext);
- code_ += indent + "use crate::" + basename + "_generated::*;";
+ code_ += indent + "use crate::" + basename +
+ parser_.opts.filename_suffix + "::*;";
}
}
diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp
index a32c93c3..015a7112 100644
--- a/src/idl_parser.cpp
+++ b/src/idl_parser.cpp
@@ -92,7 +92,7 @@ static bool IsLowerSnakeCase(const std::string &str) {
return true;
}
-// Convert an underscore_based_indentifier in to camelCase.
+// Convert an underscore_based_identifier in to camelCase.
// Also uppercases the first character if first is true.
std::string MakeCamel(const std::string &in, bool first) {
std::string s;