Repository: probe-rs/probe-rs
Pull request #3142 (2025-03-03 03:10:16)

Update Rust crate bytesize to v2
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [bytesize](https://redirect.github.com/bytesize-rs/bytesize) | dependencies | major | `1` -> `2` |

---

### Release Notes

<details>
<summary>bytesize-rs/bytesize (bytesize)</summary>

### [`v2.0.1`](https://redirect.github.com/bytesize-rs/bytesize/blob/HEAD/CHANGELOG.md#201)

-   Add support for precision in `Display` implementations.

### [`v2.0.0`](https://redirect.github.com/bytesize-rs/bytesize/blob/HEAD/CHANGELOG.md#v200)

-   Add support for `no_std` targets.
-   Use IEC (binary) format by default with `Display`.
-   Use "kB" for SI unit.
-   Add `Display` type for customizing printed format.
-   Add `ByteSize::display()` method.
-   Implement `Sub<ByteSize>` for `ByteSize`.
-   Implement `Sub<impl Into<u64>>` for `ByteSize`.
-   Implement `SubAssign<ByteSize>` for `ByteSize`.
-   Implement `SubAssign<impl Into<u64>>` for `ByteSize`.
-   Reject parsing non-unit characters after whitespace.
-   Remove `ByteSize::to_string_as()` method.
-   Remove top-level `to_string()` method.
-   Remove top-level `B` constant.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* 0-3 * * 1" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/probe-rs/probe-rs).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNzYuMiIsInVwZGF0ZWRJblZlciI6IjM5LjE3Ni4yIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbImNoYW5nZWxvZzpza2lwIiwiZGVwZW5kZW5jaWVzIl19-->


probe-rs-perfbot[bot]: # Benchmarks

https://perfbot.drop.huesser.dev/run/13622594340

No benchmarks were found. Check your CI workflows.
    
renovate[bot]: ### Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

 ⚠️ **Warning**: custom changes will be lost.
probe-rs-perfbot[bot]: # Benchmarks

https://perfbot.drop.huesser.dev/run/13626602247

No benchmarks were found. Check your CI workflows.
    

Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 35678cd7..59ac44fd 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -445,9 +445,9 @@ checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b"
 
 [[package]]
 name = "bytesize"
-version = "1.3.2"
+version = "2.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d2c12f985c78475a6b8d629afd0c360260ef34cfef52efccdcfd31972f81c2e"
+checksum = "a3c8f83209414aacf0eeae3cf730b18d6981697fba62f200fcfb92b9f082acba"
 
 [[package]]
 name = "camino"
@@ -661,7 +661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
 dependencies = [
  "lazy_static",
- "windows-sys 0.48.0",
+ "windows-sys 0.59.0",
 ]
 
 [[package]]
@@ -670,7 +670,7 @@ version = "3.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e"
 dependencies = [
- "windows-sys 0.48.0",
+ "windows-sys 0.59.0",
 ]
 
 [[package]]
@@ -4856,7 +4856,7 @@ version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
 dependencies = [
- "windows-sys 0.48.0",
+ "windows-sys 0.59.0",
 ]
 
 [[package]]
diff --git a/probe-rs-tools/Cargo.toml b/probe-rs-tools/Cargo.toml
index c5189e54..0403ef47 100644
--- a/probe-rs-tools/Cargo.toml
+++ b/probe-rs-tools/Cargo.toml
@@ -42,7 +42,7 @@ itertools = "0.14"
 
 # CLI-only
 addr2line = "0.24"
-bytesize = "1"
+bytesize = "2"
 capstone = "0.13"
 cargo_metadata = "0.19"
 clap = { version = "4", features = ["derive", "env"] }
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/diagnostics.rs b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/diagnostics.rs
index 88dda0ae..ce59397d 100644
--- a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/diagnostics.rs
+++ b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/diagnostics.rs
@@ -260,8 +260,7 @@ fn generate_flash_error_hints(
                         hint_available_regions,
                         "  {:#010x?} ({})",
                         flash.range,
-                        ByteSize(flash.range.end - flash.range.start)
-                            .to_string_as(true)
+                        ByteSize(flash.range.end - flash.range.start).display().iec()
                     );
                 }
             }
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/chip.rs b/probe-rs-tools/src/bin/probe-rs/cmd/chip.rs
index 3635418a..aa0d774f 100644
--- a/probe-rs-tools/src/bin/probe-rs/cmd/chip.rs
+++ b/probe-rs-tools/src/bin/probe-rs/cmd/chip.rs
@@ -75,7 +75,7 @@ pub async fn print_chip_info(
 
     for memory in target.memory_map {
         let range = memory.address_range();
-        let size = ByteSize(get_range_len(&range)).to_string_as(true);
+        let size = ByteSize(get_range_len(&range)).display().iec();
         let kind = match memory {
             MemoryRegion::Ram(_) => "RAM",
             MemoryRegion::Generic(_) => "Generic",


Test patch:
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/snapshots/probe_rs__cmd__chip__test__single_chip_output.snap b/probe-rs-tools/src/bin/probe-rs/cmd/snapshots/probe_rs__cmd__chip__test__single_chip_output.snap
index 606bca61..a8fa178a 100644
--- a/probe-rs-tools/src/bin/probe-rs/cmd/snapshots/probe_rs__cmd__chip__test__single_chip_output.snap
+++ b/probe-rs-tools/src/bin/probe-rs/cmd/snapshots/probe_rs__cmd__chip__test__single_chip_output.snap
@@ -6,6 +6,6 @@ nrf52840_xxaa
 Cores (1):
     - main (Armv7em)
 NVM: 0x00000000..0x00100000 (1.0 MiB)
-RAM: 0x00800000..0x00840000 (256.0 kiB)
-NVM: 0x10001000..0x10002000 (4.0 kiB)
-RAM: 0x20000000..0x20040000 (256.0 kiB)
+RAM: 0x00800000..0x00840000 (256.0 KiB)
+NVM: 0x10001000..0x10002000 (4.0 KiB)
+RAM: 0x20000000..0x20040000 (256.0 KiB)