I agree with the approach previously recommended here that you rather than building just a binary, you should have a binary that does just
main and arg parsing, and calls into a library. (This is specifically in the context of https://github.com/sourcefrog/conserve.)
It seems like the natural way to do this in Rust is with a single crate that provides both a
[[bin]] and library section.
But then, doing that seems fairly imperfectly supported across the Rust ecosystem: for example cargo-check won’t work on such crates, and nor will Clippy. (Actually perhaps these have the same underlying cause in rustc or cargo?)
So my questions are:
Would I be better off refactoring one into a sub-crate or a separate standalone crate? If so, which? I would really like
cargo install conserveto work to install the command-line tool.
Maybe the Rust book, or the Cargo documentation, or the Rust guide (maybe here?) could give some guidance on this?