From 97fc7de6754c8b5c383d7d5e3f9e26b3bbfb08fb Mon Sep 17 00:00:00 2001 From: Anthony Rubick <68485672+AnthonyMichaelTDM@users.noreply.github.com> Date: Sun, 9 Jul 2023 20:07:09 -0700 Subject: fix: minor code cleanup and pedantic lints (#134) --- src/render/repl.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/render/repl.rs') diff --git a/src/render/repl.rs b/src/render/repl.rs index 04dee73..2bdf3b2 100644 --- a/src/render/repl.rs +++ b/src/render/repl.rs @@ -16,10 +16,11 @@ use std::{ }; use unicode_width::UnicodeWidthStr; +#[allow(clippy::module_name_repetitions)] pub fn repl_render_stream( - rx: Receiver, + rx: &Receiver, light_theme: bool, - abort: SharedAbortSignal, + abort: &SharedAbortSignal, ) -> Result<()> { enable_raw_mode()?; let mut stdout = io::stdout(); @@ -32,9 +33,9 @@ pub fn repl_render_stream( } fn repl_render_stream_inner( - rx: Receiver, + rx: &Receiver, light_theme: bool, - abort: SharedAbortSignal, + abort: &SharedAbortSignal, writer: &mut Stdout, ) -> Result<()> { let mut last_tick = Instant::now(); @@ -118,7 +119,8 @@ fn repl_render_stream_inner( } fn recover_cursor(writer: &mut Stdout, terminal_columns: u16, buffer: &str) -> Result<()> { - let buffer_rows = (buffer.width() as u16 + terminal_columns - 1) / terminal_columns; + let buffer_rows = (u16::try_from(buffer.width()).unwrap_or(u16::MAX) + terminal_columns - 1) + / terminal_columns; let (_, row) = cursor::position()?; if buffer_rows == 0 { queue!(writer, cursor::MoveTo(0, row))?; -- cgit v1.2.3