diff options
| -rw-r--r-- | tests/ui/rc_mutex.rs | 13 | ||||
| -rw-r--r-- | tests/ui/rc_mutex.stderr | 8 |
2 files changed, 14 insertions, 7 deletions
diff --git a/tests/ui/rc_mutex.rs b/tests/ui/rc_mutex.rs index 14a3cfd644b..657a3ecf6a0 100644 --- a/tests/ui/rc_mutex.rs +++ b/tests/ui/rc_mutex.rs @@ -1,6 +1,5 @@ #![warn(clippy::rc_mutex)] -#![allow(clippy::boxed_local, clippy::needless_pass_by_value)] -#![allow(clippy::blacklisted_name, unused_variables, dead_code)] +#![allow(clippy::blacklisted_name)] use std::rc::Rc; use std::sync::Mutex; @@ -24,4 +23,12 @@ pub fn test2(foo: Rc<Mutex<MyEnum>>) {} pub fn test3(foo: Rc<Mutex<SubT<usize>>>) {} -fn main() {} +fn main() { + test1(Rc::new(Mutex::new(1))); + test2(Rc::new(Mutex::new(MyEnum::One))); + test3(Rc::new(Mutex::new(SubT { foo: 1 }))); + + let _my_struct = MyStruct { + foo: Rc::new(Mutex::new(1)), + }; +} diff --git a/tests/ui/rc_mutex.stderr b/tests/ui/rc_mutex.stderr index c32780acf9f..8e58e2bc2d0 100644 --- a/tests/ui/rc_mutex.stderr +++ b/tests/ui/rc_mutex.stderr @@ -1,5 +1,5 @@ error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` or `Arc<Mutex<_>>` instead - --> $DIR/rc_mutex.rs:9:10 + --> $DIR/rc_mutex.rs:8:10 | LL | foo: Rc<Mutex<i32>>, | ^^^^^^^^^^^^^^ @@ -7,19 +7,19 @@ LL | foo: Rc<Mutex<i32>>, = note: `-D clippy::rc-mutex` implied by `-D warnings` error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` or `Arc<Mutex<_>>` instead - --> $DIR/rc_mutex.rs:21:22 + --> $DIR/rc_mutex.rs:20:22 | LL | pub fn test1<T>(foo: Rc<Mutex<T>>) {} | ^^^^^^^^^^^^ error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` or `Arc<Mutex<_>>` instead - --> $DIR/rc_mutex.rs:23:19 + --> $DIR/rc_mutex.rs:22:19 | LL | pub fn test2(foo: Rc<Mutex<MyEnum>>) {} | ^^^^^^^^^^^^^^^^^ error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` or `Arc<Mutex<_>>` instead - --> $DIR/rc_mutex.rs:25:19 + --> $DIR/rc_mutex.rs:24:19 | LL | pub fn test3(foo: Rc<Mutex<SubT<usize>>>) {} | ^^^^^^^^^^^^^^^^^^^^^^ |
