Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Temporary;
- impl Drop for Temporary {
- fn drop(&mut self) {
- dbg!("dropped");
- }
- }
- impl Temporary {
- fn do_stuff(&self) -> bool {true}
- }
- pub fn main() {
- dbg!("before");
- if Temporary.do_stuff() {
- dbg!("in");
- }
- dbg!("after");
- dbg!("before");
- match { Temporary.do_stuff() } {
- true => { dbg!("in"); },
- _ => (),
- }
- dbg!("after");
- dbg!("before");
- match { let x = Temporary.do_stuff(); x } {
- true => { dbg!("in"); },
- _ => (),
- }
- dbg!("after");
- dbg!("before");
- match { Temporary.do_stuff() } {
- true => { dbg!("in"); },
- _ => (),
- }
- dbg!("after");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement