Skip to content

Commit 9c96605

Browse files
Manually add annotations for ui tests
1 parent fc1152a commit 9c96605

File tree

3 files changed

+50
-31
lines changed

3 files changed

+50
-31
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
fn zero() {
22
unsafe { 0 };
3+
//~^ ERROR: unsafe block missing a safety comment
4+
//~| NOTE: `-D clippy::undocumented-unsafe-blocks` implied by `-D warnings`
35
}

tests/ui/trivially_copy_pass_by_ref.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@normalize-stderr-test: "\(\d+ byte\)" -> "(N byte)"
2-
//@normalize-stderr-test: "\(limit: \d+ byte\)" -> "(limit: N byte)"
2+
//@normalize-stderr-test: "\(limit: \d+ byte\)" -> "(limit: 8 byte)"
33
#![deny(clippy::trivially_copy_pass_by_ref)]
44
#![allow(
55
clippy::disallowed_names,
@@ -50,17 +50,27 @@ fn good_return_explicit_lt_struct<'a>(foo: &'a Foo) -> FooRef<'a> {
5050
}
5151

5252
fn bad(x: &u32, y: &Foo, z: &Baz) {}
53+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
54+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
5355

5456
impl Foo {
5557
fn good(self, a: &mut u32, b: u32, c: &Bar) {}
5658

5759
fn good2(&mut self) {}
5860

5961
fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
62+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
63+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
64+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
65+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
6066

6167
fn bad2(x: &u32, y: &Foo, z: &Baz) {}
68+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
69+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
70+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
6271

6372
fn bad_issue7518(self, other: &Self) {}
73+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
6474
}
6575

6676
impl AsRef<u32> for Foo {
@@ -73,10 +83,14 @@ impl Bar {
7383
fn good(&self, a: &mut u32, b: u32, c: &Bar) {}
7484

7585
fn bad2(x: &u32, y: &Foo, z: &Baz) {}
86+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
87+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
88+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
7689
}
7790

7891
trait MyTrait {
7992
fn trait_method(&self, _foo: &Foo);
93+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
8094
}
8195

8296
pub trait MyTrait2 {
@@ -109,11 +123,13 @@ mod issue5876 {
109123

110124
#[inline(never)]
111125
fn foo_never(x: &i32) {
126+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
112127
println!("{}", x);
113128
}
114129

115130
#[inline]
116131
fn foo(x: &i32) {
132+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
117133
println!("{}", x);
118134
}
119135
}
@@ -141,6 +157,7 @@ async fn _async_explicit<'a>(x: &'a u32) -> &'a u32 {
141157
}
142158

143159
fn _unrelated_lifetimes<'a, 'b>(_x: &'a u32, y: &'b u32) -> &'b u32 {
160+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
144161
y
145162
}
146163

tests/ui/trivially_copy_pass_by_ref.stderr

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,92 +22,92 @@ error: this argument (N byte) is passed by reference, but would be more efficien
2222
LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
2323
| ^^^^ help: consider passing by value instead: `Baz`
2424

25-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
26-
--> $DIR/trivially_copy_pass_by_ref.rs:59:12
25+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
26+
--> $DIR/trivially_copy_pass_by_ref.rs:61:12
2727
|
2828
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
2929
| ^^^^^ help: consider passing by value instead: `self`
3030

31-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
32-
--> $DIR/trivially_copy_pass_by_ref.rs:59:22
31+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
32+
--> $DIR/trivially_copy_pass_by_ref.rs:61:22
3333
|
3434
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
3535
| ^^^^ help: consider passing by value instead: `u32`
3636

37-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
38-
--> $DIR/trivially_copy_pass_by_ref.rs:59:31
37+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
38+
--> $DIR/trivially_copy_pass_by_ref.rs:61:31
3939
|
4040
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
4141
| ^^^^ help: consider passing by value instead: `Foo`
4242

43-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
44-
--> $DIR/trivially_copy_pass_by_ref.rs:59:40
43+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
44+
--> $DIR/trivially_copy_pass_by_ref.rs:61:40
4545
|
4646
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
4747
| ^^^^ help: consider passing by value instead: `Baz`
4848

49-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
50-
--> $DIR/trivially_copy_pass_by_ref.rs:61:16
49+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
50+
--> $DIR/trivially_copy_pass_by_ref.rs:67:16
5151
|
5252
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
5353
| ^^^^ help: consider passing by value instead: `u32`
5454

55-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
56-
--> $DIR/trivially_copy_pass_by_ref.rs:61:25
55+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
56+
--> $DIR/trivially_copy_pass_by_ref.rs:67:25
5757
|
5858
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
5959
| ^^^^ help: consider passing by value instead: `Foo`
6060

61-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
62-
--> $DIR/trivially_copy_pass_by_ref.rs:61:34
61+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
62+
--> $DIR/trivially_copy_pass_by_ref.rs:67:34
6363
|
6464
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
6565
| ^^^^ help: consider passing by value instead: `Baz`
6666

67-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
68-
--> $DIR/trivially_copy_pass_by_ref.rs:63:35
67+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
68+
--> $DIR/trivially_copy_pass_by_ref.rs:72:35
6969
|
7070
LL | fn bad_issue7518(self, other: &Self) {}
7171
| ^^^^^ help: consider passing by value instead: `Self`
7272

73-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
74-
--> $DIR/trivially_copy_pass_by_ref.rs:75:16
73+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
74+
--> $DIR/trivially_copy_pass_by_ref.rs:85:16
7575
|
7676
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
7777
| ^^^^ help: consider passing by value instead: `u32`
7878

79-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
80-
--> $DIR/trivially_copy_pass_by_ref.rs:75:25
79+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
80+
--> $DIR/trivially_copy_pass_by_ref.rs:85:25
8181
|
8282
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
8383
| ^^^^ help: consider passing by value instead: `Foo`
8484

85-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
86-
--> $DIR/trivially_copy_pass_by_ref.rs:75:34
85+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
86+
--> $DIR/trivially_copy_pass_by_ref.rs:85:34
8787
|
8888
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
8989
| ^^^^ help: consider passing by value instead: `Baz`
9090

91-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
92-
--> $DIR/trivially_copy_pass_by_ref.rs:79:34
91+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
92+
--> $DIR/trivially_copy_pass_by_ref.rs:92:34
9393
|
9494
LL | fn trait_method(&self, _foo: &Foo);
9595
| ^^^^ help: consider passing by value instead: `Foo`
9696

97-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
98-
--> $DIR/trivially_copy_pass_by_ref.rs:111:21
97+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
98+
--> $DIR/trivially_copy_pass_by_ref.rs:125:21
9999
|
100100
LL | fn foo_never(x: &i32) {
101101
| ^^^^ help: consider passing by value instead: `i32`
102102

103-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
104-
--> $DIR/trivially_copy_pass_by_ref.rs:116:15
103+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
104+
--> $DIR/trivially_copy_pass_by_ref.rs:131:15
105105
|
106106
LL | fn foo(x: &i32) {
107107
| ^^^^ help: consider passing by value instead: `i32`
108108

109-
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
110-
--> $DIR/trivially_copy_pass_by_ref.rs:143:37
109+
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
110+
--> $DIR/trivially_copy_pass_by_ref.rs:159:37
111111
|
112112
LL | fn _unrelated_lifetimes<'a, 'b>(_x: &'a u32, y: &'b u32) -> &'b u32 {
113113
| ^^^^^^^ help: consider passing by value instead: `u32`

0 commit comments

Comments
 (0)