Skip to content

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

fix(core): don't ask for `to` after `try` followed by a noun (#4631)

Yunus Ozen208ce1001b46
diff --git a/harper-core/src/linting/missing_to.rs b/harper-core/src/linting/missing_to.rs
index 682e4b170..35b4e934c 100644
--- a/harper-core/src/linting/missing_to.rs
+++ b/harper-core/src/linting/missing_to.rs
@@ -501,6 +501,10 @@ impl ExprLinter for MissingTo {
| "mean"
| "means"
| "meant"
+ | "tried"
+ | "tries"
+ | "try"
+ | "trying"
| "want"
| "wanted"
| "wanting"
@@ -882,4 +886,17 @@ mod tests {
"He found the thing and attempted to solve it.",
);
}
+
+ #[test]
+ fn allows_trying_stuff_issue_4579() {
+ assert_no_lints("I was just trying stuff out.", test_linter());
+ }
+
+ #[test]
+ fn allows_try_with_a_noun_object() {
+ assert_no_lints(
+ "After trying stuff for hours, we tried things the docs suggested.",
+ test_linter(),
+ );
+ }
}