From e66c413b864c1ca17e751ac01a5312b8666a86fe Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Wed, 31 Oct 2018 08:34:04 -0400 Subject: [PATCH] Support untyped warnings from crates.io with successful publish --- src/cargo/ops/registry.rs | 6 ++++++ src/crates-io/lib.rs | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index 3932abdbece..2993fb7060d 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -276,6 +276,12 @@ fn transmit( config.shell().warn(&msg)?; } + if !warnings.other.is_empty() { + for msg in warnings.other { + config.shell().warn(&msg)?; + } + } + Ok(()) } Err(e) => Err(e), diff --git a/src/crates-io/lib.rs b/src/crates-io/lib.rs index 6de2f30533a..65843e7dcca 100644 --- a/src/crates-io/lib.rs +++ b/src/crates-io/lib.rs @@ -86,6 +86,7 @@ pub struct User { pub struct Warnings { pub invalid_categories: Vec, pub invalid_badges: Vec, + pub other: Vec, } #[derive(Deserialize)] @@ -223,9 +224,17 @@ impl Registry { .map(|x| x.iter().flat_map(|j| j.as_str()).map(Into::into).collect()) .unwrap_or_else(Vec::new); + let other: Vec = response + .get("warnings") + .and_then(|j| j.get("other")) + .and_then(|j| j.as_array()) + .map(|x| x.iter().flat_map(|j| j.as_str()).map(Into::into).collect()) + .unwrap_or_else(Vec::new); + Ok(Warnings { invalid_categories, invalid_badges, + other, }) }