about summary refs log tree commit diff
path: root/src/libcore/fmt
diff options
context:
space:
mode:
authorfort <e@mail.com>2014-06-09 23:09:53 -0700
committerfort <e@mail.com>2014-06-10 19:24:48 -0700
commita8f581fad1e08ae566b10279c5ee60cb77b3672d (patch)
treefa2d079713bb6d3937ee490efc4d0fce5af90ee7 /src/libcore/fmt
parent907d96187641d8a018af2b73239723c66b011f71 (diff)
Show impl for Ref & RefMut
Diffstat (limited to 'src/libcore/fmt')
-rw-r--r--src/libcore/fmt/mod.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 37ef325d937..e70fd837861 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -13,13 +13,14 @@
 #![allow(unused_variable)]
 
 use any;
-use cell::Cell;
+use cell::{Cell, Ref, RefMut};
 use char::Char;
 use collections::Collection;
 use iter::{Iterator, range};
 use kinds::Copy;
 use mem;
 use option::{Option, Some, None};
+use ops::Deref;
 use result::{Ok, Err};
 use result;
 use slice::{Vector, ImmutableVector};
@@ -849,5 +850,17 @@ impl<T: Copy + Show> Show for Cell<T> {
     }
 }
 
+impl<'b, T: Show> Show for Ref<'b, T> {
+    fn fmt(&self, f: &mut Formatter) -> Result {
+        (**self).fmt(f)
+    }
+}
+
+impl<'b, T: Show> Show for RefMut<'b, T> {
+    fn fmt(&self, f: &mut Formatter) -> Result {
+        (*(self.deref())).fmt(f)
+    }
+}
+
 // If you expected tests to be here, look instead at the run-pass/ifmt.rs test,
 // it's a lot easier than creating all of the rt::Piece structures here.