Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
refactor: now takes an iterator
hippietrailb8510a3749e7
diff --git a/harper-core/src/document.rs b/harper-core/src/document.rsindex 53c42c807..98bee21c5 100644--- a/harper-core/src/document.rs+++ b/harper-core/src/document.rs@@ -531,7 +531,7 @@ impl Document {fn uncached_dotted_truncation_expr() -> Lrc<FirstMatchOf> {Lrc::new(FirstMatchOf::new(vec![- Box::new(SequenceExpr::word_set(&["esp", "etc", "vs"]).then_period()),+ Box::new(SequenceExpr::word_set(["esp", "etc", "vs"]).then_period()),Box::new(SequenceExpr::aco("et").then_whitespace()diff --git a/harper-core/src/expr/duration_expr.rs b/harper-core/src/expr/duration_expr.rsindex 05610ac92..cc7fb9da8 100644--- a/harper-core/src/expr/duration_expr.rs+++ b/harper-core/src/expr/duration_expr.rs@@ -14,7 +14,7 @@ impl Expr for DurationExpr {return None;}- let units = WordSet::new(&[+ let units = WordSet::new(["second", "seconds", "minute", "minutes", "hour", "hours", "day", "days", "week","weeks", "month", "months", "year", "years",]);diff --git a/harper-core/src/expr/pronoun_be.rs b/harper-core/src/expr/pronoun_be.rsindex 74c741b3a..9d41aa7a1 100644--- a/harper-core/src/expr/pronoun_be.rs+++ b/harper-core/src/expr/pronoun_be.rs@@ -14,9 +14,9 @@ impl Default for PronounBe {SequenceExpr::default().then_subject_pronoun().t_ws()- .t_set(&["am", "are", "is", "was", "were"]),+ .t_set(["am", "are", "is", "was", "were"]),) as Box<dyn Expr>,- Box::new(WordSet::new(&[+ Box::new(WordSet::new(["i'm", "we're", "you're", "he's", "she's", "it's", "they're",])),]),diff --git a/harper-core/src/expr/sequence_expr.rs b/harper-core/src/expr/sequence_expr.rsindex eb9b3ded2..85aabd143 100644--- a/harper-core/src/expr/sequence_expr.rs+++ b/harper-core/src/expr/sequence_expr.rs@@ -111,7 +111,11 @@ impl SequenceExpr {}/// Match any word from the given set of words, case-insensitive.- pub fn word_set(words: &'static [&'static str]) -> Self {+ pub fn word_set<I, S>(words: I) -> Self+ where+ I: IntoIterator<Item = S>,+ S: AsRef<str>,+ {Self::default().then_word_set(words)}@@ -210,12 +214,20 @@ impl SequenceExpr {}/// Pushes an expression that will match any word from the given set of words, case-insensitive.- pub fn then_word_set(self, words: &'static [&'static str]) -> Self {+ pub fn then_word_set<I, S>(self, words: I) -> Self+ where+ I: IntoIterator<Item = S>,+ S: AsRef<str>,+ {self.then(WordSet::new(words))}/// Shorthand for [`Self::then_word_set`].- pub fn t_set(self, words: &'static [&'static str]) -> Self {+ pub fn t_set<I, S>(self, words: I) -> Self+ where+ I: IntoIterator<Item = S>,+ S: AsRef<str>,+ {self.then_word_set(words)}diff --git a/harper-core/src/expr/spelled_number_expr.rs b/harper-core/src/expr/spelled_number_expr.rsindex dcff85714..07769a94b 100644--- a/harper-core/src/expr/spelled_number_expr.rs+++ b/harper-core/src/expr/spelled_number_expr.rs@@ -42,7 +42,7 @@ impl Expr for SpelledNumberExpr {];let single_words = WordSet::new(- &units+ units.iter().chain(teens.iter()).chain(tens.iter())diff --git a/harper-core/src/expr/time_unit_expr.rs b/harper-core/src/expr/time_unit_expr.rsindex dfdbebdbe..01db471de 100644--- a/harper-core/src/expr/time_unit_expr.rs+++ b/harper-core/src/expr/time_unit_expr.rs@@ -31,7 +31,7 @@ impl Expr for TimeUnitExpr {return None;}- let units_definite_singular = WordSet::new(&[+ let units_definite_singular = WordSet::new(["microsecond","millisecond","second",@@ -44,7 +44,7 @@ impl Expr for TimeUnitExpr {"decade",]);- let units_definite_plural = WordSet::new(&[+ let units_definite_plural = WordSet::new(["microseconds","milliseconds","seconds",@@ -57,7 +57,7 @@ impl Expr for TimeUnitExpr {"decades",]);- let units_definite_apos = WordSet::new(&[+ let units_definite_apos = WordSet::new(["microsecond's","millisecond's","second's",@@ -71,11 +71,11 @@ impl Expr for TimeUnitExpr {]);// ms- let units_definite_abbrev = WordSet::new(&["ms"]);+ let units_definite_abbrev = WordSet::new(["ms"]);- let units_other_singular = WordSet::new(&["moment", "night", "weekend"]);- let units_other_plural = WordSet::new(&["moments", "nights", "weekends"]);- let units_other_apos = WordSet::new(&["moment's", "night's", "weekend's"]);+ let units_other_singular = WordSet::new(["moment", "night", "weekend"]);+ let units_other_plural = WordSet::new(["moments", "nights", "weekends"]);+ let units_other_apos = WordSet::new(["moment's", "night's", "weekend's"]);let units = if self.include_plurals_only {LongestMatchOf::new([diff --git a/harper-core/src/linting/a_ways_to_go.rs b/harper-core/src/linting/a_ways_to_go.rsindex e08e49684..b5290bdd0 100644--- a/harper-core/src/linting/a_ways_to_go.rs+++ b/harper-core/src/linting/a_ways_to_go.rs@@ -16,7 +16,7 @@ impl Default for AWaysToGo {let prolog = SequenceExpr::aco("still").t_ws();let core = Lrc::new(- SequenceExpr::word_set(&["have", "had", "has", "having"])+ SequenceExpr::word_set(["have", "had", "has", "having"]).t_ws().then_word_seq(&["ways", "to", "go"]),);@@ -24,7 +24,7 @@ impl Default for AWaysToGo {let epilog = FirstMatchOf::new([Box::new(AnchorEnd) as Box<dyn Expr>,Box::new(SequenceExpr::whitespace().then_any_of([- Box::new(SequenceExpr::word_set(&["before", "but", "though"])),+ Box::new(SequenceExpr::word_set(["before", "but", "though"])),Box::new(SequenceExpr::word_seq(&["in", "order", "to"])),Box::new(SequenceExpr::word_seq(&["to", "be"])),])),diff --git a/harper-core/src/linting/accuse_of.rs b/harper-core/src/linting/accuse_of.rsindex c27cefca8..04cfdd7dd 100644--- a/harper-core/src/linting/accuse_of.rs+++ b/harper-core/src/linting/accuse_of.rs@@ -12,7 +12,7 @@ impl Default for AccuseOf {fn default() -> Self {Self {expr: SequenceExpr::optional(SequenceExpr::any_word().t_ws())- .t_set(&["accuse", "accused", "accuses", "accusing"])+ .t_set(["accuse", "accused", "accuses", "accusing"]).then_optional(SequenceExpr::whitespace().then_object_pronoun()).t_ws().t_aco("for")diff --git a/harper-core/src/linting/adjective_double_degree.rs b/harper-core/src/linting/adjective_double_degree.rsindex 52c8e765b..cc9b1bd97 100644--- a/harper-core/src/linting/adjective_double_degree.rs+++ b/harper-core/src/linting/adjective_double_degree.rs@@ -12,7 +12,7 @@ pub struct AdjectiveDoubleDegree {impl Default for AdjectiveDoubleDegree {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["more", "most"])+ expr: SequenceExpr::word_set(["more", "most"]).t_ws().then_kind_where(|kind| {kind.is_comparative_adjective() || kind.is_superlative_adjective()diff --git a/harper-core/src/linting/after_later.rs b/harper-core/src/linting/after_later.rsindex 0e69b0098..c6cd6375e 100644--- a/harper-core/src/linting/after_later.rs+++ b/harper-core/src/linting/after_later.rs@@ -14,7 +14,7 @@ impl Default for AfterLater {expr: SequenceExpr::aco("after").t_ws().then_optional(- SequenceExpr::word_set(&[+ SequenceExpr::word_set(["about","almost","approximately",diff --git a/harper-core/src/linting/all_hell_break_loose.rs b/harper-core/src/linting/all_hell_break_loose.rsindex 424eed9f0..3d32b0e58 100644--- a/harper-core/src/linting/all_hell_break_loose.rs+++ b/harper-core/src/linting/all_hell_break_loose.rs@@ -13,7 +13,7 @@ impl Default for AllHellBreakLoose {Self {expr: SequenceExpr::word_seq(&["all", "hell"]).t_ws()- .then_word_set(&["break", "breaking", "breaks", "broke", "broken"])+ .then_word_set(["break", "breaking", "breaks", "broke", "broken"]).t_ws().t_aco("out"),}diff --git a/harper-core/src/linting/all_intents_and_purposes.rs b/harper-core/src/linting/all_intents_and_purposes.rsindex c467d15dc..10de88b47 100644--- a/harper-core/src/linting/all_intents_and_purposes.rs+++ b/harper-core/src/linting/all_intents_and_purposes.rs@@ -19,14 +19,14 @@ impl Default for AllIntentsAndPurposes {.t_ws().then_any_of(vec![Box::new(- SequenceExpr::word_set(&[+ SequenceExpr::word_set(["intents", // Correct, as long as it follows "for" or "to""extents", "intense", // Incorrect, no matter the preposition]).t_ws().t_aco("and"),),- Box::new(SequenceExpr::word_set(&[+ Box::new(SequenceExpr::word_set(["intended","intense","intensive",diff --git a/harper-core/src/linting/allow_to.rs b/harper-core/src/linting/allow_to.rsindex 59b5be822..ad29dab6c 100644--- a/harper-core/src/linting/allow_to.rs+++ b/harper-core/src/linting/allow_to.rs@@ -12,7 +12,7 @@ impl Default for AllowTo {fn default() -> Self {Self {// Note: Does not include "allowed to", which is a legitimate usage in its own right.- exp: SequenceExpr::word_set(&["allow", "allowing", "allows"])+ exp: SequenceExpr::word_set(["allow", "allowing", "allows"]).t_ws().t_aco("to").then_optional(SequenceExpr::default().t_ws().then_adverb())diff --git a/harper-core/src/linting/am_in_the_morning.rs b/harper-core/src/linting/am_in_the_morning.rsindex d27020fb1..d55cf5d40 100644--- a/harper-core/src/linting/am_in_the_morning.rs+++ b/harper-core/src/linting/am_in_the_morning.rs@@ -12,8 +12,8 @@ pub struct AmInTheMorning {impl Default for AmInTheMorning {fn default() -> Self {- let am = WordSet::new(&["am", "a.m."]);- let pm = WordSet::new(&["pm", "p.m."]);+ let am = WordSet::new(["am", "a.m."]);+ let pm = WordSet::new(["pm", "p.m."]);let maybe_ws_am = LongestMatchOf::new(vec![Box::new(SequenceExpr::with(am.clone())),@@ -24,7 +24,7 @@ impl Default for AmInTheMorning {Box::new(SequenceExpr::whitespace().then(pm)),]);- let ws_in_periods = SequenceExpr::fixed_phrase(" in the ").then_word_set(&[+ let ws_in_periods = SequenceExpr::fixed_phrase(" in the ").then_word_set(["morning","afternoon","evening",diff --git a/harper-core/src/linting/amounts_for.rs b/harper-core/src/linting/amounts_for.rsindex 25732b4b2..8083a1f1c 100644--- a/harper-core/src/linting/amounts_for.rs+++ b/harper-core/src/linting/amounts_for.rs@@ -12,13 +12,13 @@ pub struct AmountsFor {impl Default for AmountsFor {fn default() -> Self {- let singular_context = WordSet::new(&["that", "which", "it", "this"]);+ let singular_context = WordSet::new(["that", "which", "it", "this"]);let singular_pattern = SequenceExpr::with(singular_context).then_whitespace().then_fixed_phrase("amounts for");- let singular_context = WordSet::new(&[+ let singular_context = WordSet::new(["they", "can", "could", "may", "might", "must", "should", "will", "would",]);diff --git a/harper-core/src/linting/analog_acoustic_bike.rs b/harper-core/src/linting/analog_acoustic_bike.rsindex 62aac6adf..edfc92ccd 100644--- a/harper-core/src/linting/analog_acoustic_bike.rs+++ b/harper-core/src/linting/analog_acoustic_bike.rs@@ -13,9 +13,9 @@ pub struct AnalogAcousticBike {impl AnalogAcousticBike {pub fn new(dialect: Dialect) -> Self {let expr = SequenceExpr::optional(SequenceExpr::with(IndefiniteArticle::default()).t_ws())- .t_set(&["acoustic", "analog", "analogue"])+ .t_set(["acoustic", "analog", "analogue"]).t_ws()- .t_set(&["bike", "bikes", "bicycle", "bicycles"]);+ .t_set(["bike", "bikes", "bicycle", "bicycles"]);Self { expr, dialect }}diff --git a/harper-core/src/linting/and_the_like.rs b/harper-core/src/linting/and_the_like.rsindex 968f92231..b7c86eb51 100644--- a/harper-core/src/linting/and_the_like.rs+++ b/harper-core/src/linting/and_the_like.rs@@ -15,17 +15,17 @@ impl Default for AndTheLike {expr: All::new(vec![Box::new(// All known variants seen in the wild, good and bad- SequenceExpr::word_set(&["and", "or", "an"])+ SequenceExpr::word_set(["and", "or", "an"]).t_ws().then_optional(SequenceExpr::aco("the").t_ws())- .then_word_set(&["alike", "alikes", "like", "likes"]),+ .then_word_set(["alike", "alikes", "like", "likes"]),),Box::new(SequenceExpr::unless(- SequenceExpr::word_set(&["and", "or"]).t_ws().then_any_of([+ SequenceExpr::word_set(["and", "or"]).t_ws().then_any_of([// But not the correct variantsBox::new(FixedPhrase::from_phrase("the like")) as Box<dyn Expr>,// And not the phrases that were coincidentally caught in the net- Box::new(WordSet::new(&["like", "likes"])),+ Box::new(WordSet::new(["like", "likes"])),]),)),]),diff --git a/harper-core/src/linting/another_thing_coming.rs b/harper-core/src/linting/another_thing_coming.rsindex 06e5d867e..fa19a9972 100644--- a/harper-core/src/linting/another_thing_coming.rs+++ b/harper-core/src/linting/another_thing_coming.rs@@ -13,7 +13,7 @@ pub struct AnotherThingComing {impl Default for AnotherThingComing {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["had", "has", "have", "got"])+ expr: SequenceExpr::word_set(["had", "has", "have", "got"]).then_fixed_phrase(" another think coming"),}}diff --git a/harper-core/src/linting/another_think_coming.rs b/harper-core/src/linting/another_think_coming.rsindex 9fbd4d0f1..0909379c9 100644--- a/harper-core/src/linting/another_think_coming.rs+++ b/harper-core/src/linting/another_think_coming.rs@@ -13,7 +13,7 @@ pub struct AnotherThinkComing {impl Default for AnotherThinkComing {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["had", "has", "have", "got"])+ expr: SequenceExpr::word_set(["had", "has", "have", "got"]).then_fixed_phrase(" another thing coming"),}}diff --git a/harper-core/src/linting/arrive_to.rs b/harper-core/src/linting/arrive_to.rsindex 3c4fcc2f6..afded0b94 100644--- a/harper-core/src/linting/arrive_to.rs+++ b/harper-core/src/linting/arrive_to.rs@@ -11,7 +11,7 @@ pub struct ArriveTo {impl Default for ArriveTo {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["arrive", "arrived", "arrives", "arriving"])+ expr: SequenceExpr::word_set(["arrive", "arrived", "arrives", "arriving"]).t_ws().t_aco("to").but_not(diff --git a/harper-core/src/linting/as_to_interrogative.rs b/harper-core/src/linting/as_to_interrogative.rsindex be2d5e890..8dde8d28b 100644--- a/harper-core/src/linting/as_to_interrogative.rs+++ b/harper-core/src/linting/as_to_interrogative.rs@@ -11,11 +11,11 @@ pub struct AsToInterrogative {impl Default for AsToInterrogative {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["curious", "unsure"])+ expr: SequenceExpr::word_set(["curious", "unsure"]).t_ws().t_aco("to").t_ws()- .t_set(&[+ .t_set(["how", "what", "what's", "which", "when", "when's", "where", "whether", "who","who's", "whose", "whom", "why",])@@ -27,7 +27,7 @@ impl Default for AsToInterrogative {.t_any().t_ws()// "Extend" would be a mistake here, but a common and unrelated mistake.- .t_set(&["degree", "extent", "extend"]),+ .t_set(["degree", "extent", "extend"]),),}}diff --git a/harper-core/src/linting/ask_no_preposition.rs b/harper-core/src/linting/ask_no_preposition.rsindex 3e08cbcd0..fe37e44c5 100644--- a/harper-core/src/linting/ask_no_preposition.rs+++ b/harper-core/src/linting/ask_no_preposition.rs@@ -13,11 +13,11 @@ pub struct AskNoPreposition {impl Default for AskNoPreposition {fn default() -> Self {- let verbs = WordSet::new(&[+ let verbs = WordSet::new(["ask", "asks", "asked", "asking", "tell", "tells", "told", "telling",]);- let objs = WordSet::new(&["me", "you", "him", "her", "it", "us", "them", "one"]);+ let objs = WordSet::new(["me", "you", "him", "her", "it", "us", "them", "one"]);let pattern = SequenceExpr::with(verbs).then_whitespace()diff --git a/harper-core/src/linting/aspire_to.rs b/harper-core/src/linting/aspire_to.rsindex 5eed71fd5..75a1c0bf9 100644--- a/harper-core/src/linting/aspire_to.rs+++ b/harper-core/src/linting/aspire_to.rs@@ -14,7 +14,7 @@ pub struct AspireTo {impl Default for AspireTo {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["aspire", "aspired", "aspires", "aspiring"])+ expr: SequenceExpr::word_set(["aspire", "aspired", "aspires", "aspiring"]).t_ws().t_aco("for"),}diff --git a/harper-core/src/linting/avoid_contractions.rs b/harper-core/src/linting/avoid_contractions.rsindex d12bf1138..94194599f 100644--- a/harper-core/src/linting/avoid_contractions.rs+++ b/harper-core/src/linting/avoid_contractions.rs@@ -11,7 +11,7 @@ pub struct AvoidContractions {impl Default for AvoidContractions {fn default() -> Self {Self {- expr: WordSet::new(&[+ expr: WordSet::new(["aren't","can't","could've",diff --git a/harper-core/src/linting/back_in_the_day.rs b/harper-core/src/linting/back_in_the_day.rsindex f5dd2e70c..35b2c3bf8 100644--- a/harper-core/src/linting/back_in_the_day.rs+++ b/harper-core/src/linting/back_in_the_day.rs@@ -19,7 +19,7 @@ pub struct BackInTheDay {impl Default for BackInTheDay {fn default() -> Self {- let exceptions = Lrc::new(WordSet::new(&["before", "of", "when"]));+ let exceptions = Lrc::new(WordSet::new(["before", "of", "when"]));let phrase = Lrc::new(FixedPhrase::from_phrase("back in the days"));let pattern = SequenceExpr::with(phrase.clone())diff --git a/harper-core/src/linting/be_adjective_confusions.rs b/harper-core/src/linting/be_adjective_confusions.rsindex d2b5e9359..52882c83c 100644--- a/harper-core/src/linting/be_adjective_confusions.rs+++ b/harper-core/src/linting/be_adjective_confusions.rs@@ -31,9 +31,9 @@ impl BeAdjectiveLinter {SequenceExpr::default().then_subject_pronoun().t_ws()- .t_set(&["am", "are", "is", "was", "were"]),+ .t_set(["am", "are", "is", "was", "were"]),) as Box<dyn Expr>,- Box::new(WordSet::new(&[+ Box::new(WordSet::new([// Correct contractions"i'm", "we're", "you're", "he's", "she's", "they're",// Incorrect contractions missing their apostrophes that should not cause problemsdiff --git a/harper-core/src/linting/be_allowed.rs b/harper-core/src/linting/be_allowed.rsindex f2ffd91ca..66f4d6790 100644--- a/harper-core/src/linting/be_allowed.rs+++ b/harper-core/src/linting/be_allowed.rs@@ -17,7 +17,7 @@ impl Default for BeAllowed {SequenceExpr::default().t_aco("will").t_ws()- .then_word_set(&["not"])+ .then_word_set(["not"]).t_ws().t_aco("allowed").t_ws()diff --git a/harper-core/src/linting/best_of_all_time.rs b/harper-core/src/linting/best_of_all_time.rsindex 0d8854865..cc3488212 100644--- a/harper-core/src/linting/best_of_all_time.rs+++ b/harper-core/src/linting/best_of_all_time.rs@@ -16,7 +16,7 @@ impl Default for BestOfAllTime {.t_ws().then_positive_adjective();// Some resources call 'favourite' an 'absolute adjective', some consider it a superlative.- let fave_or_top = SequenceExpr::word_set(&["favorite", "favourite", "top"]);+ let fave_or_top = SequenceExpr::word_set(["favorite", "favourite", "top"]);// We can't use the noun phrase Expr because it allows determiners before the nouns and "best the thing" wouldn't be rightlet expr = SequenceExpr::any_of(vec![diff --git a/harper-core/src/linting/brand_brandish.rs b/harper-core/src/linting/brand_brandish.rsindex acba68c05..b3394280c 100644--- a/harper-core/src/linting/brand_brandish.rs+++ b/harper-core/src/linting/brand_brandish.rs@@ -11,7 +11,7 @@ pub struct BrandBrandish {impl Default for BrandBrandish {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["brandish", "brandished", "brandishes", "brandishing"])+ expr: SequenceExpr::word_set(["brandish", "brandished", "brandishes", "brandishing"]).t_ws()// "her" is also a possessive determiner as in "she brandished her sword"// "it" and "them" can refer to objects as in "draw your sword(s) and brandish it/them"diff --git a/harper-core/src/linting/by_accident.rs b/harper-core/src/linting/by_accident.rsindex d22221e45..25dfdc788 100644--- a/harper-core/src/linting/by_accident.rs+++ b/harper-core/src/linting/by_accident.rs@@ -14,7 +14,7 @@ impl Default for ByAccident {expr: SequenceExpr::aco("on").t_ws().then_optional(- SequenceExpr::word_set(&[+ SequenceExpr::word_set(["complete", "happy", "literal", "mere", "pure", "sheer", "total",]).t_ws(),diff --git a/harper-core/src/linting/by_the_book.rs b/harper-core/src/linting/by_the_book.rsindex 5aa3d283a..51d872deb 100644--- a/harper-core/src/linting/by_the_book.rs+++ b/harper-core/src/linting/by_the_book.rs@@ -15,7 +15,7 @@ pub struct ByTheBook {impl Default for ByTheBook {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set(["all","done","everything",diff --git a/harper-core/src/linting/call_it_quits.rs b/harper-core/src/linting/call_it_quits.rsindex 8cd45ff18..75ac59e14 100644--- a/harper-core/src/linting/call_it_quits.rs+++ b/harper-core/src/linting/call_it_quits.rs@@ -14,7 +14,7 @@ pub struct CallItQuits {impl Default for CallItQuits {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["call", "calls", "called", "calling"])+ expr: SequenceExpr::word_set(["call", "calls", "called", "calling"]).t_ws().t_aco("it").t_ws()diff --git a/harper-core/src/linting/call_them.rs b/harper-core/src/linting/call_them.rsindex de5e3e4a0..da2d98e53 100644--- a/harper-core/src/linting/call_them.rs+++ b/harper-core/src/linting/call_them.rs@@ -16,7 +16,7 @@ impl Default for CallThem {fn default() -> Self {let mut map = ExprMap::default();- let post_exception = Lrc::new(SequenceExpr::default().t_ws().then_word_set(&["if", "it"]));+ let post_exception = Lrc::new(SequenceExpr::default().t_ws().then_word_set(["if", "it"]));map.insert(SequenceExpr::with(DerivedFrom::new_from_str("call"))diff --git a/harper-core/src/linting/catch_22.rs b/harper-core/src/linting/catch_22.rsindex f3a79bab5..40f60fbee 100644--- a/harper-core/src/linting/catch_22.rs+++ b/harper-core/src/linting/catch_22.rs@@ -12,7 +12,7 @@ pub struct Catch22 {impl Default for Catch22 {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["cache", "cash"]).then_any_of(vec![+ expr: SequenceExpr::word_set(["cache", "cash"]).then_any_of(vec![Box::new(SequenceExpr::default().t_ws_h()diff --git a/harper-core/src/linting/cautionary_tale.rs b/harper-core/src/linting/cautionary_tale.rsindex 3aa0bd5fd..b90e683c4 100644--- a/harper-core/src/linting/cautionary_tale.rs+++ b/harper-core/src/linting/cautionary_tale.rs@@ -14,7 +14,7 @@ pub struct CautionaryTale {impl Default for CautionaryTale {fn default() -> Self {- let adjectives = WordSet::new(&["cautionary", "inspirational"]);+ let adjectives = WordSet::new(["cautionary", "inspirational"]);let pattern = SequenceExpr::with(adjectives).t_ws().t_aco("tail");diff --git a/harper-core/src/linting/cease_to.rs b/harper-core/src/linting/cease_to.rsindex a22e58a6e..0641415fe 100644--- a/harper-core/src/linting/cease_to.rs+++ b/harper-core/src/linting/cease_to.rs@@ -11,7 +11,7 @@ pub struct CeaseTo {impl Default for CeaseTo {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set(["seize", "seized", "seizes", "seizing", "sieze", "siezed", "siezes", "siezing",]).t_ws()diff --git a/harper-core/src/linting/claim_to_fame.rs b/harper-core/src/linting/claim_to_fame.rsindex c1a245a79..da9e09d29 100644--- a/harper-core/src/linting/claim_to_fame.rs+++ b/harper-core/src/linting/claim_to_fame.rs@@ -13,7 +13,7 @@ pub struct ClaimToFame {impl Default for ClaimToFame {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["claim", "claims"])+ expr: SequenceExpr::word_set(["claim", "claims"]).t_ws().then_word_seq(&["for", "fame"]),}diff --git a/harper-core/src/linting/close_tight_knit.rs b/harper-core/src/linting/close_tight_knit.rsindex f3850af5a..07a5a282b 100644--- a/harper-core/src/linting/close_tight_knit.rs+++ b/harper-core/src/linting/close_tight_knit.rs@@ -11,7 +11,7 @@ pub struct CloseTightKnit {impl Default for CloseTightKnit {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["close", "closely", "tight", "tightly"])+ expr: SequenceExpr::word_set(["close", "closely", "tight", "tightly"]).t_ws_h().t_aco("nit"),}diff --git a/harper-core/src/linting/code_in_write_in.rs b/harper-core/src/linting/code_in_write_in.rsindex 1d84a700e..17bb16158 100644--- a/harper-core/src/linting/code_in_write_in.rs+++ b/harper-core/src/linting/code_in_write_in.rs@@ -11,7 +11,7 @@ pub struct CodeInWriteIn {impl Default for CodeInWriteIn {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set([// "code" produces too many false positives"coded","codes",@@ -28,7 +28,7 @@ impl Default for CodeInWriteIn {.t_ws().t_aco("on").t_ws()- .then_word_set(&[+ .then_word_set(["ada","asm","assembler",diff --git a/harper-core/src/linting/complain_as_noun.rs b/harper-core/src/linting/complain_as_noun.rsindex be54f535f..3aef72c3d 100644--- a/harper-core/src/linting/complain_as_noun.rs+++ b/harper-core/src/linting/complain_as_noun.rs@@ -14,7 +14,7 @@ impl Default for ComplainAsNoun {expr: SequenceExpr::default().then_determiner().t_ws()- .t_set(&["complain", "complains"])+ .t_set(["complain", "complains"]).but_not(SequenceExpr::anything().t_any().t_any().t_ws().then_noun()),}}diff --git a/harper-core/src/linting/convenient_store.rs b/harper-core/src/linting/convenient_store.rsindex 5265ca25b..7ffc5a6f7 100644--- a/harper-core/src/linting/convenient_store.rs+++ b/harper-core/src/linting/convenient_store.rs@@ -102,7 +102,7 @@ impl Default for ConvenientStore {Self {expr: SequenceExpr::aco("convenient").t_ws()- .t_set(&["store", "stores"]),+ .t_set(["store", "stores"]),}}}diff --git a/harper-core/src/linting/crave_for.rs b/harper-core/src/linting/crave_for.rsindex 3cd7df98e..0db00380a 100644--- a/harper-core/src/linting/crave_for.rs+++ b/harper-core/src/linting/crave_for.rs@@ -14,14 +14,14 @@ impl Default for CraveFor {Self {expr: FirstMatchOf::new([Box::new(- SequenceExpr::word_set(&["crave", "craved", "craves"])+ SequenceExpr::word_set(["crave", "craved", "craves"]).t_ws().t_aco("for"),) as Box<dyn Expr>,Box::new(SequenceExpr::any_of([Box::new(InflectionOfBe::default()) as Box<dyn Expr>,- Box::new(WordSet::new(&[+ Box::new(WordSet::new(["i'm", "we're", "you're", "he's", "she's", "it's", "they're",])),])diff --git a/harper-core/src/linting/criteria_phenomena/singular_criteria_phenomena.rs b/harper-core/src/linting/criteria_phenomena/singular_criteria_phenomena.rsindex d27975422..8e8a3a3a0 100644--- a/harper-core/src/linting/criteria_phenomena/singular_criteria_phenomena.rs+++ b/harper-core/src/linting/criteria_phenomena/singular_criteria_phenomena.rs@@ -16,9 +16,9 @@ pub struct SingularCriteriaPhenomena {impl SingularCriteriaPhenomena {fn new() -> Self {- let plural_words = Lrc::new(WordSet::new(&["criteria", "phenomena"]));+ let plural_words = Lrc::new(WordSet::new(["criteria", "phenomena"]));- let singular_modifiers = Lrc::new(WordSet::new(&["this", "that", "a", "one"]));+ let singular_modifiers = Lrc::new(WordSet::new(["this", "that", "a", "one"]));Self {expr: SequenceExpr::with(singular_modifiers.clone())diff --git a/harper-core/src/linting/damages.rs b/harper-core/src/linting/damages.rsindex be74e3420..78fd8c1b9 100644--- a/harper-core/src/linting/damages.rs+++ b/harper-core/src/linting/damages.rs@@ -26,7 +26,7 @@ pub struct Damages {impl Default for Damages {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["damages", "damage"]),+ expr: SequenceExpr::word_set(["damages", "damage"]),}}}@@ -115,7 +115,7 @@ impl ExprLinter for Damages {// Or it could be a noun. Or it could still be unknown.// Check if it's the object of the verb "to pay"- let pay_det = SequenceExpr::word_set(&["paid", "pay", "paying", "pays"])+ let pay_det = SequenceExpr::word_set(["paid", "pay", "paying", "pays"]).then_optional(SequenceExpr::default().t_ws().then_determiner()).t_ws();diff --git a/harper-core/src/linting/day_and_age.rs b/harper-core/src/linting/day_and_age.rsindex 5f0619a92..f4e14c5a3 100644--- a/harper-core/src/linting/day_and_age.rs+++ b/harper-core/src/linting/day_and_age.rs@@ -11,13 +11,13 @@ pub struct DayAndAge {impl Default for DayAndAge {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["this", "these"])+ expr: SequenceExpr::word_set(["this", "these"]).t_ws()- .then_word_set(&["day", "days"])+ .then_word_set(["day", "days"]).t_ws()- .then_word_set(&["and", "in", "an", "on", "of"])+ .then_word_set(["and", "in", "an", "on", "of"]).t_ws()- .then_word_set(&["age", "ages"]),+ .then_word_set(["age", "ages"]),}}}diff --git a/harper-core/src/linting/despite_it_is.rs b/harper-core/src/linting/despite_it_is.rsindex 2217ff646..fffdae13f 100644--- a/harper-core/src/linting/despite_it_is.rs+++ b/harper-core/src/linting/despite_it_is.rs@@ -25,7 +25,7 @@ pub struct DespiteItIs {impl Default for DespiteItIs {fn default() -> Self {let subj = SequenceExpr::default().then_subject_pronoun();- let be = WordSet::new(&["am", "are", "is", "was", "were"]);+ let be = WordSet::new(["am", "are", "is", "was", "were"]);let expr = SequenceExpr::aco("despite").t_ws()diff --git a/harper-core/src/linting/did_past.rs b/harper-core/src/linting/did_past.rsindex 848c04ec8..06e968269 100644--- a/harper-core/src/linting/did_past.rs+++ b/harper-core/src/linting/did_past.rs@@ -17,7 +17,7 @@ impl<D: Dictionary> DidPast<D> {pub fn new(dict: D) -> Self {Self {expr: SequenceExpr::longest_of([- Box::new(WordSet::new(&["did", "didn't", "didnt"])) as Box<dyn Expr>,+ Box::new(WordSet::new(["did", "didn't", "didnt"])) as Box<dyn Expr>,Box::new(FixedPhrase::from_phrase("did not")),]).then_optional(SequenceExpr::default().t_ws().then_subject_pronoun())diff --git a/harper-core/src/linting/dig_under_the_hood.rs b/harper-core/src/linting/dig_under_the_hood.rsindex f7b1cdd57..7d07729a0 100644--- a/harper-core/src/linting/dig_under_the_hood.rs+++ b/harper-core/src/linting/dig_under_the_hood.rs@@ -11,11 +11,11 @@ pub struct DigUnderTheHood {impl Default for DigUnderTheHood {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["dig", "digging", "digs", "dug"])+ expr: SequenceExpr::word_set(["dig", "digging", "digs", "dug"]).t_ws().then_word_seq(&["under", "the"]).t_ws()- .t_set(&["hood", "bonnet"]),+ .t_set(["hood", "bonnet"]),}}}diff --git a/harper-core/src/linting/disjoint_prefixes.rs b/harper-core/src/linting/disjoint_prefixes.rsindex 8564488dc..79ec55415 100644--- a/harper-core/src/linting/disjoint_prefixes.rs+++ b/harper-core/src/linting/disjoint_prefixes.rs@@ -19,7 +19,7 @@ const UP_EXCEPTIONS: &[&str] = &["loading", "right", "state", "time", "trend"];impl<D: Dictionary> DisjointPrefixes<D> {pub fn new(dict: D) -> Self {Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set([// These prefixes rarely cause false positives"anti", "auto", "bi", "counter", "de", "dis", "extra", "fore", "hyper", "il", "im","inter", "ir", "macro", "mal", "micro", "mid", "mini", "mis", "mono", "multi",@@ -42,7 +42,7 @@ impl<D: Dictionary> DisjointPrefixes<D> {// No trailing hyphen. Ex: Custom patterns take precedence over built-in patterns -> overbuiltBox::new(SequenceExpr::anything().t_any().t_any().then_hyphen()),// Don't merge "co op" whether separated by space or hyphen.- Box::new(SequenceExpr::aco("co").t_any().t_set(&["op", "ops"])),+ Box::new(SequenceExpr::aco("co").t_any().t_set(["op", "ops"])),// Merge these if they're separated by hyphen, but not space.Box::new(SequenceExpr::aco("out").t_ws().t_set(OUT_EXCEPTIONS)),Box::new(SequenceExpr::aco("over").t_ws().t_set(OVER_EXCEPTIONS)),diff --git a/harper-core/src/linting/dissemble_disassemble.rs b/harper-core/src/linting/dissemble_disassemble.rsindex cf56a5e04..83bde6fc7 100644--- a/harper-core/src/linting/dissemble_disassemble.rs+++ b/harper-core/src/linting/dissemble_disassemble.rs@@ -134,7 +134,7 @@ pub struct DissembleDisassemble {impl Default for DissembleDisassemble {fn default() -> Self {Self {- expr: WordSet::new(&[+ expr: WordSet::new(["dissemble","dissembled","dissembles",diff --git a/harper-core/src/linting/do_mistake.rs b/harper-core/src/linting/do_mistake.rsindex 322f429f7..415044a3d 100644--- a/harper-core/src/linting/do_mistake.rs+++ b/harper-core/src/linting/do_mistake.rs@@ -16,10 +16,10 @@ impl Default for DoMistake {fn default() -> Self {Self {expr: Box::new(- SequenceExpr::word_set(&["do", "did", "does", "doing", "done"])+ SequenceExpr::word_set(["do", "did", "does", "doing", "done"]).t_ws().then_longest_of([- Box::new(WordSet::new(&[+ Box::new(WordSet::new(["a", "an", "the", "that", "these", "this", "those", "another", "many","several", "some", "my", "our", "your", "his", "her", "its", "their",])) as Box<dyn Expr>,@@ -35,7 +35,7 @@ impl Default for DoMistake {Box::new(FixedPhrase::from_phrase("tonnes of")),]).t_ws()- .then_word_set(&["mistake", "mistakes"]),+ .then_word_set(["mistake", "mistakes"]),),}}diff --git a/harper-core/src/linting/double_click.rs b/harper-core/src/linting/double_click.rsindex 55972e94d..cc750b7a8 100644--- a/harper-core/src/linting/double_click.rs+++ b/harper-core/src/linting/double_click.rs@@ -14,7 +14,7 @@ impl DoubleClick {SequenceExpr::default().t_aco("double").t_ws()- .then_word_set(&["click", "clicked", "clicking", "clicks"])+ .then_word_set(["click", "clicked", "clicking", "clicks"])}}diff --git a/harper-core/src/linting/else_possessive.rs b/harper-core/src/linting/else_possessive.rsindex 3c54b2a43..bbec65084 100644--- a/harper-core/src/linting/else_possessive.rs+++ b/harper-core/src/linting/else_possessive.rs@@ -14,7 +14,7 @@ pub struct ElsePossessive {impl Default for ElsePossessive {fn default() -> Self {- let pronouns = WordSet::new(&[+ let pronouns = WordSet::new(["somebody","someone","anybody",diff --git a/harper-core/src/linting/ever_every.rs b/harper-core/src/linting/ever_every.rsindex 30bb6751a..d74ef1f4b 100644--- a/harper-core/src/linting/ever_every.rs+++ b/harper-core/src/linting/ever_every.rs@@ -13,7 +13,7 @@ impl Default for EverEvery {fn default() -> Self {Self {expr: SequenceExpr::any_of([- Box::new(WordSet::new(&[+ Box::new(WordSet::new(["are", "aren't", "arent", "did", "didn't", "didnt", "do", "does", "doesn't","doesnt", "dont", "don't", "had", "hadn't", "hadnt", "has", "hasn't", "hasnt","have", "haven't", "havent", "is", "isn't", "isnt", "was", "wasn't", "wasnt",diff --git a/harper-core/src/linting/expand_memory_shorthands.rs b/harper-core/src/linting/expand_memory_shorthands.rsindex cc828c81e..9b901d40b 100644--- a/harper-core/src/linting/expand_memory_shorthands.rs+++ b/harper-core/src/linting/expand_memory_shorthands.rs@@ -14,7 +14,7 @@ pub struct ExpandMemoryShorthands {impl ExpandMemoryShorthands {pub fn new() -> Self {- let hotwords = Arc::new(WordSet::new(&[+ let hotwords = Arc::new(WordSet::new(["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB", "RB", "QB", "KiB", "MiB", "GiB","TiB", "PiB", "EiB", "ZiB", "YiB", "RiB", "QiB",]));diff --git a/harper-core/src/linting/expand_time_shorthands.rs b/harper-core/src/linting/expand_time_shorthands.rsindex 99a98a571..ad1f75e85 100644--- a/harper-core/src/linting/expand_time_shorthands.rs+++ b/harper-core/src/linting/expand_time_shorthands.rs@@ -14,7 +14,7 @@ pub struct ExpandTimeShorthands {impl ExpandTimeShorthands {pub fn new() -> Self {- let hotwords = Arc::new(WordSet::new(&[+ let hotwords = Arc::new(WordSet::new(["hr", "hrs", "min", "mins", "sec", "secs", "ms", "msec", "msecs",]));diff --git a/harper-core/src/linting/fall_below.rs b/harper-core/src/linting/fall_below.rsindex c494bd65b..7a32d734c 100644--- a/harper-core/src/linting/fall_below.rs+++ b/harper-core/src/linting/fall_below.rs@@ -15,14 +15,14 @@ pub struct FallBelow {impl Default for FallBelow {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["fall", "fallen", "falling", "falls", "fell"])+ expr: SequenceExpr::word_set(["fall", "fallen", "falling", "falls", "fell"]).t_ws().then_any_of([Box::new(SequenceExpr::number()) as Box<dyn Expr>,Box::new(SpelledNumberExpr),]).t_ws()- .t_set(&["feet", "meters", "metres"])+ .t_set(["feet", "meters", "metres"]).t_ws().t_aco("below").then_any_of(vec![diff --git a/harper-core/src/linting/feel_fell.rs b/harper-core/src/linting/feel_fell.rsindex a3ed698f6..6277250f6 100644--- a/harper-core/src/linting/feel_fell.rs+++ b/harper-core/src/linting/feel_fell.rs@@ -11,26 +11,23 @@ pub struct FeelFell {impl Default for FeelFell {fn default() -> Self {- let with_word_before = SequenceExpr::word_set(&["didn't", "doesn't"])+ let with_word_before = SequenceExpr::word_set(["didn't", "doesn't"]).t_ws().t_aco("fell");- let with_word_after = SequenceExpr::default()- .t_aco("fell")- .t_ws()- .then_word_set(&[- "comfortable",- "free",- "good",- "I",- "I'm",- "it",- "it's",- "like",- "that",- "we",- "you",- ]);+ let with_word_after = SequenceExpr::aco("fell").t_ws().t_set([+ "comfortable",+ "free",+ "good",+ "I",+ "I'm",+ "it",+ "it's",+ "like",+ "that",+ "we",+ "you",+ ]);Self {expr: SequenceExpr::any_of(vec![Box::new(with_word_before), Box::new(with_word_after)]),diff --git a/harper-core/src/linting/fellow_co_redundancy.rs b/harper-core/src/linting/fellow_co_redundancy.rsindex 6bb25a577..8d82a4dc9 100644--- a/harper-core/src/linting/fellow_co_redundancy.rs+++ b/harper-core/src/linting/fellow_co_redundancy.rs@@ -14,7 +14,7 @@ impl Default for FellowCoRedundancy {expr: SequenceExpr::any_capitalization_of("fellow").t_ws().then_any_of(vec![- Box::new(SequenceExpr::aco("co").t_ws_h().t_set(&[+ Box::new(SequenceExpr::aco("co").t_ws_h().t_set(["admin","admins","chair",@@ -40,7 +40,7 @@ impl Default for FellowCoRedundancy {"worker","workers",])),- Box::new(SequenceExpr::word_set(&[+ Box::new(SequenceExpr::word_set(["coadmin","coadmins","cochair",diff --git a/harper-core/src/linting/filler_words.rs b/harper-core/src/linting/filler_words.rsindex d5dd8a7b9..aae4010a8 100644--- a/harper-core/src/linting/filler_words.rs+++ b/harper-core/src/linting/filler_words.rs@@ -13,7 +13,7 @@ pub struct FillerWords {impl Default for FillerWords {// A filler is unlikely to be completely on its own, so check for and remove with whitespace either before or after.fn default() -> Self {- let filler_words = Lrc::new(WordSet::new(&["uh", "um"]));+ let filler_words = Lrc::new(WordSet::new(["uh", "um"]));let pattern = SequenceExpr::any_of(vec![Box::new(SequenceExpr::with(filler_words.clone()).then_whitespace()),diff --git a/harper-core/src/linting/first_aid_kit.rs b/harper-core/src/linting/first_aid_kit.rsindex 65d537e61..add879a34 100644--- a/harper-core/src/linting/first_aid_kit.rs+++ b/harper-core/src/linting/first_aid_kit.rs@@ -13,7 +13,7 @@ pub struct FirstAidKit {impl Default for FirstAidKit {fn default() -> Self {- let supply_words = WordSet::new(&["aid", "starter", "travel", "tool"]);+ let supply_words = WordSet::new(["aid", "starter", "travel", "tool"]);let pattern = SequenceExpr::with(supply_words).then_whitespace().then_any_capitalization_of("kid");diff --git a/harper-core/src/linting/fish_nor_fowl.rs b/harper-core/src/linting/fish_nor_fowl.rsindex 84a88a4a2..ca0e5fbe0 100644--- a/harper-core/src/linting/fish_nor_fowl.rs+++ b/harper-core/src/linting/fish_nor_fowl.rs@@ -11,11 +11,11 @@ pub struct FishNorFowl {impl Default for FishNorFowl {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["neither", "niether"])+ expr: SequenceExpr::word_set(["neither", "niether"]).t_ws().then_word_seq(&["fish", "nor"]).t_ws()- .t_set(&["foul", "bird"]),+ .t_set(["foul", "bird"]),}}}diff --git a/harper-core/src/linting/flesh_out_vs_full_fledged.rs b/harper-core/src/linting/flesh_out_vs_full_fledged.rsindex 7cd102286..049cb5301 100644--- a/harper-core/src/linting/flesh_out_vs_full_fledged.rs+++ b/harper-core/src/linting/flesh_out_vs_full_fledged.rs@@ -11,8 +11,8 @@ pub struct FleshOutVsFullFledged {impl Default for FleshOutVsFullFledged {fn default() -> Self {Self {- expr: SequenceExpr::optional(SequenceExpr::word_set(&["full", "fully"]).t_ws_h())- .then_word_set(&[+ expr: SequenceExpr::optional(SequenceExpr::word_set(["full", "fully"]).t_ws_h())+ .then_word_set(["fledge", "fledged", "fledged", "fledges", "fledging", "flesh", "fleshed","fleshed", "fleshes", "fleshing", "pledge", "pledged", "pledged", "pledges","pledging",diff --git a/harper-core/src/linting/for_the_nth_time.rs b/harper-core/src/linting/for_the_nth_time.rsindex 4760a5463..f77f87f77 100644--- a/harper-core/src/linting/for_the_nth_time.rs+++ b/harper-core/src/linting/for_the_nth_time.rs@@ -13,7 +13,7 @@ impl Default for ForTheNthTime {Self {expr: SequenceExpr::aco("for").t_ws()- .t_set(&[+ .t_set(["first","second","third",@@ -59,7 +59,7 @@ impl Default for ForTheNthTime {// .then(AnchorEnd),.then_any_of([Box::new(AnchorEnd) as Box<dyn Expr>,- Box::new(SequenceExpr::whitespace().t_set(&["and", "but"])),+ Box::new(SequenceExpr::whitespace().t_set(["and", "but"])),]),}}diff --git a/harper-core/src/linting/friend_of_me.rs b/harper-core/src/linting/friend_of_me.rsindex 329928fa3..762b4ba88 100644--- a/harper-core/src/linting/friend_of_me.rs+++ b/harper-core/src/linting/friend_of_me.rs@@ -12,7 +12,7 @@ pub struct FriendOfMe {impl Default for FriendOfMe {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["friend", "friends", "enemy", "enemies"])+ expr: SequenceExpr::word_set(["friend", "friends", "enemy", "enemies"]).then_whitespace().t_aco("of").t_ws()diff --git a/harper-core/src/linting/full_to_the_brim.rs b/harper-core/src/linting/full_to_the_brim.rsindex 854e65654..c55ae6027 100644--- a/harper-core/src/linting/full_to_the_brim.rs+++ b/harper-core/src/linting/full_to_the_brim.rs@@ -14,7 +14,7 @@ pub struct FullToTheBrim {impl Default for FullToTheBrim {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["full", "filled"])+ expr: SequenceExpr::word_set(["full", "filled"]).t_ws().then_word_seq(&["to", "the", "brim", "of"]).but_not(diff --git a/harper-core/src/linting/get_pass_go_pass.rs b/harper-core/src/linting/get_pass_go_pass.rsindex f4e1e6fb3..4240ee359 100644--- a/harper-core/src/linting/get_pass_go_pass.rs+++ b/harper-core/src/linting/get_pass_go_pass.rs@@ -11,7 +11,7 @@ pub struct GetPassGoPass {impl Default for GetPassGoPass {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set(["get", "gets", "getting", "got", "gotten", "go", "goes", "going", "gone", "went",]).t_ws()diff --git a/harper-core/src/linting/go_missing.rs b/harper-core/src/linting/go_missing.rsindex adc92992d..26472ebfc 100644--- a/harper-core/src/linting/go_missing.rs+++ b/harper-core/src/linting/go_missing.rs@@ -11,7 +11,7 @@ pub struct GoMissing {impl Default for GoMissing {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["become", "became", "becomes", "becoming"])+ expr: SequenceExpr::word_set(["become", "became", "becomes", "becoming"]).t_ws().t_aco("missing").but_not(SequenceExpr::anything().t_any().t_any().t_ws().then(diff --git a/harper-core/src/linting/go_so_far_as_to.rs b/harper-core/src/linting/go_so_far_as_to.rsindex f2d27c5ba..21465602d 100644--- a/harper-core/src/linting/go_so_far_as_to.rs+++ b/harper-core/src/linting/go_so_far_as_to.rs@@ -12,7 +12,7 @@ pub struct GoSoFarAsTo {impl Default for GoSoFarAsTo {fn default() -> Self {Self {- exp: SequenceExpr::word_set(&["go", "goes", "going", "gone", "went"])+ exp: SequenceExpr::word_set(["go", "goes", "going", "gone", "went"]).then_fixed_phrase(" so far to ").then_optional(SequenceExpr::default().then_adverb().t_ws()).then_any_word(),diff --git a/harper-core/src/linting/go_to_sleep.rs b/harper-core/src/linting/go_to_sleep.rsindex 2b1544c0b..934214572 100644--- a/harper-core/src/linting/go_to_sleep.rs+++ b/harper-core/src/linting/go_to_sleep.rs@@ -12,7 +12,7 @@ pub struct GoToSleep {impl Default for GoToSleep {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["go", "goes", "going", "gone", "went"])+ expr: SequenceExpr::word_set(["go", "goes", "going", "gone", "went"]).t_ws().then_word_seq(&["into", "sleep"]).but_not(@@ -24,16 +24,16 @@ impl Default for GoToSleep {.then_any_of([Box::new(SequenceExpr::whitespace().then_any_of([- Box::new(WordSet::new(&["mode", "state"])) as Box<dyn Expr>,+ Box::new(WordSet::new(["mode", "state"])) as Box<dyn Expr>,Box::new(SequenceExpr::default().then_adjective().t_ws()- .t_set(&["mode", "state"]),+ .t_set(["mode", "state"]),),]),),- Box::new(SequenceExpr::default().then_slash().t_set(&[+ Box::new(SequenceExpr::default().then_slash().t_set(["hibernate","hibernation","suspend",diff --git a/harper-core/src/linting/go_to_war.rs b/harper-core/src/linting/go_to_war.rsindex 6c0683de0..ca4d12155 100644--- a/harper-core/src/linting/go_to_war.rs+++ b/harper-core/src/linting/go_to_war.rs@@ -11,11 +11,11 @@ pub struct GoToWar {impl Default for GoToWar {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["go", "goes", "going", "gone", "went"])+ expr: SequenceExpr::word_set(["go", "goes", "going", "gone", "went"]).t_ws().then_preposition().t_ws()- .then_word_set(&["war"]),+ .then_word_set(["war"]),}}}diff --git a/harper-core/src/linting/good_at.rs b/harper-core/src/linting/good_at.rsindex c3b70e0f1..0c000fc00 100644--- a/harper-core/src/linting/good_at.rs+++ b/harper-core/src/linting/good_at.rs@@ -13,7 +13,7 @@ impl Default for GoodAt {fn default() -> Self {let we_re_not_always_very_good_in_sth = SequenceExpr::any_of([Box::new(InflectionOfBe::default()) as Box<dyn Expr>,- Box::new(WordSet::new(&[+ Box::new(WordSet::new(["I'm", "we're", "you're", "he's", "she's", "it's", "they're", "Im", "were","youre", "your", "hes", "shes", "its", "theyre",])),@@ -22,18 +22,18 @@ impl Default for GoodAt {.then_optional(SequenceExpr::aco("not").t_ws()).then_optional(SequenceExpr::default().then_frequency_adverb().t_ws()).then_optional(SequenceExpr::default().then_degree_adverb().t_ws())- .then_word_set(&["good", "bad", "great", "okay", "OK"])+ .then_word_set(["good", "bad", "great", "okay", "OK"]).t_ws().t_aco("in").t_ws().then_any_word();let good_in_skill_or_subject =- SequenceExpr::word_set(&["good", "bad", "great", "okay", "OK"])+ SequenceExpr::word_set(["good", "bad", "great", "okay", "OK"]).t_ws().t_aco("in").t_ws()- .then_word_set(&[+ .then_word_set([// sciences"biology","chemistry",diff --git a/harper-core/src/linting/have_a_hard_time.rs b/harper-core/src/linting/have_a_hard_time.rsindex c7152cb0f..00b2eb55f 100644--- a/harper-core/src/linting/have_a_hard_time.rs+++ b/harper-core/src/linting/have_a_hard_time.rs@@ -13,8 +13,8 @@ pub struct HaveAHardTime {impl HaveAHardTime {pub fn new(dialect: Dialect) -> Self {Self {- expr: SequenceExpr::word_set(&["have", "had", "has", "having"])- .then_optional(SequenceExpr::whitespace().t_set(&["extremely", "real"]))+ expr: SequenceExpr::word_set(["have", "had", "has", "having"])+ .then_optional(SequenceExpr::whitespace().t_set(["extremely", "real"])).t_ws().then_word_seq(&["hard", "time"]),dialect,diff --git a/harper-core/src/linting/helped_past.rs b/harper-core/src/linting/helped_past.rsindex 545d44b08..4f4fca0cb 100644--- a/harper-core/src/linting/helped_past.rs+++ b/harper-core/src/linting/helped_past.rs@@ -25,7 +25,7 @@ impl<D: Dictionary> HelpedPast<D> {.then_kind_where(|k| {(k.is_verb_simple_past_form() || k.is_verb_past_form()) && !k.is_verb_lemma()})- .but_not(SequenceExpr::anything().t_any().t_set(&["did", "got"])),+ .but_not(SequenceExpr::anything().t_any().t_set(["did", "got"])),dict,}}diff --git a/harper-core/src/linting/hop_hope/to_hop.rs b/harper-core/src/linting/hop_hope/to_hop.rsindex bd01ca998..cc0f2cf3f 100644--- a/harper-core/src/linting/hop_hope/to_hop.rs+++ b/harper-core/src/linting/hop_hope/to_hop.rs@@ -12,13 +12,13 @@ pub struct ToHop {impl Default for ToHop {fn default() -> Self {- let pattern = SequenceExpr::word_set(&["hoping", "hoped", "hope"])+ let pattern = SequenceExpr::word_set(["hoping", "hoped", "hope"]).then_whitespace().t_aco("on").then_whitespace().then_determiner().then_whitespace()- .then_word_set(&["airplane", "plane", "bus", "call", "train"]);+ .then_word_set(["airplane", "plane", "bus", "call", "train"]);Self {expr: Box::new(pattern),diff --git a/harper-core/src/linting/hop_hope/to_hope.rs b/harper-core/src/linting/hop_hope/to_hope.rsindex 3caabc270..d30191702 100644--- a/harper-core/src/linting/hop_hope/to_hope.rs+++ b/harper-core/src/linting/hop_hope/to_hope.rs@@ -14,7 +14,7 @@ impl Default for ToHope {let pattern = SequenceExpr::default().then_nominal().then_whitespace()- .then_word_set(&["hop", "hopped"])+ .then_word_set(["hop", "hopped"]).then_whitespace().then_nominal();diff --git a/harper-core/src/linting/hope_youre.rs b/harper-core/src/linting/hope_youre.rsindex a17f26d4e..c774aa012 100644--- a/harper-core/src/linting/hope_youre.rs+++ b/harper-core/src/linting/hope_youre.rs@@ -12,7 +12,7 @@ pub struct HopeYoure {impl Default for HopeYoure {fn default() -> Self {- let loc = WordSet::new(&["here", "there"]);+ let loc = WordSet::new(["here", "there"]);let prep = SequenceExpr::default().t_ws().then_preposition();diff --git a/harper-core/src/linting/how_does_compared.rs b/harper-core/src/linting/how_does_compared.rsindex 3fbf7d6e8..c64a4fa5d 100644--- a/harper-core/src/linting/how_does_compared.rs+++ b/harper-core/src/linting/how_does_compared.rs@@ -17,21 +17,21 @@ impl Default for HowDoesCompared {Box::new(SequenceExpr::aco("do").t_ws()- .t_set(&["these", "they", "those"]),+ .t_set(["these", "they", "those"]),) as Box<dyn Expr>,Box::new(SequenceExpr::aco("does").t_ws()- .t_set(&["it", "that", "this"]),+ .t_set(["it", "that", "this"]),),Box::new(SequenceExpr::aco("did").t_ws()- .t_set(&["it", "that", "these", "they", "this", "those"]),+ .t_set(["it", "that", "these", "they", "this", "those"]),),]).t_ws()- .t_set(&["compared", "compares"]),+ .t_set(["compared", "compares"]),}}}diff --git a/harper-core/src/linting/if_wouldve.rs b/harper-core/src/linting/if_wouldve.rsindex 7cc6b3757..4b5ea4d64 100644--- a/harper-core/src/linting/if_wouldve.rs+++ b/harper-core/src/linting/if_wouldve.rs@@ -18,11 +18,11 @@ impl Default for IfWouldve {.t_ws().then_any_of([Box::new(- SequenceExpr::word_set(&["would", "had"])+ SequenceExpr::word_set(["would", "had"]).t_ws()- .then_word_set(&["have", "of"]),+ .then_word_set(["have", "of"]),) as Box<dyn Expr>,- Box::new(WordSet::new(&["would've", "wouldve", "had've", "hadve"])),+ Box::new(WordSet::new(["would've", "wouldve", "had've", "hadve"])),]).t_ws().then_verb_past_participle_form(),diff --git a/harper-core/src/linting/implement_in.rs b/harper-core/src/linting/implement_in.rsindex d9f84e514..d14e02692 100644--- a/harper-core/src/linting/implement_in.rs+++ b/harper-core/src/linting/implement_in.rs@@ -11,7 +11,7 @@ pub struct ImplementIn {impl Default for ImplementIn {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set(["implement","implemented","implementing",diff --git a/harper-core/src/linting/in_demand_in_depth.rs b/harper-core/src/linting/in_demand_in_depth.rsindex b8fdb7ef2..1e029d62c 100644--- a/harper-core/src/linting/in_demand_in_depth.rs+++ b/harper-core/src/linting/in_demand_in_depth.rs@@ -32,7 +32,7 @@ impl Default for InDemandInDepth {.t_ws().t_aco("in").t_ws()- .t_set(&["demand", "depth"]),+ .t_set(["demand", "depth"]),}}}diff --git a/harper-core/src/linting/in_favour_of_doing.rs b/harper-core/src/linting/in_favour_of_doing.rsindex 5da8cfaea..a204c8ea2 100644--- a/harper-core/src/linting/in_favour_of_doing.rs+++ b/harper-core/src/linting/in_favour_of_doing.rs@@ -13,7 +13,7 @@ impl Default for InFavourOfDoing {Self {expr: SequenceExpr::aco("in").t_ws()- .t_set(&["favour", "favor"])+ .t_set(["favour", "favor"]).t_ws().then_verb_progressive_form(),}diff --git a/harper-core/src/linting/in_on_the_cards.rs b/harper-core/src/linting/in_on_the_cards.rsindex 3bb04ef35..fa6ec7819 100644--- a/harper-core/src/linting/in_on_the_cards.rs+++ b/harper-core/src/linting/in_on_the_cards.rs@@ -23,7 +23,7 @@ impl InOnTheCards {let pre_context = FirstMatchOf::new([Box::new(InflectionOfBe::new()) as Box<dyn Expr>,- Box::new(WordSet::new(&[+ Box::new(WordSet::new(["isn't", "it's", "wasn't", "weren't", "not", "isnt", "its", "wasnt", "werent",])),]);diff --git a/harper-core/src/linting/in_stock.rs b/harper-core/src/linting/in_stock.rsindex 76ab654aa..90995ac82 100644--- a/harper-core/src/linting/in_stock.rs+++ b/harper-core/src/linting/in_stock.rs@@ -19,8 +19,8 @@ impl Default for InStock {expr: SequenceExpr::any_of([Box::new(InflectionOfBe::default()) as Box<dyn Expr>,Box::new(- SequenceExpr::word_set(&["have", "had", "has", "having"]).then_optional(- SequenceExpr::whitespace().t_set(&[+ SequenceExpr::word_set(["have", "had", "has", "having"]).then_optional(+ SequenceExpr::whitespace().t_set(["it","one","some",diff --git a/harper-core/src/linting/in_time_from_now.rs b/harper-core/src/linting/in_time_from_now.rsindex faebc85c0..0fad6ad17 100644--- a/harper-core/src/linting/in_time_from_now.rs+++ b/harper-core/src/linting/in_time_from_now.rs@@ -15,7 +15,7 @@ impl Default for InTimeFromNow {expr: SequenceExpr::aco("in").t_ws().then_optional(- SequenceExpr::word_set(&[+ SequenceExpr::word_set(["about","almost","approximately",diff --git a/harper-core/src/linting/it_would_be.rs b/harper-core/src/linting/it_would_be.rsindex 112f18c48..d3aa909c3 100644--- a/harper-core/src/linting/it_would_be.rs+++ b/harper-core/src/linting/it_would_be.rs@@ -13,10 +13,10 @@ pub struct ItWouldBe {impl Default for ItWouldBe {fn default() -> Self {/* ─────────────── helpers ─────────────── */- let head_verbs = WordSet::new(&["believe", "doubt", "think", "assume", "guess"]);- let modals = WordSet::new(&["might", "would", "will"]);- let adjectives = WordSet::new(&["good", "bad", "wonderful", "real"]);- let tail_nouns = WordSet::new(&[+ let head_verbs = WordSet::new(["believe", "doubt", "think", "assume", "guess"]);+ let modals = WordSet::new(["might", "would", "will"]);+ let adjectives = WordSet::new(["good", "bad", "wonderful", "real"]);+ let tail_nouns = WordSet::new(["bummer","pity","shame",diff --git a/harper-core/src/linting/its_contraction/general.rs b/harper-core/src/linting/its_contraction/general.rsindex 907784425..d320f958f 100644--- a/harper-core/src/linting/its_contraction/general.rs+++ b/harper-core/src/linting/its_contraction/general.rs@@ -15,18 +15,18 @@ impl Default for General {fn default() -> Self {let positive = SequenceExpr::default().t_aco("its").then_whitespace().then(UPOSSet::new(&[UPOS::VERB, UPOS::AUX, UPOS::DET, UPOS::PRON])- .or(WordSet::new(&[+ .or(WordSet::new(["anywhere","everywhere","somewhere","nowhere",]))- .or(WordSet::new(&["because"])),+ .or(WordSet::new(["because"])),);let exceptions = SequenceExpr::anything().then_anything()- .then_word_set(&["own", "intended"]);+ .then_word_set(["own", "intended"]);let inverted = SequenceExpr::unless(exceptions);diff --git a/harper-core/src/linting/jump_the_gun.rs b/harper-core/src/linting/jump_the_gun.rsindex f7052fd15..da09ceb14 100644--- a/harper-core/src/linting/jump_the_gun.rs+++ b/harper-core/src/linting/jump_the_gun.rs@@ -11,11 +11,11 @@ pub struct JumpTheGun {impl Default for JumpTheGun {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["jump", "jumped", "jumping", "jumps"])+ expr: SequenceExpr::word_set(["jump", "jumped", "jumping", "jumps"]).t_ws()- .t_set(&["a", "an", "the"])+ .t_set(["a", "an", "the"]).t_ws()- .t_set(&["gun", "guns"])+ .t_set(["gun", "guns"]).but_not(SequenceExpr::anything().t_any()diff --git a/harper-core/src/linting/lead_rise_to.rs b/harper-core/src/linting/lead_rise_to.rsindex 814d1f789..36056a11a 100644--- a/harper-core/src/linting/lead_rise_to.rs+++ b/harper-core/src/linting/lead_rise_to.rs@@ -11,7 +11,7 @@ pub struct LeadRiseTo {impl Default for LeadRiseTo {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["lead", "led", "leads", "leading"])+ expr: SequenceExpr::word_set(["lead", "led", "leads", "leading"]).t_ws().t_aco("rise").t_ws()diff --git a/harper-core/src/linting/leaving_in_droves.rs b/harper-core/src/linting/leaving_in_droves.rsindex f9684fa57..cd18015b4 100644--- a/harper-core/src/linting/leaving_in_droves.rs+++ b/harper-core/src/linting/leaving_in_droves.rs@@ -11,7 +11,7 @@ pub struct LeavingInDroves {impl Default for LeavingInDroves {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["leave", "leaves", "leaving", "left"])+ expr: SequenceExpr::word_set(["leave", "leaves", "leaving", "left"]).t_ws().t_aco("in").t_ws()diff --git a/harper-core/src/linting/left_right_hand.rs b/harper-core/src/linting/left_right_hand.rsindex 95d92c8b6..e445d66da 100644--- a/harper-core/src/linting/left_right_hand.rs+++ b/harper-core/src/linting/left_right_hand.rs@@ -11,7 +11,7 @@ pub struct LeftRightHand {impl Default for LeftRightHand {fn default() -> Self {- let pattern = SequenceExpr::word_set(&["left", "right"])+ let pattern = SequenceExpr::word_set(["left", "right"]).then_whitespace().t_aco("hand").then_whitespace()diff --git a/harper-core/src/linting/less_worse.rs b/harper-core/src/linting/less_worse.rsindex 25ec07269..f3d747f16 100644--- a/harper-core/src/linting/less_worse.rs+++ b/harper-core/src/linting/less_worse.rs@@ -11,9 +11,9 @@ pub struct LessWorse {impl Default for LessWorse {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["less", "least"])+ expr: SequenceExpr::word_set(["less", "least"]).t_ws_h()- .then_word_set(&["worse", "worst"]),+ .then_word_set(["worse", "worst"]),}}}diff --git a/harper-core/src/linting/let_to_do.rs b/harper-core/src/linting/let_to_do.rsindex 3693de017..d79d69faf 100644--- a/harper-core/src/linting/let_to_do.rs+++ b/harper-core/src/linting/let_to_do.rs@@ -13,11 +13,11 @@ pub struct LetToDo {impl Default for LetToDo {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["let", "lets", "let's"])+ expr: SequenceExpr::word_set(["let", "lets", "let's"]).t_ws().then_any_of(vec![Box::new(SequenceExpr::default().then_object_pronoun()),- Box::new(SequenceExpr::word_set(&[+ Box::new(SequenceExpr::word_set([// Elective existential indefinite pronouns"anybody","anyone",@@ -33,9 +33,9 @@ impl Default for LetToDo {"someone",])),Box::new(- SequenceExpr::word_set(&["any", "every", "no", "some"])+ SequenceExpr::word_set(["any", "every", "no", "some"]).t_ws()- .then_word_set(&["body", "one"]),+ .then_word_set(["body", "one"]),),]).t_ws()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 ab23c9a50..c95d23c30 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@@ -22,7 +22,7 @@ pub struct NoContractionWithVerb {impl Default for NoContractionWithVerb {fn default() -> Self {// Only tests "let".- let let_ws = SequenceExpr::word_set(&["lets", "let"]).then_whitespace();+ let let_ws = SequenceExpr::word_set(["lets", "let"]).then_whitespace();let non_ing_verb = SequenceExpr::default().then_kind_is_but_isnt_any_of(TokenKind::is_verb,diff --git a/harper-core/src/linting/little_known.rs b/harper-core/src/linting/little_known.rsindex d3f0f025e..75d5c0a5f 100644--- a/harper-core/src/linting/little_known.rs+++ b/harper-core/src/linting/little_known.rs@@ -12,14 +12,14 @@ pub struct LittleKnown {impl Default for LittleKnown {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["it's", "its"])+ expr: SequenceExpr::word_set(["it's", "its"]).t_ws().then_optional(SequenceExpr::aco("a").t_ws()).t_aco("little").t_ws_h().t_aco("known").t_ws()- .t_set(&["fact", "that"]),+ .t_set(["fact", "that"]),}}}diff --git a/harper-core/src/linting/look_down_ones_nose.rs b/harper-core/src/linting/look_down_ones_nose.rsindex 2dce8dce8..18a445ad2 100644--- a/harper-core/src/linting/look_down_ones_nose.rs+++ b/harper-core/src/linting/look_down_ones_nose.rs@@ -11,11 +11,11 @@ pub struct LookDownOnesNose {impl Default for LookDownOnesNose {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["look", "looked", "looking", "looks"])+ expr: SequenceExpr::word_set(["look", "looked", "looking", "looks"]).t_ws().then_possessive_determiner().t_ws()- .then_word_set(&["nose", "noses"])+ .then_word_set(["nose", "noses"]).t_ws().t_aco("down"),}diff --git a/harper-core/src/linting/mass_nouns/noun_countability.rs b/harper-core/src/linting/mass_nouns/noun_countability.rsindex 23b4753c5..35c0ea1ae 100644--- a/harper-core/src/linting/mass_nouns/noun_countability.rs+++ b/harper-core/src/linting/mass_nouns/noun_countability.rs@@ -28,7 +28,7 @@ pub struct NounCountability {impl Default for NounCountability {fn default() -> Self {- let quantifier = WordSet::new(&[+ let quantifier = WordSet::new(["another", "both", "each", "every", "few", "fewer", "many", "multiple", "one","several",]);diff --git a/harper-core/src/linting/means_a_lot_to.rs b/harper-core/src/linting/means_a_lot_to.rsindex 16246c122..73c8c70a5 100644--- a/harper-core/src/linting/means_a_lot_to.rs+++ b/harper-core/src/linting/means_a_lot_to.rs@@ -14,11 +14,11 @@ impl Default for MeansALotTo {Self {expr: SequenceExpr::default()// Note that "meaning a lot to" is not used.- .t_set(&["mean", "means", "meant"])+ .t_set(["mean", "means", "meant"]).t_ws().then_any_of([Box::new(FixedPhrase::from_phrase("a lot")) as Box<dyn Expr>,- Box::new(WordSet::new(&["alot", "lot"])),+ Box::new(WordSet::new(["alot", "lot"])),]).t_ws().t_aco("for"),diff --git a/harper-core/src/linting/missing_to.rs b/harper-core/src/linting/missing_to.rsindex a303ab6c9..be6a88d85 100644--- a/harper-core/src/linting/missing_to.rs+++ b/harper-core/src/linting/missing_to.rs@@ -14,7 +14,7 @@ pub struct MissingTo {impl MissingTo {fn strict_controller_words() -> WordSet {- WordSet::new(&[+ WordSet::new(["eager","fail","failed",@@ -33,7 +33,7 @@ impl MissingTo {}fn permissive_controller_words() -> WordSet {- WordSet::new(&[+ WordSet::new(["aim","aimed","aiming",diff --git a/harper-core/src/linting/misspell.rs b/harper-core/src/linting/misspell.rsindex bdef1cd47..a5c1bebef 100644--- a/harper-core/src/linting/misspell.rs+++ b/harper-core/src/linting/misspell.rs@@ -11,7 +11,7 @@ pub struct Misspell {impl Default for Misspell {fn default() -> Self {- let expr = SequenceExpr::word_set(&["miss"]).t_ws_h().then_word_set(&[+ let expr = SequenceExpr::word_set(["miss"]).t_ws_h().then_word_set(["spell","spelled","spelling",diff --git a/harper-core/src/linting/modal_of.rs b/harper-core/src/linting/modal_of.rsindex b2b7b5837..3daecf7e0 100644--- a/harper-core/src/linting/modal_of.rs+++ b/harper-core/src/linting/modal_of.rs@@ -29,7 +29,7 @@ impl Default for ModalOf {// "will of" is a false positive if "will" is a noun// "The will of the many"let noun_will_of_naive = Lrc::new(- SequenceExpr::word_set(&["the", "a"])+ SequenceExpr::word_set(["the", "a"]).then_whitespace().t_aco("will").then_whitespace()diff --git a/harper-core/src/linting/months.rs b/harper-core/src/linting/months.rsindex a696f11db..6ee74fd6e 100644--- a/harper-core/src/linting/months.rs+++ b/harper-core/src/linting/months.rs@@ -29,7 +29,7 @@ pub struct Months {impl Default for Months {fn default() -> Self {// Define ambiguous months (those that are also common words)- let ambiguous_months = Lrc::new(WordSet::new(&["march", "may", "august"]));+ let ambiguous_months = Lrc::new(WordSet::new(["march", "may", "august"]));// The unambiguous monthslet only_months: Vec<&str> = ALL_MONTHS@@ -38,9 +38,9 @@ impl Default for Months {.copied().collect();- let only_months = WordSet::new(&only_months);+ let only_months = WordSet::new(only_months);- let before_month_sense_only = WordSet::new(&[+ let before_month_sense_only = WordSet::new([// Determiners.// These words won't disambiguate months: "each", "this", "that"// "each may do as he likes"diff --git a/harper-core/src/linting/more_adjective.rs b/harper-core/src/linting/more_adjective.rsindex 351cbe8fb..ab57c5416 100644--- a/harper-core/src/linting/more_adjective.rs+++ b/harper-core/src/linting/more_adjective.rs@@ -16,7 +16,7 @@ pub struct MoreAdjective<D> {impl<D: Dictionary> MoreAdjective<D> {pub fn new(dict: D) -> Self {Self {- expr: SequenceExpr::word_set(&["more", "most"])+ expr: SequenceExpr::word_set(["more", "most"]).t_ws().then_positive_adjective()// Include a following "than adjective" which we'll use to identify a false positive #2925diff --git a/harper-core/src/linting/most_number.rs b/harper-core/src/linting/most_number.rsindex 9db9f8660..fffdbb895 100644--- a/harper-core/src/linting/most_number.rs+++ b/harper-core/src/linting/most_number.rs@@ -19,7 +19,7 @@ impl Default for MostNumber {SequenceExpr::default().t_aco("most").t_ws()- .then_word_set(&["amount", "number"]),+ .then_word_set(["amount", "number"]),),// Context patternBox::new(diff --git a/harper-core/src/linting/nail_on_the_head.rs b/harper-core/src/linting/nail_on_the_head.rsindex ca680e0c1..0b9feccc0 100644--- a/harper-core/src/linting/nail_on_the_head.rs+++ b/harper-core/src/linting/nail_on_the_head.rs@@ -13,7 +13,7 @@ pub struct NailOnTheHead {impl Default for NailOnTheHead {fn default() -> Self {- let mis = WordSet::new(&["hat", "had", "hit", "hid"]);+ let mis = WordSet::new(["hat", "had", "hit", "hid"]);let pattern = SequenceExpr::default().t_aco("nail").then_whitespace()diff --git a/harper-core/src/linting/naked_eye.rs b/harper-core/src/linting/naked_eye.rsindex 0821bbcd7..e31c15c63 100644--- a/harper-core/src/linting/naked_eye.rs+++ b/harper-core/src/linting/naked_eye.rs@@ -12,7 +12,7 @@ impl Default for NakedEye {fn default() -> Self {Self {expr: SequenceExpr::optional(- SequenceExpr::word_set(&[+ SequenceExpr::word_set(["hide", "hides", "hid", "hidden", "hiding", "keep", "keeps", "kept", "keeping",]).t_ws()@@ -36,7 +36,7 @@ impl Default for NakedEye {.t_ws().t_aco("naked").t_ws()- .t_set(&["eye", "eyes"]),+ .t_set(["eye", "eyes"]),}}}diff --git a/harper-core/src/linting/need_to_noun.rs b/harper-core/src/linting/need_to_noun.rsindex 806628867..cb4bb4fea 100644--- a/harper-core/src/linting/need_to_noun.rs+++ b/harper-core/src/linting/need_to_noun.rs@@ -20,14 +20,14 @@ impl Default for NeedToNoun {|| tok.kind.is_unlintable()|| tok.kind.is_pronoun()}) as Box<dyn Expr>,- Box::new(WordSet::new(&["about", "into", "it"])),+ Box::new(WordSet::new(["about", "into", "it"])),]);let exceptions = SequenceExpr::anything().t_any().t_any().t_any()- .then_word_set(&["be", "match"]);+ .then_word_set(["be", "match"]);let a = SequenceExpr::default().then_kind_where(|kind| kind.is_nominal() && !kind.is_likely_homograph())diff --git a/harper-core/src/linting/no_harm_no_foul.rs b/harper-core/src/linting/no_harm_no_foul.rsindex 327330cd7..ee571a3c0 100644--- a/harper-core/src/linting/no_harm_no_foul.rs+++ b/harper-core/src/linting/no_harm_no_foul.rs@@ -11,14 +11,14 @@ pub struct NoHarmNoFoul {impl Default for NoHarmNoFoul {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["no", "nor"])+ expr: SequenceExpr::word_set(["no", "nor"]).t_ws().t_aco("harm").then_optional_comma().t_ws()- .t_set(&["no", "nor"])+ .t_set(["no", "nor"]).t_ws()- .t_set(&["fowl", "foul"])+ .t_set(["fowl", "foul"]).but_not(SequenceExpr::word_seq(&["no", "harm"]).then_optional_comma()diff --git a/harper-core/src/linting/no_longer_pronoun.rs b/harper-core/src/linting/no_longer_pronoun.rsindex a1d57324d..4108fe4d9 100644--- a/harper-core/src/linting/no_longer_pronoun.rs+++ b/harper-core/src/linting/no_longer_pronoun.rs@@ -20,7 +20,7 @@ impl Default for NoLongerPronoun {.t_aco("longer").t_ws().then_subject_pronoun()- .then_optional(SequenceExpr::whitespace().t_set(&["am", "are", "is"])),+ .then_optional(SequenceExpr::whitespace().t_set(["am", "are", "is"])),}}}diff --git a/harper-core/src/linting/no_match_for.rs b/harper-core/src/linting/no_match_for.rsindex 461fcf5fd..bace654f8 100644--- a/harper-core/src/linting/no_match_for.rs+++ b/harper-core/src/linting/no_match_for.rs@@ -14,7 +14,7 @@ impl Default for NoMatchFor {fn default() -> Self {let pre_context = FirstMatchOf::new([Box::new(InflectionOfBe::default()) as Box<dyn Expr>,- Box::new(WordSet::new(&[+ Box::new(WordSet::new(["I'm", "we're", "you're", "he's", "she's", "it's", "they're", "Im", "were","youre", "hes", "shes", "its", "theyre",])),diff --git a/harper-core/src/linting/no_oxford_comma.rs b/harper-core/src/linting/no_oxford_comma.rsindex 37365cac2..9aca51e8c 100644--- a/harper-core/src/linting/no_oxford_comma.rs+++ b/harper-core/src/linting/no_oxford_comma.rs@@ -22,7 +22,7 @@ impl NoOxfordComma {}.then_comma().then_whitespace()- .then_word_set(&["and", "or", "nor"]),+ .then_word_set(["and", "or", "nor"]),}}diff --git a/harper-core/src/linting/nominal_wants.rs b/harper-core/src/linting/nominal_wants.rsindex edae43439..f8e42c86b 100644--- a/harper-core/src/linting/nominal_wants.rs+++ b/harper-core/src/linting/nominal_wants.rs@@ -45,7 +45,7 @@ impl Default for NominalWants {}}- let miss = WordSet::new(&["wont", "wonts", "want", "wants"]);+ let miss = WordSet::new(["wont", "wonts", "want", "wants"]);let pattern = SequenceExpr::with(is_applicable_pronoun).then_whitespace().then(miss);diff --git a/harper-core/src/linting/not_only_inversion.rs b/harper-core/src/linting/not_only_inversion.rsindex 324c918e6..4ebbfa631 100644--- a/harper-core/src/linting/not_only_inversion.rs+++ b/harper-core/src/linting/not_only_inversion.rs@@ -13,9 +13,9 @@ impl Default for NotOnlyInversion {Self {expr: SequenceExpr::word_seq(&["not", "only"]).t_ws()- .then_word_set(&["I", "we", "you", "he", "she", "it", "they"])+ .then_word_set(["I", "we", "you", "he", "she", "it", "they"]).t_ws()- .then_word_set(&["am", "are", "is", "was", "were"]),+ .then_word_set(["am", "are", "is", "was", "were"]),}}}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 b7c909dde..a44f0be70 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@@ -26,13 +26,13 @@ impl Default for GeneralNounInsteadOfVerb {let pre_context = FirstMatchOf::new(vec![Box::new(WordSet::new(PRONOUNS)) as Box<dyn Expr>,Box::new(ModalVerb::with_common_errors()),- Box::new(WordSet::new(&["do", "don't", "dont"])),+ Box::new(WordSet::new(["do", "don't", "dont"])),Box::new(adverb_of_frequency),Box::new(Word::new("to")),]);let nouns = Lrc::new(WordSet::new(- &NOUN_VERB_PAIRS+ NOUN_VERB_PAIRS.iter().map(|&(noun, _)| noun).collect::<Vec<_>>(),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 35aaa6c68..f598147bf 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@@ -16,7 +16,7 @@ pub struct VerbInsteadOfNoun {impl Default for VerbInsteadOfNoun {fn default() -> Self {let verbs = Lrc::new(WordSet::new(- &NOUN_VERB_PAIRS+ NOUN_VERB_PAIRS.iter().map(|&(_, verb)| verb).collect::<Vec<_>>(),diff --git a/harper-core/src/linting/obsess_preposition.rs b/harper-core/src/linting/obsess_preposition.rsindex b180d5937..0785c18ed 100644--- a/harper-core/src/linting/obsess_preposition.rs+++ b/harper-core/src/linting/obsess_preposition.rs@@ -11,7 +11,7 @@ pub struct ObsessPreposition {impl Default for ObsessPreposition {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["obsess", "obsessed", "obsesses", "obsessing"])+ expr: SequenceExpr::word_set(["obsess", "obsessed", "obsesses", "obsessing"]).t_ws().then_preposition(),}diff --git a/harper-core/src/linting/of_course.rs b/harper-core/src/linting/of_course.rsindex 36a3f6e74..048efe44f 100644--- a/harper-core/src/linting/of_course.rs+++ b/harper-core/src/linting/of_course.rs@@ -18,12 +18,12 @@ impl Default for OfCourse {let curse_or_corse = SequenceExpr::default().t_aco("of").then_whitespace()- .then(WordSet::new(&["curse", "corse"]));+ .then(WordSet::new(["curse", "corse"]));let off_course_or_coarse = SequenceExpr::default().t_aco("off").then_whitespace()- .then(WordSet::new(&["course", "coarse"]));+ .then(WordSet::new(["course", "coarse"]));let expr = curse_or_corse.or_longest(off_course_or_coarse)@@ -33,7 +33,7 @@ impl Default for OfCourse {.then_whitespace().t_aco("course"),)- .or_longest(WordSet::new(&["ofcourse"]));+ .or_longest(WordSet::new(["ofcourse"]));Self { expr }}diff --git a/harper-core/src/linting/on_floor.rs b/harper-core/src/linting/on_floor.rsindex 01db6dd17..4afaa9176 100644--- a/harper-core/src/linting/on_floor.rs+++ b/harper-core/src/linting/on_floor.rs@@ -15,7 +15,7 @@ pub struct OnFloor {impl Default for OnFloor {fn default() -> Self {- let preposition = WordSet::new(&["in", "at"]);+ let preposition = WordSet::new(["in", "at"]);let on_the_floor = Lrc::new(SequenceExpr::with(preposition)@@ -28,12 +28,12 @@ impl Default for OnFloor {);let look_up_phrase = Lrc::new(- SequenceExpr::word_set(&["look", "looking", "looks", "looked"])+ SequenceExpr::word_set(["look", "looking", "looks", "looked"]).t_ws().t_aco("up"),);- let stop = Lrc::new(WordSet::new(&["stop", "stopping", "stops", "stopped"]));+ let stop = Lrc::new(WordSet::new(["stop", "stopping", "stops", "stopped"]));let exceptions = Lrc::new(LongestMatchOf::new(vec![Box::new(SequenceExpr::with(look_up_phrase.clone())),Box::new(SequenceExpr::with(stop.clone())),diff --git a/harper-core/src/linting/one_and_the_same.rs b/harper-core/src/linting/one_and_the_same.rsindex 7454c8378..700381ebd 100644--- a/harper-core/src/linting/one_and_the_same.rs+++ b/harper-core/src/linting/one_and_the_same.rs@@ -18,7 +18,7 @@ impl Default for OneAndTheSame {Self {expr: LongestMatchOf::new(vec![Box::new(- SequenceExpr::word_set(&["are", "were"])+ SequenceExpr::word_set(["are", "were"]).t_ws().then(one_in_the_same.clone()),),diff --git a/harper-core/src/linting/ones_own_accord.rs b/harper-core/src/linting/ones_own_accord.rsindex 02975dc23..0b9ce1877 100644--- a/harper-core/src/linting/ones_own_accord.rs+++ b/harper-core/src/linting/ones_own_accord.rs@@ -13,7 +13,7 @@ impl Default for OnesOwnAccord {Self {expr: SequenceExpr::aco("on").t_ws()- .t_set(&[+ .t_set([// Correct possessive determiners"my", "our", "your", "his", "her", "its", "their", "one's",// Common mistakes@@ -22,7 +22,7 @@ impl Default for OnesOwnAccord {.t_ws().t_aco("own").t_ws()- .t_set(&["accord", "accords"]),+ .t_set(["accord", "accords"]),}}}diff --git a/harper-core/src/linting/over_plus.rs b/harper-core/src/linting/over_plus.rsindex 196022948..24c8a972f 100644--- a/harper-core/src/linting/over_plus.rs+++ b/harper-core/src/linting/over_plus.rs@@ -21,9 +21,7 @@ impl Default for OverPlus {Box::new(SpelledNumberExpr) as Box<dyn Expr>,Box::new(|tok: &Token, _src: &[char]| tok.kind.is_number()),])- .then_optional(- SequenceExpr::whitespace().t_set(&["thousand", "million", "billion"]),- )+ .then_optional(SequenceExpr::whitespace().t_set(["thousand", "million", "billion"])).then_any_of([Box::new(SequenceExpr::whitespace()diff --git a/harper-core/src/linting/oxford_comma.rs b/harper-core/src/linting/oxford_comma.rsindex a4950127a..8f2517bca 100644--- a/harper-core/src/linting/oxford_comma.rs+++ b/harper-core/src/linting/oxford_comma.rs@@ -27,7 +27,7 @@ impl Default for OxfordComma {.then_one_or_more(item_chunk).then(item.clone()).then_whitespace()- .then_word_set(&["and", "or", "nor"])+ .then_word_set(["and", "or", "nor"]).then_whitespace().then(item.clone());diff --git a/harper-core/src/linting/pale_by_comparison.rs b/harper-core/src/linting/pale_by_comparison.rsindex bbe35d706..6be37f1a3 100644--- a/harper-core/src/linting/pale_by_comparison.rs+++ b/harper-core/src/linting/pale_by_comparison.rs@@ -16,7 +16,7 @@ impl Default for PaleByComparison {.t_ws().t_aco("pale").t_ws()- .t_set(&["by", "in"])+ .t_set(["by", "in"]).t_ws().t_aco("comparison"),}diff --git a/harper-core/src/linting/pay_for_price.rs b/harper-core/src/linting/pay_for_price.rsindex c372c175f..1855caf12 100644--- a/harper-core/src/linting/pay_for_price.rs+++ b/harper-core/src/linting/pay_for_price.rs@@ -11,18 +11,18 @@ pub struct PayForPrice {impl Default for PayForPrice {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["pay", "paid", "pays", "paying"])+ expr: SequenceExpr::word_set(["pay", "paid", "pays", "paying"]).t_ws().t_aco("for").t_ws().then_optional(SequenceExpr::default().then_determiner().t_ws()).then(- SequenceExpr::word_set(&[+ SequenceExpr::word_set(["bill", "bills", "check", "checks", "cheque", "cheques", "charge","charges", "cost", "costs", "fee", "fees", "price", "prices",]).but_not(SequenceExpr::any_of(vec![- Box::new(SequenceExpr::aco("check").t_ws_h().t_set(&["in", "out"])),+ Box::new(SequenceExpr::aco("check").t_ws_h().t_set(["in", "out"])),Box::new(SequenceExpr::aco("price").t_ws_h().t_aco("increase")),])),),diff --git a/harper-core/src/linting/pique_interest.rs b/harper-core/src/linting/pique_interest.rsindex 516d60505..7dc2207b1 100644--- a/harper-core/src/linting/pique_interest.rs+++ b/harper-core/src/linting/pique_interest.rs@@ -13,7 +13,7 @@ pub struct PiqueInterest {impl Default for PiqueInterest {fn default() -> Self {let pattern =- SequenceExpr::word_set(&["peak", "peaked", "peek", "peeked", "peeking", "peaking"])+ SequenceExpr::word_set(["peak", "peaked", "peek", "peeked", "peeking", "peaking"]).then_whitespace().then_kind_either(TokenKind::is_non_plural_nominal,diff --git a/harper-core/src/linting/possessive_noun.rs b/harper-core/src/linting/possessive_noun.rsindex 3493d61e8..e27c80f11 100644--- a/harper-core/src/linting/possessive_noun.rs+++ b/harper-core/src/linting/possessive_noun.rs@@ -26,9 +26,9 @@ impl<D: Dictionary> PossessiveNoun<D> {let exceptions =SequenceExpr::unless(|tok: &Token, _: &[char]| tok.kind.is_demonstrative_determiner()).t_any()- .then_unless(WordSet::new(&["flags", "checks", "catches", "you"]))+ .then_unless(WordSet::new(["flags", "checks", "catches", "you"])).t_any()- .then_unless(WordSet::new(&["form", "go"]));+ .then_unless(WordSet::new(["form", "go"]));Self {expr: All::new(vec![diff --git a/harper-core/src/linting/progressive_needs_be.rs b/harper-core/src/linting/progressive_needs_be.rsindex 3385eac5f..d3d3b82ab 100644--- a/harper-core/src/linting/progressive_needs_be.rs+++ b/harper-core/src/linting/progressive_needs_be.rs@@ -12,13 +12,13 @@ impl Default for ProgressiveNeedsBe {fn default() -> Self {// Support both contracted (I've/We've/You've/They've) and non-contracted// (I have/We have/You have/They have) forms before a progressive verb.- let contracted = SequenceExpr::word_set(&[+ let contracted = SequenceExpr::word_set(["I've", "We've", "You've", "They've", "Ive", "Weve", "Youve", "Theyve",]).t_ws().then_verb_progressive_form();- let non_contracted = SequenceExpr::word_set(&["I", "We", "You", "They"])+ let non_contracted = SequenceExpr::word_set(["I", "We", "You", "They"]).t_ws().then_any_capitalization_of("have").t_ws()diff --git a/harper-core/src/linting/pronoun_contraction/should_contract.rs b/harper-core/src/linting/pronoun_contraction/should_contract.rsindex 42b0261e4..4e0cc5e15 100644--- a/harper-core/src/linting/pronoun_contraction/should_contract.rs+++ b/harper-core/src/linting/pronoun_contraction/should_contract.rs@@ -21,19 +21,19 @@ pub struct ShouldContract {impl Default for ShouldContract {fn default() -> Self {let cap = Lrc::new(- SequenceExpr::word_set(&["your", "were"])+ SequenceExpr::word_set(["your", "were"]).then_whitespace().then_non_quantifier_determiner().then_whitespace().then(SequenceExpr::default().then_adjective()- .or(SequenceExpr::word_set(&["man", "boss"])),+ .or(SequenceExpr::word_set(["man", "boss"])),),);let start = SequenceExpr::with(AnchorStart).then(cap.clone());- let mid = SequenceExpr::unless(WordSet::new(&["what"]))+ let mid = SequenceExpr::unless(WordSet::new(["what"])).t_ws().then(cap);diff --git a/harper-core/src/linting/pronoun_knew.rs b/harper-core/src/linting/pronoun_knew.rsindex 96063379b..05d192d73 100644--- a/harper-core/src/linting/pronoun_knew.rs+++ b/harper-core/src/linting/pronoun_knew.rs@@ -42,7 +42,7 @@ impl Default for PronounKnew {let pronoun_adverb_then_new = SequenceExpr::with(pronoun_pattern).then_whitespace()- .then_word_set(&["always", "never", "also", "often"])+ .then_word_set(["always", "never", "also", "often"]).then_whitespace().then_any_capitalization_of("new");diff --git a/harper-core/src/linting/quantifier_needs_of.rs b/harper-core/src/linting/quantifier_needs_of.rsindex 8adddb905..cf8891d2d 100644--- a/harper-core/src/linting/quantifier_needs_of.rs+++ b/harper-core/src/linting/quantifier_needs_of.rs@@ -14,7 +14,7 @@ impl Default for QuantifierNeedsOf {let expr = SequenceExpr::default().then_indefinite_article().t_ws()- .then_word_set(&["couple", "lot"])+ .then_word_set(["couple", "lot"]).t_ws().then_plural_nominal();diff --git a/harper-core/src/linting/quantifier_numeral_conflict.rs b/harper-core/src/linting/quantifier_numeral_conflict.rsindex d8ec5fceb..801dab4c0 100644--- a/harper-core/src/linting/quantifier_numeral_conflict.rs+++ b/harper-core/src/linting/quantifier_numeral_conflict.rs@@ -23,12 +23,8 @@ impl Default for QuantifierNumeralConflict {]),),Box::new(SequenceExpr::unless(SequenceExpr::any_of([- Box::new(WordSet::new(&["all", "any", "every", "no"])) as Box<dyn Expr>,- Box::new(- SequenceExpr::word_set(&["each", "some"])- .t_ws()- .t_aco("one"),- ),+ Box::new(WordSet::new(["all", "any", "every", "no"])) as Box<dyn Expr>,+ Box::new(SequenceExpr::word_set(["each", "some"]).t_ws().t_aco("one")),]))),]),}diff --git a/harper-core/src/linting/reason_for_doing.rs b/harper-core/src/linting/reason_for_doing.rsindex 68b0fba88..eeabc0e3f 100644--- a/harper-core/src/linting/reason_for_doing.rs+++ b/harper-core/src/linting/reason_for_doing.rs@@ -14,7 +14,7 @@ pub struct ReasonForDoing {impl Default for ReasonForDoing {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["reason", "reasons"])+ expr: SequenceExpr::word_set(["reason", "reasons"]).t_ws().t_aco("of").t_ws()diff --git a/harper-core/src/linting/redundant_additive_adverbs.rs b/harper-core/src/linting/redundant_additive_adverbs.rsindex 3d7df9a99..b25833842 100644--- a/harper-core/src/linting/redundant_additive_adverbs.rs+++ b/harper-core/src/linting/redundant_additive_adverbs.rs@@ -12,7 +12,7 @@ pub struct RedundantAdditiveAdverbs {impl Default for RedundantAdditiveAdverbs {fn default() -> Self {- let also_too = WordSet::new(&["also", "too"]);+ let also_too = WordSet::new(["also", "too"]);let as_well = FixedPhrase::from_phrase("as well");let additive_adverb = Lrc::new(FirstMatchOf::new([diff --git a/harper-core/src/linting/redundant_firsts.rs b/harper-core/src/linting/redundant_firsts.rsindex f61af84dc..7ebe7f5b1 100644--- a/harper-core/src/linting/redundant_firsts.rs+++ b/harper-core/src/linting/redundant_firsts.rs@@ -28,7 +28,7 @@ pub struct RedundantFirsts {impl Default for RedundantFirsts {fn default() -> Self {let verbs = Lrc::new(WordSet::new(- &VERBS.iter().map(|(v, _)| *v).collect::<Vec<_>>(),+ VERBS.iter().map(|(v, _)| *v).collect::<Vec<_>>(),));Self {diff --git a/harper-core/src/linting/redundant_progressive_comparative.rs b/harper-core/src/linting/redundant_progressive_comparative.rsindex d5305968e..0c01b515e 100644--- a/harper-core/src/linting/redundant_progressive_comparative.rs+++ b/harper-core/src/linting/redundant_progressive_comparative.rs@@ -14,7 +14,7 @@ impl Default for RedundantProgressiveComparative {expr: Box::new(SequenceExpr::aco("increasingly").t_ws()- .then_word_set(&["more", "less"])+ .then_word_set(["more", "less"]).t_ws().then_kind_either(TokenKind::is_adjective, TokenKind::is_adverb),),diff --git a/harper-core/src/linting/redundant_self.rs b/harper-core/src/linting/redundant_self.rsindex 3125ee574..65a703a97 100644--- a/harper-core/src/linting/redundant_self.rs+++ b/harper-core/src/linting/redundant_self.rs@@ -16,7 +16,7 @@ impl Default for RedundantSelf {let reflexive_verb = Box::new(SequenceExpr::aco("self").t_ws_h()- .t_set(&[+ .t_set(["censor","censored","censors",@@ -98,9 +98,9 @@ impl Default for RedundantSelf {let transitive_verb = Box::new(SequenceExpr::aco("self").t_ws_h()- .t_set(&["host", "hosted", "hosting", "hosts"])+ .t_set(["host", "hosted", "hosting", "hosts"]).t_ws()- .t_set(&["it", "them", "one"])+ .t_set(["it", "them", "one"]).t_ws().then(ReflexivePronoun::with_common_errors()),);diff --git a/harper-core/src/linting/right_click.rs b/harper-core/src/linting/right_click.rsindex 2c0a35b04..79f32a980 100644--- a/harper-core/src/linting/right_click.rs+++ b/harper-core/src/linting/right_click.rs@@ -15,7 +15,7 @@ impl Default for RightClick {let mut map = ExprMap::default();map.insert(- SequenceExpr::word_set(&["right", "left", "middle"])+ SequenceExpr::word_set(["right", "left", "middle"]).t_ws().then(DerivedFrom::new_from_str("click")),0,diff --git a/harper-core/src/linting/rise_the_ranks.rs b/harper-core/src/linting/rise_the_ranks.rsindex 1cad0a9f7..c064e3202 100644--- a/harper-core/src/linting/rise_the_ranks.rs+++ b/harper-core/src/linting/rise_the_ranks.rs@@ -11,7 +11,7 @@ pub struct RiseTheRanks {impl Default for RiseTheRanks {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set([// legit forms of the legit verb "rise""rise", "risen", "rising", "rose",// wrong forms of the legit verb "rise"diff --git a/harper-core/src/linting/run_into_problems_or_trouble.rs b/harper-core/src/linting/run_into_problems_or_trouble.rsindex c2df244e5..d5a9a4101 100644--- a/harper-core/src/linting/run_into_problems_or_trouble.rs+++ b/harper-core/src/linting/run_into_problems_or_trouble.rs@@ -13,12 +13,12 @@ pub struct RunIntoProblemsOrTrouble {impl Default for RunIntoProblemsOrTrouble {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["run", "ran", "running", "runs"])+ expr: SequenceExpr::word_set(["run", "ran", "running", "runs"]).t_ws().t_aco("into").t_ws().then_any_of([- Box::new(WordSet::new(&["problem", "troubles"])) as Box<dyn Expr>,+ Box::new(WordSet::new(["problem", "troubles"])) as Box<dyn Expr>,Box::new(SequenceExpr::word_seq(&["a", "trouble"])),Box::new(SequenceExpr::word_seq(&["further", "troubles"])),]),diff --git a/harper-core/src/linting/safe_to_save.rs b/harper-core/src/linting/safe_to_save.rsindex 5890b5814..d46b6ebe8 100644--- a/harper-core/src/linting/safe_to_save.rs+++ b/harper-core/src/linting/safe_to_save.rs@@ -23,13 +23,13 @@ impl Default for SafeToSave {.then_whitespace().t_aco("safe").then_whitespace()- .then_unless(WordSet::new(&["to"]));+ .then_unless(WordSet::new(["to"]));let without_adv = SequenceExpr::with(ModalVerb::default()).then_whitespace().t_aco("safe").then_whitespace()- .then_unless(WordSet::new(&["to"]));+ .then_unless(WordSet::new(["to"]));let pattern = with_adv.or_longest(without_adv);diff --git a/harper-core/src/linting/shoot_oneself_in_the_foot.rs b/harper-core/src/linting/shoot_oneself_in_the_foot.rsindex c65b863a0..c624ce02a 100644--- a/harper-core/src/linting/shoot_oneself_in_the_foot.rs+++ b/harper-core/src/linting/shoot_oneself_in_the_foot.rs@@ -14,9 +14,9 @@ pub struct ShootOneselfInTheFoot {impl Default for ShootOneselfInTheFoot {fn default() -> Self {- let verb_forms = WordSet::new(&["shoot", "shooting", "shoots", "shot", "shooted"]);+ let verb_forms = WordSet::new(["shoot", "shooting", "shoots", "shot", "shooted"]);- let body_parts = WordSet::new(&["foot", "feet", "leg", "legs"]);+ let body_parts = WordSet::new(["foot", "feet", "leg", "legs"]);let pattern = SequenceExpr::with(verb_forms).t_ws()diff --git a/harper-core/src/linting/simple_past_to_past_participle.rs b/harper-core/src/linting/simple_past_to_past_participle.rsindex 331a01d62..e742d4627 100644--- a/harper-core/src/linting/simple_past_to_past_participle.rs+++ b/harper-core/src/linting/simple_past_to_past_participle.rs@@ -20,16 +20,16 @@ impl Default for SimplePastToPastParticiple {Box::new(SequenceExpr::any_of([// for perfect tenses- Box::new(WordSet::new(&["have", "had", "has", "having"])) as Box<dyn Expr>,+ Box::new(WordSet::new(["have", "had", "has", "having"])) as Box<dyn Expr>,// for passive voiceBox::new(InflectionOfBe::default()),// pronoun + have contractions- Box::new(WordSet::new(&[+ Box::new(WordSet::new(["I've", "I'd", "we've", "we'd", "you've", "you'd", "he's", "he'd","she's", "she'd", "it's", "it'd", "they've", "they'd",])),// pronoun + have contractions missing apostrophes- Box::new(WordSet::new(&[+ Box::new(WordSet::new(["Ive", "Id", "weve", "wed", "youve", "youd", "hes", "hed", "shes","shed", "its", "itd", "theyve", "theyd",])),@@ -47,7 +47,7 @@ impl Default for SimplePastToPastParticiple {Box::new(SequenceExpr::aco("id").t_any()- .then_word_set(&["came", "did", "went"]),+ .then_word_set(["came", "did", "went"]),),]))),]),diff --git a/harper-core/src/linting/since_duration.rs b/harper-core/src/linting/since_duration.rsindex 999720e80..8eef1cdb9 100644--- a/harper-core/src/linting/since_duration.rs+++ b/harper-core/src/linting/since_duration.rs@@ -29,11 +29,7 @@ impl Default for SinceDuration {expr: SequenceExpr::any_capitalization_of("since").then_whitespace().then(DurationExpr)- .then_optional(- SequenceExpr::default()- .t_ws()- .then_word_set(&["ago", "old"]),- ),+ .then_optional(SequenceExpr::default().t_ws().then_word_set(["ago", "old"])),}}}diff --git a/harper-core/src/linting/something_is.rs b/harper-core/src/linting/something_is.rsindex 887f6f82e..f2ee3435e 100644--- a/harper-core/src/linting/something_is.rs+++ b/harper-core/src/linting/something_is.rs@@ -11,7 +11,7 @@ pub struct SomethingIs {impl Default for SomethingIs {fn default() -> Self {- let forms = WordSet::new(&["somethings", "anythings", "everythings", "nothings"]);+ let forms = WordSet::new(["somethings", "anythings", "everythings", "nothings"]);let expr = SequenceExpr::with(forms).t_ws()diff --git a/harper-core/src/linting/sought_after.rs b/harper-core/src/linting/sought_after.rsindex 7885d3f55..38e542a09 100644--- a/harper-core/src/linting/sought_after.rs+++ b/harper-core/src/linting/sought_after.rs@@ -15,7 +15,7 @@ impl Default for SoughtAfter {SequenceExpr::default().then_kind_except(TokenKind::is_adverb, &["always", "maybe", "not", "perhaps"]),),- Box::new(SequenceExpr::word_set(&[+ Box::new(SequenceExpr::word_set(["abit", // Typo for "a bit""are", // may cause false positive, but few found so far."bit",diff --git a/harper-core/src/linting/take_care_of.rs b/harper-core/src/linting/take_care_of.rsindex 1dba49702..c32c8949d 100644--- a/harper-core/src/linting/take_care_of.rs+++ b/harper-core/src/linting/take_care_of.rs@@ -11,7 +11,7 @@ pub struct TakeCareOf {impl Default for TakeCareOf {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["take", "taken", "takes", "taking", "took"])+ expr: SequenceExpr::word_set(["take", "taken", "takes", "taking", "took"]).t_ws().then_word_seq(&["care", "about"]),}diff --git a/harper-core/src/linting/take_serious.rs b/harper-core/src/linting/take_serious.rsindex 76fb576c6..31f86fc88 100644--- a/harper-core/src/linting/take_serious.rs+++ b/harper-core/src/linting/take_serious.rs@@ -22,7 +22,7 @@ impl Default for TakeSerious {/// - Followed by a nominal phrase/// - Ending with "serious"fn default() -> Self {- let pattern = SequenceExpr::word_set(&["take", "taken", "takes", "taking", "took"])+ let pattern = SequenceExpr::word_set(["take", "taken", "takes", "taking", "took"]).t_ws().then(NominalPhrase).t_ws()diff --git a/harper-core/src/linting/the_last_days.rs b/harper-core/src/linting/the_last_days.rsindex fea1bc407..99d355730 100644--- a/harper-core/src/linting/the_last_days.rs+++ b/harper-core/src/linting/the_last_days.rs@@ -18,7 +18,7 @@ impl Default for TheLastDays {.t_ws().t_aco("last").t_ws()- .then_word_set(&[+ .then_word_set(["seconds", "minutes", "hours", "days", "weeks", "months", "years", "decades",]).but_not(diff --git a/harper-core/src/linting/the_my.rs b/harper-core/src/linting/the_my.rsindex 30689d05c..6c76dad04 100644--- a/harper-core/src/linting/the_my.rs+++ b/harper-core/src/linting/the_my.rs@@ -15,7 +15,7 @@ pub struct TheMy {impl Default for TheMy {fn default() -> Self {let the = Word::new("the");- let any_possessive = WordSet::new(&["my", "your", "his", "her", "its", "our", "their"]);+ let any_possessive = WordSet::new(["my", "your", "his", "her", "its", "our", "their"]);let the_poss = SequenceExpr::with(the.clone()).then_whitespace()diff --git a/harper-core/src/linting/the_point_for.rs b/harper-core/src/linting/the_point_for.rsindex 4464d8aa7..84371e82e 100644--- a/harper-core/src/linting/the_point_for.rs+++ b/harper-core/src/linting/the_point_for.rs@@ -12,7 +12,7 @@ pub struct ThePointFor {impl Default for ThePointFor {fn default() -> Self {Self {- expr: SequenceExpr::any_of(vec![Box::new(WordSet::new(&[+ expr: SequenceExpr::any_of(vec![Box::new(WordSet::new([// "that's" leads to false positives: "that's the point for me""is", "was", "what's", "whats",]))])diff --git a/harper-core/src/linting/the_the_to_that_the.rs b/harper-core/src/linting/the_the_to_that_the.rsindex 2509861f9..2f351e681 100644--- a/harper-core/src/linting/the_the_to_that_the.rs+++ b/harper-core/src/linting/the_the_to_that_the.rs@@ -11,7 +11,7 @@ pub struct TheTheToThatThe {impl Default for TheTheToThatThe {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set(["so", "fact", "found", "show", "say", "believe", "think", "said",]).t_ws()diff --git a/harper-core/src/linting/then_than.rs b/harper-core/src/linting/then_than.rsindex 2ef3ce7fd..0ae4b0cb1 100644--- a/harper-core/src/linting/then_than.rs+++ b/harper-core/src/linting/then_than.rs@@ -26,7 +26,7 @@ impl ThenThan {),// Positive form of adjective following "more" or "less"Box::new(- SequenceExpr::word_set(&["more", "less"])+ SequenceExpr::word_set(["more", "less"]).t_ws().then_kind_either(TokenKind::is_adjective, TokenKind::is_adverb).t_ws()@@ -36,7 +36,7 @@ impl ThenThan {),])) as Box<dyn Expr>,// Exceptions to the rule.- Box::new(Invert::new(WordSet::new(&["back", "this", "so", "but"]))),+ Box::new(Invert::new(WordSet::new(["back", "this", "so", "but"]))),]);Self {diff --git a/harper-core/src/linting/there_own.rs b/harper-core/src/linting/there_own.rsindex 64f530d61..e85748ff2 100644--- a/harper-core/src/linting/there_own.rs+++ b/harper-core/src/linting/there_own.rs@@ -13,7 +13,7 @@ pub struct ThereOwn {impl Default for ThereOwn {fn default() -> Self {- let expr = SequenceExpr::word_set(&["there", "they're", "theyre"])+ let expr = SequenceExpr::word_set(["there", "they're", "theyre"]).t_ws().t_aco("own");diff --git a/harper-core/src/linting/thing_think.rs b/harper-core/src/linting/thing_think.rsindex 93dccf737..eadd5a4e2 100644--- a/harper-core/src/linting/thing_think.rs+++ b/harper-core/src/linting/thing_think.rs@@ -13,14 +13,9 @@ pub struct ThingThink {impl Default for ThingThink {fn default() -> Self {- let subject_pronouns = WordSet::new(&["I", "you", "we", "they"]);+ let subject_pronouns = WordSet::new(["I", "you", "we", "they"]);let indefinite_pronouns = FirstMatchOf::new([- Box::new(WordSet::new(&[- "anybody",- "anyone",- "everybody",- "everyone",- ])) as Box<dyn Expr>,+ Box::new(WordSet::new(["anybody", "anyone", "everybody", "everyone"])) as Box<dyn Expr>,// "Any one thing", "every one thing", "any body thing" cause false positives.Box::new(FixedPhrase::from_phrase("every body")),]);@@ -29,14 +24,14 @@ impl Default for ThingThink {Box::new(indefinite_pronouns),]);- let verb_to = SequenceExpr::word_set(&[+ let verb_to = SequenceExpr::word_set(["have", "had", "has", "having", "need", "needed", "needs", "needing", "want", "wanted","wants", "wanting", "try", "tried", "tries", "trying",]).t_ws().t_aco("to");- let modal = WordSet::new(&[+ let modal = WordSet::new(["can","cannot","can't",@@ -56,7 +51,7 @@ impl Default for ThingThink {]);let adverb_of_frequency =- WordSet::new(&["always", "sometimes", "often", "usually", "never"]);+ WordSet::new(["always", "sometimes", "often", "usually", "never"]);let pre_context = FirstMatchOf::new([Box::new(pronoun) as Box<dyn Expr>,diff --git a/harper-core/src/linting/this_type_of_thing.rs b/harper-core/src/linting/this_type_of_thing.rsindex f61d153ef..4e12a973c 100644--- a/harper-core/src/linting/this_type_of_thing.rs+++ b/harper-core/src/linting/this_type_of_thing.rs@@ -12,17 +12,17 @@ pub struct ThisTypeOfThing {impl Default for ThisTypeOfThing {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["this", "these", "that", "those"])+ expr: SequenceExpr::word_set(["this", "these", "that", "those"]).t_ws().then(- SequenceExpr::word_set(&["kind", "kinds", "sort", "sorts", "type", "types"])+ SequenceExpr::word_set(["kind", "kinds", "sort", "sorts", "type", "types"]).t_ws(),).t_aco("of").t_ws().then_any_of([// "thing" is common in this construction and won't be part of a compound noun.- Box::new(WordSet::new(&["thing", "things"])) as Box<dyn Expr>,+ Box::new(WordSet::new(["thing", "things"])) as Box<dyn Expr>,// Other singular nouns may be part of hard-to-determine compound nouns, but plural nouns won't.Box::new(SequenceExpr::default()diff --git a/harper-core/src/linting/thrive_on.rs b/harper-core/src/linting/thrive_on.rsindex e51f5f0e7..3f52a6112 100644--- a/harper-core/src/linting/thrive_on.rs+++ b/harper-core/src/linting/thrive_on.rs@@ -11,7 +11,7 @@ pub struct ThriveOn {impl Default for ThriveOn {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["thrive", "thrived", "thrives", "thriving"])+ expr: SequenceExpr::word_set(["thrive", "thrived", "thrives", "thriving"]).t_ws().t_aco("off").then_optional(SequenceExpr::whitespace().t_aco("of")),diff --git a/harper-core/src/linting/throw_baby_with_bathwater.rs b/harper-core/src/linting/throw_baby_with_bathwater.rsindex 4ad4cce21..67d441f20 100644--- a/harper-core/src/linting/throw_baby_with_bathwater.rs+++ b/harper-core/src/linting/throw_baby_with_bathwater.rs@@ -16,7 +16,7 @@ impl Default for ThrowBabyWithBathwater {let away_sp = Lrc::new(SequenceExpr::word_seq(&["away"]).t_ws());Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set([// Correct spellings"throw", "threw", "thrown", "throwing", "throws",// Tolerate common misspelling, leaving it for its own linter to correctdiff --git a/harper-core/src/linting/till_date.rs b/harper-core/src/linting/till_date.rsindex 0d878abf3..aab9fe7fc 100644--- a/harper-core/src/linting/till_date.rs+++ b/harper-core/src/linting/till_date.rs@@ -12,7 +12,7 @@ pub struct TillDate {impl TillDate {pub fn new(dialect: Dialect) -> Self {Self {- expr: SequenceExpr::word_set(&["till", "til", "'til", "til'"])+ expr: SequenceExpr::word_set(["till", "til", "'til", "til'"]).t_ws().t_aco("date"),dialect,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 4b618b7ef..149e1aaf8 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@@ -18,7 +18,7 @@ impl Default for ToTooDegreeWords {let expr = SequenceExpr::default().t_aco("to").t_ws()- .then_word_set(&["many", "much", "few"])+ .then_word_set(["many", "much", "few"]).then_any_of([Box::new(SequenceExpr::default().then_kind_is_but_is_not_except(TokenKind::is_punctuation,diff --git a/harper-core/src/linting/try_ones_hand_at.rs b/harper-core/src/linting/try_ones_hand_at.rsindex f25827522..0e50d4500 100644--- a/harper-core/src/linting/try_ones_hand_at.rs+++ b/harper-core/src/linting/try_ones_hand_at.rs@@ -11,7 +11,7 @@ pub struct TryOnesHandAt {impl Default for TryOnesHandAt {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["try", "tried", "tries", "trying"])+ expr: SequenceExpr::word_set(["try", "tried", "tries", "trying"]).t_ws().then_possessive_determiner().t_ws()diff --git a/harper-core/src/linting/try_ones_luck.rs b/harper-core/src/linting/try_ones_luck.rsindex 51057a912..93524bf36 100644--- a/harper-core/src/linting/try_ones_luck.rs+++ b/harper-core/src/linting/try_ones_luck.rs@@ -11,7 +11,7 @@ pub struct TryOnesLuck {impl Default for TryOnesLuck {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["try", "tried", "tries", "trying"])+ expr: SequenceExpr::word_set(["try", "tried", "tries", "trying"]).t_ws().t_aco("out").t_ws()diff --git a/harper-core/src/linting/verb_to_adjective.rs b/harper-core/src/linting/verb_to_adjective.rsindex 91b0af268..8d97cfeca 100644--- a/harper-core/src/linting/verb_to_adjective.rs+++ b/harper-core/src/linting/verb_to_adjective.rs@@ -12,13 +12,13 @@ pub struct VerbToAdjective {impl Default for VerbToAdjective {fn default() -> Self {- let expr = SequenceExpr::word_set(&["the", "a", "an"])+ let expr = SequenceExpr::word_set(["the", "a", "an"]).t_ws().then_kind_where(|kind| kind.is_degree_adverb()).t_ws().then_kind_where(|kind| kind.is_noun() && kind.is_verb_progressive_form()).t_ws()- .then(WordSet::new(&["of"]));+ .then(WordSet::new(["of"]));Self { expr }}diff --git a/harper-core/src/linting/very_less.rs b/harper-core/src/linting/very_less.rsindex 0a628c9c3..6490888b7 100644--- a/harper-core/src/linting/very_less.rs+++ b/harper-core/src/linting/very_less.rs@@ -29,7 +29,7 @@ where}}-const DEGREE_ADVERB_BLACKLIST: &[&str] = &["comparably", "indeed", "notably", "really", "so"];+const DEGREE_ADVERB_BLACKLIST: [&str; 5] = ["comparably", "indeed", "notably", "really", "so"];pub struct VeryLess {expr: All,diff --git a/harper-core/src/linting/very_unique.rs b/harper-core/src/linting/very_unique.rsindex 27be1119a..d99890399 100644--- a/harper-core/src/linting/very_unique.rs+++ b/harper-core/src/linting/very_unique.rs@@ -12,7 +12,7 @@ pub struct VeryUnique {impl Default for VeryUnique {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&[+ expr: SequenceExpr::word_set(["fairly", "pretty", "rather", "quite", "somewhat", "very",]).t_ws()diff --git a/harper-core/src/linting/vice_versa.rs b/harper-core/src/linting/vice_versa.rsindex 37a30b255..5836add9f 100644--- a/harper-core/src/linting/vice_versa.rs+++ b/harper-core/src/linting/vice_versa.rs@@ -75,7 +75,7 @@ pub struct ViceVersa {impl Default for ViceVersa {fn default() -> Self {- let expr = SequenceExpr::word_set(&["vice", "vise"])+ let expr = SequenceExpr::word_set(["vice", "vise"]).then(matches_hyphen).then_optional(SequenceExpr::aco("a").then(matches_hyphen)).t_aco("versa");diff --git a/harper-core/src/linting/vicious_loop/mod.rs b/harper-core/src/linting/vicious_loop/mod.rsindex 6051c4735..b668d9795 100644--- a/harper-core/src/linting/vicious_loop/mod.rs+++ b/harper-core/src/linting/vicious_loop/mod.rs@@ -24,9 +24,9 @@ pub struct ViciousCircleOrCycle {// The Expr must have all three tokens because they should only be flagged when used together.// But we don't want to flag the legitimate combinations, and which those are depends on the user's preferences.fn build_expr(flag: Prefer) -> Box<dyn Expr> {- let seq = SequenceExpr::word_set(&["vicious", "virtuous", "viscous"])+ let seq = SequenceExpr::word_set(["vicious", "virtuous", "viscous"]).t_ws()- .then_word_set(&["circle", "circles", "cycle", "cycles"]);+ .then_word_set(["circle", "circles", "cycle", "cycles"]);match flag {Prefer::Circle => Box::new(@@ -34,7 +34,7 @@ fn build_expr(flag: Prefer) -> Box<dyn Expr> {SequenceExpr::default().then_word_except(&["viscous"]).t_ws()- .then_word_set(&["circle", "circles"]),+ .then_word_set(["circle", "circles"]),),),Prefer::Cycle => Box::new(@@ -42,7 +42,7 @@ fn build_expr(flag: Prefer) -> Box<dyn Expr> {SequenceExpr::default().then_word_except(&["viscous"]).t_ws()- .then_word_set(&["cycle", "cycles"]),+ .then_word_set(["cycle", "cycles"]),),),Prefer::DontCare => {diff --git a/harper-core/src/linting/was_aloud.rs b/harper-core/src/linting/was_aloud.rsindex 51d97ee8c..a8203542d 100644--- a/harper-core/src/linting/was_aloud.rs+++ b/harper-core/src/linting/was_aloud.rs@@ -12,7 +12,7 @@ pub struct WasAloud {impl Default for WasAloud {fn default() -> Self {- let pattern = SequenceExpr::word_set(&["was", "were", "be", "been"])+ let pattern = SequenceExpr::word_set(["was", "were", "be", "been"]).then_whitespace().then_exact_word("aloud");diff --git a/harper-core/src/linting/way_too_adjective.rs b/harper-core/src/linting/way_too_adjective.rsindex 39b65dbee..8c55d94a9 100644--- a/harper-core/src/linting/way_too_adjective.rs+++ b/harper-core/src/linting/way_too_adjective.rs@@ -18,13 +18,13 @@ impl Default for WayTooAdjective {.t_ws().t_aco("to").t_ws()- .then(UPOSSet::new(&[UPOS::ADJ]).or(WordSet::new(&["much"])));+ .then(UPOSSet::new(&[UPOS::ADJ]).or(WordSet::new(["much"])));let exceptions = SequenceExpr::anything().t_any().t_any().t_any()- .then_word_set(&["surface", "return", "aqua"]);+ .then_word_set(["surface", "return", "aqua"]);let expr = All::new(vec![Box::new(base),diff --git a/harper-core/src/linting/web_scraping.rs b/harper-core/src/linting/web_scraping.rsindex 835799e48..f9c8ee94d 100644--- a/harper-core/src/linting/web_scraping.rs+++ b/harper-core/src/linting/web_scraping.rs@@ -14,7 +14,7 @@ impl Default for WebScraping {let scrap_verbs = &["scrap", "scrapped", "scraps", "scrapping"][..];let scrap_nouns = &["scrapper", "scrappers"][..];- let mut closed_compounds = WordSet::new(&[]);+ let mut closed_compounds = WordSet::default();let mut open_and_hyphenated_compounds = vec![];scrap_verbs.iter().chain(scrap_nouns).for_each(|scrap| {diff --git a/harper-core/src/linting/well_educated.rs b/harper-core/src/linting/well_educated.rsindex 01425b0df..34a35e80b 100644--- a/harper-core/src/linting/well_educated.rs+++ b/harper-core/src/linting/well_educated.rs@@ -13,7 +13,7 @@ pub struct WellEducated {impl Default for WellEducated {fn default() -> Self {- let combined = WordSet::new(&["good-educated"]);+ let combined = WordSet::new(["good-educated"]);let separated = SequenceExpr::default().t_aco("good")diff --git a/harper-core/src/linting/were_where.rs b/harper-core/src/linting/were_where.rsindex 34cd76b09..f59f0426f 100644--- a/harper-core/src/linting/were_where.rs+++ b/harper-core/src/linting/were_where.rs@@ -19,9 +19,8 @@ impl Default for WereWhere {// "they/we" are unambiguous plural subject pronouns — "where" directly after// them is almost certainly a typo for "were".// e.g. "they where going" → "they were going"- let unambiguous_pronoun_where = SequenceExpr::word_set(&["they", "we"])- .t_ws()- .t_aco("where");+ let unambiguous_pronoun_where =+ SequenceExpr::word_set(["they", "we"]).t_ws().t_aco("where");// "you where" alone is ambiguous ("I'll show you where to go"), so only flag// it when followed by a verb, auxiliary, or adjective — confirming a verb slot.diff --git a/harper-core/src/linting/whom_subject_of_verb.rs b/harper-core/src/linting/whom_subject_of_verb.rsindex 5031e2608..f3761f17e 100644--- a/harper-core/src/linting/whom_subject_of_verb.rs+++ b/harper-core/src/linting/whom_subject_of_verb.rs@@ -12,7 +12,7 @@ pub struct WhomSubjectOfVerb {impl Default for WhomSubjectOfVerb {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["whom", "whomever", "whomsoever"])+ expr: SequenceExpr::word_set(["whom", "whomever", "whomsoever"]).t_ws().then_any_of([Box::new(SequenceExpr::default().then_kind_where(|k| {diff --git a/harper-core/src/linting/widely_accepted.rs b/harper-core/src/linting/widely_accepted.rsindex ca6829782..cb252e24f 100644--- a/harper-core/src/linting/widely_accepted.rs+++ b/harper-core/src/linting/widely_accepted.rs@@ -15,7 +15,7 @@ impl Default for WidelyAccepted {let expr = SequenceExpr::default().t_aco("wide").then_whitespace()- .then_word_set(&["accepted", "acceptable", "used"]);+ .then_word_set(["accepted", "acceptable", "used"]);Self { expr }}diff --git a/harper-core/src/linting/will_non_lemma.rs b/harper-core/src/linting/will_non_lemma.rsindex 40889123d..2ba0f8f5e 100644--- a/harper-core/src/linting/will_non_lemma.rs+++ b/harper-core/src/linting/will_non_lemma.rs@@ -24,7 +24,7 @@ wherepub fn new(dict: D) -> Self {Self {expr: Box::new(- SequenceExpr::word_set(&["will", "shall"])+ SequenceExpr::word_set(["will", "shall"]).t_ws().then_kind_where(|kind| {kind.is_verb()diff --git a/harper-core/src/linting/win_prize.rs b/harper-core/src/linting/win_prize.rsindex 3851d5b09..9ba74abff 100644--- a/harper-core/src/linting/win_prize.rs+++ b/harper-core/src/linting/win_prize.rs@@ -13,8 +13,8 @@ pub struct WinPrize {impl Default for WinPrize {fn default() -> Self {- let verbs = Lrc::new(WordSet::new(&["win", "wins", "won", "winning"]));- let miss = Lrc::new(WordSet::new(&["price", "prices", "prise", "prises"]));+ let verbs = Lrc::new(WordSet::new(["win", "wins", "won", "winning"]));+ let miss = Lrc::new(WordSet::new(["price", "prices", "prise", "prises"]));let pattern = SequenceExpr::with(verbs.clone()).then_whitespace()diff --git a/harper-core/src/linting/wish_could.rs b/harper-core/src/linting/wish_could.rsindex d75cf23e8..5fd5a927e 100644--- a/harper-core/src/linting/wish_could.rs+++ b/harper-core/src/linting/wish_could.rs@@ -10,11 +10,11 @@ pub struct WishCould {impl Default for WishCould {fn default() -> Self {Self {- expr: SequenceExpr::word_set(&["wish", "wished", "wishes", "wishing"])+ expr: SequenceExpr::word_set(["wish", "wished", "wishes", "wishing"]).t_ws().then_any_of(vec![Box::new(SequenceExpr::default().then_subject_pronoun()),- Box::new(SequenceExpr::word_set(&[+ Box::new(SequenceExpr::word_set([// Elective existential indefinite pronouns"anybody","anyone",diff --git a/harper-core/src/linting/wrong_apostrophe.rs b/harper-core/src/linting/wrong_apostrophe.rsindex dcaf0b4dd..ea78644ee 100644--- a/harper-core/src/linting/wrong_apostrophe.rs+++ b/harper-core/src/linting/wrong_apostrophe.rs@@ -20,7 +20,7 @@ impl Default for WrongApostrophe {Box::new(SequenceExpr::default().then_acute()),Box::new(SequenceExpr::default().then_backtick()),])- .then_word_set(&CONTRACTION_AND_POSSESSIVE_ENDINGS),+ .then_word_set(CONTRACTION_AND_POSSESSIVE_ENDINGS),)]),}}diff --git a/harper-core/src/patterns/indefinite_article.rs b/harper-core/src/patterns/indefinite_article.rsindex 6aab5b996..46b043881 100644--- a/harper-core/src/patterns/indefinite_article.rs+++ b/harper-core/src/patterns/indefinite_article.rs@@ -9,7 +9,7 @@ pub struct IndefiniteArticle {impl Default for IndefiniteArticle {fn default() -> Self {Self {- inner: WordSet::new(&["a", "an"]),+ inner: WordSet::new(["a", "an"]),}}}diff --git a/harper-core/src/patterns/inflection_of_be.rs b/harper-core/src/patterns/inflection_of_be.rsindex 364828b28..afef5e855 100644--- a/harper-core/src/patterns/inflection_of_be.rs+++ b/harper-core/src/patterns/inflection_of_be.rs@@ -18,7 +18,7 @@ impl Default for InflectionOfBe {impl InflectionOfBe {pub fn new() -> Self {Self {- inner: WordSet::new(&["be", "am", "is", "are", "was", "were", "been", "being"]),+ inner: WordSet::new(["be", "am", "is", "are", "was", "were", "been", "being"]),}}}diff --git a/harper-core/src/patterns/modal_verb.rs b/harper-core/src/patterns/modal_verb.rsindex 9e3fa371e..bf3d5eb93 100644--- a/harper-core/src/patterns/modal_verb.rs+++ b/harper-core/src/patterns/modal_verb.rs@@ -20,7 +20,7 @@ impl Default for ModalVerb {impl ModalVerb {pub fn without_common_errors() -> Self {static CACHED_WITHOUT_COMMON_ERRORS: LazyLock<WordSet> = LazyLock::new(|| {- let mut words = WordSet::new(&MODALS);+ let mut words = WordSet::new(MODALS);MODALS.iter().for_each(|word| {words.add(&format!("{word}n't"));});@@ -35,7 +35,7 @@ impl ModalVerb {pub fn with_common_errors() -> Self {static CACHED_WITH_COMMON_ERRORS: LazyLock<WordSet> = LazyLock::new(|| {- let mut words = WordSet::new(&MODALS);+ let mut words = WordSet::new(MODALS);MODALS.iter().for_each(|word| {words.add(&format!("{word}n't"));words.add(&format!("{word}nt"));diff --git a/harper-core/src/patterns/prepositional_preceder.rs b/harper-core/src/patterns/prepositional_preceder.rsindex f1e59b436..a790938a2 100644--- a/harper-core/src/patterns/prepositional_preceder.rs+++ b/harper-core/src/patterns/prepositional_preceder.rs@@ -16,7 +16,7 @@ pub struct PrepositionalPrecederPattern {impl Default for PrepositionalPrecederPattern {fn default() -> Self {Self {- word_set: WordSet::new(&[+ word_set: WordSet::new(["accustomed","addicted","adjacent",diff --git a/harper-core/src/patterns/relative_pronoun.rs b/harper-core/src/patterns/relative_pronoun.rsindex 8f885ba85..f66ba2ffd 100644--- a/harper-core/src/patterns/relative_pronoun.rs+++ b/harper-core/src/patterns/relative_pronoun.rs@@ -9,7 +9,7 @@ pub struct RelativePronoun {impl Default for RelativePronoun {fn default() -> Self {Self {- inner: WordSet::new(&["that", "which", "who", "whom", "whose"]),+ inner: WordSet::new(["that", "which", "who", "whom", "whose"]),}}}diff --git a/harper-core/src/patterns/word_set.rs b/harper-core/src/patterns/word_set.rsindex e4c341046..617032038 100644--- a/harper-core/src/patterns/word_set.rs+++ b/harper-core/src/patterns/word_set.rs@@ -32,11 +32,15 @@ impl WordSet {}/// Create a new word set that matches against any word in the provided list.- pub fn new(words: &[&'static str]) -> Self {+ pub fn new<I, S>(words: I) -> Self+ where+ I: IntoIterator<Item = S>,+ S: AsRef<str>,+ {let mut set = Self::default();for str in words {- set.add(str);+ set.add(str.as_ref());}set