Fix Clippy lints: redundant_closure
This commit is contained in:
parent
4ca861c905
commit
ed8f406a61
|
@ -554,7 +554,7 @@ pub mod rustc_serialize {
|
||||||
impl Decodable for TsSeconds<FixedOffset> {
|
impl Decodable for TsSeconds<FixedOffset> {
|
||||||
fn decode<D: Decoder>(d: &mut D) -> Result<TsSeconds<FixedOffset>, D::Error> {
|
fn decode<D: Decoder>(d: &mut D) -> Result<TsSeconds<FixedOffset>, D::Error> {
|
||||||
from(FixedOffset::east(0).timestamp_opt(d.read_i64()?, 0), d)
|
from(FixedOffset::east(0).timestamp_opt(d.read_i64()?, 0), d)
|
||||||
.map(|dt| TsSeconds(dt))
|
.map(TsSeconds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ pub mod rustc_serialize {
|
||||||
impl Decodable for TsSeconds<Utc> {
|
impl Decodable for TsSeconds<Utc> {
|
||||||
fn decode<D: Decoder>(d: &mut D) -> Result<TsSeconds<Utc>, D::Error> {
|
fn decode<D: Decoder>(d: &mut D) -> Result<TsSeconds<Utc>, D::Error> {
|
||||||
from(Utc.timestamp_opt(d.read_i64()?, 0), d)
|
from(Utc.timestamp_opt(d.read_i64()?, 0), d)
|
||||||
.map(|dt| TsSeconds(dt))
|
.map(TsSeconds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ impl NaiveDateTime {
|
||||||
pub fn from_timestamp_opt(secs: i64, nsecs: u32) -> Option<NaiveDateTime> {
|
pub fn from_timestamp_opt(secs: i64, nsecs: u32) -> Option<NaiveDateTime> {
|
||||||
let (days, secs) = div_mod_floor(secs, 86400);
|
let (days, secs) = div_mod_floor(secs, 86400);
|
||||||
let date = days.to_i32().and_then(|days| days.checked_add(719163))
|
let date = days.to_i32().and_then(|days| days.checked_add(719163))
|
||||||
.and_then(|days_ce| NaiveDate::from_num_days_from_ce_opt(days_ce));
|
.and_then(NaiveDate::from_num_days_from_ce_opt);
|
||||||
let time = NaiveTime::from_num_seconds_from_midnight_opt(secs as u32, nsecs);
|
let time = NaiveTime::from_num_seconds_from_midnight_opt(secs as u32, nsecs);
|
||||||
match (date, time) {
|
match (date, time) {
|
||||||
(Some(date), Some(time)) => Some(NaiveDateTime { date: date, time: time }),
|
(Some(date), Some(time)) => Some(NaiveDateTime { date: date, time: time }),
|
||||||
|
|
Loading…
Reference in New Issue