Skip to content

Commit

Permalink
Address clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cruessler committed Nov 20, 2024
1 parent 65901fd commit a478e2e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
19 changes: 9 additions & 10 deletions src/gitui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{
SPINNER_INTERVAL, TICK_INTERVAL,
};

pub(crate) struct Gitui {
pub struct Gitui {
app: crate::app::App,
rx_input: Receiver<InputEvent>,
rx_git: Receiver<AsyncGitNotification>,
Expand Down Expand Up @@ -62,8 +62,7 @@ impl Gitui {
input.clone(),
theme,
key_config.clone(),
)
.unwrap();
)?;

Ok(Self {
app,
Expand Down Expand Up @@ -130,7 +129,7 @@ impl Gitui {
QueueEvent::SpinnerUpdate => unreachable!(),
}

self.draw(terminal);
self.draw(terminal)?;

spinner.set_state(self.app.any_work_pending());
spinner.draw(terminal)?;
Expand All @@ -145,10 +144,10 @@ impl Gitui {
}

fn draw<B: ratatui::backend::Backend>(
&mut self,
&self,
terminal: &mut ratatui::Terminal<B>,
) {
draw(terminal, &self.app).unwrap();
) -> std::io::Result<()> {
draw(terminal, &self.app)
}

#[cfg(test)]
Expand Down Expand Up @@ -224,7 +223,7 @@ mod tests {
let mut terminal =
Terminal::new(TestBackend::new(120, 40)).unwrap();

gitui.draw(&mut terminal);
gitui.draw(&mut terminal).unwrap();

sleep(Duration::from_millis(500));

Expand All @@ -236,7 +235,7 @@ mod tests {

sleep(Duration::from_millis(500));

gitui.draw(&mut terminal);
gitui.draw(&mut terminal).unwrap();

assert_snapshot!("app_loading_finished", terminal.backend());

Expand All @@ -250,7 +249,7 @@ mod tests {

gitui.update();

gitui.draw(&mut terminal);
gitui.draw(&mut terminal).unwrap();

assert_snapshot!(
"app_log_tab_showing_one_commit",
Expand Down
7 changes: 3 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fn main() -> Result<()> {
app_start,
repo_path.clone(),
theme.clone(),
key_config.clone(),
&key_config,
updater,
&mut terminal,
)?;
Expand All @@ -171,12 +171,11 @@ fn run_app(
app_start: Instant,
repo: RepoPath,
theme: Theme,
key_config: KeyConfig,
key_config: &KeyConfig,
updater: Updater,
terminal: &mut Terminal,
) -> Result<QuitState, anyhow::Error> {
let mut gitui =
Gitui::new(repo.clone(), theme, &key_config, updater)?;
let mut gitui = Gitui::new(repo, theme, key_config, updater)?;

log::trace!("app start: {} ms", app_start.elapsed().as_millis());

Expand Down

0 comments on commit a478e2e

Please sign in to comment.