summaryrefslogtreecommitdiff
path: root/tests/include_test
diff options
context:
space:
mode:
authorCasper <casperneo@uchicago.edu>2020-07-25 13:46:20 -0700
committerGitHub <noreply@github.com>2020-07-25 13:46:20 -0700
commit18b015d25a0dbc29be48956b73a5591b870aa109 (patch)
tree252fdaafc73a27628d4f5c5aa119fa48752abb36 /tests/include_test
parentd76e93f277a5111409c3aebd98bfb4f3bf67d465 (diff)
downloadflatbuffers-18b015d25a0dbc29be48956b73a5591b870aa109.tar.gz
flatbuffers-18b015d25a0dbc29be48956b73a5591b870aa109.tar.bz2
flatbuffers-18b015d25a0dbc29be48956b73a5591b870aa109.zip
Rust codegen improvements and lint fixes (#6046)
* Improve rust codegen * one more unneeded lifetime * Added a derive default Co-authored-by: Casper Neo <cneo@google.com>
Diffstat (limited to 'tests/include_test')
-rw-r--r--tests/include_test/include_test1_generated.rs6
-rw-r--r--tests/include_test/sub/include_test2_generated.rs14
2 files changed, 8 insertions, 12 deletions
diff --git a/tests/include_test/include_test1_generated.rs b/tests/include_test/include_test1_generated.rs
index e6e7d490..3c549e01 100644
--- a/tests/include_test/include_test1_generated.rs
+++ b/tests/include_test/include_test1_generated.rs
@@ -20,9 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- Self {
- _tab: flatbuffers::Table { buf: buf, loc: loc },
- }
+ Self { _tab: flatbuffers::Table { buf, loc } }
}
}
@@ -51,7 +49,7 @@ impl<'a> TableA<'a> {
}
pub struct TableAArgs<'a> {
- pub b: Option<flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a >>>,
+ pub b: Option<flatbuffers::WIPOffset<my_game::other_name_space::TableB<'a>>>,
}
impl<'a> Default for TableAArgs<'a> {
#[inline]
diff --git a/tests/include_test/sub/include_test2_generated.rs b/tests/include_test/sub/include_test2_generated.rs
index eee54a93..a3500c97 100644
--- a/tests/include_test/sub/include_test2_generated.rs
+++ b/tests/include_test/sub/include_test2_generated.rs
@@ -71,12 +71,12 @@ impl flatbuffers::Push for FromInclude {
}
#[allow(non_camel_case_types)]
-pub const ENUM_VALUES_FROM_INCLUDE:[FromInclude; 1] = [
+pub const ENUM_VALUES_FROM_INCLUDE: [FromInclude; 1] = [
FromInclude::IncludeVal
];
#[allow(non_camel_case_types)]
-pub const ENUM_NAMES_FROM_INCLUDE:[&'static str; 1] = [
+pub const ENUM_NAMES_FROM_INCLUDE: [&str; 1] = [
"IncludeVal"
];
@@ -130,13 +130,13 @@ impl<'b> flatbuffers::Push for &'b Unused {
impl Unused {
- pub fn new<'a>(_a: i32) -> Self {
+ pub fn new(_a: i32) -> Self {
Unused {
a_: _a.to_little_endian(),
}
}
- pub fn a<'a>(&'a self) -> i32 {
+ pub fn a(&self) -> i32 {
self.a_.from_little_endian()
}
}
@@ -152,9 +152,7 @@ impl<'a> flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- Self {
- _tab: flatbuffers::Table { buf: buf, loc: loc },
- }
+ Self { _tab: flatbuffers::Table { buf, loc } }
}
}
@@ -183,7 +181,7 @@ impl<'a> TableB<'a> {
}
pub struct TableBArgs<'a> {
- pub a: Option<flatbuffers::WIPOffset<super::super::TableA<'a >>>,
+ pub a: Option<flatbuffers::WIPOffset<super::super::TableA<'a>>>,
}
impl<'a> Default for TableBArgs<'a> {
#[inline]