|
1 | 1 | use clippy_utils::diagnostics::span_lint_and_sugg; |
2 | 2 | use clippy_utils::source::snippet_with_context; |
3 | | -use clippy_utils::ty::is_type_diagnostic_item; |
| 3 | +use clippy_utils::ty::{is_type_diagnostic_item, is_type_lang_item}; |
4 | 4 | use clippy_utils::visitors::is_expr_unsafe; |
5 | 5 | use clippy_utils::{get_parent_node, match_libc_symbol}; |
6 | 6 | use if_chain::if_chain; |
7 | 7 | use rustc_errors::Applicability; |
8 | | -use rustc_hir::{Block, BlockCheckMode, Expr, ExprKind, Node, UnsafeSource}; |
| 8 | +use rustc_hir::{Block, BlockCheckMode, Expr, ExprKind, LangItem, Node, UnsafeSource}; |
9 | 9 | use rustc_lint::{LateContext, LateLintPass}; |
10 | 10 | use rustc_session::{declare_lint_pass, declare_tool_lint}; |
11 | 11 | use rustc_span::symbol::sym; |
@@ -67,7 +67,7 @@ impl<'tcx> LateLintPass<'tcx> for StrlenOnCStrings { |
67 | 67 | let val_name = snippet_with_context(cx, self_arg.span, ctxt, "..", &mut app).0; |
68 | 68 | let method_name = if is_type_diagnostic_item(cx, ty, sym::cstring_type) { |
69 | 69 | "as_bytes" |
70 | | - } else if is_type_diagnostic_item(cx, ty, sym::CStr) { |
| 70 | + } else if is_type_lang_item(cx, ty, LangItem::CStr) { |
71 | 71 | "to_bytes" |
72 | 72 | } else { |
73 | 73 | return; |
|
0 commit comments