]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/rc_mutex.rs
Rollup merge of #98609 - TaKO8Ki:fix-ice-for-associated-constant-generics, r=lcnr
[rust.git] / src / tools / clippy / tests / ui / rc_mutex.rs
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
26 fn test1<T>(foo: Rc<Mutex<T>>) {}
27 fn test2(foo: Rc<Mutex<MyEnum>>) {}
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.
32 pub fn pub_test1<T>(foo: Rc<Mutex<T>>) {}
33 pub fn pub_test2(foo: Rc<Mutex<MyEnum>>) {}
34 pub fn pub_test3(foo: Rc<Mutex<SubT<usize>>>) {}
35
36 fn main() {}