1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-01 18:51:04 +02:00

refactor: fix a few new clippy warnings

This commit is contained in:
Jake Stanger 2023-04-22 13:45:44 +01:00
parent 9d09855fce
commit e63509a3a7
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
3 changed files with 9 additions and 10 deletions

View file

@ -59,8 +59,8 @@ impl ClipboardClient {
let iter = senders.iter(); let iter = senders.iter();
for (tx, sender_cache_size) in iter { for (tx, sender_cache_size) in iter {
if cache_size == *sender_cache_size { if cache_size == *sender_cache_size {
let mut cache = lock!(cache); // let mut cache = lock!(cache);
let removed_id = cache let removed_id = lock!(cache)
.remove_ref_first() .remove_ref_first()
.expect("Clipboard cache unexpectedly empty"); .expect("Clipboard cache unexpectedly empty");
try_send!(tx, ClipboardEvent::Remove(removed_id)); try_send!(tx, ClipboardEvent::Remove(removed_id));
@ -131,8 +131,7 @@ impl ClipboardClient {
} }
pub fn remove(&self, id: usize) { pub fn remove(&self, id: usize) {
let mut cache = lock!(self.cache); lock!(self.cache).remove(id);
cache.remove(id);
let senders = lock!(self.senders); let senders = lock!(self.senders);
let iter = senders.iter(); let iter = senders.iter();

View file

@ -60,10 +60,10 @@ async fn main() -> Result<()> {
|display| display, |display| display,
); );
let config_res = match env::var("IRONBAR_CONFIG") { let config_res = env::var("IRONBAR_CONFIG").map_or_else(
Ok(path) => ConfigLoader::load(path), |_| ConfigLoader::new("ironbar").find_and_load(),
Err(_) => ConfigLoader::new("ironbar").find_and_load(), ConfigLoader::load,
}; );
let config = match config_res { let config = match config_res {
Ok(config) => config, Ok(config) => config,

View file

@ -229,7 +229,7 @@ impl Script {
let mut args_list = vec!["-c", &self.cmd]; let mut args_list = vec!["-c", &self.cmd];
if let Some(args) = args { if let Some(args) = args {
args_list.extend(args.iter().map(|s| s.as_str())); args_list.extend(args.iter().map(String::as_str));
} }
debug!("Running sh with args: {args_list:?}"); debug!("Running sh with args: {args_list:?}");
@ -322,7 +322,7 @@ impl Script {
/// ///
pub fn run_as_oneshot(&self, args: Option<&[String]>) { pub fn run_as_oneshot(&self, args: Option<&[String]>) {
let script = self.clone(); let script = self.clone();
let args = args.map(|args| args.to_vec()); let args = args.map(<[String]>::to_vec);
spawn(async move { spawn(async move {
match script.get_output(args.as_deref()).await { match script.get_output(args.as_deref()).await {