Skip to content

Commit e2ec85c

Browse files
committed
rc_mutex: add struct test
1 parent a5ced1f commit e2ec85c

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

tests/ui/rc_mutex.rs

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

6-
use std::cell::RefCell;
75
use std::rc::Rc;
86
use std::sync::Mutex;
97

10-
pub struct MyStruct {}
8+
pub struct MyStruct {
9+
foo: Rc<Mutex<i32>>,
10+
}
1111

1212
pub struct SubT<T> {
1313
foo: T,

tests/ui/rc_mutex.stderr

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1-
error: Found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
1+
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
2+
--> $DIR/rc_mutex.rs:9:10
3+
|
4+
LL | foo: Rc<Mutex<i32>>,
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `-D clippy::rc-mutex` implied by `-D warnings`
8+
9+
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
210
--> $DIR/rc_mutex.rs:21:22
311
|
412
LL | pub fn test1<T>(foo: Rc<Mutex<T>>) {}
513
| ^^^^^^^^^^^^
6-
|
7-
= note: `-D clippy::rc-mutex` implied by `-D warnings`
814

9-
error: Found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
15+
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
1016
--> $DIR/rc_mutex.rs:23:19
1117
|
1218
LL | pub fn test2(foo: Rc<Mutex<MyEnum>>) {}
1319
| ^^^^^^^^^^^^^^^^^
1420

15-
error: Found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
21+
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
1622
--> $DIR/rc_mutex.rs:25:19
1723
|
1824
LL | pub fn test3(foo: Rc<Mutex<SubT<usize>>>) {}
1925
| ^^^^^^^^^^^^^^^^^^^^^^
2026

21-
error: aborting due to 3 previous errors
27+
error: aborting due to 4 previous errors
2228

0 commit comments

Comments
 (0)