From 13bb839100b27192f52268589766b7f8986bba91 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Fri, 25 Oct 2024 11:10:19 +0200 Subject: [PATCH] style(fmt): remove warnings --- default-plugins/fixture-plugin-for-tests/src/main.rs | 4 ++-- default-plugins/session-manager/src/ui/components.rs | 2 -- default-plugins/tab-bar/src/line.rs | 8 +------- zellij-utils/src/input/layout.rs | 9 ++++++--- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs index 81ccc235f3..24f0f64920 100644 --- a/default-plugins/fixture-plugin-for-tests/src/main.rs +++ b/default-plugins/fixture-plugin-for-tests/src/main.rs @@ -447,7 +447,7 @@ impl ZellijPlugin for State { }, BareKey::Char('y') if key.has_modifiers(&[KeyModifier::Alt]) => { let write_to_disk = true; - let mut keys_to_unbind = vec![ + let keys_to_unbind = vec![ ( InputMode::Locked, KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), @@ -481,7 +481,7 @@ impl ZellijPlugin for State { KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), ), ]; - let mut keys_to_rebind = vec![ + let keys_to_rebind = vec![ ( InputMode::Locked, KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), diff --git a/default-plugins/session-manager/src/ui/components.rs b/default-plugins/session-manager/src/ui/components.rs index 8bc09c2406..29eba512cc 100644 --- a/default-plugins/session-manager/src/ui/components.rs +++ b/default-plugins/session-manager/src/ui/components.rs @@ -532,12 +532,10 @@ pub fn render_screen_toggle( let key_indication_len = key_indication_text.chars().count() + 1; let first_ribbon_length = new_session_text.chars().count() + 4; let second_ribbon_length = running_sessions_text.chars().count() + 4; - let third_ribbon_length = exited_sessions_text.chars().count() + 4; let key_indication_x = x; let first_ribbon_x = key_indication_x + key_indication_len; let second_ribbon_x = first_ribbon_x + first_ribbon_length; let third_ribbon_x = second_ribbon_x + second_ribbon_length; - let reset_x = third_ribbon_x + third_ribbon_length + 1; let mut new_session_text = Text::new(new_session_text); let mut running_sessions_text = Text::new(running_sessions_text); let mut exited_sessions_text = Text::new(exited_sessions_text); diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs index 9384eaf18a..d9f82698be 100644 --- a/default-plugins/tab-bar/src/line.rs +++ b/default-plugins/tab-bar/src/line.rs @@ -1,14 +1,10 @@ use ansi_term::ANSIStrings; -use ansi_term::{ - Color::{Fixed, RGB}, - Style, -}; use unicode_width::UnicodeWidthStr; use crate::{LinePart, ARROW_SEPARATOR}; use zellij_tile::prelude::actions::Action; use zellij_tile::prelude::*; -use zellij_tile_utils::{palette_match, style}; +use zellij_tile_utils::style; fn get_current_title_len(current_title: &[LinePart]) -> usize { current_title.iter().map(|p| p.len).sum() @@ -251,7 +247,6 @@ pub fn tab_line( } else { tab_info.and_then(|tab_info| { swap_layout_status( - cols, &tab_info.active_swap_layout_name, tab_info.is_swap_layout_dirty, mode_info, @@ -307,7 +302,6 @@ pub fn tab_line( } fn swap_layout_status( - cols: usize, swap_layout_name: &Option, is_swap_layout_dirty: bool, mode_info: &ModeInfo, diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index 9b97c2781b..7c91f12bfc 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -1229,8 +1229,8 @@ impl Layout { ), } } + #[cfg(not(target_family = "wasm"))] pub fn stringified_from_url(url: &str) -> Result { - #[cfg(not(target_family = "wasm"))] let raw_layout = task::block_on(async move { let download = Downloader::download_without_cache(url).await; match download { @@ -1238,8 +1238,11 @@ impl Layout { Err(e) => Err(ConfigError::DownloadError(format!("{}", e))), } })?; + Ok(raw_layout) + } + #[cfg(target_family = "wasm")] + pub fn stringified_from_url(_url: &str) -> Result { // silently fail - this should not happen in plugins and legacy architecture is hard - #[cfg(target_family = "wasm")] let raw_layout = String::new(); Ok(raw_layout) } @@ -1284,7 +1287,7 @@ impl Layout { Ok((layout, config)) } #[cfg(target_family = "wasm")] - pub fn from_url(url: &str, config: Config) -> Result<(Layout, Config), ConfigError> { + pub fn from_url(_url: &str, _config: Config) -> Result<(Layout, Config), ConfigError> { Err(ConfigError::DownloadError(format!( "Unsupported platform, cannot download layout from the web" )))