Skip to content

Commit

Permalink
Apply clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
morr0ne committed Nov 21, 2024
1 parent 8e7d8d7 commit 8e023ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/wire/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl Message {
pub fn string(&mut self) -> Result<Option<String>, DecodeError> {
let mut array = self.array()?;

if array.len() == 0 {
if array.is_empty() {
return Ok(None);
}

Expand Down
6 changes: 6 additions & 0 deletions src/wire/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ pub struct PayloadBuilder {
fds: Vec<RawFd>,
}

impl Default for PayloadBuilder {
fn default() -> Self {
Self::new()
}
}

impl PayloadBuilder {
pub fn new() -> Self {
Self {
Expand Down
9 changes: 3 additions & 6 deletions src/wire/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,9 @@ impl Stream for Socket {
let frame = pinned
.codec
.decode_eof(&mut state.buffer, &mut state.fds)
.map_err(|err| {
.inspect_err(|err| {
trace!("Got an error, going to errored state");
state.has_errored = true;
err
})?;
if frame.is_none() {
state.is_readable = false; // prepare pausing -> paused
Expand All @@ -157,10 +156,9 @@ impl Stream for Socket {
if let Some(frame) = pinned
.codec
.decode(&mut state.buffer, &mut state.fds)
.map_err(|op| {
.inspect_err(|op| {
trace!("Got an error, going to errored state");
state.has_errored = true;
op
})?
{
trace!("frame decoded from buffer");
Expand Down Expand Up @@ -269,8 +267,7 @@ impl Sink<Message> for Socket {
io::ErrorKind::WriteZero,
"failed to \
write frame to transport",
)
.into()));
)));
}

return Poll::Ready(Ok(()));
Expand Down

0 comments on commit 8e023ce

Please sign in to comment.