Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 5250afb

Browse files
committed
Remove '#[expect(clippy::similar_names)]' where needed to pass dogfood tests
1 parent 09f18f6 commit 5250afb

File tree

8 files changed

+27
-34
lines changed

8 files changed

+27
-34
lines changed

clippy_lints/src/item_name_repetitions.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ impl LateLintPass<'_> for ItemNameRepetitions {
385385
assert!(last.is_some());
386386
}
387387

388-
#[expect(clippy::similar_names)]
389388
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
390389
let item_name = item.ident.name.as_str();
391390
let item_camel = to_camel_case(item_name);

clippy_lints/src/operators/double_comparison.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_span::Span;
88

99
use super::DOUBLE_COMPARISONS;
1010

11-
#[expect(clippy::similar_names)]
1211
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, op: BinOpKind, lhs: &'tcx Expr<'_>, rhs: &'tcx Expr<'_>, span: Span) {
1312
let (lkind, llhs, lrhs, rkind, rlhs, rrhs) = match (&lhs.kind, &rhs.kind) {
1413
(ExprKind::Binary(lb, llhs, lrhs), ExprKind::Binary(rb, rlhs, rrhs)) => {

clippy_lints/src/operators/op_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_middle::ty::{self, Ty};
1111

1212
use super::OP_REF;
1313

14-
#[expect(clippy::similar_names, clippy::too_many_lines)]
14+
#[expect(clippy::too_many_lines)]
1515
pub(crate) fn check<'tcx>(
1616
cx: &LateContext<'tcx>,
1717
e: &'tcx Expr<'_>,

clippy_utils/src/ast_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! - The `eq_foobar` functions test for semantic equality but ignores `NodeId`s and `Span`s.
44
5-
#![allow(clippy::similar_names, clippy::wildcard_imports, clippy::enum_glob_use)]
5+
#![allow(clippy::wildcard_imports, clippy::enum_glob_use)]
66

77
use crate::{both, over};
88
use rustc_ast::ptr::P;
@@ -296,7 +296,7 @@ pub fn eq_item<K>(l: &Item<K>, r: &Item<K>, mut eq_kind: impl FnMut(&K, &K) -> b
296296
eq_id(l.ident, r.ident) && over(&l.attrs, &r.attrs, eq_attr) && eq_vis(&l.vis, &r.vis) && eq_kind(&l.kind, &r.kind)
297297
}
298298

299-
#[expect(clippy::too_many_lines)] // Just a big match statement
299+
#[expect(clippy::similar_names, clippy::too_many_lines)] // Just a big match statement
300300
pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
301301
use ItemKind::*;
302302
match (l, r) {

clippy_utils/src/hir_utils.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ impl HirEqInterExpr<'_, '_, '_> {
132132
}
133133

134134
/// Checks whether two blocks are the same.
135-
#[expect(clippy::similar_names)]
136135
fn eq_block(&mut self, left: &Block<'_>, right: &Block<'_>) -> bool {
137136
use TokenKind::{Semi, Whitespace};
138137
if left.stmts.len() != right.stmts.len() {
@@ -247,7 +246,7 @@ impl HirEqInterExpr<'_, '_, '_> {
247246
res
248247
}
249248

250-
#[expect(clippy::similar_names, clippy::too_many_lines)]
249+
#[expect(clippy::too_many_lines)]
251250
pub fn eq_expr(&mut self, left: &Expr<'_>, right: &Expr<'_>) -> bool {
252251
if !self.check_ctxt(left.span.ctxt(), right.span.ctxt()) {
253252
return false;
@@ -463,7 +462,6 @@ impl HirEqInterExpr<'_, '_, '_> {
463462
}
464463
}
465464

466-
#[expect(clippy::similar_names)]
467465
fn eq_qpath(&mut self, left: &QPath<'_>, right: &QPath<'_>) -> bool {
468466
match (left, right) {
469467
(&QPath::Resolved(ref lty, lpath), &QPath::Resolved(ref rty, rpath)) => {
@@ -1158,7 +1156,6 @@ pub fn hash_expr(cx: &LateContext<'_>, e: &Expr<'_>) -> u64 {
11581156
h.finish()
11591157
}
11601158

1161-
#[expect(clippy::similar_names)]
11621159
fn eq_span_tokens(
11631160
cx: &LateContext<'_>,
11641161
left: impl SpanRange,

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ fn is_const_fn(tcx: TyCtxt<'_>, def_id: DefId, msrv: &Msrv) -> bool {
389389
})
390390
}
391391

392-
#[expect(clippy::similar_names)] // bit too pedantic
393392
fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>) -> bool {
394393
// FIXME(effects, fee1-dead) revert to const destruct once it works again
395394
#[expect(unused)]

tests/ui/approx_const.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#[warn(clippy::approx_constant)]
2-
#[allow(clippy::similar_names)]
32
fn main() {
43
let my_e = 2.7182;
54
//~^ ERROR: approximate value of `f{32, 64}::consts::E` found

tests/ui/approx_const.stderr

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: approximate value of `f{32, 64}::consts::E` found
2-
--> $DIR/approx_const.rs:4:16
2+
--> $DIR/approx_const.rs:3:16
33
|
44
LL | let my_e = 2.7182;
55
| ^^^^^^
@@ -9,175 +9,175 @@ LL | let my_e = 2.7182;
99
= help: to override `-D warnings` add `#[allow(clippy::approx_constant)]`
1010

1111
error: approximate value of `f{32, 64}::consts::E` found
12-
--> $DIR/approx_const.rs:6:20
12+
--> $DIR/approx_const.rs:5:20
1313
|
1414
LL | let almost_e = 2.718;
1515
| ^^^^^
1616
|
1717
= help: consider using the constant directly
1818

1919
error: approximate value of `f{32, 64}::consts::FRAC_1_PI` found
20-
--> $DIR/approx_const.rs:10:24
20+
--> $DIR/approx_const.rs:9:24
2121
|
2222
LL | let my_1_frac_pi = 0.3183;
2323
| ^^^^^^
2424
|
2525
= help: consider using the constant directly
2626

2727
error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found
28-
--> $DIR/approx_const.rs:14:28
28+
--> $DIR/approx_const.rs:13:28
2929
|
3030
LL | let my_frac_1_sqrt_2 = 0.70710678;
3131
| ^^^^^^^^^^
3232
|
3333
= help: consider using the constant directly
3434

3535
error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found
36-
--> $DIR/approx_const.rs:16:32
36+
--> $DIR/approx_const.rs:15:32
3737
|
3838
LL | let almost_frac_1_sqrt_2 = 0.70711;
3939
| ^^^^^^^
4040
|
4141
= help: consider using the constant directly
4242

4343
error: approximate value of `f{32, 64}::consts::FRAC_2_PI` found
44-
--> $DIR/approx_const.rs:20:24
44+
--> $DIR/approx_const.rs:19:24
4545
|
4646
LL | let my_frac_2_pi = 0.63661977;
4747
| ^^^^^^^^^^
4848
|
4949
= help: consider using the constant directly
5050

5151
error: approximate value of `f{32, 64}::consts::FRAC_2_SQRT_PI` found
52-
--> $DIR/approx_const.rs:24:27
52+
--> $DIR/approx_const.rs:23:27
5353
|
5454
LL | let my_frac_2_sq_pi = 1.128379;
5555
| ^^^^^^^^
5656
|
5757
= help: consider using the constant directly
5858

5959
error: approximate value of `f{32, 64}::consts::FRAC_PI_2` found
60-
--> $DIR/approx_const.rs:28:24
60+
--> $DIR/approx_const.rs:27:24
6161
|
6262
LL | let my_frac_pi_2 = 1.57079632679;
6363
| ^^^^^^^^^^^^^
6464
|
6565
= help: consider using the constant directly
6666

6767
error: approximate value of `f{32, 64}::consts::FRAC_PI_3` found
68-
--> $DIR/approx_const.rs:32:24
68+
--> $DIR/approx_const.rs:31:24
6969
|
7070
LL | let my_frac_pi_3 = 1.04719755119;
7171
| ^^^^^^^^^^^^^
7272
|
7373
= help: consider using the constant directly
7474

7575
error: approximate value of `f{32, 64}::consts::FRAC_PI_4` found
76-
--> $DIR/approx_const.rs:36:24
76+
--> $DIR/approx_const.rs:35:24
7777
|
7878
LL | let my_frac_pi_4 = 0.785398163397;
7979
| ^^^^^^^^^^^^^^
8080
|
8181
= help: consider using the constant directly
8282

8383
error: approximate value of `f{32, 64}::consts::FRAC_PI_6` found
84-
--> $DIR/approx_const.rs:40:24
84+
--> $DIR/approx_const.rs:39:24
8585
|
8686
LL | let my_frac_pi_6 = 0.523598775598;
8787
| ^^^^^^^^^^^^^^
8888
|
8989
= help: consider using the constant directly
9090

9191
error: approximate value of `f{32, 64}::consts::FRAC_PI_8` found
92-
--> $DIR/approx_const.rs:44:24
92+
--> $DIR/approx_const.rs:43:24
9393
|
9494
LL | let my_frac_pi_8 = 0.3926990816987;
9595
| ^^^^^^^^^^^^^^^
9696
|
9797
= help: consider using the constant directly
9898

9999
error: approximate value of `f{32, 64}::consts::LN_10` found
100-
--> $DIR/approx_const.rs:48:20
100+
--> $DIR/approx_const.rs:47:20
101101
|
102102
LL | let my_ln_10 = 2.302585092994046;
103103
| ^^^^^^^^^^^^^^^^^
104104
|
105105
= help: consider using the constant directly
106106

107107
error: approximate value of `f{32, 64}::consts::LN_2` found
108-
--> $DIR/approx_const.rs:52:19
108+
--> $DIR/approx_const.rs:51:19
109109
|
110110
LL | let my_ln_2 = 0.6931471805599453;
111111
| ^^^^^^^^^^^^^^^^^^
112112
|
113113
= help: consider using the constant directly
114114

115115
error: approximate value of `f{32, 64}::consts::LOG10_E` found
116-
--> $DIR/approx_const.rs:56:22
116+
--> $DIR/approx_const.rs:55:22
117117
|
118118
LL | let my_log10_e = 0.4342944819032518;
119119
| ^^^^^^^^^^^^^^^^^^
120120
|
121121
= help: consider using the constant directly
122122

123123
error: approximate value of `f{32, 64}::consts::LOG2_E` found
124-
--> $DIR/approx_const.rs:60:21
124+
--> $DIR/approx_const.rs:59:21
125125
|
126126
LL | let my_log2_e = 1.4426950408889634;
127127
| ^^^^^^^^^^^^^^^^^^
128128
|
129129
= help: consider using the constant directly
130130

131131
error: approximate value of `f{32, 64}::consts::LOG2_10` found
132-
--> $DIR/approx_const.rs:64:19
132+
--> $DIR/approx_const.rs:63:19
133133
|
134134
LL | let log2_10 = 3.321928094887362;
135135
| ^^^^^^^^^^^^^^^^^
136136
|
137137
= help: consider using the constant directly
138138

139139
error: approximate value of `f{32, 64}::consts::LOG10_2` found
140-
--> $DIR/approx_const.rs:68:19
140+
--> $DIR/approx_const.rs:67:19
141141
|
142142
LL | let log10_2 = 0.301029995663981;
143143
| ^^^^^^^^^^^^^^^^^
144144
|
145145
= help: consider using the constant directly
146146

147147
error: approximate value of `f{32, 64}::consts::PI` found
148-
--> $DIR/approx_const.rs:72:17
148+
--> $DIR/approx_const.rs:71:17
149149
|
150150
LL | let my_pi = 3.1415;
151151
| ^^^^^^
152152
|
153153
= help: consider using the constant directly
154154

155155
error: approximate value of `f{32, 64}::consts::PI` found
156-
--> $DIR/approx_const.rs:74:21
156+
--> $DIR/approx_const.rs:73:21
157157
|
158158
LL | let almost_pi = 3.14;
159159
| ^^^^
160160
|
161161
= help: consider using the constant directly
162162

163163
error: approximate value of `f{32, 64}::consts::SQRT_2` found
164-
--> $DIR/approx_const.rs:78:18
164+
--> $DIR/approx_const.rs:77:18
165165
|
166166
LL | let my_sq2 = 1.4142;
167167
| ^^^^^^
168168
|
169169
= help: consider using the constant directly
170170

171171
error: approximate value of `f{32, 64}::consts::TAU` found
172-
--> $DIR/approx_const.rs:82:18
172+
--> $DIR/approx_const.rs:81:18
173173
|
174174
LL | let my_tau = 6.2832;
175175
| ^^^^^^
176176
|
177177
= help: consider using the constant directly
178178

179179
error: approximate value of `f{32, 64}::consts::TAU` found
180-
--> $DIR/approx_const.rs:84:22
180+
--> $DIR/approx_const.rs:83:22
181181
|
182182
LL | let almost_tau = 6.28;
183183
| ^^^^

0 commit comments

Comments
 (0)