Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nightly clippy warnings #991

Merged
merged 4 commits into from
Sep 30, 2020
Merged

fix nightly clippy warnings #991

merged 4 commits into from
Sep 30, 2020

Commits on Sep 29, 2020

  1. fix nightly clippy warnings

    This will avoid breaking CI on new releases of clippy. It also makes the
    code a little easier to read.
    
    - Convert `match val { pat => true, _ => false }` to `matches!(val, pat)`
    - Remove unnecessary closures
    - Convert `self: &mut Self` to `&mut self`
    
    This bumps the MSRV to 1.42.0 for `matches!`.
    The latest version of rust is 1.46.0, so as per
    https://github.com/tokio-rs/tracing#supported-rust-versions this is not
    considered a breaking change.
    
    I didn't fix the following error because the fix was not trivial/needed
    a decision:
    
    ```
    warning: you are deriving `Ord` but have implemented `PartialOrd` explicitly
       --> tracing-subscriber/src/filter/env/field.rs:16:32
        |
    16  | #[derive(Debug, Eq, PartialEq, Ord)]
        |                                ^^^
        |
        = note: `#[warn(clippy::derive_ord_xor_partial_ord)]` on by default
    note: `PartialOrd` implemented here
       --> tracing-subscriber/src/filter/env/field.rs:98:1
        |
    98  | / impl PartialOrd for Match {
    99  | |     fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
    100 | |         // Ordering for `Match` directives is based first on _whether_ a value
    101 | |         // is matched or not. This is semantically meaningful --- we would
    ...   |
    121 | |     }
    122 | | }
        | |_^
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord
    ```
    jyn514 committed Sep 29, 2020
    Configuration menu
    Copy the full SHA
    2920244 View commit details
    Browse the repository at this point in the history
  2. Note that the new MSRV is 1.42

    For the next person that comes along, the way to do this automatically
    is
    
    ```sh
    rg 'version is 1\.40' -l | xargs sed -i 's/version is 1\.40/version is 1.42/'
    ```
    jyn514 committed Sep 29, 2020
    Configuration menu
    Copy the full SHA
    f0f0a76 View commit details
    Browse the repository at this point in the history
  3. cargo fmt

    jyn514 committed Sep 29, 2020
    Configuration menu
    Copy the full SHA
    fadafee View commit details
    Browse the repository at this point in the history
  4. Update lib.rs and README files too

    ```
    fd '.(md|rs)' | xargs rg '1\.40' -l | xargs sed -i 's/1\.40/1.42/'
    ```
    jyn514 committed Sep 29, 2020
    Configuration menu
    Copy the full SHA
    07b81bb View commit details
    Browse the repository at this point in the history