diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2023-03-06 14:09:28 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2023-05-02 10:32:07 +0000 |
| commit | f7595e0745d05261fa2b025a4f6b3ee7e7cc4796 (patch) | |
| tree | 6f082e0fd71aa4994505dfa97b3a7db7bb5ad2c9 | |
| parent | 37127b8d7018ecc4af69ebdee06adeff9527f757 (diff) | |
| download | rust-f7595e0745d05261fa2b025a4f6b3ee7e7cc4796.tar.gz rust-f7595e0745d05261fa2b025a4f6b3ee7e7cc4796.zip | |
rm diag item, use lang item
| -rw-r--r-- | clippy_lints/src/strlen_on_c_strings.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/strlen_on_c_strings.rs b/clippy_lints/src/strlen_on_c_strings.rs index 03324c66e8e..2f2e84fa35a 100644 --- a/clippy_lints/src/strlen_on_c_strings.rs +++ b/clippy_lints/src/strlen_on_c_strings.rs @@ -1,11 +1,11 @@ use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::source::snippet_with_context; -use clippy_utils::ty::is_type_diagnostic_item; +use clippy_utils::ty::{is_type_diagnostic_item, is_type_lang_item}; use clippy_utils::visitors::is_expr_unsafe; use clippy_utils::{get_parent_node, match_libc_symbol}; use if_chain::if_chain; use rustc_errors::Applicability; -use rustc_hir::{Block, BlockCheckMode, Expr, ExprKind, Node, UnsafeSource}; +use rustc_hir::{Block, BlockCheckMode, Expr, ExprKind, LangItem, Node, UnsafeSource}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::symbol::sym; @@ -67,7 +67,7 @@ impl<'tcx> LateLintPass<'tcx> for StrlenOnCStrings { let val_name = snippet_with_context(cx, self_arg.span, ctxt, "..", &mut app).0; let method_name = if is_type_diagnostic_item(cx, ty, sym::cstring_type) { "as_bytes" - } else if is_type_diagnostic_item(cx, ty, sym::CStr) { + } else if is_type_lang_item(cx, ty, LangItem::CStr) { "to_bytes" } else { return; |
