Open
Description
What it does
Checks paths in include_str
and include_bytes
and make sure those paths are found in the include
field in Cargo.toml
.
Advantage
When using a workspace it is easy to make the mistake of include_bytes!("../../other_crate/data/file.png")
. The code will run, but cargo publish
will fail, as the referenced file is not part of the crate.
This is true for any file not found in the include
field of the crate's Cargo.toml
.
Drawbacks
This is only relevant for crates that are intended to be published, i.e. has publish = true
in their Cargo.toml
.
Example
include_bytes!("../../other_crate/data/file.png")
Clippy warning: The file "../../other_crate/data/file.png" is outside the this crate, so cargo publish
will fail.