-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Range::step_by(0) #95
Comments
We should probably have a single file which handles all lints which ban a type, function, or method |
Yeah, this should probably be in the same LintPass as #96. |
Actually, no, #96 is a pure AST match, whereas all of these (Option::unwrap, Range::step_by(0)) are middle-based checks that need to use expr_ty and match_def_path |
Most ranges will be defined in the same line of code as their We would need const folding for the check anyway (because the type won't tell us the range boundaries), so |
No, I meant that all of these "ban a method" etc use |
I agree wholeheartedly with your organization, but I think you've misclassified this issue. As I said, this should be a pure AST match + const folding. |
Oh, you intend for this lint to only work on range literals? Works for me! |
Note: Using T-AST for lints which need const folding but are otherwise pure AST |
Full ack. Once we have the const folding separated out into a |
I'm going to take a stab at this today. My plan is to warn on any use of Are there any examples of how to do constant folding? |
Ignore the constant folding for a bit, that will be available once @llogiq's stuff merges. Match on literal zeroes and leave a FIXME comment about constant folding |
New lint: Range::step_by(0) (fixes #95)
This currently doesn't even panic, but happily loops forever. Well, unless it is clipped with
.take(_)
or some such.The text was updated successfully, but these errors were encountered: