diff options
Diffstat (limited to 'vendor/gix-packetline/src/read')
-rw-r--r-- | vendor/gix-packetline/src/read/async_io.rs | 9 | ||||
-rw-r--r-- | vendor/gix-packetline/src/read/blocking_io.rs | 9 | ||||
-rw-r--r-- | vendor/gix-packetline/src/read/mod.rs | 2 | ||||
-rw-r--r-- | vendor/gix-packetline/src/read/sidebands/async_io.rs | 8 | ||||
-rw-r--r-- | vendor/gix-packetline/src/read/sidebands/blocking_io.rs | 6 |
5 files changed, 14 insertions, 20 deletions
diff --git a/vendor/gix-packetline/src/read/async_io.rs b/vendor/gix-packetline/src/read/async_io.rs index bb4dcf2c1..402c2434b 100644 --- a/vendor/gix-packetline/src/read/async_io.rs +++ b/vendor/gix-packetline/src/read/async_io.rs @@ -37,7 +37,7 @@ where } /// This function is needed to help the borrow checker allow us to return references all the time - /// It contains a bunch of logic shared between peek and read_line invocations. + /// It contains a bunch of logic shared between peek and `read_line` invocations. async fn read_line_inner_exhaustive<'a>( reader: &mut T, buf: &'a mut Vec<u8>, @@ -51,7 +51,7 @@ where Some(match Self::read_line_inner(reader, buf).await { Ok(Ok(line)) => { if delimiters.contains(&line) { - let stopped_at = delimiters.iter().find(|l| **l == line).cloned(); + let stopped_at = delimiters.iter().find(|l| **l == line).copied(); buf.clear(); return (true, stopped_at, None); } else if fail_on_err_lines { @@ -68,10 +68,7 @@ where ); } } - let len = line - .as_slice() - .map(|s| s.len() + U16_HEX_BYTES) - .unwrap_or(U16_HEX_BYTES); + let len = line.as_slice().map_or(U16_HEX_BYTES, |s| s.len() + U16_HEX_BYTES); if buf_resize { buf.resize(len, 0); } diff --git a/vendor/gix-packetline/src/read/blocking_io.rs b/vendor/gix-packetline/src/read/blocking_io.rs index 6af660b7f..50c634c4c 100644 --- a/vendor/gix-packetline/src/read/blocking_io.rs +++ b/vendor/gix-packetline/src/read/blocking_io.rs @@ -31,7 +31,7 @@ where } /// This function is needed to help the borrow checker allow us to return references all the time - /// It contains a bunch of logic shared between peek and read_line invocations. + /// It contains a bunch of logic shared between peek and `read_line` invocations. fn read_line_inner_exhaustive<'a>( reader: &mut T, buf: &'a mut Vec<u8>, @@ -45,7 +45,7 @@ where Some(match Self::read_line_inner(reader, buf) { Ok(Ok(line)) => { if delimiters.contains(&line) { - let stopped_at = delimiters.iter().find(|l| **l == line).cloned(); + let stopped_at = delimiters.iter().find(|l| **l == line).copied(); buf.clear(); return (true, stopped_at, None); } else if fail_on_err_lines { @@ -62,10 +62,7 @@ where ); } } - let len = line - .as_slice() - .map(|s| s.len() + U16_HEX_BYTES) - .unwrap_or(U16_HEX_BYTES); + let len = line.as_slice().map_or(U16_HEX_BYTES, |s| s.len() + U16_HEX_BYTES); if buf_resize { buf.resize(len, 0); } diff --git a/vendor/gix-packetline/src/read/mod.rs b/vendor/gix-packetline/src/read/mod.rs index e06b90d13..0fd30c892 100644 --- a/vendor/gix-packetline/src/read/mod.rs +++ b/vendor/gix-packetline/src/read/mod.rs @@ -95,7 +95,7 @@ impl<T> StreamingPeekableIter<T> { /// If `value` is `true` the provider will check for special `ERR` packet lines and stop iteration when one is encountered. /// - /// Use [`stopped_at()]`[StreamingPeekableIter::stopped_at()] to inspect the cause of the end of the iteration. + /// Use [`stopped_at()]`[`StreamingPeekableIter::stopped_at()`] to inspect the cause of the end of the iteration. /// ne pub fn fail_on_err_lines(&mut self, value: bool) { self.fail_on_err_lines = value; diff --git a/vendor/gix-packetline/src/read/sidebands/async_io.rs b/vendor/gix-packetline/src/read/sidebands/async_io.rs index 96973a36f..37f93bca9 100644 --- a/vendor/gix-packetline/src/read/sidebands/async_io.rs +++ b/vendor/gix-packetline/src/read/sidebands/async_io.rs @@ -77,7 +77,7 @@ mod tests { use super::*; fn receiver<T: Send>(_i: T) {} - /// We want to declare items containing pointers of StreamingPeekableIter `Send` as well, so it must be `Send` itself. + /// We want to declare items containing pointers of `StreamingPeekableIter` `Send` as well, so it must be `Send` itself. #[test] fn streaming_peekable_iter_is_send() { receiver(StreamingPeekableIter::new(Vec::<u8>::new(), &[])); @@ -118,7 +118,7 @@ where } } - /// Forwards to the parent [StreamingPeekableIter::reset_with()] + /// Forwards to the parent [`StreamingPeekableIter::reset_with()`] pub fn reset_with(&mut self, delimiters: &'static [PacketLineRef<'static>]) { if let State::Idle { ref mut parent } = self.state { parent @@ -128,7 +128,7 @@ where } } - /// Forwards to the parent [StreamingPeekableIter::stopped_at()] + /// Forwards to the parent [`StreamingPeekableIter::stopped_at()`] pub fn stopped_at(&self) -> Option<PacketLineRef<'static>> { match self.state { State::Idle { ref parent } => { @@ -146,7 +146,7 @@ where self.handle_progress = handle_progress; } - /// Effectively forwards to the parent [StreamingPeekableIter::peek_line()], allowing to see what would be returned + /// Effectively forwards to the parent [`StreamingPeekableIter::peek_line()`], allowing to see what would be returned /// next on a call to [`read_line()`][io::BufRead::read_line()]. /// /// # Warning diff --git a/vendor/gix-packetline/src/read/sidebands/blocking_io.rs b/vendor/gix-packetline/src/read/sidebands/blocking_io.rs index 20c4a2bce..f5c87aeb8 100644 --- a/vendor/gix-packetline/src/read/sidebands/blocking_io.rs +++ b/vendor/gix-packetline/src/read/sidebands/blocking_io.rs @@ -67,12 +67,12 @@ where } } - /// Forwards to the parent [StreamingPeekableIter::reset_with()] + /// Forwards to the parent [`StreamingPeekableIter::reset_with()`] pub fn reset_with(&mut self, delimiters: &'static [PacketLineRef<'static>]) { self.parent.reset_with(delimiters) } - /// Forwards to the parent [StreamingPeekableIter::stopped_at()] + /// Forwards to the parent [`StreamingPeekableIter::stopped_at()`] pub fn stopped_at(&self) -> Option<PacketLineRef<'static>> { self.parent.stopped_at } @@ -82,7 +82,7 @@ where self.handle_progress = handle_progress; } - /// Effectively forwards to the parent [StreamingPeekableIter::peek_line()], allowing to see what would be returned + /// Effectively forwards to the parent [`StreamingPeekableIter::peek_line()`], allowing to see what would be returned /// next on a call to [`read_line()`][io::BufRead::read_line()]. /// /// # Warning |