From 00faed9f0cb0129dc39d3f6ea769df35c68a4d05 Mon Sep 17 00:00:00 2001 From: kadmin Date: Sat, 24 Apr 2021 21:41:57 +0000 Subject: [PATCH] Add generic arg infer --- clippy_utils/src/hir_utils.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/clippy_utils/src/hir_utils.rs b/clippy_utils/src/hir_utils.rs index a21ad42c0..63737955f 100644 --- a/clippy_utils/src/hir_utils.rs +++ b/clippy_utils/src/hir_utils.rs @@ -885,7 +885,15 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { pub fn hash_ty(&mut self, ty: &Ty<'_>) { std::mem::discriminant(&ty.kind).hash(&mut self.s); - match ty.kind { + self.hash_tykind(&ty.kind); + } + + pub fn hash_infer(&mut self) { + "_".hash(&mut self.s); + } + + pub fn hash_tykind(&mut self, ty: &TyKind<'_>) { + match ty { TyKind::Slice(ty) => { self.hash_ty(ty); }, @@ -949,6 +957,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { GenericArg::Lifetime(l) => self.hash_lifetime(l), GenericArg::Type(ref ty) => self.hash_ty(ty), GenericArg::Const(ref ca) => self.hash_body(ca.value.body), + GenericArg::Infer(ref _inf) => self.hash_infer(), } } }