bitwarden_generators/
util.rs

1pub(crate) fn capitalize_first_letter(s: &str) -> String {
2    // Unicode case conversion can change the length of the string, so we can't capitalize in place.
3    // Instead we extract the first character and convert it to uppercase. This returns
4    // an iterator which we collect into a string, and then append the rest of the input.
5    let mut c = s.chars();
6    match c.next() {
7        None => String::new(),
8        Some(f) => f.to_uppercase().collect::<String>() + c.as_str(),
9    }
10}