Skip to content

Commit ba38dca

Browse files
Fix latest clippy warnings
1 parent 75c51d9 commit ba38dca

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

src/error/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,10 @@ impl From<PacketCodecError> for IoError {
315315
fn from(err: PacketCodecError) -> Self {
316316
match err {
317317
PacketCodecError::Io(err) => err.into(),
318-
PacketCodecError::PacketTooLarge => {
319-
io::Error::new(io::ErrorKind::Other, "packet too large").into()
320-
}
321-
PacketCodecError::PacketsOutOfSync => {
322-
io::Error::new(io::ErrorKind::Other, "packet out of order").into()
323-
}
318+
PacketCodecError::PacketTooLarge => io::Error::other("packet too large").into(),
319+
PacketCodecError::PacketsOutOfSync => io::Error::other("packet out of order").into(),
324320
PacketCodecError::BadCompressedPacketHeader => {
325-
io::Error::new(io::ErrorKind::Other, "bad compressed packet header").into()
321+
io::Error::other("bad compressed packet header").into()
326322
}
327323
}
328324
}

src/opts/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub enum PathOrBuf<'a> {
149149

150150
impl<'a> PathOrBuf<'a> {
151151
/// Will either read data from disk or return the buffered data.
152-
pub async fn read(&self) -> io::Result<Cow<[u8]>> {
152+
pub async fn read(&self) -> io::Result<Cow<'_, [u8]>> {
153153
match self {
154154
PathOrBuf::Path(x) => tokio::fs::read(x.as_ref()).await.map(Cow::Owned),
155155
PathOrBuf::Buf(x) => Ok(Cow::Borrowed(x.as_ref())),

src/queryable/query_result/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ where
100100
self.conn
101101
.get_pending_result()
102102
.map(|pending_result| match pending_result {
103-
Some(PendingResult::Pending(meta)) => meta.columns().len() > 0,
104-
Some(PendingResult::Taken(meta)) => meta.columns().len() > 0,
103+
Some(PendingResult::Pending(meta)) => !meta.columns().is_empty(),
104+
Some(PendingResult::Taken(meta)) => !meta.columns().is_empty(),
105105
None => false,
106106
})
107107
.unwrap_or(false)

src/queryable/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'a> Transaction<'a> {
154154
}
155155

156156
if let Some(isolation_level) = isolation_level {
157-
let query = format!("SET TRANSACTION ISOLATION LEVEL {}", isolation_level);
157+
let query = format!("SET TRANSACTION ISOLATION LEVEL {isolation_level}");
158158
conn.as_mut().query_drop(query).await?;
159159
}
160160

0 commit comments

Comments
 (0)