@@ -114,7 +114,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualIsAsciiCheck {
114114 && !matches ! ( cx. typeck_results( ) . expr_ty( arg) . peel_refs( ) . kind( ) , ty:: Param ( _) )
115115 {
116116 let arg = peel_ref_operators ( cx, arg) ;
117- let ty_sugg = get_ty_sugg ( cx, arg, start ) ;
117+ let ty_sugg = get_ty_sugg ( cx, arg) ;
118118 let range = check_range ( start, end) ;
119119 check_is_ascii ( cx, expr. span , arg, & range, ty_sugg) ;
120120 }
@@ -123,10 +123,9 @@ impl<'tcx> LateLintPass<'tcx> for ManualIsAsciiCheck {
123123 extract_msrv_attr ! ( LateContext ) ;
124124}
125125
126- fn get_ty_sugg ( cx : & LateContext < ' _ > , arg : & Expr < ' _ > , bound_expr : & Expr < ' _ > ) -> Option < ( Span , String ) > {
127- if let ExprKind :: Lit ( _) = bound_expr. kind
128- && let local_hid = path_to_local ( arg) ?
129- && let Node :: Param ( Param { ty_span, span, .. } ) = cx. tcx . parent_hir_node ( local_hid)
126+ fn get_ty_sugg ( cx : & LateContext < ' _ > , arg : & Expr < ' _ > ) -> Option < ( Span , String ) > {
127+ let local_hid = path_to_local ( arg) ?;
128+ if let Node :: Param ( Param { ty_span, span, .. } ) = cx. tcx . parent_hir_node ( local_hid)
130129 // `ty_span` and `span` are the same for inferred type, thus a type suggestion must be given
131130 && ty_span == span
132131 {
0 commit comments