Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #![warn(clippy::boxed_local)]
  2.  
  3. use std::thread;
  4. use std::mem;
  5.  
  6. trait ExampleTrait: Send + 'static {
  7. fn method1(self: Box<Self>) { // boxed_local triggered
  8. thread::spawn(move || {
  9. mem::drop(self);
  10. });
  11. }
  12.  
  13. fn method2(self: Box<Self>) { // boxed_local triggered
  14. let _closure = move || {
  15. mem::drop(self);
  16. };
  17. }
  18.  
  19. fn method3(self: Box<Self>) { // boxed_local not triggered
  20. mem::drop(self);
  21. }
  22. }
  23.  
  24. fn main() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement