diff --git a/Cargo.toml b/Cargo.toml
index cf3bfb0d9683..47112a0784a9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -66,7 +66,8 @@ tar = { version = "0.4.38", default-features = false }
tempfile = "3.0"
termcolor = "1.1"
time = { version = "0.3", features = ["parsing", "formatting"]}
-toml_edit = { version = "0.15.0", features = ["serde", "easy", "perf"] }
+toml_edit = "0.18.0"
+toml = "0.6.0"
unicode-xid = "0.2.0"
url = "2.2.2"
walkdir = "2.2"
diff --git a/benches/capture/Cargo.toml b/benches/capture/Cargo.toml
index 3ff3e70a1ac9..fe6ce550337c 100644
--- a/benches/capture/Cargo.toml
+++ b/benches/capture/Cargo.toml
@@ -9,4 +9,4 @@ description = "Tool for capturing a real-world workspace for benchmarking."
cargo_metadata = "0.14.0"
flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] }
tar = { version = "0.4.38", default-features = false }
-toml_edit = { version = "0.15.0", features = ["serde", "easy", "perf"] }
+toml = "0.6.0"
diff --git a/benches/capture/src/main.rs b/benches/capture/src/main.rs
index 8656c63c3ee4..f6f02c4ba051 100644
--- a/benches/capture/src/main.rs
+++ b/benches/capture/src/main.rs
@@ -8,7 +8,6 @@ use flate2::{Compression, GzBuilder};
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
-use toml_edit::easy as toml;
fn main() {
let force = std::env::args().any(|arg| arg == "-f");
diff --git a/crates/cargo-test-support/Cargo.toml b/crates/cargo-test-support/Cargo.toml
index 653c5db4d61e..01b4ab479b6f 100644
--- a/crates/cargo-test-support/Cargo.toml
+++ b/crates/cargo-test-support/Cargo.toml
@@ -25,7 +25,7 @@ serde = { version = "1.0.123", features = ["derive"] }
serde_json = "1.0"
tar = { version = "0.4.38", default-features = false }
termcolor = "1.1.2"
-toml_edit = { version = "0.15.0", features = ["serde", "easy", "perf"] }
+toml = "0.6.0"
url = "2.2.2"
[target.'cfg(windows)'.dependencies]
diff --git a/crates/cargo-test-support/src/registry.rs b/crates/cargo-test-support/src/registry.rs
index 7574151ab652..a9d458c04695 100644
--- a/crates/cargo-test-support/src/registry.rs
+++ b/crates/cargo-test-support/src/registry.rs
@@ -1391,10 +1391,13 @@ impl Package {
let mut manifest = String::new();
if !self.cargo_features.is_empty() {
- manifest.push_str(&format!(
- "cargo-features = {}\n\n",
- toml_edit::ser::to_item(&self.cargo_features).unwrap()
- ));
+ let mut features = String::new();
+ serde::Serialize::serialize(
+ &self.cargo_features,
+ toml::ser::ValueSerializer::new(&mut features),
+ )
+ .unwrap();
+ manifest.push_str(&format!("cargo-features = {}\n\n", features));
}
manifest.push_str(&format!(
diff --git a/src/cargo/core/manifest.rs b/src/cargo/core/manifest.rs
index c37dd1cb4558..182882dad75d 100644
--- a/src/cargo/core/manifest.rs
+++ b/src/cargo/core/manifest.rs
@@ -9,7 +9,6 @@ use anyhow::Context as _;
use semver::Version;
use serde::ser;
use serde::Serialize;
-use toml_edit::easy as toml;
use url::Url;
use crate::core::compiler::rustdoc::RustdocScrapeExamples;
diff --git a/src/cargo/core/package.rs b/src/cargo/core/package.rs
index 1c7532cb3e6e..29a768c4731c 100644
--- a/src/cargo/core/package.rs
+++ b/src/cargo/core/package.rs
@@ -16,7 +16,6 @@ use lazycell::LazyCell;
use log::{debug, warn};
use semver::Version;
use serde::Serialize;
-use toml_edit::easy as toml;
use crate::core::compiler::{CompileKind, RustcTargetData};
use crate::core::dependency::DepKind;
diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs
index 023da986b693..12b78a69c592 100644
--- a/src/cargo/core/workspace.rs
+++ b/src/cargo/core/workspace.rs
@@ -8,7 +8,6 @@ use anyhow::{anyhow, bail, Context as _};
use glob::glob;
use itertools::Itertools;
use log::debug;
-use toml_edit::easy as toml;
use url::Url;
use crate::core::compiler::Unit;
diff --git a/src/cargo/ops/cargo_config.rs b/src/cargo/ops/cargo_config.rs
index 2ee0e231b419..f27ed22da920 100644
--- a/src/cargo/ops/cargo_config.rs
+++ b/src/cargo/ops/cargo_config.rs
@@ -137,7 +137,8 @@ fn print_toml(config: &Config, opts: &GetOptions<'_>, key: &ConfigKey, cv: &CV)
drop_println!(
config,
" {}, # {}",
- toml_edit::ser::to_item(&val).unwrap(),
+ serde::Serialize::serialize(val, toml_edit::ser::ValueSerializer::new())
+ .unwrap(),
def
);
}
diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs
index b7ec89cba0d3..e2d493796150 100644
--- a/src/cargo/ops/cargo_new.rs
+++ b/src/cargo/ops/cargo_new.rs
@@ -12,7 +12,6 @@ use std::io::{BufRead, BufReader, ErrorKind};
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::{fmt, slice};
-use toml_edit::easy as toml;
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VersionControl {
diff --git a/src/cargo/ops/cargo_output_metadata.rs b/src/cargo/ops/cargo_output_metadata.rs
index c71cfaa1e2e9..9d52fa09ad7c 100644
--- a/src/cargo/ops/cargo_output_metadata.rs
+++ b/src/cargo/ops/cargo_output_metadata.rs
@@ -11,7 +11,6 @@ use cargo_platform::Platform;
use serde::Serialize;
use std::collections::BTreeMap;
use std::path::PathBuf;
-use toml_edit::easy as toml;
const VERSION: u32 = 1;
diff --git a/src/cargo/ops/common_for_install_and_uninstall.rs b/src/cargo/ops/common_for_install_and_uninstall.rs
index 078b8b20d9d4..8da70ce1cdb3 100644
--- a/src/cargo/ops/common_for_install_and_uninstall.rs
+++ b/src/cargo/ops/common_for_install_and_uninstall.rs
@@ -9,7 +9,6 @@ use std::task::Poll;
use anyhow::{bail, format_err, Context as _};
use ops::FilterRule;
use serde::{Deserialize, Serialize};
-use toml_edit::easy as toml;
use crate::core::compiler::{DirtyReason, Freshness};
use crate::core::Target;
diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs
index 2a1b1db39ddf..e11e492af305 100644
--- a/src/cargo/ops/lockfile.rs
+++ b/src/cargo/ops/lockfile.rs
@@ -6,7 +6,6 @@ use crate::util::toml as cargo_toml;
use crate::util::Filesystem;
use anyhow::Context as _;
-use toml_edit::easy as toml;
pub fn load_pkg_lockfile(ws: &Workspace<'_>) -> CargoResult