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

Reduce clippy noise from #[Object] macro #1496

Open
negezor opened this issue Mar 17, 2024 · 2 comments
Open

Reduce clippy noise from #[Object] macro #1496

negezor opened this issue Mar 17, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@negezor
Copy link
Contributor

negezor commented Mar 17, 2024

At the moment, when I run cargo clippy, I get a huge number of warnings related to “this function has too many arguments”. This mainly happens in fields that have a large number of filters or relay connections.

warning: this function has too many arguments (9/7)
   --> src/graphql/schema/users/user_friend.rs:116:1
    |
116 | #[Object]
    | ^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
    = note: this warning originates in the attribute macro `Object` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: this function has too many arguments (11/7)
   --> src/graphql/schema/users/user_log.rs:506:1
    |
506 | #[Object]
    | ^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
    = note: this warning originates in the attribute macro `Object` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: this function has too many arguments (8/7)
   --> src/graphql/schema/users/user.rs:644:1
    |
644 | #[Object]
    | ^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
    = note: this warning originates in the attribute macro `Object` (in Nightly builds, run with -Z macro-backtrace for more info)

Description of the feature

I suggest adding the following snippet for clippy if the method has more than 4 arguments.

#[allow(clippy::too_many_arguments)]

@negezor negezor added the enhancement New feature or request label Mar 17, 2024
@sunli829
Copy link
Collaborator

what version of Rust are you using?

@negezor
Copy link
Contributor Author

negezor commented Mar 24, 2024

@sunli829 These warrnings are present in several major versions of async-graphql. I just tried not to pay attention to them until the project grew.

async-graphql: 7.0.3
rust: 1.77.0

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