Skip to content

#[allow(clippy::fn_params_excessive_bools)] doesn't work on methods #9687

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

Closed
xFrednet opened this issue Oct 21, 2022 · 1 comment · Fixed by #9698
Closed

#[allow(clippy::fn_params_excessive_bools)] doesn't work on methods #9687

xFrednet opened this issue Oct 21, 2022 · 1 comment · Fixed by #9698
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@xFrednet
Copy link
Member

xFrednet commented Oct 21, 2022

Description

Lint: clippy::fn_params_excessive_bools

#[allow(clippy::fn_params_excessive_bools)] works on functions and impl blocks, but not on individual methods inside an impl blocks. The problem seams to be, that methods are checked from the impl block, which doesn't process the lint attributes on special functions. See:

ItemKind::Impl(box Impl {
of_trait: None, items, ..
})
| ItemKind::Trait(box Trait { items, .. }) => {
for item in items {
if let AssocItemKind::Fn(box Fn { sig, .. }) = &item.kind {
self.check_fn_sig(cx, sig, item.span);
}
}
},

Example:

Playground

#![deny(clippy::fn_params_excessive_bools)]
#![allow(dead_code)]

pub struct Test;

impl Test {
    #[allow(clippy::fn_params_excessive_bools)]
    fn new(
        is_const: bool,
        is_async: bool,
        is_unsafe: bool,
        is_extern: bool,
        is_awesome: bool,
        is_special: bool,
    ) -> Self {
        let _b = is_const || is_async || is_unsafe || is_extern || is_awesome || is_special;
        todo!()
    }
}

Version

rustc 1.66.0-nightly (9062b780b 2022-09-21)
binary: rustc
commit-hash: 9062b780b32d2eab060b4432863e085d9504ca5c
commit-date: 2022-09-21
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.0

Additional Labels

No response

@xFrednet xFrednet added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Oct 21, 2022
@kraktus
Copy link
Contributor

kraktus commented Oct 23, 2022

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
2 participants