Skip to content

Commit

Permalink
specifying return type for msg_send!
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdad committed Apr 24, 2018
1 parent a12eea7 commit c657566
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions src/platform/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ impl WindowDelegate {
(&mut **delegate).set_ivar("winitState", state_ptr as *mut ::std::os::raw::c_void);
let _: () = msg_send![*state.window, setDelegate:*delegate];

msg_send![autoreleasepool, drain];
let _: () = msg_send![autoreleasepool, drain];

WindowDelegate { state: state, _this: delegate }
}
Expand All @@ -437,7 +437,7 @@ impl Drop for WindowDelegate {
// and then autoreleases it, so autorelease pool is needed
let autoreleasepool = NSAutoreleasePool::new(cocoa::base::nil);
let _: () = msg_send![*self.state.window, setDelegate:nil];
msg_send![autoreleasepool, drain];
let _: () = msg_send![autoreleasepool, drain];
}
}
}
Expand Down Expand Up @@ -499,9 +499,7 @@ impl Drop for Window2 {
}
}

unsafe {
msg_send![autoreleasepool, release];
}
let _: () = unsafe { msg_send![autoreleasepool, drain] };
}
}

Expand Down Expand Up @@ -535,27 +533,21 @@ impl Window2 {
let app = match Window2::create_app(pl_attribs.activation_policy) {
Some(app) => app,
None => {
unsafe {
msg_send![autoreleasepool, drain];
}
let _: () = unsafe { msg_send![autoreleasepool, drain] };
return Err(OsError(format!("Couldn't create NSApplication"))); },
};

let window = match Window2::create_window(win_attribs, pl_attribs)
{
Some(window) => window,
None => {
unsafe {
msg_send![autoreleasepool, drain];
}
let _: () = unsafe { msg_send![autoreleasepool, drain] };
return Err(OsError(format!("Couldn't create NSWindow"))); },
};
let view = match Window2::create_view(*window) {
Some(view) => view,
None => {
unsafe {
msg_send![autoreleasepool, drain];
}
let _: () = unsafe { msg_send![autoreleasepool, drain] };
return Err(OsError(format!("Couldn't create NSView"))); },
};

Expand Down Expand Up @@ -622,9 +614,7 @@ impl Window2 {
window.delegate.state.perform_maximized(win_attribs.maximized);
}

unsafe {
msg_send![autoreleasepool, drain];
}
let _: () = unsafe { msg_send![autoreleasepool, drain] };

Ok(window)
}
Expand Down Expand Up @@ -758,7 +748,7 @@ impl Window2 {
window.center();
window
});
msg_send![autoreleasepool, drain];
let _: () = msg_send![autoreleasepool, drain];
res
}
}
Expand Down Expand Up @@ -1133,11 +1123,11 @@ impl IdRef {
impl Drop for IdRef {
fn drop(&mut self) {
if self.0 != nil {
let _: () = unsafe {
unsafe {
let autoreleasepool =
NSAutoreleasePool::new(cocoa::base::nil);
msg_send![self.0, release];
msg_send![autoreleasepool, release];
let _ : () = msg_send![self.0, release];
let _ : () = msg_send![autoreleasepool, release];
};
}
}
Expand Down

0 comments on commit c657566

Please sign in to comment.