feat: last ditched/ditch→last-ditch (#1147)

* feat: last ditched/ditch→last-ditch

* fix: unit test names didn't quite match tests

---------

Co-authored-by: Elijah Potter <me@elijahpotter.dev>
This commit is contained in:
Andrew Dunbar 2025-04-29 05:27:00 +07:00 committed by GitHub
parent 7ce6acda49
commit aaf7e14dd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1129,6 +1129,12 @@ pub fn lint_group() -> LintGroup {
"A more vivid adjective would better convey intense hunger.",
"Encourages vivid writing by suggesting `starving` instead of weaker expressions like `very hungry.`"
),
"LastDitch" => (
["last ditch", "last ditched", "last-ditched"],
["last-ditch"],
"In this idiom, `ditch` is a noun and a hyphen is needed.",
"Corrects wrong variations of the idiomatic adjective `last-ditch`."
),
"InvestIn" => (
["invest into"],
["invest in"],
@ -2402,6 +2408,15 @@ mod tests {
);
}
#[test]
fn correct_last_ditched() {
assert_suggestion_result(
"I was actually just trying that as a last ditched attempt to get it working, previously those ...",
lint_group(),
"I was actually just trying that as a last-ditch attempt to get it working, previously those ...",
);
}
#[test]
fn corrects_invested_into() {
assert_suggestion_result(
@ -2411,6 +2426,15 @@ mod tests {
);
}
#[test]
fn correct_last_ditch_space() {
assert_suggestion_result(
"There are unique use cases and is meant to be a last ditch option.",
lint_group(),
"There are unique use cases and is meant to be a last-ditch option.",
);
}
#[test]
fn corrects_invest_into() {
assert_suggestion_result(