Reformat rust code with rustfmt 1.0
diff --git a/lib/rs/src/protocol/binary.rs b/lib/rs/src/protocol/binary.rs
index 42c6c97..19aff3d 100644
--- a/lib/rs/src/protocol/binary.rs
+++ b/lib/rs/src/protocol/binary.rs
@@ -19,11 +19,13 @@
 use std::convert::From;
 use try_from::TryFrom;
 
-use {ProtocolError, ProtocolErrorKind};
-use transport::{TReadTransport, TWriteTransport};
-use super::{TFieldIdentifier, TInputProtocol, TInputProtocolFactory, TListIdentifier,
-            TMapIdentifier, TMessageIdentifier, TMessageType};
+use super::{
+    TFieldIdentifier, TInputProtocol, TInputProtocolFactory, TListIdentifier, TMapIdentifier,
+    TMessageIdentifier, TMessageType,
+};
 use super::{TOutputProtocol, TOutputProtocolFactory, TSetIdentifier, TStructIdentifier, TType};
+use transport::{TReadTransport, TWriteTransport};
+use {ProtocolError, ProtocolErrorKind};
 
 const BINARY_PROTOCOL_VERSION_1: u32 = 0x80010000;
 
@@ -90,14 +92,10 @@
             // apparently we got a protocol-version header - check
             // it, and if it matches, read the rest of the fields
             if first_bytes[0..2] != [0x80, 0x01] {
-                Err(
-                    ::Error::Protocol(
-                        ProtocolError {
-                            kind: ProtocolErrorKind::BadVersion,
-                            message: format!("received bad version: {:?}", &first_bytes[0..2]),
-                        },
-                    ),
-                )
+                Err(::Error::Protocol(ProtocolError {
+                    kind: ProtocolErrorKind::BadVersion,
+                    message: format!("received bad version: {:?}", &first_bytes[0..2]),
+                }))
             } else {
                 let message_type: TMessageType = TryFrom::try_from(first_bytes[3])?;
                 let name = self.read_string()?;
@@ -110,14 +108,10 @@
             if self.strict {
                 // we're in strict mode however, and that always
                 // requires the protocol-version header to be written first
-                Err(
-                    ::Error::Protocol(
-                        ProtocolError {
-                            kind: ProtocolErrorKind::BadVersion,
-                            message: format!("received bad version: {:?}", &first_bytes[0..2]),
-                        },
-                    ),
-                )
+                Err(::Error::Protocol(ProtocolError {
+                    kind: ProtocolErrorKind::BadVersion,
+                    message: format!("received bad version: {:?}", &first_bytes[0..2]),
+                }))
             } else {
                 // in the non-strict version the first message field
                 // is the message name. strings (byte arrays) are length-prefixed,
@@ -154,7 +148,9 @@
             TType::Stop => Ok(0),
             _ => self.read_i16(),
         }?;
-        Ok(TFieldIdentifier::new::<Option<String>, String, i16>(None, field_type, id),)
+        Ok(TFieldIdentifier::new::<Option<String>, String, i16>(
+            None, field_type, id,
+        ))
     }
 
     fn read_field_end(&mut self) -> ::Result<()> {
@@ -183,27 +179,19 @@
     }
 
     fn read_i16(&mut self) -> ::Result<i16> {
-        self.transport
-            .read_i16::<BigEndian>()
-            .map_err(From::from)
+        self.transport.read_i16::<BigEndian>().map_err(From::from)
     }
 
     fn read_i32(&mut self) -> ::Result<i32> {
-        self.transport
-            .read_i32::<BigEndian>()
-            .map_err(From::from)
+        self.transport.read_i32::<BigEndian>().map_err(From::from)
     }
 
     fn read_i64(&mut self) -> ::Result<i64> {
-        self.transport
-            .read_i64::<BigEndian>()
-            .map_err(From::from)
+        self.transport.read_i64::<BigEndian>().map_err(From::from)
     }
 
     fn read_double(&mut self) -> ::Result<f64> {
-        self.transport
-            .read_f64::<BigEndian>()
-            .map_err(From::from)
+        self.transport.read_f64::<BigEndian>().map_err(From::from)
     }
 
     fn read_string(&mut self) -> ::Result<String> {
@@ -346,17 +334,13 @@
 
     fn write_field_begin(&mut self, identifier: &TFieldIdentifier) -> ::Result<()> {
         if identifier.id.is_none() && identifier.field_type != TType::Stop {
-            return Err(
-                ::Error::Protocol(
-                    ProtocolError {
-                        kind: ProtocolErrorKind::Unknown,
-                        message: format!(
-                            "cannot write identifier {:?} without sequence number",
-                            &identifier
-                        ),
-                    },
+            return Err(::Error::Protocol(ProtocolError {
+                kind: ProtocolErrorKind::Unknown,
+                message: format!(
+                    "cannot write identifier {:?} without sequence number",
+                    &identifier
                 ),
-            );
+            }));
         }
 
         self.write_byte(field_type_to_u8(identifier.field_type))?;
@@ -393,27 +377,19 @@
     }
 
     fn write_i16(&mut self, i: i16) -> ::Result<()> {
-        self.transport
-            .write_i16::<BigEndian>(i)
-            .map_err(From::from)
+        self.transport.write_i16::<BigEndian>(i).map_err(From::from)
     }
 
     fn write_i32(&mut self, i: i32) -> ::Result<()> {
-        self.transport
-            .write_i32::<BigEndian>(i)
-            .map_err(From::from)
+        self.transport.write_i32::<BigEndian>(i).map_err(From::from)
     }
 
     fn write_i64(&mut self, i: i64) -> ::Result<()> {
-        self.transport
-            .write_i64::<BigEndian>(i)
-            .map_err(From::from)
+        self.transport.write_i64::<BigEndian>(i).map_err(From::from)
     }
 
     fn write_double(&mut self, d: f64) -> ::Result<()> {
-        self.transport
-            .write_f64::<BigEndian>(d)
-            .map_err(From::from)
+        self.transport.write_f64::<BigEndian>(d).map_err(From::from)
     }
 
     fn write_string(&mut self, s: &str) -> ::Result<()> {
@@ -520,25 +496,20 @@
         0x0F => Ok(TType::List),
         0x10 => Ok(TType::Utf8),
         0x11 => Ok(TType::Utf16),
-        unkn => {
-            Err(
-                ::Error::Protocol(
-                    ProtocolError {
-                        kind: ProtocolErrorKind::InvalidData,
-                        message: format!("cannot convert {} to TType", unkn),
-                    },
-                ),
-            )
-        }
+        unkn => Err(::Error::Protocol(ProtocolError {
+            kind: ProtocolErrorKind::InvalidData,
+            message: format!("cannot convert {} to TType", unkn),
+        })),
     }
 }
 
 #[cfg(test)]
 mod tests {
 
-    use protocol::{TFieldIdentifier, TInputProtocol, TListIdentifier, TMapIdentifier,
-                   TMessageIdentifier, TMessageType, TOutputProtocol, TSetIdentifier,
-                   TStructIdentifier, TType};
+    use protocol::{
+        TFieldIdentifier, TInputProtocol, TListIdentifier, TMapIdentifier, TMessageIdentifier,
+        TMessageType, TOutputProtocol, TSetIdentifier, TStructIdentifier, TType,
+    };
     use transport::{ReadHalf, TBufferChannel, TIoChannel, WriteHalf};
 
     use super::*;
@@ -550,6 +521,7 @@
         let ident = TMessageIdentifier::new("test", TMessageType::Call, 1);
         assert!(o_prot.write_message_begin(&ident).is_ok());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 16] = [
             0x80,
             0x01,
@@ -579,6 +551,7 @@
         let ident = TMessageIdentifier::new("test", TMessageType::Call, 1);
         assert!(o_prot.write_message_begin(&ident).is_ok());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 13] = [
             0x00,
             0x00,
@@ -605,6 +578,7 @@
         let ident = TMessageIdentifier::new("test", TMessageType::Reply, 10);
         assert!(o_prot.write_message_begin(&ident).is_ok());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 16] = [
             0x80,
             0x01,
@@ -634,6 +608,7 @@
         let ident = TMessageIdentifier::new("test", TMessageType::Reply, 10);
         assert!(o_prot.write_message_begin(&ident).is_ok());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 13] = [
             0x00,
             0x00,
@@ -686,7 +661,10 @@
 
     #[test]
     fn must_write_struct_begin() {
-        assert_no_write(|o| o.write_struct_begin(&TStructIdentifier::new("foo")), true);
+        assert_no_write(
+            |o| o.write_struct_begin(&TStructIdentifier::new("foo")),
+            true,
+        );
     }
 
     #[test]
@@ -698,11 +676,9 @@
     fn must_write_field_begin() {
         let (_, mut o_prot) = test_objects(true);
 
-        assert!(
-            o_prot
-                .write_field_begin(&TFieldIdentifier::new("some_field", TType::String, 22))
-                .is_ok()
-        );
+        assert!(o_prot
+            .write_field_begin(&TFieldIdentifier::new("some_field", TType::String, 22))
+            .is_ok());
 
         let expected: [u8; 3] = [0x0B, 0x00, 0x16];
         assert_eq_written_bytes!(o_prot, expected);
@@ -763,11 +739,9 @@
     fn must_write_list_begin() {
         let (_, mut o_prot) = test_objects(true);
 
-        assert!(
-            o_prot
-                .write_list_begin(&TListIdentifier::new(TType::Bool, 5))
-                .is_ok()
-        );
+        assert!(o_prot
+            .write_list_begin(&TListIdentifier::new(TType::Bool, 5))
+            .is_ok());
 
         let expected: [u8; 5] = [0x02, 0x00, 0x00, 0x00, 0x05];
         assert_eq_written_bytes!(o_prot, expected);
@@ -795,11 +769,9 @@
     fn must_write_set_begin() {
         let (_, mut o_prot) = test_objects(true);
 
-        assert!(
-            o_prot
-                .write_set_begin(&TSetIdentifier::new(TType::I16, 7))
-                .is_ok()
-        );
+        assert!(o_prot
+            .write_set_begin(&TSetIdentifier::new(TType::I16, 7))
+            .is_ok());
 
         let expected: [u8; 5] = [0x06, 0x00, 0x00, 0x00, 0x07];
         assert_eq_written_bytes!(o_prot, expected);
@@ -828,11 +800,9 @@
     fn must_write_map_begin() {
         let (_, mut o_prot) = test_objects(true);
 
-        assert!(
-            o_prot
-                .write_map_begin(&TMapIdentifier::new(TType::I64, TType::Struct, 32))
-                .is_ok()
-        );
+        assert!(o_prot
+            .write_map_begin(&TMapIdentifier::new(TType::I64, TType::Struct, 32))
+            .is_ok());
 
         let expected: [u8; 6] = [0x0A, 0x0C, 0x00, 0x00, 0x00, 0x20];
         assert_eq_written_bytes!(o_prot, expected);
@@ -923,6 +893,7 @@
     fn must_round_trip_bytes() {
         let (mut i_prot, mut o_prot) = test_objects(true);
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let bytes: [u8; 25] = [
             0x20,
             0xFD,
@@ -959,10 +930,12 @@
         assert_eq!(&received_bytes, &bytes);
     }
 
-    fn test_objects(strict: bool)
-        -> (TBinaryInputProtocol<ReadHalf<TBufferChannel>>,
-            TBinaryOutputProtocol<WriteHalf<TBufferChannel>>)
-    {
+    fn test_objects(
+        strict: bool,
+    ) -> (
+        TBinaryInputProtocol<ReadHalf<TBufferChannel>>,
+        TBinaryOutputProtocol<WriteHalf<TBufferChannel>>,
+    ) {
         let mem = TBufferChannel::with_capacity(40, 40);
 
         let (r_mem, w_mem) = mem.split().unwrap();
diff --git a/lib/rs/src/protocol/compact.rs b/lib/rs/src/protocol/compact.rs
index 1e67f49..df5edaa 100644
--- a/lib/rs/src/protocol/compact.rs
+++ b/lib/rs/src/protocol/compact.rs
@@ -18,13 +18,15 @@
 use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
 use integer_encoding::{VarIntReader, VarIntWriter};
 use std::convert::From;
-use try_from::TryFrom;
 use std::io;
+use try_from::TryFrom;
 
-use transport::{TReadTransport, TWriteTransport};
-use super::{TFieldIdentifier, TInputProtocol, TInputProtocolFactory, TListIdentifier,
-            TMapIdentifier, TMessageIdentifier, TMessageType};
+use super::{
+    TFieldIdentifier, TInputProtocol, TInputProtocolFactory, TListIdentifier, TMapIdentifier,
+    TMessageIdentifier, TMessageType,
+};
 use super::{TOutputProtocol, TOutputProtocolFactory, TSetIdentifier, TStructIdentifier, TType};
+use transport::{TReadTransport, TWriteTransport};
 
 const COMPACT_PROTOCOL_ID: u8 = 0x82;
 const COMPACT_VERSION: u8 = 0x01;
@@ -103,14 +105,10 @@
     fn read_message_begin(&mut self) -> ::Result<TMessageIdentifier> {
         let compact_id = self.read_byte()?;
         if compact_id != COMPACT_PROTOCOL_ID {
-            Err(
-                ::Error::Protocol(
-                    ::ProtocolError {
-                        kind: ::ProtocolErrorKind::BadVersion,
-                        message: format!("invalid compact protocol header {:?}", compact_id),
-                    },
-                ),
-            )
+            Err(::Error::Protocol(::ProtocolError {
+                kind: ::ProtocolErrorKind::BadVersion,
+                message: format!("invalid compact protocol header {:?}", compact_id),
+            }))
         } else {
             Ok(())
         }?;
@@ -118,17 +116,13 @@
         let type_and_byte = self.read_byte()?;
         let received_version = type_and_byte & COMPACT_VERSION_MASK;
         if received_version != COMPACT_VERSION {
-            Err(
-                ::Error::Protocol(
-                    ::ProtocolError {
-                        kind: ::ProtocolErrorKind::BadVersion,
-                        message: format!(
-                            "cannot process compact protocol version {:?}",
-                            received_version
-                        ),
-                    },
+            Err(::Error::Protocol(::ProtocolError {
+                kind: ::ProtocolErrorKind::BadVersion,
+                message: format!(
+                    "cannot process compact protocol version {:?}",
+                    received_version
                 ),
-            )
+            }))
         } else {
             Ok(())
         }?;
@@ -140,7 +134,11 @@
 
         self.last_read_field_id = 0;
 
-        Ok(TMessageIdentifier::new(service_call_name, message_type, sequence_number),)
+        Ok(TMessageIdentifier::new(
+            service_call_name,
+            message_type,
+            sequence_number,
+        ))
     }
 
     fn read_message_end(&mut self) -> ::Result<()> {
@@ -154,7 +152,8 @@
     }
 
     fn read_struct_end(&mut self) -> ::Result<()> {
-        self.last_read_field_id = self.read_field_id_stack
+        self.last_read_field_id = self
+            .read_field_id_stack
             .pop()
             .expect("should have previous field ids");
         Ok(())
@@ -179,15 +178,13 @@
         }?;
 
         match field_type {
-            TType::Stop => {
-                Ok(
-                    TFieldIdentifier::new::<Option<String>, String, Option<i16>>(
-                        None,
-                        TType::Stop,
-                        None,
-                    ),
-                )
-            }
+            TType::Stop => Ok(
+                TFieldIdentifier::new::<Option<String>, String, Option<i16>>(
+                    None,
+                    TType::Stop,
+                    None,
+                ),
+            ),
             _ => {
                 if field_delta != 0 {
                     self.last_read_field_id += field_delta as i16;
@@ -195,13 +192,11 @@
                     self.last_read_field_id = self.read_i16()?;
                 };
 
-                Ok(
-                    TFieldIdentifier {
-                        name: None,
-                        field_type: field_type,
-                        id: Some(self.last_read_field_id),
-                    },
-                )
+                Ok(TFieldIdentifier {
+                    name: None,
+                    field_type: field_type,
+                    id: Some(self.last_read_field_id),
+                })
             }
         }
     }
@@ -218,16 +213,10 @@
                 match b {
                     0x01 => Ok(true),
                     0x02 => Ok(false),
-                    unkn => {
-                        Err(
-                            ::Error::Protocol(
-                                ::ProtocolError {
-                                    kind: ::ProtocolErrorKind::InvalidData,
-                                    message: format!("cannot convert {} into bool", unkn),
-                                },
-                            ),
-                        )
-                    }
+                    unkn => Err(::Error::Protocol(::ProtocolError {
+                        kind: ::ProtocolErrorKind::InvalidData,
+                        message: format!("cannot convert {} into bool", unkn),
+                    })),
                 }
             }
         }
@@ -259,9 +248,7 @@
     }
 
     fn read_double(&mut self) -> ::Result<f64> {
-        self.transport
-            .read_f64::<BigEndian>()
-            .map_err(From::from)
+        self.transport.read_f64::<BigEndian>().map_err(From::from)
     }
 
     fn read_string(&mut self) -> ::Result<String> {
@@ -315,7 +302,6 @@
     }
 }
 
-
 impl<T> io::Seek for TCompactInputProtocol<T>
 where
     T: io::Seek + TReadTransport,
@@ -450,7 +436,8 @@
 
     fn write_struct_end(&mut self) -> ::Result<()> {
         self.assert_no_pending_bool_write();
-        self.last_write_field_id = self.write_field_id_stack
+        self.last_write_field_id = self
+            .write_field_id_stack
             .pop()
             .expect("should have previous field ids");
         Ok(())
@@ -462,7 +449,7 @@
                 if self.pending_write_bool_field_identifier.is_some() {
                     panic!(
                         "should not have a pending bool while writing another bool with id: \
-                            {:?}",
+                         {:?}",
                         identifier
                     )
                 }
@@ -471,9 +458,7 @@
             }
             _ => {
                 let field_type = type_to_u8(identifier.field_type);
-                let field_id = identifier
-                    .id
-                    .expect("non-stop field should have field id");
+                let field_id = identifier.id.expect("non-stop field should have field id");
                 self.write_field_header(field_type, field_id)
             }
         }
@@ -537,9 +522,7 @@
     }
 
     fn write_double(&mut self, d: f64) -> ::Result<()> {
-        self.transport
-            .write_f64::<BigEndian>(d)
-            .map_err(From::from)
+        self.transport.write_f64::<BigEndian>(d).map_err(From::from)
     }
 
     fn write_string(&mut self, s: &str) -> ::Result<()> {
@@ -595,10 +578,7 @@
     //
 
     fn write_byte(&mut self, b: u8) -> ::Result<()> {
-        self.transport
-            .write(&[b])
-            .map_err(From::from)
-            .map(|_| ())
+        self.transport.write(&[b]).map_err(From::from).map(|_| ())
     }
 }
 
@@ -639,7 +619,10 @@
         TType::Set => 0x0A,
         TType::Map => 0x0B,
         TType::Struct => 0x0C,
-        _ => panic!(format!("should not have attempted to convert {} to u8", field_type)),
+        _ => panic!(format!(
+            "should not have attempted to convert {} to u8",
+            field_type
+        )),
     }
 }
 
@@ -663,25 +646,20 @@
         0x0A => Ok(TType::Set),
         0x0B => Ok(TType::Map),
         0x0C => Ok(TType::Struct),
-        unkn => {
-            Err(
-                ::Error::Protocol(
-                    ::ProtocolError {
-                        kind: ::ProtocolErrorKind::InvalidData,
-                        message: format!("cannot convert {} into TType", unkn),
-                    },
-                ),
-            )
-        }
+        unkn => Err(::Error::Protocol(::ProtocolError {
+            kind: ::ProtocolErrorKind::InvalidData,
+            message: format!("cannot convert {} into TType", unkn),
+        })),
     }
 }
 
 #[cfg(test)]
 mod tests {
 
-    use protocol::{TFieldIdentifier, TInputProtocol, TListIdentifier, TMapIdentifier,
-                   TMessageIdentifier, TMessageType, TOutputProtocol, TSetIdentifier,
-                   TStructIdentifier, TType};
+    use protocol::{
+        TFieldIdentifier, TInputProtocol, TListIdentifier, TMapIdentifier, TMessageIdentifier,
+        TMessageType, TOutputProtocol, TSetIdentifier, TStructIdentifier, TType,
+    };
     use transport::{ReadHalf, TBufferChannel, TIoChannel, WriteHalf};
 
     use super::*;
@@ -690,8 +668,13 @@
     fn must_write_message_begin_0() {
         let (_, mut o_prot) = test_objects();
 
-        assert_success!(o_prot.write_message_begin(&TMessageIdentifier::new("foo", TMessageType::Call, 431)));
+        assert_success!(o_prot.write_message_begin(&TMessageIdentifier::new(
+            "foo",
+            TMessageType::Call,
+            431
+        )));
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 8] = [
             0x82, /* protocol ID */
             0x21, /* message type | protocol version */
@@ -710,10 +693,13 @@
     fn must_write_message_begin_1() {
         let (_, mut o_prot) = test_objects();
 
-        assert_success!(
-            o_prot.write_message_begin(&TMessageIdentifier::new("bar", TMessageType::Reply, 991828))
-        );
+        assert_success!(o_prot.write_message_begin(&TMessageIdentifier::new(
+            "bar",
+            TMessageType::Reply,
+            991828
+        )));
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 9] = [
             0x82, /* protocol ID */
             0x41, /* message type | protocol version */
@@ -777,6 +763,7 @@
         assert_success!(o_prot.write_field_stop());
         assert_success!(o_prot.write_struct_end());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 5] = [
             0x03, /* field type */
             0x00, /* first field id */
@@ -891,6 +878,7 @@
         assert_success!(o_prot.write_field_stop());
         assert_success!(o_prot.write_struct_end());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 4] = [
             0x15, /* field delta (1) | field type */
             0x1A, /* field delta (1) | field type */
@@ -1003,6 +991,7 @@
         assert_success!(o_prot.write_field_stop());
         assert_success!(o_prot.write_struct_end());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 8] = [
             0x05, /* field type */
             0x00, /* first field id */
@@ -1126,6 +1115,7 @@
         assert_success!(o_prot.write_field_stop());
         assert_success!(o_prot.write_struct_end());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 10] = [
             0x16, /* field delta (1) | field type */
             0x85, /* field delta (8) | field type */
@@ -1290,6 +1280,7 @@
         assert_success!(o_prot.write_field_stop());
         assert_success!(o_prot.write_struct_end());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 7] = [
             0x16, /* field delta (1) | field type */
             0x85, /* field delta (8) | field type */
@@ -1462,6 +1453,7 @@
         assert_success!(o_prot.write_field_stop());
         assert_success!(o_prot.write_struct_end());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 7] = [
             0x16, /* field delta (1) | field type */
             0x85, /* field delta (8) | field type */
@@ -1634,6 +1626,7 @@
         assert_success!(o_prot.write_field_stop());
         assert_success!(o_prot.write_struct_end());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 7] = [
             0x16, /* field delta (1) | field type */
             0x08, /* field type */
@@ -1803,6 +1796,7 @@
         assert_success!(o_prot.write_field_stop());
         assert_success!(o_prot.write_struct_end());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 8] = [
             0x16, /* field delta (1) | field type */
             0x08, /* field type */
@@ -1968,6 +1962,7 @@
         assert_success!(o_prot.write_field_stop());
         assert_success!(o_prot.write_struct_end());
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 7] = [
             0x11, /* field delta (1) | true */
             0x82, /* field delta (8) | false */
@@ -2158,8 +2153,7 @@
 
         let expected: [u8; 3] = [
             0xF9, /* 0xF0 | elem_type */
-            0x8F,
-            0x4E /* size as varint */,
+            0x8F, 0x4E, /* size as varint */
         ];
 
         assert_eq_written_bytes!(o_prot, expected);
@@ -2217,9 +2211,7 @@
 
         let expected: [u8; 4] = [
             0xF7, /* 0xF0 | elem_type */
-            0xD3,
-            0xBA,
-            0x01 /* size as varint */,
+            0xD3, 0xBA, 0x01, /* size as varint */
         ];
 
         assert_eq_written_bytes!(o_prot, expected);
@@ -2267,10 +2259,10 @@
         assert_eq!(
             &res,
             &TMapIdentifier {
-                 key_type: None,
-                 value_type: None,
-                 size: 0,
-             }
+                key_type: None,
+                value_type: None,
+                size: 0,
+            }
         );
     }
 
@@ -2278,12 +2270,15 @@
     fn must_write_map_begin() {
         let (_, mut o_prot) = test_objects();
 
-        assert_success!(o_prot.write_map_begin(&TMapIdentifier::new(TType::Double, TType::String, 238)));
+        assert_success!(o_prot.write_map_begin(&TMapIdentifier::new(
+            TType::Double,
+            TType::String,
+            238
+        )));
 
         let expected: [u8; 3] = [
-            0xEE,
-            0x01, /* size as varint */
-            0x78 /* key type | val type */,
+            0xEE, 0x01, /* size as varint */
+            0x78, /* key type | val type */
         ];
 
         assert_eq_written_bytes!(o_prot, expected);
@@ -2321,7 +2316,7 @@
             0x01, /* size as varint */
             0x11, /* key type | val type */
             0x01, /* key: true */
-            0x02 /* val: false */,
+            0x02, /* val: false */
         ];
 
         assert_eq_written_bytes!(o_prot, expected);
@@ -2366,10 +2361,10 @@
         assert!(i_prot.read_map_end().is_ok()); // will blow up if we try to read from empty buffer
     }
 
