| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
Per <https://spec.torproject.org/dir-spec/netdoc.html>,
our netdocs never have a BOM, and never have internal NULs.
This makes Arti reject such documents.
For arguments on why it's okay to increase parser strictness,
see the (forthcoming) proposal 356 at torspec!342,
and see older discussion at torspec#296.
Closes #1739.
|
| |
|
|
|
|
|
| |
I'm about to make our parsers reject some strings at construction
time, so it makes sense to have these functions become fallible.
This is a breaking change.
|
| |
|
|
|
|
| |
Looks like a copy/paste error.
Co-authored-by: Micah Elizabeth Scott <[email protected]>
|
| |
|
|
|
|
|
| |
This warning suggests using `[a,b]` as a Pattern
when it sees a search for `|ch| ch == a || ch == b`.
(All of our supported rust versions allow this kind of Pattern.)
|
| | |
|
| |
|
|
|
| |
FTR I don't think agree with clippy on this question, but then I often
don't.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
`ParseErrorKind` was renamed to `NetdocErrorKind`, so we need to
rename this acccessor too.
Signed-off-by: Gabriela Moldovan <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
`ParseErrorSource` was originally meant to represent a parsing error,
this enum has since gained some variants that aren't really parsing
related (`Signature`, `CertSignature`, `UntimelyDescriptor`).
Since this error type is now used for general-purpose netdoc errors,
let's rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.
Signed-off-by: Gabriela Moldovan <[email protected]>
|
| |
|
|
| |
Fixes #756
|
| | |
|
| |
|
|
| |
Nothing uses these now; the NetDocReader is simply an iterator, itself.
|
| | |
|
| |
|
|
| |
This simplifies the return type!
|
| |
|
|
| |
This will simplify things at many call sites.
|
| |
|
|
| |
This is the last use of PauseAt.
|
| |
|
|
|
|
| |
There's a blanket impl of Itertor for &mut impl Iterator, so this
isn't necessary, and it prevents us passing iterators by value
producing syntactic vinegar.
|
| |
|
|
|
| |
This makes things easier to read. We're about to add another
site (albeit, temporarily).
|
| |
|
|
|
| |
This gets rid of a lot of manual boolean state variable iterator
stuff.
|
| |
|
|
|
| |
This will avoids some hairy borrowck disasters when we try to use
iterator adapters.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now we require that, for all `SectionRules`, either the caller say
how to handle unrecognized tokens (using `.add(UNRECOGNIZED...)`),
or that they explicitly reject unrecognized tokens (using
`reject_unrecognized`()`.)
This solution uses an assert!() rather than an Error to indicate
failure. I say that's fine, since
1. This is a crate-internal API.
2. We never dynamically construct SectionRules according to
different behavior: they are always prefabricated in a fixed
code block. Thus, if we test a parser at all, we will make
sure that its SectionRules are well-formed.
I considered and explicitly rejected a solution where the builder
had to be finalized with separate methods `build_strict()` or
`build_tolerant()`: It's too easy IMO for the caller to forget what
these call means.
Prevents further recurrences of #752.
Closes #752.
|
| |
|
|
| |
No new behavior yet.
|
| |
|
|
|
| |
This is dead code when
cargo +stable clippy -p tor-netdir --all-features --all-targets
|
| |
|
|
|
| |
This panics on error, and we're fine with a panic on misbehavior in
tests.
|
| |
|
|
|
| |
Clippy now warns about these; I'm not sure how these warnings snuck
up on us.
|
| | |
|
| |
|
|
| |
We'll use this in the netdoc builder, but it naturally lives here.
|
| |
|
|
|
|
|
|
|
| |
Rename from _keyword_, since this actually checks the *multiple*
keywords that can appear in an object's BEGIN line.
Make this clear in the doc comment.
Expose it for use by the netdoc builder.
|
| |
|
|
| |
The document builder wants these too.
|
| |
|
|
|
| |
This is precisely the result of running the rune in
maint/adhoc-add-lint-blocks.
|
| |
|
|
|
|
|
| |
This is the hunks from running the rune in maint/adhoc-add-lint-blocks
but which require some subsequent manual fixup: usually, deleting
now-superfluous outer allows, but in some cases manually putting back
lints that the adhoc script deleted.
|
| |
|
|
| |
These slipped in while nightly was broken.
|
| |
|
|
|
| |
It looks like, despite a few false starts, they've got this warning
right; there weren't any false positives.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We already have `Pos::Unknown` for an error at an unknown
location and `Pos::None` for an error where no location is
sensible. There's no reason to have an additional `Option` here.
Additionally, the use of `Option` gave us a bug where our old
`ParseError::at_pos()` method didn't actually set the position
unless the position was already set. That's not what we want!
Fixes #640.
Finally, we have to fix a test that was a bit broken because it was
working around #640.
|
| | |
|
| | |
|
| |
|
|
|
| |
Empty lines were previously reported as BadKeyword, which is
confusing.
|
| |
|
|
|
|
| |
In addition to the usual "You named that method wrong!" errors, we
have a new rustdoc error that complains about bogus "HTML tags" that
are actually unquoted usage of types like `Result<Foo>`.
|
| |
|
|
|
|
|
| |
Note: the `base64ct` crate rejects invalid characters when the
decoding is done on padded strings. However, the `FromStr` impl
for `B64` can have both padded **and** unpadded inputs, so all
inputs are now padded first, before decoding.
|
| |
|
|
|
| |
Without this, clippy is error-free, but `cargo test` somehow gives a
warning.
|
| |
|
|
| |
Found via coverage.
|
| | |
|
| | |
|
| |
|
|
| |
This is ridiculous.
|
| |
|
|
|
| |
We want to supress the unused_macro_rules lint in one place but it's
new in Nightly and this triggers yet another lint.
|
| |
|
|
|
|
|
| |
The compiler can apparently tell that we aren't generating compile
errors! Also that we're not yet using a feature provided here.
(New lint in currently Nightly.)
|
| |
|
|
|
| |
This enum was otiose: its set of valid values is precisely those of a
Vec. (Indeed what would TokVal::Multi(vec![]) have meant?)
|
| |
|
|
| |
std::slice::from_ref exists. Spotted while reviewing !400
|