uuid-rs / uuid

Generate and parse UUIDs.
https://www.crates.io/crates/uuid
Other
1k stars 192 forks source link

`uuid!` `index is out of bounds` in clippy on rust 1.77 (fixed in uuid 1.6.1) #741

Closed eric-seppanen closed 8 months ago

eric-seppanen commented 8 months ago

I'm filing this just so others can find it quickly; it appears to be fixed in uuid >= 1.6.1.

This code fails with a hard error in clippy 1.77 (currently in beta), in uuid 1.0.0 .. 1.5.0 :

pub const SOME_UUID: Uuid = uuid!("11111111-1111-2222-3333-444444444444");

The error is

$ cargo +beta clippy
    Checking test_uuid_indexing v0.1.0
error: index is out of bounds
 --> src/lib.rs:4:29
  |
4 | pub const SOME_UUID: Uuid = uuid!("11111111-1111-2222-3333-444444444444");
  |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#out_of_bounds_indexing
  = note: `#[deny(clippy::out_of_bounds_indexing)]` on by default
  = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)