From 7b68fe6b33c341977b63d7bf4ca0282c4bc25948 Mon Sep 17 00:00:00 2001 From: itsjunetime Date: Fri, 7 Feb 2025 13:03:06 -0700 Subject: [PATCH] Remove some more dead code --- Cargo.lock | 4 ++-- Cargo.toml | 5 +---- src/main.rs | 10 ---------- src/renderer.rs | 6 +----- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2aa9949..b314918 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1967,9 +1967,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" [[package]] name = "oorandom" diff --git a/Cargo.toml b/Cargo.toml index 3db9e51..e46cb64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,8 +21,6 @@ path = "src/main.rs" name = "tdf" [dependencies] -# poppler-rs = { version = "0.24.1", default-features = false, features = ["v23_7"] } -# cairo-rs = { version = "0.20.0", default-features = false, features = ["png"] } # we're using this branch because it has significant performance fixes that I'm waiting on responses from the upstream devs to get upstreamed. See https://github.com/ratatui-org/ratatui/issues/1116 ratatui = { git = "https://github.com/itsjunetime/ratatui.git" } # ratatui = { path = "./ratatui/ratatui" } @@ -30,11 +28,10 @@ ratatui = { git = "https://github.com/itsjunetime/ratatui.git" } ratatui-image = { git = "https://github.com/itsjunetime/ratatui-image.git", branch = "vb64_on_personal", default-features = false } # ratatui-image = { path = "./ratatui-image", features = ["vb64"], default-features = false } crossterm = { version = "0.28.1", features = ["event-stream"] } -image = { version = "0.25.1", features = ["pnm", "bmp", "rayon"], default-features = false } +image = { version = "0.25.1", features = ["pnm", "rayon"], default-features = false } notify = { version = "8.0.0", features = ["crossbeam-channel"] } tokio = { version = "1.37.0", features = ["rt-multi-thread", "macros"] } futures-util = { version = "0.3.30", default-features = false } -# glib = "0.20.0" itertools = "*" flume = { version = "0.11.0", default-features = false, features = ["async"] } xflags = "0.4.0-pre.2" diff --git a/src/main.rs b/src/main.rs index d364802..1730050 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,6 @@ use crossterm::{ } }; use futures_util::{stream::StreamExt, FutureExt}; -// use glib::{LogField, LogLevel, LogWriterOutput}; use notify::{Event, EventKind, RecursiveMode, Watcher}; use ratatui::{backend::CrosstermBackend, Terminal}; use ratatui_image::picker::Picker; @@ -161,11 +160,6 @@ async fn main() -> Result<(), Box> { let mut term = Terminal::new(backend)?; term.skip_diff(true); - // poppler has some annoying logging (e.g. if you request a page index out-of-bounds of a - // document's pages, then it will return `None`, but still log to stderr with CRITICAL level), - // so we want to just ignore all logging since this is a tui app. - // glib::log_set_writer_func(noop); - execute!( term.backend_mut(), EnterAlternateScreen, @@ -286,7 +280,3 @@ fn on_notify_ev( } } } - -/*fn noop(_: LogLevel, _: &[LogField<'_>]) -> LogWriterOutput { - LogWriterOutput::Handled -}*/ diff --git a/src/renderer.rs b/src/renderer.rs index 66e0205..ce8b953 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -122,7 +122,6 @@ pub fn start_rendering( } }; - //let n_pages = doc.page_count() as usize; let n_pages = match doc.page_count() { Ok(n) => n as usize, Err(e) => { @@ -351,10 +350,7 @@ fn render_single_page_to_ctx( // then, get the size of the page let bounds = page.bounds()?; - let (p_width, p_height) = ( - f32::from(bounds.x1 - bounds.x0), - f32::from(bounds.y1 - bounds.y0) - ); + let (p_width, p_height) = (bounds.x1 - bounds.x0, bounds.y1 - bounds.y0); // and get its aspect ratio let p_aspect_ratio = p_width / p_height;