Clean up pattern matches

This commit is contained in:
Brendan Zabarauskas 2015-01-18 20:22:33 +11:00
parent f8f2950afd
commit 1891764afd

View file

@ -208,27 +208,25 @@ impl Window {
fn create_window(dimensions: (u32, u32), title: &str, monitor: Option<MonitorID>) -> Option<id> { fn create_window(dimensions: (u32, u32), title: &str, monitor: Option<MonitorID>) -> Option<id> {
unsafe { unsafe {
let scr_frame = match monitor { let frame = if monitor.is_some() {
Some(_) => { let screen = NSScreen::mainScreen(nil);
let screen = NSScreen::mainScreen(nil); NSScreen::frame(screen)
NSScreen::frame(screen) } else {
} let (width, height) = dimensions;
None => { NSRect::new(NSPoint::new(0., 0.), NSSize::new(width as f64, height as f64))
let (width, height) = dimensions;
NSRect::new(NSPoint::new(0., 0.), NSSize::new(width as f64, height as f64))
}
}; };
let masks = match monitor { let masks = if monitor.is_some() {
Some(_) => NSBorderlessWindowMask as NSUInteger, NSBorderlessWindowMask as NSUInteger
None => NSTitledWindowMask as NSUInteger | } else {
NSClosableWindowMask as NSUInteger | NSTitledWindowMask as NSUInteger |
NSMiniaturizableWindowMask as NSUInteger | NSClosableWindowMask as NSUInteger |
NSResizableWindowMask as NSUInteger, NSMiniaturizableWindowMask as NSUInteger |
NSResizableWindowMask as NSUInteger
}; };
let window = NSWindow::alloc(nil).initWithContentRect_styleMask_backing_defer_( let window = NSWindow::alloc(nil).initWithContentRect_styleMask_backing_defer_(
scr_frame, frame,
masks, masks,
NSBackingStoreBuffered, NSBackingStoreBuffered,
false, false,