File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed
src/test/ui/let_underscore Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ declare_lint! {
5555 /// of at end of scope, which is typically incorrect.
5656 ///
5757 /// ### Example
58- /// ```rust
58+ /// ```compile_fail
5959 /// use std::sync::{Arc, Mutex};
6060 /// use std::thread;
6161 /// let data = Arc::new(Mutex::new(0));
@@ -83,7 +83,7 @@ declare_lint! {
8383 /// calling `std::mem::drop` on the expression is clearer and helps convey
8484 /// intent.
8585 pub LET_UNDERSCORE_LOCK ,
86- Warn ,
86+ Deny ,
8787 "non-binding let on a synchronization lock"
8888}
8989
Original file line number Diff line number Diff line change 1- // run-pass
2-
31use std:: sync:: { Arc , Mutex } ;
42
53fn main ( ) {
64 let data = Arc :: new ( Mutex :: new ( 0 ) ) ;
7- let _ = data. lock ( ) . unwrap ( ) ; //~WARNING non-binding let on a synchronization lock
5+ let _ = data. lock ( ) . unwrap ( ) ; //~ERROR non-binding let on a synchronization lock
86}
Original file line number Diff line number Diff line change 1- warning : non-binding let on a synchronization lock
2- --> $DIR/let_underscore_lock.rs:7 :5
1+ error : non-binding let on a synchronization lock
2+ --> $DIR/let_underscore_lock.rs:5 :5
33 |
44LL | let _ = data.lock().unwrap();
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
7- = note: `#[warn (let_underscore_lock)]` on by default
7+ = note: `#[deny (let_underscore_lock)]` on by default
88help: consider binding to an unused variable
99 |
1010LL | let _unused = data.lock().unwrap();
@@ -14,5 +14,5 @@ help: consider explicitly droping with `std::mem::drop`
1414LL | let _ = drop(...);
1515 | ~~~~~~~~~
1616
17- warning: 1 warning emitted
17+ error: aborting due to previous error
1818
You can’t perform that action at this time.
0 commit comments