chore: cargo fmt

pull/9/head
wongjiahau 2 years ago
parent f5af209f09
commit afda68a11d

@ -423,7 +423,13 @@ impl Explorer {
self.render_tree(list_area, area, surface, cx) self.render_tree(list_area, area, surface, cx)
} }
fn render_tree(&mut self, area: Rect, prompt_area: Rect, surface: &mut Surface, cx: &mut Context) { fn render_tree(
&mut self,
area: Rect,
prompt_area: Rect,
surface: &mut Surface,
cx: &mut Context,
) {
let title_style = cx.editor.theme.get("ui.text"); let title_style = cx.editor.theme.get("ui.text");
let title_style = if self.is_focus() { let title_style = if self.is_focus() {
title_style.add_modifier(Modifier::BOLD) title_style.add_modifier(Modifier::BOLD)

@ -172,10 +172,7 @@ impl<T: TreeViewItem> Tree<T> {
} }
fn get_children(&self) -> Result<Vec<Tree<T>>> { fn get_children(&self) -> Result<Vec<Tree<T>>> {
Ok(vec_to_tree( Ok(vec_to_tree(self.item.get_children()?))
self.item
.get_children()?
))
} }
fn sort(&mut self) { fn sort(&mut self) {
@ -455,7 +452,6 @@ impl<T: TreeViewItem> TreeView<T> {
Ok(()) Ok(())
} }
fn move_to_first_line(&mut self) { fn move_to_first_line(&mut self) {
self.move_up(usize::MAX / 2) self.move_up(usize::MAX / 2)
} }
@ -823,7 +819,13 @@ fn render_tree<T: TreeViewItem>(
} }
impl<T: TreeViewItem + Clone> TreeView<T> { impl<T: TreeViewItem + Clone> TreeView<T> {
pub fn render(&mut self, area: Rect, prompt_area: Rect, surface: &mut Surface, cx: &mut Context) { pub fn render(
&mut self,
area: Rect,
prompt_area: Rect,
surface: &mut Surface,
cx: &mut Context,
) {
let style = cx.editor.theme.get(&self.tree_symbol_style); let style = cx.editor.theme.get(&self.tree_symbol_style);
if let Some((_, prompt)) = self.search_prompt.as_mut() { if let Some((_, prompt)) = self.search_prompt.as_mut() {
prompt.render_prompt(prompt_area, surface, cx) prompt.render_prompt(prompt_area, surface, cx)
@ -1152,12 +1154,7 @@ impl<T: TreeViewItem + Clone> TreeView<T> {
self.save_view(); self.save_view();
self.search_prompt = Some(( self.search_prompt = Some((
direction, direction,
Prompt::new( Prompt::new("search: ".into(), None, ui::completers::none, |_, _, _| {}),
"search: ".into(),
None,
ui::completers::none,
|_, _, _| {},
),
)) ))
} }
@ -1258,7 +1255,6 @@ mod test_tree_view {
Ok(vec![]) Ok(vec![])
} }
} }
} }
fn dummy_tree_view<'a>() -> TreeView<DivisibleItem<'a>> { fn dummy_tree_view<'a>() -> TreeView<DivisibleItem<'a>> {
@ -2121,7 +2117,6 @@ krabby_patty
); );
} }
#[test] #[test]
fn test_jump_backward_forward() { fn test_jump_backward_forward() {
let mut view = dummy_tree_view(); let mut view = dummy_tree_view();
@ -2250,7 +2245,6 @@ krabby_patty
None => Ok(vec![]), None => Ok(vec![]),
} }
} }
} }
pub fn render(view: &mut TreeView<StaticItem<'_>>) -> String { pub fn render(view: &mut TreeView<StaticItem<'_>>) -> String {
@ -2520,7 +2514,6 @@ krabby_patty
.trim() .trim()
); );
} }
} }
#[cfg(test)] #[cfg(test)]

Loading…
Cancel
Save