Fix spacing of pretty printed const item without body
This commit is contained in:
parent
2b67c30bfe
commit
b7df49895c
@ -1116,9 +1116,9 @@ fn print_item_const(
|
||||
self.print_ident(ident);
|
||||
self.word_space(":");
|
||||
self.print_type(ty);
|
||||
self.space();
|
||||
self.end(); // end the head-ibox
|
||||
if let Some(body) = body {
|
||||
self.space();
|
||||
self.word_space("=");
|
||||
self.print_expr(body);
|
||||
}
|
||||
|
@ -7,7 +7,8 @@ struct C {
|
||||
}
|
||||
|
||||
#[allow()]
|
||||
const C: C =
|
||||
const C: C
|
||||
=
|
||||
C{
|
||||
#[cfg(debug_assertions)]
|
||||
field: 0,
|
||||
|
@ -6,42 +6,42 @@ fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
extern "C" {
|
||||
static X: u8 ;
|
||||
static X: u8;
|
||||
type X;
|
||||
fn foo();
|
||||
pub static X: u8 ;
|
||||
pub static X: u8;
|
||||
pub type X;
|
||||
pub fn foo();
|
||||
}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
trait T {
|
||||
const X: u8 ;
|
||||
const X: u8;
|
||||
type X;
|
||||
fn foo();
|
||||
default const X: u8 ;
|
||||
default const X: u8;
|
||||
default type X;
|
||||
default fn foo();
|
||||
pub const X: u8 ;
|
||||
pub const X: u8;
|
||||
pub type X;
|
||||
pub fn foo();
|
||||
pub default const X: u8 ;
|
||||
pub default const X: u8;
|
||||
pub default type X;
|
||||
pub default fn foo();
|
||||
}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
impl T for S {
|
||||
const X: u8 ;
|
||||
const X: u8;
|
||||
type X;
|
||||
fn foo();
|
||||
default const X: u8 ;
|
||||
default const X: u8;
|
||||
default type X;
|
||||
default fn foo();
|
||||
pub const X: u8 ;
|
||||
pub const X: u8;
|
||||
pub type X;
|
||||
pub fn foo();
|
||||
pub default const X: u8 ;
|
||||
pub default const X: u8;
|
||||
pub default type X;
|
||||
pub default fn foo();
|
||||
}
|
||||
|
@ -382,13 +382,13 @@ fn test_item() {
|
||||
stringify_item!(
|
||||
static S: ();
|
||||
),
|
||||
"static S: () ;", // FIXME
|
||||
"static S: ();",
|
||||
);
|
||||
assert_eq!(
|
||||
stringify_item!(
|
||||
static mut S: ();
|
||||
),
|
||||
"static mut S: () ;",
|
||||
"static mut S: ();",
|
||||
);
|
||||
|
||||
// ItemKind::Const
|
||||
@ -402,7 +402,7 @@ fn test_item() {
|
||||
stringify_item!(
|
||||
const S: ();
|
||||
),
|
||||
"const S: () ;", // FIXME
|
||||
"const S: ();",
|
||||
);
|
||||
|
||||
// ItemKind::Fn
|
||||
|
@ -43,7 +43,8 @@ fn main() {
|
||||
crate::TokenStream::from(crate::TokenTree::Punct(crate::Punct::new('\u{3b}',
|
||||
crate::Spacing::Alone)))].iter().cloned().collect::<crate::TokenStream>()
|
||||
}
|
||||
const _: () =
|
||||
const _: ()
|
||||
=
|
||||
{
|
||||
extern crate proc_macro;
|
||||
#[rustc_proc_macro_decls]
|
||||
|
Loading…
Reference in New Issue
Block a user