pretty error messages for integers

This commit is contained in:
Folkert 2020-07-07 22:10:23 +02:00
parent 308a24b080
commit 9d67b11c0d
10 changed files with 342 additions and 87 deletions

View file

@ -100,13 +100,12 @@ pub fn fmt_expr<'a>(
buf.push('-');
}
buf.push('0');
buf.push(match base {
Base::Hex => 'x',
Base::Octal => 'o',
Base::Binary => 'b',
});
match base {
Base::Hex => buf.push_str("0x"),
Base::Octal => buf.push_str("0o"),
Base::Binary => buf.push_str("0b"),
Base::Decimal => { /* nothing */ }
}
buf.push_str(string);
}