Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
chore(core): remove `dbg` calls and format
Elijah Potter56377c12f9c1
diff --git a/harper-core/src/linting/back_in_the_day.rs b/harper-core/src/linting/back_in_the_day.rsindex c925acfaf..3c33c8c59 100644--- a/harper-core/src/linting/back_in_the_day.rs+++ b/harper-core/src/linting/back_in_the_day.rs@@ -1,5 +1,3 @@-use itertools::Itertools;-use crate::{patterns::{ExactPhrase, OwnedPatternExt, Pattern, SequencePattern, WordSet},Lrc, Token, TokenStringExt,@@ -37,13 +35,7 @@ impl PatternLinter for BackInTheDay {}fn match_to_lint(&self, matched_tokens: &[Token], source: &[char]) -> Option<Lint> {- dbg!(matched_tokens- .iter()- .map(|t| t.to_fat(source))- .enumerate()- .collect_vec());if let Some(tail) = matched_tokens.get(8..) {- dbg!(tail.iter().map(|t| t.to_fat(source)).collect_vec());if self.exceptions.matches(tail, source) != 0 {return None;}diff --git a/harper-core/src/patterns/either_pattern.rs b/harper-core/src/patterns/either_pattern.rsindex 984751b8d..db6878d3e 100644--- a/harper-core/src/patterns/either_pattern.rs+++ b/harper-core/src/patterns/either_pattern.rs@@ -2,7 +2,7 @@ use crate::Token;use super::Pattern;-/// A pattern that returns the value of the first non-zero match in a list.+/// A pattern that returns the value of the longest match in a list.#[derive(Default)]pub struct EitherPattern {patterns: Vec<Box<dyn Pattern>>,@@ -20,14 +20,16 @@ impl EitherPattern {impl Pattern for EitherPattern {fn matches(&self, tokens: &[Token], source: &[char]) -> usize {+ let mut longest = 0;+for pattern in self.patterns.iter() {let match_len = pattern.matches(tokens, source);- if match_len > 0 {- return match_len;+ if match_len > longest {+ longest = match_len}}- 0+ longest}}