Skip to content

Conversation

@benedikt-schaber
Copy link

@benedikt-schaber benedikt-schaber commented Jan 9, 2026

Motivation

Currently cleanCargoToml hardcodes which paths to remove. This PR allows users to pass a pathsModifier function to cleanCargoToml to make it customizable. Further, this PR takes it from a "what to remove" to a "what to keep" approach, which seems more scalable to me. However, this means that it is a breaking change since unknown fields are now removed by default instead of kept by default.

This was motivated by me using different cargo-tools that relied in some form or another on fields filtered by cleanCargoToml (e.g. cargo-leptos uses workspace.metadata.leptos), which can then be easily adjusted here instead of having to roll my own cleanCargoToml. But could also make it easier to implement #288, I think. I could work on that if this seems like a good direction.

There are lib functions which mostly do what my helper functions do, however, these do not handle lists, while my functions do (by iterating over the children and applying the path filtering there too).

Checklist

  • added tests to verify new behavior
  • added an example template or updated an existing one
  • updated docs/API.md (or general documentation) with changes
  • updated CHANGELOG.md

@benedikt-schaber benedikt-schaber force-pushed the feat/cleantomlcustomize branch from f7ffb0a to c50bc11 Compare January 9, 2026 14:15
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.

1 participant