Use `cargo sweep` to clean Rust target directories after an upgrade
Dependencies
- [2]
F2XQXDESReplace `cargo-watch` with `bacon` - [3]
FU7S4JHVAdd script to ensure Rust nightly version stays in sync - [4]
MAVDUPWDImprove REPL prompt - [5]
FPOXMH3VAdd more agressive garbage collection settings - [6]
HINOSPQOAdd simple nushell update script - [*]
BAT5B53ORefuse to rebuild until repository has no unrecorded changes - [*]
5FI47NSAMigrate to home-manager - [*]
226QFOMLReplace `cargo-asm` with `cargo-show-asm`
Change contents
- replacement in src/update.nu at line 7
use rust_version.nu enforce-rust-version;use rust_version.nu get-rust-version; - edit in src/update.nu at line 37
# Before updating, get the current Rust version to see if we need to clean the target directorieslet old_rust_version = get-rust-version; - edit in src/update.nu at line 50
# Make sure that Rust is roughly up-to-date (less than a week old)# rust-overlay's selectLatestNightlyWith silently keeps older versions if components/targets are no longer valid# This code should catch if that happenslet new_rust_version = get-rust-version;assert greater $new_rust_version ((date now) - 7day) $"This version of Rust was built (ansi red_bold)($new_rust_version | date humanize)(ansi reset)!Check that all specified targets and extensions are valid.(ansi yellow_bold)HINT(ansi reset): replace `selectLatestNightlyWith` with `nightly.latest.default.override` to debug."; - replacement in src/update.nu at line 61
# Make sure that Rust is up-to-dateenforce-rust-version;# Since the Rust version has changed anyways, clean all Rust target directoriesif $old_rust_version != $new_rust_version {print $"Removing old Rust target directories: ($new_rust_version - $old_rust_version) newer";# `cargo-sweep` seems to require the `time` parameter, so just set it to 0cargo sweep --time 0 --recursive ~/Projects/Rust} - replacement in src/rust_version.nu at line 1
# Prevent rustc from getting too out-of-date;# rust-overlay's selectLatestNightlyWith silently keeps older versions if components/targets are no longer validuse std assert;# Get the release date of the current Rust version - replacement in src/rust_version.nu at line 3
export def enforce-rust-version [] {export def get-rust-version [] { - replacement in src/rust_version.nu at line 10
let version_date = $version_info.date | first | into datetime;# Return an error if the version is more than one week oldassert greater $version_date ((date now) - 7day) $"This version of Rust was built (ansi red_bold)($version_date | date humanize)(ansi reset)!Check that all specified targets and extensions are valid.(ansi yellow_bold)HINT(ansi reset): replace `selectLatestNightlyWith` with `nightly.latest.default.override` to debug.";}[3.846]$version_info.date | first | into datetime} - edit in home.nix at line 89[10.19][2.0]
cargo-sweep