Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simon/clippy fixes #51

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@
clippy::panic_in_result_fn,
clippy::unwrap_in_result,
clippy::unwrap_used,
// maybe we should use?
clippy::string_slice,
// additional lints
clippy::empty_loop
clippy::empty_loop,
clippy::correctness,
clippy::needless_borrow,
clippy::cast_lossless,
clippy::obfuscated_if_else,
clippy::index_refutable_slice,
clippy::panic_in_result_fn,
clippy::unwrap_in_result,
clippy::exit,
clippy::todo,
clippy::expect_used,
clippy::unimplemented,
clippy::manual_strip,
)]

extern crate nom;
Expand Down
4 changes: 2 additions & 2 deletions src/parser/link_url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ enum UrlInfo<'a> {
},
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum LinkParseError<I> {
Nom(I, ErrorKind),
ThisIsNotPercentEncoding,
Expand All @@ -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>> {
Expand Down
2 changes: 1 addition & 1 deletion src/parser/parse_from_text/base_parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use nom::{
IResult,
};

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum CustomError<I> {
NoContent,
InvalidWhiteSpaceFound,
Expand Down
2 changes: 1 addition & 1 deletion src/parser/parse_from_text/markdown_elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?,
},
))
Expand Down
Loading