Implement ToSource and ToToken for ast::Arg

This makes ast::Arg usable in the quote_ macros.

Please note that this commit doesn't include a regression test. There
are tests that use the quote macros, but all of them are ignored. Due to
that, there is no obvious (to me) way to test this.

Since this change is absolutely trivial and only hooks up an additional
type to existing infrastructure (which presumably is tested elsewhere),
I concluded it's not worth the effort to follow up on this.
This commit is contained in:
Hanno Braun
2014-06-07 13:46:41 +00:00
parent 8e9e484d70
commit cc28ae5201
2 changed files with 11 additions and 0 deletions

View File

@@ -242,6 +242,10 @@ pub fn variant_to_str(var: &ast::Variant) -> String {
to_str(|s| s.print_variant(var))
}
pub fn arg_to_str(arg: &ast::Arg) -> String {
to_str(|s| s.print_arg(arg))
}
pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> String {
match vis {
ast::Public => format!("pub {}", s).to_string(),