| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
Removed unnecessary lint
|
| | |
|
| |
|
|
|
|
|
|
| |
This commit adds #[allow(clippy::string_slice)] to all functions in the
code where string slices are used, alongside a TODO comment.
We do this add the function header to have it consistent, as things like
expression based allow's are still experimental.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
As per #2492.
|
| | |
|
| |
|
|
|
|
|
| |
We're going to introduce facilities for encoding more generally, and
we'll want a way to enable them.
Instead, have a separate feature for *encoding* documents.
|
| |
|
|
| |
Run maint/add_warning
|
| |
|
|
| |
The new parser is going to reuse this.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Run cargo fix --edition
2. Selectively revert the "if let"->"match" changes.
These changes are meant to protect us from the lifetime changes
for "if let" bindings in Rust 2024.
But we're not actually relying on the old lifetime rules
anywhere, and the match syntax here is quite ugly.
3. Automatically revert `$pat:expr_2021` to `$pat:expr`.
(We don't actually want to restrict the expression syntax
that our macros accept).
Done with
`git grep -l expr_2021 | xargs perl -i -pe 's/expr_2021/expr/g;'`
4. Run cargo fmt.
|
| |
|
|
| |
Part of proposal 360.
|
| |
|
|
|
| |
Previously it didn't include end-of-line space, even though the docs
said it did.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
```text
warning: length comparison to one
--> crates/tor-netdoc/src/parse/tokenize.rs:470:12
|
470 | if args.len() >= 1 {
| ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!args.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
note: the lint level is defined here
--> crates/tor-netdoc/src/lib.rs:9:9
|
9 | #![warn(clippy::all)]
| ^^^^^^^^^^^
= note: `#[warn(clippy::len_zero)]` implied by `#[warn(clippy::all)]`
```
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
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.)
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
`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.
|
| |
|
|
|
| |
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.
|
| |
|
|
|
| |
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.
|
| | |
|
| |
|
|
| |
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 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.
|
| | |
|
| | |
|
| |
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|