style(fmt): remove warnings

This commit is contained in:
Aram Drevekenin 2024-10-25 11:10:19 +02:00
parent 0d40f685be
commit 13bb839100
4 changed files with 9 additions and 14 deletions

View File

@ -447,7 +447,7 @@ impl ZellijPlugin for State {
}, },
BareKey::Char('y') if key.has_modifiers(&[KeyModifier::Alt]) => { BareKey::Char('y') if key.has_modifiers(&[KeyModifier::Alt]) => {
let write_to_disk = true; let write_to_disk = true;
let mut keys_to_unbind = vec![ let keys_to_unbind = vec![
( (
InputMode::Locked, InputMode::Locked,
KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(),
@ -481,7 +481,7 @@ impl ZellijPlugin for State {
KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(),
), ),
]; ];
let mut keys_to_rebind = vec![ let keys_to_rebind = vec![
( (
InputMode::Locked, InputMode::Locked,
KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(),

View File

@ -532,12 +532,10 @@ pub fn render_screen_toggle(
let key_indication_len = key_indication_text.chars().count() + 1; let key_indication_len = key_indication_text.chars().count() + 1;
let first_ribbon_length = new_session_text.chars().count() + 4; let first_ribbon_length = new_session_text.chars().count() + 4;
let second_ribbon_length = running_sessions_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 key_indication_x = x;
let first_ribbon_x = key_indication_x + key_indication_len; let first_ribbon_x = key_indication_x + key_indication_len;
let second_ribbon_x = first_ribbon_x + first_ribbon_length; let second_ribbon_x = first_ribbon_x + first_ribbon_length;
let third_ribbon_x = second_ribbon_x + second_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 new_session_text = Text::new(new_session_text);
let mut running_sessions_text = Text::new(running_sessions_text); let mut running_sessions_text = Text::new(running_sessions_text);
let mut exited_sessions_text = Text::new(exited_sessions_text); let mut exited_sessions_text = Text::new(exited_sessions_text);

View File

@ -1,14 +1,10 @@
use ansi_term::ANSIStrings; use ansi_term::ANSIStrings;
use ansi_term::{
Color::{Fixed, RGB},
Style,
};
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use crate::{LinePart, ARROW_SEPARATOR}; use crate::{LinePart, ARROW_SEPARATOR};
use zellij_tile::prelude::actions::Action; use zellij_tile::prelude::actions::Action;
use zellij_tile::prelude::*; 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 { fn get_current_title_len(current_title: &[LinePart]) -> usize {
current_title.iter().map(|p| p.len).sum() current_title.iter().map(|p| p.len).sum()
@ -251,7 +247,6 @@ pub fn tab_line(
} else { } else {
tab_info.and_then(|tab_info| { tab_info.and_then(|tab_info| {
swap_layout_status( swap_layout_status(
cols,
&tab_info.active_swap_layout_name, &tab_info.active_swap_layout_name,
tab_info.is_swap_layout_dirty, tab_info.is_swap_layout_dirty,
mode_info, mode_info,
@ -307,7 +302,6 @@ pub fn tab_line(
} }
fn swap_layout_status( fn swap_layout_status(
cols: usize,
swap_layout_name: &Option<String>, swap_layout_name: &Option<String>,
is_swap_layout_dirty: bool, is_swap_layout_dirty: bool,
mode_info: &ModeInfo, mode_info: &ModeInfo,

View File

@ -1229,8 +1229,8 @@ impl Layout {
), ),
} }
} }
pub fn stringified_from_url(url: &str) -> Result<String, ConfigError> {
#[cfg(not(target_family = "wasm"))] #[cfg(not(target_family = "wasm"))]
pub fn stringified_from_url(url: &str) -> Result<String, ConfigError> {
let raw_layout = task::block_on(async move { let raw_layout = task::block_on(async move {
let download = Downloader::download_without_cache(url).await; let download = Downloader::download_without_cache(url).await;
match download { match download {
@ -1238,8 +1238,11 @@ impl Layout {
Err(e) => Err(ConfigError::DownloadError(format!("{}", e))), Err(e) => Err(ConfigError::DownloadError(format!("{}", e))),
} }
})?; })?;
// silently fail - this should not happen in plugins and legacy architecture is hard Ok(raw_layout)
}
#[cfg(target_family = "wasm")] #[cfg(target_family = "wasm")]
pub fn stringified_from_url(_url: &str) -> Result<String, ConfigError> {
// silently fail - this should not happen in plugins and legacy architecture is hard
let raw_layout = String::new(); let raw_layout = String::new();
Ok(raw_layout) Ok(raw_layout)
} }
@ -1284,7 +1287,7 @@ impl Layout {
Ok((layout, config)) Ok((layout, config))
} }
#[cfg(target_family = "wasm")] #[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!( Err(ConfigError::DownloadError(format!(
"Unsupported platform, cannot download layout from the web" "Unsupported platform, cannot download layout from the web"
))) )))