perf: bail early in too_many_lines lint if rule is not enabled. - #17605
perf: bail early in too_many_lines lint if rule is not enabled.#17605connorshea wants to merge 1 commit into
too_many_lines lint if rule is not enabled.#17605Conversation
If the rule isn't enabled (which is the default behavior), there's no reason to to read all the lines in the function and count them.
|
Thanks for the pull request. A reviewer will take a look after it receives 2 community reviews. In the meantime, we would highly appreciate if you could try to review any of PRs waiting on community reviews. |
There was a problem hiding this comment.
🤔 Would this not be better to do outside of this fn and for all of the variants?
Why only too_many_lines and
So in
rust-clippy/clippy_lints/src/functions/mod.rs
Lines 539 to 565 in cc7fb2d
Is the check for the others more expensive than the actual lint or why is this done this way? 🤔
There was a problem hiding this comment.
community review: actual changes look good to me, @CommanderStorm raises a good point about doing this more generally but that shouldn't block the improvement here
|
r? @Jarcho rustbot has assigned @Jarcho for the project review. Use Why was this reviewer chosen?The reviewer was selected based on:
|
this might be a good idea but I'm not sure if that'd break the ability to enable specific rules mid-file, which I assume is why it works this way right now |
|
afaik not running a lint on a HIR node if the latter has an |
If the rule isn't enabled (which is the default behavior), there's no reason to scan the lines in the given function and count them. This avoids extra work for most users.
changelog: none