Fix camel num-upper boundary handling #83
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.
Ths PR fixes a problem affecting numbers/uppercase-letter boundaries in identifiers being converted to camel case.
The following else-if case would apply and force the current character to lowercase only if the previous character was uppercase:
paste/src/segment.rs
Lines 204 to 208 in c71982e
If the previous character was a number, the above case would not apply and the current character would be pushed unchanged:
paste/src/segment.rs
Lines 208 to 210 in c71982e
This would cause an input string like
TMPG_M2HH3
to be incorrectly converted toTmpgM2Hh3
(playground).The proposed fix is to always force lowercase in the else case, i.e., essentially eliminate the
if prev.is_uppercase()
check.