Skip to content

Commit c51f8ad

Browse files
committed
Remove warning for aggressive flag without -p flag
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
1 parent 71e4dbd commit c51f8ad

File tree

2 files changed

+4
-86
lines changed

2 files changed

+4
-86
lines changed

src/bin/cargo/commands/update.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ pub fn cli() -> Command {
99
.arg_quiet()
1010
.arg(flag("workspace", "Only update the workspace packages").short('w'))
1111
.arg_package_spec_simple("Package to update")
12-
.arg(
13-
flag(
14-
"aggressive",
15-
"Force updating all dependencies of SPEC as well when used with -p",
16-
)
17-
.requires("package"),
18-
)
12+
.arg(flag(
13+
"aggressive",
14+
"Force updating all dependencies of SPEC as well when used with -p",
15+
))
1916
.arg_dry_run("Don't actually write the lockfile")
2017
.arg(
2118
opt(

tests/testsuite/update.rs

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -427,46 +427,6 @@ fn update_precise_do_not_force_update_deps() {
427427
.run();
428428
}
429429

430-
#[cargo_test]
431-
fn update_precise_without_package() {
432-
Package::new("serde", "0.2.0").publish();
433-
434-
let p = project()
435-
.file(
436-
"Cargo.toml",
437-
r#"
438-
[package]
439-
name = "bar"
440-
version = "0.0.1"
441-
authors = []
442-
443-
[dependencies]
444-
serde = "0.2"
445-
"#,
446-
)
447-
.file("src/lib.rs", "")
448-
.build();
449-
450-
p.cargo("build").run();
451-
452-
Package::new("serde", "0.2.1").publish();
453-
Package::new("serde", "0.3.0").publish();
454-
455-
p.cargo("update --precise 0.3.0")
456-
.with_status(1)
457-
.with_stderr(
458-
"\
459-
[ERROR] The following required arguments were not provided:
460-
--package [<SPEC>]
461-
462-
Usage: cargo[EXE] update --package [<SPEC>] --precise <PRECISE>
463-
464-
For more information try '--help'
465-
",
466-
)
467-
.run();
468-
}
469-
470430
#[cargo_test]
471431
fn update_aggressive() {
472432
Package::new("log", "0.1.0").publish();
@@ -504,45 +464,6 @@ fn update_aggressive() {
504464
.run();
505465
}
506466

507-
#[cargo_test]
508-
fn update_aggressive_without_package() {
509-
Package::new("serde", "0.2.0").publish();
510-
511-
let p = project()
512-
.file(
513-
"Cargo.toml",
514-
r#"
515-
[package]
516-
name = "bar"
517-
version = "0.0.1"
518-
authors = []
519-
520-
[dependencies]
521-
serde = "0.2"
522-
"#,
523-
)
524-
.file("src/lib.rs", "")
525-
.build();
526-
527-
p.cargo("build").run();
528-
529-
Package::new("serde", "0.2.1").publish();
530-
531-
p.cargo("update --aggressive")
532-
.with_status(1)
533-
.with_stderr(
534-
"\
535-
[ERROR] The following required arguments were not provided:
536-
--package [<SPEC>]
537-
538-
Usage: cargo[EXE] update --package [<SPEC>] --aggressive
539-
540-
For more information try '--help'
541-
",
542-
)
543-
.run();
544-
}
545-
546467
// cargo update should respect its arguments even without a lockfile.
547468
// See issue "Running cargo update without a Cargo.lock ignores arguments"
548469
// at <https://github.com/rust-lang/cargo/issues/6872>.

0 commit comments

Comments
 (0)