- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.7k
fix more clippy warnings #7251
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 more clippy warnings #7251
Conversation
| r? @ehuss (rust_highfive has picked a reviewer for you, use r? to override) | 
88863ce    to
    596ed63      
    Compare
  
    | @bors: r+ | 
| 📌 Commit 596ed63 has been approved by  | 
        
          
                src/cargo/core/shell.rs
              
                Outdated
          
        
      | unsafe { | ||
| let mut winsize: libc::winsize = mem::zeroed(); | ||
| if libc::ioctl(libc::STDERR_FILENO, libc::TIOCGWINSZ.into(), &mut winsize) < 0 { | ||
| if libc::ioctl(libc::STDERR_FILENO, libc::TIOCGWINSZ, &mut winsize) < 0 { | 
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.
This was changed specifically for freebsd, I don't think it should be modified.
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.
Alright, I backed that one out.
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.
Can you add #[allow(clippy::identity_conversion)] with a comment explaining why?
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.
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.
FWIW I'm personally not a fan of adding #[allow(clippy::...)] throughout the code, I find it pretty jarring to basically see a random distribution of clippy lints sprayed throughout the code. I think it's pretty bad style and is one of the reasons I'm not a fan of clippy, I'd rather not have a tool force me to randomly annotate code where it just otherwise causes bugs.
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.
Would it be OK to add it to src/cargo/lib.rs with the rest of the list?
I agree there are too many false positives in clippy's default set, and that it can be too pedantic. However, I think there are enough cases where it does help simplify and clarify code, and even point out invalid code. For example, it points out a memory corruption issue in git2 that I've been meaning to fix, but haven't got around to.
I also think there should have been a comment here in the first place.  A magical .into that only applies to one target that isn't even tested on CI should have something to explain why it is there.
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.
Yes I think it'd at least be better to go in src/cargo/lib.rs. I also do understand that this is a pretty unproductive location to litigate this, it's not like anyone from clippy is watching this PR. I apologize for venting here :(
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 suppressed the warning in lib.rs and reverted the change to shell.rs.
| @bors: r- | 
| ☀️ Try build successful - checks-azure | 
d20c78e    to
    ccc7684      
    Compare
  
    ccc7684    to
    61c1b1c      
    Compare
  
    | Thanks, I pushed a small comment addition. @bors r+ | 
| 📌 Commit e3bb695 has been approved by  | 
| ☀️ Test successful - checks-azure | 
No description provided.