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

[feat] add tauri-bindgen clippy #40

Open
JonasKruckenberg opened this issue Jan 28, 2023 · 0 comments
Open

[feat] add tauri-bindgen clippy #40

JonasKruckenberg opened this issue Jan 28, 2023 · 0 comments

Comments

@JonasKruckenberg
Copy link
Contributor

JonasKruckenberg commented Jan 28, 2023

Similar to cargo clippy provide lints to catch common problems and provide improvement tips.

Should be grouped into several groups such as correctness style perf. With associated lint levels.

Lints

  • unused
    Checks for unused type definitions.

  • excessive-tuple
    Due to restrictions in Rusts macros, Readable and Writable are only implemented for tuples up to (including) 16 fields.

  • type-complexity
    Checks for inline types above a certain complexity threshold.
    Complex types are bad for readability and should be simplified by breaking them up using type aliases

  • too-many-arguments
    Too many arguments reduce readability and should be grouped using new types.

  • too-many-returns
    Too many returns reduce readability and should be grouped using new types.

  • needless-result
    Checks for result<t, ()> types that can be written more concisely as option<t>

  • invisible-characters
    Invisible characters can mess up all sorts of things

  • variant-without-payload
    Rejects variants that only have unit cases without any types. These should be declared as enums instead.

  • variant-with-typenames
    Rejects variants which names equal the type should be written as unions.
    Example:

    variant {
       u8<u8>,
       list_u8<list<u8>>
    }
    # should be
    enum {
       u8,
       list<u8>
    }
    
  • record-of-bools
    Rejects structs with all-bool fields that should be written as flags.

  • list-of-enums
    A list of enum values is semantically equivalent as flags.

    enum value {
       a,
       b,
       c,
    }
    type values = list<value>
    
    // should be written as
    flags values {
       a,
       b,
       c,
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant