Skip to content

Commit

Permalink
chore: replace lower_ty() with typeck_results.node_type()
Browse files Browse the repository at this point in the history
  • Loading branch information
BD103 committed Oct 7, 2024
1 parent 5be367e commit b26f14c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion bevy_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern crate rustc_driver;
extern crate rustc_errors;
extern crate rustc_hir;
extern crate rustc_hir_analysis;
extern crate rustc_interface;
extern crate rustc_lint;
extern crate rustc_middle;
Expand Down
5 changes: 1 addition & 4 deletions bevy_lint/src/lints/insert_event_resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ use clippy_utils::{
};
use rustc_errors::Applicability;
use rustc_hir::{Expr, ExprKind, GenericArg, GenericArgs, Path, PathSegment, QPath};
use rustc_hir_analysis::lower_ty;
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::{Ty, TyKind};
use rustc_session::declare_lint_pass;
Expand Down Expand Up @@ -153,9 +152,7 @@ fn check_init_resource<'tcx>(cx: &LateContext<'tcx>, path: &PathSegment<'tcx>, m
{
// Lower `rustc_hir::Ty` to `ty::Ty`, so we can inspect type information. For more
// information, see <https://rustc-dev-guide.rust-lang.org/ty.html#rustc_hirty-vs-tyty>.
// Note that `lower_ty()` is quasi-deprecated, and should be removed if a adequate
// replacement is found.
let resource_ty = lower_ty(cx.tcx, resource_hir_ty);
let resource_ty = cx.typeck_results().node_type(resource_hir_ty.hir_id);

// If the resource type is `Events<T>`, emit the lint.
if match_type(cx, resource_ty, &crate::paths::EVENTS) {
Expand Down

0 comments on commit b26f14c

Please sign in to comment.