From 524b955fa7ac92d21ec05449574ce9f0b4aca6ac Mon Sep 17 00:00:00 2001 From: Simon Laux Date: Tue, 31 Oct 2023 23:54:45 +0100 Subject: [PATCH] fix clippy --- src/parser/link_url.rs | 4 ++-- src/parser/parse_from_text/base_parsers.rs | 2 +- src/parser/parse_from_text/markdown_elements.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/parser/link_url.rs b/src/parser/link_url.rs index 678c0ce..1813111 100644 --- a/src/parser/link_url.rs +++ b/src/parser/link_url.rs @@ -167,7 +167,7 @@ enum UrlInfo<'a> { }, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum LinkParseError { Nom(I, ErrorKind), ThisIsNotPercentEncoding, @@ -188,7 +188,7 @@ fn is_reserved(char: char) -> bool { } fn is_hex_digit(c: char) -> bool { - c.is_digit(16) + c.is_ascii_digit() } fn escaped_char(input: &str) -> IResult<&str, &str, LinkParseError<&str>> { diff --git a/src/parser/parse_from_text/base_parsers.rs b/src/parser/parse_from_text/base_parsers.rs index 398f12b..9881d36 100644 --- a/src/parser/parse_from_text/base_parsers.rs +++ b/src/parser/parse_from_text/base_parsers.rs @@ -8,7 +8,7 @@ use nom::{ IResult, }; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum CustomError { NoContent, InvalidWhiteSpaceFound, diff --git a/src/parser/parse_from_text/markdown_elements.rs b/src/parser/parse_from_text/markdown_elements.rs index 2e388f6..35a9a88 100644 --- a/src/parser/parse_from_text/markdown_elements.rs +++ b/src/parser/parse_from_text/markdown_elements.rs @@ -69,7 +69,7 @@ fn code_block(input: &str) -> IResult<&str, Element, CustomError<&str>> { Element::CodeBlock { language: lang, content: content - .get(0..content.bytes().count().saturating_sub(offset)) + .get(0..content.len().saturating_sub(offset)) .into_result()?, }, ))