diff --git a/vtparse/src/lib.rs b/vtparse/src/lib.rs index 5d8c4340d..4c5ad9014 100644 --- a/vtparse/src/lib.rs +++ b/vtparse/src/lib.rs @@ -291,7 +291,6 @@ impl OscState { match self.num_params { MAX_OSC => { self.full = true; - return; } num => { self.param_indices[num - 1] = self.buffer.len(); @@ -330,6 +329,7 @@ pub struct VTParser { } impl VTParser { + #[allow(clippy::new_without_default)] pub fn new() -> Self { let param_indices = [0usize; MAX_OSC]; let params = [0i64; MAX_PARAMS]; @@ -453,6 +453,7 @@ impl VTParser { let mut offset = 0usize; let mut slice = self.osc.buffer.as_slice(); let limit = self.osc.num_params.min(MAX_OSC); + #[allow(clippy::needless_range_loop)] for i in 0..limit - 1 { let (a, b) = slice.split_at(self.osc.param_indices[i] - offset); params[i] = a; diff --git a/window/src/egl.rs b/window/src/egl.rs index d642482be..484aad35e 100644 --- a/window/src/egl.rs +++ b/window/src/egl.rs @@ -283,12 +283,12 @@ impl GlState { &[ffi::CONTEXT_MAJOR_VERSION, 3, ffi::NONE], )?; - return Ok(Self { + Ok(Self { egl, display: egl_display, context, surface, - }); + }) }) } @@ -338,12 +338,12 @@ impl GlState { &[ffi::CONTEXT_MAJOR_VERSION, 3, ffi::NONE], )?; - return Ok(Self { + Ok(Self { egl, display: egl_display, context, surface, - }); + }) }) } } diff --git a/window/src/os/wayland/connection.rs b/window/src/os/wayland/connection.rs index 62574f3cf..d46be3cfe 100644 --- a/window/src/os/wayland/connection.rs +++ b/window/src/os/wayland/connection.rs @@ -87,7 +87,7 @@ impl WaylandConnection { (), ) }) - .with_context(|| format!("Failed to create seat"))?; + .context("Failed to create seat")?; let keyboard = KeyboardDispatcher::register(&seat)?; let pointer = PointerDispatcher::register( diff --git a/window/src/os/wayland/window.rs b/window/src/os/wayland/window.rs index 2110800fa..997176464 100644 --- a/window/src/os/wayland/window.rs +++ b/window/src/os/wayland/window.rs @@ -122,13 +122,12 @@ impl PendingEvent { } } Event::Refresh => { - let changed = if !self.refresh { + if !self.refresh { self.refresh = true; true } else { false - }; - changed + } } Event::Configure { new_size, .. } => { let changed; @@ -410,11 +409,9 @@ impl WaylandWindowInner { pending = pending_events.clone(); *pending_events = PendingEvent::default(); } - if pending.close { - if self.callbacks.can_close() { - self.callbacks.destroy(); - self.window.take(); - } + if pending.close && self.callbacks.can_close() { + self.callbacks.destroy(); + self.window.take(); } if let Some((w, h)) = pending.configure.take() { if self.window.is_some() { @@ -453,10 +450,8 @@ impl WaylandWindowInner { pending.refresh = true; } } - if pending.refresh { - if self.window.is_some() { - self.do_paint().unwrap(); - } + if pending.refresh && self.window.is_some() { + self.do_paint().unwrap(); } } @@ -617,7 +612,7 @@ impl WindowOps for WaylandWindow { fn set_cursor(&self, cursor: Option) -> Future<()> { WaylandConnection::with_window_inner(self.0, move |inner| { - let _ = inner.set_cursor(cursor); + inner.set_cursor(cursor); Ok(()) }) } @@ -756,14 +751,13 @@ impl WindowOps for WaylandWindow { .data_device_manager .create_data_source(move |source| { source.implement_closure( - move |event, _source| match event { - DataSourceEvent::Send { fd, .. } => { + move |event, _source| { + if let DataSourceEvent::Send { fd, .. } = event { let fd = unsafe { FileDescriptor::from_raw_fd(fd) }; if let Err(e) = write_pipe_with_timeout(fd, text.as_bytes()) { log::error!("while sending paste to pipe: {}", e); } } - _ => {} }, (), ) diff --git a/window/src/os/x11/window.rs b/window/src/os/x11/window.rs index 66711c3d6..27a2cc576 100644 --- a/window/src/os/x11/window.rs +++ b/window/src/os/x11/window.rs @@ -531,10 +531,8 @@ impl XWindowInner { log::error!("clipboard: err while getting clipboard property: {:?}", err); } } - } else { - if let Some(mut promise) = self.copy_and_paste.request.take() { - promise.ok("".to_owned()); - } + } else if let Some(mut promise) = self.copy_and_paste.request.take() { + promise.ok("".to_owned()); } Ok(()) }