Skip to content

Commit 6e04449

Browse files
committed
refactor: Resolve deprecations
1 parent 539a484 commit 6e04449

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/cargo/core/manifest.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl EitherManifest {
6363
pub struct Manifest {
6464
// alternate forms of manifests:
6565
contents: Rc<String>,
66-
document: Rc<toml_edit::ImDocument<String>>,
66+
document: Rc<toml_edit::Document<String>>,
6767
original_toml: Rc<TomlManifest>,
6868
normalized_toml: Rc<TomlManifest>,
6969
summary: Summary,
@@ -109,7 +109,7 @@ pub struct Warnings(Vec<DelayedWarning>);
109109
pub struct VirtualManifest {
110110
// alternate forms of manifests:
111111
contents: Rc<String>,
112-
document: Rc<toml_edit::ImDocument<String>>,
112+
document: Rc<toml_edit::Document<String>>,
113113
original_toml: Rc<TomlManifest>,
114114
normalized_toml: Rc<TomlManifest>,
115115

@@ -496,7 +496,7 @@ compact_debug! {
496496
impl Manifest {
497497
pub fn new(
498498
contents: Rc<String>,
499-
document: Rc<toml_edit::ImDocument<String>>,
499+
document: Rc<toml_edit::Document<String>>,
500500
original_toml: Rc<TomlManifest>,
501501
normalized_toml: Rc<TomlManifest>,
502502
summary: Summary,
@@ -565,7 +565,7 @@ impl Manifest {
565565
Ok(format!("{}\n{}", MANIFEST_PREAMBLE, toml))
566566
}
567567
/// Collection of spans for the original TOML
568-
pub fn document(&self) -> &toml_edit::ImDocument<String> {
568+
pub fn document(&self) -> &toml_edit::Document<String> {
569569
&self.document
570570
}
571571
/// The [`TomlManifest`] as parsed from [`Manifest::document`]
@@ -738,7 +738,7 @@ impl Manifest {
738738
impl VirtualManifest {
739739
pub fn new(
740740
contents: Rc<String>,
741-
document: Rc<toml_edit::ImDocument<String>>,
741+
document: Rc<toml_edit::Document<String>>,
742742
original_toml: Rc<TomlManifest>,
743743
normalized_toml: Rc<TomlManifest>,
744744
replace: Vec<(PackageIdSpec, Dependency)>,
@@ -766,7 +766,7 @@ impl VirtualManifest {
766766
self.contents.as_str()
767767
}
768768
/// Collection of spans for the original TOML
769-
pub fn document(&self) -> &toml_edit::ImDocument<String> {
769+
pub fn document(&self) -> &toml_edit::Document<String> {
770770
&self.document
771771
}
772772
/// The [`TomlManifest`] as parsed from [`VirtualManifest::document`]

src/cargo/util/lints.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use pathdiff::diff_paths;
66
use std::fmt::Display;
77
use std::ops::Range;
88
use std::path::Path;
9-
use toml_edit::ImDocument;
9+
use toml_edit::Document;
1010

1111
const LINT_GROUPS: &[LintGroup] = &[TEST_DUMMY_UNSTABLE];
1212
pub const LINTS: &[Lint] = &[IM_A_TEAPOT, UNKNOWN_LINTS];
@@ -16,7 +16,7 @@ pub fn analyze_cargo_lints_table(
1616
path: &Path,
1717
pkg_lints: &TomlToolLints,
1818
ws_contents: &str,
19-
ws_document: &ImDocument<String>,
19+
ws_document: &Document<String>,
2020
ws_path: &Path,
2121
gctx: &GlobalContext,
2222
) -> CargoResult<()> {
@@ -116,7 +116,7 @@ fn verify_feature_enabled(
116116
manifest: &Manifest,
117117
manifest_path: &str,
118118
ws_contents: &str,
119-
ws_document: &ImDocument<String>,
119+
ws_document: &Document<String>,
120120
ws_path: &str,
121121
error_count: &mut usize,
122122
gctx: &GlobalContext,
@@ -191,7 +191,7 @@ fn verify_feature_enabled(
191191
}
192192

193193
pub fn get_span(
194-
document: &ImDocument<String>,
194+
document: &Document<String>,
195195
path: &[&str],
196196
get_value: bool,
197197
) -> Option<Range<usize>> {
@@ -511,7 +511,7 @@ fn output_unknown_lints(
511511
manifest_path: &str,
512512
pkg_lints: &TomlToolLints,
513513
ws_contents: &str,
514-
ws_document: &ImDocument<String>,
514+
ws_document: &Document<String>,
515515
ws_path: &str,
516516
error_count: &mut usize,
517517
gctx: &GlobalContext,

src/cargo/util/toml/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use cargo_util_schemas::manifest::{RustVersion, StringOrBool};
1919
use itertools::Itertools;
2020
use lazycell::LazyCell;
2121
use pathdiff::diff_paths;
22-
use toml_edit::ImDocument;
22+
use toml_edit::Document;
2323
use url::Url;
2424

2525
use crate::core::compiler::{CompileKind, CompileTarget};
@@ -166,13 +166,13 @@ fn read_toml_string(path: &Path, is_embedded: bool, gctx: &GlobalContext) -> Car
166166
}
167167

168168
#[tracing::instrument(skip_all)]
169-
fn parse_document(contents: &str) -> Result<toml_edit::ImDocument<String>, toml_edit::de::Error> {
170-
toml_edit::ImDocument::parse(contents.to_owned()).map_err(Into::into)
169+
fn parse_document(contents: &str) -> Result<toml_edit::Document<String>, toml_edit::de::Error> {
170+
toml_edit::Document::parse(contents.to_owned()).map_err(Into::into)
171171
}
172172

173173
#[tracing::instrument(skip_all)]
174174
fn deserialize_toml(
175-
document: &toml_edit::ImDocument<String>,
175+
document: &toml_edit::Document<String>,
176176
) -> Result<manifest::TomlManifest, toml_edit::de::Error> {
177177
let mut unused = BTreeSet::new();
178178
let deserializer = toml_edit::de::Deserializer::from(document.clone());
@@ -1256,7 +1256,7 @@ fn deprecated_ws_default_features(
12561256
#[tracing::instrument(skip_all)]
12571257
pub fn to_real_manifest(
12581258
contents: String,
1259-
document: toml_edit::ImDocument<String>,
1259+
document: toml_edit::Document<String>,
12601260
original_toml: manifest::TomlManifest,
12611261
normalized_toml: manifest::TomlManifest,
12621262
features: Features,
@@ -1843,7 +1843,7 @@ pub fn to_real_manifest(
18431843
fn missing_dep_diagnostic(
18441844
missing_dep: &MissingDependencyError,
18451845
orig_toml: &TomlManifest,
1846-
document: &ImDocument<String>,
1846+
document: &Document<String>,
18471847
contents: &str,
18481848
manifest_file: &Path,
18491849
gctx: &GlobalContext,
@@ -1921,7 +1921,7 @@ fn missing_dep_diagnostic(
19211921

19221922
fn to_virtual_manifest(
19231923
contents: String,
1924-
document: toml_edit::ImDocument<String>,
1924+
document: toml_edit::Document<String>,
19251925
original_toml: manifest::TomlManifest,
19261926
normalized_toml: manifest::TomlManifest,
19271927
features: Features,

0 commit comments

Comments
 (0)