Skip to content

Commit aa03344

Browse files
committed
Auto merge of rust-lang#8797 - xFrednet:0000-expect-a-playground, r=flip1995
Replace `#[allow]` with `#[expect]` in Clippy Hey `@rust-lang/clippy,` `@Alexendoo,` `@dswij,` I'm currently working on the expect attribute as defined in [Rust RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html). With that, an `#[allow]` attribute can be replaced with a `#[expect]` attribute that suppresses the lint, but also emits a warning, if the lint isn't emitted in the expected scope. With this PR I would like to test the attribute on a project scale and Clippy obviously came to mind. This PR replaces (almost) all `#[allow]` attributes in `clippy_utils` and `clippy_lints` with the `#[expect]` attribute. I was also able to remove some allows since, the related FPs have been fixed 🎉. My question is now, are there any concerns regarding this? It's still okay to add normal `#[allow]` attributes, I see the need to nit-pick about that in new PRs, unless it's actually a FP. Also, I would not recommend using `#[expect]` in tests, as changes to a lint could the trigger the expect attribute in other files. Additionally, I've noticed that Clippy has a bunch of `#[allow(clippy::too_many_lines)]` attributes. Should we maybe allow the lint all together or increase the threshold setting? To me, it seems like we mostly just ignore it in our code. 😅 🙃 --- changelog: none r? `@flip1995` (I've requested you for now, since you're also helping with reviewing the expect implementation. You are welcome to delegate this PR, even if it should be a simple review 🙃 )
2 parents c3f3c58 + 03960eb commit aa03344

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+73
-93
lines changed

