util: Return empty string directly if the byte slice is empty#11828
Closed
suzaku wants to merge 3 commits intopingcap:masterfrom
Closed
util: Return empty string directly if the byte slice is empty#11828suzaku wants to merge 3 commits intopingcap:masterfrom
suzaku wants to merge 3 commits intopingcap:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11828 +/- ##
================================================
- Coverage 81.5904% 81.4308% -0.1596%
================================================
Files 435 435
Lines 94630 94129 -501
================================================
- Hits 77209 76650 -559
- Misses 11925 11980 +55
- Partials 5496 5499 +3 |
zz-jason
reviewed
Aug 25, 2019
Member
zz-jason
left a comment
There was a problem hiding this comment.
Users may wish to change the content of the underlying []byte by modifying the returned string. So I think this change is not applicable for this situation.
zz-jason
reviewed
Aug 25, 2019
Member
zz-jason
left a comment
There was a problem hiding this comment.
Users may wish to change the content of the underlying []byte by modifying the returned string. So I think this change is not applicable for this situation.
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.
What problem does this PR solve?
When the input is empty, it's faster to just return an empty string.
What is changed and how it works?
Return an empty string directly if the input is empty.
Check List
Tests
Code changes
Side effects
Related changes