Fix warnings and errors from beta Rust #2904
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The CI cannot pass due to the marking of two new warnings / errors, namely pattern exhaustiveness (by
rustc
) and long doc comments (byclippy
).Solution
Because
unreachable pattern
is a useful compiler warning, and within all ofaxum
, there are only 4 occurrences, it is simplest to just mark the match arms with#[allow]
.Because the examples are separate from the
axum
lib, it's simplest to just use the same#[allow]
in each example'smain.rs
at a module level.An alternative would be to add the directive to axum's lib.rs, but that would suppress other instances of this error.
Additionally, there does not seem to be a way to disable more specific instances of unreachable patterns, or to configure this warning's impact from
Cargo.toml
.NOTE: It seems that this warning has irked enough people for an exception for empty match arms to be made and nominated for backporting to beta, so hopefully these commits can be reverted soon.
clippy::too-long-first-doc-paragraph
This lint is likely here to stay, so this requires actual changes, which were made in accordance with the fix recommended by the lint's author(s).