Skip to content

Commit 09e7053

Browse files
committed
simplify SpanlessEq::eq_path_segment
1 parent 8823684 commit 09e7053

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

clippy_lints/src/utils/hir_utils.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,8 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
261261
pub fn eq_path_segment(&mut self, left: &PathSegment<'_>, right: &PathSegment<'_>) -> bool {
262262
// The == of idents doesn't work with different contexts,
263263
// we have to be explicit about hygiene
264-
if left.ident.as_str() != right.ident.as_str() {
265-
return false;
266-
}
267-
match (&left.args, &right.args) {
268-
(&None, &None) => true,
269-
(&Some(ref l), &Some(ref r)) => self.eq_path_parameters(l, r),
270-
_ => false,
271-
}
264+
left.ident.as_str() == right.ident.as_str()
265+
&& both(&left.args, &right.args, |l, r| self.eq_path_parameters(l, r))
272266
}
273267

274268
pub fn eq_ty(&mut self, left: &Ty<'_>, right: &Ty<'_>) -> bool {

0 commit comments

Comments
 (0)