10 Commits

Author SHA1 Message Date
David Tolnay
2ccb5b67ca
Disable question_mark clippy lint in lexical test
Serde_json uses #![deny(clippy::question_mark_used)].

    warning: this `match` expression can be replaced with `?`
      --> tests/../src/lexical/algorithm.rs:54:21
       |
    54 |           let value = match mantissa.checked_mul(power) {
       |  _____________________^
    55 | |             None => return None,
    56 | |             Some(value) => value,
    57 | |         };
       | |_________^ help: try instead: `mantissa.checked_mul(power)?`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
       = note: `-W clippy::question-mark` implied by `-W clippy::all`
       = help: to override `-W clippy::all` add `#[allow(clippy::question_mark)]`
2024-11-15 18:50:53 -08:00
David Tolnay
421a70d1a6
Fix unused imports
warning: unused imports: `parse_concise_float`, `parse_truncated_float`
      --> tests/../src/lexical/mod.rs:38:23
       |
    38 | pub use self::parse::{parse_concise_float, parse_truncated_float};
       |                       ^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^
       |
       = note: `#[warn(unused_imports)]` on by default

    warning: unused import: `std::vec::Vec`
      --> tests/lexical.rs:30:13
       |
    30 |     pub use std::vec::Vec;
       |             ^^^^^^^^^^^^^

    warning: unused imports: `cmp`, `iter`, `mem`, `ops`
      --> tests/lexical.rs:31:19
       |
    31 |     pub use std::{cmp, iter, mem, ops};
       |                   ^^^  ^^^^  ^^^  ^^^
2023-10-24 23:35:42 -07:00
David Tolnay
d9447c30eb
Ignore let_underscore_untyped pedantic clippy lint
error: non-binding `let` without a type annotation
        --> src/de.rs:1712:9
         |
    1712 |         let _ = name;
         |         ^^^^^^^^^^^^^
         |
         = help: consider adding a type annotation or removing the `let` keyword
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
         = note: `-D clippy::let-underscore-untyped` implied by `-D clippy::pedantic`

    error: non-binding `let` without a type annotation
        --> src/de.rs:2190:9
         |
    2190 |         let _ = name;
         |         ^^^^^^^^^^^^^
         |
         = help: consider adding a type annotation or removing the `let` keyword
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> src/map.rs:51:17
       |
    51 |                 let _ = capacity;
       |                 ^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/value/de.rs:312:9
        |
    312 |         let _ = name;
        |         ^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/value/de.rs:803:9
        |
    803 |         let _ = name;
        |         ^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> tests/lexical/num.rs:26:5
       |
    26 |     let _ = x;
       |     ^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: `-D clippy::let-underscore-untyped` implied by `-D clippy::pedantic`

    error: non-binding `let` without a type annotation
      --> tests/lexical/num.rs:31:5
       |
    31 |     let _ = y + x;
       |     ^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> tests/lexical/num.rs:48:5
       |
    48 |     let _ = x & T::ZERO;
       |     ^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> tests/lexical/num.rs:61:5
       |
    61 |     let _ = x.pow10(5);
       |     ^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> tests/lexical/num.rs:62:5
       |
    62 |     let _ = x.to_bits();
       |     ^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> tests/lexical/num.rs:66:5
       |
    66 |     let _ = x.to_bits() & T::SIGN_MASK;
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> tests/lexical/num.rs:67:5
       |
    67 |     let _ = x.to_bits() & T::EXPONENT_MASK;
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> tests/lexical/num.rs:68:5
       |
    68 |     let _ = x.to_bits() & T::HIDDEN_BIT_MASK;
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> tests/lexical/num.rs:69:5
       |
    69 |     let _ = x.to_bits() & T::MANTISSA_MASK;
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
        --> tests/test.rs:1977:5
         |
    1977 | /     let _ = json!([
    1978 | |         <Result<(), ()> as Clone>::clone(&Ok(())),
    1979 | |         <Result<(), ()> as Clone>::clone(&Err(()))
    1980 | |     ]);
         | |_______^
         |
         = help: consider adding a type annotation or removing the `let` keyword
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
         = note: `-D clippy::let-underscore-untyped` implied by `-D clippy::pedantic`

    error: non-binding `let` without a type annotation
        --> tests/test.rs:1983:5
         |
    1983 | /     let _ = json!({
    1984 | |         "ok": <Result<(), ()> as Clone>::clone(&Ok(())),
    1985 | |         "err": <Result<(), ()> as Clone>::clone(&Err(()))
    1986 | |     });
         | |_______^
         |
         = help: consider adding a type annotation or removing the `let` keyword
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
        --> tests/test.rs:1989:5
         |
    1989 | /     let _ = json!({
    1990 | |         (<Result<&str, ()> as Clone>::clone(&Ok("")).unwrap()): "ok",
    1991 | |         (<Result<(), &str> as Clone>::clone(&Err("")).unwrap_err()): "err"
    1992 | |     });
         | |_______^
         |
         = help: consider adding a type annotation or removing the `let` keyword
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
        --> tests/test.rs:1995:5
         |
    1995 |     let _ = json!({ "architecture": [true, null] });
         |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: consider adding a type annotation or removing the `let` keyword
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
2023-02-26 23:03:29 -07:00
David Tolnay
5d2cbcdd4b
Eliminate lib module 2021-12-30 20:52:08 -08:00
David Tolnay
7db1ea907d
Ignore needless_late_init Clippy lint
error: unneeded late initalization
       --> tests/../src/lexical/float.rs:173:9
        |
    173 |         let exp: u64;
        |         ^^^^^^^^^^^^^
        |
        = note: `-D clippy::needless-late-init` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
    help: declare `exp` here
        |
    174 |         let exp: u64 = if (fp.exp == F::DENORMAL_EXPONENT) && (fp.mant & F::HIDDEN_BIT_MASK.as_u64()) == 0 {
        |         ++++++++++++++
    help: remove the assignments from the branches
        |
    175 ~             0
    176 |         } else {
    177 ~             (fp.exp + F::EXPONENT_BIAS) as u64
        |
    help: add a semicolon after the `if` expression
        |
    178 |         };
        |          +
