Skip to content

Commit

Permalink
Refactor: Handle entry type in different method
Browse files Browse the repository at this point in the history
  • Loading branch information
allaboutevemirolive committed Oct 7, 2024
1 parent 7702271 commit 55560b5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/walk/tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,29 @@ impl<'tr, 'a> TreeCtxt<'tr, 'a> {
let mut visitor = walk::visit::Visitor::new(entry)?;
self.update_stats_and_print_info(&visitor)?;
self.update_node(idx, entries_len)?;
self.handle_entry_type(&mut visitor)?;
Ok(())
}

fn handle_entry_type(&mut self, visitor: &mut walk::visit::Visitor) -> anyhow::Result<()> {
if visitor.is_symlink() {
self.handle_symlink(&mut visitor)?;
self.handle_symlink(visitor)?;
self.nod.pop();
return Ok(());
} else if visitor.is_media_type() {
self.handle_media(&visitor)?;
self.handle_media(visitor)?;
self.nod.pop();
return Ok(());
} else if visitor.is_file() {
self.handle_file(&visitor)?;
self.handle_file(visitor)?;
self.nod.pop();
return Ok(());
} else if visitor.is_dir() {
self.handle_directory(&visitor)?;
self.handle_directory(visitor)?;
self.nod.pop();
return Ok(());
} else {
self.handle_special(&visitor)?;
self.handle_special(visitor)?;
self.nod.pop();
return Ok(());
}
Expand Down

0 comments on commit 55560b5

Please sign in to comment.