diff --git a/Cargo.lock b/Cargo.lock index e51456d608..581a0a4a5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -733,7 +733,7 @@ dependencies = [ "serde_json", "strum", "strum_macros", - "toml_edit", + "toml 0.6.0", ] [[package]] @@ -1633,7 +1633,7 @@ checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" dependencies = [ "once_cell", "thiserror", - "toml", + "toml 0.5.11", ] [[package]] @@ -1875,7 +1875,7 @@ dependencies = [ "textwrap", "thiserror", "titlecase", - "toml_edit", + "toml 0.6.0", "wasm-bindgen", "wasm-bindgen-test", ] @@ -2200,6 +2200,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c68e921cef53841b8925c2abadd27c9b891d9613bdc43d6b823062866df38e8" +dependencies = [ + "serde", +] + [[package]] name = "shellexpand" version = "3.0.0" @@ -2480,32 +2489,44 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] [[package]] -name = "toml_datetime" -version = "0.5.0" +name = "toml" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808b51e57d0ef8f71115d8f3a01e7d3750d01c79cac4b3eda910f4389fdf92fd" +checksum = "4fb9d890e4dc9298b70f740f615f2e05b9db37dce531f6b24fb77ac993f9f217" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.17.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34cc558345efd7e88b9eda9626df2138b80bb46a7606f695e751c892bc7dac6" +checksum = "729bfd096e40da9c001f778f5cdecbd2957929a24e10e5883d9392220a751581" dependencies = [ "indexmap", - "itertools", "nom8", "serde", + "serde_spanned", "toml_datetime", ] diff --git a/Cargo.toml b/Cargo.toml index ff48daab90..5c61bb494a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,7 @@ strum_macros = { version = "0.24.3" } textwrap = { version = "0.16.0" } thiserror = { version = "1.0" } titlecase = { version = "2.2.1" } -toml_edit = { version = "0.17.1", features = ["easy"] } +toml = { version = "0.6.0", features= ["parse"] } # https://docs.rs/getrandom/0.2.7/getrandom/#webassembly-support # For (future) wasm-pack support diff --git a/flake8_to_ruff/Cargo.toml b/flake8_to_ruff/Cargo.toml index 453ee85023..9699d94559 100644 --- a/flake8_to_ruff/Cargo.toml +++ b/flake8_to_ruff/Cargo.toml @@ -16,7 +16,7 @@ serde = { version = "1.0.147", features = ["derive"] } serde_json = { version = "1.0.87" } strum = { version = "0.24.1", features = ["strum_macros"] } strum_macros = { version = "0.24.3" } -toml_edit = { version = "0.17.1", features = ["easy"] } +toml = { version = "0.6.0", features = ["parse"] } [dev-dependencies] diff --git a/flake8_to_ruff/src/main.rs b/flake8_to_ruff/src/main.rs index 279df5bb5c..447757abb6 100644 --- a/flake8_to_ruff/src/main.rs +++ b/flake8_to_ruff/src/main.rs @@ -60,7 +60,7 @@ fn main() -> Result<()> { // Create Ruff's pyproject.toml section. let pyproject = flake8_to_ruff::convert(&config, &external_config, cli.plugin)?; - println!("{}", toml_edit::easy::to_string_pretty(&pyproject)?); + println!("{}", toml::to_string_pretty(&pyproject)?); Ok(()) } diff --git a/src/flake8_to_ruff/pyproject.rs b/src/flake8_to_ruff/pyproject.rs index 335c7d2fc1..6d00d1193e 100644 --- a/src/flake8_to_ruff/pyproject.rs +++ b/src/flake8_to_ruff/pyproject.rs @@ -19,6 +19,6 @@ pub struct Pyproject { pub fn parse>(path: P) -> Result { let contents = std::fs::read_to_string(path)?; - let pyproject = toml_edit::easy::from_str::(&contents)?; + let pyproject = toml::from_str::(&contents)?; Ok(pyproject) } diff --git a/src/settings/pyproject.rs b/src/settings/pyproject.rs index 5356b0e6fb..9c248995b8 100644 --- a/src/settings/pyproject.rs +++ b/src/settings/pyproject.rs @@ -31,13 +31,13 @@ impl Pyproject { /// Parse a `ruff.toml` file. fn parse_ruff_toml>(path: P) -> Result { let contents = fs::read_file(path)?; - toml_edit::easy::from_str(&contents).map_err(Into::into) + toml::from_str(&contents).map_err(Into::into) } /// Parse a `pyproject.toml` file. fn parse_pyproject_toml>(path: P) -> Result { let contents = fs::read_file(path)?; - toml_edit::easy::from_str(&contents).map_err(Into::into) + toml::from_str(&contents).map_err(Into::into) } /// Return `true` if a `pyproject.toml` contains a `[tool.ruff]` section. @@ -144,17 +144,17 @@ mod tests { #[test] fn deserialize() -> Result<()> { - let pyproject: Pyproject = toml_edit::easy::from_str(r#""#)?; + let pyproject: Pyproject = toml::from_str(r#""#)?; assert_eq!(pyproject.tool, None); - let pyproject: Pyproject = toml_edit::easy::from_str( + let pyproject: Pyproject = toml::from_str( r#" [tool.black] "#, )?; assert_eq!(pyproject.tool, Some(Tools { ruff: None })); - let pyproject: Pyproject = toml_edit::easy::from_str( + let pyproject: Pyproject = toml::from_str( r#" [tool.black] [tool.ruff] @@ -215,7 +215,7 @@ mod tests { }) ); - let pyproject: Pyproject = toml_edit::easy::from_str( + let pyproject: Pyproject = toml::from_str( r#" [tool.black] [tool.ruff] @@ -277,7 +277,7 @@ line-length = 79 }) ); - let pyproject: Pyproject = toml_edit::easy::from_str( + let pyproject: Pyproject = toml::from_str( r#" [tool.black] [tool.ruff] @@ -339,7 +339,7 @@ exclude = ["foo.py"] }) ); - let pyproject: Pyproject = toml_edit::easy::from_str( + let pyproject: Pyproject = toml::from_str( r#" [tool.black] [tool.ruff] @@ -401,7 +401,7 @@ select = ["E501"] }) ); - let pyproject: Pyproject = toml_edit::easy::from_str( + let pyproject: Pyproject = toml::from_str( r#" [tool.black] [tool.ruff] @@ -464,7 +464,7 @@ ignore = ["E501"] }) ); - assert!(toml_edit::easy::from_str::( + assert!(toml::from_str::( r#" [tool.black] [tool.ruff] @@ -473,7 +473,7 @@ line_length = 79 ) .is_err()); - assert!(toml_edit::easy::from_str::( + assert!(toml::from_str::( r#" [tool.black] [tool.ruff] @@ -482,7 +482,7 @@ select = ["E123"] ) .is_err()); - assert!(toml_edit::easy::from_str::( + assert!(toml::from_str::( r#" [tool.black] [tool.ruff]