diff --git a/src/backend/drm/mod.rs b/src/backend/drm/mod.rs index 6b32c54..6849f5a 100644 --- a/src/backend/drm/mod.rs +++ b/src/backend/drm/mod.rs @@ -328,7 +328,7 @@ impl DrmDevice { info!(log, "DrmDevice initializing"); // we want to mode-set, so we better be the master, if we run via a tty session - if let Err(_) = drm.set_master() { + if drm.set_master().is_err() { warn!( log, "Unable to become drm master, assuming unpriviledged mode" @@ -594,7 +594,7 @@ where fn receive(&mut self, event: FdEvent, (): ()) { let mut device = self.device.borrow_mut(); match event { - FdEvent::Ready { .. } => match crtc::receive_events(&mut *device) { + FdEvent::Ready { .. } => match crtc::receive_events(&*device) { Ok(events) => for event in events { if let crtc::Event::PageFlip(event) = event { if device.active.load(Ordering::SeqCst) { @@ -643,7 +643,7 @@ impl AsSessionObserver> for Drm fn observer(&mut self) -> DrmDeviceObserver { DrmDeviceObserver { context: Rc::downgrade(&self.context), - device_id: self.device_id.clone(), + device_id: self.device_id, backends: self.backends.clone(), old_state: self.old_state.clone(), active: self.active.clone(), @@ -662,7 +662,7 @@ impl SessionObserver for DrmDeviceObserver { } } if let Some(device) = self.context.upgrade() { - for (handle, &(ref info, ref connectors)) in self.old_state.iter() { + for (handle, &(ref info, ref connectors)) in &self.old_state { if let Err(err) = crtc::set( &*device, *handle, diff --git a/src/backend/input.rs b/src/backend/input.rs index 0bc4769..180ab09 100644 --- a/src/backend/input.rs +++ b/src/backend/input.rs @@ -24,9 +24,9 @@ pub struct Seat { impl Seat { pub(crate) fn new(id: u64, name: S, capabilities: SeatCapabilities) -> Seat { Seat { - id: id, + id, name: name.to_string(), - capabilities: capabilities, + capabilities, } } @@ -331,7 +331,7 @@ pub struct TouchSlot { impl TouchSlot { pub(crate) fn new(id: u64) -> Self { - TouchSlot { id: id } + TouchSlot { id } } } diff --git a/src/backend/libinput.rs b/src/backend/libinput.rs index faf6577..c6d311d 100644 --- a/src/backend/libinput.rs +++ b/src/backend/libinput.rs @@ -43,7 +43,7 @@ impl LibinputInputBackend { let log = ::slog_or_stdlog(logger).new(o!("smithay_module" => "backend_libinput")); info!(log, "Initializing a libinput backend"); LibinputInputBackend { - context: context, + context, devices: Vec::new(), seats: HashMap::new(), handler: None, @@ -404,7 +404,7 @@ impl backend::InputBackend for LibinputInputBackend { use input::event::touch::*; if let Some(ref mut handler) = self.handler { let device_seat = touch_event.device().seat(); - if let &Some(ref seat) = &self.seats.get(&device_seat) { + if let Some(ref seat) = self.seats.get(&device_seat) { match touch_event { TouchEvent::Down(down_event) => { trace!(self.logger, "Calling on_touch_down with {:?}", down_event); @@ -446,7 +446,7 @@ impl backend::InputBackend for LibinputInputBackend { match keyboard_event { KeyboardEvent::Key(key_event) => if let Some(ref mut handler) = self.handler { let device_seat = key_event.device().seat(); - if let &Some(ref seat) = &self.seats.get(&device_seat) { + if let Some(ref seat) = self.seats.get(&device_seat) { trace!(self.logger, "Calling on_keyboard_key with {:?}", key_event); handler.on_keyboard_key(seat, key_event); } else { @@ -460,7 +460,7 @@ impl backend::InputBackend for LibinputInputBackend { use input::event::pointer::*; if let Some(ref mut handler) = self.handler { let device_seat = pointer_event.device().seat(); - if let &Some(ref seat) = &self.seats.get(&device_seat) { + if let Some(ref seat) = self.seats.get(&device_seat) { match pointer_event { PointerEvent::Motion(motion_event) => { trace!( diff --git a/src/backend/session/auto.rs b/src/backend/session/auto.rs index 59e4807..b1440e8 100644 --- a/src/backend/session/auto.rs +++ b/src/backend/session/auto.rs @@ -170,40 +170,40 @@ impl Session for AutoSession { type Error = Error; fn open(&mut self, path: &Path, flags: OFlag) -> Result { - match self { + match *self { #[cfg(feature = "backend_session_logind")] - &mut AutoSession::Logind(ref mut logind) => logind.open(path, flags).map_err(|e| e.into()), - &mut AutoSession::Direct(ref mut direct) => direct.open(path, flags).map_err(|e| e.into()), + AutoSession::Logind(ref mut logind) => logind.open(path, flags).map_err(|e| e.into()), + AutoSession::Direct(ref mut direct) => direct.open(path, flags).map_err(|e| e.into()), } } fn close(&mut self, fd: RawFd) -> Result<()> { - match self { + match *self { #[cfg(feature = "backend_session_logind")] - &mut AutoSession::Logind(ref mut logind) => logind.close(fd).map_err(|e| e.into()), - &mut AutoSession::Direct(ref mut direct) => direct.close(fd).map_err(|e| e.into()), + AutoSession::Logind(ref mut logind) => logind.close(fd).map_err(|e| e.into()), + AutoSession::Direct(ref mut direct) => direct.close(fd).map_err(|e| e.into()), } } fn change_vt(&mut self, vt: i32) -> Result<()> { - match self { + match *self { #[cfg(feature = "backend_session_logind")] - &mut AutoSession::Logind(ref mut logind) => logind.change_vt(vt).map_err(|e| e.into()), - &mut AutoSession::Direct(ref mut direct) => direct.change_vt(vt).map_err(|e| e.into()), + AutoSession::Logind(ref mut logind) => logind.change_vt(vt).map_err(|e| e.into()), + AutoSession::Direct(ref mut direct) => direct.change_vt(vt).map_err(|e| e.into()), } } fn is_active(&self) -> bool { - match self { + match *self { #[cfg(feature = "backend_session_logind")] - &AutoSession::Logind(ref logind) => logind.is_active(), - &AutoSession::Direct(ref direct) => direct.is_active(), + AutoSession::Logind(ref logind) => logind.is_active(), + AutoSession::Direct(ref direct) => direct.is_active(), } } fn seat(&self) -> String { - match self { + match *self { #[cfg(feature = "backend_session_logind")] - &AutoSession::Logind(ref logind) => logind.seat(), - &AutoSession::Direct(ref direct) => direct.seat(), + AutoSession::Logind(ref logind) => logind.seat(), + AutoSession::Direct(ref direct) => direct.seat(), } } } @@ -215,12 +215,12 @@ impl SessionNotifier for AutoSessionNotifier { &mut self, signal: &mut A, ) -> Self::Id { - match self { + match *self { #[cfg(feature = "backend_session_logind")] - &mut AutoSessionNotifier::Logind(ref mut logind) => { + AutoSessionNotifier::Logind(ref mut logind) => { AutoId(AutoIdInternal::Logind(logind.register(signal))) } - &mut AutoSessionNotifier::Direct(ref mut direct) => { + AutoSessionNotifier::Direct(ref mut direct) => { AutoId(AutoIdInternal::Direct(direct.register(signal))) } } @@ -239,17 +239,17 @@ impl SessionNotifier for AutoSessionNotifier { } fn is_active(&self) -> bool { - match self { + match *self { #[cfg(feature = "backend_session_logind")] - &AutoSessionNotifier::Logind(ref logind) => logind.is_active(), - &AutoSessionNotifier::Direct(ref direct) => direct.is_active(), + AutoSessionNotifier::Logind(ref logind) => logind.is_active(), + AutoSessionNotifier::Direct(ref direct) => direct.is_active(), } } fn seat(&self) -> &str { - match self { + match *self { #[cfg(feature = "backend_session_logind")] - &AutoSessionNotifier::Logind(ref logind) => logind.seat(), - &AutoSessionNotifier::Direct(ref direct) => direct.seat(), + AutoSessionNotifier::Logind(ref logind) => logind.seat(), + AutoSessionNotifier::Direct(ref direct) => direct.seat(), } } } diff --git a/src/backend/session/direct.rs b/src/backend/session/direct.rs index f9a5c71..657976d 100644 --- a/src/backend/session/direct.rs +++ b/src/backend/session/direct.rs @@ -372,7 +372,7 @@ impl Implementation<(), SignalEvent> for DirectSessionNotifier { if self.is_active() { info!(self.logger, "Session shall become inactive."); for signal in &mut self.signals { - if let &mut Some(ref mut signal) = signal { + if let Some(ref mut signal) = *signal { signal.pause(None); } } @@ -387,7 +387,7 @@ impl Implementation<(), SignalEvent> for DirectSessionNotifier { tty::vt_rel_disp(self.tty, tty::VT_ACKACQ).expect("Unable to acquire tty lock"); } for signal in &mut self.signals { - if let &mut Some(ref mut signal) = signal { + if let Some(ref mut signal) = *signal { signal.activate(None); } } diff --git a/src/backend/udev.rs b/src/backend/udev.rs index 674ef1d..6032059 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -69,7 +69,7 @@ impl + 'static, S: Session + 'static, T: UdevH /// `session` - A session used to open and close devices as they become available /// `handler` - User-provided handler to respond to any detected changes /// `logger` - slog Logger to be used by the backend and its `DrmDevices`. - pub fn new<'a, L>( + pub fn new( token: LoopToken, context: &Context, mut session: S, @@ -195,7 +195,7 @@ impl< } impl SessionObserver for UdevBackendObserver { - fn pause<'a>(&mut self, devnum: Option<(u32, u32)>) { + fn pause(&mut self, devnum: Option<(u32, u32)>) { if let Some(devices) = self.devices.upgrade() { for &mut (_, ref device) in devices.borrow_mut().values_mut() { info!(self.logger, "changed successful"); @@ -204,7 +204,7 @@ impl SessionObserver for UdevBackendObserver { } } - fn activate<'a>(&mut self, devnum: Option<(u32, u32, Option)>) { + fn activate(&mut self, devnum: Option<(u32, u32, Option)>) { if let Some(devices) = self.devices.upgrade() { for &mut (_, ref device) in devices.borrow_mut().values_mut() { info!(self.logger, "changed successful"); diff --git a/src/backend/winit.rs b/src/backend/winit.rs index fcd3089..ae2bcc6 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -53,9 +53,9 @@ enum Window { impl Window { fn window(&self) -> &WinitWindow { - match self { - &Window::Wayland { ref context, .. } => &**context, - &Window::X11 { ref context, .. } => &**context, + match *self { + Window::Wayland { ref context, .. } => &**context, + Window::X11 { ref context, .. } => &**context, } } } @@ -697,12 +697,9 @@ impl InputBackend for WinitInputBackend { (WindowEvent::Resized(w, h), _, events_handler) => { trace!(logger, "Resizing window to {:?}", (w, h)); window.window().set_inner_size(w, h); - match **window { - Window::Wayland { ref surface, .. } => { - surface.resize(w as i32, h as i32, 0, 0) - } - _ => {} - }; + if let Window::Wayland { ref surface, .. } = **window { + surface.resize(w as i32, h as i32, 0, 0); + } if let Some(events_handler) = events_handler { events_handler.resized(w, h); } @@ -743,7 +740,7 @@ impl InputBackend for WinitInputBackend { time, key: scancode, count: *key_counter, - state: state, + state, }, ) } @@ -760,8 +757,8 @@ impl InputBackend for WinitInputBackend { WinitMouseMovedEvent { window: window.clone(), time, - x: x, - y: y, + x, + y, }, ) } @@ -780,8 +777,8 @@ impl InputBackend for WinitInputBackend { seat, WinitMouseInputEvent { time, - button: button, - state: state, + button, + state, }, ) } @@ -802,7 +799,7 @@ impl InputBackend for WinitInputBackend { window: window.clone(), time, location: (x, y), - id: id, + id, }, ) } @@ -823,7 +820,7 @@ impl InputBackend for WinitInputBackend { window: window.clone(), time, location: (x, y), - id: id, + id, }, ) } @@ -844,11 +841,11 @@ impl InputBackend for WinitInputBackend { window: window.clone(), time, location: (x, y), - id: id, + id, }, ); trace!(logger, "Calling on_touch_up"); - handler.on_touch_up(seat, WinitTouchEndedEvent { time, id: id }); + handler.on_touch_up(seat, WinitTouchEndedEvent { time, id }); } ( WindowEvent::Touch(Touch { @@ -860,7 +857,7 @@ impl InputBackend for WinitInputBackend { _, ) => { trace!(logger, "Calling on_touch_cancel"); - handler.on_touch_cancel(seat, WinitTouchCancelledEvent { time, id: id }) + handler.on_touch_cancel(seat, WinitTouchCancelledEvent { time, id }) } (WindowEvent::CloseRequested, _, _) | (WindowEvent::Destroyed, _, _) => { warn!(logger, "Window closed"); diff --git a/src/wayland/compositor/handlers.rs b/src/wayland/compositor/handlers.rs index 1334278..1555e64 100644 --- a/src/wayland/compositor/handlers.rs +++ b/src/wayland/compositor/handlers.rs @@ -57,8 +57,8 @@ impl SurfaceImplem { + 'static, { SurfaceImplem { - log: log, - implem: implem, + log, + implem, } } } diff --git a/src/wayland/compositor/tree.rs b/src/wayland/compositor/tree.rs index d0fda29..94547e0 100644 --- a/src/wayland/compositor/tree.rs +++ b/src/wayland/compositor/tree.rs @@ -229,14 +229,14 @@ impl + 'static> SurfaceData pub unsafe fn get_parent(child: &Resource) -> Option> { let child_mutex = Self::get_data(child); let child_guard = child_mutex.lock().unwrap(); - child_guard.parent.as_ref().map(|p| p.clone()) + child_guard.parent.as_ref().cloned() } /// Retrieve the parent surface (if any) of this surface pub unsafe fn get_children(child: &Resource) -> Vec> { let child_mutex = Self::get_data(child); let child_guard = child_mutex.lock().unwrap(); - child_guard.children.iter().map(|p| p.clone()).collect() + child_guard.children.to_vec() } /// Reorders a surface relative to one of its sibling @@ -250,7 +250,7 @@ impl + 'static> SurfaceData let parent = { let data_mutex = Self::get_data(surface); let data_guard = data_mutex.lock().unwrap(); - data_guard.parent.as_ref().map(|p| p.clone()).unwrap() + data_guard.parent.as_ref().cloned().unwrap() }; if parent.equals(relative_to) { // TODO: handle positioning relative to parent diff --git a/src/wayland/output/mod.rs b/src/wayland/output/mod.rs index ee60dfd..43d5c43 100644 --- a/src/wayland/output/mod.rs +++ b/src/wayland/output/mod.rs @@ -127,7 +127,7 @@ impl Inner { flags |= WMode::Preferred; } output.send(Event::Mode { - flags: flags, + flags, width: mode.width, height: mode.height, refresh: mode.refresh, @@ -198,10 +198,10 @@ impl Output { info!(log, "Creating new wl_output"; "name" => &name); let inner = Arc::new(Mutex::new(Inner { - name: name, - log: log, + name, + log, instances: Vec::new(), - physical: physical, + physical, location: (0, 0), transform: Transform::Normal, scale: 1, @@ -306,7 +306,7 @@ impl Output { for output in &inner.instances { if let Some(mode) = new_mode { output.send(Event::Mode { - flags: flags, + flags, width: mode.width, height: mode.height, refresh: mode.refresh, diff --git a/src/wayland/seat/keyboard.rs b/src/wayland/seat/keyboard.rs index f7996cc..1a6d403 100644 --- a/src/wayland/seat/keyboard.rs +++ b/src/wayland/seat/keyboard.rs @@ -102,10 +102,10 @@ impl KbdInternal { focus: None, pressed_keys: Vec::new(), mods_state: ModifiersState::new(), - keymap: keymap, - state: state, - repeat_rate: repeat_rate, - repeat_delay: repeat_delay, + keymap, + state, + repeat_rate, + repeat_delay, }) } @@ -224,7 +224,7 @@ pub(crate) fn create_keyboard_handler( Ok(KeyboardHandle { arc: Arc::new(KbdArc { internal: Mutex::new(internal), - keymap_file: keymap_file, + keymap_file, keymap_len: keymap_data.as_bytes().len() as u32, logger: log, }), @@ -349,7 +349,7 @@ impl KeyboardHandle { }); // set new focus - guard.focus = focus.map(|s| s.clone()); + guard.focus = focus.cloned(); let (dep, la, lo, gr) = guard.serialize_modifiers(); let keys = guard.serialize_pressed_keys(); guard.with_focused_kbds(|kbd, surface| { diff --git a/src/wayland/seat/mod.rs b/src/wayland/seat/mod.rs index d45d229..98478fd 100644 --- a/src/wayland/seat/mod.rs +++ b/src/wayland/seat/mod.rs @@ -125,7 +125,7 @@ impl Seat { let log = ::slog_or_stdlog(logger); let inner = Arc::new(Mutex::new(Inner { log: log.new(o!("smithay_module" => "seat_handler", "seat_name" => name.clone())), - name: name, + name, pointer: None, keyboard: None, known_seats: Vec::new(), diff --git a/src/wayland/shell/legacy/mod.rs b/src/wayland/shell/legacy/mod.rs index c851410..7081c8c 100644 --- a/src/wayland/shell/legacy/mod.rs +++ b/src/wayland/shell/legacy/mod.rs @@ -345,7 +345,7 @@ where self::wl_handlers::implement_shell( shell, ltoken.clone(), - ctoken.clone(), + ctoken, implementation.clone(), state2.clone(), ); diff --git a/src/wayland/shell/legacy/wl_handlers.rs b/src/wayland/shell/legacy/wl_handlers.rs index 3dbc0e6..c9ac168 100644 --- a/src/wayland/shell/legacy/wl_handlers.rs +++ b/src/wayland/shell/legacy/wl_handlers.rs @@ -45,17 +45,17 @@ pub(crate) fn implement_shell( surface, implementation.clone(), ltoken.clone(), - ctoken.clone(), + ctoken, state.clone(), ); state .lock() .unwrap() .known_surfaces - .push(make_handle(&shell_surface, ctoken.clone())); + .push(make_handle(&shell_surface, ctoken)); implementation.borrow_mut().receive( ShellRequest::NewShellSurface { - surface: make_handle(&shell_surface, ctoken.clone()), + surface: make_handle(&shell_surface, ctoken), }, (), ); @@ -117,7 +117,7 @@ where if valid { user_impl.receive( ShellRequest::Pong { - surface: make_handle(&shell_surface, ctoken.clone()), + surface: make_handle(&shell_surface, ctoken), }, (), ); @@ -125,7 +125,7 @@ where } Request::Move { seat, serial } => user_impl.receive( ShellRequest::Move { - surface: make_handle(&shell_surface, ctoken.clone()), + surface: make_handle(&shell_surface, ctoken), serial, seat, }, @@ -137,7 +137,7 @@ where edges, } => user_impl.receive( ShellRequest::Resize { - surface: make_handle(&shell_surface, ctoken.clone()), + surface: make_handle(&shell_surface, ctoken), serial, seat, edges, @@ -146,7 +146,7 @@ where ), Request::SetToplevel => user_impl.receive( ShellRequest::SetKind { - surface: make_handle(&shell_surface, ctoken.clone()), + surface: make_handle(&shell_surface, ctoken), kind: ShellSurfaceKind::Toplevel, }, (), @@ -158,7 +158,7 @@ where flags, } => user_impl.receive( ShellRequest::SetKind { - surface: make_handle(&shell_surface, ctoken.clone()), + surface: make_handle(&shell_surface, ctoken), kind: ShellSurfaceKind::Transient { parent, location: (x, y), @@ -173,7 +173,7 @@ where output, } => user_impl.receive( ShellRequest::SetKind { - surface: make_handle(&shell_surface, ctoken.clone()), + surface: make_handle(&shell_surface, ctoken), kind: ShellSurfaceKind::Fullscreen { method, framerate, @@ -191,7 +191,7 @@ where flags, } => user_impl.receive( ShellRequest::SetKind { - surface: make_handle(&shell_surface, ctoken.clone()), + surface: make_handle(&shell_surface, ctoken), kind: ShellSurfaceKind::Popup { parent, serial, @@ -204,7 +204,7 @@ where ), Request::SetMaximized { output } => user_impl.receive( ShellRequest::SetKind { - surface: make_handle(&shell_surface, ctoken.clone()), + surface: make_handle(&shell_surface, ctoken), kind: ShellSurfaceKind::Maximized { output }, }, (), diff --git a/src/wayland/shell/xdg/mod.rs b/src/wayland/shell/xdg/mod.rs index b4b281c..6a5ec83 100644 --- a/src/wayland/shell/xdg/mod.rs +++ b/src/wayland/shell/xdg/mod.rs @@ -221,7 +221,7 @@ pub struct ToplevelState { impl Clone for ToplevelState { fn clone(&self) -> ToplevelState { ToplevelState { - parent: self.parent.as_ref().map(|p| p.clone()), + parent: self.parent.as_ref().cloned(), title: self.title.clone(), app_id: self.app_id.clone(), min_size: self.min_size, @@ -242,7 +242,7 @@ pub struct PopupState { impl Clone for PopupState { fn clone(&self) -> PopupState { PopupState { - parent: self.parent.as_ref().map(|p| p.clone()), + parent: self.parent.as_ref().cloned(), positioner: self.positioner.clone(), } } @@ -266,7 +266,7 @@ impl Clone for ShellImplementation { fn clone(&self) -> Self { ShellImplementation { log: self.log.clone(), - compositor_token: self.compositor_token.clone(), + compositor_token: self.compositor_token, loop_token: self.loop_token.clone(), user_impl: self.user_impl.clone(), shell_state: self.shell_state.clone(), diff --git a/src/wayland/shell/xdg/xdg_handlers.rs b/src/wayland/shell/xdg/xdg_handlers.rs index 68c11e0..fc65837 100644 --- a/src/wayland/shell/xdg/xdg_handlers.rs +++ b/src/wayland/shell/xdg/xdg_handlers.rs @@ -449,7 +449,7 @@ fn make_toplevel_handle( super::ToplevelSurface { wl_surface: wl_surface.clone(), shell_surface: ToplevelKind::Xdg(resource.clone()), - token: token, + token, _shell_data: ::std::marker::PhantomData, } } @@ -650,7 +650,7 @@ fn make_popup_handle( super::PopupSurface { wl_surface: wl_surface.clone(), shell_surface: PopupKind::Xdg(resource.clone()), - token: token, + token, _shell_data: ::std::marker::PhantomData, } } diff --git a/src/wayland/shell/xdg/zxdgv6_handlers.rs b/src/wayland/shell/xdg/zxdgv6_handlers.rs index 8e25154..e55875e 100644 --- a/src/wayland/shell/xdg/zxdgv6_handlers.rs +++ b/src/wayland/shell/xdg/zxdgv6_handlers.rs @@ -466,7 +466,7 @@ fn make_toplevel_handle( super::ToplevelSurface { wl_surface: wl_surface.clone(), shell_surface: ToplevelKind::ZxdgV6(resource.clone()), - token: token, + token, _shell_data: ::std::marker::PhantomData, } } @@ -671,7 +671,7 @@ fn make_popup_handle( super::PopupSurface { wl_surface: wl_surface.clone(), shell_surface: PopupKind::ZxdgV6(resource.clone()), - token: token, + token, _shell_data: ::std::marker::PhantomData, } } diff --git a/src/wayland/shm/mod.rs b/src/wayland/shm/mod.rs index a8c25f6..2f57fc4 100644 --- a/src/wayland/shm/mod.rs +++ b/src/wayland/shm/mod.rs @@ -249,11 +249,11 @@ impl Implementation, wl_shm_pool::Request> for let data = Box::into_raw(Box::new(InternalBufferData { pool: arc_pool.clone(), data: BufferData { - offset: offset, - width: width, - height: height, - stride: stride, - format: format, + offset, + width, + height, + stride, + format, }, })); let buffer = buffer.implement_nonsend( diff --git a/src/wayland/shm/pool.rs b/src/wayland/shm/pool.rs index 55ccac5..931119e 100644 --- a/src/wayland/shm/pool.rs +++ b/src/wayland/shm/pool.rs @@ -28,8 +28,8 @@ impl Pool { trace!(log, "Creating new shm pool"; "fd" => fd as i32, "size" => size); Ok(Pool { map: RwLock::new(memmap), - fd: fd, - log: log, + fd, + log, }) } @@ -100,8 +100,8 @@ impl MemMap { fn new(fd: RawFd, size: usize) -> Result { Ok(MemMap { ptr: unsafe { map(fd, size) }?, - fd: fd, - size: size, + fd, + size, }) } diff --git a/src/xwayland/x11_sockets.rs b/src/xwayland/x11_sockets.rs index 2fb4486..f872b61 100644 --- a/src/xwayland/x11_sockets.rs +++ b/src/xwayland/x11_sockets.rs @@ -40,7 +40,7 @@ impl X11Lock { Ok(mut file) => { // we got it, write our PID in it and we're good let ret = file.write_fmt(format_args!("{:>10}", ::nix::unistd::Pid::this())); - if let Err(_) = ret { + if ret.is_err() { // write to the file failed ? we abandon ::std::mem::drop(file); let _ = ::std::fs::remove_file(&filename);