about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorlyj <sjtu5140809011@gmail.com>2021-06-05 21:20:02 +0800
committerlyj <sjtu5140809011@gmail.com>2021-06-05 21:20:02 +0800
commite2ec85c6977c4c22a11d346f4f94773c527eddbf (patch)
treec036ac4ed927e3524bdf645973a0cf0081b5ace1 /tests
parenta5ced1fc2bab6c23888a85b339f93dd4c6b40dac (diff)
downloadrust-e2ec85c6977c4c22a11d346f4f94773c527eddbf.tar.gz
rust-e2ec85c6977c4c22a11d346f4f94773c527eddbf.zip
rc_mutex: add struct test
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/rc_mutex.rs6
-rw-r--r--tests/ui/rc_mutex.stderr18
2 files changed, 15 insertions, 9 deletions
diff --git a/tests/ui/rc_mutex.rs b/tests/ui/rc_mutex.rs
index 922ffbf8da1..14a3cfd644b 100644
--- a/tests/ui/rc_mutex.rs
+++ b/tests/ui/rc_mutex.rs
@@ -1,13 +1,13 @@
 #![warn(clippy::rc_mutex)]
-#![allow(unused_imports)]
 #![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
 #![allow(clippy::blacklisted_name, unused_variables, dead_code)]
 
-use std::cell::RefCell;
 use std::rc::Rc;
 use std::sync::Mutex;
 
-pub struct MyStruct {}
+pub struct MyStruct {
+    foo: Rc<Mutex<i32>>,
+}
 
 pub struct SubT<T> {
     foo: T,
diff --git a/tests/ui/rc_mutex.stderr b/tests/ui/rc_mutex.stderr
index efd8abacd38..ab59337a960 100644
--- a/tests/ui/rc_mutex.stderr
+++ b/tests/ui/rc_mutex.stderr
@@ -1,22 +1,28 @@
-error: Found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
+error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
+  --> $DIR/rc_mutex.rs:9:10
+   |
+LL |     foo: Rc<Mutex<i32>>,
+   |          ^^^^^^^^^^^^^^
+   |
+   = note: `-D clippy::rc-mutex` implied by `-D warnings`
+
+error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
   --> $DIR/rc_mutex.rs:21:22
    |
 LL | pub fn test1<T>(foo: Rc<Mutex<T>>) {}
    |                      ^^^^^^^^^^^^
-   |
-   = note: `-D clippy::rc-mutex` implied by `-D warnings`
 
-error: Found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
+error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
   --> $DIR/rc_mutex.rs:23:19
    |
 LL | pub fn test2(foo: Rc<Mutex<MyEnum>>) {}
    |                   ^^^^^^^^^^^^^^^^^
 
-error: Found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
+error: found `Rc<Mutex<_>>`. Consider using `Rc<RefCell<_>>` instead
   --> $DIR/rc_mutex.rs:25:19
    |
 LL | pub fn test3(foo: Rc<Mutex<SubT<usize>>>) {}
    |                   ^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors