Skip to content

Commit 2ccfd52

Browse files
committed
Run rustfix on first UI test
1 parent bd74fdc commit 2ccfd52

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

tests/ui/unnecessary_ref.fixed

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution.
3+
//
4+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7+
// option. This file may not be copied, modified, or distributed
8+
// except according to those terms.
9+
10+
// run-rustfix
11+
12+
13+
#![feature(stmt_expr_attributes)]
14+
15+
struct Outer {
16+
inner: u32,
17+
}
18+
19+
#[deny(clippy::ref_in_deref)]
20+
fn main() {
21+
let outer = Outer { inner: 0 };
22+
let inner = outer.inner.inner;
23+
}

tests/ui/unnecessary_ref.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// option. This file may not be copied, modified, or distributed
88
// except according to those terms.
99

10-
#![feature(tool_attributes)]
10+
// run-rustfix
11+
1112
#![feature(stmt_expr_attributes)]
1213

1314
struct Outer {

tests/ui/unnecessary_ref.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: Creating a reference that is immediately dereferenced.
2-
--> $DIR/unnecessary_ref.rs:20:17
2+
--> $DIR/unnecessary_ref.rs:21:17
33
|
44
LL | let inner = (&outer).inner;
55
| ^^^^^^^^ help: try this: `outer.inner`
66
|
77
note: lint level defined here
8-
--> $DIR/unnecessary_ref.rs:17:8
8+
--> $DIR/unnecessary_ref.rs:18:8
99
|
1010
LL | #[deny(clippy::ref_in_deref)]
1111
| ^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)