[rust][LSC] Adjust for new toolchain warnings

Trait objects without explicit `dyn` are deprecated,
as is the `...` syntax for ranges in patterns.

Change-Id: I1e5f1a4529e89b8504bbd556b7e503520e85cc77
diff --git a/src/edit.rs b/src/edit.rs
index 7d706f5..ce9d20e 100644
--- a/src/edit.rs
+++ b/src/edit.rs
@@ -19,7 +19,7 @@
 /// Represent the state during line editing.
 /// Implement rendering.
 pub struct State<'out, 'prompt> {
-    pub out: &'out mut Renderer,
+    pub out: &'out mut dyn Renderer,
     prompt: &'prompt str,  // Prompt to display (rl_prompt)
     prompt_size: Position, // Prompt Unicode/visible width and height
     pub line: LineBuffer,  // Edited line buffer
@@ -30,18 +30,18 @@
     saved_line_for_history: LineBuffer, // Current edited line before history browsing
     byte_buffer: [u8; 4],
     pub changes: Rc<RefCell<Changeset>>, // changes to line, for undo/redo
-    pub hinter: Option<&'out Hinter>,
-    pub highlighter: Option<&'out Highlighter>,
+    pub hinter: Option<&'out dyn Hinter>,
+    pub highlighter: Option<&'out dyn Highlighter>,
     no_hint: bool, // `false` if an hint has been displayed
 }
 
 impl<'out, 'prompt> State<'out, 'prompt> {
     pub fn new(
-        out: &'out mut Renderer,
+        out: &'out mut dyn Renderer,
         prompt: &'prompt str,
         history_index: usize,
-        hinter: Option<&'out Hinter>,
-        highlighter: Option<&'out Highlighter>,
+        hinter: Option<&'out dyn Hinter>,
+        highlighter: Option<&'out dyn Highlighter>,
     ) -> State<'out, 'prompt> {
         let capacity = MAX_LINE;
         let prompt_size = out.calculate_position(prompt, Position::default());
diff --git a/src/keymap.rs b/src/keymap.rs
index 50f50cd..443e6b6 100644
--- a/src/keymap.rs
+++ b/src/keymap.rs
@@ -121,7 +121,7 @@
     }
 
     // Replay this command with a possible different `RepeatCount`.
-    fn redo(&self, new: Option<RepeatCount>, wrt: &Refresher) -> Cmd {
+    fn redo(&self, new: Option<RepeatCount>, wrt: &dyn Refresher) -> Cmd {
         match *self {
             Cmd::Insert(previous, ref text) => {
                 Cmd::Insert(repeat_count(previous, new), text.clone())
@@ -322,7 +322,7 @@
     pub fn next_cmd<R: RawReader>(
         &mut self,
         rdr: &mut R,
-        wrt: &mut Refresher,
+        wrt: &mut dyn Refresher,
         single_esc_abort: bool,
     ) -> Result<Cmd> {
         match self.mode {
@@ -336,11 +336,11 @@
     fn emacs_digit_argument<R: RawReader>(
         &mut self,
         rdr: &mut R,
-        wrt: &mut Refresher,
+        wrt: &mut dyn Refresher,
         digit: char,
     ) -> Result<KeyPress> {
         match digit {
-            '0'...'9' => {
+            '0'..='9' => {
                 self.num_args = digit.to_digit(10).unwrap() as i16;
             }
             '-' => {
@@ -352,7 +352,7 @@
             try!(wrt.refresh_prompt_and_line(&format!("(arg: {}) ", self.num_args)));
             let key = try!(rdr.next_key(true));
             match key {
-                KeyPress::Char(digit @ '0'...'9') | KeyPress::Meta(digit @ '0'...'9') => {
+                KeyPress::Char(digit @ '0'..='9') | KeyPress::Meta(digit @ '0'..='9') => {
                     if self.num_args == -1 {
                         self.num_args *= digit.to_digit(10).unwrap() as i16;
                     } else if self.num_args.abs() < 1000 {
@@ -375,13 +375,13 @@
     fn emacs<R: RawReader>(
         &mut self,
         rdr: &mut R,
-        wrt: &mut Refresher,
+        wrt: &mut dyn Refresher,
         single_esc_abort: bool,
     ) -> Result<Cmd> {
         let mut key = try!(rdr.next_key(single_esc_abort));
         if let KeyPress::Meta(digit @ '-') = key {
             key = try!(self.emacs_digit_argument(rdr, wrt, digit));
-        } else if let KeyPress::Meta(digit @ '0'...'9') = key {
+        } else if let KeyPress::Meta(digit @ '0'..='9') = key {
             key = try!(self.emacs_digit_argument(rdr, wrt, digit));
         }
         let (n, positive) = self.emacs_num_args(); // consume them in all cases
@@ -491,14 +491,14 @@
     fn vi_arg_digit<R: RawReader>(
         &mut self,
         rdr: &mut R,
-        wrt: &mut Refresher,
+        wrt: &mut dyn Refresher,
         digit: char,
     ) -> Result<KeyPress> {
         self.num_args = digit.to_digit(10).unwrap() as i16;
         loop {
             try!(wrt.refresh_prompt_and_line(&format!("(arg: {}) ", self.num_args)));
             let key = try!(rdr.next_key(false));
-            if let KeyPress::Char(digit @ '0'...'9') = key {
+            if let KeyPress::Char(digit @ '0'..='9') = key {
                 if self.num_args.abs() < 1000 {
                     // shouldn't ever need more than 4 digits
                     self.num_args = self
@@ -513,9 +513,9 @@
         }
     }
 
-    fn vi_command<R: RawReader>(&mut self, rdr: &mut R, wrt: &mut Refresher) -> Result<Cmd> {
+    fn vi_command<R: RawReader>(&mut self, rdr: &mut R, wrt: &mut dyn Refresher) -> Result<Cmd> {
         let mut key = try!(rdr.next_key(false));
-        if let KeyPress::Char(digit @ '1'...'9') = key {
+        if let KeyPress::Char(digit @ '1'..='9') = key {
             key = try!(self.vi_arg_digit(rdr, wrt, digit));
         }
         let no_num_args = self.num_args == 0;
@@ -686,7 +686,7 @@
         Ok(cmd)
     }
 
-    fn vi_insert<R: RawReader>(&mut self, rdr: &mut R, wrt: &mut Refresher) -> Result<Cmd> {
+    fn vi_insert<R: RawReader>(&mut self, rdr: &mut R, wrt: &mut dyn Refresher) -> Result<Cmd> {
         let key = try!(rdr.next_key(false));
         {
             let bindings = self.custom_bindings.read().unwrap();
@@ -733,7 +733,7 @@
     fn vi_cmd_motion<R: RawReader>(
         &mut self,
         rdr: &mut R,
-        wrt: &mut Refresher,
+        wrt: &mut dyn Refresher,
         key: KeyPress,
         n: RepeatCount,
     ) -> Result<Option<Movement>> {
@@ -742,7 +742,7 @@
             return Ok(Some(Movement::WholeLine));
         }
         let mut n = n;
-        if let KeyPress::Char(digit @ '1'...'9') = mvt {
+        if let KeyPress::Char(digit @ '1'..='9') = mvt {
             // vi-arg-digit
             mvt = try!(self.vi_arg_digit(rdr, wrt, digit));
             n = self.vi_num_args().saturating_mul(n);
diff --git a/src/lib.rs b/src/lib.rs
index 6e7e625..4a87b10 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -86,7 +86,7 @@
     s: &mut State,
     input_state: &mut InputState,
     completer: &C,
-    highlighter: Option<&Highlighter>,
+    highlighter: Option<&dyn Highlighter>,
     config: &Config,
 ) -> Result<Option<Cmd>> {
     // get a list of completions
@@ -203,7 +203,7 @@
     rdr: &mut R,
     s: &mut State,
     input_state: &mut InputState,
-    highlighter: Option<&Highlighter>,
+    highlighter: Option<&dyn Highlighter>,
     candidates: &[C],
 ) -> Result<Option<Cmd>> {
     use std::cmp;
@@ -374,9 +374,9 @@
     original_mode: &tty::Mode,
 ) -> Result<String> {
     let completer = editor.helper.as_ref();
-    let hinter = editor.helper.as_ref().map(|h| h as &Hinter);
+    let hinter = editor.helper.as_ref().map(|h| h as &dyn Hinter);
     let highlighter = if editor.term.colors_enabled() {
-        editor.helper.as_ref().map(|h| h as &Highlighter)
+        editor.helper.as_ref().map(|h| h as &dyn Highlighter)
     } else {
         None
     };
diff --git a/src/line_buffer.rs b/src/line_buffer.rs
index 8811888..de185b5 100644
--- a/src/line_buffer.rs
+++ b/src/line_buffer.rs
@@ -53,8 +53,8 @@
 pub struct LineBuffer {
     buf: String, // Edited line buffer (rl_line_buffer)
     pos: usize,  // Current cursor position (byte position) (rl_point)
-    dl: Option<Arc<Mutex<DeleteListener>>>,
-    cl: Option<Rc<RefCell<ChangeListener>>>,
+    dl: Option<Arc<Mutex<dyn DeleteListener>>>,
+    cl: Option<Rc<RefCell<dyn ChangeListener>>>,
 }
 
 impl fmt::Debug for LineBuffer {
@@ -90,11 +90,11 @@
         lb
     }
 
-    pub(crate) fn set_delete_listener(&mut self, dl: Arc<Mutex<DeleteListener>>) {
+    pub(crate) fn set_delete_listener(&mut self, dl: Arc<Mutex<dyn DeleteListener>>) {
         self.dl = Some(dl);
     }
 
-    pub(crate) fn set_change_listener(&mut self, dl: Rc<RefCell<ChangeListener>>) {
+    pub(crate) fn set_change_listener(&mut self, dl: Rc<RefCell<dyn ChangeListener>>) {
         self.cl = Some(dl);
     }
 
diff --git a/src/tty/fuchsia.rs b/src/tty/fuchsia.rs
index 1dd632f..c4d63b5 100644
--- a/src/tty/fuchsia.rs
+++ b/src/tty/fuchsia.rs
@@ -361,7 +361,7 @@
         hint: Option<String>,
         current_row: usize,
         old_rows: usize,
-        highlighter: Option<&Highlighter>,
+        highlighter: Option<&dyn Highlighter>,
     ) -> Result<(Position, Position)> {
         use std::fmt::Write;
         self.buffer.clear();
diff --git a/src/tty/mod.rs b/src/tty/mod.rs
index 48f917c..69e8122 100644
--- a/src/tty/mod.rs
+++ b/src/tty/mod.rs
@@ -43,7 +43,7 @@
         hint: Option<String>,
         current_row: usize,
         old_rows: usize,
-        highlighter: Option<&Highlighter>,
+        highlighter: Option<&dyn Highlighter>,
     ) -> Result<(Position, Position)>;
 
     /// Calculate the number of columns and rows used to display `s` on a
@@ -87,7 +87,7 @@
         hint: Option<String>,
         current_row: usize,
         old_rows: usize,
-        highlighter: Option<&Highlighter>,
+        highlighter: Option<&dyn Highlighter>,
     ) -> Result<(Position, Position)> {
         (**self).refresh_line(
             prompt,