From 32ad4ae4cde68fed1b132be79bc9068b020d270b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 13 Nov 2012 19:08:01 -0800 Subject: librustc: Require the #[derivable] attribute, remove the significance of "impl Foo : Bar;", and allow only a subset of methods in a trait to be derived. r=brson --- src/libsyntax/print/pprust.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/libsyntax/print') diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 09cc9ad0232..267f0e7d5f2 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -520,7 +520,7 @@ fn print_item(s: ps, &&item: @ast::item) { print_struct(s, struct_def, tps, item.ident, item.span); } - ast::item_impl(tps, opt_trait, ty, methods_opt) => { + ast::item_impl(tps, opt_trait, ty, methods) => { head(s, visibility_qualified(item.vis, ~"impl")); if tps.is_not_empty() { print_type_params(s, tps); @@ -537,17 +537,14 @@ fn print_item(s: ps, &&item: @ast::item) { }; space(s.s); - match methods_opt { - None => { - word(s.s, ~";"); - } - Some(methods) => { - bopen(s); - for methods.each |meth| { - print_method(s, *meth); - } - bclose(s, item.span); + if methods.len() == 0 { + word(s.s, ~";"); + } else { + bopen(s); + for methods.each |meth| { + print_method(s, *meth); } + bclose(s, item.span); } } ast::item_trait(tps, traits, methods) => { -- cgit 1.4.1-3-g733a5