From 66d08dadcc2911d6b658dc5984f09266904bc8ab Mon Sep 17 00:00:00 2001 From: Janis Date: Tue, 13 Aug 2024 18:55:36 +0200 Subject: [PATCH] remove lints --- src/common.rs | 1 - src/lexer.rs | 3 +++ src/lib.rs | 2 +- src/parser.rs | 12 ++++++------ src/triples.rs | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/common.rs b/src/common.rs index 21e486c..284fdd6 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,4 +1,3 @@ -#![allow(unused)] /// True if `c` is considered a whitespace according to Rust language definition. /// See [Rust language reference](https://doc.rust-lang.org/reference/whitespace.html) /// for definitions of these classes. diff --git a/src/lexer.rs b/src/lexer.rs index 8ee47e9..64fe000 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -591,6 +591,7 @@ pub enum Radix { } impl Radix { + #[allow(unused)] /// must be called with one of `['b','x','d','o']` unsafe fn from_char_unchecked(c: char) -> Self { match c.to_ascii_lowercase() { @@ -610,6 +611,8 @@ impl Radix { _ => None, } } + + #[allow(unused)] fn radix(self) -> u8 { match self { Radix::Hex => 16, diff --git a/src/lib.rs b/src/lib.rs index a86e629..cbf66d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ #![feature(extract_if, iter_advance_by, box_into_inner, hash_extract_if)] -#![allow(dead_code, unused_macros)] +#![allow(unused_macros)] pub mod ast; pub mod codegen; diff --git a/src/parser.rs b/src/parser.rs index bd92623..e97eed1 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use itertools::Itertools; use crate::{ - ast::{FloatingType, IntegralType, LetOrVar, Node, PrimitiveType, Tag, Type}, + ast::{FloatingType, IntegralType, LetOrVar, Node, PrimitiveType, Tag}, common::NextIf, lexer::{Radix, TokenIterator}, symbol_table::{SymbolKind, SymbolTable}, @@ -129,6 +129,7 @@ impl Tree { } } + #[allow(unused)] fn is_integral_type(lexeme: &str) -> Option<()> { let mut iter = lexeme.chars(); iter.next_if(|&c| c == 'u' || c == 'i')?; @@ -758,7 +759,6 @@ impl Tree { let token = tokens.peek_token_or_err()?; match token.token() { Token::Ident => { - // Ok(self.parse_ident(tokens)?) let ident = tokens.expect_token(Token::Ident)?; let decl = match self.st.find_symbol(ident.lexeme()) { @@ -898,7 +898,7 @@ impl Tree { self.get_typename_str(node).unwrap() ) } - Tag::PointerQualifier { constness } => todo!(), + Tag::PointerQualifier { .. } => todo!(), Tag::FunctionDecl { proto, body } => { self.render_node(writer, proto, indent)?; writeln_indented!( @@ -995,9 +995,9 @@ impl Tree { writeln!(writer, ");")?; Ok(()) } - Tag::CallExpr { lhs, rhs } => todo!(), - Tag::ArgumentList { parameters } => todo!(), - Tag::Argument { name, expr } => todo!(), + Tag::CallExpr { .. } => todo!(), + Tag::ArgumentList { .. } => todo!(), + Tag::Argument { .. } => todo!(), Tag::ExplicitCast { lhs, typename } => { self.render_node(writer, lhs, indent)?; writeln_indented!( diff --git a/src/triples.rs b/src/triples.rs index 59b8aca..39b2361 100644 --- a/src/triples.rs +++ b/src/triples.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -use std::{collections::HashMap, marker::PhantomData, num::NonZero}; +use std::collections::HashMap; use crate::{ ast::{FloatingType, IntegralType, Node as AstNode, PrimitiveType, Tag, Type},