Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
codec: no need to clear empty buffer, can check BytesMut directly wit…
Browse files Browse the repository at this point in the history
…hout as_ref
  • Loading branch information
stbuehler authored and cathay4t committed Jun 22, 2022
1 parent c65da74 commit 9cdc870
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions netlink-packet-audit/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ impl NetlinkMessageCodec for NetlinkAuditCodec {

loop {
// If there's nothing to read, return Ok(None)
if src.as_ref().is_empty() {
if src.is_empty() {
trace!("buffer is empty");
src.clear();
return Ok(None);
}

Expand Down
3 changes: 1 addition & 2 deletions netlink-proto/src/codecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ impl NetlinkMessageCodec for NetlinkCodec {

loop {
// If there's nothing to read, return Ok(None)
if src.as_ref().is_empty() {
if src.is_empty() {
trace!("buffer is empty");
src.clear();
return Ok(None);
}

Expand Down

0 comments on commit 9cdc870

Please sign in to comment.