Skip to content

Commit

Permalink
simplify SpanlessEq::eq_path_segment
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-700 committed Oct 24, 2020
1 parent bf1c6f9 commit 5e1154e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions clippy_lints/src/utils/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5e1154e

Please sign in to comment.