- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Duplicate bounds lint #88096
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
Duplicate bounds lint #88096
Conversation
| Some changes occurred in src/tools/clippy. cc @rust-lang/clippy | 
| (rust-highfive has picked a reviewer for you, use r? to override) | 
        
          
                library/proc_macro/src/lib.rs
              
                Outdated
          
        
      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 seems to be a false positive from the old clippy lint as well:
#![deny(clippy::pedantic)]
fn foo<T: AsRef<str>>()
where
    T: AsRef<String>,
{
}error: this trait bound is already specified in the where clause
 --> src/lib.rs:3:11
  |
3 | fn foo<T: AsRef<str>>()
  |           ^^^^^^^^^^
  |
I guess I would have to compare Path::segments instead of Res to handle this case?
| Can you add a Clippy test for the renamed lint in tests/ui/rename.rs? | 
| In addition to the test in  | 
| 
 Oh, no that's fine, since other renames are also tested there. But there should be more output in deprecated.stderr. | 
2e804ea    to
    9e7c714      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| The job  Click to see the possible cause of the failure (guessed by this bot) | 
| ls.register_renamed("clippy::panic_params", "non_fmt_panics"); | ||
| ls.register_renamed("clippy::unknown_clippy_lints", "unknown_lints"); | ||
| ls.register_renamed("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"); | ||
| ls.register_renamed("clippy::trait_duplication_in_bounds", "trait_duplication_in_bounds"); | 
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.
| ls.register_renamed("clippy::trait_duplication_in_bounds", "trait_duplication_in_bounds"); | |
| ls.register_renamed("clippy::trait_duplication_in_bounds", "duplicate_bounds"); | 
| /// assert!(result.is_err()); | ||
| /// ``` | ||
| #[inline] | ||
| #[cfg_attr(not(bootstrap), allow(duplicate_bounds))] | 
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.
Why is the lint reported 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.
Because Try and TryV2 are the same thing now. cc @scottmcm
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.
Oh, good point, I never cleaned that alias up after the bootstrap compiler updated. New PR: #88223
| I'm sufficiently sure that the check should not be HIR-based. Before type checking all bounds are converted to type representation ( (Could you also add a test for  | 
| ☔ The latest upstream changes (presumably #88329) made this pull request unmergeable. Please resolve the merge conflicts. | 
| Ping from triage: | 
| Ping again from triage: | 
| Ping from triage: | 
Deprecate
clippy::trait_duplication_in_boundsand add a rustc built-in lintduplicate_boundsthat handles more cases:fn foo<T: Foo + Foo>() {}fn foo<T: Foo>() where T: Foo {}fn foo<'a, 'b: 'a + 'a>() {}fn foo<'a, 'b: 'a>() where 'b: 'a {}fn foo<'a, T: 'a>() where T: 'a {}Resolves #88013.