I'm trying to add code coverage to my rust library. It's reporting that it is covered 100%, but when I look at the report a lot of lines are not counted: https://codecov.io/gh/JelteF/defaultmap/src/c878e108c61f270718c909e1500c4c2e865a33d1/src/lib.rs#L93...106
What is the reason for this and is it possible to fix this? I have already tried setting RUSTFLAGS to "-C link-dead-code" as suggested in this answer: https://stackoverflow.com/a/38371687/2570866 That didn't help however.
This is a known issue (https://github.com/rust-lang/rust/issues/39293), with no solutions implemented yet. Generics in Rust are similar to templates in C++, if you don't use the generic function, no code will be generated at all. Indeed those functions are not present:
I think, for now, the only practical solution is to manually inspect the coverage report, and add back missing tests for the ignored functions.