mirror of
https://github.com/bevyengine/bevy
synced 2024-11-29 08:00:20 +00:00
fix deprecations from toml_edit (#12421)
# Objective - `toml_edit` released a new patch that deprecates `Document` - this warns when Bevy builds, and CI deny warns ## Solution - fix deprecation warnings
This commit is contained in:
parent
63993864c0
commit
b3655a3601
7 changed files with 19 additions and 13 deletions
|
@ -9,7 +9,9 @@ license = "MIT OR Apache-2.0"
|
||||||
keywords = ["bevy"]
|
keywords = ["bevy"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
toml_edit = { version = "0.22", default-features = false, features = ["parse"] }
|
toml_edit = { version = "0.22.7", default-features = false, features = [
|
||||||
|
"parse",
|
||||||
|
] }
|
||||||
syn = "2.0"
|
syn = "2.0"
|
||||||
quote = "1.0"
|
quote = "1.0"
|
||||||
rustc-hash = "1.0"
|
rustc-hash = "1.0"
|
||||||
|
|
|
@ -2,11 +2,11 @@ extern crate proc_macro;
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use std::{env, path::PathBuf};
|
use std::{env, path::PathBuf};
|
||||||
use toml_edit::{Document, Item};
|
use toml_edit::{DocumentMut, Item};
|
||||||
|
|
||||||
/// The path to the `Cargo.toml` file for the Bevy project.
|
/// The path to the `Cargo.toml` file for the Bevy project.
|
||||||
pub struct BevyManifest {
|
pub struct BevyManifest {
|
||||||
manifest: Document,
|
manifest: DocumentMut,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BevyManifest {
|
impl Default for BevyManifest {
|
||||||
|
@ -25,7 +25,7 @@ impl Default for BevyManifest {
|
||||||
let manifest = std::fs::read_to_string(path.clone()).unwrap_or_else(|_| {
|
let manifest = std::fs::read_to_string(path.clone()).unwrap_or_else(|_| {
|
||||||
panic!("Unable to read cargo manifest: {}", path.display())
|
panic!("Unable to read cargo manifest: {}", path.display())
|
||||||
});
|
});
|
||||||
manifest.parse::<Document>().unwrap_or_else(|_| {
|
manifest.parse::<DocumentMut>().unwrap_or_else(|_| {
|
||||||
panic!("Failed to parse cargo manifest: {}", path.display())
|
panic!("Failed to parse cargo manifest: {}", path.display())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -10,7 +10,9 @@ license = "MIT OR Apache-2.0"
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
toml_edit = { version = "0.22", default-features = false, features = ["parse"] }
|
toml_edit = { version = "0.22.7", default-features = false, features = [
|
||||||
|
"parse",
|
||||||
|
] }
|
||||||
tera = "1.15"
|
tera = "1.15"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
bitflags = "2.3"
|
bitflags = "2.3"
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::{cmp::Ordering, fs::File};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use tera::{Context, Tera};
|
use tera::{Context, Tera};
|
||||||
use toml_edit::Document;
|
use toml_edit::DocumentMut;
|
||||||
|
|
||||||
use crate::Command;
|
use crate::Command;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ impl PartialOrd for Example {
|
||||||
|
|
||||||
fn parse_examples(panic_on_missing: bool) -> Vec<Example> {
|
fn parse_examples(panic_on_missing: bool) -> Vec<Example> {
|
||||||
let manifest_file = std::fs::read_to_string("Cargo.toml").unwrap();
|
let manifest_file = std::fs::read_to_string("Cargo.toml").unwrap();
|
||||||
let manifest = manifest_file.parse::<Document>().unwrap();
|
let manifest = manifest_file.parse::<DocumentMut>().unwrap();
|
||||||
let metadatas = manifest
|
let metadatas = manifest
|
||||||
.get("package")
|
.get("package")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -83,7 +83,7 @@ fn parse_examples(panic_on_missing: bool) -> Vec<Example> {
|
||||||
|
|
||||||
fn parse_categories() -> HashMap<Box<str>, String> {
|
fn parse_categories() -> HashMap<Box<str>, String> {
|
||||||
let manifest_file = std::fs::read_to_string("Cargo.toml").unwrap();
|
let manifest_file = std::fs::read_to_string("Cargo.toml").unwrap();
|
||||||
let manifest = manifest_file.parse::<Document>().unwrap();
|
let manifest = manifest_file.parse::<DocumentMut>().unwrap();
|
||||||
manifest
|
manifest
|
||||||
.get("package")
|
.get("package")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::{cmp::Ordering, fs::File};
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use tera::{Context, Tera};
|
use tera::{Context, Tera};
|
||||||
use toml_edit::Document;
|
use toml_edit::DocumentMut;
|
||||||
|
|
||||||
use crate::Command;
|
use crate::Command;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ impl PartialOrd for Feature {
|
||||||
|
|
||||||
fn parse_features(panic_on_missing: bool) -> Vec<Feature> {
|
fn parse_features(panic_on_missing: bool) -> Vec<Feature> {
|
||||||
let manifest_file = std::fs::read_to_string("Cargo.toml").unwrap();
|
let manifest_file = std::fs::read_to_string("Cargo.toml").unwrap();
|
||||||
let manifest = manifest_file.parse::<Document>().unwrap();
|
let manifest = manifest_file.parse::<DocumentMut>().unwrap();
|
||||||
|
|
||||||
let features = manifest["features"].as_table().unwrap();
|
let features = manifest["features"].as_table().unwrap();
|
||||||
let default: Vec<_> = features
|
let default: Vec<_> = features
|
||||||
|
|
|
@ -13,5 +13,7 @@ workspace = true
|
||||||
xshell = "0.2"
|
xshell = "0.2"
|
||||||
clap = { version = "4.0", features = ["derive"] }
|
clap = { version = "4.0", features = ["derive"] }
|
||||||
ron = "0.8"
|
ron = "0.8"
|
||||||
toml_edit = { version = "0.22", default-features = false, features = ["parse"] }
|
toml_edit = { version = "0.22.7", default-features = false, features = [
|
||||||
|
"parse",
|
||||||
|
] }
|
||||||
pbr = "1.1"
|
pbr = "1.1"
|
||||||
|
|
|
@ -14,7 +14,7 @@ use std::{
|
||||||
|
|
||||||
use clap::{error::ErrorKind, CommandFactory, Parser, ValueEnum};
|
use clap::{error::ErrorKind, CommandFactory, Parser, ValueEnum};
|
||||||
use pbr::ProgressBar;
|
use pbr::ProgressBar;
|
||||||
use toml_edit::Document;
|
use toml_edit::DocumentMut;
|
||||||
use xshell::{cmd, Shell};
|
use xshell::{cmd, Shell};
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
|
@ -661,7 +661,7 @@ header_message = \"Examples ({})\"
|
||||||
|
|
||||||
fn parse_examples() -> Vec<Example> {
|
fn parse_examples() -> Vec<Example> {
|
||||||
let manifest_file = fs::read_to_string("Cargo.toml").unwrap();
|
let manifest_file = fs::read_to_string("Cargo.toml").unwrap();
|
||||||
let manifest = manifest_file.parse::<Document>().unwrap();
|
let manifest = manifest_file.parse::<DocumentMut>().unwrap();
|
||||||
let metadatas = manifest
|
let metadatas = manifest
|
||||||
.get("package")
|
.get("package")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
Loading…
Reference in a new issue