1 #![warn(clippy::rc_mutex)]
2 #![allow(unused, clippy::blacklisted_name)]
3 
4 use std::rc::Rc;
5 use std::sync::Mutex;
6 
7 pub struct MyStructWithPrivItem {
8     foo: Rc<Mutex<i32>>,
9 }
10 
11 pub struct MyStructWithPubItem {
12     pub foo: Rc<Mutex<i32>>,
13 }
14 
15 pub struct SubT<T> {
16     foo: T,
17 }
18 
19 pub enum MyEnum {
20     One,
21     Two,
22 }
23 
24 // All of these test should be trigger the lint because they are not
25 // part of the public api
test1<T>(foo: Rc<Mutex<T>>)26 fn test1<T>(foo: Rc<Mutex<T>>) {}
test2(foo: Rc<Mutex<MyEnum>>)27 fn test2(foo: Rc<Mutex<MyEnum>>) {}
test3(foo: Rc<Mutex<SubT<usize>>>)28 fn test3(foo: Rc<Mutex<SubT<usize>>>) {}
29 
30 // All of these test should be allowed because they are part of the
31 // public api and `avoid_breaking_exported_api` is `false` by default.
pub_test1<T>(foo: Rc<Mutex<T>>)32 pub fn pub_test1<T>(foo: Rc<Mutex<T>>) {}
pub_test2(foo: Rc<Mutex<MyEnum>>)33 pub fn pub_test2(foo: Rc<Mutex<MyEnum>>) {}
pub_test3(foo: Rc<Mutex<SubT<usize>>>)34 pub fn pub_test3(foo: Rc<Mutex<SubT<usize>>>) {}
35 
main()36 fn main() {}
37