Manually add annotations for ui tests
This commit is contained in:
parent
fc1152abf6
commit
9c96605b20
@ -1,3 +1,5 @@
|
|||||||
fn zero() {
|
fn zero() {
|
||||||
unsafe { 0 };
|
unsafe { 0 };
|
||||||
|
//~^ ERROR: unsafe block missing a safety comment
|
||||||
|
//~| NOTE: `-D clippy::undocumented-unsafe-blocks` implied by `-D warnings`
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//@normalize-stderr-test: "\(\d+ byte\)" -> "(N byte)"
|
//@normalize-stderr-test: "\(\d+ byte\)" -> "(N byte)"
|
||||||
//@normalize-stderr-test: "\(limit: \d+ byte\)" -> "(limit: N byte)"
|
//@normalize-stderr-test: "\(limit: \d+ byte\)" -> "(limit: 8 byte)"
|
||||||
#![deny(clippy::trivially_copy_pass_by_ref)]
|
#![deny(clippy::trivially_copy_pass_by_ref)]
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::disallowed_names,
|
clippy::disallowed_names,
|
||||||
@ -50,6 +50,8 @@ fn good_return_explicit_lt_struct<'a>(foo: &'a Foo) -> FooRef<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn bad(x: &u32, y: &Foo, z: &Baz) {}
|
fn bad(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
|
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
|
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
|
|
||||||
impl Foo {
|
impl Foo {
|
||||||
fn good(self, a: &mut u32, b: u32, c: &Bar) {}
|
fn good(self, a: &mut u32, b: u32, c: &Bar) {}
|
||||||
@ -57,10 +59,18 @@ fn good(self, a: &mut u32, b: u32, c: &Bar) {}
|
|||||||
fn good2(&mut self) {}
|
fn good2(&mut self) {}
|
||||||
|
|
||||||
fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
||||||
|
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
|
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
|
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
|
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
|
|
||||||
fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
|
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
|
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
|
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
|
|
||||||
fn bad_issue7518(self, other: &Self) {}
|
fn bad_issue7518(self, other: &Self) {}
|
||||||
|
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsRef<u32> for Foo {
|
impl AsRef<u32> for Foo {
|
||||||
@ -73,10 +83,14 @@ impl Bar {
|
|||||||
fn good(&self, a: &mut u32, b: u32, c: &Bar) {}
|
fn good(&self, a: &mut u32, b: u32, c: &Bar) {}
|
||||||
|
|
||||||
fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
|
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
|
||||||
|
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
|
||||||
|
//~| ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
|
||||||
}
|
}
|
||||||
|
|
||||||
trait MyTrait {
|
trait MyTrait {
|
||||||
fn trait_method(&self, _foo: &Foo);
|
fn trait_method(&self, _foo: &Foo);
|
||||||
|
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait MyTrait2 {
|
pub trait MyTrait2 {
|
||||||
@ -109,11 +123,13 @@ fn foo_always(x: &i32) {
|
|||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn foo_never(x: &i32) {
|
fn foo_never(x: &i32) {
|
||||||
|
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
println!("{}", x);
|
println!("{}", x);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn foo(x: &i32) {
|
fn foo(x: &i32) {
|
||||||
|
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
println!("{}", x);
|
println!("{}", x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,6 +157,7 @@ async fn _async_explicit<'a>(x: &'a u32) -> &'a u32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn _unrelated_lifetimes<'a, 'b>(_x: &'a u32, y: &'b u32) -> &'b u32 {
|
fn _unrelated_lifetimes<'a, 'b>(_x: &'a u32, y: &'b u32) -> &'b u32 {
|
||||||
|
//~^ ERROR: this argument (4 byte) is passed by reference, but would be more efficient if passed by
|
||||||
y
|
y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,92 +22,92 @@ error: this argument (N byte) is passed by reference, but would be more efficien
|
|||||||
LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `Baz`
|
| ^^^^ help: consider passing by value instead: `Baz`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:59:12
|
--> $DIR/trivially_copy_pass_by_ref.rs:61:12
|
||||||
|
|
|
|
||||||
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^^ help: consider passing by value instead: `self`
|
| ^^^^^ help: consider passing by value instead: `self`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:59:22
|
--> $DIR/trivially_copy_pass_by_ref.rs:61:22
|
||||||
|
|
|
|
||||||
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `u32`
|
| ^^^^ help: consider passing by value instead: `u32`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:59:31
|
--> $DIR/trivially_copy_pass_by_ref.rs:61:31
|
||||||
|
|
|
|
||||||
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `Foo`
|
| ^^^^ help: consider passing by value instead: `Foo`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:59:40
|
--> $DIR/trivially_copy_pass_by_ref.rs:61:40
|
||||||
|
|
|
|
||||||
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `Baz`
|
| ^^^^ help: consider passing by value instead: `Baz`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:61:16
|
--> $DIR/trivially_copy_pass_by_ref.rs:67:16
|
||||||
|
|
|
|
||||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `u32`
|
| ^^^^ help: consider passing by value instead: `u32`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:61:25
|
--> $DIR/trivially_copy_pass_by_ref.rs:67:25
|
||||||
|
|
|
|
||||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `Foo`
|
| ^^^^ help: consider passing by value instead: `Foo`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:61:34
|
--> $DIR/trivially_copy_pass_by_ref.rs:67:34
|
||||||
|
|
|
|
||||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `Baz`
|
| ^^^^ help: consider passing by value instead: `Baz`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:63:35
|
--> $DIR/trivially_copy_pass_by_ref.rs:72:35
|
||||||
|
|
|
|
||||||
LL | fn bad_issue7518(self, other: &Self) {}
|
LL | fn bad_issue7518(self, other: &Self) {}
|
||||||
| ^^^^^ help: consider passing by value instead: `Self`
|
| ^^^^^ help: consider passing by value instead: `Self`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:75:16
|
--> $DIR/trivially_copy_pass_by_ref.rs:85:16
|
||||||
|
|
|
|
||||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `u32`
|
| ^^^^ help: consider passing by value instead: `u32`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:75:25
|
--> $DIR/trivially_copy_pass_by_ref.rs:85:25
|
||||||
|
|
|
|
||||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `Foo`
|
| ^^^^ help: consider passing by value instead: `Foo`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:75:34
|
--> $DIR/trivially_copy_pass_by_ref.rs:85:34
|
||||||
|
|
|
|
||||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||||
| ^^^^ help: consider passing by value instead: `Baz`
|
| ^^^^ help: consider passing by value instead: `Baz`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:79:34
|
--> $DIR/trivially_copy_pass_by_ref.rs:92:34
|
||||||
|
|
|
|
||||||
LL | fn trait_method(&self, _foo: &Foo);
|
LL | fn trait_method(&self, _foo: &Foo);
|
||||||
| ^^^^ help: consider passing by value instead: `Foo`
|
| ^^^^ help: consider passing by value instead: `Foo`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:111:21
|
--> $DIR/trivially_copy_pass_by_ref.rs:125:21
|
||||||
|
|
|
|
||||||
LL | fn foo_never(x: &i32) {
|
LL | fn foo_never(x: &i32) {
|
||||||
| ^^^^ help: consider passing by value instead: `i32`
|
| ^^^^ help: consider passing by value instead: `i32`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:116:15
|
--> $DIR/trivially_copy_pass_by_ref.rs:131:15
|
||||||
|
|
|
|
||||||
LL | fn foo(x: &i32) {
|
LL | fn foo(x: &i32) {
|
||||||
| ^^^^ help: consider passing by value instead: `i32`
|
| ^^^^ help: consider passing by value instead: `i32`
|
||||||
|
|
||||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
|
||||||
--> $DIR/trivially_copy_pass_by_ref.rs:143:37
|
--> $DIR/trivially_copy_pass_by_ref.rs:159:37
|
||||||
|
|
|
|
||||||
LL | fn _unrelated_lifetimes<'a, 'b>(_x: &'a u32, y: &'b u32) -> &'b u32 {
|
LL | fn _unrelated_lifetimes<'a, 'b>(_x: &'a u32, y: &'b u32) -> &'b u32 {
|
||||||
| ^^^^^^^ help: consider passing by value instead: `u32`
|
| ^^^^^^^ help: consider passing by value instead: `u32`
|
||||||
|
Loading…
Reference in New Issue
Block a user