Skip to content

Commit

Permalink
Remove warning for aggressive flag without -p flag
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <[email protected]>
  • Loading branch information
Rustin170506 committed Nov 30, 2022
1 parent 71e4dbd commit c51f8ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 86 deletions.
11 changes: 4 additions & 7 deletions src/bin/cargo/commands/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ pub fn cli() -> Command {
.arg_quiet()
.arg(flag("workspace", "Only update the workspace packages").short('w'))
.arg_package_spec_simple("Package to update")
.arg(
flag(
"aggressive",
"Force updating all dependencies of SPEC as well when used with -p",
)
.requires("package"),
)
.arg(flag(
"aggressive",
"Force updating all dependencies of SPEC as well when used with -p",
))
.arg_dry_run("Don't actually write the lockfile")
.arg(
opt(
Expand Down
79 changes: 0 additions & 79 deletions tests/testsuite/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,46 +427,6 @@ fn update_precise_do_not_force_update_deps() {
.run();
}

#[cargo_test]
fn update_precise_without_package() {
Package::new("serde", "0.2.0").publish();

let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "bar"
version = "0.0.1"
authors = []
[dependencies]
serde = "0.2"
"#,
)
.file("src/lib.rs", "")
.build();

p.cargo("build").run();

Package::new("serde", "0.2.1").publish();
Package::new("serde", "0.3.0").publish();

p.cargo("update --precise 0.3.0")
.with_status(1)
.with_stderr(
"\
[ERROR] The following required arguments were not provided:
--package [<SPEC>]
Usage: cargo[EXE] update --package [<SPEC>] --precise <PRECISE>
For more information try '--help'
",
)
.run();
}

#[cargo_test]
fn update_aggressive() {
Package::new("log", "0.1.0").publish();
Expand Down Expand Up @@ -504,45 +464,6 @@ fn update_aggressive() {
.run();
}

#[cargo_test]
fn update_aggressive_without_package() {
Package::new("serde", "0.2.0").publish();

let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "bar"
version = "0.0.1"
authors = []
[dependencies]
serde = "0.2"
"#,
)
.file("src/lib.rs", "")
.build();

p.cargo("build").run();

Package::new("serde", "0.2.1").publish();

p.cargo("update --aggressive")
.with_status(1)
.with_stderr(
"\
[ERROR] The following required arguments were not provided:
--package [<SPEC>]
Usage: cargo[EXE] update --package [<SPEC>] --aggressive
For more information try '--help'
",
)
.run();
}

// cargo update should respect its arguments even without a lockfile.
// See issue "Running cargo update without a Cargo.lock ignores arguments"
// at <https://github.com/rust-lang/cargo/issues/6872>.
Expand Down

0 comments on commit c51f8ad

Please sign in to comment.