Skip to content

Commit 767e668

Browse files
committed
fix dogfood
1 parent 77ec0f0 commit 767e668

26 files changed

+175
-165
lines changed

tests/ui/arc_with_non_send_sync.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@aux-build:proc_macros.rs
22
#![warn(clippy::arc_with_non_send_sync)]
3-
#![allow(unused_variables)]
43

54
#[macro_use]
65
extern crate proc_macros;
@@ -35,7 +34,7 @@ fn main() {
3534
let _ = Arc::new(RefCell::new(42));
3635
//~^ arc_with_non_send_sync
3736

38-
let mutex = Mutex::new(1);
37+
let mutex = &Mutex::new(1);
3938
let _ = Arc::new(mutex.lock().unwrap());
4039
//~^ arc_with_non_send_sync
4140

tests/ui/arc_with_non_send_sync.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: usage of an `Arc` that is not `Send` and `Sync`
2-
--> tests/ui/arc_with_non_send_sync.rs:35:13
2+
--> tests/ui/arc_with_non_send_sync.rs:34:13
33
|
44
LL | let _ = Arc::new(RefCell::new(42));
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -11,7 +11,7 @@ LL | let _ = Arc::new(RefCell::new(42));
1111
= help: to override `-D warnings` add `#[allow(clippy::arc_with_non_send_sync)]`
1212

1313
error: usage of an `Arc` that is not `Send` and `Sync`
14-
--> tests/ui/arc_with_non_send_sync.rs:39:13
14+
--> tests/ui/arc_with_non_send_sync.rs:38:13
1515
|
1616
LL | let _ = Arc::new(mutex.lock().unwrap());
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -21,7 +21,7 @@ LL | let _ = Arc::new(mutex.lock().unwrap());
2121
= help: otherwise make `MutexGuard<'_, i32>` `Send` and `Sync` or consider a wrapper type such as `Mutex`
2222

2323
error: usage of an `Arc` that is not `Send` and `Sync`
24-
--> tests/ui/arc_with_non_send_sync.rs:42:13
24+
--> tests/ui/arc_with_non_send_sync.rs:41:13
2525
|
2626
LL | let _ = Arc::new(&42 as *const i32);
2727
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/await_holding_lock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async fn baz() -> u32 {
173173
42
174174
}
175175

176-
async fn no_await(x: std::sync::Mutex<u32>) {
176+
async fn no_await(x: &std::sync::Mutex<u32>) {
177177
let mut guard = x.lock().unwrap();
178178
*guard += 1;
179179
}
@@ -182,7 +182,7 @@ async fn no_await(x: std::sync::Mutex<u32>) {
182182
// something the needs to be fixed in rustc. There's already drop-tracking, but this is currently
183183
// disabled, see rust-lang/rust#93751. This case isn't picked up by drop-tracking though. If the
184184
// `*guard += 1` is removed it is picked up.
185-
async fn dropped_before_await(x: std::sync::Mutex<u32>) {
185+
async fn dropped_before_await(x: &std::sync::Mutex<u32>) {
186186
let mut guard = x.lock().unwrap();
187187
//~^ ERROR: this `MutexGuard` is held across an await point
188188
*guard += 1;

tests/ui/branches_sharing_code/false_positives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ check-pass
22

3-
#![allow(dead_code)]
3+
#![allow(clippy::mut_mutex_lock)]
44
#![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
55

66
use std::sync::Mutex;

tests/ui/entry.fixed

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ mod issue_16173 {
255255

256256
async fn f() {}
257257

258-
async fn foo() {
259-
let mu_map = Mutex::new(HashMap::new());
258+
async fn foo(mu_map: &Mutex<HashMap<i32, i32>>) {
260259
if !mu_map.lock().unwrap().contains_key(&0) {
261260
f().await;
262261
mu_map.lock().unwrap().insert(0, 0);

tests/ui/entry.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ mod issue_16173 {
261261

262262
async fn f() {}
263263

264-
async fn foo() {
265-
let mu_map = Mutex::new(HashMap::new());
264+
async fn foo(mu_map: &Mutex<HashMap<i32, i32>>) {
266265
if !mu_map.lock().unwrap().contains_key(&0) {
267266
f().await;
268267
mu_map.lock().unwrap().insert(0, 0);

tests/ui/entry.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ LL + }
247247
|
248248

249249
error: usage of `contains_key` followed by `insert` on a `HashMap`
250-
--> tests/ui/entry.rs:285:5
250+
--> tests/ui/entry.rs:284:5
251251
|
252252
LL | / if !m.contains_key(&k) {
253253
LL | |

tests/ui/if_let_mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//@[edition2024] edition:2024
66
//@[edition2024] check-pass
77
#![warn(clippy::if_let_mutex)]
8-
#![allow(clippy::redundant_pattern_matching)]
8+
#![allow(clippy::redundant_pattern_matching, clippy::mut_mutex_lock)]
99

1010
use std::ops::Deref;
1111
use std::sync::Mutex;

tests/ui/let_underscore_lock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::let_underscore_lock)]
2+
#![allow(clippy::mut_mutex_lock)]
23

34
extern crate parking_lot;
45

tests/ui/let_underscore_lock.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: non-binding `let` on a synchronization lock
2-
--> tests/ui/let_underscore_lock.rs:10:5
2+
--> tests/ui/let_underscore_lock.rs:11:5
33
|
44
LL | let _ = p_m.lock();
55
| ^^^^^^^^^^^^^^^^^^^
@@ -9,23 +9,23 @@ LL | let _ = p_m.lock();
99
= help: to override `-D warnings` add `#[allow(clippy::let_underscore_lock)]`
1010

1111
error: non-binding `let` on a synchronization lock
12-
--> tests/ui/let_underscore_lock.rs:14:5
12+
--> tests/ui/let_underscore_lock.rs:15:5
1313
|
1414
LL | let _ = p_m1.lock();
1515
| ^^^^^^^^^^^^^^^^^^^^
1616
|
1717
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
1818

1919
error: non-binding `let` on a synchronization lock
20-
--> tests/ui/let_underscore_lock.rs:18:5
20+
--> tests/ui/let_underscore_lock.rs:19:5
2121
|
2222
LL | let _ = p_rw.read();
2323
| ^^^^^^^^^^^^^^^^^^^^
2424
|
2525
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
2626

2727
error: non-binding `let` on a synchronization lock
28-
--> tests/ui/let_underscore_lock.rs:20:5
28+
--> tests/ui/let_underscore_lock.rs:21:5
2929
|
3030
LL | let _ = p_rw.write();
3131
| ^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)