When running cargo publish in a crate that has examples or tests, and explicitly lists what to include in package.include (and doesn't list examples or tests, but only /src/), one gets the following warnings:
warning: ignoring example `hello` as `examples/hello.rs` is not included in the published package
warning: ignoring test `spec` as `tests/spec.rs` is not included in the published package
What's the rationale behind those warnings?
How do I disable them? I tried to specify --lib to say that I only want to publish the library, but it's not recognized.
They used to be errors. The rationale of downgrading them to warnings is discussed in the PR that made the change.
You can add the -q/--quiet flag to suppress log messages in general. Or use --no-verify, which will skip the verification step, where the warning stems from.
Note that the warning only applies to explicit targets (that you defined in your Cargo.toml as i.e. [[test]] or [[example]]) that are excluded. Maybe you could avoid making your test and example targets explicit, that would also remove the warning.
Thanks! That was the part I was missing to figure out something's wrong and it's likely a regression. Because I don't have any [[test]] or [[example]] in my Cargo.toml. The warnings are about implicit targets.