about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hansch <dev@phansch.net>2018-12-09 16:18:16 +0100
committerPhilipp Hansch <dev@phansch.net>2018-12-28 20:53:43 +0100
commit2ccfd52f5dd0774cf17d6c5459460cc9fcea6907 (patch)
tree376b34b4f57cb87bee34f3ae0d51de43ca167227
parentbd74fdce2288746b2a4db678830447385e3319d2 (diff)
downloadrust-2ccfd52f5dd0774cf17d6c5459460cc9fcea6907.tar.gz
rust-2ccfd52f5dd0774cf17d6c5459460cc9fcea6907.zip
Run rustfix on first UI test
-rw-r--r--tests/ui/unnecessary_ref.fixed23
-rw-r--r--tests/ui/unnecessary_ref.rs3
-rw-r--r--tests/ui/unnecessary_ref.stderr4
3 files changed, 27 insertions, 3 deletions
diff --git a/tests/ui/unnecessary_ref.fixed b/tests/ui/unnecessary_ref.fixed
new file mode 100644
index 00000000000..32ad6d72054
--- /dev/null
+++ b/tests/ui/unnecessary_ref.fixed
@@ -0,0 +1,23 @@
+// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+
+#![feature(stmt_expr_attributes)]
+
+struct Outer {
+    inner: u32,
+}
+
+#[deny(clippy::ref_in_deref)]
+fn main() {
+    let outer = Outer { inner: 0 };
+    let inner = outer.inner.inner;
+}
diff --git a/tests/ui/unnecessary_ref.rs b/tests/ui/unnecessary_ref.rs
index 31aa367e506..4ed47cf8b5d 100644
--- a/tests/ui/unnecessary_ref.rs
+++ b/tests/ui/unnecessary_ref.rs
@@ -7,7 +7,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(tool_attributes)]
+// run-rustfix
+
 #![feature(stmt_expr_attributes)]
 
 struct Outer {
diff --git a/tests/ui/unnecessary_ref.stderr b/tests/ui/unnecessary_ref.stderr
index 77503026bde..dc221f9921e 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:20:17
+  --> $DIR/unnecessary_ref.rs:21:17
    |
 LL |     let inner = (&outer).inner;
    |                 ^^^^^^^^ help: try this: `outer.inner`
    |
 note: lint level defined here
-  --> $DIR/unnecessary_ref.rs:17:8
+  --> $DIR/unnecessary_ref.rs:18:8
    |
 LL | #[deny(clippy::ref_in_deref)]
    |        ^^^^^^^^^^^^^^^^^^^^