style: some cleanups (#4329)

* style: some cleanups

* style(fmt): rustfmt
This commit is contained in:
Aram Drevekenin 2025-08-01 15:17:44 +02:00 committed by GitHub
parent 549c5edb46
commit b5a893f36a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 12 additions and 44 deletions

View file

@ -378,6 +378,7 @@ impl State {
// Tooltip operations
fn toggle_persisted_tooltip(&self, new_mode: InputMode) {
#[allow(unused_variables)]
let message = self
.create_tooltip_message(MSG_TOGGLE_PERSISTED_TOOLTIP, new_mode)
.with_args(self.create_persist_args());

View file

@ -1,5 +1,6 @@
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::io::prelude::*;
use zellij_tile::prelude::*;
@ -7,6 +8,7 @@ use zellij_tile::prelude::*;
// it is not (and should not!) be included in the mainline executable
// it's included here for convenience so that it will be built by the CI
#[allow(dead_code)]
#[derive(Default)]
struct State {
received_events: Vec<Event>,

View file

@ -700,10 +700,6 @@ pub mod tests {
);
}
fn get_palette() -> Palette {
Palette::default()
}
#[test]
fn style_key_with_modifier_only_chars() {
let keyvec = vec![

View file

@ -531,10 +531,6 @@ mod tests {
string.to_string()
}
fn get_palette() -> Palette {
Palette::default()
}
#[test]
fn full_length_shortcut_with_key() {
let keyvec = vec![KeyWithModifier::new(BareKey::Char('a'))];

View file

@ -1,8 +1,8 @@
use crate::shared::{calculate_list_bounds, render_list_tip};
use crate::state::{refresh_directory, ROOT};
use crate::state::refresh_directory;
use pretty_bytes::converter::convert as pretty_bytes;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use unicode_width::UnicodeWidthStr;
use zellij_tile::prelude::*;
@ -58,17 +58,6 @@ impl FileListView {
self.cursor_hist.remove(&self.path);
}
pub fn get_relative_path(&self) -> PathBuf {
if let Some(initial_cwd_part) = self.path.iter().next() {
self.path
.strip_prefix(initial_cwd_part)
.unwrap_or(&self.path)
.to_path_buf()
} else {
PathBuf::new()
}
}
pub fn update_files(
&mut self,
paths: Vec<(PathBuf, Option<FileMetadata>)>,
@ -193,19 +182,6 @@ impl FsEntry {
}
}
pub fn get_pathbuf_without_root_prefix(&self) -> PathBuf {
match self {
FsEntry::Dir(p) => p
.strip_prefix(ROOT)
.map(|p| p.to_path_buf())
.unwrap_or_else(|_| p.clone()),
FsEntry::File(p, _) => p
.strip_prefix(ROOT)
.map(|p| p.to_path_buf())
.unwrap_or_else(|_| p.clone()),
}
}
pub fn get_full_pathbuf(&self) -> PathBuf {
match self {
FsEntry::Dir(p) => p.clone(),

View file

@ -3,7 +3,6 @@ mod search_view;
mod shared;
mod state;
use crate::file_list_view::FsEntry;
use shared::{render_current_path, render_instruction_line, render_search_term};
use state::{refresh_directory, State};
use std::collections::BTreeMap;
@ -58,7 +57,7 @@ impl ZellijPlugin for State {
self.update_files(paths);
should_render = true;
},
Event::HostFolderChanged(new_host_folder) => {
Event::HostFolderChanged(_new_host_folder) => {
scan_host_folder(&"/host");
should_render = true;
},

View file

@ -7,8 +7,6 @@ use std::{
};
use zellij_tile::prelude::*;
pub const ROOT: &str = "/host";
#[derive(Default)]
pub struct State {
pub file_list_view: FileListView,

View file

@ -59,8 +59,11 @@ pub(crate) enum ClientInstruction {
UnblockCliPipeInput(()), // String -> pipe name
CliPipeOutput((), ()), // String -> pipe name, String -> output
QueryTerminalSize,
WriteConfigToDisk { config: String },
WriteConfigToDisk {
config: String,
},
StartWebServer,
#[allow(dead_code)] // we need the session name here even though we're not currently using it
RenamedSession(String), // String -> new session name
}

View file

@ -171,6 +171,7 @@ pub fn start_web_client(
));
}
#[allow(dead_code)]
async fn listen_to_config_file_changes(config_file_path: PathBuf, instance_id: &str) {
let socket_path = WEBSERVER_SOCKET_PATH.join(instance_id);

View file

@ -1,5 +1,4 @@
use super::sixel::{PixelRect, SixelGrid, SixelImageStore};
use regex::Regex;
use std::borrow::Cow;
use std::cell::RefCell;
use std::collections::HashMap;

View file

@ -1313,8 +1313,6 @@ impl Tab {
pid,
initial_pane_title,
invoked_with,
start_suppressed,
should_focus_pane,
pane_id_to_replace,
close_replaced_pane,
client_id,
@ -1615,8 +1613,6 @@ impl Tab {
pid: PaneId,
initial_pane_title: Option<String>,
invoked_with: Option<Run>,
start_suppressed: bool,
should_focus_pane: bool,
pane_id_to_replace: Option<PaneId>,
close_replaced_pane: bool,
client_id: Option<ClientId>,

View file

@ -1,6 +1,7 @@
#[cfg(not(target_family = "wasm"))]
use crate::consts::ASSET_MAP;
use crate::input::theme::Themes;
#[allow(unused_imports)]
use crate::{
cli::{CliArgs, Command, SessionCommand, Sessions},
consts::{