Skip to content

Commit

Permalink
fix internal lints
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed Jun 14, 2023
1 parent fcb9a38 commit 4795c91
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions clippy_lints/src/derivable_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ use clippy_utils::source::indent_of;
use clippy_utils::{is_default_equivalent, peel_blocks};
use rustc_errors::Applicability;
use rustc_hir::{
self as hir,
def::{CtorKind, CtorOf, DefKind, Res},
Body, Expr, ExprKind, GenericArg, Impl, ImplItemKind, Item, ItemKind, Node, PathSegment, QPath, Ty, TyKind,
Body, Expr, ExprKind, GenericArg, Impl, ImplItemKind, Item, ItemKind, Node, PathSegment, QPath, TyKind,
};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::adjustment::{Adjust, PointerCast};
use rustc_middle::ty::{self, Adt, AdtDef, SubstsRef, TypeckResults};
use rustc_middle::ty::{self, Adt, AdtDef, SubstsRef, Ty, TypeckResults};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::sym;

Expand Down Expand Up @@ -76,19 +77,19 @@ fn is_path_self(e: &Expr<'_>) -> bool {
}
}

fn contains_trait_object(ty: ty::Ty<'_>) -> bool {
fn contains_trait_object(ty: Ty<'_>) -> bool {
match ty.kind() {
ty::TyKind::Ref(_, ty, _) => contains_trait_object(*ty),
ty::TyKind::Adt(def, substs) => def.is_box() && substs[0].as_type().map_or(false, contains_trait_object),
ty::TyKind::Dynamic(..) => true,
ty::Ref(_, ty, _) => contains_trait_object(*ty),
ty::Adt(def, substs) => def.is_box() && substs[0].as_type().map_or(false, contains_trait_object),
ty::Dynamic(..) => true,
_ => false,
}
}

fn check_struct<'tcx>(
cx: &LateContext<'tcx>,
item: &'tcx Item<'_>,
self_ty: &Ty<'_>,
self_ty: &hir::Ty<'_>,
func_expr: &Expr<'_>,
adt_def: AdtDef<'_>,
substs: SubstsRef<'_>,
Expand Down

0 comments on commit 4795c91

Please sign in to comment.