Skip to content

Commit f877f54

Browse files
committed
rc_mutex: fix test
1 parent 896c19e commit f877f54

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

tests/ui/rc_mutex.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![warn(clippy::rc_mutex)]
2-
#![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
3-
#![allow(clippy::blacklisted_name, unused_variables, dead_code)]
2+
#![allow(clippy::blacklisted_name)]
43

54
use std::rc::Rc;
65
use std::sync::Mutex;
@@ -24,4 +23,12 @@ pub fn test2(foo: Rc<Mutex<MyEnum>>) {}
2423

2524
pub fn test3(foo: Rc<Mutex<SubT<usize>>>) {}
2625

27-
fn main() {}
26+
fn main() {
27+
test1(Rc::new(Mutex::new(1)));
28+
test2(Rc::new(Mutex::new(MyEnum::One)));
29+
test3(Rc::new(Mutex::new(SubT { foo: 1 })));
30+
31+
let _my_struct = MyStruct {
32+
foo: Rc::new(Mutex::new(1)),
33+
};
34+
}

tests/ui/rc_mutex.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` or `Arc<Mutex<_>>` instead
2-
--> $DIR/rc_mutex.rs:9:10
2+
--> $DIR/rc_mutex.rs:8:10
33
|
44
LL | foo: Rc<Mutex<i32>>,
55
| ^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::rc-mutex` implied by `-D warnings`
88

99
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` or `Arc<Mutex<_>>` instead
10-
--> $DIR/rc_mutex.rs:21:22
10+
--> $DIR/rc_mutex.rs:20:22
1111
|
1212
LL | pub fn test1<T>(foo: Rc<Mutex<T>>) {}
1313
| ^^^^^^^^^^^^
1414

1515
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` or `Arc<Mutex<_>>` instead
16-
--> $DIR/rc_mutex.rs:23:19
16+
--> $DIR/rc_mutex.rs:22:19
1717
|
1818
LL | pub fn test2(foo: Rc<Mutex<MyEnum>>) {}
1919
| ^^^^^^^^^^^^^^^^^
2020

2121
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` or `Arc<Mutex<_>>` instead
22-
--> $DIR/rc_mutex.rs:25:19
22+
--> $DIR/rc_mutex.rs:24:19
2323
|
2424
LL | pub fn test3(foo: Rc<Mutex<SubT<usize>>>) {}
2525
| ^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)