Skip to content

Commit 0942fc7

Browse files
committed
Auto merge of #11630 - Muscraft:fix-unused-manifest-keys, r=ehuss
fix(toml): Provide a way to show unused manifest keys for dependencies Dependencies have not been able to show unused manifest keys for some time, this problem partially resulted in #11329. This problem is caused by having an `enum` when deserializing. To get around this you can use: ```rust #[serde(flatten)] other: BTreeMap<String, toml::Value>, ``` This collects any unused keys into `other` that can later be used to show warnings. This idea was suggested in a thread I cannot find but is mentioned in [serde#941](serde-rs/serde#941).
2 parents dbb2d67 + a32af2f commit 0942fc7

File tree

6 files changed

+513
-68
lines changed

6 files changed

+513
-68
lines changed

src/cargo/core/dependency.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ pub enum DepKind {
106106
Build,
107107
}
108108

109+
impl DepKind {
110+
pub fn kind_table(&self) -> &'static str {
111+
match self {
112+
DepKind::Normal => "dependencies",
113+
DepKind::Development => "dev-dependencies",
114+
DepKind::Build => "build-dependencies",
115+
}
116+
}
117+
}
118+
109119
impl ser::Serialize for DepKind {
110120
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
111121
where

0 commit comments

Comments
 (0)