-    fn test_objects()
-        -> (TCompactInputProtocol<ReadHalf<TBufferChannel>>,
-            TCompactOutputProtocol<WriteHalf<TBufferChannel>>)
-    {
+    fn test_objects() -> (
+        TCompactInputProtocol<ReadHalf<TBufferChannel>>,
+        TCompactOutputProtocol<WriteHalf<TBufferChannel>>,
+    ) {
         let mem = TBufferChannel::with_capacity(80, 80);
 
         let (r_mem, w_mem) = mem.split().unwrap();
diff --git a/lib/rs/src/protocol/mod.rs b/lib/rs/src/protocol/mod.rs
index 4f13914..11c0289 100644
--- a/lib/rs/src/protocol/mod.rs
+++ b/lib/rs/src/protocol/mod.rs
@@ -57,38 +57,34 @@
 //! protocol.write_field_end().unwrap();
 //! ```
 
+use std::convert::From;
 use std::fmt;
 use std::fmt::{Display, Formatter};
-use std::convert::From;
 use try_from::TryFrom;
 
-use {ProtocolError, ProtocolErrorKind};
 use transport::{TReadTransport, TWriteTransport};
+use {ProtocolError, ProtocolErrorKind};
 
 #[cfg(test)]
 macro_rules! assert_eq_written_bytes {
-    ($o_prot:ident, $expected_bytes:ident) => {
-        {
-            assert_eq!($o_prot.transport.write_bytes(), &$expected_bytes);
-        }
-    };
+    ($o_prot:ident, $expected_bytes:ident) => {{
+        assert_eq!($o_prot.transport.write_bytes(), &$expected_bytes);
+    }};
 }
 
 // FIXME: should take both read and write
 #[cfg(test)]
 macro_rules! copy_write_buffer_to_read_buffer {
-    ($o_prot:ident) => {
-        {
-            $o_prot.transport.copy_write_buffer_to_read_buffer();
-        }
-    };
+    ($o_prot:ident) => {{
+        $o_prot.transport.copy_write_buffer_to_read_buffer();
+    }};
 }
 
 #[cfg(test)]
 macro_rules! set_readable_bytes {
     ($i_prot:ident, $bytes:expr) => {
         $i_prot.transport.set_readable_bytes($bytes);
-    }
+    };
 }
 
 mod binary;
@@ -96,10 +92,14 @@
 mod multiplexed;
 mod stored;
 
-pub use self::binary::{TBinaryInputProtocol, TBinaryInputProtocolFactory, TBinaryOutputProtocol,
-                       TBinaryOutputProtocolFactory};
-pub use self::compact::{TCompactInputProtocol, TCompactInputProtocolFactory,
-                        TCompactOutputProtocol, TCompactOutputProtocolFactory};
+pub use self::binary::{
+    TBinaryInputProtocol, TBinaryInputProtocolFactory, TBinaryOutputProtocol,
+    TBinaryOutputProtocolFactory,
+};
+pub use self::compact::{
+    TCompactInputProtocol, TCompactInputProtocolFactory, TCompactOutputProtocol,
+    TCompactOutputProtocolFactory,
+};
 pub use self::multiplexed::TMultiplexedOutputProtocol;
 pub use self::stored::TStoredInputProtocol;
 
@@ -186,14 +186,10 @@
     /// Skip a field with type `field_type` recursively up to `depth` levels.
     fn skip_till_depth(&mut self, field_type: TType, depth: i8) -> ::Result<()> {
         if depth == 0 {
-            return Err(
-                ::Error::Protocol(
-                    ProtocolError {
-                        kind: ProtocolErrorKind::DepthLimit,
-                        message: format!("cannot parse past {:?}", field_type),
-                    },
-                ),
-            );
+            return Err(::Error::Protocol(ProtocolError {
+                kind: ProtocolErrorKind::DepthLimit,
+                message: format!("cannot parse past {:?}", field_type),
+            }));
         }
 
         match field_type {
@@ -243,16 +239,10 @@
                 }
                 self.read_map_end()
             }
-            u => {
-                Err(
-                    ::Error::Protocol(
-                        ProtocolError {
-                            kind: ProtocolErrorKind::Unknown,
-                            message: format!("cannot skip field type {:?}", &u),
-                        },
-                    ),
-                )
-            }
+            u => Err(::Error::Protocol(ProtocolError {
+                kind: ProtocolErrorKind::Unknown,
+                message: format!("cannot skip field type {:?}", &u),
+            })),
         }
     }
 
