fix: compile error on windows

This commit is contained in:
ThetaDev 2025-01-25 03:24:35 +01:00
parent 4f2bb47ab4
commit 34f8e9b551
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
2 changed files with 1 additions and 3 deletions

View file

@ -1,6 +1,5 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![forbid(unsafe_code)]
#![warn(missing_docs, clippy::todo, clippy::dbg_macro)]
//! ## Go to

View file

@ -68,7 +68,6 @@ pub fn local_timezone_name() -> Result<String, Error> {
}
#[cfg(windows)]
#[allow(unsafe_code)]
{
unsafe {
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 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()));
}
}
}