clippy_lints/src/booleans.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
137137
}
138138
for (n, expr) in self.terminals.iter().enumerate() {
139139
if eq_expr_value(self.cx, e, expr) {
140-
#[allow(clippy::cast_possible_truncation)]
140+
#[expect(clippy::cast_possible_truncation)]
141141
return Ok(Bool::Term(n as u8));
142142
}
143143

@@ -149,15 +149,15 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
149149
if eq_expr_value(self.cx, e_lhs, expr_lhs);
150150
if eq_expr_value(self.cx, e_rhs, expr_rhs);
151151
then {
152-
#[allow(clippy::cast_possible_truncation)]
152+
#[expect(clippy::cast_possible_truncation)]
153153
return Ok(Bool::Not(Box::new(Bool::Term(n as u8))));
154154
}
155155
}
156156
}
157157
let n = self.terminals.len();
158158
self.terminals.push(e);
159159
if n < 32 {
160-
#[allow(clippy::cast_possible_truncation)]
160+
#[expect(clippy::cast_possible_truncation)]
161161
Ok(Bool::Term(n as u8))
162162
} else {
163163
Err("too many literals".to_owned())

clippy_lints/src/cognitive_complexity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl CognitiveComplexity {
4848
impl_lint_pass!(CognitiveComplexity => [COGNITIVE_COMPLEXITY]);
4949

5050
impl CognitiveComplexity {
51-
#[allow(clippy::cast_possible_truncation)]
51+
#[expect(clippy::cast_possible_truncation)]
5252
fn check<'tcx>(
5353
&mut self,
5454
cx: &LateContext<'tcx>,
@@ -70,7 +70,7 @@ impl CognitiveComplexity {
7070
let ret_adjust = if is_type_diagnostic_item(cx, ret_ty, sym::Result) {
7171
returns
7272
} else {
73-
#[allow(clippy::integer_division)]
73+
#[expect(clippy::integer_division)]
7474
(returns / 2)
7575
};
7676

clippy_lints/src/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
110110
}
111111
}
112112

113-
#[allow(clippy::too_many_lines)]
113+
#[expect(clippy::too_many_lines)]
114114
fn check_block(&mut self, cx: &LateContext<'tcx>, block: &Block<'tcx>) {
115115
// start from the `let mut _ = _::default();` and look at all the following
116116
// statements, see if they re-assign the fields of the binding

clippy_lints/src/default_numeric_fallback.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ impl<'a, 'tcx> NumericFallbackVisitor<'a, 'tcx> {
116116
}
117117

118118
impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
119-
#[allow(clippy::too_many_lines)]
120119
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
121120
match &expr.kind {
122121
ExprKind::Call(func, args) => {

clippy_lints/src/dereference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ struct RefPat {
168168
}
169169

170170
impl<'tcx> LateLintPass<'tcx> for Dereferencing {
171-
#[allow(clippy::too_many_lines)]
171+
#[expect(clippy::too_many_lines)]
172172
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
173173
// Skip path expressions from deref calls. e.g. `Deref::deref(e)`
174174
if Some(expr.hir_id) == self.skip_expr.take() {
@@ -580,7 +580,7 @@ fn find_adjustments<'tcx>(
580580
}
581581
}
582582

583-
#[allow(clippy::needless_pass_by_value)]
583+
#[expect(clippy::needless_pass_by_value)]
584584
fn report(cx: &LateContext<'_>, expr: &Expr<'_>, state: State, data: StateData) {
585585
match state {
586586
State::DerefMethod {

clippy_lints/src/doc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ declare_clippy_lint! {
198198
"presence of `fn main() {` in code examples"
199199
}
200200

201-
#[allow(clippy::module_name_repetitions)]
201+
#[expect(clippy::module_name_repetitions)]
202202
#[derive(Clone)]
203203
pub struct DocMarkdown {
204204
valid_idents: FxHashSet<String>,
@@ -373,7 +373,7 @@ fn lint_for_missing_headers<'tcx>(
373373
/// `rustc_ast::parse::lexer::comments::strip_doc_comment_decoration` because we
374374
/// need to keep track of
375375
/// the spans but this function is inspired from the later.
376-
#[allow(clippy::cast_possible_truncation)]
376+
#[expect(clippy::cast_possible_truncation)]
377377
#[must_use]
378378
pub fn strip_doc_comment_decoration(doc: &str, comment_kind: CommentKind, span: Span) -> (String, Vec<(usize, Span)>) {
379379
// one-line comments lose their prefix
@@ -428,7 +428,7 @@ fn check_attrs<'a>(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, attrs
428428
/// We don't want the parser to choke on intra doc links. Since we don't
429429
/// actually care about rendering them, just pretend that all broken links are
430430
/// point to a fake address.
431-
#[allow(clippy::unnecessary_wraps)] // we're following a type signature
431+
#[expect(clippy::unnecessary_wraps)] // we're following a type signature
432432
fn fake_broken_link_callback<'a>(_: BrokenLink<'_>) -> Option<(CowStr<'a>, CowStr<'a>)> {
433433
Some(("fake".into(), "fake".into()))
434434
}

clippy_lints/src/double_comparison.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ declare_clippy_lint! {
4040
declare_lint_pass!(DoubleComparisons => [DOUBLE_COMPARISONS]);
4141

4242
impl<'tcx> DoubleComparisons {
43-
#[allow(clippy::similar_names)]
43+
#[expect(clippy::similar_names)]
4444
fn check_binop(cx: &LateContext<'tcx>, op: BinOpKind, lhs: &'tcx Expr<'_>, rhs: &'tcx Expr<'_>, span: Span) {
4545
let (lkind, llhs, lrhs, rkind, rlhs, rrhs) = match (&lhs.kind, &rhs.kind) {
4646
(ExprKind::Binary(lb, llhs, lrhs), ExprKind::Binary(rb, rlhs, rrhs)) => {

clippy_lints/src/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ declare_clippy_lint! {
6363
declare_lint_pass!(HashMapPass => [MAP_ENTRY]);
6464

6565
impl<'tcx> LateLintPass<'tcx> for HashMapPass {
66-
#[allow(clippy::too_many_lines)]
66+
#[expect(clippy::too_many_lines)]
6767
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
6868
let (cond_expr, then_expr, else_expr) = match higher::If::hir(expr) {
6969
Some(higher::If { cond, then, r#else }) => (cond, then, r#else),
@@ -319,7 +319,7 @@ struct Insertion<'tcx> {
319319
/// `or_insert_with`.
320320
/// * Determine if there's any sub-expression that can't be placed in a closure.
321321
/// * Determine if there's only a single insert statement. `or_insert` can be used in this case.
322-
#[allow(clippy::struct_excessive_bools)]
322+
#[expect(clippy::struct_excessive_bools)]
323323
struct InsertSearcher<'cx, 'tcx> {
324324
cx: &'cx LateContext<'tcx>,
325325
/// The map expression used in the contains call.

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ declare_clippy_lint! {
3737
declare_lint_pass!(UnportableVariant => [ENUM_CLIKE_UNPORTABLE_VARIANT]);
3838

3939
impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
40-
#[allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap, clippy::cast_sign_loss)]
40+
#[expect(clippy::cast_possible_wrap)]
4141
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
4242
if cx.tcx.data_layout.pointer_size.bits() != 64 {
4343
return;

clippy_lints/src/enum_variants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl LateLintPass<'_> for EnumVariantNames {
240240
assert!(last.is_some());
241241
}
242242

243-
#[allow(clippy::similar_names)]
243+
#[expect(clippy::similar_names)]
244244
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
245245
let item_name = item.ident.name.as_str();
246246
let item_camel = to_camel_case(item_name);

clippy_lints/src/eq_op.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ declare_clippy_lint! {
7272
declare_lint_pass!(EqOp => [EQ_OP, OP_REF]);
7373

7474
impl<'tcx> LateLintPass<'tcx> for EqOp {
75-
#[allow(clippy::similar_names, clippy::too_many_lines)]
75+
#[expect(clippy::similar_names, clippy::too_many_lines)]
7676
fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) {
7777
if_chain! {
7878
if let Some((macro_call, macro_name)) = first_node_macro_backtrace(cx, e).find_map(|macro_call| {
@@ -138,7 +138,6 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
138138
},
139139
};
140140
if let Some(trait_id) = trait_id {
141-
#[allow(clippy::match_same_arms)]
142141
match (&left.kind, &right.kind) {
143142
// do not suggest to dereference literals
144143
(&ExprKind::Lit(..), _) | (_, &ExprKind::Lit(..)) => {},

clippy_lints/src/floating_point_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ fn check_ln1p(cx: &LateContext<'_>, expr: &Expr<'_>, args: &[Expr<'_>]) {
215215
// converted to an integer without loss of precision. For now we only check
216216
// ranges [-16777215, 16777216) for type f32 as whole number floats outside
217217
// this range are lossy and ambiguous.
218-
#[allow(clippy::cast_possible_truncation)]
218+
#[expect(clippy::cast_possible_truncation)]
219219
fn get_integer_from_float_constant(value: &Constant) -> Option<i32> {
220220
match value {
221221
F32(num) if num.fract() == 0.0 => {

clippy_lints/src/implicit_hasher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ declare_clippy_lint! {
6262
declare_lint_pass!(ImplicitHasher => [IMPLICIT_HASHER]);
6363

6464
impl<'tcx> LateLintPass<'tcx> for ImplicitHasher {
65-
#[allow(clippy::cast_possible_truncation, clippy::too_many_lines)]
65+
#[expect(clippy::cast_possible_truncation, clippy::too_many_lines)]
6666
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
6767
use rustc_span::BytePos;
6868

clippy_lints/src/implicit_return.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fn lint_implicit_returns(
164164
})
165165
.visit_block(block);
166166
if add_return {
167-
#[allow(clippy::option_if_let_else)]
167+
#[expect(clippy::option_if_let_else)]
168168
if let Some(span) = call_site_span {
169169
lint_return(cx, span);
170170
LintLocation::Parent
@@ -196,7 +196,7 @@ fn lint_implicit_returns(
196196

197197
_ =>
198198
{
199-
#[allow(clippy::option_if_let_else)]
199+
#[expect(clippy::option_if_let_else)]
200200
if let Some(span) = call_site_span {
201201
lint_return(cx, span);
202202
LintLocation::Parent

clippy_lints/src/int_plus_one.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ enum Side {
5252
}
5353

5454
impl IntPlusOne {
55-
#[allow(clippy::cast_sign_loss)]
55+
#[expect(clippy::cast_sign_loss)]
5656
fn check_lit(lit: &Lit, target_value: i128) -> bool {
5757
if let LitKind::Int(value, ..) = lit.kind {
5858
return value == (target_value as u128);

clippy_lints/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#![feature(iter_intersperse)]
99
#![feature(let_chains)]
1010
#![feature(let_else)]
11+
#![feature(lint_reasons)]
1112
#![feature(once_cell)]
1213
#![feature(rustc_private)]
1314
#![feature(stmt_expr_attributes)]
@@ -472,7 +473,7 @@ pub fn read_conf(sess: &Session) -> Conf {
472473
/// Register all lints and lint groups with the rustc plugin registry
473474
///
474475
/// Used in `./src/driver.rs`.
475-
#[allow(clippy::too_many_lines)]
476+
#[expect(clippy::too_many_lines)]
476477
pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: &Conf) {
477478
register_removed_non_tool_lints(store);
478479

clippy_lints/src/literal_representation.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ impl WarningType {
204204
}
205205
}
206206

207-
#[allow(clippy::module_name_repetitions)]
208207
#[derive(Copy, Clone)]
209208
pub struct LiteralDigitGrouping {
210209
lint_fraction_readability: bool,
@@ -432,7 +431,7 @@ impl LiteralDigitGrouping {
432431
}
433432
}
434433

435-
#[allow(clippy::module_name_repetitions)]
434+
#[expect(clippy::module_name_repetitions)]
436435
#[derive(Copy, Clone)]
437436
pub struct DecimalLiteralRepresentation {
438437
threshold: u64,

clippy_lints/src/loops/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ declare_lint_pass!(Loops => [
620620
]);
621621

622622
impl<'tcx> LateLintPass<'tcx> for Loops {
623-
#[allow(clippy::too_many_lines)]
624623
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
625624
let for_loop = higher::ForLoop::hir(expr);
626625
if let Some(higher::ForLoop {

clippy_lints/src/loops/needless_range_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::mem;
1919

2020
/// Checks for looping over a range and then indexing a sequence with it.
2121
/// The iteratee must be a range literal.
22-
#[allow(clippy::too_many_lines)]
22+
#[expect(clippy::too_many_lines)]
2323
pub(super) fn check<'tcx>(
2424
cx: &LateContext<'tcx>,
2525
pat: &'tcx Pat<'_>,

clippy_lints/src/loops/while_let_on_iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn uses_iter<'tcx>(cx: &LateContext<'tcx>, iter_expr: &IterExpr, container: &'tc
239239
v.uses_iter
240240
}
241241

242-
#[allow(clippy::too_many_lines)]
242+
#[expect(clippy::too_many_lines)]
243243
fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: &Expr<'_>) -> bool {
244244
struct AfterLoopVisitor<'a, 'b, 'tcx> {
245245
cx: &'a LateContext<'tcx>,

clippy_lints/src/macro_use.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl MacroRefData {
4949
}
5050

5151
#[derive(Default)]
52-
#[allow(clippy::module_name_repetitions)]
52+
#[expect(clippy::module_name_repetitions)]
5353
pub struct MacroUseImports {
5454
/// the actual import path used and the span of the attribute above it.
5555
imports: Vec<(String, Span)>,
@@ -135,7 +135,6 @@ impl<'tcx> LateLintPass<'tcx> for MacroUseImports {
135135
self.push_unique_macro_pat_ty(cx, ty.span);
136136
}
137137
}
138-
#[allow(clippy::too_many_lines)]
139138
fn check_crate_post(&mut self, cx: &LateContext<'_>) {
140139
let mut used = FxHashMap::default();
141140
let mut check_dup = vec![];

clippy_lints/src/manual_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ declare_clippy_lint! {
4646
declare_lint_pass!(ManualMap => [MANUAL_MAP]);
4747

4848
impl<'tcx> LateLintPass<'tcx> for ManualMap {
49-
#[allow(clippy::too_many_lines)]
49+
#[expect(clippy::too_many_lines)]
5050
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
5151
let (scrutinee, then_pat, then_body, else_pat, else_body) = match IfLetOrMatch::parse(cx, expr) {
5252
Some(IfLetOrMatch::IfLet(scrutinee, pat, body, Some(r#else))) => (scrutinee, pat, body, None, r#else),

clippy_lints/src/manual_non_exhaustive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ declare_clippy_lint! {
6262
"manual implementations of the non-exhaustive pattern can be simplified using #[non_exhaustive]"
6363
}
6464

65-
#[allow(clippy::module_name_repetitions)]
65+
#[expect(clippy::module_name_repetitions)]
6666
pub struct ManualNonExhaustiveStruct {
6767
msrv: Option<RustcVersion>,
6868
}
@@ -76,7 +76,7 @@ impl ManualNonExhaustiveStruct {
7676

7777
impl_lint_pass!(ManualNonExhaustiveStruct => [MANUAL_NON_EXHAUSTIVE]);
7878

79-
#[allow(clippy::module_name_repetitions)]
79+
#[expect(clippy::module_name_repetitions)]
8080
pub struct ManualNonExhaustiveEnum {
8181
msrv: Option<RustcVersion>,
8282
constructed_enum_variants: FxHashSet<(DefId, DefId)>,

clippy_lints/src/matches/match_same_arms.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::collections::hash_map::Entry;
1616

1717
use super::MATCH_SAME_ARMS;
1818

19-
#[allow(clippy::too_many_lines)]
19+
#[expect(clippy::too_many_lines)]
2020
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
2121
let hash = |&(_, arm): &(usize, &Arm<'_>)| -> u64 {
2222
let mut h = SpanlessHash::new(cx);
@@ -225,9 +225,9 @@ fn iter_matching_struct_fields<'a>(
225225
Iter(left.iter(), right.iter())
226226
}
227227

228-
#[allow(clippy::similar_names)]
228+
#[expect(clippy::similar_names)]
229229
impl<'a> NormalizedPat<'a> {
230-
#[allow(clippy::too_many_lines)]
230+
#[expect(clippy::too_many_lines)]
231231
fn from_pat(cx: &LateContext<'_>, arena: &'a DroplessArena, pat: &'a Pat<'_>) -> Self {
232232
match pat.kind {
233233
PatKind::Wild | PatKind::Binding(.., None) => Self::Wild,

clippy_lints/src/matches/match_single_binding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_lint::LateContext;
88

99
use super::MATCH_SINGLE_BINDING;
1010

11-
#[allow(clippy::too_many_lines)]
11+
#[expect(clippy::too_many_lines)]
1212
pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], expr: &Expr<'_>) {
1313
if expr.span.from_expansion() || arms.len() != 1 || is_refutable(cx, arms[0].pat) {
1414
return;

clippy_lints/src/matches/match_wild_enum.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_span::sym;
1010

1111
use super::{MATCH_WILDCARD_FOR_SINGLE_VARIANTS, WILDCARD_ENUM_MATCH_ARM};
1212

13-
#[allow(clippy::too_many_lines)]
13+
#[expect(clippy::too_many_lines)]
1414
pub(crate) fn check(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>]) {
1515
let ty = cx.typeck_results().expr_ty(ex).peel_refs();
1616
let adt_def = match ty.kind() {
@@ -56,7 +56,6 @@ pub(crate) fn check(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>]) {
5656
recurse_or_patterns(arm.pat, |pat| {
5757
let path = match &peel_hir_pat_refs(pat).0.kind {
5858
PatKind::Path(path) => {
59-
#[allow(clippy::match_same_arms)]
6059
let id = match cx.qpath_res(path, pat.hir_id) {
6160
Res::Def(
6261
DefKind::Const | DefKind::ConstParam | DefKind::AnonConst | DefKind::InlineConst,

clippy_lints/src/matches/redundant_pattern_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ pub(super) fn check_match<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, op
340340
}
341341
}
342342

343-
#[allow(clippy::too_many_arguments)]
343+
#[expect(clippy::too_many_arguments)]
344344
fn find_good_method_for_match<'a>(
345345
cx: &LateContext<'_>,
346346
arms: &[Arm<'_>],

clippy_lints/src/misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ fn is_array(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
548548
matches!(&cx.typeck_results().expr_ty(expr).peel_refs().kind(), ty::Array(_, _))
549549
}
550550

551-
#[allow(clippy::too_many_lines)]
551+
#[expect(clippy::too_many_lines)]
552552
fn check_to_owned(cx: &LateContext<'_>, expr: &Expr<'_>, other: &Expr<'_>, left: bool) {
553553
#[derive(Default)]
554554
struct EqImpl {

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ macro_rules! need {
7070
}
7171

7272
impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
73-
#[allow(clippy::too_many_lines)]
73+
#[expect(clippy::too_many_lines)]
7474
fn check_fn(
7575
&mut self,
7676
cx: &LateContext<'tcx>,

clippy_lints/src/neg_multiply.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ declare_clippy_lint! {
3434

3535
declare_lint_pass!(NegMultiply => [NEG_MULTIPLY]);
3636

37-
#[allow(clippy::match_same_arms)]
3837
impl<'tcx> LateLintPass<'tcx> for NegMultiply {
3938
fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) {
4039
if let ExprKind::Binary(ref op, left, right) = e.kind {

0 commit comments

Comments
 (0)