From 185941d035d431242178574cd70508617ff826c2 Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Tue, 14 Apr 2020 12:10:17 -0400 Subject: [PATCH] Apply suggestions from code review Co-Authored-By: Leopold Luley --- docs/book_examples/src/custom_widgets_md.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/book_examples/src/custom_widgets_md.rs b/docs/book_examples/src/custom_widgets_md.rs index e81a8892a2..021574a49d 100644 --- a/docs/book_examples/src/custom_widgets_md.rs +++ b/docs/book_examples/src/custom_widgets_md.rs @@ -47,11 +47,6 @@ impl TextBoxActionController { pub fn new() -> Self { TextBoxActionController { timer: None } } - - // Fire ACTION after 300 ms - fn deadline() -> Instant { - Instant::now() + DELAY - } } impl Controller for TextBoxActionController { @@ -68,7 +63,7 @@ impl Controller for TextBoxActionController { ctx.submit_command(ACTION, None); } Event::KeyUp(k) if k.key_code != KeyCode::Return => { - self.timer = Some(ctx.request_timer(Self::deadline())); + self.timer = Some(ctx.request_timer(Instant::now() + DELAY)); child.event(ctx, event, data, env); } Event::Timer(token) if Some(*token) == self.timer => {