| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
Some of the tests used derive(Builder), which is not current
practice for our configuration.
Additionally, they didn't implement the requisite ConfigBuilder
logic to pass with the other changes in this branch.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 isn't strictly necessary, but it helps for consistency.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
We were only using it for Default, and it is easier to implement
Default by hand than it is to keep this particular layer in our
leaning tower of macros.
|
| |
|
|
| |
Run maint/add_warning
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
First, run
```
git grep -l "^edition =" |
xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;'
```
Second, manually verify that all Cargo.toml files have changed,
and nothing else has changed.
Third, run cargo fmt again.
|
| | |
|
| |\
| |
| |
| |
| | |
Encapsulate usage of config-rs inside tor-config.
See merge request tpo/core/arti!2040
|
| | |
| |
| |
| |
| | |
Our macros use these exports, but we don't need everybody else to
be able to see them.
|
| |/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Since Rust 1.66, std's default works properly for enums, provided that
the default variant is a unit.
Review all uses of `#[educe(default)]` on enums and replace them with
std where possible, which is most of them.
In 1.66 and later, std's `#[derive(Default)]` doesn't infer any
generic bounds on the derived impl, where it's an enum - since the
unit variant can always be constructed. So this change doesn't add
any generic bounds and is not API-visible.
|
| | |
|
| | |
|
| |
|
|
|
| |
This panics on error, and we're fine with a panic on misbehavior in
tests.
|
| |
|
|
| |
This gets rid of a spurious warning on nightly about the use of dbg!
|
| | |
|
| | |
|
| |
|
|
| |
We're going to reuse this.
|
| |
|
|
|
|
| |
The error message from `#[serde(untagged)]` would otherwise start to
appear when we try to deserialise unsupported PT configurations, when
compiled with bridge but not PT support.
|
| |
|
|
| |
By changing MultilineListBuilder.
|
| |
|
|
|
| |
This trait can have this ludicrously long name because no-one needs to
import it.
|
| |
|
|
| |
This is what we'll use to parse the `bridges.bridges` config key.
|
| | |
|
| |
|
|
|
|
|
|
| |
We're going to want something that has the standard list builder
methods at the Rust API, but which has different serialisation.
Sadly the implementation is annoying, because macro_rules makes it
hard to parse a nice input syntax.
|
| | |
|
| |\
| |
| |
| |
| | |
arti config: Check that example config is exhaustive
See merge request tpo/core/arti!546
|
| | |
| |
| |
| |
| | |
These violate our rule that *built* structs ought not to be desr.
But this is just in a test.
|
| |/
|
|
| |
There's nothing major here, but it does fill in a few gaps.
|
| | |
|
| |\
| |
| |
| |
| | |
Fix typos (using the typos-cli tool).
See merge request tpo/core/arti!486
|
| | | |
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Builders additionally derive: Debug, Serialize, Deserialize.
* Validated structs no longer derive: Serialize, Deserialize
and all related attributes deleted.
* As a consequence, all the `#[serde(deny_unknown_fields)]`
are gone. That means that right now unknown fields are totally
ignored. This is good for compatibility but poor for useability.
Doing something better here is arti#417, in progress.
* As a consequence, delete tor_dirmgr::retry::default_parallelism.
(The default value was already duplicated into a builder attr.)
|
| |
|
|
|
| |
Apropos
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/474#note_2800481
|
| | |
|
| |
|
|
| |
This is for lists of plain types (non-builder types).
|
| |
|
|
|
|
| |
This allows us to use this with an item builder type which doesn't
impl Default. (Obviously this only makes sense for items which aren't
actually builders.)
|
| |
|
|
|
|
|
|
| |
It is Quite Vexing that we have to use [ ] rather than the < > around
the generics, particularly given that we are also using [ ] to signal
"this is arrayish".
Signed-off-by: Ian Jackson <[email protected]>
|
| |
|
|
|
|
| |
The docs were a lie. $docs_and_attrs was missing from the expander.
And add a note about how any supplied docs are handled.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new API is (roughly) as discussed in
https://gitlab.torproject.org/tpo/core/arti/-/issues/451
This is quite a large commit and it is not convenient to split it up.
It contains the following changes:
* Redo the list builder and accessor macros implemnetation,
including docs and tests.
* Change uses of define_list_config_builder. In each case:
- Move the docs about the default value to the containing field.
- Remove the other docs (which were just recapitulations, and
are now not needed since the ListBuilder is no longer public).
- Rewmove or replace `pub` in the define_list_builder_helper call,
so that the builder is no longer public.
- Change the main macro call site to use define_list_builder_helper.
- Add a call to define_list_builder_accessors.
* Make the module `list_builder` pub so that we have somewhere to
put the overview documentation.
* Consequential changes:
- Change `outer.inner().replace(X)` to `outer.set_inner(X)`
- Consequential changes to imports (`use` statements).
|
| |
|
|
|
| |
This removes a caveat from the API and will be convenient for what is
coming.
|
| |
|
|
|
| |
Because the macro output is private, if we miss one out of the tests,
it doesn't fail due to dead code :-).
|
| |
|
|
|
|
|
|
|
| |
Really, we probably don't want any of these not to be pub, but it
triggers "unreachable pub" in my test cases, and making it not pub by
mistake seems not very serious, and likely to be noticed.
Making the struct private in the test cases has the useful effect of
checking that all the methods are tested.
|
| |
|
|
|
|
|
| |
I don't think we need to bother with things in the prelude,
but doing it for serde and ConfigBuildError seems nice.
Noticed while writing a test case.
|
| |
|
|
|
|
|
| |
And add an imprecation in define_list_config_builder's doc comment do
do so in future for other invocations of the macro.
Add add the missing full stops.
|
| |
|
|
|
| |
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798027
|