diff --git a/src/offset/local/mod.rs b/src/offset/local/mod.rs index 7f3f0f9488..41be2a9d30 100644 --- a/src/offset/local/mod.rs +++ b/src/offset/local/mod.rs @@ -13,8 +13,14 @@ use crate::naive::{NaiveDate, NaiveDateTime, NaiveTime}; use crate::Date; use crate::{DateTime, Utc}; -// we don't want `stub.rs` when the target_os is not wasi or emscripten -// as we use js-sys to get the date instead +#[cfg(unix)] +#[path = "unix.rs"] +mod inner; + +#[cfg(windows)] +#[path = "windows.rs"] +mod inner; + #[cfg(all( not(unix), not(windows), @@ -24,16 +30,19 @@ use crate::{DateTime, Utc}; not(any(target_os = "emscripten", target_os = "wasi")) )) ))] -#[path = "stub.rs"] -mod inner; +mod inner { + use crate::{FixedOffset, LocalResult, NaiveDateTime}; -#[cfg(unix)] -#[path = "unix.rs"] -mod inner; + pub(super) fn offset_from_utc_datetime(_utc_time: &NaiveDateTime) -> LocalResult { + LocalResult::Single(FixedOffset::east_opt(0).unwrap()) + } -#[cfg(windows)] -#[path = "windows.rs"] -mod inner; + pub(super) fn offset_from_local_datetime( + _local_time: &NaiveDateTime, + ) -> LocalResult { + LocalResult::Single(FixedOffset::east_opt(0).unwrap()) + } +} #[cfg(unix)] mod tz_info; diff --git a/src/offset/local/stub.rs b/src/offset/local/stub.rs deleted file mode 100644 index 38ef680773..0000000000 --- a/src/offset/local/stub.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use crate::{FixedOffset, LocalResult, NaiveDateTime}; - -pub(super) fn offset_from_utc_datetime(_utc_time: &NaiveDateTime) -> LocalResult { - LocalResult::Single(FixedOffset::east_opt(0).unwrap()) -} - -pub(super) fn offset_from_local_datetime(_local_time: &NaiveDateTime) -> LocalResult { - LocalResult::Single(FixedOffset::east_opt(0).unwrap()) -}