about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRicho Healey <richo@psych0tik.net>2015-04-09 18:06:01 -0700
committerRicho Healey <richo@psych0tik.net>2015-04-09 18:06:01 -0700
commit64da4e171d7fa5715b76becde4e8fd40712eaf9f (patch)
tree4995c5742fb53bdd9eaec27c0a2f0ac07cae0341 /src
parentd8bb08037f9ea7295feb5740a16a6dc1dd810f33 (diff)
downloadrust-64da4e171d7fa5715b76becde4e8fd40712eaf9f.tar.gz
rust-64da4e171d7fa5715b76becde4e8fd40712eaf9f.zip
fmt: Assume that we'll only ever see 32 or 64 bit pointers
Diffstat (limited to 'src')
-rw-r--r--src/libcore/fmt/mod.rs3
-rw-r--r--src/test/run-pass/fmt-pointer-trait.rs3
-rw-r--r--src/test/run-pass/ifmt.rs3
3 files changed, 3 insertions, 6 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 2a7569e3b73..67781b73ae2 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -861,8 +861,7 @@ impl<T> Pointer for *const T {
                 // The formats need two extra bytes, for the 0x
                 if cfg!(target_pointer_width = "32") {
                     f.width = Some(10);
-                }
-                if cfg!(target_pointer_width = "64") {
+                } else {
                     f.width = Some(18);
                 }
             }
diff --git a/src/test/run-pass/fmt-pointer-trait.rs b/src/test/run-pass/fmt-pointer-trait.rs
index 0f4b0bfcec9..96f31891f2f 100644
--- a/src/test/run-pass/fmt-pointer-trait.rs
+++ b/src/test/run-pass/fmt-pointer-trait.rs
@@ -26,8 +26,7 @@ fn main() {
     if cfg!(target_pointer_width = "32") {
         assert_eq!(format!("{:#p}", p),
                    "0x00000000");
-    }
-    if cfg!(target_pointer_width = "64") {
+    } else {
         assert_eq!(format!("{:#p}", p),
                    "0x0000000000000000");
     }
diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs
index 8658099ec38..3a7af097644 100644
--- a/src/test/run-pass/ifmt.rs
+++ b/src/test/run-pass/ifmt.rs
@@ -75,8 +75,7 @@ pub fn main() {
     if cfg!(target_pointer_width = "32") {
         t!(format!("{:#p}", 0x1234 as *const isize), "0x00001234");
         t!(format!("{:#p}", 0x1234 as *mut isize), "0x00001234");
-    }
-    if cfg!(target_pointer_width = "64") {
+    } else {
         t!(format!("{:#p}", 0x1234 as *const isize), "0x0000000000001234");
         t!(format!("{:#p}", 0x1234 as *mut isize), "0x0000000000001234");
     }