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

refactor: fix clippy warnings #165

Merged
merged 2 commits into from
Jul 17, 2020
Merged

refactor: fix clippy warnings #165

merged 2 commits into from
Jul 17, 2020

Conversation

mainrs
Copy link
Contributor

@mainrs mainrs commented Jul 12, 2020

This fixes all clippy warnings that I encountered

@@ -9,8 +9,6 @@ from being printed.

#[cfg(feature = "atty")]
mod imp {
use atty;
Copy link
Contributor Author

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]
Copy link
Contributor Author

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)]
Copy link
Contributor Author

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";
Copy link
Contributor Author

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) {
Copy link
Contributor Author

@mainrs mainrs Jul 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same control flow.

@mainrs
Copy link
Contributor Author

mainrs commented Jul 12, 2020

Oh, I didn't know that non_exhaustive is experimental on 1.31. Reverting...

Edit: Done.

@mainrs mainrs mentioned this pull request Jul 12, 2020
@KodrAus
Copy link
Collaborator

KodrAus commented Jul 12, 2020

@sirwindfield 1.31.0 is pretty old now, I'd be up for bumping it to something more recent.

@mainrs
Copy link
Contributor Author

mainrs commented Jul 12, 2020

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 1.44.1 is the newest version, so we'd ensure support for 1.41+.

@KodrAus
Copy link
Collaborator

KodrAus commented Jul 12, 2020

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 1.41.0).

@mainrs
Copy link
Contributor Author

mainrs commented Jul 12, 2020

That's a great idea! Sounds good! I can add a rust-toolchain file to pin the MSRV. I'll add it to #164.

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,
Copy link
Contributor

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>.

Copy link
Contributor Author

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 :)

@mainrs
Copy link
Contributor Author

mainrs commented Jul 17, 2020

By the power that has been given to me, I'll just merge this :)

@mainrs mainrs changed the title fix clippy warnings refactor: fix clippy warnings Jul 17, 2020
@mainrs mainrs merged commit e8c3a5f into rust-cli:master Jul 17, 2020
@mainrs mainrs deleted the fix_lints branch July 17, 2020 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants