diff --git a/src/handshake/client.rs b/src/handshake/client.rs index 15494f9..fc2581d 100644 --- a/src/handshake/client.rs +++ b/src/handshake/client.rs @@ -113,7 +113,7 @@ impl ClientHandshake { }; trace!("Client handshake initiated."); - MidHandshake { role: client, machine: machine } + MidHandshake { role: client, machine } } } diff --git a/src/handshake/headers.rs b/src/handshake/headers.rs index 73419b6..23f0d77 100644 --- a/src/handshake/headers.rs +++ b/src/handshake/headers.rs @@ -28,7 +28,7 @@ impl Headers { /// Iterate over all headers with the given name. pub fn find<'headers, 'name>(&'headers self, name: &'name str) -> HeadersIter<'name, 'headers> { HeadersIter { - name: name, + name, iter: self.data.iter() } } diff --git a/src/handshake/machine.rs b/src/handshake/machine.rs index a945be1..39f37a5 100644 --- a/src/handshake/machine.rs +++ b/src/handshake/machine.rs @@ -16,14 +16,14 @@ impl HandshakeMachine { /// Start reading data from the peer. pub fn start_read(stream: Stream) -> Self { HandshakeMachine { - stream: stream, + stream, state: HandshakeState::Reading(InputBuffer::with_capacity(MIN_READ)), } } /// Start writing data to the peer. pub fn start_write>>(stream: Stream, data: D) -> Self { HandshakeMachine { - stream: stream, + stream, state: HandshakeState::Writing(Cursor::new(data.into())), } } diff --git a/src/protocol/frame/frame.rs b/src/protocol/frame/frame.rs index cee9b00..4c9cc83 100644 --- a/src/protocol/frame/frame.rs +++ b/src/protocol/frame/frame.rs @@ -296,7 +296,7 @@ impl Frame { let code = NetworkEndian::read_u16(&data[0..2]).into(); data.drain(0..2); let text = String::from_utf8(data)?; - Ok(Some(CloseFrame { code: code, reason: text.into() })) + Ok(Some(CloseFrame { code, reason: text.into() })) } } } @@ -357,7 +357,7 @@ impl Frame { Frame { header: FrameHeader::default(), - payload: payload, + payload, } } diff --git a/src/protocol/frame/mod.rs b/src/protocol/frame/mod.rs index 470a795..9d17338 100644 --- a/src/protocol/frame/mod.rs +++ b/src/protocol/frame/mod.rs @@ -30,7 +30,7 @@ impl FrameSocket { /// Create a new frame socket. pub fn new(stream: Stream) -> Self { FrameSocket { - stream: stream, + stream, in_buffer: InputBuffer::with_capacity(MIN_READ), out_buffer: Vec::new(), header: None, @@ -40,7 +40,7 @@ impl FrameSocket { /// Create a new frame socket from partially read data. pub fn from_partially_read(stream: Stream, part: Vec) -> Self { FrameSocket { - stream: stream, + stream, in_buffer: InputBuffer::from_partially_read(part), out_buffer: Vec::new(), header: None, diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index e35b9b7..7fb2259 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -116,8 +116,8 @@ impl WebSocket { config: Option ) -> Self { WebSocket { - role: role, - socket: socket, + role, + socket, state: WebSocketState::Active, incomplete: None, send_queue: VecDeque::new(),