Skip to content

Commit eb7c954

Browse files
Wynandomus
andauthored
Inline and make returns explicit
Also avoid an extra `TimeZone` conversion Co-authored-by: Curtis Vogt <[email protected]>
1 parent 2672ff1 commit eb7c954

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/types/fixedtimezone.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,16 @@ name(tz::FixedTimeZone) = tz.name
9797
rename(tz::FixedTimeZone, name::AbstractString) = FixedTimeZone(name, tz.offset)
9898

9999
function Base.:(==)(a::FixedTimeZone, b::FixedTimeZone)
100-
a.name == b.name && a.offset == b.offset
100+
return a.name == b.name && a.offset == b.offset
101101
end
102102

103103
function Base.isequal(a::FixedTimeZone, b::FixedTimeZone)
104-
return (
105-
isequal(a.name, b.name) &&
106-
isequal(a.offset, b.offset)
107-
)
104+
return isequal(a.name, b.name) && isequal(a.offset, b.offset)
108105
end
109106

110107
function Base.hash(tz::FixedTimeZone, h::UInt)
108+
h = hash(:timezone, h)
111109
h = hash(tz.name, h)
112110
h = hash(tz.offset, h)
113111
return h
114-
end
112+
end

src/types/timezone.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ US/Pacific (UTC-8/UTC-7)
4040
"""
4141
TimeZone(::AbstractString, ::Class)
4242

43-
function TimeZone(str::AbstractString, mask::Class=Class(:DEFAULT))
43+
TimeZone(str::AbstractString, args...) = TimeZone(String(str), args...)
44+
45+
function TimeZone(str::String, mask::Class=Class(:DEFAULT))
4446
# Note: If the class `mask` does not match the time zone we'll still load the
4547
# information into the cache to ensure the result is consistent.
4648
tz, class = get!(TIME_ZONE_CACHE, String(str)) do

0 commit comments

Comments
 (0)