]> git.lizzy.rs Git - rust.git/commitdiff
Test for trait method decl/impl for borrowed box.
authorscott-linder <scott.b.linder@wmich.edu>
Mon, 12 Jun 2017 12:44:08 +0000 (08:44 -0400)
committerscott-linder <scott.b.linder@wmich.edu>
Mon, 12 Jun 2017 12:44:08 +0000 (08:44 -0400)
clippy_tests/examples/borrow_box.rs
clippy_tests/examples/borrow_box.stderr

index a72c664376fafcc97d4afc818ad4a26cda944203..ef569ab037ffd0b06433be81a70a4b3d4c4880b9 100644 (file)
@@ -18,6 +18,16 @@ 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();
index 11838a0ec1ca2e4eb617dbbafdad45f309d9bdda..6670a8c40835c4a330b8b9c890dc9c71eeb3495a 100644 (file)
@@ -22,6 +22,12 @@ error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
 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`.