aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-04-17 17:24:17 -0400
committerBrian Anderson <[email protected]>2011-04-17 17:24:17 -0400
commit1bec738c56c221843adbb022914c1de6e3bd7c61 (patch)
tree2b5d86bb58bc138d1c1c10248a2a8b94f26a8a94 /src/lib
parentFix indentation in syntax-extension-fmt.rs (diff)
downloadrust-1bec738c56c221843adbb022914c1de6e3bd7c61.tar.xz
rust-1bec738c56c221843adbb022914c1de6e3bd7c61.zip
Support #fmt precision for bools, with same rules as strings
Not totally confident this is desirable. The alternative would be to make it a compile error.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ExtFmt.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/ExtFmt.rs b/src/lib/ExtFmt.rs
index bbcb14bd..4be03858 100644
--- a/src/lib/ExtFmt.rs
+++ b/src/lib/ExtFmt.rs
@@ -358,11 +358,15 @@ mod RT {
}
fn conv_bool(&conv cv, bool b) -> str {
+ auto s;
if (b) {
- ret pad(cv, "true");
+ s = "true";
} else {
- ret pad(cv, "false");
+ s = "false";
}
+ // Run the boolean conversion through the string conversion logic,
+ // giving it the same rules for precision, etc.
+ ret conv_str(cv, s);
}
fn conv_char(&conv cv, char c) -> str {