chiark
/
gitweb
/
~ian
/
nimber.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dc5dbec
)
Handle the 'alternate' formatting flag.
author
Simon Tatham
<anakin@pobox.com>
Sat, 12 Apr 2025 12:19:05 +0000
(13:19 +0100)
committer
Simon Tatham
<anakin@pobox.com>
Sat, 12 Apr 2025 12:19:05 +0000
(13:19 +0100)
Suppresses the optimisation of omitting the 0x on single-decimal-digit
nimbers.
src/finitenimber.rs
patch
|
blob
|
history
diff --git
a/src/finitenimber.rs
b/src/finitenimber.rs
index b7ea0bb62916195be5cdb536fd9e13c4f7c261f7..469cd061c95751a6851ffc6a9d06aed856d776af 100644
(file)
--- a/
src/finitenimber.rs
+++ b/
src/finitenimber.rs
@@
-49,7
+49,10
@@
impl Debug for FiniteNimberRef<'_> {
impl Display for FiniteNimber {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), core::fmt::Error> {
- if self.to_ref().level() < WORDLEVELS && self.0[0] < 10 {
+ if !f.alternate()
+ && self.to_ref().level() < WORDLEVELS
+ && self.0[0] < 10
+ {
write!(f, "*{}", self.0[0])
} else {
write!(f, "*0x")?;