Skip to content

Commit 9997653

Browse files
committed
Remove a few more unnecessary ratatui::Backend references
1 parent 1bd13cf commit 9997653

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/main.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,21 @@ use crossterm::{
6565
};
6666
use input::{Input, InputEvent, InputState};
6767
use keys::KeyConfig;
68-
use ratatui::{
69-
backend::{Backend, CrosstermBackend},
70-
Terminal,
71-
};
68+
use ratatui::backend::CrosstermBackend;
7269
use scopeguard::defer;
7370
use scopetime::scope_time;
7471
use spinner::Spinner;
7572
use std::{
7673
cell::RefCell,
77-
io::{self, Write},
74+
io::{self, Stdout},
7875
panic, process,
7976
time::{Duration, Instant},
8077
};
8178
use ui::style::Theme;
8279
use watcher::RepoWatcher;
8380

81+
type Terminal = ratatui::Terminal<CrosstermBackend<io::Stdout>>;
82+
8483
static TICK_INTERVAL: Duration = Duration::from_secs(5);
8584
static SPINNER_INTERVAL: Duration = Duration::from_millis(80);
8685

@@ -182,7 +181,7 @@ fn run_app(
182181
key_config: KeyConfig,
183182
input: &Input,
184183
updater: Updater,
185-
terminal: &mut Terminal<CrosstermBackend<io::Stdout>>,
184+
terminal: &mut Terminal,
186185
) -> Result<QuitState, anyhow::Error> {
187186
let (tx_git, rx_git) = unbounded();
188187
let (tx_app, rx_app) = unbounded();
@@ -301,10 +300,7 @@ fn shutdown_terminal() {
301300
}
302301
}
303302

304-
fn draw<B: Backend>(
305-
terminal: &mut Terminal<B>,
306-
app: &App,
307-
) -> io::Result<()> {
303+
fn draw(terminal: &mut Terminal, app: &App) -> io::Result<()> {
308304
if app.requires_redraw() {
309305
terminal.resize(terminal.size()?)?;
310306
}
@@ -363,9 +359,7 @@ fn select_event(
363359
Ok(ev)
364360
}
365361

366-
fn start_terminal<W: Write>(
367-
buf: W,
368-
) -> io::Result<Terminal<CrosstermBackend<W>>> {
362+
fn start_terminal(buf: Stdout) -> io::Result<Terminal> {
369363
let backend = CrosstermBackend::new(buf);
370364
let mut terminal = Terminal::new(backend)?;
371365
terminal.hide_cursor()?;

0 commit comments

Comments
 (0)