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

clippy warnings #48

Open
reyk opened this issue Mar 12, 2020 · 1 comment
Open

clippy warnings #48

reyk opened this issue Mar 12, 2020 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@reyk
Copy link
Contributor

reyk commented Mar 12, 2020

DISCLAIMER: I'm using a non-default clippy configuration.

With that, I have to use the following block for the generated Rust code:

#![allow(
    clippy::unreadable_literal,
    clippy::empty_enum,
    clippy::unseparated_literal_suffix
)]
#![allow(single_use_lifetimes)]

This request is a "nice-to-have", not a real issue. But as the flatbuffers crate generates quite outdated and "dirty" rust code, it would be a nice benefit if butte could try to be as rust-2018-clean as possible. Either by adding the allow directives in the generated code or by generating it in the desired style.

  • clippy::unreadable_literal: this happens with very large default values, e.g.:

    table Hello {
        value: i64 = 1000000;
    }
    

    Clippy would expect 1_000_000. The FlatBuffers schema doesn't support this and converting the format would probably be an excessive step, but it could be a case for an [allow(clippy::unreadable_literal)] in the generated code.

  • clippy::empty_enum: this happens with the offset enums, e.g.:

    pub enum HelloOffset {}
  • clippy::unseparated_literal_suffix: this is part of the vtable, e.g.:

    pub const VT_ID: butte::VOffsetT = 4u16;
                                       ^^^^ help: add an underscore: 4_u16
  • single_use_lifetimes: This warning is a bit annoying since it generates too many false positives in perfectly valid code. So I should better fix my configuration ;-). Nevertheless, it appears in a number of places:

    impl<'a> HelloOptions<&'a [u8]> {
         ^^ this...        ^^ ...is used only here     
    ``
@lovesegfault lovesegfault added the enhancement New feature or request label Mar 12, 2020
@lovesegfault lovesegfault added this to the 0.2.0 milestone Mar 12, 2020
@reyk
Copy link
Contributor Author

reyk commented Mar 14, 2020

I found another one: missing_copy_implementations

That happens with small tables that only contain scalars or empty tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants