Description
I just noticed that online some people write "for while" instead of "for a while". Probably mostly non-native English speakers. But maybe also thinking faster than typing, or hasty editing.
This can probably be combined with the lint for "for awhile". (Not sure if we already handle that.)
Examples
- Compiled on RHEL6.1 with libncurses included but it will crash after using it for while also lots of garbage left when you navigate screen.
- I use it for while and then ty to remove it
- I've been looking at this for while and just can't figure how what I have done wrong with the configuration.
Potential False Positives
Yes! People often talk about for-while loops or for/while loops but sometimes just "for while" without a hyphen or slash or using the word "loop".
Maybe the best way to handle this besides checking for the word "loop" is to use wording like "Unless discussing for and while loops, use for a while.
"For while" can also be used to provide a counterpoint:
- For while I appreciate your input, I think we should consider other options as well.
But I think this can only happen at the beginning of clauses:
- "I enjoy hiking, for while it can be challenging, the views are always worth it."
Maybe a good implementation would use .iterate_chunks and skip the first token.
It turns out we handle "in while" along with "in a while" in phrase_corrections.rs but not "for ..." and while thinking about this I realized there's also "after a while" with "after awhile" and "after while" nonstandard variants.
Description
I just noticed that online some people write "for while" instead of "for a while". Probably mostly non-native English speakers. But maybe also thinking faster than typing, or hasty editing.
This can probably be combined with the lint for "for awhile". (Not sure if we already handle that.)
Examples
Potential False Positives
Yes! People often talk about for-while loops or for/while loops but sometimes just "for while" without a hyphen or slash or using the word "loop".
Maybe the best way to handle this besides checking for the word "loop" is to use wording like "Unless discussing
forandwhileloops, usefor a while."For while" can also be used to provide a counterpoint:
But I think this can only happen at the beginning of clauses:
Maybe a good implementation would use
.iterate_chunksand skip the first token.It turns out we handle "in while" along with "in a while" in
phrase_corrections.rsbut not "for ..." and while thinking about this I realized there's also "after a while" with "after awhile" and "after while" nonstandard variants.