Remove NO_ANN.

This makes `rustc_hir_pretty` more like `rustc_ast_pretty`.
This commit is contained in:
Nicholas Nethercote 2023-11-14 10:44:08 +11:00
parent ce363bb6e6
commit 33cee0b22c

View File

@ -49,8 +49,8 @@ fn post(&self, _state: &mut State<'_>, _node: AnnNode<'_>) {}
}
pub struct NoAnn;
impl PpAnn for NoAnn {}
pub const NO_ANN: &dyn PpAnn = &NoAnn;
impl PpAnn for &dyn rustc_hir::intravisit::Map<'_> {
fn nested(&self, state: &mut State<'_>, nested: Nested) {
@ -183,15 +183,15 @@ fn to_string<F>(ann: &dyn PpAnn, f: F) -> String
}
pub fn ty_to_string(ty: &hir::Ty<'_>) -> String {
to_string(NO_ANN, |s| s.print_type(ty))
to_string(&NoAnn, |s| s.print_type(ty))
}
pub fn qpath_to_string(segment: &hir::QPath<'_>) -> String {
to_string(NO_ANN, |s| s.print_qpath(segment, false))
to_string(&NoAnn, |s| s.print_qpath(segment, false))
}
pub fn pat_to_string(pat: &hir::Pat<'_>) -> String {
to_string(NO_ANN, |s| s.print_pat(pat))
to_string(&NoAnn, |s| s.print_pat(pat))
}
impl<'a> State<'a> {