From b9398d2df87ebcfb243a78290712c1ccff904171 Mon Sep 17 00:00:00 2001 From: memoryruins Date: Thu, 7 Nov 2019 01:07:00 -0500 Subject: minor changes to text_input's use of iterators --- core/src/widget/text_input.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'core/src') diff --git a/core/src/widget/text_input.rs b/core/src/widget/text_input.rs index e5d6b70d..9c7f4bc8 100644 --- a/core/src/widget/text_input.rs +++ b/core/src/widget/text_input.rs @@ -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) { -- cgit