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

Pin clippy check to 1.49.0 #407

Merged
merged 5 commits into from
Jan 4, 2021
Merged

Pin clippy check to 1.49.0 #407

merged 5 commits into from
Jan 4, 2021

Conversation

crawford
Copy link
Contributor

@crawford crawford commented Jan 4, 2021

This also includes a handful of other clippy-inspired cleanups.

These were flagged by `cargo clippy`:

    warning: using `clone` on a `Copy` type
    warning: passing a unit value to a function
    warning: redundant closure found
    warning: called `iter().cloned().collect()` on a slice to create a
             `Vec`. Calling `to_vec()` is both faster and more readable
These were flagged by `cargo clippy`:

    warning: you seem to be trying to use match for destructuring a
             single pattern. Consider using `if let`
    warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()`
             is equivalent
    warning: using `write!()` with a format string that ends in a single
             newline
    warning: useless conversion to the same type:
             `smoltcp::wire::Ipv4Address`
    warning: called `map(f)` on an `Option` value where `f` is a closure
             that returns the unit type `()`
    warning: returning the result of a `let` binding from a block
    warning: use of `unwrap_or` followed by a function call
This was flagged by `cargo clippy`:

    warning: field assignment outside of initializer for an instance
             created with Default::default()

This changes the visibility of the dummy field to be public, but only to
the crate.
Might as well run the lints on our tests and examples. When I first
started doing this cleanup, I thought this was the default, but I must
have run `cargo clippy --all-targets` at some point in there.
It can be rather surprising when new lints pop up when a new stable
toolchain is released. Let's pin this check to a specific version to
avoid those surprises.
@crawford crawford mentioned this pull request Jan 4, 2021
@Dirbaio
Copy link
Member

Dirbaio commented Jan 4, 2021

Sounds great! This way we can decide when to update it and deal with the breakage there, instead of in a random PR. Thanks!

@Dirbaio Dirbaio merged commit 4d0d4ae into smoltcp-rs:master Jan 4, 2021
@crawford crawford deleted the clippy branch January 4, 2021 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants