Skip to content

Conversation

@lpil
Copy link
Member

@lpil lpil commented Jan 19, 2026

These keys were inconsistent in that they used a different case convention to the other keys.

Assuming no bugs this is backwards compatible and will support the old config too.

@lpil lpil marked this pull request as draft January 19, 2026 00:11
Comment on lines -25 to +36
let maybe_removed_item = toml["dependencies"]
.as_table_like_mut()
.and_then(|deps| deps.remove(package_to_remove));

#[allow(clippy::indexing_slicing)]
let maybe_removed_dev_item = toml["dev-dependencies"]
.as_table_like_mut()
.and_then(|deps| deps.remove(package_to_remove));

if maybe_removed_item.or(maybe_removed_dev_item).is_none() {
let remove = |toml: &mut toml_edit::DocumentMut, name| {
#[allow(clippy::indexing_slicing)]
toml[name]
.as_table_like_mut()
.and_then(|deps| deps.remove(package_to_remove))
};

// dev-dependencies is the old deprecated name for dev_dependencies
let removed = remove(&mut toml, "dependencies")
.or_else(|| remove(&mut toml, "dev_dependencies"))
.or_else(|| remove(&mut toml, "dev-dependencies"));

if removed.is_none() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this change the behaviour of this piece of code? Previously both the remove from dependencies and from dev_dependencies would run and then the check is performed. Does it make any difference?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does change in that way, but that config would have been invalid and rejected by the build tool

Copy link
Member

@giacomocavalieri giacomocavalieri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Just one comment inline

@lpil lpil merged commit 37069b0 into main Jan 20, 2026
12 checks passed
@lpil lpil deleted the gleam.toml branch January 20, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants