Skip to content

Commit 953c435

Browse files
author
scott-linder
committed
Move old-style test to examples
1 parent 4d076ac commit 953c435

File tree

3 files changed

+52
-25
lines changed

3 files changed

+52
-25
lines changed

clippy_tests/examples/borrow_box.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#![feature(plugin)]
2+
#![plugin(clippy)]
3+
4+
#![deny(borrowed_box)]
5+
#![allow(blacklisted_name)]
6+
#![allow(unused_variables)]
7+
#![allow(dead_code)]
8+
9+
pub fn test1(foo: &mut Box<bool>) {
10+
println!("{:?}", foo)
11+
}
12+
13+
pub fn test2() {
14+
let foo: &Box<bool>;
15+
}
16+
17+
struct Test3<'a> {
18+
foo: &'a Box<bool>
19+
}
20+
21+
fn main(){
22+
test1(&mut Box::new(false));
23+
test2();
24+
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
2+
--> borrow_box.rs:10:19
3+
|
4+
10 | pub fn test1(foo: &Box<bool>) { //~ ERROR you seem to be trying to use `&Box<T>`
5+
| ^^^^^^^^^^
6+
|
7+
= note: #[deny(borrowed_box)] implied by #[deny(clippy)]
8+
note: lint level defined here
9+
--> borrow_box.rs:4:9
10+
|
11+
4 | #![deny(clippy)]
12+
| ^^^^^^
13+
= help: replace `&Box<T>` with simply `&T`
14+
15+
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
16+
--> borrow_box.rs:19:10
17+
|
18+
19 | foo: &'a Box<bool> //~ ERROR you seem to be trying to use `&Box<T>`
19+
| ^^^^^^^^^^^^^
20+
|
21+
= note: #[deny(borrowed_box)] implied by #[deny(clippy)]
22+
= help: replace `&Box<T>` with simply `&T`
23+
24+
error: aborting due to previous error(s)
25+
26+
error: Could not compile `clippy_tests`.
27+
28+
To learn more, run the command again with --verbose.

tests/compile-fail/borrow_box.rs

-25
This file was deleted.

0 commit comments

Comments
 (0)