mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-28 11:39:07 +00:00
Fix some lint warnings
This commit is contained in:
parent
4c90e026f7
commit
735c8c366a
@ -16,11 +16,3 @@ pub(crate) fn get_str(src: &[u8]) -> io::Result<&str> {
|
||||
|
||||
Ok(s)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn get_str_bytes_unchecked(src: &Bytes) -> Bytes {
|
||||
let end = memchr(b'\0', &src).unwrap();
|
||||
let buf = src.slice_to(end);
|
||||
|
||||
buf
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ pub enum Message {
|
||||
ParameterStatus(ParameterStatus),
|
||||
BackendKeyData(BackendKeyData),
|
||||
ReadyForQuery(ReadyForQuery),
|
||||
Response(Response),
|
||||
Response(Box<Response>),
|
||||
}
|
||||
|
||||
impl Message {
|
||||
@ -41,7 +41,7 @@ impl Message {
|
||||
let src = src.split_to(len + 1).freeze().slice_from(5);
|
||||
|
||||
Ok(Some(match token {
|
||||
b'N' | b'E' => Message::Response(Response::decode(src)?),
|
||||
b'N' | b'E' => Message::Response(Box::new(Response::decode(src)?)),
|
||||
b'S' => Message::ParameterStatus(ParameterStatus::decode(src)?),
|
||||
b'Z' => Message::ReadyForQuery(ReadyForQuery::decode(src)?),
|
||||
b'R' => Message::Authentication(Authentication::decode(src)?),
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use crate::{decode::get_str_bytes_unchecked, Decode};
|
||||
use crate::Decode;
|
||||
use bytes::Bytes;
|
||||
use std::{io, str};
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ impl PasswordMessage {
|
||||
}
|
||||
|
||||
/// Create a `PasswordMessage` by hasing the password, user, and salt together using MD5.
|
||||
pub fn md5(password: &str, user: &str, salt: &[u8; 4]) -> Self {
|
||||
pub fn md5(password: &str, user: &str, salt: [u8; 4]) -> Self {
|
||||
let mut hasher = Md5::new();
|
||||
|
||||
hasher.input(password);
|
||||
|
||||
@ -22,14 +22,14 @@ pub enum Severity {
|
||||
}
|
||||
|
||||
impl Severity {
|
||||
pub fn is_error(&self) -> bool {
|
||||
pub fn is_error(self) -> bool {
|
||||
match self {
|
||||
Severity::Panic | Severity::Fatal | Severity::Error => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_notice(&self) -> bool {
|
||||
pub fn is_notice(self) -> bool {
|
||||
match self {
|
||||
Severity::Warning
|
||||
| Severity::Notice
|
||||
@ -41,7 +41,7 @@ impl Severity {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
pub fn to_str(self) -> &'static str {
|
||||
match self {
|
||||
Severity::Panic => "PANIC",
|
||||
Severity::Fatal => "FATAL",
|
||||
|
||||
@ -59,7 +59,7 @@ pub async fn establish<'a, 'b: 'a>(
|
||||
conn.send(PasswordMessage::md5(
|
||||
options.password.unwrap_or_default(),
|
||||
options.user.unwrap_or_default(),
|
||||
&salt,
|
||||
salt,
|
||||
))
|
||||
.await?;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user