@@ -787,16 +777,10 @@
             0x02 => Ok(TMessageType::Reply),
             0x03 => Ok(TMessageType::Exception),
             0x04 => Ok(TMessageType::OneWay),
-            unkn => {
-                Err(
-                    ::Error::Protocol(
-                        ProtocolError {
-                            kind: ProtocolErrorKind::InvalidData,
-                            message: format!("cannot convert {} to TMessageType", unkn),
-                        },
-                    ),
-                )
-            }
+            unkn => Err(::Error::Protocol(ProtocolError {
+                kind: ProtocolErrorKind::InvalidData,
+                message: format!("cannot convert {} to TMessageType", unkn),
+            })),
         }
     }
 }
@@ -869,14 +853,10 @@
     if expected == actual {
         Ok(())
     } else {
-        Err(
-            ::Error::Application(
-                ::ApplicationError {
-                    kind: ::ApplicationErrorKind::BadSequenceId,
-                    message: format!("expected {} got {}", expected, actual),
-                },
-            ),
-        )
+        Err(::Error::Application(::ApplicationError {
+            kind: ::ApplicationErrorKind::BadSequenceId,
+            message: format!("expected {} got {}", expected, actual),
+        }))
     }
 }
 
@@ -888,14 +868,10 @@
     if expected == actual {
         Ok(())
     } else {
-        Err(
-            ::Error::Application(
-                ::ApplicationError {
-                    kind: ::ApplicationErrorKind::WrongMethodName,
-                    message: format!("expected {} got {}", expected, actual),
-                },
-            ),
-        )
+        Err(::Error::Application(::ApplicationError {
+            kind: ::ApplicationErrorKind::WrongMethodName,
+            message: format!("expected {} got {}", expected, actual),
+        }))
     }
 }
 
