Format defualtness on specialized impl const

This commit is contained in:
topecongiro 2017-11-30 19:38:05 +09:00
parent 9f67ad8212
commit 3b36371b78

View File

@ -1490,6 +1490,7 @@ pub struct StaticParts<'a> {
ty: &'a ast::Ty,
mutability: ast::Mutability,
expr_opt: Option<&'a ptr::P<ast::Expr>>,
defaultness: Option<ast::Defaultness>,
span: Span,
}
@ -1509,6 +1510,7 @@ impl<'a> StaticParts<'a> {
ty: ty,
mutability: mutability,
expr_opt: Some(expr),
defaultness: None,
span: item.span,
}
}
@ -1525,6 +1527,7 @@ impl<'a> StaticParts<'a> {
ty: ty,
mutability: ast::Mutability::Immutable,
expr_opt: expr_opt.as_ref(),
defaultness: None,
span: ti.span,
}
}
@ -1541,6 +1544,7 @@ impl<'a> StaticParts<'a> {
ty: ty,
mutability: ast::Mutability::Immutable,
expr_opt: Some(expr),
defaultness: Some(ii.defaultness),
span: ii.span,
}
}
@ -1556,8 +1560,9 @@ fn rewrite_static(
context.config.space_after_colon(),
);
let prefix = format!(
"{}{} {}{}{}",
"{}{}{} {}{}{}",
format_visibility(static_parts.vis),
static_parts.defaultness.map_or("", format_defaultness),
static_parts.prefix,
format_mutability(static_parts.mutability),
static_parts.ident,