1
Fork 0

Remove implicit Continue type

This commit is contained in:
LeSeulArtichaut 2020-10-25 11:50:56 +01:00
parent 24e1a7e656
commit 9433eb83fe
30 changed files with 129 additions and 135 deletions

View file

@ -56,7 +56,7 @@ trait DefIdVisitor<'tcx> {
def_id: DefId,
kind: &str,
descr: &dyn fmt::Display,
) -> ControlFlow<(), ()>;
) -> ControlFlow<()>;
/// Not overridden, but used to actually visit types and traits.
fn skeleton(&mut self) -> DefIdVisitorSkeleton<'_, 'tcx, Self> {
@ -66,13 +66,13 @@ trait DefIdVisitor<'tcx> {
dummy: Default::default(),
}
}
fn visit(&mut self, ty_fragment: impl TypeFoldable<'tcx>) -> ControlFlow<(), ()> {
fn visit(&mut self, ty_fragment: impl TypeFoldable<'tcx>) -> ControlFlow<()> {
ty_fragment.visit_with(&mut self.skeleton())
}
fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> ControlFlow<(), ()> {
fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> ControlFlow<()> {
self.skeleton().visit_trait(trait_ref)
}
fn visit_predicates(&mut self, predicates: ty::GenericPredicates<'tcx>) -> ControlFlow<(), ()> {
fn visit_predicates(&mut self, predicates: ty::GenericPredicates<'tcx>) -> ControlFlow<()> {
self.skeleton().visit_predicates(predicates)
}
}
@ -87,13 +87,13 @@ impl<'tcx, V> DefIdVisitorSkeleton<'_, 'tcx, V>
where
V: DefIdVisitor<'tcx> + ?Sized,
{
fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> ControlFlow<(), ()> {
fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> ControlFlow<()> {
let TraitRef { def_id, substs } = trait_ref;
self.def_id_visitor.visit_def_id(def_id, "trait", &trait_ref.print_only_trait_path())?;
if self.def_id_visitor.shallow() { ControlFlow::CONTINUE } else { substs.visit_with(self) }
}
fn visit_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> ControlFlow<(), ()> {
fn visit_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> ControlFlow<()> {
match predicate.skip_binders() {
ty::PredicateAtom::Trait(ty::TraitPredicate { trait_ref }, _) => {
self.visit_trait(trait_ref)
@ -119,7 +119,7 @@ where
}
}
fn visit_predicates(&mut self, predicates: ty::GenericPredicates<'tcx>) -> ControlFlow<(), ()> {
fn visit_predicates(&mut self, predicates: ty::GenericPredicates<'tcx>) -> ControlFlow<()> {
let ty::GenericPredicates { parent: _, predicates } = predicates;
predicates.iter().try_for_each(|&(predicate, _span)| self.visit_predicate(predicate))
}
@ -129,7 +129,7 @@ impl<'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'tcx, V>
where
V: DefIdVisitor<'tcx> + ?Sized,
{
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<(), ()> {
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<()> {
let tcx = self.def_id_visitor.tcx();
// InternalSubsts are not visited here because they are visited below in `super_visit_with`.
match *ty.kind() {
@ -283,7 +283,7 @@ impl<'a, 'tcx, VL: VisibilityLike> DefIdVisitor<'tcx> for FindMin<'a, 'tcx, VL>
def_id: DefId,
_kind: &str,
_descr: &dyn fmt::Display,
) -> ControlFlow<(), ()> {
) -> ControlFlow<()> {
self.min = VL::new_min(self, def_id);
ControlFlow::CONTINUE
}
@ -902,7 +902,7 @@ impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> {
def_id: DefId,
_kind: &str,
_descr: &dyn fmt::Display,
) -> ControlFlow<(), ()> {
) -> ControlFlow<()> {
if let Some(def_id) = def_id.as_local() {
if let (ty::Visibility::Public, _) | (_, Some(AccessLevel::ReachableFromImplTrait)) =
(self.tcx().visibility(def_id.to_def_id()), self.access_level)
@ -1079,7 +1079,7 @@ impl<'tcx> TypePrivacyVisitor<'tcx> {
fn check_expr_pat_type(&mut self, id: hir::HirId, span: Span) -> bool {
self.span = span;
let typeck_results = self.typeck_results();
let result: ControlFlow<(), ()> = try {
let result: ControlFlow<()> = try {
self.visit(typeck_results.node_type(id))?;
self.visit(typeck_results.node_substs(id))?;
if let Some(adjustments) = typeck_results.adjustments().get(id) {
@ -1297,7 +1297,7 @@ impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'tcx> {
def_id: DefId,
kind: &str,
descr: &dyn fmt::Display,
) -> ControlFlow<(), ()> {
) -> ControlFlow<()> {
if self.check_def_id(def_id, kind, descr) {
ControlFlow::BREAK
} else {
@ -1797,7 +1797,7 @@ impl DefIdVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'tcx> {
def_id: DefId,
kind: &str,
descr: &dyn fmt::Display,
) -> ControlFlow<(), ()> {
) -> ControlFlow<()> {
if self.check_def_id(def_id, kind, descr) {
ControlFlow::BREAK
} else {