-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
project-wide tidying, style updates #432
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctz
approved these changes
May 31, 2024
Good stuff! |
Using: ``` sed -i -e 's/ffi_panic_boundary! {/if true {/g' src/*.rs cargo fmt sed -i -e 's/if true {/ffi_panic_boundary! {/g' src/*.rs ```
After removing the type hints, this is now a redundant binding: ``` error: redundant redefinition of a binding `cs` --> src/connection.rs:412:17 | 412 | let cs = cs; | ^^^^^^^^^^^^ | help: `cs` is initially defined here --> src/connection.rs:408:17 | 408 | for cs in ALL_CIPHER_SUITES { | ^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals = note: `#[deny(clippy::redundant_locals)]` on by default ```
After refactoring out explicit type hints these are now `useless_vec` findings of the form: ``` error: useless use of `vec!` --> src/client.rs:599:20 | 599 | let alpn = vec![h1.into(), h2.into()]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[h1.into(), h2.into()]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec = note: `-D clippy::useless-vec` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]` ```
This papers around a `cargo fmt` limitation that leaves code within the `ffi_panic_boundary!` macros unformatted. By also adding this to `format-check`, we'll get CI enforcement to prevent backsliding.
@jsha Would you like me to hold merging this until you've had a chance to review? |
Nope, go ahead and merge, thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It might be best to review this commit-by-commit. The total overall changeset should have no functional effect - it's exclusively stylistic changes.
ffi_panic_boundary!
macro bodies (using the approach ctz used incargo fmt
inside of ffi_panic_boundary! invocations #383 and that we're using in rustls-openssl-compat).make format
andmake format-check
to enforce rust formatting within theffi_panic_boundary!
macrosResolves #31