Make suggestions from @jackh726; run fmt

This commit is contained in:
PFPoitras 2021-12-14 09:26:57 -04:00
parent ae21dd00ac
commit a586e7d857
7 changed files with 20 additions and 17 deletions

View File

@ -1450,7 +1450,7 @@ fn check_method_receiver<'fcx, 'tcx>(
}
}
fn e0307<'fcx, 'tcx> (fcx: &FnCtxt<'fcx, 'tcx>, span: Span, receiver_ty: Ty<'_>) {
fn e0307<'tcx>(fcx: &FnCtxt<'_, 'tcx>, span: Span, receiver_ty: Ty<'_>) {
struct_span_err!(
fcx.tcx.sess.diagnostic(),
span,
@ -1696,8 +1696,8 @@ pub struct CheckTypeWellFormedVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl CheckTypeWellFormedVisitor<'_> {
pub fn new(tcx: TyCtxt<'_>) -> CheckTypeWellFormedVisitor<'_> {
impl<'tcx> CheckTypeWellFormedVisitor<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>) -> CheckTypeWellFormedVisitor<'tcx> {
CheckTypeWellFormedVisitor { tcx }
}
}

View File

@ -21,7 +21,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
unused_crates_lint(tcx);
}
impl <'v, 'tcx> ItemLikeVisitor<'v> for CheckVisitor<'tcx> {
impl<'tcx> ItemLikeVisitor<'_> for CheckVisitor<'tcx> {
fn visit_item(&mut self, item: &hir::Item<'_>) {
if item.vis.node.is_pub() || item.span.is_dummy() {
return;

View File

@ -108,7 +108,7 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
}
}
fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
fn visit_implementation_of_coerce_unsized<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) {
debug!("visit_implementation_of_coerce_unsized: impl_did={:?}", impl_did);
// Just compute this for the side-effects, in particular reporting
@ -118,7 +118,7 @@ fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'_>, impl_did: LocalDefId)
tcx.at(span).coerce_unsized_info(impl_did);
}
fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
fn visit_implementation_of_dispatch_from_dyn<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) {
debug!("visit_implementation_of_dispatch_from_dyn: impl_did={:?}", impl_did);
let impl_hir_id = tcx.hir().local_def_id_to_hir_id(impl_did);

View File

@ -38,7 +38,7 @@ struct InherentCollect<'tcx> {
impls_map: CrateInherentImpls,
}
impl<'v, 'tcx> ItemLikeVisitor<'v> for InherentCollect<'tcx> {
impl<'tcx> ItemLikeVisitor<'_> for InherentCollect<'tcx> {
fn visit_item(&mut self, item: &hir::Item<'_>) {
let (ty, assoc_items) = match item.kind {
hir::ItemKind::Impl(hir::Impl { of_trait: None, ref self_ty, items, .. }) => {

View File

@ -115,8 +115,8 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
}
}
impl<'v, 'tcx> ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> {
fn visit_item(&mut self, item: &'v hir::Item<'v>) {
impl<'tcx> ItemLikeVisitor<'_> for InherentOverlapChecker<'tcx> {
fn visit_item(&mut self, item: &hir::Item<'_>) {
match item.kind {
hir::ItemKind::Enum(..)
| hir::ItemKind::Struct(..)
@ -300,9 +300,9 @@ impl<'v, 'tcx> ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> {
}
}
fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem<'v>) {}
fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem<'_>) {}
fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem<'v>) {}
fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem<'_>) {}
fn visit_foreign_item(&mut self, _foreign_item: &hir::ForeignItem<'v>) {}
fn visit_foreign_item(&mut self, _foreign_item: &hir::ForeignItem<'_>) {}
}

View File

@ -17,9 +17,9 @@ struct UnsafetyChecker<'tcx> {
}
impl<'tcx> UnsafetyChecker<'tcx> {
fn check_unsafety_coherence<'v>(
fn check_unsafety_coherence(
&mut self,
item: &'v hir::Item<'v>,
item: &hir::Item<'_>,
impl_generics: Option<&hir::Generics<'_>>,
unsafety: hir::Unsafety,
polarity: hir::ImplPolarity,
@ -83,8 +83,8 @@ impl<'tcx> UnsafetyChecker<'tcx> {
}
}
impl<'v, 'tcx> ItemLikeVisitor<'v> for UnsafetyChecker<'tcx> {
fn visit_item(&mut self, item: &'v hir::Item<'v>) {
impl<'tcx> ItemLikeVisitor<'_> for UnsafetyChecker<'tcx> {
fn visit_item(&mut self, item: &hir::Item<'_>) {
if let hir::ItemKind::Impl(ref impl_) = item.kind {
self.check_unsafety_coherence(
item,

View File

@ -223,7 +223,10 @@ crate fn placeholder_type_error<'tcx>(
err.emit();
}
fn reject_placeholder_type_signatures_in_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) {
fn reject_placeholder_type_signatures_in_item<'tcx>(
tcx: TyCtxt<'tcx>,
item: &'tcx hir::Item<'tcx>,
) {
let (generics, suggest) = match &item.kind {
hir::ItemKind::Union(_, generics)
| hir::ItemKind::Enum(_, generics)