mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Run rustfix on first UI test
This commit is contained in:
parent
bd74fdce22
commit
2ccfd52f5d
3 changed files with 27 additions and 3 deletions
23
tests/ui/unnecessary_ref.fixed
Normal file
23
tests/ui/unnecessary_ref.fixed
Normal file
|
@ -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;
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -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)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
Loading…
Reference in a new issue