Skip to content

Commit 1c32ddd

Browse files
committed
Push Idents into Tokens instead of String for future compatibility
Signed-off-by: Daniel Egger <daniel@eggers-club.de>
1 parent 17b6657 commit 1c32ddd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/util.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,21 @@ pub fn hex(n: u32) -> Tokens {
220220
let mut t = Tokens::new();
221221
let (h2, h1) = ((n >> 16) & 0xffff, n & 0xffff);
222222
t.append(if h2 != 0 {
223-
format!("0x{:04x}_{:04x}", h2, h1)
223+
Ident::from(format!("0x{:04x}_{:04x}", h2, h1))
224224
} else if h1 & 0xff00 != 0 {
225-
format!("0x{:04x}", h1)
225+
Ident::from(format!("0x{:04x}", h1))
226226
} else if h1 != 0 {
227-
format!("0x{:02x}", h1 & 0xff)
227+
Ident::from(format!("0x{:02x}", h1 & 0xff))
228228
} else {
229-
String::from("0")
229+
Ident::from("0")
230230
});
231231
t
232232
}
233233

234234
pub fn hex_or_bool(n: u32, width: u32) -> Tokens {
235235
if width == 1 {
236236
let mut t = Tokens::new();
237-
t.append(if n == 0 { "false" } else { "true" });
237+
t.append(Ident::from(if n == 0 { "false" } else { "true" }));
238238
t
239239
} else {
240240
hex(n)
@@ -244,14 +244,14 @@ pub fn hex_or_bool(n: u32, width: u32) -> Tokens {
244244
/// Turns `n` into an unsuffixed token
245245
pub fn unsuffixed(n: u64) -> Tokens {
246246
let mut t = Tokens::new();
247-
t.append(format!("{}", n));
247+
t.append(Ident::from(format!("{}", n)));
248248
t
249249
}
250250

251251
pub fn unsuffixed_or_bool(n: u64, width: u32) -> Tokens {
252252
if width == 1 {
253253
let mut t = Tokens::new();
254-
t.append(if n == 0 { "false" } else { "true" });
254+
t.append(Ident::from(if n == 0 { "false" } else { "true" }));
255255
t
256256
} else {
257257
unsuffixed(n)

0 commit comments

Comments
 (0)