From dfae432055de068c12b72103bdcb3ac9e9fc71f5 Mon Sep 17 00:00:00 2001 From: NotAFile Date: Thu, 3 Feb 2022 00:08:45 +0100 Subject: [PATCH] clippy fix --- src/parser/error.rs | 6 +++--- src/parser/mod.rs | 11 +---------- src/parser/tokens.rs | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/parser/error.rs b/src/parser/error.rs index f479262..7382d93 100644 --- a/src/parser/error.rs +++ b/src/parser/error.rs @@ -44,12 +44,12 @@ where } } - fn or(mut self, mut other: Self) -> Self { + fn or(self, mut other: Self) -> Self { let self_first = self.errors.first(); let other_first = other.errors.first(); match (self_first, other_first) { - (Some((is, ErrorKind::Token(s))), Some((io, ErrorKind::Token(o)))) => { - let combined_kind = ErrorKind::Tokens(vec![s.clone(), o.clone()]); + (Some((_is, ErrorKind::Token(s))), Some((io, ErrorKind::Token(o)))) => { + let combined_kind = ErrorKind::Tokens(vec![*s, *o]); other.errors[0] = (io.clone(), combined_kind); other } diff --git a/src/parser/mod.rs b/src/parser/mod.rs index f1618a0..a29cd47 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -6,15 +6,6 @@ pub mod module; pub mod proc; pub mod tokens; -use nom::{ - branch::alt, - bytes::complete::tag, - character::complete::{alpha1, alphanumeric1, multispace0}, - combinator::{map, opt, recognize}, - error::{ErrorKind, ParseError}, - multi::{many0, separated_list0}, - sequence::{delimited, pair, preceded, separated_pair, tuple}, -}; use nom_locate::LocatedSpan; // custom span type for nom_locate @@ -29,7 +20,7 @@ pub use crate::parser::declaration::{ }; pub use crate::parser::expression::{expression, Call, Expression, Operation}; pub use crate::parser::module::{module, Module, ModuleItem, PortDirection}; -use crate::parser::tokens::{token, TokenKind as tk, TokenSpan}; +use crate::parser::tokens::TokenSpan; pub fn parse(input: TokenSpan) -> IResult { module(input) diff --git a/src/parser/tokens.rs b/src/parser/tokens.rs index 43ac876..11daa64 100644 --- a/src/parser/tokens.rs +++ b/src/parser/tokens.rs @@ -133,7 +133,7 @@ impl InputPos for TokenSpan<'_> { pub fn token<'a>(kind: TokenKind) -> impl FnMut(TokenSpan<'a>) -> IResult { move |input: TokenSpan| { let next = &input.rest[0]; - let kind = kind.clone(); + let kind = kind; if next.kind == kind { let rest = TokenSpan::with_pos(&input.rest[1..], input.pos + 1); Ok((rest, next))