Skip to content

Interned struct with 7 fields or more leads to clippy::too_many_arguments #808

Closed
@sharkdp

Description

@sharkdp

When a salsa::interned struct has 7 fields or more, clippy issues a too_many_arguments diagnostic for generated code that can not be silenced by a local #[allow(clippy::too_many_arguments)].

To reproduce, add the following struct to e.g. tests/interned-structs.rs:

#[salsa::interned(debug)]
struct ManyFields<'db> {
    x1: u32,
    x2: u32,
    x3: u32,
    x4: u32,
    x5: u32,
    x6: u32,
    x7: u32,
}

and run clippy:

▶ cargo clippy --all-targets                
    Checking salsa v0.19.0 (/home/shark/salsa)
warning: this function has too many arguments (8/7)
  --> tests/interned-structs.rs:20:1
   |
20 | #[salsa::interned(debug)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: `#[warn(clippy::too_many_arguments)]` on by default
   = note: this warning originates in the macro `salsa::plumbing::setup_interned_struct` which comes from the expansion of the attribute macro `salsa::interned` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `salsa` (test "interned-structs") generated 1 warning

It would be good if salsa would take care of this automatically, or allow users to silence the clippy warning without having to disable this lint globally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions