Move old-style test to examples

This commit is contained in:
scott-linder 2017-06-10 23:50:57 -04:00
parent c061464f20
commit 663688f70d
3 changed files with 52 additions and 25 deletions

View 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();
}

View 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.

View File

@ -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();
}