1
Fork 0

Rework precise capturing syntax

This commit is contained in:
Michael Goulet 2024-06-05 16:18:52 -04:00
parent 68bd001c00
commit b1efe1ab5d
54 changed files with 406 additions and 350 deletions

View file

@ -1187,17 +1187,8 @@ impl<'a> State<'a> {
}
self.print_type_bounds(bounds);
}
ast::TyKind::ImplTrait(_, bounds, precise_capturing_args) => {
ast::TyKind::ImplTrait(_, bounds) => {
self.word_nbsp("impl");
if let Some((precise_capturing_args, ..)) = precise_capturing_args.as_deref() {
self.word("use");
self.word("<");
self.commasep(Inconsistent, precise_capturing_args, |s, arg| match arg {
ast::PreciseCapturingArg::Arg(p, _) => s.print_path(p, false, 0),
ast::PreciseCapturingArg::Lifetime(lt) => s.print_lifetime(*lt),
});
self.word(">")
}
self.print_type_bounds(bounds);
}
ast::TyKind::Array(ty, length) => {
@ -1800,6 +1791,15 @@ impl<'a> State<'a> {
self.print_poly_trait_ref(tref);
}
GenericBound::Outlives(lt) => self.print_lifetime(*lt),
GenericBound::Use(args, _) => {
self.word("use");
self.word("<");
self.commasep(Inconsistent, args, |s, arg| match arg {
ast::PreciseCapturingArg::Arg(p, _) => s.print_path(p, false, 0),
ast::PreciseCapturingArg::Lifetime(lt) => s.print_lifetime(*lt),
});
self.word(">")
}
}
}
}