Delegation implementation: step 1
This commit is contained in:
parent
381ef817b7
commit
6078b96b23
@ -728,7 +728,9 @@ fn visit_impl_items(&mut self, items: &[ptr::P<ast::AssocItem>]) {
|
|||||||
(Const(..), Const(..)) | (MacCall(..), MacCall(..)) => {
|
(Const(..), Const(..)) | (MacCall(..), MacCall(..)) => {
|
||||||
a.ident.as_str().cmp(b.ident.as_str())
|
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::Less,
|
||||||
(_, Type(ty)) if is_type(&ty.ty) => Ordering::Greater,
|
(_, Type(ty)) if is_type(&ty.ty) => Ordering::Greater,
|
||||||
(Type(..), _) => Ordering::Less,
|
(Type(..), _) => Ordering::Less,
|
||||||
@ -737,6 +739,8 @@ fn visit_impl_items(&mut self, items: &[ptr::P<ast::AssocItem>]) {
|
|||||||
(_, Const(..)) => Ordering::Greater,
|
(_, Const(..)) => Ordering::Greater,
|
||||||
(MacCall(..), _) => Ordering::Less,
|
(MacCall(..), _) => Ordering::Less,
|
||||||
(_, MacCall(..)) => Ordering::Greater,
|
(_, MacCall(..)) => Ordering::Greater,
|
||||||
|
(Delegation(..), _) => Ordering::Less,
|
||||||
|
(_, Delegation(..)) => Ordering::Greater,
|
||||||
});
|
});
|
||||||
let mut prev_kind = None;
|
let mut prev_kind = None;
|
||||||
for (buf, item) in buffer {
|
for (buf, item) in buffer {
|
||||||
|
@ -592,6 +592,11 @@ pub(crate) fn visit_item(&mut self, item: &ast::Item) {
|
|||||||
);
|
);
|
||||||
self.push_rewrite(item.span, rewrite);
|
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;
|
self.skip_context = skip_context_saved;
|
||||||
|
Loading…
Reference in New Issue
Block a user