2021-12-07 18:41:06 -08:00
David Tolnay
019041e4d5
Resolve semicolon_if_nothing_returned pedantic clippy lint
error: consider adding a `;` to the last statement for consistent formatting
       --> tests/../src/lexical/float.rs:111:9
        |
    111 |         round_to_native::<F, _>(self, algorithm)
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `round_to_native::<F, _>(self, algorithm);`
        |
        = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D clippy::pedantic`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

    error: consider adding a `;` to the last statement for consistent formatting
       --> tests/../src/lexical/math.rs:616:9
        |
    616 |         iadd_impl(x, y, 0)
        |         ^^^^^^^^^^^^^^^^^^ help: add a `;` here: `iadd_impl(x, y, 0);`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

    error: consider adding a `;` to the last statement for consistent formatting
       --> tests/../src/lexical/math.rs:862:9
        |
    862 |         self.ishl(n as usize)
        |         ^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `self.ishl(n as usize);`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

    error: consider adding a `;` to the last statement for consistent formatting
       --> tests/../src/lexical/math.rs:868:9
        |
    868 |         small::imul_pow5(self.data_mut(), n)
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `small::imul_pow5(self.data_mut(), n);`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

    error: consider adding a `;` to the last statement for consistent formatting
       --> tests/lexical/float.rs:184:5
        |
    184 |     check_round_to_f64(10234494226754558294, -1086, 2498655817078750, -1074)
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `check_round_to_f64(10234494226754558294, -1086, 2498655817078750, -1074);`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
2021-10-01 01:09:12 -04:00
David Tolnay
0b5931550a
Resolve needless_borrow clippy lint
error: this expression borrows a reference (`&lexical::float::ExtendedFloat`) that is immediately dereferenced by the compiler
       --> tests/../src/lexical/algorithm.rs:136:45
        |
    136 |         u64::error_is_accurate::<F>(errors, &fp)
        |                                             ^^^ help: change this to: `fp`
        |
        = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
2021-10-01 01:07:42 -04:00
David Tolnay
fc4db0306a
Run clippy on test suite too 2021-10-01 00:46:45 -04:00
David Tolnay
f753b96ddd
Ignore some clippy lints in lexical tests 2020-06-07 01:33:30 -07:00
David Tolnay
664cd2d253
Move lexical unit tests to tests directory 2020-06-07 00:10:43 -07:00