-
-
Notifications
You must be signed in to change notification settings - Fork 199
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
When merging configs there is no way to override bools in the merge chain with false. If one item in the merge chain is true it will always stay true. This is a known limitation that we should ideally work around in the long term. The workaround is to convert all bools of Config into Option<bool>. Then we can remove the bool case of the merge! macro and move the affected fields into the option case in the merge invocation.
Note that this is not a very pressing issue. It does not affect CLI options, as there is no way to set flags to false. (e.g. lychee --dump=false does not work)
Also see the relevant discussion.
lychee/lychee-bin/src/options.rs
Lines 938 to 959 in 5916c31
| macro_rules! merge { | |
| ( | |
| option { $( $optional:ident ),* $(,)? }, | |
| chain { $( $chainable:ident ),* $(,)? }, | |
| bool { $( $bool:ident ),* $(,)? }, | |
| ) => { | |
| Config { | |
| hosts, | |
| // Merge chainable fields (e.g. `Vec` and `HashMap`) | |
| $( $chainable: self.$chainable.into_iter().chain(other.$chainable).collect(), )* | |
| // Use self if present, otherwise use other | |
| $( $optional: self.$optional.or(other.$optional), )* | |
| // Use `true` when self or other is `true`. | |
| // Note that this has the drawback, that a value cannot be overwritten with | |
| // `false` in the merge chain, as there is no way to distinguish | |
| // between "default" `false` and user-provided `false`. | |
| // We would have to use `Option<bool>` in order to do that. | |
| // See: https://github.com/lycheeverse/lychee/issues/2051 | |
| $( $bool: self.$bool || other.$bool, )* | |
| } | |
| }; | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers