diff --git a/src/bin/cargo/commands/update.rs b/src/bin/cargo/commands/update.rs index 9a0b99b9181..771957169af 100644 --- a/src/bin/cargo/commands/update.rs +++ b/src/bin/cargo/commands/update.rs @@ -7,7 +7,7 @@ pub fn cli() -> App { subcommand("update") .about("Update dependencies as recorded in the local lock file") .arg(opt("quiet", "No output printed to stdout").short("q")) - .arg(opt("workspace", "Only update the workspace pakcages").short("w")) + .arg(opt("workspace", "Only update the workspace packages").short("w")) .arg_package_spec_simple("Package to update") .arg(opt( "aggressive", diff --git a/src/cargo/ops/cargo_generate_lockfile.rs b/src/cargo/ops/cargo_generate_lockfile.rs index 6b2d941433c..0040bc9b0d6 100644 --- a/src/cargo/ops/cargo_generate_lockfile.rs +++ b/src/cargo/ops/cargo_generate_lockfile.rs @@ -36,19 +36,6 @@ pub fn generate_lockfile(ws: &Workspace<'_>) -> CargoResult<()> { } pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoResult<()> { - if opts.workspace { - if opts.aggressive { - anyhow::bail!("cannot specify aggressive for workspace updates"); - } - if opts.precise.is_some() { - anyhow::bail!("cannot specify precise for workspace updates"); - } - - ws.emit_warnings()?; - let (_packages, _resolve) = ops::resolve_ws(ws)?; - return Ok(()); - } - if opts.aggressive && opts.precise.is_some() { anyhow::bail!("cannot specify both aggressive and precise simultaneously") } @@ -92,8 +79,10 @@ pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoRes let mut to_avoid = HashSet::new(); if opts.to_update.is_empty() { - to_avoid.extend(previous_resolve.iter()); - to_avoid.extend(previous_resolve.unused_patches()); + if !opts.workspace { + to_avoid.extend(previous_resolve.iter()); + to_avoid.extend(previous_resolve.unused_patches()); + } } else { let mut sources = Vec::new(); for name in opts.to_update.iter() { diff --git a/src/doc/man/cargo-update.md b/src/doc/man/cargo-update.md index 4be609d83e4..54aa90ae846 100644 --- a/src/doc/man/cargo-update.md +++ b/src/doc/man/cargo-update.md @@ -49,7 +49,6 @@ Attempt to update only packages defined in the workspace. Other packages are updated only if they don't already exist in the lockfile. This option is useful for updating `Cargo.lock` after you've changed version numbers in `Cargo.toml`. -Cannot be used with `--precise` or `--aggressive`. {{/option}} {{#option "`--dry-run`" }} diff --git a/src/doc/man/generated_txt/cargo-update.txt b/src/doc/man/generated_txt/cargo-update.txt index c8225b39955..b2232fd2fba 100644 --- a/src/doc/man/generated_txt/cargo-update.txt +++ b/src/doc/man/generated_txt/cargo-update.txt @@ -39,8 +39,7 @@ OPTIONS Attempt to update only packages defined in the workspace. Other packages are updated only if they don't already exist in the lockfile. This option is useful for updating Cargo.lock after you've - changed version numbers in Cargo.toml. Cannot be used with --precise - or --aggressive. + changed version numbers in Cargo.toml. --dry-run Displays what would be updated, but doesn't actually write the diff --git a/src/doc/src/commands/cargo-update.md b/src/doc/src/commands/cargo-update.md index 5199e210ea5..8b974d79381 100644 --- a/src/doc/src/commands/cargo-update.md +++ b/src/doc/src/commands/cargo-update.md @@ -48,8 +48,7 @@ revision (such as a SHA hash or tag).
Attempt to update only packages defined in the workspace. Other packages are updated only if they don't already exist in the lockfile. This option is useful for updating Cargo.lock after you've changed version -numbers in Cargo.toml. -Cannot be used with --precise or --aggressive.
+numbers in Cargo.toml.
--dry-run
diff --git a/src/etc/man/cargo-update.1 b/src/etc/man/cargo-update.1 index 94ef3e13a73..ee977985480 100644 --- a/src/etc/man/cargo-update.1 +++ b/src/etc/man/cargo-update.1 @@ -49,7 +49,6 @@ Attempt to update only packages defined in the workspace. Other packages are updated only if they don't already exist in the lockfile. This option is useful for updating \fBCargo.lock\fR after you've changed version numbers in \fBCargo.toml\fR\&. -Cannot be used with \fB\-\-precise\fR or \fB\-\-aggressive\fR\&. .RE .sp \fB\-\-dry\-run\fR