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 8d48231 commit e250763
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions asyncgit/src/sync/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl From<git2_hooks::HookResult> for HookResult {
}

/// this hook is documented here <https://git-scm.com/docs/githooks#_commit_msg>
///
/// we use the same convention as other git clients to create a temp file containing
/// the commit message at `<.git|hooksPath>/COMMIT_EDITMSG` and pass it's relative path as the only
/// parameter to the hook script.
Expand Down
1 change: 1 addition & 0 deletions git2-hooks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ fn create_hook_in_path(path: &Path, hook_script: &[u8]) {
}

/// this hook is documented here <https://git-scm.com/docs/githooks#_commit_msg>
///
/// we use the same convention as other git clients to create a temp file containing
/// the commit message at `<.git|hooksPath>/COMMIT_EDITMSG` and pass it's relative path as the only
/// parameter to the hook script.
Expand Down
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 e250763

Please sign in to comment.