mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
redundant_pattern_matching
This commit is contained in:
parent
5a62a0db46
commit
71d4dba960
17 changed files with 39 additions and 46 deletions
|
@ -98,15 +98,13 @@ pub(super) fn hints(
|
|||
};
|
||||
{
|
||||
let mut potential_lt_refs = potential_lt_refs.iter().filter(|&&(.., is_elided)| is_elided);
|
||||
if let Some(_) = &self_param {
|
||||
if let Some(_) = potential_lt_refs.next() {
|
||||
allocated_lifetimes.push(if config.param_names_for_lifetime_elision_hints {
|
||||
// self can't be used as a lifetime, so no need to check for collisions
|
||||
"'self".into()
|
||||
} else {
|
||||
gen_idx_name()
|
||||
});
|
||||
}
|
||||
if self_param.is_some() && potential_lt_refs.next().is_some() {
|
||||
allocated_lifetimes.push(if config.param_names_for_lifetime_elision_hints {
|
||||
// self can't be used as a lifetime, so no need to check for collisions
|
||||
"'self".into()
|
||||
} else {
|
||||
gen_idx_name()
|
||||
});
|
||||
}
|
||||
potential_lt_refs.for_each(|(name, ..)| {
|
||||
let name = match name {
|
||||
|
|
|
@ -47,7 +47,7 @@ pub(super) fn hints(
|
|||
if let Some(name) = param {
|
||||
if let hir::CallableKind::Function(f) = callable.kind() {
|
||||
// assert the file is cached so we can map out of macros
|
||||
if let Some(_) = sema.source(f) {
|
||||
if sema.source(f).is_some() {
|
||||
linked_location = sema.original_range_opt(name.syntax());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue