Skip to content

Commit 8c3f259

Browse files
committed
Address clippy issues
1 parent d94c718 commit 8c3f259

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
@@ -153,7 +153,7 @@ fn main() -> Result<()> {
153153
app_start,
154154
repo_path.clone(),
155155
theme.clone(),
156-
key_config.clone(),
156+
&key_config,
157157
updater,
158158
&mut terminal,
159159
)?;
@@ -173,12 +173,11 @@ fn run_app(
173173
app_start: Instant,
174174
repo: RepoPath,
175175
theme: Theme,
176-
key_config: KeyConfig,
176+
key_config: &KeyConfig,
177177
updater: Updater,
178178
terminal: &mut Terminal,
179179
) -> Result<QuitState, anyhow::Error> {
180-
let mut gitui =
181-
Gitui::new(repo.clone(), theme, &key_config, updater)?;
180+
let mut gitui = Gitui::new(repo, theme, key_config, updater)?;
182181

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

0 commit comments

Comments
 (0)