That only applies when dynamic dispatch is involved and the linker can't trace the calls. For direct calls and generics(which idiomatic Rust code tends to prefer over dyn traits) LTO will prune extensively.
let uri = get_uri_from_stdin();
networking_library::make_request(uri);
How is the compiler supposed to prune that? let uri: Uri<HTTP> = get_uri_from_stdin().parse()?;
If the library is made in a modular way this is how it would typically be done. The `HTTP` may be inferred by calls further along in the function.If you want to mix schemes you would need to be able to handle all schemes; you can either go through all variations (through the same generics) you want to test or just just accept that you need a full URI parser and lose the generic.
let uri: Uri<FTP or HTTP or HTTPS> = parse_uri(get_uri_from_stdin()) or fail;If your library cannot parse FTP, either you enable that feature, add that feature, or use a different library.