@@ -907,14 +883,10 @@
     if expected == actual {
         Ok(())
     } else {
-        Err(
-            ::Error::Application(
-                ::ApplicationError {
-                    kind: ::ApplicationErrorKind::InvalidMessageType,
-                    message: format!("expected {} got {}", expected, actual),
-                },
-            ),
-        )
+        Err(::Error::Application(::ApplicationError {
+            kind: ::ApplicationErrorKind::InvalidMessageType,
+            message: format!("expected {} got {}", expected, actual),
+        }))
     }
 }
 
@@ -924,16 +896,10 @@
 pub fn verify_required_field_exists<T>(field_name: &str, field: &Option<T>) -> ::Result<()> {
     match *field {
         Some(_) => Ok(()),
-        None => {
-            Err(
-                ::Error::Protocol(
-                    ::ProtocolError {
-                        kind: ::ProtocolErrorKind::Unknown,
-                        message: format!("missing required field {}", field_name),
-                    },
-                ),
-            )
-        }
+        None => Err(::Error::Protocol(::ProtocolError {
+            kind: ::ProtocolErrorKind::Unknown,
+            message: format!("missing required field {}", field_name),
+        })),
     }
 }
 
@@ -943,18 +909,12 @@
 ///
 /// Return `TFieldIdentifier.id` if an id exists, `Err` otherwise.
 pub fn field_id(field_ident: &TFieldIdentifier) -> ::Result<i16> {
-    field_ident
-        .id
-        .ok_or_else(
-            || {
-                ::Error::Protocol(
-                    ::ProtocolError {
-                        kind: ::ProtocolErrorKind::Unknown,
-                        message: format!("missing field in in {:?}", field_ident),
-                    },
-                )
-            },
-        )
+    field_ident.id.ok_or_else(|| {
+        ::Error::Protocol(::ProtocolError {
+            kind: ::ProtocolErrorKind::Unknown,
+            message: format!("missing field in in {:?}", field_ident),
+        })
+    })
 }
 
 #[cfg(test)]
