-
Notifications
You must be signed in to change notification settings - Fork 898
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 a couply of clippy findings #6007
Conversation
I think there's some overlap here with what's being proposed in #5400 |
src/bin/main.rs
Outdated
fn should_print_with_colors<T: Write>(session: &mut Session<'_, T>) -> bool { | ||
match term::stderr() { | ||
Some(ref t) | ||
if session.config.color().use_colored_tty() | ||
matches!(term::stderr(), Some(ref t) if session.config.color().use_colored_tty() | ||
&& t.supports_color() | ||
&& t.supports_attr(term::Attr::Bold) => | ||
{ | ||
true | ||
} | ||
_ => false, | ||
} | ||
&& t.supports_attr(term::Attr::Bold)) | ||
} |
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.
#5400 is using is_some_and
, which I think it a little clearer than the matches!
that you're using here.
term::stderr().is_some_and(|t| {
session.config.color().use_colored_tty()
&& t.supports_color()
&& t.supports_attr(term::Attr::Bold)
})
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.
fixed
looking at the commits of #5400 , I skipped most of these warnings because I didn't find them very interesting but yes there might be some overlap besides that. |
a08e023
to
40a1684
Compare
Out of curiosity, what about these changes did you find interesting? |
I'm usually trying to go for stuff that imo makes code slightly more elegant, simpler or easier to understand (for me, at least 🙃 ) / doing the same things with less code, ĺike using an array instead of vec when its sufficient, having a nice flow of iterator chains that help building a metal model what is going on etc. Unnecessary needles borrows which I didnt touch can sometimes help keep in mind that a var is borrowed, even if it is already a reference (although I think rust-analyzer can show you that nowadays..?) IIRC Caleb once mentioned that he liked the if nesting as is, which is why I didn't touch |
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.
Thanks for explaining. Overall I think these changes look reasonable!
No description provided.