hobofan / cargo-nono

Check your crate for (possible) no_std compatibility
Apache License 2.0
209 stars 12 forks source link

Adding support to check tests / examples #24

Open elichai opened 5 years ago

elichai commented 5 years ago

Hi, I have a proc-macro that I want to make sure that the results are always no-std compatible (I'll add this to the CI), for that I need this to check the examples/tests of my crate instead of the crate itself. In cargo clippy/check/fmt you can use: --examples / --tests

Thanks.

hobofan commented 5 years ago

👍 Checks for examples shouldn't be that hard to implement. I'll look into that! (A PR would also be welcome 😉 )

Cheking tests is more complicated though, I think. IIRC tests always require std to be present, due to how the normal cargo test harness works. So it would be really hard to separate the std that's coming from the test environment from the test contents that are supposed to be no_std.

Would be good to know the crate you want to introduce it for, if possible. (I'm guessing https://github.com/elichai/log-derive ?)

elichai commented 5 years ago

Yes, that's the crate :) Hmm maybe tonight I'll try to look at your code see if I can make a PR for that myself. Never wrote custom commands to cargo so might be interesting to look at how it's implemented

elichai commented 5 years ago

Another thing, have you checked if this fails a CI? would be helpful if it is, otherwise it might only require exiting via std::process::exit(1)