| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
|
| |
I want this in tor-netdoc (which doesn't use tor-config and probably
shouldn't).
Almost entirely code motion. Review with --color-moved.
|
| |
|
|
|
|
|
| |
I want to mvoe this to tor-basic-utils, so it can't use tor-config in
its example. Also, Cell is just a nicer example.
(The rule identifier was already wrong.)
|
| |
|
|
|
| |
IMO this makes the example clearer. It will also make moving this
macro to tor-basic-utils less noisy.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This commit executes maint/add_warning with the just added change to
deny string slices except in tests.
I recommend auditing this by checking out the previous commit followed
by running the script yourself and then verifying that the diff is
identical to this commit.
This commit makes cargo clippy fail. We will add exceptions in the next
commit.
|
| |
|
| |
Co-authored-by: gabi-250 <[email protected]>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This new method modifies a builder by replacing any unset values
that have a default with that default. We're using this method
so that we can re-serialize a builder into a `ConfigurationTree`
with all of its default values included.
In all cases, `b.apply_defaults()?; b.build()` should produce
the same output as `b.build()`.
The interesting parts of this commit are in tor_config::load
and tor_config::derive. The rest of this commit just adds
`apply_defaults` to other builders that _aren't_ made with
`derive_deftly(TorConfig)`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This affects the automatic builder code made by our
derive_deftly macro. It is only relevant (for now)
in the case of the `NonZero<>` types and their special handling.
Previously, when a builder contained Option<U>,
and we wanted to generate a configuration holding T,
we would _first_ apply a transformation from Option<U> to Option<T>
and _second_ unwrap the result or apply a default.
Now, we _first_ convert from Option<U> to U by applying a default,
and only _then_ perform any necessary conversion from U and T.
This is only relevant in the case where U and T are different.
It simplifies writing the defaults for `NonZero` options,
and will significantly simplify the logic for setting builder defaults.
|
| |
|
|
|
| |
Rust 1.88 added these, so we no longer have to use `any()` for false
and `all()` for true.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Previously, it used the sub_builder rule, which doesn't make sense
when the value is a stub place-holder to tell us whether to warn.
|
| |
|
|
|
|
|
|
| |
1. When we are told to `extend_with`, we should obey that directive
even if we have a sub_builder etc.
2. Provide an `extend_with_replace` function for the common case
where we want to just replace one object with another.
|
| | |
|
|
|
This template is meant to replace most of our use of derive_builder
for configuration objects. Where possible and reasonable, it
delegates to existing macros, and automatically infers what special
patterns we use for individual types. In other cases, it uses
compile-time errors to inform the caller about pattern violations.
|