Edition maintenance: scripting the updates for future work

This commit is contained in:
Chris Krycho
2025-02-25 10:32:11 -07:00
parent 2800281fc4
commit 34820ac2f4
4 changed files with 16 additions and 11 deletions

View File

@@ -2,7 +2,18 @@
set -eu
# So that we can do this in a single pass, check *here* if there are any “dirty”
# files from Git, and bail if so.
git diff --quiet || { echo "Git working directory is not clean"; exit 1; }
OLD_EDITION=2021
NEW_EDITION=2024
find listings/** -name "Cargo.toml" -exec sed -i '' "s/edition = \"$OLD_EDITION\"/edition = \"$NEW_EDITION\"/g" '{}' \;
# Start by preparing all listings for the edition.
find listings -name "Cargo.toml" -exec cargo fix --allow-dirty --edition --manifest-path '{}' \;
# Update the edition itself
find listings -name "Cargo.toml" -exec sed -i '' "s/edition = \"$OLD_EDITION\"/edition = \"$NEW_EDITION\"/g" '{}' \;
# Update all id
find listings -name "Cargo.toml" -exec cargo fix --allow-dirty --edition-idioms --manifest-path {} \;