Skip to content

Commit

Permalink
refactor(toml): Consolidate field name conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Apr 26, 2024
1 parent a71b8fe commit 57b4ab9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2331,16 +2331,14 @@ fn deprecated_underscore<T>(
edition: Edition,
warnings: &mut Vec<String>,
) -> CargoResult<()> {
let old_path = new_path.replace("-", "_");
if old.is_some() && Edition::Edition2024 <= edition {
let old_path = new_path.replace("-", "_");
anyhow::bail!("`{old_path}` is unsupported as of the 2024 edition; instead use `{new_path}`\n(in the `{name}` {kind})");
} else if old.is_some() && new.is_some() {
let old_path = new_path.replace("-", "_");
warnings.push(format!(
"`{old_path}` is redundant with `{new_path}`, preferring `{new_path}` in the `{name}` {kind}"
))
} else if old.is_some() {
let old_path = new_path.replace("-", "_");
warnings.push(format!(
"`{old_path}` is deprecated in favor of `{new_path}` and will not work in the 2024 edition\n(in the `{name}` {kind})"
))
Expand Down

0 comments on commit 57b4ab9

Please sign in to comment.