-
Notifications
You must be signed in to change notification settings - Fork 130
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
refactor: fix clippy warnings #165
Conversation
@@ -9,8 +9,6 @@ from being printed. | |||
|
|||
#[cfg(feature = "atty")] | |||
mod imp { | |||
use atty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
@@ -452,6 +452,7 @@ impl_styled_value_fmt!( | |||
/// Hexadecimal numbers are written with a `0x` prefix. | |||
#[allow(missing_docs)] | |||
#[derive(Clone, Debug, Eq, PartialEq)] | |||
#[non_exhaustive] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as the manual implementation.
@@ -245,6 +245,7 @@ | |||
#![cfg_attr(rustbuild, feature(staged_api, rustc_private))] | |||
#![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] | |||
#![deny(missing_debug_implementations, missing_docs, warnings)] | |||
#![allow(clippy::needless_doctest_main)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main functions are not needed in doc tests but they make sense here as they reflect real-world usage more accurately.
@@ -260,10 +261,10 @@ use self::fmt::writer::{self, Writer}; | |||
use self::fmt::Formatter; | |||
|
|||
/// The default name for the environment variable to read filters from. | |||
pub const DEFAULT_FILTER_ENV: &'static str = "RUST_LOG"; | |||
pub const DEFAULT_FILTER_ENV: &str = "RUST_LOG"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default 'static
@@ -354,15 +354,15 @@ fn parse_spec(spec: &str) -> (Vec<Directive>, Option<inner::Filter>) { | |||
} | |||
}); | |||
|
|||
let filter = filter.map_or(None, |filter| match inner::Filter::new(filter) { | |||
let filter = filter.and_then(|filter| match inner::Filter::new(filter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same control flow.
Oh, I didn't know that non_exhaustive is experimental on 1.31. Reverting... Edit: Done. |
@sirwindfield |
Not sure what a sensible good one would be though. Maybe something relative is a good approach here, like supporting the latest four versions, meaning that from today's perspective, Rust |
That sounds good to me! I usually bump the MSRV as-needed to something reasonably recent but old enough. As a baseline I check whatever the latest version is that's available in Ubuntu packages for the current LTS (which right now is |
That's a great idea! Sounds good! I can add a Merge-able from my side. I will do a cleanup PR if something is still missing afterwards. |
@@ -479,6 +480,7 @@ impl Color { | |||
Color::White => Some(termcolor::Color::White), | |||
Color::Ansi256(value) => Some(termcolor::Color::Ansi256(value)), | |||
Color::Rgb(r, g, b) => Some(termcolor::Color::Rgb(r, g, b)), | |||
_ => None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do bump the MSRV, let's also make this function return Color
instead of Option<Color>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, I totally missed that :)
By the power that has been given to me, I'll just merge this :) |
This fixes all clippy warnings that I encountered