style(lib): remove default_trait_access lint#4111
Open
nakaryo716 wants to merge 1 commit into
Open
Conversation
This file contains hidden or 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
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.
Overview
This PR removes
default_trait_access = "allow"fromCargo.tomland updates the code to explicitly call type-specific default methods (e.g.,ParserConfig::default()) instead ofDefault::default().Changes
default_trait_access = "allow"fromCargo.toml.Default::default()with explicit type-default calls in code.src/server/conn/http1.rsto align with the client-side style.Questions
Full path for h2 config
In
src/client/conn/http2.rsandsrc/server/conn/http2.rs, I used fully qualified paths to avoidDefault::default()while preventing name conflicts:Question:
Does this look good to you, or would you prefer introducing type aliases (e.g.,
use proto::h2::client::Config as H2ClientConfig) at the top of the file to keep it shorter?Import refactoring in
src/server/conn/http1.rsI changed
use httparse;touse httparse::ParserConfig;If you prefer keeping the original import style to minimize the diff, please let me know. I will revert this specific part.
Untouched test codes
I noticed that there are still many
Default::default()occurrences in the test codes (e.g.,src/proto/h1/role.rs). Currently, the CI clippy job does not check test targets because it runs without --all-targets:cargo clippy --features full -- -D warningsAs a result, the CI passes with this PR.
Question:
Should I also update the test codes, or should we keep this PR focused only on the library code?
Related issue
Part of a #4071
Sorry for the long description!
If there are any changes needed, please let me know. Otherwise, feel free to merge this PR if everything looks good to you.🙏