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

Commit 9b88a2b

Browse files
committed
decouple 'let_underscore' tests
1 parent d1f8621 commit 9b88a2b

File tree

7 files changed

+53
-48
lines changed

7 files changed

+53
-48
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
88

9-
[There are 350 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
9+
[There are 351 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1010

1111
We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:
1212

clippy_lints/src/let_underscore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetUnderscore {
8080
cx,
8181
LET_UNDERSCORE_LOCK,
8282
stmt.span,
83-
"non-binding let on an a synchronization lock",
83+
"non-binding let on a synchronization lock",
8484
"consider using an underscore-prefixed named binding"
8585
)
8686
} else {

src/lintlist/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub use lint::Lint;
66
pub use lint::LINT_LEVELS;
77

88
// begin lint list, do not remove this comment, it’s used in `update_lints`
9-
pub const ALL_LINTS: [Lint; 350] = [
9+
pub const ALL_LINTS: [Lint; 351] = [
1010
Lint {
1111
name: "absurd_extreme_comparisons",
1212
group: "correctness",

tests/ui/let_underscore_lock.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![warn(clippy::let_underscore_lock)]
2+
3+
fn main() {
4+
let m = std::sync::Mutex::new(());
5+
let rw = std::sync::RwLock::new(());
6+
7+
let _ = m.lock();
8+
let _ = rw.read();
9+
let _ = rw.write();
10+
}

tests/ui/let_underscore_lock.stderr

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error: non-binding let on a synchronization lock
2+
--> $DIR/let_underscore_lock.rs:7:5
3+
|
4+
LL | let _ = m.lock();
5+
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `-D clippy::let-underscore-lock` implied by `-D warnings`
8+
= help: consider using an underscore-prefixed named binding
9+
10+
error: non-binding let on a synchronization lock
11+
--> $DIR/let_underscore_lock.rs:8:5
12+
|
13+
LL | let _ = rw.read();
14+
| ^^^^^^^^^^^^^^^^^^
15+
|
16+
= help: consider using an underscore-prefixed named binding
17+
18+
error: non-binding let on a synchronization lock
19+
--> $DIR/let_underscore_lock.rs:9:5
20+
|
21+
LL | let _ = rw.write();
22+
| ^^^^^^^^^^^^^^^^^^^
23+
|
24+
= help: consider using an underscore-prefixed named binding
25+
26+
error: aborting due to 3 previous errors
27+

tests/ui/let_underscore.rs renamed to tests/ui/let_underscore_must_use.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,4 @@ fn main() {
8888
let _ = a.map(|_| ());
8989

9090
let _ = a;
91-
92-
let m = std::sync::Mutex::new(());
93-
let rw = std::sync::RwLock::new(());
94-
95-
let _ = m.lock();
96-
let _ = rw.read();
97-
let _ = rw.write();
9891
}
Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: non-binding let on a result of a `#[must_use]` function
2-
--> $DIR/let_underscore.rs:66:5
2+
--> $DIR/let_underscore_must_use.rs:66:5
33
|
44
LL | let _ = f();
55
| ^^^^^^^^^^^^
@@ -8,117 +8,92 @@ LL | let _ = f();
88
= help: consider explicitly using function result
99

1010
error: non-binding let on an expression with `#[must_use]` type
11-
--> $DIR/let_underscore.rs:67:5
11+
--> $DIR/let_underscore_must_use.rs:67:5
1212
|
1313
LL | let _ = g();
1414
| ^^^^^^^^^^^^
1515
|
1616
= help: consider explicitly using expression value
1717

1818
error: non-binding let on a result of a `#[must_use]` function
19-
--> $DIR/let_underscore.rs:69:5
19+
--> $DIR/let_underscore_must_use.rs:69:5
2020
|
2121
LL | let _ = l(0_u32);
2222
| ^^^^^^^^^^^^^^^^^
2323
|
2424
= help: consider explicitly using function result
2525

2626
error: non-binding let on a result of a `#[must_use]` function
27-
--> $DIR/let_underscore.rs:73:5
27+
--> $DIR/let_underscore_must_use.rs:73:5
2828
|
2929
LL | let _ = s.f();
3030
| ^^^^^^^^^^^^^^
3131
|
3232
= help: consider explicitly using function result
3333

3434
error: non-binding let on an expression with `#[must_use]` type
35-
--> $DIR/let_underscore.rs:74:5
35+
--> $DIR/let_underscore_must_use.rs:74:5
3636
|
3737
LL | let _ = s.g();
3838
| ^^^^^^^^^^^^^^
3939
|
4040
= help: consider explicitly using expression value
4141

4242
error: non-binding let on a result of a `#[must_use]` function
43-
--> $DIR/let_underscore.rs:77:5
43+
--> $DIR/let_underscore_must_use.rs:77:5
4444
|
4545
LL | let _ = S::h();
4646
| ^^^^^^^^^^^^^^^
4747
|
4848
= help: consider explicitly using function result
4949

5050
error: non-binding let on an expression with `#[must_use]` type
51-
--> $DIR/let_underscore.rs:78:5
51+
--> $DIR/let_underscore_must_use.rs:78:5
5252
|
5353
LL | let _ = S::p();
5454
| ^^^^^^^^^^^^^^^
5555
|
5656
= help: consider explicitly using expression value
5757

5858
error: non-binding let on a result of a `#[must_use]` function
59-
--> $DIR/let_underscore.rs:80:5
59+
--> $DIR/let_underscore_must_use.rs:80:5
6060
|
6161
LL | let _ = S::a();
6262
| ^^^^^^^^^^^^^^^
6363
|
6464
= help: consider explicitly using function result
6565

6666
error: non-binding let on an expression with `#[must_use]` type
67-
--> $DIR/let_underscore.rs:82:5
67+
--> $DIR/let_underscore_must_use.rs:82:5
6868
|
6969
LL | let _ = if true { Ok(()) } else { Err(()) };
7070
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7171
|
7272
= help: consider explicitly using expression value
7373

7474
error: non-binding let on a result of a `#[must_use]` function
75-
--> $DIR/let_underscore.rs:86:5
75+
--> $DIR/let_underscore_must_use.rs:86:5
7676
|
7777
LL | let _ = a.is_ok();
7878
| ^^^^^^^^^^^^^^^^^^
7979
|
8080
= help: consider explicitly using function result
8181

8282
error: non-binding let on an expression with `#[must_use]` type
83-
--> $DIR/let_underscore.rs:88:5
83+
--> $DIR/let_underscore_must_use.rs:88:5
8484
|
8585
LL | let _ = a.map(|_| ());
8686
| ^^^^^^^^^^^^^^^^^^^^^^
8787
|
8888
= help: consider explicitly using expression value
8989

9090
error: non-binding let on an expression with `#[must_use]` type
91-
--> $DIR/let_underscore.rs:90:5
91+
--> $DIR/let_underscore_must_use.rs:90:5
9292
|
9393
LL | let _ = a;
9494
| ^^^^^^^^^^
9595
|
9696
= help: consider explicitly using expression value
9797

98-
error: non-binding let on an a synchronization lock
99-
--> $DIR/let_underscore.rs:95:5
100-
|
101-
LL | let _ = m.lock();
102-
| ^^^^^^^^^^^^^^^^^
103-
|
104-
= note: `#[deny(clippy::let_underscore_lock)]` on by default
105-
= help: consider using an underscore-prefixed named binding
106-
107-
error: non-binding let on an a synchronization lock
108-
--> $DIR/let_underscore.rs:96:5
109-
|
110-
LL | let _ = rw.read();
111-
| ^^^^^^^^^^^^^^^^^^
112-
|
113-
= help: consider using an underscore-prefixed named binding
114-
115-
error: non-binding let on an a synchronization lock
116-
--> $DIR/let_underscore.rs:97:5
117-
|
118-
LL | let _ = rw.write();
119-
| ^^^^^^^^^^^^^^^^^^^
120-
|
121-
= help: consider using an underscore-prefixed named binding
122-
123-
error: aborting due to 15 previous errors
98+
error: aborting due to 12 previous errors
12499

0 commit comments

Comments
 (0)