Commit Graph

232 Commits

Author SHA1 Message Date
Michael Pfaff e6cbf0b921 Merge remote-tracking branch 'origin/master' 2024-05-20 18:59:45 -04:00
Michael Pfaff 3ef6de9039 Expose some internals & make const 2024-05-20 18:58:40 -04:00
David Tolnay 945f297a24
Ignore cast_possible_wrap pedantic clippy lint
warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:144:32
        |
    144 |                   let mut curr = buf.len() as isize;
        |                                  ^^^^^^^^^^^^^^^^^^
    ...
    216 | / impl_Integer!(
    217 | |     I8_MAX_LEN => i8,
    218 | |     U8_MAX_LEN => u8,
    219 | |     I16_MAX_LEN => i16,
    ...   |
    222 | |     U32_MAX_LEN => u32
    223 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: `-W clippy::cast-possible-wrap` implied by `-W clippy::pedantic`
        = help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_possible_wrap)]`
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
       --> src/lib.rs:152:35
        |
    152 |                           let rem = (n % 10000) as isize;
        |                                     ^^^^^^^^^^^^^^^^^^^^
    ...
    216 | / impl_Integer!(
    217 | |     I8_MAX_LEN => i8,
    218 | |     U8_MAX_LEN => u8,
    219 | |     I16_MAX_LEN => i16,
    ...   |
    222 | |     U32_MAX_LEN => u32
    223 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
       --> src/lib.rs:166:29
        |
    166 |                   let mut n = n as isize; // Possibly reduce 64-bit math.
        |                               ^^^^^^^^^^
    ...
    216 | / impl_Integer!(
    217 | |     I8_MAX_LEN => i8,
    218 | |     U8_MAX_LEN => u8,
    219 | |     I16_MAX_LEN => i16,
    ...   |
    222 | |     U32_MAX_LEN => u32
    223 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:144:32
        |
    144 |                   let mut curr = buf.len() as isize;
        |                                  ^^^^^^^^^^^^^^^^^^
    ...
    216 | / impl_Integer!(
    217 | |     I8_MAX_LEN => i8,
    218 | |     U8_MAX_LEN => u8,
    219 | |     I16_MAX_LEN => i16,
    ...   |
    222 | |     U32_MAX_LEN => u32
    223 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:144:32
        |
    144 |                 let mut curr = buf.len() as isize;
        |                                ^^^^^^^^^^^^^^^^^^
    ...
    225 | impl_Integer!(I64_MAX_LEN => i64, U64_MAX_LEN => u64 as u64);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
       --> src/lib.rs:152:35
        |
    152 |                         let rem = (n % 10000) as isize;
        |                                   ^^^^^^^^^^^^^^^^^^^^
    ...
    225 | impl_Integer!(I64_MAX_LEN => i64, U64_MAX_LEN => u64 as u64);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
       --> src/lib.rs:166:29
        |
    166 |                 let mut n = n as isize; // Possibly reduce 64-bit math.
        |                             ^^^^^^^^^^
    ...
    225 | impl_Integer!(I64_MAX_LEN => i64, U64_MAX_LEN => u64 as u64);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:144:32
        |
    144 |                 let mut curr = buf.len() as isize;
        |                                ^^^^^^^^^^^^^^^^^^
    ...
    234 | impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64);
        | ---------------------------------------------------------------- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
       --> src/lib.rs:152:35
        |
    152 |                         let rem = (n % 10000) as isize;
        |                                   ^^^^^^^^^^^^^^^^^^^^
    ...
    234 | impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64);
        | ---------------------------------------------------------------- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
       --> src/lib.rs:166:29
        |
    166 |                 let mut n = n as isize; // Possibly reduce 64-bit math.
        |                             ^^^^^^^^^^
    ...
    234 | impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64);
        | ---------------------------------------------------------------- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:254:32
        |
    254 |                 let mut curr = buf.len() as isize;
        |                                ^^^^^^^^^^^^^^^^^^
    ...
    310 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:259:59
        |
    259 |                 let buf1 = unsafe { buf_ptr.offset(curr - U64_MAX_LEN as isize) as *mut [MaybeUninit<u8>; U64...
        |                                                           ^^^^^^^^^^^^^^^^^^^^
    ...
    310 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:260:25
        |
    260 |                 curr -= rem.write(unsafe { &mut *buf1 }).len() as isize;
        |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    310 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:264:34
        |
    264 |                     let target = buf.len() as isize - 19;
        |                                  ^^^^^^^^^^^^^^^^^^
    ...
    310 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:272:63
        |
    272 |                     let buf2 = unsafe { buf_ptr.offset(curr - U64_MAX_LEN as isize) as *mut [MaybeUninit<u8>;...
        |                                                               ^^^^^^^^^^^^^^^^^^^^
    ...
    310 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:273:29
        |
    273 |                     curr -= rem.write(unsafe { &mut *buf2 }).len() as isize;
        |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    310 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `usize` to `isize` may wrap around the value
       --> src/lib.rs:277:38
        |
    277 |                         let target = buf.len() as isize - 38;
        |                                      ^^^^^^^^^^^^^^^^^^
    ...
    310 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)
2024-04-19 20:42:48 -07:00
David Tolnay 3895493dc3
Ignore cast_sign_loss pedantic clippy lint
warning: casting `i8` to `u32` may lose the sign of the value
       --> src/lib.rs:138:21
        |
    138 |                       self as $conv_fn
        |                       ^^^^^^^^^^^^^^^^
    ...
    215 | / impl_Integer!(
    216 | |     I8_MAX_LEN => i8,
    217 | |     U8_MAX_LEN => u8,
    218 | |     I16_MAX_LEN => i16,
    ...   |
    221 | |     U32_MAX_LEN => u32
    222 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: `-W clippy::cast-sign-loss` implied by `-W clippy::pedantic`
        = help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_sign_loss)]`
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `i8` to `u32` may lose the sign of the value
       --> src/lib.rs:141:23
        |
    141 |                       (!(self as $conv_fn)).wrapping_add(1)
        |                         ^^^^^^^^^^^^^^^^^^
    ...
    215 | / impl_Integer!(
    216 | |     I8_MAX_LEN => i8,
    217 | |     U8_MAX_LEN => u8,
    218 | |     I16_MAX_LEN => i16,
    ...   |
    221 | |     U32_MAX_LEN => u32
    222 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `u8` may lose the sign of the value
       --> src/lib.rs:181:49
        |
    181 |                           *buf_ptr.offset(curr) = (n as u8) + b'0';
        |                                                   ^^^^^^^^^
    ...
    215 | / impl_Integer!(
    216 | |     I8_MAX_LEN => i8,
    217 | |     U8_MAX_LEN => u8,
    218 | |     I16_MAX_LEN => i16,
    ...   |
    221 | |     U32_MAX_LEN => u32
    222 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `usize` may lose the sign of the value
       --> src/lib.rs:198:39
        |
    198 |                   let len = buf.len() - curr as usize;
        |                                         ^^^^^^^^^^^^^
    ...
    215 | / impl_Integer!(
    216 | |     I8_MAX_LEN => i8,
    217 | |     U8_MAX_LEN => u8,
    218 | |     I16_MAX_LEN => i16,
    ...   |
    221 | |     U32_MAX_LEN => u32
    222 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `i16` to `u32` may lose the sign of the value
       --> src/lib.rs:138:21
        |
    138 |                       self as $conv_fn
        |                       ^^^^^^^^^^^^^^^^
    ...
    215 | / impl_Integer!(
    216 | |     I8_MAX_LEN => i8,
    217 | |     U8_MAX_LEN => u8,
    218 | |     I16_MAX_LEN => i16,
    ...   |
    221 | |     U32_MAX_LEN => u32
    222 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `i16` to `u32` may lose the sign of the value
       --> src/lib.rs:141:23
        |
    141 |                       (!(self as $conv_fn)).wrapping_add(1)
        |                         ^^^^^^^^^^^^^^^^^^
    ...
    215 | / impl_Integer!(
    216 | |     I8_MAX_LEN => i8,
    217 | |     U8_MAX_LEN => u8,
    218 | |     I16_MAX_LEN => i16,
    ...   |
    221 | |     U32_MAX_LEN => u32
    222 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `i32` to `u32` may lose the sign of the value
       --> src/lib.rs:138:21
        |
    138 |                       self as $conv_fn
        |                       ^^^^^^^^^^^^^^^^
    ...
    215 | / impl_Integer!(
    216 | |     I8_MAX_LEN => i8,
    217 | |     U8_MAX_LEN => u8,
    218 | |     I16_MAX_LEN => i16,
    ...   |
    221 | |     U32_MAX_LEN => u32
    222 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `i32` to `u32` may lose the sign of the value
       --> src/lib.rs:141:23
        |
    141 |                       (!(self as $conv_fn)).wrapping_add(1)
        |                         ^^^^^^^^^^^^^^^^^^
    ...
    215 | / impl_Integer!(
    216 | |     I8_MAX_LEN => i8,
    217 | |     U8_MAX_LEN => u8,
    218 | |     I16_MAX_LEN => i16,
    ...   |
    221 | |     U32_MAX_LEN => u32
    222 | |     as u32);
        | |___________- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `i64` to `u64` may lose the sign of the value
       --> src/lib.rs:138:21
        |
    138 |                     self as $conv_fn
        |                     ^^^^^^^^^^^^^^^^
    ...
    224 | impl_Integer!(I64_MAX_LEN => i64, U64_MAX_LEN => u64 as u64);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `i64` to `u64` may lose the sign of the value
       --> src/lib.rs:141:23
        |
    141 |                     (!(self as $conv_fn)).wrapping_add(1)
        |                       ^^^^^^^^^^^^^^^^^^
    ...
    224 | impl_Integer!(I64_MAX_LEN => i64, U64_MAX_LEN => u64 as u64);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `u8` may lose the sign of the value
       --> src/lib.rs:181:49
        |
    181 |                         *buf_ptr.offset(curr) = (n as u8) + b'0';
        |                                                 ^^^^^^^^^
    ...
    224 | impl_Integer!(I64_MAX_LEN => i64, U64_MAX_LEN => u64 as u64);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `usize` may lose the sign of the value
       --> src/lib.rs:198:39
        |
    198 |                 let len = buf.len() - curr as usize;
        |                                       ^^^^^^^^^^^^^
    ...
    224 | impl_Integer!(I64_MAX_LEN => i64, U64_MAX_LEN => u64 as u64);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `u64` may lose the sign of the value
       --> src/lib.rs:138:21
        |
    138 |                     self as $conv_fn
        |                     ^^^^^^^^^^^^^^^^
    ...
    233 | impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64);
        | ---------------------------------------------------------------- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `u64` may lose the sign of the value
       --> src/lib.rs:141:23
        |
    141 |                     (!(self as $conv_fn)).wrapping_add(1)
        |                       ^^^^^^^^^^^^^^^^^^
    ...
    233 | impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64);
        | ---------------------------------------------------------------- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `u8` may lose the sign of the value
       --> src/lib.rs:181:49
        |
    181 |                         *buf_ptr.offset(curr) = (n as u8) + b'0';
        |                                                 ^^^^^^^^^
    ...
    233 | impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64);
        | ---------------------------------------------------------------- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `usize` may lose the sign of the value
       --> src/lib.rs:198:39
        |
    198 |                 let len = buf.len() - curr as usize;
        |                                       ^^^^^^^^^^^^^
    ...
    233 | impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64);
        | ---------------------------------------------------------------- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `i128` to `u128` may lose the sign of the value
       --> src/lib.rs:248:21
        |
    248 |                     self as u128
        |                     ^^^^^^^^^^^^
    ...
    309 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `i128` to `u128` may lose the sign of the value
       --> src/lib.rs:251:23
        |
    251 |                     (!(self as u128)).wrapping_add(1)
        |                       ^^^^^^^^^^^^^^
    ...
    309 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `usize` may lose the sign of the value
       --> src/lib.rs:265:72
        |
    265 |                         ptr::write_bytes(buf_ptr.offset(target), b'0', (curr - target) as usize);
        |                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    309 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `usize` may lose the sign of the value
       --> src/lib.rs:278:76
        |
    278 |                             ptr::write_bytes(buf_ptr.offset(target), b'0', (curr - target) as usize);
        |                                                                            ^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    309 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: casting `isize` to `usize` may lose the sign of the value
       --> src/lib.rs:298:39
        |
    298 |                 let len = buf.len() - curr as usize;
        |                                       ^^^^^^^^^^^^^
    ...
    309 | impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128);
        | ------------------------------------------------------------ in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
        = note: this warning originates in the macro `impl_Integer128` (in Nightly builds, run with -Z macro-backtrace for more info)
2024-04-19 20:41:43 -07:00
David Tolnay 0ce0ec2440
Revert "Temporarily disable miri on doctests"
This reverts commit d5e45f2273.
2024-04-08 11:52:12 -07:00
David Tolnay 8f392032fa
Release 1.0.11 2024-03-25 23:00:42 -07:00
David Tolnay eeca57ddcf
Touch up comments 2024-03-25 23:00:20 -07:00
David Tolnay ea29bbdbbf
Merge pull request #42 from anforowicz/more-granular-unsafe-blocks
More granular `unsafe` blocks.
2024-03-25 22:57:07 -07:00
David Tolnay 526d4e408c
Explicitly install a Rust toolchain for cargo-outdated job
Debugging a recent cargo-outdated bug, it would have been nice not to
wonder whether a rustc version change in GitHub's runner image was a
contributing factor.
2024-03-25 22:24:51 -07:00
Lukasz Anforowicz fde7fa5e2a More granular `unsafe` blocks.
There should be no functional changes from this commit - the same code
is used before and after this commit, except that `unsafe { ... }`
blocks wrap smaller pieces of code afterwards.  Having more granular
`unsafe` blocks hopefully makes `unsafe` audits a tiny bit easier.
2024-03-25 18:05:44 +00:00
David Tolnay d5e45f2273
Temporarily disable miri on doctests 2024-03-24 19:58:05 -07:00
David Tolnay 547c143d50
Release 1.0.10 2023-12-08 17:26:22 -08:00
David Tolnay ba20a60b10
Touch up PR 41 2023-12-08 17:25:29 -08:00
David Tolnay adecb79816
Merge pull request #41 from CXWorks/master
Add missing unit test for i128 positive
2023-12-08 17:24:42 -08:00
cxworks 84bffa9c1e fix CI error 2023-12-08 20:21:58 -05:00
cxworks cefacdbb27 add missing unit test for i128 2023-12-08 20:15:30 -05:00
David Tolnay 0d040f4664
Remove 'remember to update' reminder from Cargo.toml 2023-10-17 21:05:30 -07:00
David Tolnay 2763105d39
Test docs.rs documentation build in CI 2023-09-24 10:53:40 -07:00
David Tolnay e999a5a689
Update name of clippy clone impl lint
warning: lint `clippy::incorrect_clone_impl_on_copy_type` has been renamed to `clippy::non_canonical_clone_impl`
      --> src/lib.rs:76:13
       |
    76 |     #[allow(clippy::incorrect_clone_impl_on_copy_type)] // false positive https://github.com/rust-lang/rust-clippy/issues/11072
       |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::non_canonical_clone_impl`
       |
       = note: `#[warn(renamed_and_removed_lints)]` on by default
2023-09-13 22:47:39 -06:00
David Tolnay 633b6ae6b2
Ignore needless_doctest_main clippy lint
warning: needless `fn main` in doctest
      --> src/lib.rs:22:5
       |
    22 |   //! fn main() {
       |  _____^
    23 | | //!     let mut buffer = itoa::Buffer::new();
    24 | | //!     let printed = buffer.format(128u64);
    25 | | //!     assert_eq!(printed, "128");
    26 | | //! }
       | |_____^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main
       = note: `-W clippy::needless-doctest-main` implied by `-W clippy::all`
       = help: to override `-W clippy::all` add `#[allow(clippy::needless_doctest_main)]`
2023-09-12 22:34:53 -06:00
David Tolnay 03549a22a1
Update actions/checkout@v3 -> v4 2023-09-04 22:34:58 -07:00
David Tolnay 359df33761
Revert "Temporarily disable -Zrandomize-layout due to rustc ICE"
Fixed in nightly-2023-07-23.

This reverts commit 5a2a69eed4.
2023-07-22 18:40:35 -07:00
David Tolnay 5a2a69eed4
Temporarily disable -Zrandomize-layout due to rustc ICE
https://github.com/rust-lang/rust/issues/113941
2023-07-21 20:22:40 -07:00
David Tolnay 81c115b833
Release 1.0.9 2023-07-15 13:44:22 -07:00
David Tolnay e3dcf52700
Opt in to generate-link-to-definition when building on docs.rs 2023-07-15 13:44:09 -07:00
David Tolnay a6af90ff98
Release 1.0.8 2023-07-03 11:20:56 -07:00
David Tolnay f834fdb88e
Add no-std::no-alloc category 2023-07-03 11:20:43 -07:00
David Tolnay 26259a9a1a
Release 1.0.7 2023-07-02 20:42:05 -07:00
David Tolnay 21ee1ba697
Suppress incorrect_clone_impl_on_copy_type clippy false positive
https://github.com/rust-lang/rust-clippy/issues/11072

    error: incorrect implementation of `clone` on a `Copy` type
      --> src/lib.rs:74:29
       |
    74 |       fn clone(&self) -> Self {
       |  _____________________________^
    75 | |         Buffer::new()
    76 | |     }
       | |_____^ help: change this to: `{ *self }`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_clone_impl_on_copy_type
       = note: `-D clippy::incorrect-clone-impl-on-copy-type` implied by `-D clippy::all`
2023-07-02 20:40:18 -07:00
David Tolnay 0dccfa4597
Ignore expl_impl_clone_on_copy pedantic clippy lint
error: you are implementing `Clone` explicitly on a `Copy` type
      --> src/lib.rs:72:1
       |
    72 | / impl Clone for Buffer {
    73 | |     #[inline]
    74 | |     fn clone(&self) -> Self {
    75 | |         Buffer::new()
    76 | |     }
    77 | | }
       | |_^
       |
    note: consider deriving `Clone` or removing `Copy`
      --> src/lib.rs:72:1
       |
    72 | / impl Clone for Buffer {
    73 | |     #[inline]
    74 | |     fn clone(&self) -> Self {
    75 | |         Buffer::new()
    76 | |     }
    77 | | }
       | |_^
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expl_impl_clone_on_copy
       = note: `-D clippy::expl-impl-clone-on-copy` implied by `-D clippy::pedantic`
2023-07-02 20:39:38 -07:00
David Tolnay 9c8ced9755
impl Copy for Buffer 2023-07-02 20:39:11 -07:00
David Tolnay f2d5e2750a
Remove .clippy.toml in favor of respecting rust-version from Cargo.toml 2023-06-15 18:47:05 -07:00
David Tolnay 97a5102fef
Show error details during miri setup in CI
Without this, if it fails, the only information printed is useless:

    Preparing a sysroot for Miri (target: x86_64-unknown-linux-gnu)...
    fatal error: failed to build sysroot; run `cargo miri setup` to see the error details
2023-05-23 08:29:45 -07:00
David Tolnay 57fa3a3878
Update fuzz crate gitignore to ignore coverage dir 2023-03-25 21:35:19 -07:00
David Tolnay 3cab737d59
Release 1.0.6 2023-03-03 15:18:01 -08:00
David Tolnay e9573cd99e
Enable type layout randomization in CI on nightly 2023-02-19 09:21:56 -08:00
David Tolnay 320250e56d
Support a manual trigger on CI workflow 2023-02-18 17:23:53 -08:00
David Tolnay 40db9e7ea8
Prevent actions duplication on noop merge commits 2023-02-01 17:55:23 -08:00
David Tolnay d79365b257
Speed up cargo fuzz CI job
https://github.com/rust-fuzz/cargo-fuzz/pull/317
2023-01-19 17:28:30 -08:00
David Tolnay 5bd582c965
Opt out -Zrustdoc-scrape-examples on docs.rs
I'd like a chance to audit all the code that rustdoc is inserting into
the docs. Currently I am skeptical that showing itoa's internal usages
of APIs is a net benefit to the public documentation. I am also
skeptical that quite so many examples are needed, and that they should
be featured so prominently in comparison to handwritten docs. Lastly I
wish there were a way to turn this behavior off on a more granular
basis.
2023-01-02 21:43:11 -08:00
David Tolnay a77f3c911f
Sync license text with rust-lang repos 2022-12-30 12:00:48 -08:00
David Tolnay ef4faeda61
Release 1.0.5 2022-12-17 11:20:14 -08:00
David Tolnay b74302f21e
Update build status badge 2022-12-15 17:52:40 -08:00
David Tolnay e035699d6b
Time out workflows after 45 minutes
GitHub's default timeout is 6 hours. Recently some of my GitHub Actions
jobs have started randomly stalling for that long, which is inconvenient
because it ties up a chunk of my runner quota. It apepars to be very
rare for a job to recover after stalling. It's better to time out
quicker and retry on a different runner.
2022-11-25 18:56:17 -08:00
David Tolnay faae88d4ea
Release 1.0.4 2022-10-06 16:06:04 -07:00
David Tolnay 29aa8d782b
Merge pull request #38 from dtolnay/nopanic
Add no-panic feature to confirm no panicking codepaths
2022-10-06 16:05:24 -07:00
David Tolnay 91ba6e8326
Add no-panic feature to confirm no panicking codepaths 2022-10-06 16:02:42 -07:00
David Tolnay 228add34e3
Remove default package.readme metadata from Cargo.toml
Since cargo 1.46.0, README.md is recognized by default.
2022-09-14 09:15:59 -07:00
David Tolnay 8c4881a3ad
GitHub Workflows security hardening 2022-09-02 15:09:29 -07:00
David Tolnay ccd581e524
Release 1.0.3 2022-08-03 06:52:18 -07:00
David Tolnay c9010e1515
Update keywords in crates.io metadata 2022-08-02 10:38:55 -07:00
David Tolnay c46afd3801
Add no-std category to crates.io metadata 2022-08-01 00:12:24 -07:00
David Tolnay f0139eb2f8
Add authors to Cargo.toml 2022-07-31 19:25:46 -07:00
David Tolnay 44ed979a8d
Sort package entries in Cargo.toml 2022-07-31 19:19:03 -07:00
David Tolnay 366ff427d7
Use upstreamed docs.rs icon in docs.rs badge 2022-06-11 10:17:10 -07:00
David Tolnay 8e8a84540e
Add actions job to notice outdated dependencies 2022-06-06 17:01:48 -07:00
David Tolnay f3485c0ef7
Release 1.0.2 2022-05-15 14:09:51 -07:00
David Tolnay e2a55ceb94
Add CI job to compile fuzz target 2022-05-15 13:55:36 -07:00
David Tolnay 9825ed8b12
Assert formatted integer parses back to the same value 2022-05-15 13:55:28 -07:00
David Tolnay 4f1481a12a
Assert size of string in fuzz target 2022-05-15 13:55:04 -07:00
David Tolnay 951c29d200
Rename ptr sized integer variants 2022-05-15 13:51:37 -07:00
David Tolnay ff6798f26e
Move ptr sized integer variant last 2022-05-15 13:51:36 -07:00
David Tolnay 6f99ca58e1
Format a single integer per fuzz call 2022-05-15 13:51:36 -07:00
David Tolnay 5638af52e1
Remove unneeded Clone impls from fuzz target 2022-05-15 13:51:36 -07:00
David Tolnay 6ba4e7ca6c
Depend on arbitrary crate directly 2022-05-15 13:51:36 -07:00
David Tolnay 534011840c
Copy cargo-fuzz generated gitignore 2022-05-15 13:51:36 -07:00
David Tolnay 8d798edf30
Touch up PR 32 manifest 2022-05-15 13:41:03 -07:00
David Tolnay 0d042acb34
Merge pull request #32 from adetaylor/fuzz
Add a fuzzer.
2022-05-15 13:40:06 -07:00
David Tolnay 5f720ce7a4
Run miri in stricter miri-strict-provenance mode 2022-05-06 04:01:33 -07:00
David Tolnay 079962b982
Drop unneeded quoting from env variable in workflows yaml 2022-04-28 19:29:09 -07:00
David Tolnay 71926ea4b0
Update workflows to actions/checkout@v3 2022-04-25 01:43:59 -07:00
David Tolnay 8f756bf621
Pull miri from miri branch of dtolnay/rust-toolchain 2022-04-24 15:47:45 -07:00
Adrian Taylor 5f0c1d0f8d Add a fuzzer. 2022-03-04 13:19:14 -08:00
David Tolnay e2364ef593
Detect warnings in CI 2021-12-31 22:22:30 -08:00
David Tolnay ba8dd88380
Release 1.0.1 2021-12-12 12:07:18 -08:00
David Tolnay 5d3b787011
Run clippy on benches as well 2021-12-12 12:04:30 -08:00
David Tolnay fcdb43ec93
Remove no longer triggered clippy suppressions 2021-12-12 12:03:59 -08:00
David Tolnay 52466ab21b
Resolve clippy transmute_ptr_to_ptr lint 2021-12-12 12:00:36 -08:00
David Tolnay f7502e28ab
Move buffer cast operation out of macro 2021-12-12 11:59:10 -08:00
David Tolnay e2609a2fb7
Combine IntegerPrivate into Sealed trait 2021-12-12 11:53:52 -08:00
David Tolnay 93b0d619fc
Inline impl_IntegerCommon macro 2021-12-12 11:52:29 -08:00
David Tolnay 260dfafbd9
Move buffer type to associated type of IntegerPrivate 2021-12-12 11:50:52 -08:00
David Tolnay 2d2eac29b4
Begin unifying write_to signature with write 2021-12-12 11:49:40 -08:00
David Tolnay 54b4f3db29
Guarantee that Integer: Copy 2021-12-12 11:46:02 -08:00
David Tolnay 0f27c02804
Move write implementation out to the private trait 2021-12-12 11:44:54 -08:00
David Tolnay e6a8f6f2f1
Release 1.0.0 2021-12-12 10:42:05 -08:00
David Tolnay ef7c22a081
Remove impl Copy on Buffer 2021-12-12 00:31:45 -08:00
David Tolnay 4f958fd42f
Reword Buffer documentation 2021-12-12 00:31:22 -08:00
David Tolnay bfd3ee6f24
Adjust chart margins and background for dark themes 2021-12-12 00:23:32 -08:00
David Tolnay 0788e27004
Merge pull request #31 from dtolnay/chart
Add latex code for performance chart
2021-12-12 00:02:25 -08:00
David Tolnay 8c3a8a47dd
Add latex code for performance chart 2021-12-12 00:00:11 -08:00
David Tolnay b85761ea04
Link to ryu as successor to dtoa 2021-12-11 21:19:33 -08:00
David Tolnay b618d972b2
Adjust documentation 2021-12-11 21:18:35 -08:00
David Tolnay 1d447bdf15
Delete outdated documentation 2021-12-11 21:08:50 -08:00
David Tolnay 58e20ae3f3
Drop std feature 2021-12-11 21:08:36 -08:00
David Tolnay f90632b9db
Delete io write function 2021-12-11 21:07:41 -08:00
David Tolnay 9cf53f1083
Delete fmt function 2021-12-11 21:07:14 -08:00
David Tolnay 42cb96a975
Clean up test and bench macro syntax 2021-12-11 21:04:54 -08:00
David Tolnay 6b06fb04f7
Remove attr matcher from test and bench macro
Formerly needed for conditional i128 support.
2021-12-11 21:02:37 -08:00
David Tolnay 2581c8cee7
Eliminate itoa::write and itoa::fmt from rustdoc 2021-12-11 20:59:11 -08:00