Skip to content

Commit 6535183

Browse files
committed
simplify config.jl a bit
1 parent c5793d2 commit 6535183

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/config.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,8 @@ Among the registered configuration files, fetches the value in order of priority
178178
Even when the specified configuration is not explicitly set, a default value is returned,
179179
so `config` is guaranteed to not be `nothing`.
180180
"""
181-
Base.@constprop :aggressive function get_config(manager::ConfigManager, key_path::Symbol...)
182-
data = load(manager)
183-
config = getobjpath(data.filled_settings, key_path...)
184-
@assert !isnothing(config) "Invalid default configuration values"
185-
return config
186-
end
181+
Base.@constprop :aggressive get_config(manager::ConfigManager, key_path::Symbol...) =
182+
@something getobjpath(load(manager).filled_settings, key_path...) error(lazy"Invalid default configuration value found at $key_path")
187183

188184
function initialize_config!(manager::ConfigManager)
189185
store!(manager) do old_data::ConfigManagerData
@@ -205,6 +201,7 @@ end
205201
ConfigChangeTracker() = ConfigChangeTracker(ConfigChange[], false)
206202

207203
function (tracker::ConfigChangeTracker)(old_val, new_val, path::Tuple{Vararg{Symbol}})
204+
@nospecialize old_val new_val
208205
if old_val !== new_val
209206
path_str = join(path, ".")
210207
push!(tracker.changed_settings, ConfigChange(path_str, old_val, new_val))

0 commit comments

Comments
 (0)