Skip to content

Commit

Permalink
Use path_res instead of lowering hir::Ty to ty::Ty
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Oct 11, 2024
1 parent dfcd47f commit a2f50c1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clippy_lints/src/unnecessary_literal_bound.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::path_res;
use rustc_ast::ast::LitKind;
use rustc_errors::Applicability;
use rustc_hir::def::Res;
use rustc_hir::intravisit::{FnKind, Visitor};
use rustc_hir::{Body, Expr, ExprKind, FnDecl, FnRetTy, Lit, MutTy, Mutability, Ty, TyKind, intravisit};
use rustc_hir::{Body, Expr, ExprKind, FnDecl, FnRetTy, Lit, MutTy, Mutability, PrimTy, Ty, TyKind, intravisit};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::declare_lint_pass;
use rustc_span::Span;
Expand Down Expand Up @@ -140,7 +142,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryLiteralBound {
return;
};

if !rustc_hir_analysis::lower_ty(cx.tcx, inner_hir_ty).is_str() {
if path_res(cx, inner_hir_ty) != Res::PrimTy(PrimTy::Str) {
return;
}

Expand Down

0 comments on commit a2f50c1

Please sign in to comment.