Skip to content

Commit

Permalink
Fix some clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ohadravid committed Jan 19, 2024
1 parent f59a44c commit b609a7e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ impl FromStr for WMIDateTime {
let (datetime_part, tz_part) = s.split_at(21);
let tz_min: i32 = tz_part.parse()?;
let tz = FixedOffset::east_opt(tz_min * 60).unwrap();
let dt = tz.datetime_from_str(datetime_part, "%Y%m%d%H%M%S.%f")?;
let dt = NaiveDateTime::parse_from_str(datetime_part, "%Y%m%d%H%M%S.%f")?
.and_local_timezone(tz)
.single()
.ok_or(WMIError::ParseDatetimeLocalError)?;

Ok(Self(dt))
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(unused_unsafe)]
#![allow(clippy::arc_with_non_send_sync)]
#![cfg(windows)]

pub mod connection;
Expand Down
3 changes: 3 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pub enum WMIError {
#[cfg(feature = "chrono")]
#[error(transparent)]
ParseDatetimeError(#[from] chrono::format::ParseError),
#[cfg(feature = "chrono")]
#[error("Cannot parse a non unique local timestamp")]
ParseDatetimeLocalError,
#[cfg(feature = "time")]
#[error(transparent)]
ParseOffsetDatetimeError(#[from] time::Error),
Expand Down

0 comments on commit b609a7e

Please sign in to comment.