Summary
Today if you run cargo test --doc you'll see the following error
warning: doc tests are not supported for crate type(s) `cdylib` in package `marker_lints`
error: no library targets found in package `marker_lints`
There are no good solutions to this problem. Same problem is also described in use-ink/cargo-contract#494.
We could recommend setting crate-type = ["cdylib", "rlib"] to make the doc tests work, but it means that the lint crates would be compiled as a static library in addition to a dynamic one. I suppose that it will influence the lint crates compilation performance by compiling an additional unnecessary library target.
We could provide a command in cargo-marker that adds the rlib crate type temporarily for doc tests. But that will look ugly if we need to modify the Cargo.toml of the crate. What if the process is killed? The modifications to the Cargo.toml file will persist and be potentially committed to the version control. Copying the project to a temp directory would solve this, but it may have a bunch of edge cases on its own as well...
Summary
Today if you run
cargo test --docyou'll see the following errorThere are no good solutions to this problem. Same problem is also described in use-ink/cargo-contract#494.
We could recommend setting
crate-type = ["cdylib", "rlib"]to make the doc tests work, but it means that the lint crates would be compiled as a static library in addition to a dynamic one. I suppose that it will influence the lint crates compilation performance by compiling an additional unnecessary library target.We could provide a command in
cargo-markerthat adds therlibcrate type temporarily for doc tests. But that will look ugly if we need to modify theCargo.tomlof the crate. What if the process is killed? The modifications to theCargo.tomlfile will persist and be potentially committed to the version control. Copying the project to a temp directory would solve this, but it may have a bunch of edge cases on its own as well...