about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/items.rs6
-rw-r--r--src/visitor.rs5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/items.rs b/src/items.rs
index 6fb69d6b883..b57be8c1054 100644
--- a/src/items.rs
+++ b/src/items.rs
@@ -728,7 +728,9 @@ impl<'a> FmtVisitor<'a> {
                 (Const(..), Const(..)) | (MacCall(..), MacCall(..)) => {
                     a.ident.as_str().cmp(b.ident.as_str())
                 }
-                (Fn(..), Fn(..)) => a.span.lo().cmp(&b.span.lo()),
+                (Fn(..), Fn(..)) | (Delegation(..), Delegation(..)) => {
+                    a.span.lo().cmp(&b.span.lo())
+                }
                 (Type(ty), _) if is_type(&ty.ty) => Ordering::Less,
                 (_, Type(ty)) if is_type(&ty.ty) => Ordering::Greater,
                 (Type(..), _) => Ordering::Less,
@@ -737,6 +739,8 @@ impl<'a> FmtVisitor<'a> {
                 (_, Const(..)) => Ordering::Greater,
                 (MacCall(..), _) => Ordering::Less,
                 (_, MacCall(..)) => Ordering::Greater,
+                (Delegation(..), _) => Ordering::Less,
+                (_, Delegation(..)) => Ordering::Greater,
             });
             let mut prev_kind = None;
             for (buf, item) in buffer {
diff --git a/src/visitor.rs b/src/visitor.rs
index f4d84d1381f..bc5accefd92 100644
--- a/src/visitor.rs
+++ b/src/visitor.rs
@@ -592,6 +592,11 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
                     );
                     self.push_rewrite(item.span, rewrite);
                 }
+                ast::ItemKind::Delegation(..) => {
+                    // TODO: rewrite delegation items once syntax is established.
+                    // For now, leave the contents of the Span unformatted.
+                    self.push_rewrite(item.span, None)
+                }
             };
         }
         self.skip_context = skip_context_saved;