From d5a304e64593fc38b4a393b5e1fdf3fc60baf35d Mon Sep 17 00:00:00 2001 From: unspeaker Date: Tue, 4 Mar 2025 01:03:13 +0200 Subject: [PATCH] fix warnings; 27.2% cov --- edn/src/lib.rs | 3 +-- output/src/output.rs | 15 ++++++++++++--- shell.nix | 2 +- tui/src/tui_buffer.rs | 4 +++- tui/src/tui_output.rs | 4 ++-- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/edn/src/lib.rs b/edn/src/lib.rs index 10d60bb..8315cb1 100644 --- a/edn/src/lib.rs +++ b/edn/src/lib.rs @@ -9,8 +9,7 @@ pub(crate) use self::Value::*; pub(crate) use self::ParseError::*; pub(crate) use konst::iter::{ConstIntoIter, IsIteratorKind}; pub(crate) use konst::string::{split_at, str_range, char_indices}; -pub(crate) use std::error::Error; -pub(crate) use std::fmt::{Debug, Display, Formatter, Result as FormatResult}; +pub(crate) use std::fmt::Debug; /// Static iteration helper. #[macro_export] macro_rules! iterate { ($expr:expr => $arg: pat => $body:expr) => { diff --git a/output/src/output.rs b/output/src/output.rs index e993606..6dcf9f1 100644 --- a/output/src/output.rs +++ b/output/src/output.rs @@ -53,9 +53,18 @@ impl<'a, E: Output> Content for RenderBox<'a, E> { pub type RenderDyn<'a, E> = dyn Render + Send + Sync + 'a; /// You can render from an opaque pointer. impl<'a, E: Output> Content for &RenderDyn<'a, E> where Self: Sized { - fn content (&self) -> impl Render { self.deref() } - fn layout (&self, area: E::Area) -> E::Area { Render::layout(self.deref(), area) } - fn render (&self, output: &mut E) { Render::render(self.deref(), output) } + fn content (&self) -> impl Render { + #[allow(suspicious_double_ref_op)] + self.deref() + } + fn layout (&self, area: E::Area) -> E::Area { + #[allow(suspicious_double_ref_op)] + Render::layout(self.deref(), area) + } + fn render (&self, output: &mut E) { + #[allow(suspicious_double_ref_op)] + Render::render(self.deref(), output) + } } /// Composable renderable with static dispatch. pub trait Content { diff --git a/shell.nix b/shell.nix index 4087b75..a84dcd7 100644 --- a/shell.nix +++ b/shell.nix @@ -9,5 +9,5 @@ in pkgs.mkShell.override { inherit stdenv; } { - inherit name nativeBuildInputs buildInputs VST3_SDK_DIR LIBCLANG_PATH LD_LIBRARY_PATH; + inherit name nativeBuildInputs buildInputs LIBCLANG_PATH LD_LIBRARY_PATH; } diff --git a/tui/src/tui_buffer.rs b/tui/src/tui_buffer.rs index 465cc32..d229008 100644 --- a/tui/src/tui_buffer.rs +++ b/tui/src/tui_buffer.rs @@ -5,7 +5,9 @@ pub fn buffer_update (buf: &mut Buffer, area: [u16;4], callback: &impl Fn(&mut C for col in 0..area.w() { let x = area.x() + col; if x < buf.area.width && y < buf.area.height { - callback(buf.get_mut(x, y), col, row); + if let Some(cell) = buf.cell_mut(ratatui::prelude::Position { x, y }) { + callback(cell, col, row); + } } } } diff --git a/tui/src/tui_output.rs b/tui/src/tui_output.rs index 1addc18..900ca0b 100644 --- a/tui/src/tui_output.rs +++ b/tui/src/tui_output.rs @@ -35,7 +35,7 @@ impl TuiOut { if exited.fetch_and(true, Relaxed) { break } - let t0 = engine.read().unwrap().perf.get_t0(); + //let t0 = engine.read().unwrap().perf.get_t0(); let Size { width, height } = engine.read().unwrap().backend.size() .expect("get size failed"); if let Ok(state) = state.try_read() { @@ -50,7 +50,7 @@ impl TuiOut { state.render(&mut output); buffer = engine.write().unwrap().flip(output.buffer, size); } - let t1 = engine.read().unwrap().perf.get_t1(t0).unwrap(); + //let t1 = engine.read().unwrap().perf.get_t1(t0).unwrap(); //buffer.set_string(0, 0, &format!("{:>3}.{:>3}ms", t1.as_millis(), t1.as_micros() % 1000), Style::default()); std::thread::sleep(timer); })