clippy_utils::str_utils

Function to_snake_case

source
pub fn to_snake_case(name: &str) -> String
Expand description

Returns a snake_case version of the input

use clippy_utils::str_utils::to_snake_case;
assert_eq!(to_snake_case("AbcDef"), "abc_def");
assert_eq!(to_snake_case("ABCD"), "a_b_c_d");
assert_eq!(to_snake_case("AbcDD"), "abc_d_d");
assert_eq!(to_snake_case("Abc1DD"), "abc1_d_d");