Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix: don't flag more low-hanging fruit→lower-hanging (#3571)

Andrew Dunbar368afb4de2e0
diff --git a/harper-core/src/linting/more_adjective.rs b/harper-core/src/linting/more_adjective.rs
index 61ec2769e..924a8b3aa 100644
--- a/harper-core/src/linting/more_adjective.rs
+++ b/harper-core/src/linting/more_adjective.rs
@@ -2,7 +2,7 @@ use itertools::Itertools;
use crate::{
char_ext::CharExt,
- expr::{Expr, SequenceExpr},
+ expr::{Expr, FirstMatchOf, SequenceExpr},
linting::{ExprLinter, LintKind, Suggestion, expr_linter::Chunk},
spell::Dictionary,
{CharStringExt, Lint, Token, TokenStringExt},
@@ -23,12 +23,16 @@ where
.t_ws()
.then_positive_adjective()
// Include a following "than adjective" which we'll use to identify a false positive #2925
- .then_optional(
- SequenceExpr::whitespace()
- .t_aco("than")
- .t_ws()
- .then_positive_adjective(),
- ),
+ // Or a following hyphen which we'll use to identify a false positive #3568
+ .then_optional(FirstMatchOf::new(vec![
+ Box::new(
+ SequenceExpr::whitespace()
+ .t_aco("than")
+ .t_ws()
+ .then_positive_adjective(),
+ ),
+ Box::new(|tok: &Token, _source: &[char]| tok.kind.is_hyphen()),
+ ])),
dict,
}
}