about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorPhilipp Hansch <dev@phansch.net>2018-12-09 17:25:45 +0100
committerPhilipp Hansch <dev@phansch.net>2018-12-28 20:54:29 +0100
commit298aedf2f874ed86a68966c7b722918b1e2bde0a (patch)
tree0a3a63db7f3f1d37b8c67f7eb5260030b4de4fbc /tests/ui
parent3f978afe8d2260e29dbc593fa294ccaa39b0df32 (diff)
downloadrust-298aedf2f874ed86a68966c7b722918b1e2bde0a.tar.gz
rust-298aedf2f874ed86a68966c7b722918b1e2bde0a.zip
Fix suggestion for unnecessary_ref lint
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/unnecessary_ref.fixed4
-rw-r--r--tests/ui/unnecessary_ref.rs1
-rw-r--r--tests/ui/unnecessary_ref.stderr6
3 files changed, 6 insertions, 5 deletions
diff --git a/tests/ui/unnecessary_ref.fixed b/tests/ui/unnecessary_ref.fixed
index 32ad6d72054..3617641a116 100644
--- a/tests/ui/unnecessary_ref.fixed
+++ b/tests/ui/unnecessary_ref.fixed
@@ -9,8 +9,8 @@
 
 // run-rustfix
 
-
 #![feature(stmt_expr_attributes)]
+#![allow(unused_variables)]
 
 struct Outer {
     inner: u32,
@@ -19,5 +19,5 @@ struct Outer {
 #[deny(clippy::ref_in_deref)]
 fn main() {
     let outer = Outer { inner: 0 };
-    let inner = outer.inner.inner;
+    let inner = outer.inner;
 }
diff --git a/tests/ui/unnecessary_ref.rs b/tests/ui/unnecessary_ref.rs
index 4ed47cf8b5d..48101c87a54 100644
--- a/tests/ui/unnecessary_ref.rs
+++ b/tests/ui/unnecessary_ref.rs
@@ -10,6 +10,7 @@
 // run-rustfix
 
 #![feature(stmt_expr_attributes)]
+#![allow(unused_variables)]
 
 struct Outer {
     inner: u32,
diff --git a/tests/ui/unnecessary_ref.stderr b/tests/ui/unnecessary_ref.stderr
index dc221f9921e..863a6389e7f 100644
--- a/tests/ui/unnecessary_ref.stderr
+++ b/tests/ui/unnecessary_ref.stderr
@@ -1,11 +1,11 @@
 error: Creating a reference that is immediately dereferenced.
-  --> $DIR/unnecessary_ref.rs:21:17
+  --> $DIR/unnecessary_ref.rs:22:17
    |
 LL |     let inner = (&outer).inner;
-   |                 ^^^^^^^^ help: try this: `outer.inner`
+   |                 ^^^^^^^^ help: try this: `outer`
    |
 note: lint level defined here
-  --> $DIR/unnecessary_ref.rs:18:8
+  --> $DIR/unnecessary_ref.rs:19:8
    |
 LL | #[deny(clippy::ref_in_deref)]
    |        ^^^^^^^^^^^^^^^^^^^^