Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(core): don't flag `MissingTo` after a possessive nominal (#4089)
Mauro Pereira112b9f22d381
diff --git a/harper-core/src/linting/missing_to.rs b/harper-core/src/linting/missing_to.rsindex 35b4e934c..b5322c2a4 100644--- a/harper-core/src/linting/missing_to.rs+++ b/harper-core/src/linting/missing_to.rs@@ -384,6 +384,12 @@ impl ExprLinter for MissingTo {let controller_text = controller.get_str(source).to_lowercase();let controller_text = controller_text.as_str();+ if controller.kind.is_noun()+ && preceded_by_word(context, |tok| tok.kind.is_possessive_nominal())+ {+ return None;+ }+if controller.kind.is_verb()&& controller.kind.is_adjective()&& preceded_by_word(context, |tok| tok.kind.is_nominal())@@ -660,6 +666,14 @@ mod tests {);}+ #[test]+ fn issue_3951_possessive_noun() {+ assert_no_lints(+ "This Article's aims are both theoretical and historical.",+ test_linter(),+ );+ }+#[test]fn no_lint_when_to_present() {assert_no_lints("She wants to finish early.", test_linter());