aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-08-15 05:06:21 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-08-18 18:37:12 +0530
commitac1b7a3896c5e05d9ae0af71fc3c82e73c9a05f4 (patch)
tree4b0bcb057a3322fc2191163af5a6f3d41df3d407
parent53e155e8ac62c4ce2f2e2bd930b15ecebd41465e (diff)
downloadservo-ac1b7a3896c5e05d9ae0af71fc3c82e73c9a05f4.tar.gz
servo-ac1b7a3896c5e05d9ae0af71fc3c82e73c9a05f4.zip
Cleanup textinput, timers
-rw-r--r--components/script/textinput.rs7
-rw-r--r--components/script/timers.rs4
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<T: ClipboardProvider> TextInput<T> {
/// 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
}