-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1501 from scott-linder/types-borrow-box
Types borrow box
- Loading branch information
Showing
8 changed files
with
163 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#![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> | ||
} | ||
|
||
trait Test4 { | ||
fn test4(a: &Box<bool>); | ||
} | ||
|
||
impl<'a> Test4 for Test3<'a> { | ||
fn test4(a: &Box<bool>) { | ||
unimplemented!(); | ||
} | ||
} | ||
|
||
fn main(){ | ||
test1(&mut Box::new(false)); | ||
test2(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T` | ||
--> borrow_box.rs:9:19 | ||
| | ||
9 | pub fn test1(foo: &mut Box<bool>) { | ||
| ^^^^^^^^^^^^^^ help: try `&mut bool` | ||
| | ||
note: lint level defined here | ||
--> borrow_box.rs:4:9 | ||
| | ||
4 | #![deny(borrowed_box)] | ||
| ^^^^^^^^^^^^ | ||
|
||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T` | ||
--> borrow_box.rs:14:14 | ||
| | ||
14 | let foo: &Box<bool>; | ||
| ^^^^^^^^^^ help: try `&bool` | ||
|
||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T` | ||
--> borrow_box.rs:18:10 | ||
| | ||
18 | foo: &'a Box<bool> | ||
| ^^^^^^^^^^^^^ help: try `&'a bool` | ||
|
||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T` | ||
--> borrow_box.rs:22:17 | ||
| | ||
22 | fn test4(a: &Box<bool>); | ||
| ^^^^^^^^^^ help: try `&bool` | ||
|
||
error: aborting due to previous error(s) | ||
|
||
error: Could not compile `clippy_tests`. | ||
|
||
To learn more, run the command again with --verbose. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters