Skip to content

Commit c7ec582

Browse files
Manually add annotations for ui tests
1 parent 295bdc0 commit c7ec582

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
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: 19 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,28 @@ 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 value (limit: 8 byte)
54+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
55+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
5356

5457
impl Foo {
5558
fn good(self, a: &mut u32, b: u32, c: &Bar) {}
5659

5760
fn good2(&mut self) {}
5861

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

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

6373
fn bad_issue7518(self, other: &Self) {}
74+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
6475
}
6576

6677
impl AsRef<u32> for Foo {
@@ -73,10 +84,14 @@ impl Bar {
7384
fn good(&self, a: &mut u32, b: u32, c: &Bar) {}
7485

7586
fn bad2(x: &u32, y: &Foo, z: &Baz) {}
87+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
88+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
89+
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
7690
}
7791

7892
trait MyTrait {
7993
fn trait_method(&self, _foo: &Foo);
94+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
8095
}
8196

8297
pub trait MyTrait2 {
@@ -109,11 +124,13 @@ mod issue5876 {
109124

110125
#[inline(never)]
111126
fn foo_never(x: &i32) {
127+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
112128
println!("{}", x);
113129
}
114130

115131
#[inline]
116132
fn foo(x: &i32) {
133+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
117134
println!("{}", x);
118135
}
119136
}
@@ -141,6 +158,7 @@ async fn _async_explicit<'a>(x: &'a u32) -> &'a u32 {
141158
}
142159

143160
fn _unrelated_lifetimes<'a, 'b>(_x: &'a u32, y: &'b u32) -> &'b u32 {
161+
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
144162
y
145163
}
146164

0 commit comments

Comments
 (0)