From 7e81d605800f912586ca7b5554d49ae6243239a8 Mon Sep 17 00:00:00 2001 From: slbsh Date: Thu, 1 Aug 2024 23:03:29 +0200 Subject: [PATCH] fmt: cleanup clippy errors --- src/args.rs | 2 +- src/ast.rs | 4 ++-- src/parser.rs | 2 +- src/report.rs | 6 ++---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/args.rs b/src/args.rs index 05a4c61..324a722 100644 --- a/src/args.rs +++ b/src/args.rs @@ -156,7 +156,7 @@ impl Args { out.verbs.push(Box::leak(arg.into_boxed_str()) as &str); // drain remaining args - while let Some(arg) = args.next() { + for arg in args.by_ref() { out.verbs.push(Box::leak(arg.into_boxed_str()) as &str); } } diff --git a/src/ast.rs b/src/ast.rs index 3fab7c3..c8b3387 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -3,7 +3,7 @@ use std::fmt::{Display, Formatter}; pub struct Program { pub filename: &'static str, - pub stmts: Vec>, + pub stmts: Vec, } #[derive(Debug)] @@ -23,7 +23,7 @@ pub enum ASTKind { StringLiteral(String), CharLiteral(char), - Block(Vec>), + Block(Vec), TypeAnnotation(Type, Option>), diff --git a/src/parser.rs b/src/parser.rs index 1b0d811..5a973da 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -114,7 +114,7 @@ impl<'t, 'contents> Parser<'t, 'contents> { } fn parse_block(&mut self, global: bool) -> Result { - let mut stmts = Vec::>::new(); + let mut stmts: Vec = Vec::new(); let until = if global { TokenKind::EOF } else { TokenKind::RBrace }; let start = self.current.span.clone(); diff --git a/src/report.rs b/src/report.rs index a378490..d7c68ee 100644 --- a/src/report.rs +++ b/src/report.rs @@ -217,10 +217,8 @@ impl Display for ReportFormatter<'_> { note.bright_black().italic() )?; } - } else { - if let Some(note) = &report.note { - writeln!(f, " {}", note.bright_black().italic())?; - } + } else if let Some(note) = &report.note { + writeln!(f, " {}", note.bright_black().italic())?; } }, None => {