chore: fix clippy warnings in newer versions (#3588)

This commit is contained in:
cssivision
2021-03-10 08:42:24 +01:00
committed by GitHub
parent 8c5cde9bc3
commit bcb95db4e2
7 changed files with 12 additions and 21 deletions
+4 -4
View File
@@ -535,14 +535,14 @@ impl LengthDelimitedCodec {
Ok(Some(n))
}
fn decode_data(&self, n: usize, src: &mut BytesMut) -> io::Result<Option<BytesMut>> {
fn decode_data(&self, n: usize, src: &mut BytesMut) -> Option<BytesMut> {
// At this point, the buffer has already had the required capacity
// reserved. All there is to do is read.
if src.len() < n {
return Ok(None);
return None;
}
Ok(Some(src.split_to(n)))
Some(src.split_to(n))
}
}
@@ -562,7 +562,7 @@ impl Decoder for LengthDelimitedCodec {
DecodeState::Data(n) => n,
};
match self.decode_data(n, src)? {
match self.decode_data(n, src) {
Some(data) => {
// Update the decode state
self.state = DecodeState::Head;
+1 -4
View File
@@ -126,10 +126,7 @@ impl<T: Send + 'static> PollSender<T> {
/// If this method returns `None`, then the channel is closed. (But it is
/// not guaranteed to return `None` if the channel is closed.)
pub fn clone_inner(&self) -> Option<Sender<T>> {
match &self.sender {
Some(sender) => Some((&**sender).clone()),
None => None,
}
self.sender.as_ref().map(|sender| (&**sender).clone())
}
/// Access the underlying `Sender`.