Skip to content

Commit 5db8647

Browse files
author
scott-linder
committed
Test for trait method decl/impl for borrowed box.
1 parent 1a50755 commit 5db8647

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

clippy_tests/examples/borrow_box.rs

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ struct Test3<'a> {
1818
foo: &'a Box<bool>
1919
}
2020

21+
trait Test4 {
22+
fn test4(a: &Box<bool>);
23+
}
24+
25+
impl<'a> Test4 for Test3<'a> {
26+
fn test4(a: &Box<bool>) {
27+
unimplemented!();
28+
}
29+
}
30+
2131
fn main(){
2232
test1(&mut Box::new(false));
2333
test2();

clippy_tests/examples/borrow_box.stderr

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
2222
18 | foo: &'a Box<bool>
2323
| ^^^^^^^^^^^^^ help: try `&'a bool`
2424

25+
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
26+
--> borrow_box.rs:22:17
27+
|
28+
22 | fn test4(a: &Box<bool>);
29+
| ^^^^^^^^^^ help: try `&bool`
30+
2531
error: aborting due to previous error(s)
2632

2733
error: Could not compile `clippy_tests`.

0 commit comments

Comments
 (0)