diff options
author | Ben S <ogham@bsago.me> | 2014-11-24 02:01:08 +0000 |
---|---|---|
committer | Ben S <ogham@bsago.me> | 2014-11-24 02:01:08 +0000 |
commit | d72be30c30c0c57375736154fd6b5293cb04d0d8 (patch) | |
tree | a254fdddf168b96dc926f4315a81b07179c1a205 /src/column.rs | |
parent | c75bbf7f7951dc08dd1ecb71c1fceea79ba70963 (diff) |
Reduce unnecessary String allocations
- Remove uses of to_string() on a &str where it wasn't necessary
- Use SendStr to reduce allocations further
Diffstat (limited to 'src/column.rs')
-rw-r--r-- | src/column.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/column.rs b/src/column.rs index 132497a..0136981 100644 --- a/src/column.rs +++ b/src/column.rs @@ -49,8 +49,8 @@ impl Column { impl Alignment { pub fn pad_string(&self, string: &String, padding: uint) -> String { match *self { - Alignment::Left => string.clone() + " ".to_string().repeat(padding).as_slice(), - Alignment::Right => " ".to_string().repeat(padding) + string.as_slice(), + Alignment::Left => string.clone() + " ".repeat(padding).as_slice(), + Alignment::Right => " ".repeat(padding) + string.as_slice(), } } } |