From ac1b7a3896c5e05d9ae0af71fc3c82e73c9a05f4 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 15 Aug 2015 05:06:21 +0530 Subject: [PATCH] Cleanup textinput, timers --- components/script/textinput.rs | 7 ++++--- components/script/timers.rs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/script/textinput.rs b/components/script/textinput.rs index 31fc7dc2e25..5ecf6a4f312 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -292,10 +292,11 @@ impl TextInput { /// Deal with a newline input. pub fn handle_return(&mut self) -> KeyReaction { if !self.multiline { - return KeyReaction::TriggerDefaultAction; + KeyReaction::TriggerDefaultAction + } else { + self.insert_char('\n'); + KeyReaction::DispatchInput } - self.insert_char('\n'); - return KeyReaction::DispatchInput; } /// Select all text in the input control. diff --git a/components/script/timers.rs b/components/script/timers.rs index 579c0d9a2c3..8cc317f83ac 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -222,8 +222,8 @@ impl TimerManager { for _ in 0..arguments.len() { timer.data.args.push(Heap::default()); } - for i in 0..arguments.len() { - timer.data.args.get_mut(i).unwrap().set(arguments[i].get()); + for (i, item) in arguments.iter().enumerate() { + timer.data.args.get_mut(i).unwrap().set(item.get()); } handle }