rust-clippy
rust-clippy copied to clipboard
Warn if a `[patch.*]` section is used on a dependency of a library
What it does
If a [patch]
section is used to override a dependency, it is only applicable to the current crate. Dependencies ignore this. If a library tries to patch a dependency (not a dev-dependency
or build-dependency
) this is useless since it won't apply to anything actually using this library, but it would appear to work in tests.
Advantage
- Prevents accidental use of the
[patch]
section when it won't work
Drawbacks
There might be some edge cases where this is wanted, but I'm not currently aware of any.
Example
[patch.crates-io]
foo = { git = 'https://github.com/example/foo.git' }
Would generate a clippy warning such as
The patch override for dependency `foo` will be ignored outside of this crate.