Skip to content

Commit

Permalink
less horrible diff
Browse files Browse the repository at this point in the history
  • Loading branch information
edwloef committed Nov 9, 2024
1 parent a2338f9 commit ebef43e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use std::{
cell::{OnceCell, RefCell},
cmp::Ordering,
fmt::{Debug, Formatter},
ops::Deref,
path::PathBuf,
rc::Rc,
};
Expand Down Expand Up @@ -185,18 +184,13 @@ where
}

fn diff(&self, tree: &mut Tree) {
let state = tree.state.downcast_ref::<State>();
let open = tree.state.downcast_ref::<State>().open;

tree.diff_children(self.children.get().map_or_else(
|| {
if state.open {
&**self.children.get_or_init(|| self.init_children())
} else {
&[]
}
},
Deref::deref,
));
tree.diff_children(if open {
self.children.get_or_init(|| self.init_children())
} else {
&[]
});
}

fn size(&self) -> Size<Length> {
Expand Down

0 comments on commit ebef43e

Please sign in to comment.