Skip to content

Commit

Permalink
Suppress some clippy lints from dtoa function moves
Browse files Browse the repository at this point in the history
    error: this is an `else if` but the formatting might hide it
       --> src/dtoa.rs:151:6
        |
    151 |       }
        |  ______^
    152 | |     /*
    153 | |     else if (0 < kk && kk <= 21) {
    154 | |         // 1234e-2 -> 12.34
    ...   |
    168 | |     */
    169 | |     else if 0 < kk && kk <= 21 {
        | |_________^
        |
        = note: `-D clippy::suspicious-else-formatting` implied by `-D clippy::all`
        = note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting

    error: this is an `else if` but the formatting might hide it
       --> src/dtoa.rs:189:6
        |
    189 |       }
        |  ______^
    190 | |     /*
    191 | |     else if (-6 < kk && kk <= 0) {
    192 | |         // 1234e-6 -> 0.001234
    ...   |
    210 | |     */
    211 | |     else if -6 < kk && kk <= 0 {
        | |_________^
        |
        = note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting

    error: this is an `else if` but the formatting might hide it
       --> src/dtoa.rs:232:6
        |
    232 |       }
        |  ______^
    233 | |     /*
    234 | |     else if (kk < -maxDecimalPlaces) {
    235 | |         // Truncate to zero
    ...   |
    241 | |     */
    242 | |     else if kk < -crate::MAX_DECIMAL_PLACES {
        | |_________^
        |
        = note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting

    error: this is an `else if` but the formatting might hide it
       --> src/dtoa.rs:247:6
        |
    247 |       }
        |  ______^
    248 | |     /*
    249 | |     else if (length == 1) {
    250 | |         // 1e30
    ...   |
    254 | |     */
    255 | |     else if length == 1 {
        | |_________^
        |
        = note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting

    error: this is an `else {..}` but the formatting might hide it
       --> src/dtoa.rs:259:6
        |
    259 |       }
        |  ______^
    260 | |     /*
    261 | |     else {
    262 | |         // 1234e30 -> 1.234e33
    ...   |
    268 | |     */
    269 | |     else {
        | |_________^
        |
        = note: to remove this lint, remove the `else` or remove the new line between `else` and `{..}`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting

    error: casting `isize` to `u8` may lose the sign of the value
       --> src/dtoa.rs:109:26
        |
    109 |         *buffer = b'0' + (k / 100) as u8;
        |                          ^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::cast-sign-loss` implied by `-D clippy::pedantic`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss

    error: casting `isize` to `u8` may lose the sign of the value
       --> src/dtoa.rs:119:26
        |
    119 |         *buffer = b'0' + k as u8;
        |                          ^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss

    error: casting `isize` to `usize` may lose the sign of the value
       --> src/dtoa.rs:174:13
        |
    174 |             (length - kk) as usize,
        |             ^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss

    error: casting `isize` to `usize` may lose the sign of the value
       --> src/dtoa.rs:214:50
        |
    214 |         ptr::copy(buffer, buffer.offset(offset), length as usize);
        |                                                  ^^^^^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss

    error: casting `isize` to `usize` may lose the sign of the value
       --> src/dtoa.rs:271:55
        |
    271 |         ptr::copy(buffer.offset(1), buffer.offset(2), (length - 1) as usize);
        |                                                       ^^^^^^^^^^^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
  • Loading branch information
dtolnay committed Dec 13, 2021
1 parent 8bccb93 commit e59016f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@
#![allow(
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::doc_markdown,
clippy::if_not_else,
clippy::missing_errors_doc,
clippy::must_use_candidate,
clippy::range_plus_one,
clippy::semicolon_if_nothing_returned, // https://github.com/rust-lang/rust-clippy/issues/7768
clippy::shadow_unrelated,
clippy::suspicious_else_formatting,
clippy::transmute_float_to_int,
clippy::unreadable_literal,
clippy::unseparated_literal_suffix
Expand Down

0 comments on commit e59016f

Please sign in to comment.