Skip to content

Fix clippy warnings / Update lru and webpki-roots #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ futures-core = "0.3"
futures-util = "0.3"
futures-sink = "0.3"
keyed_priority_queue = "0.4"
lru = "0.14.0"
lru = "0.16.0"
mysql_common = { version = "0.35.4", default-features = false }
pem = "3.0"
percent-encoding = "2.1.0"
Expand Down Expand Up @@ -62,7 +62,7 @@ version = "2.1.0"
optional = true

[dependencies.webpki-roots]
version = "0.26.1"
version = "1.0.0"
optional = true

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/conn/routines/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Routine<Arc<StmtInner>> for PrepareRoutine {
// The statement may contain sensitive data. Restrict to DEBUG.
span.record(
"mysql_async.query.sql",
String::from_utf8_lossy(&*self.query).as_ref(),
String::from_utf8_lossy(&self.query).as_ref(),
);
}

Expand Down
10 changes: 3 additions & 7 deletions src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,10 @@ impl From<PacketCodecError> for IoError {
fn from(err: PacketCodecError) -> Self {
match err {
PacketCodecError::Io(err) => err.into(),
PacketCodecError::PacketTooLarge => {
io::Error::new(io::ErrorKind::Other, "packet too large").into()
}
PacketCodecError::PacketsOutOfSync => {
io::Error::new(io::ErrorKind::Other, "packet out of order").into()
}
PacketCodecError::PacketTooLarge => io::Error::other("packet too large").into(),
PacketCodecError::PacketsOutOfSync => io::Error::other("packet out of order").into(),
PacketCodecError::BadCompressedPacketHeader => {
io::Error::new(io::ErrorKind::Other, "bad compressed packet header").into()
io::Error::other("bad compressed packet header").into()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/opts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub enum PathOrBuf<'a> {

impl<'a> PathOrBuf<'a> {
/// Will either read data from disk or return the buffered data.
pub async fn read(&self) -> io::Result<Cow<[u8]>> {
pub async fn read(&self) -> io::Result<Cow<'_, [u8]>> {
match self {
PathOrBuf::Path(x) => tokio::fs::read(x.as_ref()).await.map(Cow::Owned),
PathOrBuf::Buf(x) => Ok(Cow::Borrowed(x.as_ref())),
Expand Down
4 changes: 2 additions & 2 deletions src/queryable/query_result/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ where
self.conn
.get_pending_result()
.map(|pending_result| match pending_result {
Some(PendingResult::Pending(meta)) => meta.columns().len() > 0,
Some(PendingResult::Taken(meta)) => meta.columns().len() > 0,
Some(PendingResult::Pending(meta)) => !meta.columns().is_empty(),
Some(PendingResult::Taken(meta)) => !meta.columns().is_empty(),
None => false,
})
.unwrap_or(false)
Expand Down
2 changes: 1 addition & 1 deletion src/queryable/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl<'a> Transaction<'a> {
}

if let Some(isolation_level) = isolation_level {
let query = format!("SET TRANSACTION ISOLATION LEVEL {}", isolation_level);
let query = format!("SET TRANSACTION ISOLATION LEVEL {isolation_level}");
conn.as_mut().query_drop(query).await?;
}

Expand Down
Loading