Skip to content

Commit

Permalink
Eliminate spurious default in has_preference
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Jan 31, 2022
1 parent 72ad73e commit 1c7ed5f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Preferences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,28 @@ macro load_preference(key, default = nothing)
end

"""
has_preference(uuid_or_module, key, default = nothing)
has_preference(uuid_or_module, key)
Return `true` if the particular preference is found, and `false` otherwise.
See the `has_preference` docstring for more details.
"""
function has_preference(uuid::UUID, key::String, default = nothing)
function has_preference(uuid::UUID, key::String)
value = load_preference(uuid, key, nothing)
return !(value isa Nothing)
end
function has_preference(m::Module, key::String, default = nothing)
return has_preference(get_uuid(m), key, default)
function has_preference(m::Module, key::String)
return has_preference(get_uuid(m), key)
end

"""
@has_preference(key)
Convenience macro to call `has_preference()` for the current package.
"""
macro has_preference(key, default = nothing)
macro has_preference(key)
return quote
has_preference($(esc(get_uuid(__module__))), $(esc(key)), $(esc(default)))
has_preference($(esc(get_uuid(__module__))), $(esc(key)))
end
end

Expand Down

0 comments on commit 1c7ed5f

Please sign in to comment.