Move old-style test to examples
This commit is contained in:
parent
c061464f20
commit
663688f70d
24
clippy_tests/examples/borrow_box.rs
Normal file
24
clippy_tests/examples/borrow_box.rs
Normal file
@ -0,0 +1,24 @@
|
||||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(borrowed_box)]
|
||||
#![allow(blacklisted_name)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
pub fn test1(foo: &mut Box<bool>) {
|
||||
println!("{:?}", foo)
|
||||
}
|
||||
|
||||
pub fn test2() {
|
||||
let foo: &Box<bool>;
|
||||
}
|
||||
|
||||
struct Test3<'a> {
|
||||
foo: &'a Box<bool>
|
||||
}
|
||||
|
||||
fn main(){
|
||||
test1(&mut Box::new(false));
|
||||
test2();
|
||||
}
|
28
clippy_tests/examples/borrow_box.stderr
Normal file
28
clippy_tests/examples/borrow_box.stderr
Normal file
@ -0,0 +1,28 @@
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> borrow_box.rs:10:19
|
||||
|
|
||||
10 | pub fn test1(foo: &Box<bool>) { //~ ERROR you seem to be trying to use `&Box<T>`
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(borrowed_box)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
--> borrow_box.rs:4:9
|
||||
|
|
||||
4 | #![deny(clippy)]
|
||||
| ^^^^^^
|
||||
= help: replace `&Box<T>` with simply `&T`
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> borrow_box.rs:19:10
|
||||
|
|
||||
19 | foo: &'a Box<bool> //~ ERROR you seem to be trying to use `&Box<T>`
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(borrowed_box)] implied by #[deny(clippy)]
|
||||
= help: replace `&Box<T>` with simply `&T`
|
||||
|
||||
error: aborting due to previous error(s)
|
||||
|
||||
error: Could not compile `clippy_tests`.
|
||||
|
||||
To learn more, run the command again with --verbose.
|
@ -1,25 +0,0 @@
|
||||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#![deny(clippy)]
|
||||
#![allow(boxed_local)]
|
||||
#![allow(blacklisted_name)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
pub fn test1(foo: &Box<bool>) { //~ ERROR you seem to be trying to use `&Box<T>`
|
||||
println!("{:?}", foo)
|
||||
}
|
||||
|
||||
pub fn test2() {
|
||||
let foo: &Box<bool>; //~ ERROR you seem to be trying to use `&Box<T>`
|
||||
}
|
||||
|
||||
struct Test3<'a> {
|
||||
foo: &'a Box<bool> //~ ERROR you seem to be trying to use `&Box<T>`
|
||||
}
|
||||
|
||||
fn main(){
|
||||
test1(&Box::new(false));
|
||||
test2();
|
||||
}
|
Loading…
Reference in New Issue
Block a user