mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
more clippy fixes
This commit is contained in:
parent
a11da53bda
commit
318498c8ee
3 changed files with 7 additions and 26 deletions
|
|
@ -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(())
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue