Guest User

Untitled

a guest
Oct 24th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #![deny(elided_lifetimes_in_paths)]
  2.  
  3. #[derive(Copy, Clone)]
  4. struct Test<'a>(&'a str);
  5.  
  6. fn main() {
  7. let u = "test";
  8. let t = Test(u);
  9.  
  10.  
  11. // Type as Trait
  12.  
  13. // <Test as Clone>::clone(&t); // not allowed with the lint
  14. <Test<'_> as Clone>::clone(&t); // allowed, required with the lint
  15.  
  16.  
  17. // Type in angle brackets
  18.  
  19. // <Test>::clone(&t); // not allowed with the lint
  20. <Test<'_>>::clone(&t); // allowed, required with the lint
  21.  
  22.  
  23. // Type not in angle brackets
  24.  
  25. Test::clone(&t); // always allowed
  26. // Test<'_>::clone(&t); // never allowed
  27. }
Add Comment
Please, Sign In to add comment