From 6f4ac52e4645fba53d10251e081371b90322ed59 Mon Sep 17 00:00:00 2001 From: c Date: Thu, 12 Sep 2024 14:18:40 +0200 Subject: [PATCH] fix warnings and clippy --- examples/html2term.rs | 5 ----- src/css/parser.rs | 2 +- src/markup5ever_rcdom.rs | 1 - src/render/text_renderer.rs | 2 +- src/tests.rs | 4 ++-- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/examples/html2term.rs b/examples/html2term.rs index 92e8a91..8df19bd 100644 --- a/examples/html2term.rs +++ b/examples/html2term.rs @@ -1,14 +1,9 @@ #[cfg(unix)] extern crate argparse; #[cfg(unix)] -extern crate termion; -#[cfg(unix)] extern crate unicode_width; #[cfg(unix)] mod top { - use ::html2text; - use ::std; - use ::termion; use argparse::{ArgumentParser, Store}; use html2text::render::{RichAnnotation, TaggedLine, TaggedLineElement}; use std::collections::HashMap; diff --git a/src/css/parser.rs b/src/css/parser.rs index ba3ca06..edf39e7 100644 --- a/src/css/parser.rs +++ b/src/css/parser.rs @@ -225,7 +225,7 @@ fn ident_escape(s: &str) -> IResult<&str, char> { match chars.next() { None => { // EOF: return replacement char - Ok((&rest, '\u{fffd}')) + Ok((rest, '\u{fffd}')) } Some((i, c)) if c.is_hex_digit() => { // Option 1: up to 6 hex digits. diff --git a/src/markup5ever_rcdom.rs b/src/markup5ever_rcdom.rs index 19d726a..ff8b371 100644 --- a/src/markup5ever_rcdom.rs +++ b/src/markup5ever_rcdom.rs @@ -42,7 +42,6 @@ extern crate tendril; use std::borrow::Cow; use std::cell::{Cell, RefCell}; use std::collections::{HashSet, VecDeque}; -use std::default::Default; use std::fmt; use std::io; use std::mem; diff --git a/src/render/text_renderer.rs b/src/render/text_renderer.rs index 7fa060b..74134a3 100644 --- a/src/render/text_renderer.rs +++ b/src/render/text_renderer.rs @@ -1032,7 +1032,7 @@ impl SubRenderer { let mut result = String::new(); for line in &self.lines { result += &line.to_string(); - result.push_str("\n"); + result.push('\n'); } result } diff --git a/src/tests.rs b/src/tests.rs index e00deba..ea9f481 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1128,14 +1128,14 @@ hi .take(rpt - 3) .collect::>() .concat() - + &r#"──┬──── + + r#"──┬──── hi│hi │//// │── │hi │── ──┴──── -"# + &repeat("──────────\n").take(rpt - 3).collect::(); +"# + &"──────────\n".repeat(rpt - 3); test_html(html.as_bytes(), &result, 10); }