mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-16 17:58:14 +00:00
Auto merge of #6403 - camsteffen:similar-names-underscore, r=Manishearth
Similar names ignore underscore prefixed names changelog: Ignore underscore-prefixed names for similar_names IMO, this lint is not very helpful for underscore-prefixed variables. Usually they are unused or are just there to ignore part of a destructuring.
This commit is contained in:
commit
70386ff352
2 changed files with 9 additions and 0 deletions
|
@ -199,6 +199,10 @@ impl<'a, 'tcx, 'b> SimilarNamesNameVisitor<'a, 'tcx, 'b> {
|
|||
);
|
||||
return;
|
||||
}
|
||||
if interned_name.starts_with('_') {
|
||||
// these bindings are typically unused or represent an ignored portion of a destructuring pattern
|
||||
return;
|
||||
}
|
||||
let count = interned_name.chars().count();
|
||||
if count < 3 {
|
||||
if count == 1 {
|
||||
|
|
|
@ -101,3 +101,8 @@ pub(crate) struct DirSizes {
|
|||
pub(crate) numb_reg_cache_entries: u64,
|
||||
pub(crate) numb_reg_src_checkouts: u64,
|
||||
}
|
||||
|
||||
fn ignore_underscore_prefix() {
|
||||
let hello: ();
|
||||
let _hello: ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue