diff options
| author | Aleksei Latyshev <alex_700_95@mail.ru> | 2020-10-24 18:05:02 +0300 |
|---|---|---|
| committer | Aleksei Latyshev <alex_700_95@mail.ru> | 2020-10-27 20:44:41 +0300 |
| commit | 09e70536075fd92506ef985c5e662e1b2be3dd3d (patch) | |
| tree | 5054afa36c253a99ab73ef6c90c72c2e7fabd450 | |
| parent | 8823684197f2314fe773c35bbb40444ca49a1d23 (diff) | |
| download | rust-09e70536075fd92506ef985c5e662e1b2be3dd3d.tar.gz rust-09e70536075fd92506ef985c5e662e1b2be3dd3d.zip | |
simplify SpanlessEq::eq_path_segment
| -rw-r--r-- | clippy_lints/src/utils/hir_utils.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index c9e639e8728..e4ad105c351 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -261,14 +261,8 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> { pub fn eq_path_segment(&mut self, left: &PathSegment<'_>, right: &PathSegment<'_>) -> bool { // The == of idents doesn't work with different contexts, // we have to be explicit about hygiene - if left.ident.as_str() != right.ident.as_str() { - return false; - } - match (&left.args, &right.args) { - (&None, &None) => true, - (&Some(ref l), &Some(ref r)) => self.eq_path_parameters(l, r), - _ => false, - } + left.ident.as_str() == right.ident.as_str() + && both(&left.args, &right.args, |l, r| self.eq_path_parameters(l, r)) } pub fn eq_ty(&mut self, left: &Ty<'_>, right: &Ty<'_>) -> bool { |
