Skip to content

Commit

Permalink
Auto merge of #7243 - ehuss:ws-warn-fetch, r=alexcrichton
Browse files Browse the repository at this point in the history
`cargo fetch`: Display workspace warnings.

Warnings were previously hidden with `cargo fetch`. It may be a little confusing, so go ahead and display them.

cc #7180 (comment)

I thought about other commands that don't display warnings, but I couldn't think of any others where it would be useful. The only edge case is `publish`/`package`, which won't display unused key warnings because the manifest is rewritten and they are stripped. But displaying warnings there is awkward because some warnings will be displayed twice.
  • Loading branch information
bors committed Aug 13, 2019
2 parents 85a52ce + 22619a2 commit 0b0bb84
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cargo/ops/cargo_fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub fn fetch<'a>(
ws: &Workspace<'a>,
options: &FetchOptions<'a>,
) -> CargoResult<(Resolve, PackageSet<'a>)> {
ws.emit_warnings()?;
let (packages, resolve) = ops::resolve_ws(ws)?;

let jobs = Some(1);
Expand Down
19 changes: 19 additions & 0 deletions tests/testsuite/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,22 @@ fn fetch_platform_specific_dependencies() {
.with_stderr_does_not_contain("[DOWNLOADED] d1 v1.2.3 [..]")
.run();
}

#[cargo_test]
fn fetch_warning() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "1.0.0"
misspelled = "wut"
"#,
)
.file("src/lib.rs", "")
.build();
p.cargo("fetch")
.with_stderr("[WARNING] unused manifest key: package.misspelled")
.run();
}

0 comments on commit 0b0bb84

Please sign in to comment.