Skip to content

Commit a52a6f2

Browse files
committed
Fix clippy in test
1 parent 6377436 commit a52a6f2

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

src/params.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ impl<'a> Iterator for Params<'a> {
7373
self.bound_types.clear();
7474
for i in 0..self.params as usize {
7575
self.bound_types.push((
76-
myc::constants::ColumnType::try_from(typmap[2 * i as usize])
77-
.unwrap_or_else(|e| {
78-
panic!("bad column type 0x{:x}: {}", typmap[2 * i as usize], e)
79-
}),
80-
(typmap[2 * i as usize + 1] & 128) != 0,
76+
myc::constants::ColumnType::try_from(typmap[2 * i]).unwrap_or_else(|e| {
77+
panic!("bad column type 0x{:x}: {}", typmap[2 * i], e)
78+
}),
79+
(typmap[2 * i + 1] & 128) != 0,
8180
));
8281
}
8382
self.input = rest;

src/value/encode.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -723,15 +723,14 @@ mod tests {
723723
rt!(opt_none, Option<u8>, None);
724724
rt!(opt_some, Option<u8>, Some(1));
725725

726-
rt!(
727-
time,
728-
chrono::NaiveDate,
729-
chrono::Local::today().naive_local()
730-
);
726+
rt!(time, chrono::NaiveDate, chrono::Local::now().date_naive());
731727
rt!(
732728
datetime,
733729
chrono::NaiveDateTime,
734-
chrono::Utc.ymd(1989, 12, 7).and_hms(8, 0, 4).naive_utc()
730+
chrono::Utc
731+
.with_ymd_and_hms(1989, 12, 7, 8, 0, 4)
732+
.unwrap()
733+
.naive_utc()
735734
);
736735
rt!(dur, time::Duration, time::Duration::from_secs(1893));
737736
rt!(dur_micro, time::Duration, time::Duration::new(1893, 5000));
@@ -915,13 +914,16 @@ mod tests {
915914
rt!(
916915
time,
917916
chrono::NaiveDate,
918-
chrono::Local::today().naive_local(),
917+
chrono::Local::now().date_naive(),
919918
ColumnType::MYSQL_TYPE_DATE
920919
);
921920
rt!(
922921
datetime,
923922
chrono::NaiveDateTime,
924-
chrono::Utc.ymd(1989, 12, 7).and_hms(8, 0, 4).naive_utc(),
923+
chrono::Utc
924+
.with_ymd_and_hms(1989, 12, 7, 8, 0, 4)
925+
.unwrap()
926+
.naive_utc(),
925927
ColumnType::MYSQL_TYPE_DATETIME
926928
);
927929
rt!(

tests/async.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,10 @@ fn insert_exec() {
508508
);
509509
assert_eq!(
510510
Into::<chrono::NaiveDateTime>::into(params[3].value),
511-
chrono::NaiveDate::from_ymd(2018, 4, 6).and_hms(13, 0, 56)
511+
chrono::NaiveDate::from_ymd_opt(2018, 4, 6)
512+
.unwrap()
513+
.and_hms_opt(13, 0, 56)
514+
.unwrap()
512515
);
513516
assert_eq!(Into::<&str>::into(params[4].value), "token199");
514517
assert_eq!(Into::<&str>::into(params[5].value), "rsstoken199");

tests/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ where
147147
#[cfg(all(feature = "tls", unix))]
148148
fn with_tls(mut self, client: bool, server: bool, use_client_certs: bool) -> Self {
149149
use std::fs::File;
150-
use std::io::Write;
151150

152151
use mysql::ClientIdentity;
153152

@@ -998,7 +997,10 @@ fn insert_exec() {
998997
);
999998
assert_eq!(
1000999
Into::<chrono::NaiveDateTime>::into(params[3].value),
1001-
chrono::NaiveDate::from_ymd(2018, 4, 6).and_hms(13, 0, 56)
1000+
chrono::NaiveDate::from_ymd_opt(2018, 4, 6)
1001+
.unwrap()
1002+
.and_hms_opt(13, 0, 56)
1003+
.unwrap()
10021004
);
10031005
assert_eq!(Into::<&str>::into(params[4].value), "token199");
10041006
assert_eq!(Into::<&str>::into(params[5].value), "rsstoken199");

0 commit comments

Comments
 (0)