minor changes to text_input's use of iterators

This commit is contained in:
memoryruins 2019-11-07 01:07:00 -05:00
parent d568d05df4
commit b9398d2df8

View file

@ -125,17 +125,12 @@ impl Value {
}
pub fn until(&self, index: usize) -> Self {
Self(self.0[..index.min(self.len())].iter().cloned().collect())
Self(self.0[..index.min(self.len())].to_vec())
}
pub fn to_string(&self) -> String {
let mut string = String::new();
for c in self.0.iter() {
string.push(*c);
}
string
use std::iter::FromIterator;
String::from_iter(self.0.iter())
}
pub fn insert(&mut self, index: usize, c: char) {