-
Notifications
You must be signed in to change notification settings - Fork 190
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
Replace bool with enum for a function parameter of label::fmt_string #1875
Conversation
This commit addresses code smell where the said function takes a bool to decide whether it percent-encodes the UTF-8 encoding of the given string. For clarity, we define an enum EncodingStrategy so that we can see the callers' intent at the call sites by reading the variant names rather than true/false.
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Co-authored-by: John DiSanti <[email protected]>
A new generated diff is ready to view.
A new doc preview is ready to view. |
This commit modifies a call site for the updated function signature of `aws_smithy_http::label::fmt_string`, otherwise the test would fail to compile, leading to a failure in CI.
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
Fixes #964
Description
This commit is a refactoring where the said function takes a
bool
to decide whether it percent-encodes the UTF-8 encoding of/
in the given string. For clarity, we define an enumEncodingStrategy
so that we can better express the callers' intent at the call sites with the variant names rather thantrue
/false
.In addition, the PR includes two tangential changes:
label::fmt_timestamp
callslabel::fmt_string
(one in its own module) rather thanquery::fmt_string
. I made this change with the intent that if some operation can be completed without reaching into another module, it's more self-contained. I'm open to opinions/suggestions/preferences as to whether we revert the change.BASE_SET
is nowpub(crate)
so that we don't need to export it from the crate.Testing
Ran
cargo t
fromaws/rust-runtime
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.