mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
rc_mutex: add struct test
This commit is contained in:
parent
a5ced1fc2b
commit
e2ec85c697
@ -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,
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user