diff options
author | Canop <cano.petrole@gmail.com> | 2024-08-04 08:10:44 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2024-08-04 08:10:44 +0200 |
commit | 7b2663b1c7cb70ca32def99a00b5fd5618840698 (patch) | |
tree | 92922f638a4ddbbe37dc08e3b7b455669135b9de | |
parent | b197512f8a97009971909152d35677551fe8cba9 (diff) |
version 1.41.0v1.41.0
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | Cargo.lock | 10 | ||||
-rw-r--r-- | Cargo.toml | 4 | ||||
-rw-r--r-- | bacon.toml | 1 | ||||
-rw-r--r-- | src/app/app.rs | 8 | ||||
-rw-r--r-- | src/app/app_context.rs | 4 | ||||
-rw-r--r-- | src/app/panel_state.rs | 3 | ||||
-rw-r--r-- | src/app/selection.rs | 2 | ||||
-rw-r--r-- | src/browser/browser_state.rs | 4 | ||||
-rw-r--r-- | src/command/panel_input.rs | 2 | ||||
-rw-r--r-- | src/help/help_verbs.rs | 2 | ||||
-rw-r--r-- | src/kitty/mod.rs | 2 | ||||
-rw-r--r-- | src/pattern/fuzzy_pattern.rs | 2 | ||||
-rw-r--r-- | src/preview/preview_state.rs | 8 | ||||
-rw-r--r-- | src/print.rs | 4 | ||||
-rw-r--r-- | src/stage/filtered_stage.rs | 4 | ||||
-rw-r--r-- | src/tree/tree.rs | 4 | ||||
-rw-r--r-- | src/tree_build/builder.rs | 8 |
18 files changed, 39 insertions, 37 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a36e00..f005833 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ -### next +### v1.41.0 - 2024-08-04 +<a name="v1.41.0"></a> #### Major Feature: :search_again ctrl-s now triggers `:search_again` which either - brings back the last used search pattern, when no filtering pattern is active @@ -13,6 +14,7 @@ See http://dystroy.org/broot/panels/#resize-panels - when git file infos are shown, and git ignored files aren't hidden, those files are flagged with a 'I' - Fix #916 - Remove .bak extension from content search exclusion list - Fix #915 - Update nerdfont and vscode icons - Thanks @jpaju +- `{initial-root}` verb argument ### v1.40.0 - 2024-07-16 <a name="v1.40.0"></a> @@ -210,7 +210,7 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "broot" -version = "1.40.1-dev" +version = "1.41.0" dependencies = [ "ansi_colours", "base64 0.21.7", @@ -1140,9 +1140,9 @@ dependencies = [ [[package]] name = "lazy-regex" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c" +checksum = "576c8060ecfdf2e56995cf3274b4f2d71fa5e4fa3607c1c0b63c10180ee58741" dependencies = [ "lazy-regex-proc_macros", "once_cell", @@ -1151,9 +1151,9 @@ dependencies = [ [[package]] name = "lazy-regex-proc_macros" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b" +checksum = "9efb9e65d4503df81c615dc33ff07042a9408ac7f26b45abee25566f7fbfd12c" dependencies = [ "proc-macro2", "quote", @@ -1,6 +1,6 @@ [package] name = "broot" -version = "1.40.1-dev" +version = "1.41.0" authors = ["dystroy <denys.seguret@gmail.com>"] repository = "https://github.com/Canop/broot" homepage = "https://dystroy.org/broot" @@ -41,7 +41,7 @@ glob = "0.3" id-arena = "2.2.1" image = "0.24" include_dir = "0.7" -lazy-regex = "3.1.0" +lazy-regex = "3.2" libc = "0.2" memmap2 = "0.9" once_cell = "1.18" # waiting for https://github.com/rust-lang/rust/issues/109736 @@ -46,6 +46,7 @@ command = [ "-A", "clippy::needless_range_loop", "-A", "clippy::neg_multiply", "-A", "clippy::vec_init_then_push", + "-W", "clippy::explicit_iter_loop", ] need_stdout = false diff --git a/src/app/app.rs b/src/app/app.rs index 18914a8..df1ab2c 100644 --- a/src/app/app.rs +++ b/src/app/app.rs @@ -35,7 +35,7 @@ use { }, std::{ io::Write, - path::PathBuf, + path::{Path, PathBuf}, str::FromStr, sync::{ Arc, @@ -280,7 +280,7 @@ impl App { if let Some(preview_id) = self.preview_panel { for (idx, panel) in self.panels.iter().enumerate() { if self.active_panel_idx != idx && panel.id != preview_id { - return panel.state().selected_path().map(|p| p.to_path_buf()); + return panel.state().selected_path().map(Path::to_path_buf); } } } @@ -290,7 +290,7 @@ impl App { self.panels[non_focused_panel_idx] .state() .selected_path() - .map(|p| p.to_path_buf()) + .map(Path::to_path_buf) } else { None } @@ -774,7 +774,7 @@ impl App { } fn has_pending_task(&mut self) -> bool { - self.panels.iter().any(|p| p.has_pending_task()) + self.panels.iter().any(Panel::has_pending_task) } /// This is the main loop of the application diff --git a/src/app/app_context.rs b/src/app/app_context.rs index b27e537..8508286 100644 --- a/src/app/app_context.rs +++ b/src/app/app_context.rs @@ -163,7 +163,7 @@ impl AppContext { let search_modes = config .search_modes .as_ref() - .map(|map| map.try_into()) + .map(TryInto::try_into) .transpose()? .unwrap_or_default(); let ext_colors = ExtColorMap::try_from(&config.ext_colors) @@ -248,7 +248,7 @@ impl AppContext { pub fn cmd(&self) -> Option<&str> { self.launch_args.cmd.as_ref().or( self.config_default_args.as_ref().and_then(|args| args.cmd.as_ref()) - ).map(|s| s.as_str()) + ).map(String::as_str) } pub fn initial_mode(&self) -> Mode { if self.modal { diff --git a/src/app/panel_state.rs b/src/app/panel_state.rs index 20d870b..62167a4 100644 --- a/src/app/panel_state.rs +++ b/src/app/panel_state.rs @@ -673,8 +673,7 @@ pub trait PanelState { } else { let line = input_invocation .and_then(|inv| inv.args.as_ref()) - .map(|s| s.as_str()) - .unwrap_or(""); + .map_or("", String::as_str); verb_write(con, line)?; } CmdResult::Keep diff --git a/src/app/selection.rs b/src/app/selection.rs index e81804c..51d279d 100644 --- a/src/app/selection.rs +++ b/src/app/selection.rs @@ -118,7 +118,7 @@ impl<'a> SelInfo<'a> { SelInfo::None => true, SelInfo::One(sel) => condition.accepts_path(sel.path), SelInfo::More(stage) => { - for path in stage.paths().iter() { + for path in stage.paths() { if !condition.accepts_path(path) { return false; } diff --git a/src/browser/browser_state.rs b/src/browser/browser_state.rs index bf82d7b..e87446d 100644 --- a/src/browser/browser_state.rs +++ b/src/browser/browser_state.rs @@ -396,7 +396,7 @@ impl PanelState for BrowserState { } Internal::next_dir => { self.displayed_tree_mut().try_select_next_filtered( - |line| line.is_dir(), + TreeLine::is_dir, page_height, ); CmdResult::Keep @@ -474,7 +474,7 @@ impl PanelState for BrowserState { Internal::parent => self.go_to_parent(screen, con, bang), Internal::previous_dir => { self.displayed_tree_mut().try_select_previous_filtered( - |line| line.is_dir(), + TreeLine::is_dir, page_height, ); CmdResult::Keep diff --git a/src/command/panel_input.rs b/src/command/panel_input.rs index 8c903f0..aae6793 100644 --- a/src/command/panel_input.rs +++ b/src/command/panel_input.rs @@ -285,7 +285,7 @@ impl PanelInput { sel_info: SelInfo<'_>, panel_state_type: PanelStateType, ) -> Option<&'c Verb> { - for verb in con.verb_store.verbs().iter() { + for verb in con.verb_store.verbs() { // note that there can be several verbs with the same key and // not all of them can apply if !verb.keys.contains(&key) { diff --git a/src/help/help_verbs.rs b/src/help/help_verbs.rs index 795f9f3..a557bfc 100644 --- a/src/help/help_verbs.rs +++ b/src/help/help_verbs.rs @@ -46,7 +46,7 @@ pub fn matching_verb_rows<'v>( con: &'v AppContext, ) -> Vec<MatchingVerbRow<'v>> { let mut rows = Vec::new(); - for verb in con.verb_store.verbs().iter() { + for verb in con.verb_store.verbs() { if !verb.show_in_doc { continue; } diff --git a/src/kitty/mod.rs b/src/kitty/mod.rs index 8c5360a..68172e0 100644 --- a/src/kitty/mod.rs +++ b/src/kitty/mod.rs @@ -95,7 +95,7 @@ impl KittyManager { kept_id: KittyImageId, drawing_count: usize, ) { - for image in self.rendered_images.iter_mut() { + for image in &mut self.rendered_images { if image.image_id == kept_id { image.drawing_count = drawing_count; } diff --git a/src/pattern/fuzzy_pattern.rs b/src/pattern/fuzzy_pattern.rs index 12aaec2..fafe9a0 100644 --- a/src/pattern/fuzzy_pattern.rs +++ b/src/pattern/fuzzy_pattern.rs @@ -30,7 +30,7 @@ pub struct FuzzyPattern { impl fmt::Display for FuzzyPattern { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - for &c in self.chars.iter() { + for &c in &self.chars { f.write_char(c)? } Ok(()) diff --git a/src/preview/preview_state.rs b/src/preview/preview_state.rs index eb180be..e39bcb2 100644 --- a/src/preview/preview_state.rs +++ b/src/preview/preview_state.rs @@ -20,9 +20,9 @@ use { }; /// an application state dedicated to previewing files. -/// It's usually the only state in its panel and is kept when -/// the selection changes (other panels indirectly call -/// set_selected_path). +/// +/// It's usually the only state in its panel and is kept when the +/// selection changes (other panels indirectly call `set_selected_path`). pub struct PreviewState { pub preview_area: Area, dirty: bool, // true when background must be cleared @@ -200,7 +200,7 @@ impl PanelState for PreviewState { self.pending_pattern = fp.pattern(); }; self.transform = con.preview_transformers.transform(&path, self.preferred_mode); - let preview_path = self.transform.as_ref().map(|c| &c.output_path).unwrap_or(&path); + let preview_path = self.transform.as_ref().map_or(&path, |c| &c.output_path); self.preview = Preview::new(preview_path, self.preferred_mode, con); if let Some(number) = selected_line_number { self.preview.try_select_line_number(number); diff --git a/src/print.rs b/src/print.rs index 6775401..9b31d99 100644 --- a/src/print.rs +++ b/src/print.rs @@ -32,7 +32,7 @@ pub fn print_paths(sel_info: SelInfo, con: &AppContext) -> io::Result<CmdResult> SelInfo::One(sel) => sel.path.to_string_lossy().to_string(), SelInfo::More(stage) => { let mut string = String::new(); - for path in stage.paths().iter() { + for path in stage.paths() { string.push_str(&path.to_string_lossy()); string.push('\n'); } @@ -67,7 +67,7 @@ pub fn print_relative_paths(sel_info: SelInfo, con: &AppContext) -> io::Result<C SelInfo::One(sel) => relativize_path(sel.path, con)?, SelInfo::More(stage) => { let mut string = String::new(); - for path in stage.paths().iter() { + for path in stage.paths() { string.push_str(&relativize_path(path, con)?); string.push('\n'); } diff --git a/src/stage/filtered_stage.rs b/src/stage/filtered_stage.rs index dab2ba3..3132b61 100644 --- a/src/stage/filtered_stage.rs +++ b/src/stage/filtered_stage.rs @@ -5,7 +5,7 @@ use { }, std::{ convert::TryFrom, - path::Path, + path::{Path, PathBuf}, }, }; @@ -93,7 +93,7 @@ impl FilteredStage { self.paths_idx .get(idx) .and_then(|&idx| stage.paths().get(idx)) - .map(|p| p.as_path()) + .map(PathBuf::as_path) } pub fn path_sel<'s>(&self, stage: &'s Stage, idx: usize) -> Option<(&'s Path, bool)> { self.path(stage, idx) diff --git a/src/tree/tree.rs b/src/tree/tree.rs index 94a11f9..68cb505 100644 --- a/src/tree/tree.rs +++ b/src/tree/tree.rs @@ -75,14 +75,14 @@ impl Tree { // - a node can come from a not parent node, when we followed a link let mut bid_parents: FxHashMap<BId, BId> = FxHashMap::default(); let mut bid_lines: FxHashMap<BId, &TreeLine> = FxHashMap::default(); - for line in self.lines[..].iter() { + for line in &self.lines[..] { if let Some(parent_bid) = line.parent_bid { bid_parents.insert(line.bid, parent_bid); } bid_lines.insert(line.bid, line); } let mut sort_paths: FxHashMap<BId, String> = FxHashMap::default(); - for line in self.lines[1..].iter() { + for line in &self.lines[1..] { let mut sort_path = String::new(); let mut bid = line.bid; while let Some(l) = bid_lines.get(&bid) { diff --git a/src/tree_build/builder.rs b/src/tree_build/builder.rs index 65fe9a4..c52c117 100644 --- a/src/tree_build/builder.rs +++ b/src/tree_build/builder.rs @@ -424,7 +424,7 @@ impl<'c> TreeBuilder<'c> { out_blines: &[BId], ) { let mut count = 1; - for id in out_blines[1..].iter() { + for id in &out_blines[1..] { if self.blines[*id].has_match { //debug!("bline before trimming: {:?}", &self.blines[*idx].path); count += 1; @@ -434,7 +434,7 @@ impl<'c> TreeBuilder<'c> { } } let mut remove_queue: BinaryHeap<SortableBId> = BinaryHeap::new(); - for id in out_blines[1..].iter() { + for id in &out_blines[1..] { let bline = &self.blines[*id]; if bline.has_match && bline.nb_kept_children == 0 @@ -533,7 +533,7 @@ impl<'c> TreeBuilder<'c> { out_blines: &[BId], ) -> Tree { let mut lines: Vec<TreeLine> = Vec::new(); - for id in out_blines.iter() { + for id in out_blines { if self.blines[*id].has_match { // we need to count the children, so we load them if self.blines[*id].can_enter() && self.blines[*id].children.is_none() { @@ -566,7 +566,7 @@ impl<'c> TreeBuilder<'c> { tree.git_status = ComputationResult::NotComputed; // it would make no sense to keep only files having a git status and // not display that type - for line in tree.lines.iter_mut() { + for line in &mut tree.lines { line.git_status = computer.line_status(&line.path); } } |