rc_mutex: add struct test

This commit is contained in:
lyj 2021-06-05 21:20:02 +08:00
parent a5ced1fc2b
commit e2ec85c697
2 changed files with 15 additions and 9 deletions

View File

@ -1,13 +1,13 @@
#![warn(clippy::rc_mutex)]
#![allow(unused_imports)]
#![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
#![allow(clippy::blacklisted_name, unused_variables, dead_code)]
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Mutex;
pub struct MyStruct {}
pub struct MyStruct {
foo: Rc<Mutex<i32>>,
}
pub struct SubT<T> {
foo: T,

View File

@ -1,22 +1,28 @@
error: Found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
--> $DIR/rc_mutex.rs:9:10
|
LL | foo: Rc<Mutex<i32>>,
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::rc-mutex` implied by `-D warnings`
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
--> $DIR/rc_mutex.rs:21:22
|
LL | pub fn test1<T>(foo: Rc<Mutex<T>>) {}
| ^^^^^^^^^^^^
|
= note: `-D clippy::rc-mutex` implied by `-D warnings`
error: Found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
--> $DIR/rc_mutex.rs:23:19
|
LL | pub fn test2(foo: Rc<Mutex<MyEnum>>) {}
| ^^^^^^^^^^^^^^^^^
error: Found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
--> $DIR/rc_mutex.rs:25:19
|
LL | pub fn test3(foo: Rc<Mutex<SubT<usize>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
error: aborting due to 4 previous errors