THRIFT-5158 Update Rust generator and Rust lib,test,tutorial to only support 2018 edition
Client: rs
Patch: Allen George

This closes #2078
diff --git a/lib/rs/src/server/mod.rs b/lib/rs/src/server/mod.rs
index f24c113..050feee 100644
--- a/lib/rs/src/server/mod.rs
+++ b/lib/rs/src/server/mod.rs
@@ -17,8 +17,8 @@
 
 //! Types used to implement a Thrift server.
 
-use protocol::{TInputProtocol, TMessageIdentifier, TMessageType, TOutputProtocol};
-use {ApplicationError, ApplicationErrorKind};
+use crate::protocol::{TInputProtocol, TMessageIdentifier, TMessageType, TOutputProtocol};
+use crate::{ApplicationError, ApplicationErrorKind};
 
 mod multiplexed;
 mod threaded;
@@ -91,19 +91,19 @@
     /// the response to `o`.
     ///
     /// Returns `()` if the handler was executed; `Err` otherwise.
-    fn process(&self, i: &mut dyn TInputProtocol, o: &mut dyn TOutputProtocol) -> ::Result<()>;
+    fn process(&self, i: &mut dyn TInputProtocol, o: &mut dyn TOutputProtocol) -> crate::Result<()>;
 }
 
 /// Convenience function used in generated `TProcessor` implementations to
 /// return an `ApplicationError` if thrift message processing failed.
 pub fn handle_process_result(
     msg_ident: &TMessageIdentifier,
-    res: ::Result<()>,
+    res: crate::Result<()>,
     o_prot: &mut dyn TOutputProtocol,
-) -> ::Result<()> {
+) -> crate::Result<()> {
     if let Err(e) = res {
         let e = match e {
-            ::Error::Application(a) => a,
+            crate::Error::Application(a) => a,
             _ => ApplicationError::new(ApplicationErrorKind::Unknown, format!("{:?}", e)),
         };
 
@@ -114,7 +114,7 @@
         );
 
         o_prot.write_message_begin(&ident)?;
-        ::Error::write_application_error_to_out_protocol(&e, o_prot)?;
+        crate::Error::write_application_error_to_out_protocol(&e, o_prot)?;
         o_prot.write_message_end()?;
         o_prot.flush()
     } else {
diff --git a/lib/rs/src/server/multiplexed.rs b/lib/rs/src/server/multiplexed.rs
index 3f9bc78..3d688fa 100644
--- a/lib/rs/src/server/multiplexed.rs
+++ b/lib/rs/src/server/multiplexed.rs
@@ -21,7 +21,7 @@
 use std::fmt::{Debug, Formatter};
 use std::sync::{Arc, Mutex};
 
-use protocol::{TInputProtocol, TMessageIdentifier, TOutputProtocol, TStoredInputProtocol};
+use crate::protocol::{TInputProtocol, TMessageIdentifier, TOutputProtocol, TStoredInputProtocol};
 
 use super::{handle_process_result, TProcessor};
 
@@ -76,7 +76,7 @@
         service_name: S,
         processor: Box<dyn TProcessor + Send + Sync>,
         as_default: bool,
-    ) -> ::Result<()> {
+    ) -> crate::Result<()> {
         let mut stored = self.stored.lock().unwrap();
 
         let name = service_name.into();
@@ -105,7 +105,7 @@
         msg_ident: &TMessageIdentifier,
         i_prot: &mut dyn TInputProtocol,
         o_prot: &mut dyn TOutputProtocol,
-    ) -> ::Result<()> {
+    ) -> crate::Result<()> {
         let (svc_name, svc_call) = split_ident_name(&msg_ident.name);
         debug!("routing svc_name {:?} svc_call {}", &svc_name, &svc_call);
 
@@ -134,7 +134,7 @@
 }
 
 impl TProcessor for TMultiplexedProcessor {
-    fn process(&self, i_prot: &mut dyn TInputProtocol, o_prot: &mut dyn TOutputProtocol) -> ::Result<()> {
+    fn process(&self, i_prot: &mut dyn TInputProtocol, o_prot: &mut dyn TOutputProtocol) -> crate::Result<()> {
         let msg_ident = i_prot.read_message_begin()?;
 
         debug!("process incoming msg id:{:?}", &msg_ident);
@@ -181,9 +181,9 @@
     use std::sync::atomic::{AtomicBool, Ordering};
     use std::sync::Arc;
 
-    use protocol::{TBinaryInputProtocol, TBinaryOutputProtocol, TMessageIdentifier, TMessageType};
-    use transport::{ReadHalf, TBufferChannel, TIoChannel, WriteHalf};
-    use {ApplicationError, ApplicationErrorKind};
+    use crate::protocol::{TBinaryInputProtocol, TBinaryOutputProtocol, TMessageIdentifier, TMessageType};
+    use crate::transport::{ReadHalf, TBufferChannel, TIoChannel, WriteHalf};
+    use crate::{ApplicationError, ApplicationErrorKind};
 
     use super::*;
 
@@ -220,7 +220,7 @@
         let rcvd_ident = i.read_message_begin().unwrap();
         let expected_ident = TMessageIdentifier::new("foo", TMessageType::Exception, 10);
         assert_eq!(rcvd_ident, expected_ident);
-        let rcvd_err = ::Error::read_application_error_from_in_protocol(&mut i).unwrap();
+        let rcvd_err = crate::Error::read_application_error_from_in_protocol(&mut i).unwrap();
         let expected_err = ApplicationError::new(
             ApplicationErrorKind::Unknown,
             MISSING_SEPARATOR_AND_NO_DEFAULT,
@@ -245,7 +245,7 @@
         let rcvd_ident = i.read_message_begin().unwrap();
         let expected_ident = TMessageIdentifier::new("missing:call", TMessageType::Exception, 10);
         assert_eq!(rcvd_ident, expected_ident);
-        let rcvd_err = ::Error::read_application_error_from_in_protocol(&mut i).unwrap();
+        let rcvd_err = crate::Error::read_application_error_from_in_protocol(&mut i).unwrap();
         let expected_err = ApplicationError::new(
             ApplicationErrorKind::Unknown,
             missing_processor_message(Some("missing")),
@@ -259,7 +259,7 @@
     }
 
     impl TProcessor for Service {
-        fn process(&self, _: &mut dyn TInputProtocol, _: &mut dyn TOutputProtocol) -> ::Result<()> {
+        fn process(&self, _: &mut dyn TInputProtocol, _: &mut dyn TOutputProtocol) -> crate::Result<()> {
             let res = self
                 .invoked
                 .compare_and_swap(false, true, Ordering::Relaxed);
diff --git a/lib/rs/src/server/threaded.rs b/lib/rs/src/server/threaded.rs
index 5e253f7..8373c46 100644
--- a/lib/rs/src/server/threaded.rs
+++ b/lib/rs/src/server/threaded.rs
@@ -19,12 +19,12 @@
 use std::sync::Arc;
 use threadpool::ThreadPool;
 
-use protocol::{TInputProtocol, TInputProtocolFactory, TOutputProtocol, TOutputProtocolFactory};
-use transport::{TIoChannel, TReadTransportFactory, TTcpChannel, TWriteTransportFactory};
-use {ApplicationError, ApplicationErrorKind};
+use crate::protocol::{TInputProtocol, TInputProtocolFactory, TOutputProtocol, TOutputProtocolFactory};
+use crate::transport::{TIoChannel, TReadTransportFactory, TTcpChannel, TWriteTransportFactory};
+use crate::{ApplicationError, ApplicationErrorKind};
 
 use super::TProcessor;
-use TransportErrorKind;
+use crate::TransportErrorKind;
 
 /// Fixed-size thread-pool blocking Thrift server.
 ///
@@ -169,7 +169,7 @@
     ///
     /// Return `Err` when the server cannot bind to `listen_address` or there
     /// is an unrecoverable error.
-    pub fn listen<A: ToSocketAddrs>(&mut self, listen_address: A) -> ::Result<()> {
+    pub fn listen<A: ToSocketAddrs>(&mut self, listen_address: A) -> crate::Result<()> {
         let listener = TcpListener::bind(listen_address)?;
         for stream in listener.incoming() {
             match stream {
@@ -185,7 +185,7 @@
             }
         }
 
-        Err(::Error::Application(ApplicationError {
+        Err(crate::Error::Application(ApplicationError {
             kind: ApplicationErrorKind::Unknown,
             message: "aborted listen loop".into(),
         }))
@@ -194,7 +194,7 @@
     fn new_protocols_for_connection(
         &mut self,
         stream: TcpStream,
-    ) -> ::Result<(Box<dyn TInputProtocol + Send>, Box<dyn TOutputProtocol + Send>)> {
+    ) -> crate::Result<(Box<dyn TInputProtocol + Send>, Box<dyn TOutputProtocol + Send>)> {
         // create the shared tcp stream
         let channel = TTcpChannel::with_stream(stream);
 
@@ -228,7 +228,7 @@
             Ok(()) => {},
             Err(err) => {
                 match err {
-                    ::Error::Transport(ref transport_err) if transport_err.kind == TransportErrorKind::EndOfFile => {},
+                    crate::Error::Transport(ref transport_err) if transport_err.kind == TransportErrorKind::EndOfFile => {},
                     other => warn!("processor completed with error: {:?}", other),
                 }
                 break;