2021-06-03 01:56:34 -05:00
|
|
|
#![warn(clippy::rc_mutex)]
|
2021-06-05 09:42:48 -05:00
|
|
|
#![allow(clippy::blacklisted_name)]
|
2021-06-03 01:56:34 -05:00
|
|
|
|
|
|
|
use std::rc::Rc;
|
|
|
|
use std::sync::Mutex;
|
|
|
|
|
2021-06-05 08:20:02 -05:00
|
|
|
pub struct MyStruct {
|
|
|
|
foo: Rc<Mutex<i32>>,
|
|
|
|
}
|
2021-06-03 01:56:34 -05:00
|
|
|
|
|
|
|
pub struct SubT<T> {
|
|
|
|
foo: T,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum MyEnum {
|
|
|
|
One,
|
|
|
|
Two,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn test1<T>(foo: Rc<Mutex<T>>) {}
|
|
|
|
|
|
|
|
pub fn test2(foo: Rc<Mutex<MyEnum>>) {}
|
|
|
|
|
|
|
|
pub fn test3(foo: Rc<Mutex<SubT<usize>>>) {}
|
|
|
|
|
2021-06-05 09:42:48 -05:00
|
|
|
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)),
|
|
|
|
};
|
|
|
|
}
|