all: address clippy issues
This commit is contained in:
parent
9c7299234a
commit
036af4abaa
10 changed files with 23 additions and 13 deletions
|
|
@ -8,7 +8,9 @@
|
||||||
clippy::unnecessary_to_owned,
|
clippy::unnecessary_to_owned,
|
||||||
clippy::match_like_matches_macro,
|
clippy::match_like_matches_macro,
|
||||||
clippy::too_many_arguments,
|
clippy::too_many_arguments,
|
||||||
clippy::iter_skip_next
|
clippy::iter_skip_next,
|
||||||
|
clippy::uninlined_format_args,
|
||||||
|
clippy::manual_is_ascii_check
|
||||||
)]
|
)]
|
||||||
|
|
||||||
extern crate core;
|
extern crate core;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,11 @@
|
||||||
//! config!(configure);
|
//! config!(configure);
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![allow(clippy::zero_prefixed_literal, clippy::manual_range_contains)]
|
#![allow(
|
||||||
|
clippy::zero_prefixed_literal,
|
||||||
|
clippy::manual_range_contains,
|
||||||
|
clippy::uninlined_format_args
|
||||||
|
)]
|
||||||
|
|
||||||
use {
|
use {
|
||||||
crate::keyboard::ModifiedKeySym,
|
crate::keyboard::ModifiedKeySym,
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ impl AsyncEngine {
|
||||||
while self.num_queued.get() > 0 {
|
while self.num_queued.get() > 0 {
|
||||||
self.iteration.fetch_add(1);
|
self.iteration.fetch_add(1);
|
||||||
let mut phase = 0;
|
let mut phase = 0;
|
||||||
while phase < NUM_PHASES as usize {
|
while phase < NUM_PHASES {
|
||||||
self.queues[phase].swap(&mut *stash);
|
self.queues[phase].swap(&mut *stash);
|
||||||
if stash.is_empty() {
|
if stash.is_empty() {
|
||||||
phase += 1;
|
phase += 1;
|
||||||
|
|
|
||||||
|
|
@ -920,6 +920,7 @@ impl XBackend {
|
||||||
if changed {
|
if changed {
|
||||||
let images = self.create_images(output.window, width, height).await?;
|
let images = self.create_images(output.window, width, height).await?;
|
||||||
for (new, old) in images.iter().zip(output.images.iter()) {
|
for (new, old) in images.iter().zip(output.images.iter()) {
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
let _ = self.c.call(&FreePixmap {
|
let _ = self.c.call(&FreePixmap {
|
||||||
pixmap: old.pixmap.get(),
|
pixmap: old.pixmap.get(),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -613,8 +613,8 @@ fn parser_cursor_file<R: BufRead + Seek>(
|
||||||
};
|
};
|
||||||
let num_bytes = width as usize * height as usize * 4;
|
let num_bytes = width as usize * height as usize * 4;
|
||||||
unsafe {
|
unsafe {
|
||||||
image.pixels.reserve_exact(num_bytes as usize);
|
image.pixels.reserve_exact(num_bytes);
|
||||||
image.pixels.set_len(num_bytes as usize);
|
image.pixels.set_len(num_bytes);
|
||||||
r.read_exact(slice::from_raw_parts_mut(
|
r.read_exact(slice::from_raw_parts_mut(
|
||||||
image.pixels.as_mut_ptr() as _,
|
image.pixels.as_mut_ptr() as _,
|
||||||
num_bytes,
|
num_bytes,
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,11 @@
|
||||||
clippy::collapsible_match,
|
clippy::collapsible_match,
|
||||||
clippy::field_reassign_with_default,
|
clippy::field_reassign_with_default,
|
||||||
clippy::new_ret_no_self,
|
clippy::new_ret_no_self,
|
||||||
clippy::or_fun_call
|
clippy::or_fun_call,
|
||||||
|
clippy::uninlined_format_args,
|
||||||
|
clippy::manual_is_ascii_check,
|
||||||
|
clippy::needless_borrow,
|
||||||
|
clippy::unnecessary_cast
|
||||||
)]
|
)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ impl<'a> PwParser<'a> {
|
||||||
packed: bool,
|
packed: bool,
|
||||||
) -> Result<PwPod<'a>, PwParserError> {
|
) -> Result<PwPod<'a>, PwParserError> {
|
||||||
let size = if packed { len } else { (len + 7) & !7 };
|
let size = if packed { len } else { (len + 7) & !7 };
|
||||||
if self.len() < size as usize {
|
if self.len() < size {
|
||||||
return Err(PwParserError::UnexpectedEof);
|
return Err(PwParserError::UnexpectedEof);
|
||||||
}
|
}
|
||||||
let val = match ty {
|
let val = match ty {
|
||||||
|
|
@ -278,7 +278,7 @@ impl<'a> PwParser<'a> {
|
||||||
}
|
}
|
||||||
_ => return Err(PwParserError::UnknownType(ty)),
|
_ => return Err(PwParserError::UnknownType(ty)),
|
||||||
};
|
};
|
||||||
self.pos += size as usize;
|
self.pos += size;
|
||||||
Ok(val)
|
Ok(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -210,8 +210,7 @@ impl GuiElement for Button {
|
||||||
r.fill_boxes_f(&rects, &color);
|
r.fill_boxes_f(&rects, &color);
|
||||||
}
|
}
|
||||||
if let Some(tex) = self.tex.get() {
|
if let Some(tex) = self.tex.get() {
|
||||||
let (tx, ty) =
|
let (tx, ty) = r.scale_point_f(x1 + self.tex_off_x.get(), y1 + self.tex_off_y.get());
|
||||||
r.scale_point_f(x1 + self.tex_off_x.get(), y1 as f32 + self.tex_off_y.get());
|
|
||||||
r.render_texture(
|
r.render_texture(
|
||||||
&tex,
|
&tex,
|
||||||
tx.round() as _,
|
tx.round() as _,
|
||||||
|
|
|
||||||
|
|
@ -469,12 +469,12 @@ impl State {
|
||||||
let mut x1 = output_rect.x1();
|
let mut x1 = output_rect.x1();
|
||||||
let mut y1 = output_rect.y1();
|
let mut y1 = output_rect.y1();
|
||||||
if width < output_rect.width() {
|
if width < output_rect.width() {
|
||||||
x1 += (output_rect.width() - width) as i32 / 2;
|
x1 += (output_rect.width() - width) / 2;
|
||||||
} else {
|
} else {
|
||||||
width = output_rect.width();
|
width = output_rect.width();
|
||||||
}
|
}
|
||||||
if height < output_rect.height() {
|
if height < output_rect.height() {
|
||||||
y1 += (output_rect.height() - height) as i32 / 2;
|
y1 += (output_rect.height() - height) / 2;
|
||||||
} else {
|
} else {
|
||||||
height = output_rect.height();
|
height = output_rect.height();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -405,7 +405,7 @@ impl DrmMaster {
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
buf = &buf[len as usize..];
|
buf = &buf[len..];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(self.events.pop())
|
Ok(self.events.pop())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue