Removed some crates from lint exceptions.

This commit is contained in:
Filipe Rodrigues 2025-09-13 01:19:34 +01:00
parent c09b2fd6e4
commit 0aef84953c
Signed by: zenithsiz
SSH Key Fingerprint: SHA256:Mb5ppb3Sh7IarBO/sBTXLHbYEOz37hJAlslLQPPAPaU
6 changed files with 22 additions and 34 deletions

View File

@ -1,7 +1,4 @@
absolute-paths-allowed-crates = [
# `winit::event::Event` would be ambiguous with just `event::Event` or `Event`.
"winit",
# `tokio` mirrors a lot of `std`'s api, so we want to explicitly mention when
# using `tokio`,
"tokio",
@ -9,12 +6,6 @@ absolute-paths-allowed-crates = [
# `tracing_subscriber::fmt` makes this ambiguous with `std::fmt`
"tracing_subscriber",
# Since this lint triggers for enum variants, and the following crates have
# types that would be ambiguous without the crate name, we allow them.
"wgpu",
"async_channel",
"async_walkdir",
# Crate consists of only nondescript modules
"naga_oil",
]

View File

@ -10,7 +10,7 @@ use {
std::{fmt, sync::Arc},
tokio::sync::Mutex,
tracing as _,
winit::window::Window,
winit::{event::WindowEvent, window::Window},
zsw_util::AppError,
zsw_wgpu::{FrameRender, Wgpu, WgpuRenderer},
};
@ -166,7 +166,7 @@ impl EguiEventHandler {
}
/// Handles an event
pub async fn handle_event(&self, event: &winit::event::WindowEvent) {
pub async fn handle_event(&self, event: &WindowEvent) {
self.platform.lock().await.handle_event(event);
}
}

View File

@ -15,7 +15,7 @@ use {
core::sync::atomic::{self, AtomicBool},
image::DynamicImage,
std::path::Path,
wgpu::util::DeviceExt,
wgpu::{util as wgpu_util, util::DeviceExt},
zsw_util::AppError,
};
@ -121,7 +121,7 @@ impl Wgpu {
let texture = self.device.create_texture_with_data(
&self.queue,
&texture_descriptor,
wgpu::util::TextureDataOrder::LayerMajor,
wgpu_util::TextureDataOrder::LayerMajor,
image.as_bytes(),
);

View File

@ -50,9 +50,10 @@ use {
directories::ProjectDirs,
std::{collections::HashMap, fs, sync::Arc},
winit::{
application::ApplicationHandler,
dpi::PhysicalSize,
event::WindowEvent,
event_loop::EventLoop,
event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy},
platform::{run_on_demand::EventLoopExtRunOnDemand, x11::EventLoopBuilderExtX11},
window::{Window, WindowId},
},
@ -118,36 +119,31 @@ struct WinitApp {
shared: Arc<Shared>,
}
impl winit::application::ApplicationHandler<AppEvent> for WinitApp {
fn resumed(&mut self, event_loop: &winit::event_loop::ActiveEventLoop) {
impl ApplicationHandler<AppEvent> for WinitApp {
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
if let Err(err) = self.init_window(event_loop) {
tracing::warn!("Unable to initialize window: {}", err.pretty());
event_loop.exit();
}
}
fn suspended(&mut self, event_loop: &winit::event_loop::ActiveEventLoop) {
fn suspended(&mut self, event_loop: &ActiveEventLoop) {
if let Err(err) = self.destroy_window() {
tracing::warn!("Unable to destroy window: {}", err.pretty());
event_loop.exit();
}
}
fn user_event(&mut self, event_loop: &winit::event_loop::ActiveEventLoop, event: AppEvent) {
fn user_event(&mut self, event_loop: &ActiveEventLoop, event: AppEvent) {
match event {
AppEvent::Shutdown => event_loop.exit(),
}
}
fn window_event(
&mut self,
_event_loop: &winit::event_loop::ActiveEventLoop,
window_id: WindowId,
event: WindowEvent,
) {
fn window_event(&mut self, _event_loop: &ActiveEventLoop, window_id: WindowId, event: WindowEvent) {
match event {
winit::event::WindowEvent::Resized(size) => self.shared.last_resize.store(Some(Resize { size })),
winit::event::WindowEvent::CursorMoved { position, .. } => self.shared.cursor_pos.store(Some(position)),
WindowEvent::Resized(size) => self.shared.last_resize.store(Some(Resize { size })),
WindowEvent::CursorMoved { position, .. } => self.shared.cursor_pos.store(Some(position)),
_ => (),
}
@ -163,7 +159,7 @@ impl WinitApp {
pub async fn new(
config: Arc<Config>,
config_dirs: Arc<ConfigDirs>,
event_loop_proxy: winit::event_loop::EventLoopProxy<AppEvent>,
event_loop_proxy: EventLoopProxy<AppEvent>,
) -> Result<Self, AppError> {
let wgpu = Wgpu::new().await.context("Unable to initialize wgpu")?;
let panels_renderer_shared = PanelsRendererShared::new(&wgpu);
@ -226,7 +222,7 @@ impl WinitApp {
}
/// Initializes the window related things
pub fn init_window(&mut self, event_loop: &winit::event_loop::ActiveEventLoop) -> Result<(), AppError> {
pub fn init_window(&mut self, event_loop: &ActiveEventLoop) -> Result<(), AppError> {
let windows = window::create(event_loop).context("Unable to create winit event loop and window")?;
for app_window in windows {
let window = Arc::new(app_window.window);

View File

@ -12,14 +12,14 @@ use {
},
crossbeam::atomic::AtomicCell,
std::sync::Arc,
winit::dpi::PhysicalPosition,
winit::{dpi::PhysicalPosition, event_loop::EventLoopProxy},
zsw_wgpu::Wgpu,
};
/// Shared data
#[derive(Debug)]
pub struct Shared {
pub event_loop_proxy: winit::event_loop::EventLoopProxy<AppEvent>,
pub event_loop_proxy: EventLoopProxy<AppEvent>,
pub last_resize: AtomicCell<Option<Resize>>,
pub cursor_pos: AtomicCell<Option<PhysicalPosition<f64>>>,

View File

@ -6,7 +6,8 @@ use {
cgmath::{Point2, Vector2},
winit::{
event_loop::ActiveEventLoop,
window::{Window, WindowAttributes},
monitor::MonitorHandle,
window::{Fullscreen, Window, WindowAttributes, WindowLevel},
},
zsw_util::{AppError, Rect},
};
@ -41,8 +42,8 @@ pub fn create(event_loop: &ActiveEventLoop) -> Result<Vec<AppWindow>, AppError>
.with_position(monitor.position())
.with_inner_size(monitor.size())
.with_resizable(false)
.with_fullscreen(Some(winit::window::Fullscreen::Borderless(Some(monitor))))
.with_window_level(winit::window::WindowLevel::AlwaysOnBottom)
.with_fullscreen(Some(Fullscreen::Borderless(Some(monitor))))
.with_window_level(WindowLevel::AlwaysOnBottom)
.with_transparent(true)
.with_decorations(false);
@ -61,7 +62,7 @@ pub fn create(event_loop: &ActiveEventLoop) -> Result<Vec<AppWindow>, AppError>
}
/// Returns a monitor's geometry
fn monitor_geometry(monitor: &winit::monitor::MonitorHandle) -> Rect<i32, u32> {
fn monitor_geometry(monitor: &MonitorHandle) -> Rect<i32, u32> {
let monitor_pos = monitor.position();
let monitor_size = monitor.size();
Rect {