Skip to content

Commit

Permalink
remove some unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiyaa committed Jul 6, 2024
1 parent f314c73 commit 85aa8d6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 66 deletions.
5 changes: 0 additions & 5 deletions src/config/raw/app/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ use super::display::DisplayOptionRaw;
const fn default_true() -> bool {
true
}
const fn default_scroll_offset() -> usize {
6
}

#[derive(Debug, Deserialize, Clone)]
pub struct CustomCommand {
Expand All @@ -22,8 +19,6 @@ pub struct CustomCommand {

#[derive(Clone, Debug, Deserialize)]
pub struct AppConfigRaw {
#[serde(default = "default_scroll_offset")]
pub scroll_offset: usize,
#[serde(default = "default_true")]
pub use_trash: bool,
#[serde(default)]
Expand Down
4 changes: 0 additions & 4 deletions src/config/raw/app/display/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ pub struct DisplayOptionRaw {
#[serde(default)]
pub show_icons: bool,

#[serde(default = "default_true")]
pub tilde_in_titlebar: bool,

#[serde(default, rename = "sort")]
pub sort_options: SortOptionRaw,

Expand All @@ -67,7 +64,6 @@ impl std::default::Default for DisplayOptionRaw {
show_hidden: false,
show_icons: false,
sort_options: SortOptionRaw::default(),
tilde_in_titlebar: true,
line_number_style: "none".to_string(),
linemode: LineMode::default(),
}
Expand Down
57 changes: 0 additions & 57 deletions src/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,7 @@ use crate::fs::{JoshutoDirEntry, JoshutoDirList, JoshutoMetadata};

pub trait DirectoryHistory {
fn insert_entries(&mut self, entries: Vec<JoshutoDirList>);
fn create_or_soft_update(
&mut self,
path: &Path,
options: &DisplayOption,
tab_options: &TabDisplayOption,
) -> io::Result<()>;
fn create_or_reload(
&mut self,
path: &Path,
options: &DisplayOption,
tab_options: &TabDisplayOption,
) -> io::Result<()>;
fn depreciate_all_entries(&mut self);

fn depreciate_entry(&mut self, path: &Path);
}

pub type JoshutoHistory = HashMap<PathBuf, JoshutoDirList>;
Expand All @@ -38,52 +24,9 @@ impl DirectoryHistory for JoshutoHistory {
}
}

fn create_or_soft_update(
&mut self,
path: &Path,
options: &DisplayOption,
tab_options: &TabDisplayOption,
) -> io::Result<()> {
let (contains_key, need_update) = if let Some(dirlist) = self.get(path) {
(true, dirlist.need_update())
} else {
(false, true)
};
if need_update {
let dirlist = if contains_key {
create_dirlist_with_history(self, path, options, tab_options)?
} else {
JoshutoDirList::from_path(path.to_path_buf(), options, tab_options)?
};
self.insert(path.to_path_buf(), dirlist);
}
Ok(())
}

fn create_or_reload(
&mut self,
path: &Path,
options: &DisplayOption,
tab_options: &TabDisplayOption,
) -> io::Result<()> {
let dirlist = if self.contains_key(path) {
create_dirlist_with_history(self, path, options, tab_options)?
} else {
JoshutoDirList::from_path(path.to_path_buf(), options, tab_options)?
};
self.insert(path.to_path_buf(), dirlist);
Ok(())
}

fn depreciate_all_entries(&mut self) {
self.iter_mut().for_each(|(_, v)| v.depreciate());
}

fn depreciate_entry(&mut self, path: &Path) {
if let Some(v) = self.get_mut(path) {
v.depreciate();
}
}
}

fn get_index_of_value(arr: &[JoshutoDirEntry], val: &Path) -> Option<usize> {
Expand Down

0 comments on commit 85aa8d6

Please sign in to comment.