1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-04-19 19:34:24 +02:00

refactor: fix new clippy warnings

This commit is contained in:
Jake Stanger 2023-10-19 21:11:56 +01:00
parent 4aa3009f4f
commit 08e354e019
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
4 changed files with 10 additions and 7 deletions

View file

@ -5,7 +5,7 @@ use hyprland::data::{Workspace as HWorkspace, Workspaces};
use hyprland::dispatch::{Dispatch, DispatchType, WorkspaceIdentifierWithSpecial};
use hyprland::event_listener::EventListener;
use hyprland::prelude::*;
use hyprland::shared::WorkspaceType;
use hyprland::shared::{HyprDataVec, WorkspaceType};
use lazy_static::lazy_static;
use tokio::sync::broadcast::{channel, Receiver, Sender};
use tokio::task::spawn_blocking;
@ -260,9 +260,12 @@ fn get_workspace_name(name: WorkspaceType) -> String {
}
}
/// Creates a function which determines if a workspace is visible. This function makes a Hyprland call that allocates so it should be cached when possible, but it is only valid so long as workspaces do not change so it should not be stored long term
/// Creates a function which determines if a workspace is visible.
///
/// This function makes a Hyprland call that allocates so it should be cached when possible,
/// but it is only valid so long as workspaces do not change so it should not be stored long term
fn create_is_visible() -> impl Fn(&HWorkspace) -> bool {
let monitors = hyprland::data::Monitors::get().map_or(Vec::new(), |ms| ms.to_vec());
let monitors = hyprland::data::Monitors::get().map_or(Vec::new(), HyprDataVec::to_vec);
move |w| monitors.iter().any(|m| m.active_workspace.id == w.id)
}

View file

@ -198,7 +198,7 @@ impl DataControlDeviceHandler for Environment {
let token = self
.loop_handle
.insert_source(read_pipe, move |_, file, state| {
.insert_source(read_pipe, move |(), file, state| {
let item = state
.selection_offers
.iter()

View file

@ -137,7 +137,7 @@ impl Ipc {
let variable_manager = get_variable_manager();
let mut variable_manager = write_lock!(variable_manager);
match variable_manager.set(key, value) {
Ok(_) => Response::Ok,
Ok(()) => Response::Ok,
Err(err) => Response::error(&format!("{err}")),
}
}

View file

@ -205,7 +205,7 @@ impl Script {
Ok(output) => callback(output.0, output.1),
Err(err) => error!("{err:?}"),
},
ScriptMode::Watch => match self.spawn().await {
ScriptMode::Watch => match self.spawn() {
Ok(mut rx) => {
while let Some(msg) = rx.recv().await {
callback(msg, true);
@ -264,7 +264,7 @@ impl Script {
/// Spawns a long-running process.
/// Returns a `mpsc::Receiver` that sends a message
/// every time a new line is written to `stdout` or `stderr`.
pub async fn spawn(&self) -> Result<mpsc::Receiver<OutputStream>> {
pub fn spawn(&self) -> Result<mpsc::Receiver<OutputStream>> {
let mut handle = Command::new("/bin/sh")
.args(["-c", &self.cmd])
.stdout(Stdio::piped())