Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: allow `ExprLinter` to work on sentences as well as chunks (#2165)
Andrew Dunbar256cf92196c2
diff --git a/harper-core/src/linting/a_part.rs b/harper-core/src/linting/a_part.rsindex 6154faf4f..0e34638bf 100644--- a/harper-core/src/linting/a_part.rs+++ b/harper-core/src/linting/a_part.rs@@ -1,6 +1,7 @@use crate::expr::Expr;use crate::expr::FirstMatchOf;use crate::expr::FixedPhrase;+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -26,6 +27,8 @@ impl Default for APart {}impl ExprLinter for APart {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/addicting.rs b/harper-core/src/linting/addicting.rsindex 2ca2297a1..765ff79e7 100644--- a/harper-core/src/linting/addicting.rs+++ b/harper-core/src/linting/addicting.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{All, AnchorEnd, Expr, FirstMatchOf, LongestMatchOf, ReflexivePronoun, SequenceExpr},@@ -34,6 +35,8 @@ impl Default for Addicting {}impl ExprLinter for Addicting {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/adjective_double_degree.rs b/harper-core/src/linting/adjective_double_degree.rsindex 882122617..cb19ebefd 100644--- a/harper-core/src/linting/adjective_double_degree.rs+++ b/harper-core/src/linting/adjective_double_degree.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{CharStringExt, Token, TokenStringExt,expr::{Expr, SequenceExpr},@@ -21,6 +22,8 @@ impl Default for AdjectiveDoubleDegree {}impl ExprLinter for AdjectiveDoubleDegree {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/after_later.rs b/harper-core/src/linting/after_later.rsindex 25085da3a..20588bceb 100644--- a/harper-core/src/linting/after_later.rs+++ b/harper-core/src/linting/after_later.rs@@ -1,5 +1,6 @@use crate::Token;use crate::expr::{DurationExpr, Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::token_string_ext::TokenStringExt;@@ -41,6 +42,8 @@ impl Default for AfterLater {}impl ExprLinter for AfterLater {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/all_intents_and_purposes.rs b/harper-core/src/linting/all_intents_and_purposes.rsindex eb5c88aab..1db05a3c7 100644--- a/harper-core/src/linting/all_intents_and_purposes.rs+++ b/harper-core/src/linting/all_intents_and_purposes.rs@@ -1,6 +1,7 @@use crate::Token;use crate::char_string::CharStringExt;use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::token_string_ext::TokenStringExt;@@ -41,6 +42,8 @@ impl Default for AllIntentsAndPurposes {}impl ExprLinter for AllIntentsAndPurposes {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/allow_to.rs b/harper-core/src/linting/allow_to.rsindex f90729a68..5b18c9353 100644--- a/harper-core/src/linting/allow_to.rs+++ b/harper-core/src/linting/allow_to.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind};use crate::token::Token;use crate::token_string_ext::TokenStringExt;@@ -24,6 +25,8 @@ impl Default for AllowTo {}impl ExprLinter for AllowTo {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.exp.as_ref()}diff --git a/harper-core/src/linting/am_in_the_morning.rs b/harper-core/src/linting/am_in_the_morning.rsindex b3a2478d8..ac012d715 100644--- a/harper-core/src/linting/am_in_the_morning.rs+++ b/harper-core/src/linting/am_in_the_morning.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Span, Token, TokenStringExt,expr::{Expr, FixedPhrase, LongestMatchOf, SequenceExpr},@@ -40,6 +41,8 @@ impl Default for AmInTheMorning {}impl ExprLinter for AmInTheMorning {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/amounts_for.rs b/harper-core/src/linting/amounts_for.rsindex cc9519ac3..055b0f3fb 100644--- a/harper-core/src/linting/amounts_for.rs+++ b/harper-core/src/linting/amounts_for.rs@@ -5,6 +5,7 @@ use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt, patterns::WordSet};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct AmountsFor {expr: Box<dyn Expr>,@@ -38,6 +39,8 @@ impl Default for AmountsFor {}impl ExprLinter for AmountsFor {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/and_in.rs b/harper-core/src/linting/and_in.rsindex 09b3d30d2..90bfb8111 100644--- a/harper-core/src/linting/and_in.rs+++ b/harper-core/src/linting/and_in.rs@@ -1,5 +1,6 @@use crate::Token;use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};pub struct AndIn {@@ -15,6 +16,8 @@ impl Default for AndIn {}impl ExprLinter for AndIn {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {&*self.expr}diff --git a/harper-core/src/linting/and_the_like.rs b/harper-core/src/linting/and_the_like.rsindex 3674996b9..d33525ec3 100644--- a/harper-core/src/linting/and_the_like.rs+++ b/harper-core/src/linting/and_the_like.rs@@ -1,4 +1,5 @@use crate::expr::{All, Expr, FixedPhrase, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, LintKind, Suggestion};use crate::patterns::WordSet;use crate::token_string_ext::TokenStringExt;@@ -35,6 +36,8 @@ impl Default for AndTheLike {}impl ExprLinter for AndTheLike {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/another_thing_coming.rs b/harper-core/src/linting/another_thing_coming.rsindex feac36b36..074981777 100644--- a/harper-core/src/linting/another_thing_coming.rs+++ b/harper-core/src/linting/another_thing_coming.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,expr::{Expr, FixedPhrase, SequenceExpr},@@ -23,6 +24,8 @@ impl Default for AnotherThingComing {}impl ExprLinter for AnotherThingComing {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/another_think_coming.rs b/harper-core/src/linting/another_think_coming.rsindex cc29ed0a6..0b3e8c9ca 100644--- a/harper-core/src/linting/another_think_coming.rs+++ b/harper-core/src/linting/another_think_coming.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,expr::{Expr, FixedPhrase, SequenceExpr},@@ -23,6 +24,8 @@ impl Default for AnotherThinkComing {}impl ExprLinter for AnotherThinkComing {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/ask_no_preposition.rs b/harper-core/src/linting/ask_no_preposition.rsindex 11e88be74..c2682c72e 100644--- a/harper-core/src/linting/ask_no_preposition.rs+++ b/harper-core/src/linting/ask_no_preposition.rs@@ -1,5 +1,6 @@use crate::expr::Expr;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Span, Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -32,6 +33,8 @@ impl Default for AskNoPreposition {}impl ExprLinter for AskNoPreposition {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/avoid_curses.rs b/harper-core/src/linting/avoid_curses.rsindex 85c5cad3e..bbf8db69e 100644--- a/harper-core/src/linting/avoid_curses.rs+++ b/harper-core/src/linting/avoid_curses.rs@@ -3,6 +3,7 @@ use crate::expr::{Expr, SequenceExpr};use crate::linting::{LintKind, Suggestion};use super::{ExprLinter, Lint};+use crate::linting::expr_linter::Chunk;pub struct AvoidCurses {expr: Box<dyn Expr>,@@ -17,6 +18,8 @@ impl Default for AvoidCurses {}impl ExprLinter for AvoidCurses {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/back_in_the_day.rs b/harper-core/src/linting/back_in_the_day.rsindex dc5adc713..76511f4fd 100644--- a/harper-core/src/linting/back_in_the_day.rs+++ b/harper-core/src/linting/back_in_the_day.rs@@ -8,6 +8,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct BackInTheDay {expr: Box<dyn Expr>,@@ -34,6 +35,8 @@ impl Default for BackInTheDay {}impl ExprLinter for BackInTheDay {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/be_allowed.rs b/harper-core/src/linting/be_allowed.rsindex 24a281dcb..9cf379910 100644--- a/harper-core/src/linting/be_allowed.rs+++ b/harper-core/src/linting/be_allowed.rs@@ -1,5 +1,6 @@use std::sync::Arc;+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{Expr, ExprMap, SequenceExpr},@@ -51,6 +52,8 @@ impl Default for BeAllowed {}impl ExprLinter for BeAllowed {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/best_of_all_time.rs b/harper-core/src/linting/best_of_all_time.rsindex f872d26d3..76ef31caa 100644--- a/harper-core/src/linting/best_of_all_time.rs+++ b/harper-core/src/linting/best_of_all_time.rs@@ -3,6 +3,7 @@ use crate::expr::{Expr, SequenceExpr};use crate::patterns::WhitespacePattern;use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct BestOfAllTime {expr: Box<dyn Expr>,@@ -37,6 +38,8 @@ impl Default for BestOfAllTime {}impl ExprLinter for BestOfAllTime {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/boring_words.rs b/harper-core/src/linting/boring_words.rsindex 11e838d96..07a8ba006 100644--- a/harper-core/src/linting/boring_words.rs+++ b/harper-core/src/linting/boring_words.rs@@ -2,6 +2,7 @@ use crate::expr::{Expr, WordExprGroup};use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind};+use crate::linting::expr_linter::Chunk;pub struct BoringWords {expr: Box<dyn Expr>,@@ -24,6 +25,8 @@ impl Default for BoringWords {}impl ExprLinter for BoringWords {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/bought.rs b/harper-core/src/linting/bought.rsindex 11d0f6fb1..8b8fb750e 100644--- a/harper-core/src/linting/bought.rs+++ b/harper-core/src/linting/bought.rs@@ -2,6 +2,7 @@ use super::{ExprLinter, Lint, LintKind};use crate::Token;use crate::expr::{Expr, SequenceExpr};use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;pub struct Bought {expr: Box<dyn Expr>,@@ -24,6 +25,8 @@ impl Default for Bought {}impl ExprLinter for Bought {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/call_them.rs b/harper-core/src/linting/call_them.rsindex 16f85a282..7e3ed7cce 100644--- a/harper-core/src/linting/call_them.rs+++ b/harper-core/src/linting/call_them.rs@@ -5,6 +5,7 @@ use crate::patterns::{DerivedFrom, WordSet};use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct CallThem {expr: Box<dyn Expr>,@@ -53,6 +54,8 @@ impl Default for CallThem {}impl ExprLinter for CallThem {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/cant.rs b/harper-core/src/linting/cant.rsindex 49563b56b..21e0d5f10 100644--- a/harper-core/src/linting/cant.rs+++ b/harper-core/src/linting/cant.rs@@ -2,6 +2,7 @@ use super::{ExprLinter, Suggestion};use crate::Lint;use crate::expr::{Expr, LongestMatchOf, SequenceExpr};use crate::linting::LintKind;+use crate::linting::expr_linter::Chunk;use crate::linting::expr_linter::find_the_only_token_matching;use crate::{CharStringExt, Token};@@ -31,6 +32,8 @@ impl Default for Cant {}impl ExprLinter for Cant {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/cautionary_tale.rs b/harper-core/src/linting/cautionary_tale.rsindex 940b74cf6..db5da883c 100644--- a/harper-core/src/linting/cautionary_tale.rs+++ b/harper-core/src/linting/cautionary_tale.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{Expr, SequenceExpr},@@ -27,6 +28,8 @@ impl Default for CautionaryTale {}impl ExprLinter for CautionaryTale {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/change_tack.rs b/harper-core/src/linting/change_tack.rsindex 57af9963d..007836ea8 100644--- a/harper-core/src/linting/change_tack.rs+++ b/harper-core/src/linting/change_tack.rs@@ -1,5 +1,6 @@use crate::Token;use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::patterns::Word;@@ -33,6 +34,8 @@ impl Default for ChangeTack {}impl ExprLinter for ChangeTack {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/chock_full.rs b/harper-core/src/linting/chock_full.rsindex 11640fe7e..7edf50f3a 100644--- a/harper-core/src/linting/chock_full.rs+++ b/harper-core/src/linting/chock_full.rs@@ -4,6 +4,7 @@ use crate::expr::SpaceOrHyphen;use crate::{Token, TokenStringExt, patterns::WordSet};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ChockFull {expr: Box<dyn Expr>,@@ -23,6 +24,8 @@ impl Default for ChockFull {}impl ExprLinter for ChockFull {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/compound_nouns/compound_noun_after_det_adj.rs b/harper-core/src/linting/compound_nouns/compound_noun_after_det_adj.rsindex 7ac2f1a42..56a47d47d 100644--- a/harper-core/src/linting/compound_nouns/compound_noun_after_det_adj.rs+++ b/harper-core/src/linting/compound_nouns/compound_noun_after_det_adj.rs@@ -5,6 +5,7 @@ use crate::expr::SequenceExpr;use crate::{CharStringExt, TokenStringExt, linting::ExprLinter};use super::{Lint, LintKind, Suggestion, is_content_word, predicate};+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Token};@@ -53,6 +54,8 @@ impl Default for CompoundNounAfterDetAdj {}impl ExprLinter for CompoundNounAfterDetAdj {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/compound_nouns/compound_noun_after_possessive.rs b/harper-core/src/linting/compound_nouns/compound_noun_after_possessive.rsindex 4544032c8..a341958ad 100644--- a/harper-core/src/linting/compound_nouns/compound_noun_after_possessive.rs+++ b/harper-core/src/linting/compound_nouns/compound_noun_after_possessive.rs@@ -6,6 +6,7 @@ use crate::patterns::AnyPattern;use crate::{CharStringExt, Lrc, TokenStringExt, linting::ExprLinter};use super::{Lint, LintKind, Suggestion, is_content_word, predicate};+use crate::linting::expr_linter::Chunk;use crate::Token;@@ -52,6 +53,8 @@ impl Default for CompoundNounAfterPossessive {}impl ExprLinter for CompoundNounAfterPossessive {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/compound_nouns/compound_noun_before_aux_verb.rs b/harper-core/src/linting/compound_nouns/compound_noun_before_aux_verb.rsindex 07b0b4255..63f1ee2fb 100644--- a/harper-core/src/linting/compound_nouns/compound_noun_before_aux_verb.rs+++ b/harper-core/src/linting/compound_nouns/compound_noun_before_aux_verb.rs@@ -8,6 +8,7 @@ use crate::{CharStringExt, Lrc, TokenStringExt, linting::ExprLinter};use super::{Lint, LintKind, Suggestion, is_content_word, predicate};use crate::Token;+use crate::linting::expr_linter::Chunk;/// Two adjacent words separated by whitespace that if joined would be a valid noun.pub struct CompoundNounBeforeAuxVerb {@@ -44,6 +45,8 @@ impl Default for CompoundNounBeforeAuxVerb {}impl ExprLinter for CompoundNounBeforeAuxVerb {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/compound_subject_i.rs b/harper-core/src/linting/compound_subject_i.rsindex 36b5dfc06..ed3cc04c2 100644--- a/harper-core/src/linting/compound_subject_i.rs+++ b/harper-core/src/linting/compound_subject_i.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenKind,expr::{AnchorStart, Expr, SequenceExpr},@@ -41,6 +42,8 @@ impl Default for CompoundSubjectI {}impl ExprLinter for CompoundSubjectI {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/confident.rs b/harper-core/src/linting/confident.rsindex a689104f0..ab282967f 100644--- a/harper-core/src/linting/confident.rs+++ b/harper-core/src/linting/confident.rs@@ -1,6 +1,7 @@use crate::expr::Expr;use crate::expr::OwnedExprExt;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token, patterns::Word};use super::{ExprLinter, Lint, LintKind, Suggestion};@@ -28,6 +29,8 @@ impl Default for Confident {}impl ExprLinter for Confident {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/criteria_phenomena.rs b/harper-core/src/linting/criteria_phenomena.rsindex acc3dee10..21d390c39 100644--- a/harper-core/src/linting/criteria_phenomena.rs+++ b/harper-core/src/linting/criteria_phenomena.rs@@ -3,6 +3,7 @@ use super::expr_linter::ExprLinter;use crate::expr::Expr;use crate::expr::SequenceExpr;use crate::linting::LintKind;+use crate::linting::expr_linter::Chunk;use crate::patterns::WordSet;use crate::{Lint, Lrc, Token, TokenStringExt};@@ -33,6 +34,8 @@ impl CriteriaPhenomena {}impl ExprLinter for CriteriaPhenomena {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/dashes.rs b/harper-core/src/linting/dashes.rsindex 79799adc1..baa511e09 100644--- a/harper-core/src/linting/dashes.rs+++ b/harper-core/src/linting/dashes.rs@@ -4,6 +4,7 @@ use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;const EN_DASH: char = '–';const EM_DASH: char = '—';@@ -29,6 +30,8 @@ impl Default for Dashes {}impl ExprLinter for Dashes {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/despite_of.rs b/harper-core/src/linting/despite_of.rsindex 42fc22c54..71ce5f116 100644--- a/harper-core/src/linting/despite_of.rs+++ b/harper-core/src/linting/despite_of.rs@@ -3,6 +3,7 @@ use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct DespiteOf {expr: Box<dyn Expr>,@@ -21,6 +22,8 @@ impl Default for DespiteOf {}impl ExprLinter for DespiteOf {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/determiner_without_noun.rs b/harper-core/src/linting/determiner_without_noun.rsindex be9d00fe9..f0e6e7866 100644--- a/harper-core/src/linting/determiner_without_noun.rs+++ b/harper-core/src/linting/determiner_without_noun.rs@@ -3,6 +3,7 @@ use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct DeterminerWithoutNoun {expr: Box<dyn Expr>,@@ -22,6 +23,8 @@ impl Default for DeterminerWithoutNoun {}impl ExprLinter for DeterminerWithoutNoun {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/didnt.rs b/harper-core/src/linting/didnt.rsindex 11498e65d..c01603502 100644--- a/harper-core/src/linting/didnt.rs+++ b/harper-core/src/linting/didnt.rs@@ -1,5 +1,6 @@use crate::Token;use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};pub struct Didnt {@@ -20,6 +21,8 @@ impl Default for Didnt {}impl ExprLinter for Didnt {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/dot_initialisms.rs b/harper-core/src/linting/dot_initialisms.rsindex 2db513edb..99df487cf 100644--- a/harper-core/src/linting/dot_initialisms.rs+++ b/harper-core/src/linting/dot_initialisms.rs@@ -4,6 +4,7 @@ use crate::expr::WordExprGroup;use hashbrown::HashMap;use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt};pub struct DotInitialisms {@@ -35,6 +36,8 @@ impl Default for DotInitialisms {}impl ExprLinter for DotInitialisms {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/double_click.rs b/harper-core/src/linting/double_click.rsindex 989422521..86fb6e389 100644--- a/harper-core/src/linting/double_click.rs+++ b/harper-core/src/linting/double_click.rs@@ -1,5 +1,6 @@use std::sync::Arc;+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenKind, TokenStringExt,expr::{Expr, ExprMap, SequenceExpr},@@ -57,6 +58,8 @@ impl Default for DoubleClick {}impl ExprLinter for DoubleClick {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/double_modal.rs b/harper-core/src/linting/double_modal.rsindex 0de18528a..5926d9552 100644--- a/harper-core/src/linting/double_modal.rs+++ b/harper-core/src/linting/double_modal.rs@@ -5,6 +5,7 @@ use crate::{Token, TokenStringExt};use super::Suggestion;use super::{ExprLinter, Lint, LintKind};+use crate::linting::expr_linter::Chunk;pub struct DoubleModal {expr: Box<dyn Expr>,@@ -24,6 +25,8 @@ impl Default for DoubleModal {}impl ExprLinter for DoubleModal {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/else_possessive.rs b/harper-core/src/linting/else_possessive.rsindex 7087d24fe..94ac63ef5 100644--- a/harper-core/src/linting/else_possessive.rs+++ b/harper-core/src/linting/else_possessive.rs@@ -1,6 +1,7 @@use crate::expr::Expr;use crate::expr::OwnedExprExt;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -36,6 +37,8 @@ impl Default for ElsePossessive {}impl ExprLinter for ElsePossessive {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/everyday.rs b/harper-core/src/linting/everyday.rsindex f827c473b..f056a5563 100644--- a/harper-core/src/linting/everyday.rs+++ b/harper-core/src/linting/everyday.rs@@ -3,6 +3,7 @@ use crate::expr::All;use crate::expr::Expr;use crate::expr::LongestMatchOf;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Punctuation, Token, TokenKind, TokenStringExt, patterns::Word};pub struct Everyday {@@ -147,6 +148,8 @@ impl Default for Everyday {}impl ExprLinter for Everyday {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/expand_memory_shorthands.rs b/harper-core/src/linting/expand_memory_shorthands.rsindex 37b3bf64a..79b9b1e99 100644--- a/harper-core/src/linting/expand_memory_shorthands.rs+++ b/harper-core/src/linting/expand_memory_shorthands.rs@@ -4,6 +4,7 @@ use super::{ExprLinter, Lint, LintKind};use crate::Token;use crate::expr::{Expr, SequenceExpr, SpaceOrHyphen};use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;use crate::patterns::{ImpliesQuantity, WordSet};pub struct ExpandMemoryShorthands {@@ -74,6 +75,8 @@ impl Default for ExpandMemoryShorthands {}impl ExprLinter for ExpandMemoryShorthands {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/expand_time_shorthands.rs b/harper-core/src/linting/expand_time_shorthands.rsindex 86f25643e..96340acc0 100644--- a/harper-core/src/linting/expand_time_shorthands.rs+++ b/harper-core/src/linting/expand_time_shorthands.rs@@ -6,6 +6,7 @@ use std::sync::Arc;use super::{ExprLinter, Lint, LintKind};use crate::Token;use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;use crate::patterns::{ImpliesQuantity, WordSet};pub struct ExpandTimeShorthands {@@ -57,6 +58,8 @@ impl Default for ExpandTimeShorthands {}impl ExprLinter for ExpandTimeShorthands {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/expr_linter.rs b/harper-core/src/linting/expr_linter.rsindex 8bef30e91..549f58969 100644--- a/harper-core/src/linting/expr_linter.rs+++ b/harper-core/src/linting/expr_linter.rs@@ -5,12 +5,41 @@ use crate::{Document, LSend, Token, TokenStringExt};use super::{Lint, Linter};+pub trait DocumentIterator {+ type Unit;++ fn iter_units<'a>(document: &'a Document) -> Box<dyn Iterator<Item = &'a [Token]> + 'a>;+}++/// Process text in chunks (clauses between commas)+pub struct Chunk;+/// Process text in full sentences+pub struct Sentence;++impl DocumentIterator for Chunk {+ type Unit = Chunk;++ fn iter_units<'a>(document: &'a Document) -> Box<dyn Iterator<Item = &'a [Token]> + 'a> {+ Box::new(document.iter_chunks())+ }+}++impl DocumentIterator for Sentence {+ type Unit = Sentence;++ fn iter_units<'a>(document: &'a Document) -> Box<dyn Iterator<Item = &'a [Token]> + 'a> {+ Box::new(document.iter_sentences())+ }+}+/// A trait that searches for tokens that fulfil [`Expr`]s in a [`Document`].///-/// Makes use of [`TokenStringExt::iter_chunks`] to avoid matching across sentence or clause-/// boundaries.+/// Makes use of [`TokenStringExt::iter_chunks`] by default, or [`TokenStringExt::iter_sentences`] to process either+/// a chunk (clause) or a sentence at a time.#[blanket(derive(Box))]pub trait ExprLinter: LSend {+ type Unit: DocumentIterator;+/// A simple getter for the expression you want Harper to search for.fn expr(&self) -> &dyn Expr;/// If any portions of a [`Document`] match [`Self::expr`], they are passed through [`ExprLinter::match_to_lint`]@@ -65,16 +94,17 @@ where}}-impl<L> Linter for L+impl<L, U> Linter for Lwhere- L: ExprLinter,+ L: ExprLinter<Unit = U>,+ U: DocumentIterator,{fn lint(&mut self, document: &Document) -> Vec<Lint> {let mut lints = Vec::new();let source = document.get_source();- for chunk in document.iter_chunks() {- lints.extend(run_on_chunk(self, chunk, source));+ for unit in U::iter_units(document) {+ lints.extend(run_on_chunk(self, unit, source));}lints@@ -87,24 +117,25 @@ wherepub fn run_on_chunk<'a>(linter: &'a impl ExprLinter,- chunk: &'a [Token],+ unit: &'a [Token],source: &'a [char],) -> impl Iterator<Item = Lint> + 'a {linter.expr()- .iter_matches(chunk, source)+ .iter_matches(unit, source).filter_map(|match_span| {linter.match_to_lint_with_context(- &chunk[match_span.start..match_span.end],+ &unit[match_span.start..match_span.end],source,- Some((&chunk[..match_span.start], &chunk[match_span.end..])),+ Some((&unit[..match_span.start], &unit[match_span.end..])),)})}#[cfg(test)]-mod tests {+mod tests_context {use crate::expr::{Expr, FixedPhrase};+ use crate::linting::expr_linter::{Chunk, Sentence};use crate::linting::tests::assert_suggestion_result;use crate::linting::{ExprLinter, Suggestion};use crate::token_string_ext::TokenStringExt;@@ -123,6 +154,8 @@ mod tests {}impl ExprLinter for TestSimpleLinter {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {&*self.expr}@@ -154,6 +187,8 @@ mod tests {}impl ExprLinter for TestContextLinter {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {&*self.expr}@@ -205,6 +240,39 @@ mod tests {}}+ pub struct TestSentenceLinter {+ expr: Box<dyn Expr>,+ }++ impl Default for TestSentenceLinter {+ fn default() -> Self {+ Self {+ expr: Box::new(FixedPhrase::from_phrase("two, two")),+ }+ }+ }++ impl ExprLinter for TestSentenceLinter {+ type Unit = Sentence;++ fn expr(&self) -> &dyn Expr {+ self.expr.as_ref()+ }++ fn match_to_lint(&self, toks: &[Token], _src: &[char]) -> Option<Lint> {+ Some(Lint {+ span: toks.span()?,+ message: "sentence".to_string(),+ suggestions: vec![Suggestion::ReplaceWith(vec!['2', '&', '2'])],+ ..Default::default()+ })+ }++ fn description(&self) -> &str {+ "sentence linter"+ }+ }+#[test]fn simple_test_123() {assert_suggestion_result("one two three", TestSimpleLinter::default(), "one 2 three");@@ -219,4 +287,13 @@ mod tests {fn context_test_321() {assert_suggestion_result("three two one", TestContextLinter::default(), "three < one");}++ #[test]+ fn sentence_test_123() {+ assert_suggestion_result(+ "one, two, two, three",+ TestSentenceLinter::default(),+ "one, 2&2, three",+ );+ }}diff --git a/harper-core/src/linting/far_be_it.rs b/harper-core/src/linting/far_be_it.rsindex 9457bc327..e41060222 100644--- a/harper-core/src/linting/far_be_it.rs+++ b/harper-core/src/linting/far_be_it.rs@@ -1,5 +1,6 @@use crate::char_string::CharStringExt;use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::token::Token;@@ -25,6 +26,8 @@ impl Default for FarBeIt {}impl ExprLinter for FarBeIt {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/feel_fell.rs b/harper-core/src/linting/feel_fell.rsindex dc2b72ff0..670b391e7 100644--- a/harper-core/src/linting/feel_fell.rs+++ b/harper-core/src/linting/feel_fell.rs@@ -1,6 +1,7 @@use crate::Token;use crate::char_string::CharStringExt;use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::expr_linter::find_the_only_token_matching;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};@@ -42,6 +43,8 @@ impl Default for FeelFell {}impl ExprLinter for FeelFell {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/few_units_of_time_ago.rs b/harper-core/src/linting/few_units_of_time_ago.rsindex bcc0f6c7b..b60620750 100644--- a/harper-core/src/linting/few_units_of_time_ago.rs+++ b/harper-core/src/linting/few_units_of_time_ago.rs@@ -1,6 +1,7 @@use crate::expr::Expr;use crate::expr::SequenceExpr;use crate::expr::TimeUnitExpr;+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Token,linting::{ExprLinter, Lint, Suggestion},@@ -33,6 +34,8 @@ impl Default for FewUnitsOfTimeAgo {}impl ExprLinter for FewUnitsOfTimeAgo {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/filler_words.rs b/harper-core/src/linting/filler_words.rsindex 5d702bcb5..e59449193 100644--- a/harper-core/src/linting/filler_words.rs+++ b/harper-core/src/linting/filler_words.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Token, TokenStringExt,expr::{Expr, SequenceExpr},@@ -30,6 +31,8 @@ impl Default for FillerWords {}impl ExprLinter for FillerWords {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/find_fine.rs b/harper-core/src/linting/find_fine.rsindex 20568785b..8a3cb5190 100644--- a/harper-core/src/linting/find_fine.rs+++ b/harper-core/src/linting/find_fine.rs@@ -3,6 +3,7 @@ use crate::expr::Expr;use crate::expr::SequenceExpr;use crate::patterns::InflectionOfBe;+use super::expr_linter::Chunk;use super::{ExprLinter, Lint, LintKind, Suggestion};pub struct FindFine {@@ -23,6 +24,8 @@ impl Default for FindFine {}impl ExprLinter for FindFine {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/first_aid_kit.rs b/harper-core/src/linting/first_aid_kit.rsindex 8463938b3..7abf89e6a 100644--- a/harper-core/src/linting/first_aid_kit.rs+++ b/harper-core/src/linting/first_aid_kit.rs@@ -1,5 +1,6 @@use crate::expr::Expr;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -24,6 +25,8 @@ impl Default for FirstAidKit {}impl ExprLinter for FirstAidKit {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/for_noun.rs b/harper-core/src/linting/for_noun.rsindex 665f1e6db..fe1248c8c 100644--- a/harper-core/src/linting/for_noun.rs+++ b/harper-core/src/linting/for_noun.rs@@ -7,6 +7,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ForNoun {expr: Box<dyn Expr>,@@ -25,6 +26,8 @@ impl Default for ForNoun {}impl ExprLinter for ForNoun {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/free_predicate.rs b/harper-core/src/linting/free_predicate.rsindex b1c2b3b28..b0819f77b 100644--- a/harper-core/src/linting/free_predicate.rs+++ b/harper-core/src/linting/free_predicate.rs@@ -7,6 +7,7 @@ use crate::expr::{Expr, ExprMap, SequenceExpr};use crate::patterns::WhitespacePattern;use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct FreePredicate {expr: Box<dyn Expr>,@@ -47,6 +48,8 @@ impl Default for FreePredicate {}impl ExprLinter for FreePredicate {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/friend_of_me.rs b/harper-core/src/linting/friend_of_me.rsindex ce9a99c7d..a446a9654 100644--- a/harper-core/src/linting/friend_of_me.rs+++ b/harper-core/src/linting/friend_of_me.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{Expr, SequenceExpr},@@ -23,6 +24,8 @@ impl Default for FriendOfMe {}impl ExprLinter for FriendOfMe {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/go_so_far_as_to.rs b/harper-core/src/linting/go_so_far_as_to.rsindex 2da11708a..661a39662 100644--- a/harper-core/src/linting/go_so_far_as_to.rs+++ b/harper-core/src/linting/go_so_far_as_to.rs@@ -2,6 +2,7 @@ use crate::Token;use crate::TokenStringExt;use crate::expr::{Expr, SequenceExpr};use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind};pub struct GoSoFarAsTo {@@ -22,6 +23,8 @@ impl Default for GoSoFarAsTo {}impl ExprLinter for GoSoFarAsTo {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.exp.as_ref()}diff --git a/harper-core/src/linting/have_pronoun.rs b/harper-core/src/linting/have_pronoun.rsindex 19ac29e09..93f48ba79 100644--- a/harper-core/src/linting/have_pronoun.rs+++ b/harper-core/src/linting/have_pronoun.rs@@ -2,6 +2,7 @@ use crate::expr::{AnchorStart, Expr, SequenceExpr};use crate::{Token, TokenKind};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct HavePronoun {expr: Box<dyn Expr>,@@ -25,6 +26,8 @@ impl Default for HavePronoun {}impl ExprLinter for HavePronoun {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/have_take_a_look.rs b/harper-core/src/linting/have_take_a_look.rsindex ca3694de5..da31ebf55 100644--- a/harper-core/src/linting/have_take_a_look.rs+++ b/harper-core/src/linting/have_take_a_look.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Dialect, Token,expr::{Expr, FixedPhrase, SequenceExpr},@@ -31,6 +32,8 @@ impl HaveTakeALook {}impl ExprLinter for HaveTakeALook {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/hedging.rs b/harper-core/src/linting/hedging.rsindex 2acadc15a..6b0c30945 100644--- a/harper-core/src/linting/hedging.rs+++ b/harper-core/src/linting/hedging.rs@@ -1,6 +1,7 @@use crate::expr::Expr;use crate::expr::FirstMatchOf;use crate::expr::FixedPhrase;+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind};use crate::{Token, TokenStringExt};@@ -24,6 +25,8 @@ impl Default for Hedging {}impl ExprLinter for Hedging {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/hello_greeting.rs b/harper-core/src/linting/hello_greeting.rsindex f4ea6f22e..9323b49aa 100644--- a/harper-core/src/linting/hello_greeting.rs+++ b/harper-core/src/linting/hello_greeting.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{AnchorStart, Expr, SequenceExpr},@@ -27,6 +28,8 @@ impl Default for HelloGreeting {}impl ExprLinter for HelloGreeting {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/hereby.rs b/harper-core/src/linting/hereby.rsindex 305814517..6db78d314 100644--- a/harper-core/src/linting/hereby.rs+++ b/harper-core/src/linting/hereby.rs@@ -3,6 +3,7 @@ use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct Hereby {expr: Box<dyn Expr>,@@ -23,6 +24,8 @@ impl Default for Hereby {}impl ExprLinter for Hereby {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/hop_hope/to_hop.rs b/harper-core/src/linting/hop_hope/to_hop.rsindex 66360562d..182ac3b7c 100644--- a/harper-core/src/linting/hop_hope/to_hop.rs+++ b/harper-core/src/linting/hop_hope/to_hop.rs@@ -2,6 +2,7 @@ use super::super::{ExprLinter, Lint, LintKind};use crate::expr::Expr;use crate::expr::SequenceExpr;use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;use crate::patterns::WordSet;use crate::{CharString, CharStringExt};use crate::{Token, char_string::char_string};@@ -39,6 +40,8 @@ impl ToHop {}impl ExprLinter for ToHop {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/hop_hope/to_hope.rs b/harper-core/src/linting/hop_hope/to_hope.rsindex 7f61a485f..e49794c80 100644--- a/harper-core/src/linting/hop_hope/to_hope.rs+++ b/harper-core/src/linting/hop_hope/to_hope.rs@@ -2,6 +2,7 @@ use super::super::{ExprLinter, Lint, LintKind};use crate::expr::Expr;use crate::expr::SequenceExpr;use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;use crate::patterns::WordSet;use crate::{Token, char_string::char_string};@@ -25,6 +26,8 @@ impl Default for ToHope {}impl ExprLinter for ToHope {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/hope_youre.rs b/harper-core/src/linting/hope_youre.rsindex ec6241048..6d33031b9 100644--- a/harper-core/src/linting/hope_youre.rs+++ b/harper-core/src/linting/hope_youre.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::SequenceExpr,@@ -31,6 +32,8 @@ impl Default for HopeYoure {}impl ExprLinter for HopeYoure {+ type Unit = Chunk;+fn expr(&self) -> &dyn crate::expr::Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/how_to.rs b/harper-core/src/linting/how_to.rsindex 9ecc07d60..a7c930bce 100644--- a/harper-core/src/linting/how_to.rs+++ b/harper-core/src/linting/how_to.rs@@ -1,5 +1,6 @@use harper_brill::UPOS;+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenKind, TokenStringExt,expr::{All, Expr, OwnedExprExt, SequenceExpr},@@ -49,6 +50,8 @@ impl Default for HowTo {}impl ExprLinter for HowTo {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/hyphenate_number_day.rs b/harper-core/src/linting/hyphenate_number_day.rsindex 6107fee29..f10124924 100644--- a/harper-core/src/linting/hyphenate_number_day.rs+++ b/harper-core/src/linting/hyphenate_number_day.rs@@ -3,6 +3,7 @@ use crate::expr::SequenceExpr;use crate::{Token, patterns::NominalPhrase};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct HyphenateNumberDay {expr: Box<dyn Expr>,@@ -36,6 +37,8 @@ impl Default for HyphenateNumberDay {}impl ExprLinter for HyphenateNumberDay {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/i_am_agreement.rs b/harper-core/src/linting/i_am_agreement.rsindex a2e40e9df..d766f17da 100644--- a/harper-core/src/linting/i_am_agreement.rs+++ b/harper-core/src/linting/i_am_agreement.rs@@ -1,8 +1,10 @@+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Token, TokenStringExt,expr::{AnchorStart, Expr, FirstMatchOf, FixedPhrase, SequenceExpr},linting::{ExprLinter, Lint, LintKind, Suggestion},};+pub struct IAmAgreement {expr: Box<dyn Expr>,}@@ -34,6 +36,8 @@ impl Default for IAmAgreement {}impl ExprLinter for IAmAgreement {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/if_wouldve.rs b/harper-core/src/linting/if_wouldve.rsindex 7e22e0d6b..e65b50e7c 100644--- a/harper-core/src/linting/if_wouldve.rs+++ b/harper-core/src/linting/if_wouldve.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, LintKind, Suggestion};use crate::patterns::{NominalPhrase, WordSet};use crate::token_string_ext::TokenStringExt;@@ -33,6 +34,8 @@ impl Default for IfWouldve {}impl ExprLinter for IfWouldve {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/in_on_the_cards.rs b/harper-core/src/linting/in_on_the_cards.rsindex 5efdf76dd..c0b42a707 100644--- a/harper-core/src/linting/in_on_the_cards.rs+++ b/harper-core/src/linting/in_on_the_cards.rs@@ -6,6 +6,7 @@ use crate::{};use super::{ExprLinter, Lint};+use crate::linting::expr_linter::Chunk;pub struct InOnTheCards {expr: Box<dyn Expr>,@@ -41,6 +42,8 @@ impl InOnTheCards {}impl ExprLinter for InOnTheCards {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/initialism_linter.rs b/harper-core/src/linting/initialism_linter.rsindex 270201215..2f34880b1 100644--- a/harper-core/src/linting/initialism_linter.rs+++ b/harper-core/src/linting/initialism_linter.rs@@ -4,6 +4,7 @@ use itertools::Itertools;use crate::{Token, patterns::Word};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;/// A struct that can be composed to expand initialisms, respecting the capitalization of each/// item.@@ -29,6 +30,8 @@ impl InitialismLinter {}impl ExprLinter for InitialismLinter {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/initialisms.rs b/harper-core/src/linting/initialisms.rsindex 76fb73d87..23106af94 100644--- a/harper-core/src/linting/initialisms.rs+++ b/harper-core/src/linting/initialisms.rs@@ -8,7 +8,7 @@ pub fn lint_group() -> LintGroup {macro_rules! add_initialism_mappings {($group:expr, { $($name:expr => ($initialism:expr, $expanded:expr)),+ $(,)? }) => {$(- $group.add_expr_linter(+ $group.add_chunk_expr_linter($name,Box::new(InitialismLinter::new($initialism, $expanded)),);diff --git a/harper-core/src/linting/interested_in.rs b/harper-core/src/linting/interested_in.rsindex 1666a97d7..5aeb1e67a 100644--- a/harper-core/src/linting/interested_in.rs+++ b/harper-core/src/linting/interested_in.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{CharStringExt, Token, TokenKind,expr::{Expr, SequenceExpr},@@ -25,6 +26,8 @@ impl Default for InterestedIn {}impl ExprLinter for InterestedIn {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/it_is.rs b/harper-core/src/linting/it_is.rsindex 810eadf8c..8afa28c88 100644--- a/harper-core/src/linting/it_is.rs+++ b/harper-core/src/linting/it_is.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenKind,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -51,6 +52,8 @@ impl Default for ItIs {}impl ExprLinter for ItIs {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/it_looks_like_that.rs b/harper-core/src/linting/it_looks_like_that.rsindex d4057e740..2e28691a6 100644--- a/harper-core/src/linting/it_looks_like_that.rs+++ b/harper-core/src/linting/it_looks_like_that.rs@@ -1,5 +1,6 @@use crate::Token;use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::token_string_ext::TokenStringExt;@@ -43,6 +44,8 @@ impl Default for ItLooksLikeThat {}impl ExprLinter for ItLooksLikeThat {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/it_would_be.rs b/harper-core/src/linting/it_would_be.rsindex 9808eff0b..7a9a198e3 100644--- a/harper-core/src/linting/it_would_be.rs+++ b/harper-core/src/linting/it_would_be.rs@@ -1,6 +1,7 @@use crate::expr::Expr;use crate::expr::OwnedExprExt;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -64,6 +65,8 @@ impl Default for ItWouldBe {}impl ExprLinter for ItWouldBe {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/its_possessive.rs b/harper-core/src/linting/its_possessive.rsindex 34d209d20..5aa90fb44 100644--- a/harper-core/src/linting/its_possessive.rs+++ b/harper-core/src/linting/its_possessive.rs@@ -12,6 +12,7 @@ use crate::patterns::UPOSSet;use crate::patterns::WordSet;use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ItsPossessive {expr: Box<dyn Expr>,@@ -73,6 +74,8 @@ impl Default for ItsPossessive {}impl ExprLinter for ItsPossessive {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/left_right_hand.rs b/harper-core/src/linting/left_right_hand.rsindex 52ec805f2..006e9dd48 100644--- a/harper-core/src/linting/left_right_hand.rs+++ b/harper-core/src/linting/left_right_hand.rs@@ -3,6 +3,7 @@ use crate::expr::SequenceExpr;use crate::{Token, patterns::WordSet};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct LeftRightHand {expr: Box<dyn Expr>,@@ -24,6 +25,8 @@ impl Default for LeftRightHand {}impl ExprLinter for LeftRightHand {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/less_worse.rs b/harper-core/src/linting/less_worse.rsindex 33f1b4607..355323c22 100644--- a/harper-core/src/linting/less_worse.rs+++ b/harper-core/src/linting/less_worse.rs@@ -3,6 +3,7 @@ use crate::patterns::WordSet;use crate::{CharStringExt, Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct LessWorse {expr: Box<dyn Expr>,@@ -22,6 +23,8 @@ impl Default for LessWorse {}impl ExprLinter for LessWorse {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/let_to_do.rs b/harper-core/src/linting/let_to_do.rsindex 646ee5fef..53e927cfc 100644--- a/harper-core/src/linting/let_to_do.rs+++ b/harper-core/src/linting/let_to_do.rs@@ -4,6 +4,7 @@ use crate::linting::{LintKind, Suggestion};use crate::token_string_ext::TokenStringExt;use super::{ExprLinter, Lint};+use crate::linting::expr_linter::Chunk;pub struct LetToDo {expr: Box<dyn Expr>,@@ -47,6 +48,8 @@ impl Default for LetToDo {}impl ExprLinter for LetToDo {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/lets_confusion/let_us_redundancy.rs b/harper-core/src/linting/lets_confusion/let_us_redundancy.rsindex 5b6157b2a..6a1a7c7bf 100644--- a/harper-core/src/linting/lets_confusion/let_us_redundancy.rs+++ b/harper-core/src/linting/lets_confusion/let_us_redundancy.rs@@ -2,6 +2,7 @@ use crate::expr::Expr;use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};/// See also:@@ -24,6 +25,8 @@ impl Default for LetUsRedundancy {}impl ExprLinter for LetUsRedundancy {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/lets_confusion/no_contraction_with_verb.rs b/harper-core/src/linting/lets_confusion/no_contraction_with_verb.rsindex eda163bb8..fe60e45fa 100644--- a/harper-core/src/linting/lets_confusion/no_contraction_with_verb.rs+++ b/harper-core/src/linting/lets_confusion/no_contraction_with_verb.rs@@ -9,6 +9,7 @@ use crate::{};use crate::linting::ExprLinter;+use crate::linting::expr_linter::Chunk;/// See also:/// harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs@@ -57,6 +58,8 @@ impl Default for NoContractionWithVerb {}impl ExprLinter for NoContractionWithVerb {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/likewise.rs b/harper-core/src/linting/likewise.rsindex 024e54501..49a1ba447 100644--- a/harper-core/src/linting/likewise.rs+++ b/harper-core/src/linting/likewise.rs@@ -4,6 +4,7 @@ use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct Likewise {expr: Box<dyn Expr>,@@ -30,6 +31,8 @@ impl Default for Likewise {}}impl ExprLinter for Likewise {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rsindex 08c7b1d64..986171301 100644--- a/harper-core/src/linting/lint_group.rs+++ b/harper-core/src/linting/lint_group.rs@@ -182,6 +182,7 @@ use super::would_never_have::WouldNeverHave;use super::{CurrencyPlacement, HtmlDescriptionLinter, Linter, NoOxfordComma, OxfordComma};use super::{ExprLinter, Lint};use crate::linting::dashes::Dashes;+use crate::linting::expr_linter::Chunk;use crate::linting::open_compounds::OpenCompounds;use crate::linting::{MassPlurals, NounVerbConfusion, closed_compounds, initialisms, phrase_corrections,@@ -308,7 +309,7 @@ pub struct LintGroup {/// We use a binary map here so the ordering is stable.linters: BTreeMap<String, Box<dyn Linter>>,/// We use a binary map here so the ordering is stable.- expr_linters: BTreeMap<String, Box<dyn ExprLinter>>,+ chunk_expr_linters: BTreeMap<String, Box<dyn ExprLinter<Unit = Chunk>>>,/// Since [`ExprLinter`]s operate on a chunk-basis, we can store a/// mapping of `Chunk -> Lint` and only re-run the expr linters/// when a chunk changes.@@ -324,7 +325,7 @@ impl LintGroup {Self {config: LintGroupConfig::default(),linters: BTreeMap::new(),- expr_linters: BTreeMap::new(),+ chunk_expr_linters: BTreeMap::new(),chunk_expr_cache: LruCache::new(NonZero::new(1000).unwrap()),hasher_builder: RandomState::default(),}@@ -332,7 +333,8 @@ impl LintGroup {/// Check if the group already contains a linter with a given name.pub fn contains_key(&self, name: impl AsRef<str>) -> bool {- self.linters.contains_key(name.as_ref()) || self.expr_linters.contains_key(name.as_ref())+ self.linters.contains_key(name.as_ref())+ || self.chunk_expr_linters.contains_key(name.as_ref())}/// Add a [`Linter`] to the group, returning whether the operation was successful.@@ -347,21 +349,22 @@ impl LintGroup {}}- /// Add a [`ExprLinter`] to the group, returning whether the operation was successful.+ /// Add a chunk-based [`ExprLinter`] to the group, returning whether the operation was successful./// If it returns `false`, it is because a linter with that key already existed in the group.////// This function is not significantly different from [`Self::add`], but allows us to take- /// advantage of some properties of [`ExprLinter`]s for cache optimization.- pub fn add_expr_linter(+ /// advantage of some properties of chunk-based [`ExprLinter`]s for cache optimization.+ pub fn add_chunk_expr_linter(&mut self,name: impl AsRef<str>,- linter: impl ExprLinter + 'static,+ // linter: impl ExprLinter + 'static,+ linter: impl ExprLinter<Unit = Chunk> + 'static,) -> bool {if self.contains_key(&name) {false} else {- self.expr_linters- .insert(name.as_ref().to_string(), Box::new(linter));+ self.chunk_expr_linters+ .insert(name.as_ref().to_string(), Box::new(linter) as _);true}}@@ -374,14 +377,14 @@ impl LintGroup {let other_linters = std::mem::take(&mut other.linters);self.linters.extend(other_linters);- let other_expr_linters = std::mem::take(&mut other.expr_linters);- self.expr_linters.extend(other_expr_linters);+ let other_expr_linters = std::mem::take(&mut other.chunk_expr_linters);+ self.chunk_expr_linters.extend(other_expr_linters);}pub fn iter_keys(&self) -> impl Iterator<Item = &str> {self.linters.keys()- .chain(self.expr_linters.keys())+ .chain(self.chunk_expr_linters.keys()).map(|v| v.as_str())}@@ -404,7 +407,7 @@ impl LintGroup {.iter().map(|(key, value)| (key.as_str(), value.description())).chain(- self.expr_linters+ self.chunk_expr_linters.iter().map(|(key, value)| (key.as_str(), ExprLinter::description(value))),)@@ -417,7 +420,7 @@ impl LintGroup {.iter().map(|(key, value)| (key.as_str(), value.description_html())).chain(- self.expr_linters+ self.chunk_expr_linters.iter().map(|(key, value)| (key.as_str(), value.description_html())),)@@ -442,12 +445,12 @@ impl LintGroup {};}- /// Add an `ExprLinter` to the group, setting it to be enabled by default.+ /// Add a chunk-based `ExprLinter` to the group, setting it to be enabled by default./// While you _can_ pass an `ExprLinter` to `insert_struct_rule`, using this macro instead/// will allow it to use more aggressive caching strategies.macro_rules! insert_expr_rule {($rule:ident, $default_config:expr) => {- out.add_expr_linter(stringify!($rule), $rule::default());+ out.add_chunk_expr_linter(stringify!($rule), $rule::default());out.config.set_rule_enabled(stringify!($rule), $default_config);};@@ -699,7 +702,7 @@ impl LintGroup {} else {let mut pattern_lints = BTreeMap::new();- for (key, linter) in &mut self.expr_linters {+ for (key, linter) in &mut self.chunk_expr_linters {if self.config.is_rule_enabled(key) {let lints =run_on_chunk(linter, chunk, document.get_source()).map(|mut l| {diff --git a/harper-core/src/linting/looking_forward_to.rs b/harper-core/src/linting/looking_forward_to.rsindex 25943f601..096656fc5 100644--- a/harper-core/src/linting/looking_forward_to.rs+++ b/harper-core/src/linting/looking_forward_to.rs@@ -1,5 +1,6 @@use hashbrown::HashSet;+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{Expr, FixedPhrase, SequenceExpr},@@ -27,6 +28,8 @@ impl Default for LookingForwardTo {}impl ExprLinter for LookingForwardTo {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/map_phrase_linter.rs b/harper-core/src/linting/map_phrase_linter.rsindex 4faef8ee9..fc7ab4e45 100644--- a/harper-core/src/linting/map_phrase_linter.rs+++ b/harper-core/src/linting/map_phrase_linter.rs@@ -4,6 +4,7 @@ use crate::expr::FixedPhrase;use crate::expr::LongestMatchOf;use crate::expr::SimilarToPhrase;use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt};pub struct MapPhraseLinter {@@ -105,6 +106,8 @@ impl MapPhraseLinter {}impl ExprLinter for MapPhraseLinter {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/map_phrase_set_linter.rs b/harper-core/src/linting/map_phrase_set_linter.rsindex 39d9d96a1..86fbdcb30 100644--- a/harper-core/src/linting/map_phrase_set_linter.rs+++ b/harper-core/src/linting/map_phrase_set_linter.rs@@ -4,6 +4,7 @@ use crate::expr::Expr;use crate::expr::FixedPhrase;use crate::expr::LongestMatchOf;use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt};pub struct MapPhraseSetLinter<'a> {@@ -68,6 +69,8 @@ impl<'a> MapPhraseSetLinter<'a> {}impl<'a> ExprLinter for MapPhraseSetLinter<'a> {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/mass_plurals.rs b/harper-core/src/linting/mass_plurals.rsindex 8eca69b62..f9efce1e8 100644--- a/harper-core/src/linting/mass_plurals.rs+++ b/harper-core/src/linting/mass_plurals.rs@@ -1,5 +1,6 @@use hashbrown::HashSet;+use crate::linting::expr_linter::Chunk;use crate::{CharStringExt, Token, TokenStringExt,expr::{All, Expr, FirstMatchOf, FixedPhrase, SequenceExpr},@@ -56,6 +57,8 @@ impl<D> ExprLinter for MassPlurals<D>whereD: Dictionary,{+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/missing_preposition.rs b/harper-core/src/linting/missing_preposition.rsindex 1165fbe52..63250ee03 100644--- a/harper-core/src/linting/missing_preposition.rs+++ b/harper-core/src/linting/missing_preposition.rs@@ -9,6 +9,7 @@ use crate::patterns::UPOSSet;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind};+use crate::linting::expr_linter::Chunk;pub struct MissingPreposition {expr: Box<dyn Expr>,@@ -41,6 +42,8 @@ impl Default for MissingPreposition {}impl ExprLinter for MissingPreposition {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/missing_to.rs b/harper-core/src/linting/missing_to.rsindex 05e81cde4..3979de6c5 100644--- a/harper-core/src/linting/missing_to.rs+++ b/harper-core/src/linting/missing_to.rs@@ -2,6 +2,7 @@ use std::sync::Arc;use harper_brill::UPOS;+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{Expr, ExprMap, SequenceExpr},@@ -216,6 +217,8 @@ impl Default for MissingTo {}impl ExprLinter for MissingTo {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/misspell.rs b/harper-core/src/linting/misspell.rsindex bad74ce7f..91ff275f3 100644--- a/harper-core/src/linting/misspell.rs+++ b/harper-core/src/linting/misspell.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,expr::{Expr, SequenceExpr},@@ -29,6 +30,8 @@ impl Default for Misspell {}impl ExprLinter for Misspell {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/mixed_bag.rs b/harper-core/src/linting/mixed_bag.rsindex d3e4dac7b..7c0f2eceb 100644--- a/harper-core/src/linting/mixed_bag.rs+++ b/harper-core/src/linting/mixed_bag.rs@@ -1,4 +1,5 @@use crate::CharStringExt;+use crate::linting::expr_linter::Chunk;use crate::linting::expr_linter::find_the_only_token_matching;use crate::linting::{ExprLinter, LintKind, Suggestion};use crate::{@@ -29,6 +30,8 @@ impl Default for MixedBag {}impl ExprLinter for MixedBag {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/modal_of.rs b/harper-core/src/linting/modal_of.rsindex 09213d86c..c8e5526d9 100644--- a/harper-core/src/linting/modal_of.rs+++ b/harper-core/src/linting/modal_of.rs@@ -5,6 +5,7 @@ use crate::patterns::ModalVerb;use crate::{Lrc, Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ModalOf {expr: Box<dyn Expr>,@@ -71,6 +72,8 @@ impl Default for ModalOf {}impl ExprLinter for ModalOf {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/modal_seem.rs b/harper-core/src/linting/modal_seem.rsindex acf061e36..aea17bc96 100644--- a/harper-core/src/linting/modal_seem.rs+++ b/harper-core/src/linting/modal_seem.rs@@ -1,5 +1,6 @@use std::sync::Arc;+use crate::linting::expr_linter::Chunk;use crate::{CharStringExt, Token,expr::{Expr, ExprMap, SequenceExpr},@@ -68,6 +69,8 @@ impl Default for ModalSeem {}impl ExprLinter for ModalSeem {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/months.rs b/harper-core/src/linting/months.rsindex 514677694..ab5962b7c 100644--- a/harper-core/src/linting/months.rs+++ b/harper-core/src/linting/months.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Token, TokenKind,expr::{Expr, FirstMatchOf, SequenceExpr},@@ -87,6 +88,8 @@ impl Default for Months {}impl ExprLinter for Months {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/more_better.rs b/harper-core/src/linting/more_better.rsindex 8672b8ac6..76b6096cb 100644--- a/harper-core/src/linting/more_better.rs+++ b/harper-core/src/linting/more_better.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::token::Token;use crate::token_string_ext::TokenStringExt;@@ -29,6 +30,8 @@ impl Default for MoreBetter {}impl ExprLinter for MoreBetter {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/most_number.rs b/harper-core/src/linting/most_number.rsindex 446c8f82e..1cd3fecb3 100644--- a/harper-core/src/linting/most_number.rs+++ b/harper-core/src/linting/most_number.rs@@ -4,6 +4,7 @@ use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt, patterns::WordSet};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct MostNumber {expr: Box<dyn Expr>,@@ -35,6 +36,8 @@ impl Default for MostNumber {}impl ExprLinter for MostNumber {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/most_of_the_times.rs b/harper-core/src/linting/most_of_the_times.rsindex 4cd13b8dd..dd3b33bc5 100644--- a/harper-core/src/linting/most_of_the_times.rs+++ b/harper-core/src/linting/most_of_the_times.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, FixedPhrase, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, LintKind, Suggestion};use crate::patterns::Word;use crate::{Lint, Token};@@ -23,6 +24,8 @@ impl Default for MostOfTheTimes {}impl ExprLinter for MostOfTheTimes {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/multiple_sequential_pronouns.rs b/harper-core/src/linting/multiple_sequential_pronouns.rsindex ac422e29e..dfb528a40 100644--- a/harper-core/src/linting/multiple_sequential_pronouns.rs+++ b/harper-core/src/linting/multiple_sequential_pronouns.rs@@ -3,6 +3,7 @@ use super::expr_linter::ExprLinter;use crate::expr::Expr;use crate::expr::SequenceExpr;use crate::linting::LintKind;+use crate::linting::expr_linter::Chunk;use crate::patterns::WordSet;use crate::{CharStringExt, Lint, Lrc, Token, TokenStringExt};@@ -76,6 +77,8 @@ impl MultipleSequentialPronouns {}impl ExprLinter for MultipleSequentialPronouns {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/nail_on_the_head.rs b/harper-core/src/linting/nail_on_the_head.rsindex a436a0f08..80b1d4e82 100644--- a/harper-core/src/linting/nail_on_the_head.rs+++ b/harper-core/src/linting/nail_on_the_head.rs@@ -1,5 +1,6 @@use crate::expr::Expr;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -28,6 +29,8 @@ impl Default for NailOnTheHead {}impl ExprLinter for NailOnTheHead {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/need_to_noun.rs b/harper-core/src/linting/need_to_noun.rsindex 0a72fc966..2cd189485 100644--- a/harper-core/src/linting/need_to_noun.rs+++ b/harper-core/src/linting/need_to_noun.rs@@ -9,6 +9,7 @@ use crate::patterns::DerivedFrom;use crate::patterns::WordSet;use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct NeedToNoun {expr: Box<dyn Expr>,@@ -50,6 +51,8 @@ impl Default for NeedToNoun {}impl ExprLinter for NeedToNoun {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/no_match_for.rs b/harper-core/src/linting/no_match_for.rsindex d12adec65..1a9e97a27 100644--- a/harper-core/src/linting/no_match_for.rs+++ b/harper-core/src/linting/no_match_for.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{CharStringExt, Token, TokenStringExt,expr::{Expr, FirstMatchOf, SequenceExpr},@@ -35,6 +36,8 @@ impl Default for NoMatchFor {}impl ExprLinter for NoMatchFor {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/nobody.rs b/harper-core/src/linting/nobody.rsindex 32f9aad5e..f620e023c 100644--- a/harper-core/src/linting/nobody.rs+++ b/harper-core/src/linting/nobody.rs@@ -3,6 +3,7 @@ use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct Nobody {expr: Box<dyn Expr>,@@ -22,6 +23,8 @@ impl Default for Nobody {}impl ExprLinter for Nobody {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/nominal_wants.rs b/harper-core/src/linting/nominal_wants.rsindex 75c2a1064..e8e48fafa 100644--- a/harper-core/src/linting/nominal_wants.rs+++ b/harper-core/src/linting/nominal_wants.rs@@ -3,6 +3,7 @@ use harper_brill::UPOS;use crate::CharStringExt;use crate::expr::Expr;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token,dict_word_metadata::Person,@@ -57,6 +58,8 @@ impl Default for NominalWants {}impl ExprLinter for NominalWants {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/noun_countability.rs b/harper-core/src/linting/noun_countability.rsindex b8b8cba37..04b97361a 100644--- a/harper-core/src/linting/noun_countability.rs+++ b/harper-core/src/linting/noun_countability.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Span, Token, TokenStringExt,expr::{Expr, FirstMatchOf, LongestMatchOf, SequenceExpr},@@ -66,6 +67,8 @@ impl Default for NounCountability {}impl ExprLinter for NounCountability {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/noun_verb_confusion/effect_affect/affect_to_effect.rs b/harper-core/src/linting/noun_verb_confusion/effect_affect/affect_to_effect.rsindex 637335be4..5a9b405e1 100644--- a/harper-core/src/linting/noun_verb_confusion/effect_affect/affect_to_effect.rs+++ b/harper-core/src/linting/noun_verb_confusion/effect_affect/affect_to_effect.rs@@ -2,6 +2,7 @@ use std::sync::Arc;use harper_brill::UPOS;+use crate::linting::expr_linter::Chunk;use crate::{CharStringExt, Token, TokenKind,expr::{Expr, ExprMap, SequenceExpr},@@ -77,6 +78,8 @@ impl Default for AffectToEffect {}impl ExprLinter for AffectToEffect {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/noun_verb_confusion/effect_affect/effect_to_affect.rs b/harper-core/src/linting/noun_verb_confusion/effect_affect/effect_to_affect.rsindex 0ef120f8b..cc12c4929 100644--- a/harper-core/src/linting/noun_verb_confusion/effect_affect/effect_to_affect.rs+++ b/harper-core/src/linting/noun_verb_confusion/effect_affect/effect_to_affect.rs@@ -2,6 +2,7 @@ use std::sync::Arc;use harper_brill::UPOS;+use crate::linting::expr_linter::Chunk;use crate::{CharStringExt, Token, TokenKind,expr::{Expr, ExprMap, SequenceExpr},@@ -40,6 +41,8 @@ impl Default for EffectToAffect {}impl ExprLinter for EffectToAffect {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/noun_verb_confusion/noun_instead_of_verb/general.rs b/harper-core/src/linting/noun_verb_confusion/noun_instead_of_verb/general.rsindex 35bd903ae..43428c46d 100644--- a/harper-core/src/linting/noun_verb_confusion/noun_instead_of_verb/general.rs+++ b/harper-core/src/linting/noun_verb_confusion/noun_instead_of_verb/general.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, FirstMatchOf, LongestMatchOf, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::patterns::Word;use crate::{CharStringExt, Lrc, Token, patterns::WordSet};@@ -85,6 +86,8 @@ impl Default for GeneralNounInsteadOfVerb {}impl ExprLinter for GeneralNounInsteadOfVerb {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rs b/harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rsindex a25ac8718..5cc9e20ca 100644--- a/harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rs+++ b/harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Token,expr::{Expr, SequenceExpr},@@ -32,6 +33,8 @@ impl Default for VerbInsteadOfNoun {}impl ExprLinter for VerbInsteadOfNoun {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/of_course.rs b/harper-core/src/linting/of_course.rsindex 2aa3d1e63..c41ec064c 100644--- a/harper-core/src/linting/of_course.rs+++ b/harper-core/src/linting/of_course.rs@@ -5,6 +5,7 @@use crate::expr::Expr;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -30,6 +31,8 @@ impl Default for OfCourse {}impl ExprLinter for OfCourse {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/on_floor.rs b/harper-core/src/linting/on_floor.rsindex bc3a8dbb6..3a259aec7 100644--- a/harper-core/src/linting/on_floor.rs+++ b/harper-core/src/linting/on_floor.rs@@ -2,6 +2,7 @@ use crate::CharStringExt;use crate::expr::Expr;use crate::expr::LongestMatchOf;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::patterns::WordSet;use crate::{Lrc, Token, TokenStringExt,@@ -57,6 +58,8 @@ impl Default for OnFloor {}impl ExprLinter for OnFloor {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/once_or_twice.rs b/harper-core/src/linting/once_or_twice.rsindex 231460b56..18c21c2bf 100644--- a/harper-core/src/linting/once_or_twice.rs+++ b/harper-core/src/linting/once_or_twice.rs@@ -3,6 +3,7 @@ use crate::Token;use crate::expr::{Expr, SequenceExpr};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct OnceOrTwice {expr: Box<dyn Expr>,@@ -23,6 +24,8 @@ impl Default for OnceOrTwice {}impl ExprLinter for OnceOrTwice {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/one_and_the_same.rs b/harper-core/src/linting/one_and_the_same.rsindex b854ab6d2..fdf2255f2 100644--- a/harper-core/src/linting/one_and_the_same.rs+++ b/harper-core/src/linting/one_and_the_same.rs@@ -5,6 +5,7 @@ use crate::expr::SequenceExpr;use crate::{Lrc, Token, TokenStringExt, patterns::WordSet};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct OneAndTheSame {expr: Box<dyn Expr>,@@ -38,6 +39,8 @@ fn ws_word(word: &'static str) -> SequenceExpr {}impl ExprLinter for OneAndTheSame {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/open_compounds.rs b/harper-core/src/linting/open_compounds.rsindex 054ee646f..2d0d5b5f8 100644--- a/harper-core/src/linting/open_compounds.rs+++ b/harper-core/src/linting/open_compounds.rs@@ -2,6 +2,7 @@ use crate::expr::{Expr, LongestMatchOf, SequenceExpr};use crate::{Lrc, Token, patterns::WordSet};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;use hashbrown::HashMap;pub struct OpenCompounds {@@ -66,6 +67,8 @@ impl Default for OpenCompounds {}impl ExprLinter for OpenCompounds {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/open_the_light.rs b/harper-core/src/linting/open_the_light.rsindex e964a6925..e2381120a 100644--- a/harper-core/src/linting/open_the_light.rs+++ b/harper-core/src/linting/open_the_light.rs@@ -8,6 +8,7 @@ use crate::{};use super::{ExprLinter, Lint};+use crate::linting::expr_linter::Chunk;pub struct OpenTheLight {expr: Box<dyn Expr>,@@ -58,6 +59,8 @@ impl Default for OpenTheLight {}impl ExprLinter for OpenTheLight {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/orthographic_consistency.rs b/harper-core/src/linting/orthographic_consistency.rsindex c5655643d..04a39d233 100644--- a/harper-core/src/linting/orthographic_consistency.rs+++ b/harper-core/src/linting/orthographic_consistency.rs@@ -6,6 +6,8 @@ use crate::spell::{Dictionary, FstDictionary};use crate::{OrthFlags, Token};use super::{ExprLinter, Lint};+use crate::linting::expr_linter::Chunk;+pub struct OrthographicConsistency {dict: Arc<FstDictionary>,expr: Box<dyn Expr>,@@ -27,6 +29,8 @@ impl Default for OrthographicConsistency {}impl ExprLinter for OrthographicConsistency {+ type Unit = Chunk;+fn description(&self) -> &str {"Ensures word casing matches the dictionary's canonical orthography."}diff --git a/harper-core/src/linting/ought_to_be.rs b/harper-core/src/linting/ought_to_be.rsindex 641a6184f..019149cfe 100644--- a/harper-core/src/linting/ought_to_be.rs+++ b/harper-core/src/linting/ought_to_be.rs@@ -1,5 +1,6 @@use crate::TokenKind;use crate::expr::{AnchorStart, Expr, ExprMap, FixedPhrase, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::{Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -60,6 +61,8 @@ impl Default for OughtToBe {}impl ExprLinter for OughtToBe {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/out_of_date.rs b/harper-core/src/linting/out_of_date.rsindex 2e2d40eeb..5ea014e50 100644--- a/harper-core/src/linting/out_of_date.rs+++ b/harper-core/src/linting/out_of_date.rs@@ -4,6 +4,7 @@ use crate::expr::FixedPhrase;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct OutOfDate {expr: Box<dyn Expr>,@@ -24,6 +25,8 @@ impl Default for OutOfDate {}impl ExprLinter for OutOfDate {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/oxymorons.rs b/harper-core/src/linting/oxymorons.rsindex 045933c36..aeced36bd 100644--- a/harper-core/src/linting/oxymorons.rs+++ b/harper-core/src/linting/oxymorons.rs@@ -1,6 +1,7 @@use crate::expr::Expr;use crate::expr::FirstMatchOf;use crate::expr::FixedPhrase;+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind};use crate::{Token, TokenStringExt};@@ -50,6 +51,8 @@ impl Default for Oxymorons {}impl ExprLinter for Oxymorons {+ type Unit = Chunk;+/// Returns the underlying pattern.fn expr(&self) -> &dyn Expr {self.expr.as_ref()diff --git a/harper-core/src/linting/phrase_corrections/mod.rs b/harper-core/src/linting/phrase_corrections/mod.rsindex 7b7b63f60..2a1ef951b 100644--- a/harper-core/src/linting/phrase_corrections/mod.rs+++ b/harper-core/src/linting/phrase_corrections/mod.rs@@ -15,7 +15,7 @@ pub fn lint_group() -> LintGroup {$($name:expr => ($input:expr, $corrections:expr, $hint:expr, $description:expr $(, $lint_kind:expr)?)),+ $(,)?}) => {$(- $group.add_expr_linter(+ $group.add_chunk_expr_linter($name,Box::new(MapPhraseLinter::new_fixed_phrases(diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rsindex 00e9c3a6d..d7f991525 100644--- a/harper-core/src/linting/phrase_set_corrections/mod.rs+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs@@ -15,7 +15,7 @@ pub fn lint_group() -> LintGroup {$($name:expr => ($input_correction_pairs:expr, $message:expr, $description:expr $(, $lint_kind:expr)?)),+ $(,)?}) => {$(- $group.add_expr_linter(+ $group.add_chunk_expr_linter($name,Box::new(MapPhraseSetLinter::one_to_one(@@ -36,7 +36,7 @@ pub fn lint_group() -> LintGroup {$($name:expr => ($input_correction_multi_pairs:expr, $message:expr, $description:expr $(, $lint_kind:expr)?)),+ $(,)?}) => {$(- $group.add_expr_linter(+ $group.add_chunk_expr_linter($name,Box::new(MapPhraseSetLinter::many_to_many(diff --git a/harper-core/src/linting/pique_interest.rs b/harper-core/src/linting/pique_interest.rsindex 9aea4107a..5aa3a9f7b 100644--- a/harper-core/src/linting/pique_interest.rs+++ b/harper-core/src/linting/pique_interest.rs@@ -3,6 +3,7 @@ use crate::expr::SequenceExpr;use crate::{CharString, CharStringExt, Token, char_string::char_string, patterns::WordSet};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct PiqueInterest {expr: Box<dyn Expr>,@@ -42,6 +43,8 @@ impl PiqueInterest {}impl ExprLinter for PiqueInterest {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/possessive_noun.rs b/harper-core/src/linting/possessive_noun.rsindex 1e24c5dcd..1edda238f 100644--- a/harper-core/src/linting/possessive_noun.rs+++ b/harper-core/src/linting/possessive_noun.rs@@ -2,6 +2,7 @@ use harper_brill::UPOS;use super::{ExprLinter, Lint, LintKind, Suggestion};use crate::expr::{All, Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::patterns::{UPOSSet, WordSet};use crate::spell::Dictionary;use crate::{Token, TokenKind};@@ -53,6 +54,8 @@ impl<D> ExprLinter for PossessiveNoun<D>whereD: Dictionary,{+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/possessive_your.rs b/harper-core/src/linting/possessive_your.rsindex 6f2c2fbf9..964674b19 100644--- a/harper-core/src/linting/possessive_your.rs+++ b/harper-core/src/linting/possessive_your.rs@@ -4,6 +4,7 @@ use crate::expr::Expr;use crate::expr::SequenceExpr;use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct PossessiveYour {expr: Box<dyn Expr>,@@ -26,6 +27,8 @@ impl Default for PossessiveYour {}impl ExprLinter for PossessiveYour {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/progressive_needs_be.rs b/harper-core/src/linting/progressive_needs_be.rsindex 415d76926..313b4b30d 100644--- a/harper-core/src/linting/progressive_needs_be.rs+++ b/harper-core/src/linting/progressive_needs_be.rs@@ -2,6 +2,7 @@ use crate::Token;use crate::expr::{Expr, SequenceExpr};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ProgressiveNeedsBe {expr: Box<dyn Expr>,@@ -32,6 +33,8 @@ impl Default for ProgressiveNeedsBe {}impl ExprLinter for ProgressiveNeedsBe {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/pronoun_are.rs b/harper-core/src/linting/pronoun_are.rsindex 63a3fc41b..af7474aad 100644--- a/harper-core/src/linting/pronoun_are.rs+++ b/harper-core/src/linting/pronoun_are.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,expr::{Expr, SequenceExpr},@@ -29,6 +30,8 @@ impl Default for PronounAre {}impl ExprLinter for PronounAre {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/pronoun_contraction/avoid_contraction.rs b/harper-core/src/linting/pronoun_contraction/avoid_contraction.rsindex bc3bead55..928a65092 100644--- a/harper-core/src/linting/pronoun_contraction/avoid_contraction.rs+++ b/harper-core/src/linting/pronoun_contraction/avoid_contraction.rs@@ -2,6 +2,7 @@ use crate::expr::{Expr, SequenceExpr};use crate::{Token, TokenKind};use super::super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct AvoidContraction {expr: Box<dyn Expr>,@@ -20,6 +21,8 @@ impl Default for AvoidContraction {}impl ExprLinter for AvoidContraction {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/pronoun_contraction/should_contract.rs b/harper-core/src/linting/pronoun_contraction/should_contract.rsindex 62b799841..baf564ca1 100644--- a/harper-core/src/linting/pronoun_contraction/should_contract.rs+++ b/harper-core/src/linting/pronoun_contraction/should_contract.rs@@ -8,6 +8,7 @@ use crate::expr::SequenceExpr;use crate::{Token, patterns::WordSet};use crate::Lint;+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, LintKind, Suggestion};/// See also:@@ -61,6 +62,8 @@ impl ShouldContract {}impl ExprLinter for ShouldContract {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/pronoun_inflection_be.rs b/harper-core/src/linting/pronoun_inflection_be.rsindex 5e4dd9e1d..72934c2b1 100644--- a/harper-core/src/linting/pronoun_inflection_be.rs+++ b/harper-core/src/linting/pronoun_inflection_be.rs@@ -6,6 +6,7 @@ use crate::{Lrc, Token, TokenKind};use super::Suggestion;use super::{ExprLinter, Lint, LintKind};+use crate::linting::expr_linter::Chunk;pub struct PronounInflectionBe {expr: Box<dyn Expr>,@@ -143,6 +144,8 @@ impl Default for PronounInflectionBe {}impl ExprLinter for PronounInflectionBe {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/pronoun_knew.rs b/harper-core/src/linting/pronoun_knew.rsindex 97aae7d37..34fbcea1c 100644--- a/harper-core/src/linting/pronoun_knew.rs+++ b/harper-core/src/linting/pronoun_knew.rs@@ -3,6 +3,7 @@ use harper_brill::UPOS;use crate::expr::Expr;use crate::expr::LongestMatchOf;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -60,6 +61,8 @@ impl Default for PronounKnew {}impl ExprLinter for PronounKnew {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/proper_noun_capitalization_linters.rs b/harper-core/src/linting/proper_noun_capitalization_linters.rsindex 04bb2736a..665403e7f 100644--- a/harper-core/src/linting/proper_noun_capitalization_linters.rs+++ b/harper-core/src/linting/proper_noun_capitalization_linters.rs@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};use super::{ExprLinter, LintGroup};use super::{Lint, LintKind, Suggestion};use crate::Document;+use crate::linting::expr_linter::Chunk;use crate::parsers::PlainEnglish;use crate::spell::Dictionary;use crate::{Token, TokenStringExt};@@ -66,6 +67,8 @@ impl<D: Dictionary + 'static> ProperNounCapitalizationLinter<D> {}impl<D: Dictionary + 'static> ExprLinter for ProperNounCapitalizationLinter<D> {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {&self.pattern_map}@@ -117,7 +120,7 @@ fn lint_group_from_json(json: &str, dictionary: Arc<impl Dictionary + 'static>)let rules: HashMap<String, RuleEntry> = serde_json::from_str(json).unwrap();for (key, rule) in rules.into_iter() {- group.add_expr_linter(+ group.add_chunk_expr_linter(key,Box::new(ProperNounCapitalizationLinter::new_strs(rule.canonical,diff --git a/harper-core/src/linting/quantifier_needs_of.rs b/harper-core/src/linting/quantifier_needs_of.rsindex 70116db0d..bfc2de251 100644--- a/harper-core/src/linting/quantifier_needs_of.rs+++ b/harper-core/src/linting/quantifier_needs_of.rs@@ -3,6 +3,7 @@ use crate::expr::{Expr, SequenceExpr};use crate::patterns::WordSet;use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;/// Flags phrases like `a couple months` → should be `a couple **of** months`.pub struct QuantifierNeedsOf {@@ -25,6 +26,8 @@ impl Default for QuantifierNeedsOf {}impl ExprLinter for QuantifierNeedsOf {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/quantifier_numeral_conflict.rs b/harper-core/src/linting/quantifier_numeral_conflict.rsindex a198b700a..b2c908758 100644--- a/harper-core/src/linting/quantifier_numeral_conflict.rs+++ b/harper-core/src/linting/quantifier_numeral_conflict.rs@@ -1,4 +1,5 @@use crate::expr::{All, Expr, SequenceExpr, SpelledNumberExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, LintKind, Suggestion};use crate::patterns::{NominalPhrase, WordSet};use crate::token_string_ext::TokenStringExt;@@ -37,6 +38,8 @@ impl Default for QuantifierNumeralConflict {}impl ExprLinter for QuantifierNumeralConflict {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/quite_quiet.rs b/harper-core/src/linting/quite_quiet.rsindex e0a0f200f..9afedc76a 100644--- a/harper-core/src/linting/quite_quiet.rs+++ b/harper-core/src/linting/quite_quiet.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, FirstMatchOf, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::{CharStringExt, Token, TokenKind, TokenStringExt};@@ -52,6 +53,8 @@ impl Default for QuiteQuiet {}impl ExprLinter for QuiteQuiet {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/redundant_additive_adverbs.rs b/harper-core/src/linting/redundant_additive_adverbs.rsindex 43912f31b..889542367 100644--- a/harper-core/src/linting/redundant_additive_adverbs.rs+++ b/harper-core/src/linting/redundant_additive_adverbs.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Token, TokenStringExt,expr::{Expr, FirstMatchOf, FixedPhrase, SequenceExpr},@@ -35,6 +36,8 @@ impl Default for RedundantAdditiveAdverbs {}impl ExprLinter for RedundantAdditiveAdverbs {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/regionalisms.rs b/harper-core/src/linting/regionalisms.rsindex 7a0e6e22c..96d39e39b 100644--- a/harper-core/src/linting/regionalisms.rs+++ b/harper-core/src/linting/regionalisms.rs@@ -6,6 +6,7 @@ use crate::{};use super::ExprLinter;+use crate::linting::expr_linter::Chunk;#[derive(PartialEq)]enum CanFlag {@@ -485,6 +486,8 @@ impl Regionalisms {}impl ExprLinter for Regionalisms {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/roller_skated.rs b/harper-core/src/linting/roller_skated.rsindex 02516952c..a61891b82 100644--- a/harper-core/src/linting/roller_skated.rs+++ b/harper-core/src/linting/roller_skated.rs@@ -1,5 +1,6 @@use std::sync::Arc;+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenKind, TokenStringExt,expr::{AnchorStart, Expr, ExprMap, SequenceExpr},@@ -68,6 +69,8 @@ impl Default for RollerSkated {}impl ExprLinter for RollerSkated {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/safe_to_save.rs b/harper-core/src/linting/safe_to_save.rsindex f813c5989..1dcaa6488 100644--- a/harper-core/src/linting/safe_to_save.rs+++ b/harper-core/src/linting/safe_to_save.rs@@ -3,6 +3,7 @@ use harper_brill::UPOS;use crate::expr::Expr;use crate::expr::OwnedExprExt;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::patterns::{ModalVerb, UPOSSet, WordSet};use crate::{Token,@@ -40,6 +41,8 @@ impl Default for SafeToSave {}impl ExprLinter for SafeToSave {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/save_to_safe.rs b/harper-core/src/linting/save_to_safe.rsindex d86b1d35e..99cdc21d6 100644--- a/harper-core/src/linting/save_to_safe.rs+++ b/harper-core/src/linting/save_to_safe.rs@@ -1,6 +1,7 @@use crate::expr::Expr;use crate::expr::OwnedExprExt;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -28,6 +29,8 @@ impl Default for SaveToSafe {}impl ExprLinter for SaveToSafe {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/semicolon_apostrophe.rs b/harper-core/src/linting/semicolon_apostrophe.rsindex 44e53dcc3..f58488770 100644--- a/harper-core/src/linting/semicolon_apostrophe.rs+++ b/harper-core/src/linting/semicolon_apostrophe.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,expr::{Expr, SequenceExpr},@@ -25,6 +26,8 @@ impl Default for SemicolonApostrophe {}impl ExprLinter for SemicolonApostrophe {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/shoot_oneself_in_the_foot.rs b/harper-core/src/linting/shoot_oneself_in_the_foot.rsindex f3380d6af..e5191981c 100644--- a/harper-core/src/linting/shoot_oneself_in_the_foot.rs+++ b/harper-core/src/linting/shoot_oneself_in_the_foot.rs@@ -6,6 +6,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind};+use crate::linting::expr_linter::Chunk;pub struct ShootOneselfInTheFoot {pattern: Box<dyn Expr>,@@ -34,6 +35,8 @@ impl Default for ShootOneselfInTheFoot {}impl ExprLinter for ShootOneselfInTheFoot {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.pattern.as_ref()}diff --git a/harper-core/src/linting/simple_past_to_past_participle.rs b/harper-core/src/linting/simple_past_to_past_participle.rsindex 832603765..7217f4c0c 100644--- a/harper-core/src/linting/simple_past_to_past_participle.rs+++ b/harper-core/src/linting/simple_past_to_past_participle.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token,char_string::CharStringExt,@@ -127,6 +128,8 @@ impl Default for SimplePastToPastParticiple {}impl ExprLinter for SimplePastToPastParticiple {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/since_duration.rs b/harper-core/src/linting/since_duration.rsindex b4be6b2af..5ac1340b1 100644--- a/harper-core/src/linting/since_duration.rs+++ b/harper-core/src/linting/since_duration.rs@@ -2,6 +2,7 @@ use crate::expr::{DurationExpr, Expr, LongestMatchOf, SequenceExpr};use crate::{Lrc, Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;const AGO_VARIANTS: [&[char]; 3] = [&['a', 'g', 'o'], &['A', 'g', 'o'], &['A', 'G', 'O']];const FOR_VARIANTS: [&[char]; 3] = [&['f', 'o', 'r'], &['F', 'o', 'r'], &['F', 'O', 'R']];@@ -46,6 +47,8 @@ impl Default for SinceDuration {}impl ExprLinter for SinceDuration {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/single_be.rs b/harper-core/src/linting/single_be.rsindex 6185aed43..8839422e8 100644--- a/harper-core/src/linting/single_be.rs+++ b/harper-core/src/linting/single_be.rs@@ -1,4 +1,5 @@use crate::dict_word_metadata::VerbFormFlags;+use crate::linting::expr_linter::Chunk;use crate::{Span, Token,expr::{Expr, SequenceExpr},@@ -81,6 +82,8 @@ impl Default for SingleBe {}impl ExprLinter for SingleBe {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/some_without_article.rs b/harper-core/src/linting/some_without_article.rsindex 9d0a9363b..e92dc8292 100644--- a/harper-core/src/linting/some_without_article.rs+++ b/harper-core/src/linting/some_without_article.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,expr::{Expr, SequenceExpr},@@ -22,6 +23,8 @@ impl Default for SomeWithoutArticle {}impl ExprLinter for SomeWithoutArticle {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/something_is.rs b/harper-core/src/linting/something_is.rsindex 414ee057d..67f724eaa 100644--- a/harper-core/src/linting/something_is.rs+++ b/harper-core/src/linting/something_is.rs@@ -3,6 +3,7 @@ use crate::patterns::WordSet;use crate::{Token, TokenKind};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct SomethingIs {expr: Box<dyn Expr>,@@ -25,6 +26,8 @@ impl Default for SomethingIs {}impl ExprLinter for SomethingIs {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/somewhat_something.rs b/harper-core/src/linting/somewhat_something.rsindex 879827bb5..c6cf79bbe 100644--- a/harper-core/src/linting/somewhat_something.rs+++ b/harper-core/src/linting/somewhat_something.rs@@ -2,6 +2,7 @@ use crate::Token;use crate::expr::{Expr, SequenceExpr};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct SomewhatSomething {expr: Box<dyn Expr>,@@ -22,6 +23,8 @@ impl Default for SomewhatSomething {}impl ExprLinter for SomewhatSomething {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/sought_after.rs b/harper-core/src/linting/sought_after.rsindex ab44b1add..838139a1c 100644--- a/harper-core/src/linting/sought_after.rs+++ b/harper-core/src/linting/sought_after.rs@@ -2,6 +2,7 @@ use crate::expr::{Expr, SequenceExpr, SpaceOrHyphen};use crate::{Token, TokenKind};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct SoughtAfter {expr: Box<dyn Expr>,@@ -35,6 +36,8 @@ impl Default for SoughtAfter {}impl ExprLinter for SoughtAfter {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/split_words.rs b/harper-core/src/linting/split_words.rsindex 61cfc6c96..26fc5caa3 100644--- a/harper-core/src/linting/split_words.rs+++ b/harper-core/src/linting/split_words.rs@@ -7,6 +7,7 @@ use crate::linting::{LintKind, Suggestion};use crate::spell::{FstDictionary, TrieDictionary};use super::{ExprLinter, Lint};+use crate::linting::expr_linter::Chunk;pub struct SplitWords {dict: Arc<TrieDictionary<Arc<FstDictionary>>>,@@ -29,6 +30,8 @@ impl Default for SplitWords {}impl ExprLinter for SplitWords {+ type Unit = Chunk;+fn description(&self) -> &str {"Finds missing spaces in improper compound words."}diff --git a/harper-core/src/linting/take_serious.rs b/harper-core/src/linting/take_serious.rsindex 07db42111..0eb1fcd24 100644--- a/harper-core/src/linting/take_serious.rs+++ b/harper-core/src/linting/take_serious.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,expr::{Expr, SequenceExpr},@@ -35,6 +36,8 @@ impl Default for TakeSerious {}impl ExprLinter for TakeSerious {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/that_than.rs b/harper-core/src/linting/that_than.rsindex e85a9f7a0..117f8c153 100644--- a/harper-core/src/linting/that_than.rs+++ b/harper-core/src/linting/that_than.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenKind,expr::{Expr, SequenceExpr},@@ -27,6 +28,8 @@ impl Default for ThatThan {}impl ExprLinter for ThatThan {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/that_which.rs b/harper-core/src/linting/that_which.rsindex add26ee32..18183bba6 100644--- a/harper-core/src/linting/that_which.rs+++ b/harper-core/src/linting/that_which.rs@@ -6,6 +6,7 @@ use itertools::Itertools;use crate::{Lrc, Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ThatWhich {expr: Box<dyn Expr>,@@ -32,6 +33,8 @@ impl Default for ThatWhich {}impl ExprLinter for ThatWhich {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/the_how_why.rs b/harper-core/src/linting/the_how_why.rsindex 45b6664c2..c4ac7ad6c 100644--- a/harper-core/src/linting/the_how_why.rs+++ b/harper-core/src/linting/the_how_why.rs@@ -1,6 +1,7 @@use crate::expr::Expr;use crate::expr::FirstMatchOf;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -60,6 +61,8 @@ impl Default for TheHowWhy {}impl ExprLinter for TheHowWhy {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {&self.expr}diff --git a/harper-core/src/linting/the_my.rs b/harper-core/src/linting/the_my.rsindex 1d221a4fd..3c2eea83b 100644--- a/harper-core/src/linting/the_my.rs+++ b/harper-core/src/linting/the_my.rs@@ -2,6 +2,7 @@ use super::{ExprLinter, Lint, LintKind, Suggestion};use crate::expr::Expr;use crate::expr::FirstMatchOf;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{CharStringExt, Token, TokenStringExt,patterns::{Word, WordSet},@@ -36,6 +37,8 @@ impl Default for TheMy {}impl ExprLinter for TheMy {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/then_than.rs b/harper-core/src/linting/then_than.rsindex 721245904..003313279 100644--- a/harper-core/src/linting/then_than.rs+++ b/harper-core/src/linting/then_than.rs@@ -1,6 +1,7 @@use super::{ExprLinter, Lint, LintKind};use crate::expr::{All, Expr, FirstMatchOf, FixedPhrase, SequenceExpr};use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;use crate::patterns::{Invert, Word, WordSet};use crate::{CharStringExt, Token, TokenKind};@@ -69,6 +70,8 @@ impl Default for ThenThan {}impl ExprLinter for ThenThan {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/theres.rs b/harper-core/src/linting/theres.rsindex 01a9ec192..da74437fc 100644--- a/harper-core/src/linting/theres.rs+++ b/harper-core/src/linting/theres.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{CharStringExt, Token,expr::SequenceExpr,@@ -26,6 +27,8 @@ impl Default for Theres {}impl ExprLinter for Theres {+ type Unit = Chunk;+fn expr(&self) -> &dyn crate::expr::Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/theses_these.rs b/harper-core/src/linting/theses_these.rsindex 7227a83ea..a8aea0f94 100644--- a/harper-core/src/linting/theses_these.rs+++ b/harper-core/src/linting/theses_these.rs@@ -1,6 +1,7 @@use super::{ExprLinter, Lint, LintKind, Suggestion};use crate::Token;use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::patterns::UPOSSet;use harper_brill::UPOS;@@ -22,6 +23,8 @@ impl Default for ThesesThese {}impl ExprLinter for ThesesThese {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/thing_think.rs b/harper-core/src/linting/thing_think.rsindex c02ced2e8..c4a32b235 100644--- a/harper-core/src/linting/thing_think.rs+++ b/harper-core/src/linting/thing_think.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{Expr, FirstMatchOf, FixedPhrase, SequenceExpr},@@ -77,6 +78,8 @@ impl Default for ThingThink {}impl ExprLinter for ThingThink {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/though_thought.rs b/harper-core/src/linting/though_thought.rsindex 8a4cda418..651222c5f 100644--- a/harper-core/src/linting/though_thought.rs+++ b/harper-core/src/linting/though_thought.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::expr_linter::find_the_only_token_matching;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::{CharStringExt, Token, TokenKind};@@ -29,6 +30,8 @@ impl Default for ThoughThought {}impl ExprLinter for ThoughThought {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/throw_away.rs b/harper-core/src/linting/throw_away.rsindex 8b37b9e6a..88691d87c 100644--- a/harper-core/src/linting/throw_away.rs+++ b/harper-core/src/linting/throw_away.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{Expr, SequenceExpr},@@ -22,6 +23,8 @@ impl Default for ThrowAway {}impl ExprLinter for ThrowAway {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/to_adverb.rs b/harper-core/src/linting/to_adverb.rsindex b8283bae4..77478aa4d 100644--- a/harper-core/src/linting/to_adverb.rs+++ b/harper-core/src/linting/to_adverb.rs@@ -5,6 +5,7 @@ use crate::patterns::{UPOSSet, WordSet};use crate::{Span, Token};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;const AMBIGUOUS_ADVERBS: &[&str] = &["just", "not"];@@ -30,6 +31,8 @@ impl Default for ToAdverb {}impl ExprLinter for ToAdverb {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/to_two_too/to_too_adjective_end.rs b/harper-core/src/linting/to_two_too/to_too_adjective_end.rsindex 590ffefab..ac6790848 100644--- a/harper-core/src/linting/to_two_too/to_too_adjective_end.rs+++ b/harper-core/src/linting/to_two_too/to_too_adjective_end.rs@@ -6,6 +6,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ToTooAdjectiveEnd {expr: Box<dyn Expr>,@@ -38,6 +39,8 @@ impl Default for ToTooAdjectiveEnd {}impl ExprLinter for ToTooAdjectiveEnd {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/to_two_too/to_too_adjective_punct.rs b/harper-core/src/linting/to_two_too/to_too_adjective_punct.rsindex 4a1c626f5..fa425cf70 100644--- a/harper-core/src/linting/to_two_too/to_too_adjective_punct.rs+++ b/harper-core/src/linting/to_two_too/to_too_adjective_punct.rs@@ -6,6 +6,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ToTooAdjectivePunct {expr: Box<dyn Expr>,@@ -36,6 +37,8 @@ impl Default for ToTooAdjectivePunct {}impl ExprLinter for ToTooAdjectivePunct {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/to_two_too/to_too_adjverb_ed_punct.rs b/harper-core/src/linting/to_two_too/to_too_adjverb_ed_punct.rsindex 77c3b8b33..6579b48de 100644--- a/harper-core/src/linting/to_two_too/to_too_adjverb_ed_punct.rs+++ b/harper-core/src/linting/to_two_too/to_too_adjverb_ed_punct.rs@@ -5,6 +5,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ToTooAdjVerbEdPunct {expr: Box<dyn Expr>,@@ -36,6 +37,8 @@ impl Default for ToTooAdjVerbEdPunct {}impl ExprLinter for ToTooAdjVerbEdPunct {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/to_two_too/to_too_adverb.rs b/harper-core/src/linting/to_two_too/to_too_adverb.rsindex 989c42f2d..ccea36f71 100644--- a/harper-core/src/linting/to_two_too/to_too_adverb.rs+++ b/harper-core/src/linting/to_two_too/to_too_adverb.rs@@ -6,6 +6,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ToTooAdverb {expr: Box<dyn Expr>,@@ -34,6 +35,8 @@ impl Default for ToTooAdverb {}impl ExprLinter for ToTooAdverb {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/to_two_too/to_too_chunk_start_comma.rs b/harper-core/src/linting/to_two_too/to_too_chunk_start_comma.rsindex f9ae055a7..164b43da0 100644--- a/harper-core/src/linting/to_two_too/to_too_chunk_start_comma.rs+++ b/harper-core/src/linting/to_two_too/to_too_chunk_start_comma.rs@@ -6,6 +6,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ToTooChunkStartComma {expr: Box<dyn Expr>,@@ -26,6 +27,8 @@ impl Default for ToTooChunkStartComma {}impl ExprLinter for ToTooChunkStartComma {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/to_two_too/to_too_degree_words.rs b/harper-core/src/linting/to_two_too/to_too_degree_words.rsindex 32eea34da..4ef98c677 100644--- a/harper-core/src/linting/to_two_too/to_too_degree_words.rs+++ b/harper-core/src/linting/to_two_too/to_too_degree_words.rs@@ -5,6 +5,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ToTooDegreeWords {expr: Box<dyn Expr>,@@ -34,6 +35,8 @@ impl Default for ToTooDegreeWords {}impl ExprLinter for ToTooDegreeWords {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/to_two_too/to_too_pronoun_end.rs b/harper-core/src/linting/to_two_too/to_too_pronoun_end.rsindex 2263e3aa8..eb924b3f4 100644--- a/harper-core/src/linting/to_two_too/to_too_pronoun_end.rs+++ b/harper-core/src/linting/to_two_too/to_too_pronoun_end.rs@@ -6,6 +6,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct ToTooPronounEnd {expr: Box<dyn Expr>,@@ -47,6 +48,8 @@ impl Default for ToTooPronounEnd {}impl ExprLinter for ToTooPronounEnd {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/to_two_too/too_to.rs b/harper-core/src/linting/to_two_too/too_to.rsindex d67bc11b8..54c106fa5 100644--- a/harper-core/src/linting/to_two_too/too_to.rs+++ b/harper-core/src/linting/to_two_too/too_to.rs@@ -6,6 +6,7 @@ use crate::expr::SequenceExpr;use crate::patterns::UPOSSet;use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct TooTo {expr: Box<dyn Expr>,@@ -27,6 +28,8 @@ impl Default for TooTo {}impl ExprLinter for TooTo {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/touristic.rs b/harper-core/src/linting/touristic.rsindex 25903e673..f5ae6d0be 100644--- a/harper-core/src/linting/touristic.rs+++ b/harper-core/src/linting/touristic.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,expr::{Expr, LongestMatchOf, SequenceExpr},@@ -89,6 +90,8 @@ impl Default for Touristic {}impl ExprLinter for Touristic {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/update_place_names.rs b/harper-core/src/linting/update_place_names.rsindex faf4a97c0..591a014e7 100644--- a/harper-core/src/linting/update_place_names.rs+++ b/harper-core/src/linting/update_place_names.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, FixedPhrase, LongestMatchOf};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, LintKind, Suggestion};use crate::{Lint, Token, TokenStringExt};@@ -97,6 +98,8 @@ impl<'a> UpdatePlaceNames<'a> {}impl<'a> ExprLinter for UpdatePlaceNames<'a> {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/use_genitive.rs b/harper-core/src/linting/use_genitive.rsindex ac57e5d6a..141f04814 100644--- a/harper-core/src/linting/use_genitive.rs+++ b/harper-core/src/linting/use_genitive.rs@@ -2,6 +2,7 @@ use crate::expr::Expr;use crate::expr::FirstMatchOf;use crate::expr::SequenceExpr;use crate::expr::WordExprGroup;+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, LintKind, Suggestion};use crate::patterns::Word;use crate::{Lint, Lrc, Token};@@ -56,6 +57,8 @@ impl UseGenitive {}impl ExprLinter for UseGenitive {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/verb_to_adjective.rs b/harper-core/src/linting/verb_to_adjective.rsindex da0f2d9ab..93c39df59 100644--- a/harper-core/src/linting/verb_to_adjective.rs+++ b/harper-core/src/linting/verb_to_adjective.rs@@ -8,6 +8,7 @@ use crate::patterns::WordSet;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind};+use crate::linting::expr_linter::Chunk;pub struct VerbToAdjective {expr: Box<dyn Expr>,@@ -40,6 +41,8 @@ impl Default for VerbToAdjective {}impl ExprLinter for VerbToAdjective {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/very_unique.rs b/harper-core/src/linting/very_unique.rsindex 0038e4647..0331c26d2 100644--- a/harper-core/src/linting/very_unique.rs+++ b/harper-core/src/linting/very_unique.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token, TokenStringExt,expr::{Expr, SequenceExpr},@@ -25,6 +26,8 @@ impl Default for VeryUnique {}impl ExprLinter for VeryUnique {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/vice_versa.rs b/harper-core/src/linting/vice_versa.rsindex 1da3eb6c0..57f558e10 100644--- a/harper-core/src/linting/vice_versa.rs+++ b/harper-core/src/linting/vice_versa.rs@@ -1,4 +1,5 @@use crate::expr::{Expr, SequenceExpr};+use crate::linting::expr_linter::Chunk;use crate::linting::{ExprLinter, Lint, LintKind, Suggestion};use crate::{Token, TokenStringExt};@@ -86,6 +87,8 @@ impl Default for ViceVersa {}impl ExprLinter for ViceVersa {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/was_aloud.rs b/harper-core/src/linting/was_aloud.rsindex fde4bf5c5..be57b8eae 100644--- a/harper-core/src/linting/was_aloud.rs+++ b/harper-core/src/linting/was_aloud.rs@@ -4,6 +4,7 @@ use crate::TokenStringExt;use crate::expr::Expr;use crate::expr::SequenceExpr;use crate::linting::Suggestion;+use crate::linting::expr_linter::Chunk;use crate::patterns::WordSet;pub struct WasAloud {@@ -24,6 +25,8 @@ impl Default for WasAloud {}impl ExprLinter for WasAloud {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/way_too_adjective.rs b/harper-core/src/linting/way_too_adjective.rsindex a1085cdac..5cfa201d7 100644--- a/harper-core/src/linting/way_too_adjective.rs+++ b/harper-core/src/linting/way_too_adjective.rs@@ -5,6 +5,7 @@ use crate::expr::{All, Expr, OwnedExprExt, SequenceExpr};use crate::patterns::{UPOSSet, WordSet};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct WayTooAdjective {expr: Box<dyn Expr>,@@ -38,6 +39,8 @@ impl Default for WayTooAdjective {}impl ExprLinter for WayTooAdjective {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/well_educated.rs b/harper-core/src/linting/well_educated.rsindex dea7ac667..4e0c63102 100644--- a/harper-core/src/linting/well_educated.rs+++ b/harper-core/src/linting/well_educated.rs@@ -5,6 +5,7 @@ use crate::{};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct WellEducated {expr: Box<dyn Expr>,@@ -31,6 +32,8 @@ impl Default for WellEducated {}impl ExprLinter for WellEducated {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/whereas.rs b/harper-core/src/linting/whereas.rsindex 67c971a5c..d1d0de77f 100644--- a/harper-core/src/linting/whereas.rs+++ b/harper-core/src/linting/whereas.rs@@ -3,6 +3,7 @@ use crate::expr::SequenceExpr;use crate::{Token, TokenStringExt};use super::{ExprLinter, Lint, LintKind, Suggestion};+use crate::linting::expr_linter::Chunk;pub struct Whereas {expr: Box<dyn Expr>,@@ -22,6 +23,8 @@ impl Default for Whereas {}impl ExprLinter for Whereas {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/widely_accepted.rs b/harper-core/src/linting/widely_accepted.rsindex f9dc862dd..579706763 100644--- a/harper-core/src/linting/widely_accepted.rs+++ b/harper-core/src/linting/widely_accepted.rs@@ -1,5 +1,6 @@use crate::expr::Expr;use crate::expr::SequenceExpr;+use crate::linting::expr_linter::Chunk;use crate::{Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -22,6 +23,8 @@ impl Default for WidelyAccepted {}impl ExprLinter for WidelyAccepted {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {&self.expr}diff --git a/harper-core/src/linting/win_prize.rs b/harper-core/src/linting/win_prize.rsindex 578a45e7d..78d540b19 100644--- a/harper-core/src/linting/win_prize.rs+++ b/harper-core/src/linting/win_prize.rs@@ -1,5 +1,6 @@use crate::expr::SequenceExpr;use crate::expr::{Expr, OwnedExprExt};+use crate::linting::expr_linter::Chunk;use crate::{Lrc, Token,linting::{ExprLinter, Lint, LintKind, Suggestion},@@ -35,6 +36,8 @@ impl Default for WinPrize {}impl ExprLinter for WinPrize {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}diff --git a/harper-core/src/linting/would_never_have.rs b/harper-core/src/linting/would_never_have.rsindex 060ffa532..af3880bef 100644--- a/harper-core/src/linting/would_never_have.rs+++ b/harper-core/src/linting/would_never_have.rs@@ -1,3 +1,4 @@+use crate::linting::expr_linter::Chunk;use crate::{Token,expr::{Expr, FixedPhrase, SequenceExpr},@@ -37,6 +38,8 @@ impl Default for WouldNeverHave {}impl ExprLinter for WouldNeverHave {+ type Unit = Chunk;+fn expr(&self) -> &dyn Expr {self.expr.as_ref()}