From 7321373d6b198d7e00a3d82be42c52338b3ff01d Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 28 Oct 2014 11:02:53 -0700 Subject: [PATCH] util: Add a `Show` implementation to `SmallVec` --- components/util/smallvec.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/util/smallvec.rs b/components/util/smallvec.rs index f0767c3ec5a..b1fbffb2075 100644 --- a/components/util/smallvec.rs +++ b/components/util/smallvec.rs @@ -7,6 +7,7 @@ use std::mem::init as i; use std::cmp; +use std::fmt; use std::intrinsics; use std::kinds::marker::ContravariantLifetime; use std::mem; @@ -435,6 +436,12 @@ macro_rules! def_small_vector( } } + impl fmt::Show for $name { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.as_slice()) + } + } + impl $name { #[inline] pub fn new() -> $name {