diff --git a/libs/preprocessor/src/processor/defines.rs b/libs/preprocessor/src/processor/defines.rs index 6dfdd0d0..528c5e4b 100644 --- a/libs/preprocessor/src/processor/defines.rs +++ b/libs/preprocessor/src/processor/defines.rs @@ -2,7 +2,7 @@ use std::{collections::HashMap, sync::Arc}; use hemtt_workspace::{ position::Position, - reporting::{Output, Symbol, Token}, + reporting::{Code, Output, Symbol, Token}, }; use peekmore::{PeekMore, PeekMoreIterator}; @@ -238,12 +238,18 @@ impl Processor { { for token in [value.first(), value.last()] { if token.map_or(false, |t| t.symbol().is_whitespace()) { - self.warnings.push(Arc::new(PaddedArg::new( + let warning = PaddedArg::new( Box::new( (**token.expect("token exists from map_or check")).clone(), ), ident_string.clone(), - ))); + ); + + if !self.warnings.iter().any(|w| { + w.ident() == warning.ident() && w.token() == warning.token() + }) { + self.warnings.push(Arc::new(warning)); + } } } } diff --git a/libs/preprocessor/tests/warnings.rs b/libs/preprocessor/tests/warnings.rs index 300eadee..872ffdfa 100644 --- a/libs/preprocessor/tests/warnings.rs +++ b/libs/preprocessor/tests/warnings.rs @@ -35,11 +35,9 @@ fn check(dir: &str) { .unwrap(); let warning = config .warnings() - .first() - .unwrap() - .diagnostic() - .unwrap() - .to_string(&WorkspaceFiles::new()); + .iter() + .map(|w| w.diagnostic().unwrap().to_string(&WorkspaceFiles::new())) + .collect::(); if expected.is_empty() { std::fs::write(folder.join("stderr.ansi"), warning.replace('\r', "")).unwrap(); } @@ -66,3 +64,4 @@ bootstrap!(pw1_redefine); bootstrap!(pw1_redefine_stack); bootstrap!(pw3_padded_arg); bootstrap!(pw3_padded_arg_duplicates); +bootstrap!(pw3_padded_arg_inner);