Fix all warnings previously generated by clippy
This commit is contained in:
@@ -20,5 +20,6 @@ pkgs.rustPlatform.buildRustPackage {
|
|||||||
pkgs.pkg-config
|
pkgs.pkg-config
|
||||||
pkgs.rustPlatform.bindgenHook
|
pkgs.rustPlatform.bindgenHook
|
||||||
pkgs.rustfmt
|
pkgs.rustfmt
|
||||||
|
pkgs.clippy
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ impl LockedSurface {
|
|||||||
use wayland_client::Proxy;
|
use wayland_client::Proxy;
|
||||||
self.wayland_surface
|
self.wayland_surface
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(false, |ws| ws.id() == surface.id())
|
.is_some_and(|ws| ws.id() == surface.id())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the surface state (called on each frame)
|
/// Update the surface state (called on each frame)
|
||||||
|
|||||||
+3
-2
@@ -160,7 +160,7 @@ impl WaylandLock {
|
|||||||
if let Some(info) = self.output_state.info(output) {
|
if let Some(info) = self.output_state.info(output) {
|
||||||
if let Some(mode) = info.modes.first() {
|
if let Some(mode) = info.modes.first() {
|
||||||
let (w, h) = mode.dimensions;
|
let (w, h) = mode.dimensions;
|
||||||
return (w as i32, h as i32);
|
return (w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(1920, 1080)
|
(1920, 1080)
|
||||||
@@ -587,6 +587,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
log::set_logger(&LOGGER).map(|()| log::set_max_level(log::LevelFilter::Debug))?;
|
log::set_logger(&LOGGER).map(|()| log::set_max_level(log::LevelFilter::Debug))?;
|
||||||
|
|
||||||
log::info!("Starting rustlock v{}", env!("CARGO_PKG_VERSION"));
|
log::info!("Starting rustlock v{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
#[allow(clippy::arc_with_non_send_sync)]
|
||||||
let lock_manager = Arc::new(Mutex::new(LockManager::new(config.clone())));
|
let lock_manager = Arc::new(Mutex::new(LockManager::new(config.clone())));
|
||||||
let ctrlc_exit = Arc::new(std::sync::atomic::AtomicBool::new(false));
|
let ctrlc_exit = Arc::new(std::sync::atomic::AtomicBool::new(false));
|
||||||
|
|
||||||
@@ -626,7 +627,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
registry_state: RegistryState::new(&globals),
|
registry_state: RegistryState::new(&globals),
|
||||||
session_lock_state: SessionLockState::new(&globals, &qh),
|
session_lock_state: SessionLockState::new(&globals, &qh),
|
||||||
seat_state: SeatState::new(&globals, &qh),
|
seat_state: SeatState::new(&globals, &qh),
|
||||||
shm_state: shm_state,
|
shm_state,
|
||||||
pool,
|
pool,
|
||||||
session_lock: None,
|
session_lock: None,
|
||||||
lock_surfaces: Vec::new(),
|
lock_surfaces: Vec::new(),
|
||||||
|
|||||||
+4
-16
@@ -499,8 +499,8 @@ impl Renderer {
|
|||||||
let art_size = 56.0;
|
let art_size = 56.0;
|
||||||
let spacing = 80.0;
|
let spacing = 80.0;
|
||||||
|
|
||||||
if self.config.show_album_art {
|
if self.config.show_album_art
|
||||||
if self.system_status.media_art_url != self.last_art_url {
|
&& self.system_status.media_art_url != self.last_art_url {
|
||||||
self.last_art_url = self.system_status.media_art_url.clone();
|
self.last_art_url = self.system_status.media_art_url.clone();
|
||||||
self.media_art_surface = None;
|
self.media_art_surface = None;
|
||||||
if let Some(ref data) = self.system_status.media_art_data {
|
if let Some(ref data) = self.system_status.media_art_data {
|
||||||
@@ -526,7 +526,6 @@ impl Renderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let has_art = self.config.show_album_art && self.media_art_surface.is_some();
|
let has_art = self.config.show_album_art && self.media_art_surface.is_some();
|
||||||
let text_x = if has_art {
|
let text_x = if has_art {
|
||||||
@@ -654,25 +653,14 @@ impl Renderer {
|
|||||||
self.context.move_to(text_x, y);
|
self.context.move_to(text_x, y);
|
||||||
self.context.show_text(ssid).unwrap();
|
self.context.show_text(ssid).unwrap();
|
||||||
} else {
|
} else {
|
||||||
let strength = self.system_status.wifi_strength.unwrap_or(0);
|
|
||||||
let icon = if strength > 75 {
|
|
||||||
"📶"
|
|
||||||
} else if strength > 50 {
|
|
||||||
"📶"
|
|
||||||
} else if strength > 25 {
|
|
||||||
"📶"
|
|
||||||
} else {
|
|
||||||
"📶"
|
|
||||||
};
|
|
||||||
let text = format!("{} {}", icon, ssid);
|
|
||||||
self.context.new_path();
|
self.context.new_path();
|
||||||
self.context.set_source_rgba(1.0, 1.0, 1.0, self.fade_alpha);
|
self.context.set_source_rgba(1.0, 1.0, 1.0, self.fade_alpha);
|
||||||
self.context.set_font_size(16.0);
|
self.context.set_font_size(16.0);
|
||||||
self.context.move_to(x, y);
|
self.context.move_to(x, y);
|
||||||
self.context.show_text(&text).unwrap();
|
self.context.show_text(ssid).unwrap();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let text = "📵 No WiFi";
|
let text = "No WiFi";
|
||||||
self.context.new_path();
|
self.context.new_path();
|
||||||
self.context
|
self.context
|
||||||
.set_source_rgba(1.0, 1.0, 1.0, self.fade_alpha * 0.5);
|
.set_source_rgba(1.0, 1.0, 1.0, self.fade_alpha * 0.5);
|
||||||
|
|||||||
+4
-4
@@ -394,24 +394,24 @@ impl ScreenshotManager {
|
|||||||
flipped[dst_offset..dst_offset + src_stride]
|
flipped[dst_offset..dst_offset + src_stride]
|
||||||
.copy_from_slice(&converted_data[src_offset..src_offset + src_stride]);
|
.copy_from_slice(&converted_data[src_offset..src_offset + src_stride]);
|
||||||
}
|
}
|
||||||
return Ok(ImageSurface::create_for_data(
|
return ImageSurface::create_for_data(
|
||||||
flipped,
|
flipped,
|
||||||
cairo::Format::ARgb32,
|
cairo::Format::ARgb32,
|
||||||
info.width as i32,
|
info.width as i32,
|
||||||
info.height as i32,
|
info.height as i32,
|
||||||
src_stride as i32,
|
src_stride as i32,
|
||||||
)
|
)
|
||||||
.context("Failed to create flipped Cairo surface")?);
|
.context("Failed to create flipped Cairo surface");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ImageSurface::create_for_data(
|
ImageSurface::create_for_data(
|
||||||
converted_data,
|
converted_data,
|
||||||
cairo::Format::ARgb32,
|
cairo::Format::ARgb32,
|
||||||
info.width as i32,
|
info.width as i32,
|
||||||
info.height as i32,
|
info.height as i32,
|
||||||
pixel_width as i32,
|
pixel_width as i32,
|
||||||
)
|
)
|
||||||
.context("Failed to create Cairo surface")?)
|
.context("Failed to create Cairo surface")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -230,7 +230,7 @@ impl SystemManager {
|
|||||||
)
|
)
|
||||||
).await;
|
).await;
|
||||||
|
|
||||||
if let Err(_) = result {
|
if result.is_err() {
|
||||||
error!("System command {} timed out", method);
|
error!("System command {} timed out", method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user