self.head(visibility_qualified(&item.vis, "union"));
self.print_struct(struct_def, generics, item.ident, item.span, true);
}
- ast::ItemKind::Impl(
+ ast::ItemKind::Impl {
unsafety,
polarity,
defaultness,
+ constness,
ref generics,
- ref opt_trait,
- ref ty,
- ref impl_items,
- ) => {
+ ref of_trait,
+ ref self_ty,
+ ref items,
+ } => {
self.head("");
self.print_visibility(&item.vis);
self.print_defaultness(defaultness);
self.print_unsafety(unsafety);
self.word_nbsp("impl");
+ self.print_constness(constness);
if !generics.params.is_empty() {
self.print_generic_params(&generics.params);
self.s.word("!");
}
- if let Some(ref t) = *opt_trait {
+ if let Some(ref t) = *of_trait {
self.print_trait_ref(t);
self.s.space();
self.word_space("for");
}
- self.print_type(ty);
+ self.print_type(self_ty);
self.print_where_clause(&generics.where_clause);
self.s.space();
self.bopen();
self.print_inner_attributes(&item.attrs);
- for impl_item in impl_items {
+ for impl_item in items {
self.print_assoc_item(impl_item);
}
self.bclose(item.span);
self.print_expr_as_cond(i);
self.s.space();
self.print_block(then);
- self.print_else(e.as_ref().map(|e| &**e))
+ self.print_else(e.as_deref())
}
// Final `else` block.
ast::ExprKind::Block(ref b, _) => {
self.print_let(pat, scrutinee);
}
ast::ExprKind::If(ref test, ref blk, ref elseopt) => {
- self.print_if(test, blk, elseopt.as_ref().map(|e| &**e));
+ self.print_if(test, blk, elseopt.as_deref())
}
ast::ExprKind::While(ref test, ref blk, opt_label) => {
if let Some(label) = opt_label {
}
}
+ crate fn print_constness(&mut self, s: ast::Constness) {
+ match s {
+ ast::Constness::Const => self.word_nbsp("const"),
+ ast::Constness::NotConst => {}
+ }
+ }
+
crate fn print_is_auto(&mut self, s: ast::IsAuto) {
match s {
ast::IsAuto::Yes => self.word_nbsp("auto"),