Merge pull request #45 from memoryruins/smol-changes

Minor clean-up
This commit is contained in:
Héctor Ramón 2019-11-08 00:54:05 +01:00 committed by GitHub
commit b31a80f2c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

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) {

View file

@ -33,7 +33,7 @@ impl Application for Todos {
Message::CreateTask => {
if !self.input_value.is_empty() {
self.tasks.push(Task::new(self.input_value.clone()));
self.input_value = String::new();
self.input_value.clear();
}
}
Message::TaskChanged(i, completed) => {