Skip to content

Commit

Permalink
Fix some clippy warnings
Browse files Browse the repository at this point in the history
ohadravid committed Jan 19, 2024

Verified

This commit was signed with the committer’s verified signature.
1 parent f59a44c commit b609a7e
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
@@ -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))
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 3 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -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),

0 comments on commit b609a7e

Please sign in to comment.