Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust] Generated code produces warnings about snake case / camel case #5053

Closed
andygrove opened this issue Nov 18, 2018 · 4 comments
Closed
Labels

Comments

@andygrove
Copy link

Language: Rust
OS: Ubuntu 16.04
GCC: 5.4.0

Because flatbuffers files are intended for use across multiple languages, there is no guarantee that the generated code will use Rust style snake case etc, leading to compiler warnings.

It would be good to have the option of either generating idiomatic Rust code, or generating these directives to disable the warnings:

#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
@aardappel
Copy link
Collaborator

Since FlatBuffers started with C++, it was assumed that schemas would be written in snake_case for fields (which corresponds to most C++ style guides), and then we added ways to convert those to various camels for Java/C# etc. But yes, we don't enforce this, and we don't do the reverse if someone writes their schemas in a camel case. Maybe we should.

@rw
Copy link
Collaborator

rw commented Nov 20, 2018

@andygrove You can see here that we already emit these directives in some cases:

#[allow(non_snake_case)]

Would you be able to point out where else the directives should be emitted? Thanks!

@aardappel
Copy link
Collaborator

Also note the FlatBuffers style guide says things like field names should already be snake_case: https://google.github.io/flatbuffers/flatbuffers_guide_writing_schema.html (under "style guide"). Which identifiers have the wrong case?

kszucs pushed a commit to apache/arrow that referenced this issue Apr 8, 2019
I generated the IPC code after installing the flatbuffers release available via conda but still had to manually modify the code to make it compile due to these issues with flatbuffers:

google/flatbuffers#5052
google/flatbuffers#5053
google/flatbuffers#5054

I think this is the best we can do for now.

Author: Andy Grove <[email protected]>

Closes #4021 from andygrove/rust-ipc and squashes the following commits:

7a549be <Andy Grove> encode field data type
ab769bb <Andy Grove> delete file
a81bee9 <Andy Grove> fix CI
1bbc4a7 <Andy Grove> Update README
83f3b4c <Andy Grove> Add generated IPC code
@stale
Copy link

stale bot commented Jul 27, 2019

This issue has been automatically marked as stale because it has not had activity for 6 months. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 27, 2019
@stale stale bot closed this as completed Aug 23, 2019
alamb pushed a commit to apache/arrow-rs that referenced this issue Apr 20, 2021
I generated the IPC code after installing the flatbuffers release available via conda but still had to manually modify the code to make it compile due to these issues with flatbuffers:

google/flatbuffers#5052
google/flatbuffers#5053
google/flatbuffers#5054

I think this is the best we can do for now.

Author: Andy Grove <[email protected]>

Closes #4021 from andygrove/rust-ipc and squashes the following commits:

7a549be9e <Andy Grove> encode field data type
ab769bba5 <Andy Grove> delete file
a81bee9b3 <Andy Grove> fix CI
1bbc4a76b <Andy Grove> Update README
83f3b4c06 <Andy Grove> Add generated IPC code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants