Skip to content

Commit 0901b9f

Browse files
committed
Convert TypeVisitor and DefIdVisitor to use VisitorResult
1 parent ae710de commit 0901b9f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

clippy_lints/src/methods/useless_asref.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ fn get_enum_ty(enum_ty: Ty<'_>) -> Option<Ty<'_>> {
2222
}
2323

2424
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ContainsTyVisitor {
25-
type BreakTy = Ty<'tcx>;
25+
type Result = ControlFlow<Ty<'tcx>>;
2626

27-
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
27+
fn visit_ty(&mut self, t: Ty<'tcx>) -> Self::Result {
2828
self.level += 1;
2929
if self.level == 1 {
3030
t.super_visit_with(self)

clippy_utils/src/mir/possible_borrower.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ impl<'a, 'b, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'b,
141141
struct ContainsRegion;
142142

143143
impl TypeVisitor<TyCtxt<'_>> for ContainsRegion {
144-
type BreakTy = ();
144+
type Result = ControlFlow<()>;
145145

146-
fn visit_region(&mut self, _: ty::Region<'_>) -> ControlFlow<Self::BreakTy> {
146+
fn visit_region(&mut self, _: ty::Region<'_>) -> Self::Result {
147147
ControlFlow::Break(())
148148
}
149149
}

clippy_utils/src/ty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,8 @@ pub fn for_each_top_level_late_bound_region<B>(
916916
f: F,
917917
}
918918
impl<'tcx, B, F: FnMut(BoundRegion) -> ControlFlow<B>> TypeVisitor<TyCtxt<'tcx>> for V<F> {
919-
type BreakTy = B;
920-
fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> {
919+
type Result = ControlFlow<B>;
920+
fn visit_region(&mut self, r: Region<'tcx>) -> Self::Result {
921921
if let RegionKind::ReBound(idx, bound) = r.kind()
922922
&& idx.as_u32() == self.index
923923
{
@@ -926,7 +926,7 @@ pub fn for_each_top_level_late_bound_region<B>(
926926
ControlFlow::Continue(())
927927
}
928928
}
929-
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(&mut self, t: &Binder<'tcx, T>) -> ControlFlow<Self::BreakTy> {
929+
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(&mut self, t: &Binder<'tcx, T>) -> Self::Result {
930930
self.index += 1;
931931
let res = t.super_visit_with(self);
932932
self.index -= 1;

0 commit comments

Comments
 (0)