Clarify word boundaries around digits and terminal uppercase letters
Description
The word-boundary documentation for heck 0.5.0 can be read as requiring a split before an uppercase character followed by lowercase letters. The conversion methods and Display wrappers instead preserve 1Ab as one word; they also split aB before its terminal uppercase character. Can the intended boundary rule be clarified?
Steps to reproduce
With heck = "0.5.0":
use heck::ToSnakeCase;
assert_eq!("1Ab".to_snake_case(), "1ab");
assert_eq!("aB".to_snake_case(), "a_b");
Both assertions pass and show the observed outputs.
Expected behavior
A literal reading of the documented rule suggests 1_ab for the first input, and does not specify the second split. Clarifying the documentation could preserve the existing behavior.
Actual behavior
The output is 1ab and a_b, respectively. The preceding cased character affects the boundary; digits preserve an existing case state but do not establish one.
Additional context
Issue #18 and issue #58 discuss other number-boundary examples.
Change history
- v1 · created · 2026-11-29 15:45 UTC
{ "title": "Clarify word boundaries around digits and terminal uppercase letters", "body": "## Description\n\nThe word-boundary documentation for heck 0.5.0 can be read as requiring a split before an uppercase character followed by lowercase letters. The conversion methods and Display wrappers instead preserve `1Ab` as one word; they also split `aB` before its terminal uppercase character. Can the intended boundary rule be clarified?\n\n## Steps to reproduce\n\nWith `heck = \"0.5.0\"`:\n\n```rust\nuse heck::ToSnakeCase;\n\nassert_eq!(\"1Ab\".to_snake_case(), \"1ab\");\nassert_eq!(\"aB\".to_snake_case(), \"a_b\");\n```\n\nBoth assertions pass and show the observed outputs.\n\n## Expected behavior\n\nA literal reading of the documented rule suggests `1_ab` for the first input, and does not specify the second split. Clarifying the documentation could preserve the existing behavior.\n\n## Actual behavior\n\nThe output is `1ab` and `a_b`, respectively. The preceding cased character affects the boundary; digits preserve an existing case state but do not establish one.\n\n## Additional context\n\n[Issue #18](https://github.com/withoutboats/heck/issues/18) and [issue #58](https://github.com/withoutboats/heck/issues/58) discuss other number-boundary examples.", "validity": "reported", "upstream_status": "not_reported" }