Skip to content

Commit 0bc70ca

Browse files
authored
Merge pull request #524 from dtolnay/display
Ignore formatting options for padding, alignment, width
2 parents 6417f8f + 48b68db commit 0bc70ca

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/fallback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ impl Display for Ident {
889889
if self.raw {
890890
f.write_str("r#")?;
891891
}
892-
Display::fmt(&self.sym, f)
892+
f.write_str(&self.sym)
893893
}
894894
}
895895

tests/test.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,17 @@ fn raw_identifier() {
705705
assert!(tts.next().is_none());
706706
}
707707

708+
#[test]
709+
fn test_display_ident() {
710+
let ident = Ident::new("proc_macro", Span::call_site());
711+
assert_eq!(format!("{ident}"), "proc_macro");
712+
assert_eq!(format!("{ident:-^14}"), "proc_macro");
713+
714+
let ident = Ident::new_raw("proc_macro", Span::call_site());
715+
assert_eq!(format!("{ident}"), "r#proc_macro");
716+
assert_eq!(format!("{ident:-^14}"), "r#proc_macro");
717+
}
718+
708719
#[test]
709720
fn test_debug_ident() {
710721
let ident = Ident::new("proc_macro", Span::call_site());

0 commit comments

Comments
 (0)