Rust is not happy when there is more than one underscore in a row in a field name. This can happen when transforming a name like thieves' tools: one underscore replaces the ' and the other one the space.
Another edge case is when the field name is just _. .to_snake_case() will just leave it empty, so it's better to replace is with some placeholder and return early.
And a few other edge cases.
Rust is not happy when there is more than one underscore in a row in a field name. This can happen when transforming a name like
thieves' tools
: one underscore replaces the'
and the other one the space.Another edge case is when the field name is just
_
..to_snake_case()
will just leave it empty, so it's better to replace is with some placeholder and return early.