diff --git a/src/cargo/core/features.rs b/src/cargo/core/features.rs
index 8ed33b2f6..2f7ea741a 100644
--- a/src/cargo/core/features.rs
+++ b/src/cargo/core/features.rs
@@ -333,7 +333,10 @@ impl Features {
/// and then test for your flag or your value and act accordingly.
///
/// If you have any trouble with this, please let us know!
-#[derive(Default, Debug)]
+#[derive(Default, Debug, Deserialize)]
+#[serde(default)]
+#[serde(deny_unknown_fields)]
+#[serde(rename_all="kebab-case")]
pub struct CliUnstable {
pub print_im_a_teapot: bool,
pub unstable_options: bool,
diff --git a/src/cargo/util/config/mod.rs b/src/cargo/util/config/mod.rs
index bb3149352..156a272b9 100644
--- a/src/cargo/util/config/mod.rs
+++ b/src/cargo/util/config/mod.rs
@@ -63,7 +63,7 @@ use std::str::FromStr;
use std::sync::Once;
use std::time::Instant;
-use anyhow::{anyhow, bail, Context};
+use anyhow::{anyhow, bail};
use curl::easy::Easy;
use lazycell::LazyCell;
use serde::Deserialize;
@@ -745,18 +745,13 @@ impl Config {
// If nightly features are enabled, allow setting Z-flags from config
// using the `unstable` table. Ignore that block otherwise.
if nightly_features_allowed() {
- if let Some(unstable_configs) =
- self.get::