to_snake_case in clippy_utils::str_utils - Rust
Description: Returns a `snake_case` version of the input

Skip to main content

## to_snake_case

# 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");