Skip to content

Commit a478e2e

Browse files
committed
Address clippy issues
1 parent 65901fd commit a478e2e

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/gitui.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::{
2424
SPINNER_INTERVAL, TICK_INTERVAL,
2525
};
2626

27-
pub(crate) struct Gitui {
27+
pub struct Gitui {
2828
app: crate::app::App,
2929
rx_input: Receiver<InputEvent>,
3030
rx_git: Receiver<AsyncGitNotification>,
@@ -62,8 +62,7 @@ impl Gitui {
6262
input.clone(),
6363
theme,
6464
key_config.clone(),
65-
)
66-
.unwrap();
65+
)?;
6766

6867
Ok(Self {
6968
app,
@@ -130,7 +129,7 @@ impl Gitui {
130129
QueueEvent::SpinnerUpdate => unreachable!(),
131130
}
132131

133-
self.draw(terminal);
132+
self.draw(terminal)?;
134133

135134
spinner.set_state(self.app.any_work_pending());
136135
spinner.draw(terminal)?;
@@ -145,10 +144,10 @@ impl Gitui {
145144
}
146145

147146
fn draw<B: ratatui::backend::Backend>(
148-
&mut self,
147+
&self,
149148
terminal: &mut ratatui::Terminal<B>,
150-
) {
151-
draw(terminal, &self.app).unwrap();
149+
) -> std::io::Result<()> {
150+
draw(terminal, &self.app)
152151
}
153152

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

227-
gitui.draw(&mut terminal);
226+
gitui.draw(&mut terminal).unwrap();
228227

229228
sleep(Duration::from_millis(500));
230229

@@ -236,7 +235,7 @@ mod tests {
236235

237236
sleep(Duration::from_millis(500));
238237

239-
gitui.draw(&mut terminal);
238+
gitui.draw(&mut terminal).unwrap();
240239

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

@@ -250,7 +249,7 @@ mod tests {
250249

251250
gitui.update();
252251

253-
gitui.draw(&mut terminal);
252+
gitui.draw(&mut terminal).unwrap();
254253

255254
assert_snapshot!(
256255
"app_log_tab_showing_one_commit",

src/main.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ fn main() -> Result<()> {
151151
app_start,
152152
repo_path.clone(),
153153
theme.clone(),
154-
key_config.clone(),
154+
&key_config,
155155
updater,
156156
&mut terminal,
157157
)?;
@@ -171,12 +171,11 @@ fn run_app(
171171
app_start: Instant,
172172
repo: RepoPath,
173173
theme: Theme,
174-
key_config: KeyConfig,
174+
key_config: &KeyConfig,
175175
updater: Updater,
176176
terminal: &mut Terminal,
177177
) -> Result<QuitState, anyhow::Error> {
178-
let mut gitui =
179-
Gitui::new(repo.clone(), theme, &key_config, updater)?;
178+
let mut gitui = Gitui::new(repo, theme, key_config, updater)?;
180179

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

0 commit comments

Comments
 (0)