Skip to content

Commit 0b0bb84

Browse files
committed
Auto merge of #7243 - ehuss:ws-warn-fetch, r=alexcrichton
`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.
2 parents 85a52ce + 22619a2 commit 0b0bb84

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/cargo/ops/cargo_fetch.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn fetch<'a>(
1616
ws: &Workspace<'a>,
1717
options: &FetchOptions<'a>,
1818
) -> CargoResult<(Resolve, PackageSet<'a>)> {
19+
ws.emit_warnings()?;
1920
let (packages, resolve) = ops::resolve_ws(ws)?;
2021

2122
let jobs = Some(1);

tests/testsuite/fetch.rs

+19
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,22 @@ fn fetch_platform_specific_dependencies() {
112112
.with_stderr_does_not_contain("[DOWNLOADED] d1 v1.2.3 [..]")
113113
.run();
114114
}
115+
116+
#[cargo_test]
117+
fn fetch_warning() {
118+
let p = project()
119+
.file(
120+
"Cargo.toml",
121+
r#"
122+
[package]
123+
name = "foo"
124+
version = "1.0.0"
125+
misspelled = "wut"
126+
"#,
127+
)
128+
.file("src/lib.rs", "")
129+
.build();
130+
p.cargo("fetch")
131+
.with_stderr("[WARNING] unused manifest key: package.misspelled")
132+
.run();
133+
}

0 commit comments

Comments
 (0)