From 3b8e1f309e16b63069ede2e7bf0dfb8d7dbae959 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Sun, 12 Jun 2016 01:49:58 +0000 Subject: Implement `Into>` for `SmallVector` --- src/libsyntax/util/small_vector.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs index 8b07b21c578..9548805c1f8 100644 --- a/src/libsyntax/util/small_vector.rs +++ b/src/libsyntax/util/small_vector.rs @@ -29,6 +29,16 @@ enum SmallVectorRepr { Many(Vec), } +impl Into> for SmallVector { + fn into(self) -> Vec { + match self.repr { + Zero => Vec::new(), + One(t) => vec![t], + Many(vec) => vec, + } + } +} + impl FromIterator for SmallVector { fn from_iter>(iter: I) -> SmallVector { let mut v = SmallVector::zero(); -- cgit 1.4.1-3-g733a5