diff --git a/lib/rs/src/protocol/multiplexed.rs b/lib/rs/src/protocol/multiplexed.rs
index db08027..aaee44f 100644
--- a/lib/rs/src/protocol/multiplexed.rs
+++ b/lib/rs/src/protocol/multiplexed.rs
@@ -15,8 +15,10 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use super::{TFieldIdentifier, TListIdentifier, TMapIdentifier, TMessageIdentifier, TMessageType,
-            TOutputProtocol, TSetIdentifier, TStructIdentifier};
+use super::{
+    TFieldIdentifier, TListIdentifier, TMapIdentifier, TMessageIdentifier, TMessageType,
+    TOutputProtocol, TSetIdentifier, TStructIdentifier,
+};
 
 /// `TOutputProtocol` that prefixes the service name to all outgoing Thrift
 /// messages.
@@ -81,7 +83,8 @@
     P: TOutputProtocol,
 {
     fn write_message_begin(&mut self, identifier: &TMessageIdentifier) -> ::Result<()> {
-        match identifier.message_type { // FIXME: is there a better way to override identifier here?
+        match identifier.message_type {
+            // FIXME: is there a better way to override identifier here?
             TMessageType::Call | TMessageType::OneWay => {
                 let identifier = TMessageIdentifier {
                     name: format!("{}:{}", self.service_name, identifier.name),
@@ -200,6 +203,7 @@
         let ident = TMessageIdentifier::new("bar", TMessageType::Call, 2);
         assert_success!(o_prot.write_message_begin(&ident));
 
+        #[cfg_attr(rustfmt, rustfmt::skip)]
         let expected: [u8; 19] = [
             0x80,
             0x01, /* protocol identifier */
@@ -225,9 +229,7 @@
         assert_eq!(o_prot.inner.transport.write_bytes(), expected);
     }
 
-    fn test_objects
-        ()
-        -> TMultiplexedOutputProtocol<TBinaryOutputProtocol<WriteHalf<TBufferChannel>>>
+    fn test_objects() -> TMultiplexedOutputProtocol<TBinaryOutputProtocol<WriteHalf<TBufferChannel>>>
     {
         let c = TBufferChannel::with_capacity(40, 40);
         let (_, w_chan) = c.split().unwrap();
diff --git a/lib/rs/src/protocol/stored.rs b/lib/rs/src/protocol/stored.rs
index b3f305f..8c55978 100644
--- a/lib/rs/src/protocol/stored.rs
+++ b/lib/rs/src/protocol/stored.rs
@@ -17,9 +17,11 @@
 
 use std::convert::Into;
 
+use super::{
+    TFieldIdentifier, TInputProtocol, TListIdentifier, TMapIdentifier, TMessageIdentifier,
+    TSetIdentifier, TStructIdentifier,
+};
 use ProtocolErrorKind;
-use super::{TFieldIdentifier, TInputProtocol, TListIdentifier, TMapIdentifier, TMessageIdentifier,
-            TSetIdentifier, TStructIdentifier};
 
 /// `TInputProtocol` required to use a `TMultiplexedProcessor`.
 ///
@@ -101,16 +103,12 @@
 
 impl<'a> TInputProtocol for TStoredInputProtocol<'a> {
     fn read_message_begin(&mut self) -> ::Result<TMessageIdentifier> {
-        self.message_ident
-            .take()
-            .ok_or_else(
-                || {
-                    ::errors::new_protocol_error(
-                        ProtocolErrorKind::Unknown,
-                        "message identifier already read",
-                    )
-                },
+        self.message_ident.take().ok_or_else(|| {
+            ::errors::new_protocol_error(
+                ProtocolErrorKind::Unknown,
+                "message identifier already read",
             )
+        })
     }
 
     fn read_message_end(&mut self) -> ::Result<()> {