From 7b7cf440cb5bc8733de38aeca8d42f3747bd45e1 Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Sun, 18 Aug 2024 17:50:29 +0500 Subject: string_slice should detect on Cow --- clippy_lints/src/strings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clippy_lints/src') diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index cfc387886dc..6ca4ca000e9 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -190,7 +190,7 @@ impl<'tcx> LateLintPass<'tcx> for StringAdd { } }, ExprKind::Index(target, _idx, _) => { - let e_ty = cx.typeck_results().expr_ty(target).peel_refs(); + let e_ty = cx.typeck_results().expr_ty_adjusted(target).peel_refs(); if e_ty.is_str() || is_type_lang_item(cx, e_ty, LangItem::String) { span_lint( cx, -- cgit 1.4.1-3-g733a5