fix: compile error on windows
This commit is contained in:
parent
b082dd4740
commit
f344fa43a6
2 changed files with 1 additions and 3 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||||
#![forbid(unsafe_code)]
|
|
||||||
#![warn(missing_docs, clippy::todo, clippy::dbg_macro)]
|
#![warn(missing_docs, clippy::todo, clippy::dbg_macro)]
|
||||||
|
|
||||||
//! ## Go to
|
//! ## Go to
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ pub fn local_timezone_name() -> Result<String, Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[allow(unsafe_code)]
|
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
use windows_sys::Win32::System::Time::GetDynamicTimeZoneInformation;
|
use windows_sys::Win32::System::Time::GetDynamicTimeZoneInformation;
|
||||||
|
|
@ -87,7 +86,7 @@ pub fn local_timezone_name() -> Result<String, Error> {
|
||||||
return Err(Error::Other("local timezone could not be read".into()));
|
return Err(Error::Other("local timezone could not be read".into()));
|
||||||
}
|
}
|
||||||
return String::from_utf16(&win_name_utf16[..len])
|
return String::from_utf16(&win_name_utf16[..len])
|
||||||
.map_err(|_| "local timezone is invalid UTF16".into())?;
|
.map_err(|_| Error::Other("local timezone is invalid UTF16".into()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue