clippy
This commit is contained in:
1 parent
0accf24181
commit
ff4f0add98
5 files changed
+19
-26
No files matched your search
+2
-1
@@ -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;
|
||||
|
||||
+4
-4
@@ -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,
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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<MouseCursor>) -> 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);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
(),
|
||||
)
|
||||
|
||||
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user