Skip to content

Commit 03491c8

Browse files
Update doc wildcard_dependencies
1 parent c2d23ad commit 03491c8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

clippy_lints/src/cargo/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,25 @@ declare_clippy_lint! {
155155
/// [As the edition guide says](https://rust-lang-nursery.github.io/edition-guide/rust-2018/cargo-and-crates-io/crates-io-disallows-wildcard-dependencies.html),
156156
/// it is highly unlikely that you work with any possible version of your dependency,
157157
/// and wildcard dependencies would cause unnecessary breakage in the ecosystem.
158+
/// Instead, you must actually specify a specific version or range of versions, using one of the `semver` crate’s various options: `^`, `~`, or `=`.
158159
///
159160
/// ### Example
160161
/// ```toml
161162
/// [dependencies]
162163
/// regex = "*"
163164
/// ```
165+
/// Use instead:
166+
/// ```toml
167+
/// [dependencies]
168+
/// # compatible with the specified version and any version that doesn't introduce breaking changes
169+
/// some_crate_1 = "^1.2.3"
170+
///
171+
/// # allow patch updates, but not minor or major version changes
172+
/// some_crate_2 = "~1.2.3"
173+
///
174+
/// # pin the version to a specific version
175+
/// some_crate_3 = "=1.2.3"
176+
/// ```
164177
#[clippy::version = "1.32.0"]
165178
pub WILDCARD_DEPENDENCIES,
166179
cargo,

0 commit comments

Comments
 (0)