rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.28k stars 1.52k forks source link

[Project Goal, Help Wanted] Optimizing MSRV attribute collection #13169

Open blyxyas opened 1 month ago

blyxyas commented 1 month ago

Currently, when knowing if the MSRV is high enough to run a lint, we're doing lots of repeated work. We visit the same attributes a lot of times with the extract_msrv_attr! (specifically, the number of lints that use MSRVs, so a good number of dozens).

A possible solution to this would be precomputing the MSRV by DefId, as there can be more than a single clippy::msrv attribute on a single module.

Additional resources:

Alexendoo commented 1 month ago

MSRV tracking will have to change anyway for incremental lints - they're run separately for each module so the current extraction mechanism wouldn't work

Since I'll be changing it for that I can take a look at reducing the amount of attribute parsing going on too

Early lints will probably stay the same for now at least

Alexendoo commented 1 month ago

Gonna remove help wanted until ^ is done, I'll make that the first thing I do though if someone wants to look at it further after that