diff options
author | 2019-11-07 01:07:00 -0500 | |
---|---|---|
committer | 2019-11-07 01:07:00 -0500 | |
commit | b9398d2df87ebcfb243a78290712c1ccff904171 (patch) | |
tree | 344cf5bf87f2984e457ba1d0576292503ce90519 /core | |
parent | d568d05df4388bfaa254ee87cca6edd07fc24465 (diff) | |
download | iced-b9398d2df87ebcfb243a78290712c1ccff904171.tar.gz iced-b9398d2df87ebcfb243a78290712c1ccff904171.tar.bz2 iced-b9398d2df87ebcfb243a78290712c1ccff904171.zip |
minor changes to text_input's use of iterators
Diffstat (limited to 'core')
-rw-r--r-- | core/src/widget/text_input.rs | 11 |
1 files changed, 3 insertions, 8 deletions
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) { |