more clippy fixes

This commit is contained in:
Stephan Dilly 2021-02-23 11:33:24 +01:00
parent a11da53bda
commit 318498c8ee
3 changed files with 7 additions and 26 deletions

View file

@ -9,16 +9,12 @@ use crate::{
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::{
sync::{self, CommitId},
CWD,
};
use asyncgit::{sync, CWD};
use crossterm::event::Event;
use tui::{backend::Backend, layout::Rect, Frame};
pub struct CreateBranchComponent {
input: TextInputComponent,
commit_id: Option<CommitId>,
queue: Queue,
key_config: SharedKeyConfig,
}
@ -104,14 +100,12 @@ impl CreateBranchComponent {
&strings::create_branch_popup_msg(&key_config),
true,
),
commit_id: None,
key_config,
}
}
///
pub fn open(&mut self) -> Result<()> {
self.commit_id = None;
self.show()?;
Ok(())

View file

@ -324,7 +324,6 @@ impl DrawableComponent for FileTreeComponent {
r,
self.title.as_str(),
items.into_iter(),
None,
self.focused,
&self.theme,
);
@ -368,7 +367,6 @@ impl DrawableComponent for FileTreeComponent {
r,
self.title.as_str(),
items,
Some(select),
self.focused,
&self.theme,
);

View file

@ -18,8 +18,6 @@ where
block: Option<Block<'b>>,
/// Items to be displayed
items: L,
/// Index of the scroll position
scroll: usize,
/// Base style of the widget
style: Style,
}
@ -32,7 +30,6 @@ where
Self {
block: None,
items,
scroll: 0,
style: Style::default(),
}
}
@ -41,11 +38,6 @@ where
self.block = Some(block);
self
}
fn scroll(mut self, index: usize) -> Self {
self.scroll = index;
self
}
}
impl<'b, L> Widget for ScrollableList<'b, L>
@ -68,19 +60,16 @@ pub fn draw_list<'b, B: Backend, L>(
r: Rect,
title: &'b str,
items: L,
select: Option<usize>,
selected: bool,
theme: &SharedTheme,
) where
L: Iterator<Item = Span<'b>>,
{
let list = ScrollableList::new(items)
.block(
Block::default()
.title(Span::styled(title, theme.title(selected)))
.borders(Borders::ALL)
.border_style(theme.block(selected)),
)
.scroll(select.unwrap_or_default());
let list = ScrollableList::new(items).block(
Block::default()
.title(Span::styled(title, theme.title(selected)))
.borders(Borders::ALL)
.border_style(theme.block(selected)),
);
f.render_widget(list, r)
}