Trim leading contiguous whitespace, fix nightly clippy warns #41
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.
RFC 7468 §2 says:
Previously we only stripped the trailing whitespace from the base64 content lines within the PEM section boundaries. This branch updates our processing to additionally trim leading contiguous whitespace. This felt more sensible than outright ignoring whitespace (e.g. from the middle of content) and will be sufficient to resolve #40
We base our implementation on the stdlib's unstable
[u8]::trim_ascii
fn, which we can't (yet) use directly due to our MSRV/stable rust requirements. A TODO is left for future cleanup. Notably this broadens our definition of what whitespace is slightly (e.g. including\t
).Along the way I noticed CI for main is failing on nightly clippy due to redundant import findings. I've applied the same fix strategy we used for Rustls (rustls/rustls#1813) and Webpki (rustls/webpki#234) to resolve this.