]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/rc_mutex.rs
Merge commit '05677b6bd6c938ed760835d9b1f6514992654ae3' into sync_cg_clif-2021-08-06
[rust.git] / src / tools / clippy / tests / ui / rc_mutex.rs
1 #![warn(clippy::rc_mutex)]
2 #![allow(clippy::blacklisted_name)]
3
4 use std::rc::Rc;
5 use std::sync::Mutex;
6
7 pub struct MyStruct {
8     foo: Rc<Mutex<i32>>,
9 }
10
11 pub struct SubT<T> {
12     foo: T,
13 }
14
15 pub enum MyEnum {
16     One,
17     Two,
18 }
19
20 pub fn test1<T>(foo: Rc<Mutex<T>>) {}
21
22 pub fn test2(foo: Rc<Mutex<MyEnum>>) {}
23
24 pub fn test3(foo: Rc<Mutex<SubT<usize>>>) {}
25
26 fn main() {
27     test1(Rc::new(Mutex::new(1)));
28     test2(Rc::new(Mutex::new(MyEnum::One)));
29     test3(Rc::new(Mutex::new(SubT { foo: 1 })));
30
31     let _my_struct = MyStruct {
32         foo: Rc::new(Mutex::new(1)),
33     };
34 }