foundry-rs / compilers

Utilities for working with native solc and compiling projects.
Apache License 2.0
58 stars 34 forks source link

chore: remove most impl AsRef<str,Path> #157

Closed DaniPopes closed 6 days ago

DaniPopes commented 6 days ago

These mostly only bloat code size and compilation times, which are already not great when we are already codegenning a billion structs and ASTs with serde derives

For AsRef, the only change is having to specify an extra 1 (one) character (&) when using String so it derefs to str, otherwise it's the same

For AsRef it's the same as AsRef when using Path/PathBuf, but it's a bit worse for string literals; but most of these functions are called with variables in the first place. except in tests which will have to use .as_ref() or Path::new

I've not removed these when using with &[] or impl IntoIterator since that does help quite a bit, e.g if you have an owning iterator of Strings, you cannot borrow inside of a map closure

I've also kept Into since that makes more sense, you want to avoid cloning if you can pass in an owned thing already, otherwise you'll clone it yourself

Also fixes some inconsistencies in function signatures for str vs path

DaniPopes commented 6 days ago

Pending github waking up and running actions