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> {
unsafe {
let scr_frame = match monitor {
Some(_) => {
let frame = if monitor.is_some() {
let screen = NSScreen::mainScreen(nil);
NSScreen::frame(screen)
}
None => {
} else {
let (width, height) = dimensions;
NSRect::new(NSPoint::new(0., 0.), NSSize::new(width as f64, height as f64))
}
};
let masks = match monitor {
Some(_) => NSBorderlessWindowMask as NSUInteger,
None => NSTitledWindowMask as NSUInteger |
let masks = if monitor.is_some() {
NSBorderlessWindowMask as NSUInteger
} else {
NSTitledWindowMask as NSUInteger |
NSClosableWindowMask as NSUInteger |
NSMiniaturizableWindowMask as NSUInteger |
NSResizableWindowMask as NSUInteger,
NSResizableWindowMask as NSUInteger
};
let window = NSWindow::alloc(nil).initWithContentRect_styleMask_backing_defer_(
scr_frame,
frame,
masks,
NSBackingStoreBuffered,
false,