diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-11-13 19:08:01 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-11-14 11:36:55 -0800 |
| commit | 32ad4ae4cde68fed1b132be79bc9068b020d270b (patch) | |
| tree | 174cee72ef970f110f1cf22a190641b0c834f264 /src/libsyntax/print | |
| parent | 3e14ada4f6782f1379abe498b2b2d9681f489e26 (diff) | |
| download | rust-32ad4ae4cde68fed1b132be79bc9068b020d270b.tar.gz rust-32ad4ae4cde68fed1b132be79bc9068b020d270b.zip | |
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
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 19 |
1 files changed, 8 insertions, 11 deletions
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) => { |
