From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/clippy/tests/ui/rc_mutex.rs | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/tools/clippy/tests/ui/rc_mutex.rs (limited to 'src/tools/clippy/tests/ui/rc_mutex.rs') diff --git a/src/tools/clippy/tests/ui/rc_mutex.rs b/src/tools/clippy/tests/ui/rc_mutex.rs new file mode 100644 index 000000000..18e8a2e01 --- /dev/null +++ b/src/tools/clippy/tests/ui/rc_mutex.rs @@ -0,0 +1,36 @@ +#![warn(clippy::rc_mutex)] +#![allow(unused, clippy::blacklisted_name)] + +use std::rc::Rc; +use std::sync::Mutex; + +pub struct MyStructWithPrivItem { + foo: Rc>, +} + +pub struct MyStructWithPubItem { + pub foo: Rc>, +} + +pub struct SubT { + foo: T, +} + +pub enum MyEnum { + One, + Two, +} + +// All of these test should be trigger the lint because they are not +// part of the public api +fn test1(foo: Rc>) {} +fn test2(foo: Rc>) {} +fn test3(foo: Rc>>) {} + +// All of these test should be allowed because they are part of the +// public api and `avoid_breaking_exported_api` is `false` by default. +pub fn pub_test1(foo: Rc>) {} +pub fn pub_test2(foo: Rc>) {} +pub fn pub_test3(foo: Rc>>) {} + +fn main() {} -- cgit v1.2.3