daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Mar 26th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct Temporary;
  2.  
  3. impl Drop for Temporary {
  4.     fn drop(&mut self) {
  5.         dbg!("dropped");
  6.     }
  7. }
  8.  
  9. impl Temporary {
  10.     fn do_stuff(&self) -> bool {true}
  11. }
  12.  
  13. pub fn main() {
  14.     dbg!("before");
  15.     if Temporary.do_stuff() {
  16.         dbg!("in");
  17.     }
  18.     dbg!("after");
  19.  
  20.     dbg!("before");
  21.     match { Temporary.do_stuff() } {
  22.         true => { dbg!("in"); },
  23.         _ => (),
  24.     }
  25.     dbg!("after");
  26.  
  27.     dbg!("before");
  28.     match { let x = Temporary.do_stuff(); x } {
  29.         true => { dbg!("in"); },
  30.         _ => (),
  31.     }
  32.     dbg!("after");
  33.  
  34.     dbg!("before");
  35.     match { Temporary.do_stuff() } {
  36.         true => { dbg!("in"); },
  37.         _ => (),
  38.     }
  39.     dbg!("after");
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top