cargo_metadata icon indicating copy to clipboard operation
cargo_metadata copied to clipboard

Split main code into modules

Open morr0ne opened this issue 2 years ago • 3 comments

Currently most of the code live in the lib.rs file. The file has reached almost 700 lines which can make it a bit confusing to navigate. I think it might be a good idea to split the code in smaller modules, something more like: metadata.rs, target.rs, command.rs and so on an so forth. Then export everything from the main lib.rs. This approach comes with a cleaner separation of the various impls/structs which are seemingly scattered around the lib.rs file without a clear hierarchy. This is probably due too continuous addition to the originally simple lib.rs file which got progressively more complex.

morr0ne avatar Jul 01 '22 08:07 morr0ne

I'd love to tackle this immediately as it's relatively straight foreword thing to do but it's probably better for #185 to be merged first otherwise we will drown in merge conflicts.

morr0ne avatar Jul 01 '22 08:07 morr0ne

Another reason to consider splitting up the code is supporting other commands such as #107 although I'm not sure that it applies to cargo_metadata

morr0ne avatar Jul 01 '22 09:07 morr0ne

I've used git too long and every time I see "submodule" I think it means git submodules; edited the title just for my sanity.

jyn514 avatar Jul 10 '22 22:07 jyn514