Crawling crates for type/api indexing/analysis - RLS or Clippy?

I'm exploring ways to crawl crates available on crates.io for indexing and analysis. I'd like to record where unsafe blocks occur and item usage (items being macros, enums, structs, traits, functions & methods). I have a couple of fun (and useful) ideas of what could be done with the ability to dump that information for every crate on crates.io.
Currently I'm trying to figure out whether it would be better to try to utilize the RLS or clippy to do this.

I've done a little experimenting with clippy. It looks like the LateContext gives me basically what I need with access to the HIR, but I've been having trouble trying to resolve types on expressions. I've also found that clippy actually runs (but in a mostly silent mode) on dependencies of the current crate which is very, very conventient.

I've looked at some of the test data for the RLS and it looks like I'd have to invoke it and redo work in order to get at the non-public data of the crate (e.g. usage of items). I also don't know if has access to HIR, but I'm not sure I'd actually need it.

So hopefully somebody who is familiar with clippy and the RLS can weigh in and let me know if they have any opinions on if this is actually doable, and if so, which path is least painful.

I know that clippy relies heavily on rustc internals, but at this point it seems like the way to go.

RLS works on top of save-analysis data. I don’t think save analysis includes info about unsafe blocks. See rls_analysis - Rust for docs.

Does cargo-geiger do what you need?

Cargo-geiger doesn't quite cut it. I'm hoping to index with types the unsafe blocks - cargo Geer at this point only just counts the unsafe occurences.

Thanks! I'll plan on perusing the clippy lint extension route then. :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.