From 27d77ad638e1ab14ccfc5c1f18249386d45328a7 Mon Sep 17 00:00:00 2001 From: galister <22305755+galister@users.noreply.github.com> Date: Wed, 6 Mar 2024 18:20:56 +0100 Subject: [PATCH] clippy --- src/backend/notifications.rs | 2 +- src/backend/openvr/helpers.rs | 2 +- src/backend/openvr/manifest.rs | 2 +- src/gui/modular/button.rs | 2 +- src/gui/modular/label.rs | 2 +- src/gui/modular/mod.rs | 18 +++++++++--------- src/main.rs | 2 +- src/overlays/watch.rs | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/backend/notifications.rs b/src/backend/notifications.rs index 7bd3630..cc30f84 100644 --- a/src/backend/notifications.rs +++ b/src/backend/notifications.rs @@ -96,7 +96,7 @@ impl NotificationManager { let sender2 = self.tx_toast.clone(); let result = c.add_match(rule_with_eavesdrop, move |_: (), _, msg| { - if let Ok(toast) = parse_dbus(&msg) { + if let Ok(toast) = parse_dbus(msg) { match sender2.try_send(toast) { Ok(_) => {} Err(e) => { diff --git a/src/backend/openvr/helpers.rs b/src/backend/openvr/helpers.rs index 8cd2940..895c55b 100644 --- a/src/backend/openvr/helpers.rs +++ b/src/backend/openvr/helpers.rs @@ -101,7 +101,7 @@ impl From for BackendError { use cstr::cstr; const STEAMVR_SECTION: &CStr = cstr!("steamvr"); -const COLOR_GAIN_CSTR: [&'static CStr; 3] = [ +const COLOR_GAIN_CSTR: [&CStr; 3] = [ cstr!("hmdDisplayColorGainR"), cstr!("hmdDisplayColorGainG"), cstr!("hmdDisplayColorGainB"), diff --git a/src/backend/openvr/manifest.rs b/src/backend/openvr/manifest.rs index e2fcee1..3ff40bd 100644 --- a/src/backend/openvr/manifest.rs +++ b/src/backend/openvr/manifest.rs @@ -15,7 +15,7 @@ pub(super) fn install_manifest(app_mgr: &mut ApplicationsManager) -> anyhow::Res let executable_pathbuf = std::env::current_exe()?; let executable_path = match appimage_path { - Ok(ref path) => &path, + Ok(ref path) => path, Err(_) => executable_pathbuf .to_str() .ok_or_else(|| anyhow::anyhow!("Invalid executable path"))?, diff --git a/src/gui/modular/button.rs b/src/gui/modular/button.rs index b028cdb..dccde8b 100644 --- a/src/gui/modular/button.rs +++ b/src/gui/modular/button.rs @@ -474,7 +474,7 @@ fn run_watch(data: &WatchAction, app: &mut AppState) { app.tasks.enqueue(TaskType::Overlay( OverlaySelector::Name(WATCH_NAME.into()), Box::new(move |app, o| { - o.spawn_rotation = o.spawn_rotation * rot; + o.spawn_rotation *= rot; app.session.config.watch_rot = o.spawn_rotation.into(); o.dirty = true; }), diff --git a/src/gui/modular/label.rs b/src/gui/modular/label.rs index f5bebec..e7b03e0 100644 --- a/src/gui/modular/label.rs +++ b/src/gui/modular/label.rs @@ -92,7 +92,7 @@ pub fn modular_label_init(label: &mut ModularControl, content: &LabelContent) { child: None, }), LabelContent::Static { text } => { - label.set_text(&text); + label.set_text(text); None } }; diff --git a/src/gui/modular/mod.rs b/src/gui/modular/mod.rs index f87d7be..dd63c87 100644 --- a/src/gui/modular/mod.rs +++ b/src/gui/modular/mod.rs @@ -130,7 +130,7 @@ pub fn modular_canvas( rect: [x, y, w, h], bg_color, } => { - canvas.bg_color = color_parse(&bg_color).unwrap_or(FALLBACK_COLOR); + canvas.bg_color = color_parse(bg_color).unwrap_or(FALLBACK_COLOR); canvas.panel(*x, *y, *w, *h); } ModularElement::Label { @@ -140,9 +140,9 @@ pub fn modular_canvas( data, } => { canvas.font_size = *font_size; - canvas.fg_color = color_parse(&fg_color).unwrap_or(FALLBACK_COLOR); - let mut label = canvas.label(*x, *y, *w, *h, empty_str.clone()); - modular_label_init(&mut label, data); + canvas.fg_color = color_parse(fg_color).unwrap_or(FALLBACK_COLOR); + let label = canvas.label(*x, *y, *w, *h, empty_str.clone()); + modular_label_init(label, data); } ModularElement::Button { rect: [x, y, w, h], @@ -152,8 +152,8 @@ pub fn modular_canvas( text, data, } => { - canvas.bg_color = color_parse(&bg_color).unwrap_or(FALLBACK_COLOR); - canvas.fg_color = color_parse(&fg_color).unwrap_or(FALLBACK_COLOR); + canvas.bg_color = color_parse(bg_color).unwrap_or(FALLBACK_COLOR); + canvas.fg_color = color_parse(fg_color).unwrap_or(FALLBACK_COLOR); canvas.font_size = *font_size; let button = canvas.button(*x, *y, *w, *h, text.clone()); modular_button_init(button, data); @@ -177,7 +177,7 @@ pub fn modular_canvas( ListLayout::Vertical => (*w, *h / num_buttons), }; - let fg_color = color_parse(&fg_color).unwrap_or(FALLBACK_COLOR); + let fg_color = color_parse(fg_color).unwrap_or(FALLBACK_COLOR); canvas.font_size = *font_size; canvas.fg_color = fg_color; @@ -225,8 +225,8 @@ pub fn modular_canvas( ListLayout::Vertical => (*w, *h / num_buttons), }; - canvas.bg_color = color_parse(&bg_color).unwrap_or(FALLBACK_COLOR); - canvas.fg_color = color_parse(&fg_color).unwrap_or(FALLBACK_COLOR); + canvas.bg_color = color_parse(bg_color).unwrap_or(FALLBACK_COLOR); + canvas.fg_color = color_parse(fg_color).unwrap_or(FALLBACK_COLOR); canvas.font_size = *font_size; for screen in state.screens.iter() { diff --git a/src/main.rs b/src/main.rs index e7e755c..cba4296 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,7 +44,7 @@ fn main() -> Result<(), Box> { let args = Args::parse(); if let Some(ref log_to) = args.log_to { flexi_logger::Logger::try_with_env_or_str("info")? - .log_to_file(FileSpec::default().directory(&log_to)) + .log_to_file(FileSpec::default().directory(log_to)) .log_to_stdout() .start()?; println!("Logging to: {}", &log_to); diff --git a/src/overlays/watch.rs b/src/overlays/watch.rs index 77a2d4e..4dd3f6a 100644 --- a/src/overlays/watch.rs +++ b/src/overlays/watch.rs @@ -95,8 +95,8 @@ fn get_config_path() -> PathBuf { } pub fn save_watch(app: &mut AppState) -> anyhow::Result<()> { let conf = WatchConf { - watch_pos: app.session.config.watch_pos.clone(), - watch_rot: app.session.config.watch_rot.clone(), + watch_pos: app.session.config.watch_pos, + watch_rot: app.session.config.watch_rot, watch_hand: app.session.config.watch_hand, watch_view_angle_min: app.session.config.watch_view_angle_min, watch_view_angle_max: app.session.config.watch_view_angle_max,