diff options
-rw-r--r-- | src/osx/mod.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/osx/mod.rs b/src/osx/mod.rs index 5ef1c65..58b6176 100644 --- a/src/osx/mod.rs +++ b/src/osx/mod.rs @@ -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 screen = NSScreen::mainScreen(nil); - NSScreen::frame(screen) - } - None => { - let (width, height) = dimensions; - NSRect::new(NSPoint::new(0., 0.), NSSize::new(width as f64, height as f64)) - } + let frame = if monitor.is_some() { + let screen = NSScreen::mainScreen(nil); + NSScreen::frame(screen) + } 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 | - NSClosableWindowMask as NSUInteger | - NSMiniaturizableWindowMask as NSUInteger | - NSResizableWindowMask as NSUInteger, + let masks = if monitor.is_some() { + NSBorderlessWindowMask as NSUInteger + } else { + NSTitledWindowMask as NSUInteger | + NSClosableWindowMask as NSUInteger | + NSMiniaturizableWindowMask as NSUInteger | + NSResizableWindowMask as NSUInteger }; let window = NSWindow::alloc(nil).initWithContentRect_styleMask_backing_defer_( - scr_frame, + frame, masks, NSBackingStoreBuffered, false, |