chore: Fix remaining clippy lints
This commit is contained in:
parent
0a016991a4
commit
5216eb50ba
14 changed files with 64 additions and 50 deletions
|
|
@ -747,7 +747,7 @@ impl KmsGuard<'_> {
|
|||
.crtcs()
|
||||
.iter()
|
||||
.filter(|crtc| {
|
||||
device.inner.surfaces.get(crtc).is_none()
|
||||
!device.inner.surfaces.contains_key(crtc)
|
||||
// TODO: We can't do this. See https://github.com/Smithay/smithay/pull/1820
|
||||
//.is_some_and(|surface| surface.output.is_enabled())
|
||||
})
|
||||
|
|
|
|||
|
|
@ -511,8 +511,10 @@ fn surface_thread(
|
|||
let egui = {
|
||||
let state =
|
||||
smithay_egui::EguiState::new(smithay::utils::Rectangle::from_size((400, 800).into()));
|
||||
let mut visuals: egui::style::Visuals = Default::default();
|
||||
visuals.window_shadow = egui::Shadow::NONE;
|
||||
let visuals = egui::style::Visuals {
|
||||
window_shadow: egui::Shadow::NONE,
|
||||
..Default::default()
|
||||
};
|
||||
state.context().set_visuals(visuals);
|
||||
state
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ use tracing::{debug, error, info, warn};
|
|||
use super::render::{ScreenFilterStorage, init_shaders};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum Allocator {
|
||||
Gbm(GbmAllocator<DrmDeviceFd>),
|
||||
Vulkan(PhysicalDevice),
|
||||
|
|
|
|||
36
src/debug.rs
36
src/debug.rs
|
|
@ -27,7 +27,7 @@ pub const RENDER_COLOR: Color32 = Color32::from_rgb(29, 114, 58);
|
|||
pub const SUBMITTED_COLOR: Color32 = Color32::from_rgb(253, 178, 39);
|
||||
pub const DISPLAY_COLOR: Color32 = Color32::from_rgb(41, 184, 209);
|
||||
|
||||
pub fn fps_ui<'a>(
|
||||
pub fn fps_ui(
|
||||
gpu: Option<&DrmNode>,
|
||||
debug_active: bool,
|
||||
seats: &[Seat<State>],
|
||||
|
|
@ -122,23 +122,19 @@ pub fn fps_ui<'a>(
|
|||
if let Ok(vendor) = std::fs::read_to_string(format!(
|
||||
"/sys/class/drm/renderD{}/device/vendor",
|
||||
gpu.minor()
|
||||
)) {
|
||||
if let Some(img) = match vendor.trim() {
|
||||
"0x10de" => Some(egui::include_image!(
|
||||
"../resources/icons/nvidia.svg"
|
||||
)),
|
||||
"0x1002" => {
|
||||
Some(egui::include_image!("../resources/icons/amd.svg"))
|
||||
}
|
||||
"0x8086" => Some(egui::include_image!(
|
||||
"../resources/icons/intel.svg"
|
||||
)),
|
||||
_ => None,
|
||||
} {
|
||||
ui.add(
|
||||
egui::Image::new(img).max_height(resp.rect.height()),
|
||||
);
|
||||
)) && let Some(img) = match vendor.trim() {
|
||||
"0x10de" => {
|
||||
Some(egui::include_image!("../resources/icons/nvidia.svg"))
|
||||
}
|
||||
"0x1002" => {
|
||||
Some(egui::include_image!("../resources/icons/amd.svg"))
|
||||
}
|
||||
"0x8086" => {
|
||||
Some(egui::include_image!("../resources/icons/intel.svg"))
|
||||
}
|
||||
_ => None,
|
||||
} {
|
||||
ui.add(egui::Image::new(img).max_height(resp.rect.height()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -311,7 +307,7 @@ fn format_pointer_focus(focus: Option<PointerFocusTarget>) -> String {
|
|||
),
|
||||
Some(ResizeFork(_)) => String::from("Resize UI"),
|
||||
Some(ZoomUI(_)) => String::from("Zoom UI"),
|
||||
None => format!("None"),
|
||||
None => "None".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -348,8 +344,8 @@ fn format_keyboard_focus(focus: Option<KeyboardFocusTarget>) -> String {
|
|||
),
|
||||
Some(LayerSurface(x)) => format!("LayerSurface {}", x.wl_surface().id().protocol_id()),
|
||||
Some(Popup(x)) => format!("Popup {}", x.wl_surface().id().protocol_id()),
|
||||
Some(Group(_)) => format!("Window Group"),
|
||||
Some(Group(_)) => "Window Group".to_string(),
|
||||
Some(LockSurface(x)) => format!("LockSurface {}", x.wl_surface().id().protocol_id()),
|
||||
None => format!("None"),
|
||||
None => "None".to_string(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#![allow(
|
||||
clippy::too_many_arguments,
|
||||
clippy::type_complexity,
|
||||
clippy::len_without_is_empty
|
||||
)]
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use calloop::timer::{TimeoutAction, Timer};
|
||||
|
|
|
|||
|
|
@ -812,7 +812,7 @@ impl CosmicMapped {
|
|||
scale.x,
|
||||
0.8,
|
||||
) {
|
||||
Ok(element) => vec![CosmicMappedRenderElement::from(element).into()],
|
||||
Ok(element) => vec![CosmicMappedRenderElement::from(element)],
|
||||
Err(err) => {
|
||||
debug!(?err, "Error rendering debug overlay.");
|
||||
Vec::new()
|
||||
|
|
|
|||
|
|
@ -154,6 +154,8 @@ impl Focus {
|
|||
}
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
/// `value` must be in the range of `Focus`
|
||||
pub unsafe fn from_u8(value: u8) -> Option<Focus> {
|
||||
match value {
|
||||
0 => None,
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ pub enum PointerFocusTarget {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum PointerFocusToplevel {
|
||||
Surface(CosmicSurface),
|
||||
Popup(PopupKind),
|
||||
|
|
|
|||
|
|
@ -737,6 +737,8 @@ impl MoveGrab {
|
|||
release: ReleaseMode,
|
||||
evlh: LoopHandle<'static, State>,
|
||||
) -> MoveGrab {
|
||||
// false-positive: `Output`s hash is based on it's inner ptr
|
||||
#[allow(clippy::mutable_key_type)]
|
||||
let mut outputs = HashSet::new();
|
||||
outputs.insert(cursor_output.clone());
|
||||
window.output_enter(&cursor_output, window.geometry()); // not accurate but...
|
||||
|
|
@ -798,6 +800,8 @@ impl Drop for MoveGrab {
|
|||
// No more buttons are pressed, release the grab.
|
||||
let output = self.cursor_output.clone();
|
||||
let seat = self.seat.clone();
|
||||
// false-positive: `Output`s hash is based on it's inner ptr
|
||||
#[allow(clippy::mutable_key_type)]
|
||||
let window_outputs = self.window_outputs.drain().collect::<HashSet<_>>();
|
||||
let previous = self.previous;
|
||||
let window = self.window.clone();
|
||||
|
|
|
|||
|
|
@ -1459,35 +1459,32 @@ impl TilingLayout {
|
|||
let _ = tree.remove_node(node.clone(), RemoveBehavior::DropChildren);
|
||||
|
||||
// fixup parent node
|
||||
match parent_id {
|
||||
Some(id) => {
|
||||
let position = position.unwrap();
|
||||
let group = tree.get_mut(&id).unwrap().data_mut();
|
||||
assert!(group.is_group());
|
||||
if let Some(id) = parent_id {
|
||||
let position = position.unwrap();
|
||||
let group = tree.get_mut(&id).unwrap().data_mut();
|
||||
assert!(group.is_group());
|
||||
|
||||
if group.len() > 2 {
|
||||
group.remove_window(position);
|
||||
} else {
|
||||
trace!("Removing Group");
|
||||
let other_child = tree.children_ids(&id).unwrap().next().cloned().unwrap();
|
||||
let fork_pos = parent_parent_id.as_ref().and_then(|parent_id| {
|
||||
tree.children_ids(parent_id).unwrap().position(|i| i == &id)
|
||||
});
|
||||
let _ = tree.remove_node(id.clone(), RemoveBehavior::OrphanChildren);
|
||||
tree.move_node(
|
||||
&other_child,
|
||||
parent_parent_id
|
||||
.as_ref()
|
||||
.map(MoveBehavior::ToParent)
|
||||
.unwrap_or(MoveBehavior::ToRoot),
|
||||
)
|
||||
.unwrap();
|
||||
if let Some(old_pos) = fork_pos {
|
||||
tree.make_nth_sibling(&other_child, old_pos).unwrap();
|
||||
}
|
||||
if group.len() > 2 {
|
||||
group.remove_window(position);
|
||||
} else {
|
||||
trace!("Removing Group");
|
||||
let other_child = tree.children_ids(&id).unwrap().next().cloned().unwrap();
|
||||
let fork_pos = parent_parent_id.as_ref().and_then(|parent_id| {
|
||||
tree.children_ids(parent_id).unwrap().position(|i| i == &id)
|
||||
});
|
||||
let _ = tree.remove_node(id.clone(), RemoveBehavior::OrphanChildren);
|
||||
tree.move_node(
|
||||
&other_child,
|
||||
parent_parent_id
|
||||
.as_ref()
|
||||
.map(MoveBehavior::ToParent)
|
||||
.unwrap_or(MoveBehavior::ToRoot),
|
||||
)
|
||||
.unwrap();
|
||||
if let Some(old_pos) = fork_pos {
|
||||
tree.make_nth_sibling(&other_child, old_pos).unwrap();
|
||||
}
|
||||
}
|
||||
None => {} // root
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1186,6 +1186,8 @@ impl Workspaces {
|
|||
let len = self.sets[0].workspaces.len();
|
||||
let mut active = self.sets[0].active;
|
||||
let mut keep = vec![true; len];
|
||||
// false-positive: we iterate over multiple sets
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for i in 0..len {
|
||||
let has_windows = self
|
||||
.sets
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ pub struct FullscreenRestoreData {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FocusResult {
|
||||
None,
|
||||
Handled,
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ pub struct Common {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum BackendData {
|
||||
X11(X11State),
|
||||
Winit(WinitState),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::wrong_self_convention)]
|
||||
|
||||
use std::sync::Mutex;
|
||||
|
||||
use smithay::{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue