refactor: Resolve deprecations

This commit is contained in:
Ed Page 2025-07-08 12:02:29 -05:00
parent 539a48452a
commit 6e04449c27
3 changed files with 18 additions and 18 deletions

View File

@ -63,7 +63,7 @@ impl EitherManifest {
pub struct Manifest {
// alternate forms of manifests:
contents: Rc<String>,
document: Rc<toml_edit::ImDocument<String>>,
document: Rc<toml_edit::Document<String>>,
original_toml: Rc<TomlManifest>,
normalized_toml: Rc<TomlManifest>,
summary: Summary,
@ -109,7 +109,7 @@ pub struct Warnings(Vec<DelayedWarning>);
pub struct VirtualManifest {
// alternate forms of manifests:
contents: Rc<String>,
document: Rc<toml_edit::ImDocument<String>>,
document: Rc<toml_edit::Document<String>>,
original_toml: Rc<TomlManifest>,
normalized_toml: Rc<TomlManifest>,
@ -496,7 +496,7 @@ compact_debug! {
impl Manifest {
pub fn new(
contents: Rc<String>,
document: Rc<toml_edit::ImDocument<String>>,
document: Rc<toml_edit::Document<String>>,
original_toml: Rc<TomlManifest>,
normalized_toml: Rc<TomlManifest>,
summary: Summary,
@ -565,7 +565,7 @@ impl Manifest {
Ok(format!("{}\n{}", MANIFEST_PREAMBLE, toml))
}
/// Collection of spans for the original TOML
pub fn document(&self) -> &toml_edit::ImDocument<String> {
pub fn document(&self) -> &toml_edit::Document<String> {
&self.document
}
/// The [`TomlManifest`] as parsed from [`Manifest::document`]
@ -738,7 +738,7 @@ impl Manifest {
impl VirtualManifest {
pub fn new(
contents: Rc<String>,
document: Rc<toml_edit::ImDocument<String>>,
document: Rc<toml_edit::Document<String>>,
original_toml: Rc<TomlManifest>,
normalized_toml: Rc<TomlManifest>,
replace: Vec<(PackageIdSpec, Dependency)>,
@ -766,7 +766,7 @@ impl VirtualManifest {
self.contents.as_str()
}
/// Collection of spans for the original TOML
pub fn document(&self) -> &toml_edit::ImDocument<String> {
pub fn document(&self) -> &toml_edit::Document<String> {
&self.document
}
/// The [`TomlManifest`] as parsed from [`VirtualManifest::document`]

View File

@ -6,7 +6,7 @@ use pathdiff::diff_paths;
use std::fmt::Display;
use std::ops::Range;
use std::path::Path;
use toml_edit::ImDocument;
use toml_edit::Document;
const LINT_GROUPS: &[LintGroup] = &[TEST_DUMMY_UNSTABLE];
pub const LINTS: &[Lint] = &[IM_A_TEAPOT, UNKNOWN_LINTS];
@ -16,7 +16,7 @@ pub fn analyze_cargo_lints_table(
path: &Path,
pkg_lints: &TomlToolLints,
ws_contents: &str,
ws_document: &ImDocument<String>,
ws_document: &Document<String>,
ws_path: &Path,
gctx: &GlobalContext,
) -> CargoResult<()> {
@ -116,7 +116,7 @@ fn verify_feature_enabled(
manifest: &Manifest,
manifest_path: &str,
ws_contents: &str,
ws_document: &ImDocument<String>,
ws_document: &Document<String>,
ws_path: &str,
error_count: &mut usize,
gctx: &GlobalContext,
@ -191,7 +191,7 @@ fn verify_feature_enabled(
}
pub fn get_span(
document: &ImDocument<String>,
document: &Document<String>,
path: &[&str],
get_value: bool,
) -> Option<Range<usize>> {
@ -511,7 +511,7 @@ fn output_unknown_lints(
manifest_path: &str,
pkg_lints: &TomlToolLints,
ws_contents: &str,
ws_document: &ImDocument<String>,
ws_document: &Document<String>,
ws_path: &str,
error_count: &mut usize,
gctx: &GlobalContext,

View File

@ -19,7 +19,7 @@ use cargo_util_schemas::manifest::{RustVersion, StringOrBool};
use itertools::Itertools;
use lazycell::LazyCell;
use pathdiff::diff_paths;
use toml_edit::ImDocument;
use toml_edit::Document;
use url::Url;
use crate::core::compiler::{CompileKind, CompileTarget};
@ -166,13 +166,13 @@ fn read_toml_string(path: &Path, is_embedded: bool, gctx: &GlobalContext) -> Car
}
#[tracing::instrument(skip_all)]
fn parse_document(contents: &str) -> Result<toml_edit::ImDocument<String>, toml_edit::de::Error> {
toml_edit::ImDocument::parse(contents.to_owned()).map_err(Into::into)
fn parse_document(contents: &str) -> Result<toml_edit::Document<String>, toml_edit::de::Error> {
toml_edit::Document::parse(contents.to_owned()).map_err(Into::into)
}
#[tracing::instrument(skip_all)]
fn deserialize_toml(
document: &toml_edit::ImDocument<String>,
document: &toml_edit::Document<String>,
) -> Result<manifest::TomlManifest, toml_edit::de::Error> {
let mut unused = BTreeSet::new();
let deserializer = toml_edit::de::Deserializer::from(document.clone());
@ -1256,7 +1256,7 @@ fn deprecated_ws_default_features(
#[tracing::instrument(skip_all)]
pub fn to_real_manifest(
contents: String,
document: toml_edit::ImDocument<String>,
document: toml_edit::Document<String>,
original_toml: manifest::TomlManifest,
normalized_toml: manifest::TomlManifest,
features: Features,
@ -1843,7 +1843,7 @@ pub fn to_real_manifest(
fn missing_dep_diagnostic(
missing_dep: &MissingDependencyError,
orig_toml: &TomlManifest,
document: &ImDocument<String>,
document: &Document<String>,
contents: &str,
manifest_file: &Path,
gctx: &GlobalContext,
@ -1921,7 +1921,7 @@ fn missing_dep_diagnostic(
fn to_virtual_manifest(
contents: String,
document: toml_edit::ImDocument<String>,
document: toml_edit::Document<String>,
original_toml: manifest::TomlManifest,
normalized_toml: manifest::TomlManifest,
features: Features,