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 or the MIT license +// , 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)] | ^^^^^^^^^^^^^^^^^^^^