| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This error type doesn't impement HasKind, since the kind will depend
on context.
However, the existing implementation was pretty messy and inconsistent:
Some errors had positions, some didn't.
Some took messages as str, some as String.
Some had internal errors that were somewhat orthogonal to their actual
types.
This commit refactors tor_netdoc::Error to use a ParseErrorKind, and
adds a set of convenience functions to add positions and
messages to the errors that need them.
|
| | |
|
| |
|
|
| |
We're assuming that prop285 is accepted in some form.
|
| |
|
|
|
| |
[Edited by nickm: This applies one of Daniel's fixes in place of one
of Trinity's: Trinity says it's a bit cleaner, and I agree.]
|