Skip to content

Commit 3bc089e

Browse files
committed
refactor manual_is_ascii_check to remove unused parameter
1 parent 2a4dadd commit 3bc089e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

clippy_lints/src/manual_is_ascii_check.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)