-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
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:
rust-clippy/clippy_lints/src/excessive_bools.rs
Lines 162 to 171 in 967f172
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:
#![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
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have