Skip to content

Commit 3f4b735

Browse files
committed
clippy
1 parent e9566e9 commit 3f4b735

File tree

7 files changed

+34
-20
lines changed

7 files changed

+34
-20
lines changed

src/collations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ pub struct Collation<'a> {
648648
/// JOIN INFORMATION_SCHEMA.CHARACTER_SETS
649649
/// USING(CHARACTER_SET_NAME) ORDER BY ID;
650650
/// ```
651-
impl<'a> Collation<'a> {
651+
impl Collation<'_> {
652652
/// This is a stub.
653653
const UNKNOWN_COLLATION: Collation<'static> = Collation {
654654
id: CollationId::UNKNOWN_COLLATION_ID,

src/misc/raw/seq.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use super::{
2525
#[repr(transparent)]
2626
pub struct Seq<'a, T: Clone, U>(pub Cow<'a, [T]>, PhantomData<U>);
2727

28-
impl<'a, T: Clone, U> Deref for Seq<'a, T, U> {
28+
impl<T: Clone, U> Deref for Seq<'_, T, U> {
2929
type Target = [T];
3030

3131
fn deref(&self) -> &Self::Target {
@@ -68,7 +68,7 @@ impl<'a, T: Clone, U> Seq<'a, T, U> {
6868
}
6969
}
7070

71-
impl<'a, T: Clone, U> Default for Seq<'a, T, U> {
71+
impl<T: Clone, U> Default for Seq<'_, T, U> {
7272
fn default() -> Self {
7373
Seq::new(Vec::new())
7474
}
@@ -185,7 +185,7 @@ impl<'a, T: IntRepr, U> RawSeq<'a, T, U> {
185185
}
186186
}
187187

188-
impl<'a, T: IntRepr, U> RawSeq<'a, T, U>
188+
impl<T: IntRepr, U> RawSeq<'_, T, U>
189189
where
190190
T: Copy,
191191
U: TryFrom<T::Primitive>,

src/packets/caching_sha2_password.rs

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ impl PublicKeyRequest {
2828
}
2929
}
3030

31+
impl Default for PublicKeyRequest {
32+
fn default() -> Self {
33+
Self::new()
34+
}
35+
}
36+
3137
impl<'de> MyDeserialize<'de> for PublicKeyRequest {
3238
const SIZE: Option<usize> = None;
3339
type Ctx = ();

src/packets/mod.rs

+21-13
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct ColumnMeta<'a> {
120120
org_name: RawBytes<'a, LenEnc>,
121121
}
122122

123-
impl<'a> ColumnMeta<'a> {
123+
impl ColumnMeta<'_> {
124124
pub fn into_owned(self) -> ColumnMeta<'static> {
125125
ColumnMeta {
126126
schema: self.schema.into_owned(),
@@ -428,7 +428,7 @@ pub struct SessionStateInfo<'a> {
428428
data: RawBytes<'a, LenEnc>,
429429
}
430430

431-
impl<'a> SessionStateInfo<'a> {
431+
impl SessionStateInfo<'_> {
432432
pub fn into_owned(self) -> SessionStateInfo<'static> {
433433
let SessionStateInfo { data_type, data } = self;
434434
SessionStateInfo {
@@ -678,7 +678,7 @@ pub struct OkPacket<'a> {
678678
session_state_info: Option<RawBytes<'a, LenEnc>>,
679679
}
680680

681-
impl<'a> OkPacket<'a> {
681+
impl OkPacket<'_> {
682682
pub fn into_owned(self) -> OkPacket<'static> {
683683
OkPacket {
684684
affected_rows: self.affected_rows,
@@ -864,7 +864,7 @@ impl MySerialize for ProgressReport<'_> {
864864
}
865865
}
866866

867-
impl<'a> fmt::Display for ProgressReport<'a> {
867+
impl fmt::Display for ProgressReport<'_> {
868868
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
869869
write!(
870870
f,
@@ -892,7 +892,7 @@ pub enum ErrPacket<'a> {
892892
Progress(ProgressReport<'a>),
893893
}
894894

895-
impl<'a> ErrPacket<'a> {
895+
impl ErrPacket<'_> {
896896
/// Returns false if this error packet contains progress report.
897897
pub fn is_error(&self) -> bool {
898898
matches!(self, ErrPacket::Error { .. })
@@ -957,7 +957,7 @@ impl MySerialize for ErrPacket<'_> {
957957
}
958958
}
959959

960-
impl<'a> fmt::Display for ErrPacket<'a> {
960+
impl fmt::Display for ErrPacket<'_> {
961961
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
962962
match self {
963963
ErrPacket::Error(server_error) => write!(f, "{}", server_error),
@@ -1190,7 +1190,7 @@ pub enum AuthPluginData<'a> {
11901190
Clear(Cow<'a, [u8]>),
11911191
}
11921192

1193-
impl<'a> AuthPluginData<'a> {
1193+
impl AuthPluginData<'_> {
11941194
pub fn into_owned(self) -> AuthPluginData<'static> {
11951195
match self {
11961196
AuthPluginData::Old(x) => AuthPluginData::Old(x),
@@ -1667,6 +1667,7 @@ impl MySerialize for HandshakePacket<'_> {
16671667
}
16681668

16691669
impl<'a> HandshakePacket<'a> {
1670+
#[allow(clippy::too_many_arguments)]
16701671
pub fn new(
16711672
protocol_version: u8,
16721673
server_version: impl Into<Cow<'a, [u8]>>,
@@ -1898,6 +1899,12 @@ impl<'a> ComChangeUser<'a> {
18981899
}
18991900
}
19001901

1902+
impl Default for ComChangeUser<'_> {
1903+
fn default() -> Self {
1904+
Self::new()
1905+
}
1906+
}
1907+
19011908
impl<'de> MyDeserialize<'de> for ComChangeUser<'de> {
19021909
const SIZE: Option<usize> = None;
19031910

@@ -2042,7 +2049,7 @@ impl<'de> MyDeserialize<'de> for ComChangeUserMoreData<'de> {
20422049
}
20432050
}
20442051

2045-
impl<'a> MySerialize for ComChangeUserMoreData<'a> {
2052+
impl MySerialize for ComChangeUserMoreData<'_> {
20462053
fn serialize(&self, buf: &mut Vec<u8>) {
20472054
self.character_set.serialize(&mut *buf);
20482055
if let Some(ref auth_plugin) = self.auth_plugin {
@@ -2075,6 +2082,7 @@ pub struct HandshakeResponse<'a> {
20752082
}
20762083

20772084
impl<'a> HandshakeResponse<'a> {
2085+
#[allow(clippy::too_many_arguments)]
20782086
pub fn new(
20792087
scramble_buf: Option<impl Into<Cow<'a, [u8]>>>,
20802088
server_version: (u16, u16, u16),
@@ -2789,7 +2797,7 @@ impl<'a> ComRegisterSlave<'a> {
27892797
}
27902798

27912799
/// Returns the raw `hostname` field value.
2792-
pub fn hostname_raw(&'a self) -> &[u8] {
2800+
pub fn hostname_raw(&self) -> &[u8] {
27932801
self.hostname.as_bytes()
27942802
}
27952803

@@ -2799,7 +2807,7 @@ impl<'a> ComRegisterSlave<'a> {
27992807
}
28002808

28012809
/// Returns the raw `user` field value.
2802-
pub fn user_raw(&'a self) -> &[u8] {
2810+
pub fn user_raw(&self) -> &[u8] {
28032811
self.user.as_bytes()
28042812
}
28052813

@@ -2809,7 +2817,7 @@ impl<'a> ComRegisterSlave<'a> {
28092817
}
28102818

28112819
/// Returns the raw `password` field value.
2812-
pub fn password_raw(&'a self) -> &[u8] {
2820+
pub fn password_raw(&self) -> &[u8] {
28132821
self.password.as_bytes()
28142822
}
28152823

@@ -3140,7 +3148,7 @@ pub struct Sid<'a> {
31403148
intervals: Seq<'a, GnoInterval, LeU64>,
31413149
}
31423150

3143-
impl<'a> Sid<'a> {
3151+
impl Sid<'_> {
31443152
/// Creates a new instance.
31453153
pub fn new(uuid: [u8; UUID_LEN]) -> Self {
31463154
Self {
@@ -3217,7 +3225,7 @@ impl Sid<'_> {
32173225
}
32183226
}
32193227

3220-
impl<'a> FromStr for Sid<'a> {
3228+
impl FromStr for Sid<'_> {
32213229
type Err = io::Error;
32223230

32233231
fn from_str(s: &str) -> Result<Self, Self::Err> {

src/packets/session_state_change.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub enum SessionStateChange<'a> {
3131
Unsupported(Unsupported<'a>),
3232
}
3333

34-
impl<'a> SessionStateChange<'a> {
34+
impl SessionStateChange<'_> {
3535
pub fn into_owned(self) -> SessionStateChange<'static> {
3636
match self {
3737
SessionStateChange::SystemVariables(x) => SessionStateChange::SystemVariables(

src/row/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl ColumnIndex for usize {
213213
}
214214
}
215215

216-
impl<'a> ColumnIndex for &'a str {
216+
impl ColumnIndex for &'_ str {
217217
fn idx(&self, columns: &[Column]) -> Option<usize> {
218218
for (i, c) in columns.iter().enumerate() {
219219
if c.name_ref() == self.as_bytes() {

src/value/convert/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ lazy_static::lazy_static! {
4444
}
4545

4646
/// Returns (year, month, day, hour, minute, second, micros)
47-
#[cfg(any(feature = "chrono"))]
47+
#[cfg(feature = "chrono")]
4848
fn parse_mysql_datetime_string(bytes: &[u8]) -> Option<(u32, u32, u32, u32, u32, u32, u32)> {
4949
let len = bytes.len();
5050

0 commit comments

Comments
 (0)