mirror of
https://github.com/Smithay/smithay.git
synced 2024-09-28 03:21:14 +02:00
Fix new Clippy warnings
This commit is contained in:
parent
fe654453b0
commit
68a629d79a
5 changed files with 10 additions and 28 deletions
|
@ -400,16 +400,8 @@ impl<BackendData: Backend> PointerGrab<AnvilState<BackendData>> for PointerResiz
|
|||
|
||||
let min_width = min_size.w.max(1);
|
||||
let min_height = min_size.h.max(1);
|
||||
let max_width = if max_size.w == 0 {
|
||||
i32::max_value()
|
||||
} else {
|
||||
max_size.w
|
||||
};
|
||||
let max_height = if max_size.h == 0 {
|
||||
i32::max_value()
|
||||
} else {
|
||||
max_size.h
|
||||
};
|
||||
let max_width = if max_size.w == 0 { i32::MAX } else { max_size.w };
|
||||
let max_height = if max_size.h == 0 { i32::MAX } else { max_size.h };
|
||||
|
||||
new_window_width = new_window_width.max(min_width).min(max_width);
|
||||
new_window_height = new_window_height.max(min_height).min(max_height);
|
||||
|
@ -804,16 +796,8 @@ impl<BackendData: Backend> TouchGrab<AnvilState<BackendData>> for TouchResizeSur
|
|||
|
||||
let min_width = min_size.w.max(1);
|
||||
let min_height = min_size.h.max(1);
|
||||
let max_width = if max_size.w == 0 {
|
||||
i32::max_value()
|
||||
} else {
|
||||
max_size.w
|
||||
};
|
||||
let max_height = if max_size.h == 0 {
|
||||
i32::max_value()
|
||||
} else {
|
||||
max_size.h
|
||||
};
|
||||
let max_width = if max_size.w == 0 { i32::MAX } else { max_size.w };
|
||||
let max_height = if max_size.h == 0 { i32::MAX } else { max_size.h };
|
||||
|
||||
new_window_width = new_window_width.max(min_width).min(max_width);
|
||||
new_window_height = new_window_height.max(min_height).min(max_height);
|
||||
|
|
|
@ -2,10 +2,7 @@ use criterion::{criterion_group, criterion_main, Criterion};
|
|||
use rand::Rng;
|
||||
use smithay::utils::{Physical, Rectangle, Size};
|
||||
|
||||
fn element_visible_size(
|
||||
test_element: Rectangle<i32, Physical>,
|
||||
opaque_regions: &Vec<Rectangle<i32, Physical>>,
|
||||
) {
|
||||
fn element_visible_size(test_element: Rectangle<i32, Physical>, opaque_regions: &[Rectangle<i32, Physical>]) {
|
||||
let mut workhouse = Vec::with_capacity(2048 * 4);
|
||||
workhouse.push(test_element);
|
||||
workhouse = Rectangle::subtract_rects_many_in_place(workhouse, opaque_regions.iter().copied());
|
||||
|
@ -35,7 +32,6 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||
// let y_max = stage.h - element_size.h;
|
||||
|
||||
let opaque_regions = (0..2048)
|
||||
.into_iter()
|
||||
.map(|_| {
|
||||
let x = rand.gen_range(x_min..=x_max);
|
||||
let y = rand.gen_range(y_min..=y_max);
|
||||
|
|
|
@ -422,7 +422,7 @@ impl AtomicDrmSurface {
|
|||
return Err(Error::DeviceInactive);
|
||||
}
|
||||
|
||||
let current = self.state.write().unwrap();
|
||||
let current = self.state.read().unwrap();
|
||||
let mut pending = self.pending.write().unwrap();
|
||||
|
||||
self.ensure_props_known(connectors)?;
|
||||
|
@ -578,7 +578,7 @@ impl AtomicDrmSurface {
|
|||
let planes = planes.into_iter().collect::<Vec<_>>();
|
||||
let mut current = self.state.write().unwrap();
|
||||
let mut used_planes = self.used_planes.lock().unwrap();
|
||||
let pending = self.pending.write().unwrap();
|
||||
let pending = self.pending.read().unwrap();
|
||||
|
||||
debug!(current = ?*current, pending = ?*pending, ?planes, "Preparing Commit",);
|
||||
|
||||
|
|
|
@ -150,6 +150,8 @@ impl InnerPool {
|
|||
place_sigbus_handler();
|
||||
});
|
||||
|
||||
// This is actually a write access.
|
||||
#[allow(clippy::readonly_write_lock)]
|
||||
let pool_guard = self.map.write().unwrap();
|
||||
|
||||
trace!(fd = ?self.fd, "Mutable buffer access on shm pool");
|
||||
|
|
|
@ -1259,7 +1259,7 @@ where
|
|||
// "to_ignore <= seqno". This is equivalent to "to_ignore - seqno <= 0", which is what we
|
||||
// check instead. Since sequence numbers are unsigned, we need a trick: We decide
|
||||
// that values from [MAX/2, MAX] count as "<= 0" and the rest doesn't.
|
||||
if to_ignore.wrapping_sub(seqno) <= u16::max_value() / 2 {
|
||||
if to_ignore.wrapping_sub(seqno) <= u16::MAX / 2 {
|
||||
// If the two sequence numbers are equal, this event should be ignored.
|
||||
should_ignore = to_ignore == seqno;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue