-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix Clippy lints #1661
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 Clippy lints #1661
Conversation
|
Forgot to ask, do I update the |
|
Thanks for taking the time to make another contribution! Seems like we can't add I suspect that latest Rust clippy is smarter than in 1.45.0 and therefore finds more lints. I took a quick look at your changes, and they all seemed reasonable, but I need some more time to make an in-depth code review. I personally think it is fine to mention this in |
|
Thank you for your review!
Got it, maybe in the future when the MSRV is bumped to 1.50.0.
Take all the time you need! Given that the lints are not showing up on 1.45.0, as a point of reference, I'll post links to the lints and their relevant commit(s). Hopefully this helps with the review process. Links are in the format:
Clippy Lints
|
src/pager.rs
Outdated
| // Is false if the given expression does not match any of the | ||
| // patterns; this ensures 'less' is never silently used if BAT_PAGER | ||
| // or --pager has been specified. | ||
| let use_less_instead = matches!( | ||
| (&source, &kind), | ||
| // 'more' and 'most' do not supports colors; automatically use | ||
| // 'less' instead if the problematic pager came from the | ||
| // generic PAGER env var | ||
| (PagerSource::EnvVarPager, PagerKind::More) | ||
| | (PagerSource::EnvVarPager, PagerKind::Most) | ||
|
|
||
| // If PAGER=bat, silently use 'less' instead to prevent | ||
| // recursion ... | ||
| | (PagerSource::EnvVarPager, PagerKind::Bat) | ||
| ); |
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.
I personally think this is quite a bit harder to read now. The previous match isn't great either. Maybe this should be written with an outer if clause instead?
let use_less_instead = if source == PagerSource::EnvVarPager {
// full comment here
matches!(&kind, PagerKind::More | PagerKind::Most | …)
} else {
false
};
sharkdp
left a comment
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 other changes look good - thank you!
|
Thank you!
I agree, this is much better.
Just checking, |
|
On another note, I promise I'm not trying to rush you or anything, I am just new here and wanted to know what is more convenient for you. I was working on another issue and wanted to discuss it so I added a couple of comments to the issue; is that easy for you to spot and review, or should I create a PR and have the discussion there? |
Right. Didn't test my code :-)
No. Discussion in the ticket is completely fine. Comments should be visible to everyone watching the repo. We just didn't have the time to answer, yet. |
Got it, take as much time as you need! Thank you for being patient will all my questions; I appreciate it! :) |
The Minimum Supported Rust Version (MSRV) for
batis 1.45.0. Settingmsrv = "1.45.0"in.clippy.toml(not part of the repository) and runningcargo clippyemits 7 warnings. These are proposed fixes to said warnings. If there are any lints we would rather allow, I can revert the relevant commit(s) and add the appropriate lint attribute(s).Also, do you think we should create
.clippy.toml/clippy.tomland set the MSRV to ensure consistency amongst contributors?