fn tolower<'a>(s: &'a str, buf: &'a mut [u8]) -> &'a str {
    let b = s.as_bytes();
    if b.len() > buf.len() {
        return s;
    }
    for idx in 0 .. b.len() {
        let c = b[idx];
        buf[idx] = if c >= 65 && c <= 90 { c + 32 } else { c };
    }
    match ::std::str::from_utf8(&buf[0..b.len()]) {
        Ok(s) => s,
        Err(_) => s,
    }
}
// over-engineered way to lowercase a string without allocating.
over-engineered way to lowercase a string without allocating.
over - engineered way to lowercase a string without allocating .
fn tolower<'a>(s: &'a str, buf: &'a mut [u8]) -> &'a str {
    let b = s.as_bytes();
    if b.len() > buf.len() {
        return s;
    }
    for idx in 0 .. b.len() {
        let c = b[idx];
        buf[idx] = if c >= 65 && c <= 90 { c + 32 } else { c };
    }
    match ::std::str::from_utf8(&buf[0..b.len()]) {
        Ok(s) => s,
        Err(_) => s,
    }
}
fn tolower < ' a > ( s : & ' a str , buf : & ' a mut [ u8 ] ) -> & ' a str { let b = s . as_bytes ( ) ; if b . len ( ) > buf . len ( ) { return s ; } for idx in 0 .. b . len ( ) { let c = b [ idx ] ; buf [ idx ] = if c >= 65 && c <= 90 { c + 32 } else { c } ; } match :: std :: str :: from_utf8 ( & buf [ 0 .. b . len ( ) ] ) { Ok ( s ) => s , Err ( _ ) => s , } }
over-engineered way to lowercase a string without allocating.
over - engineered way to lowercase a string without allocating .
s
&'a str
buf
&'a mut [u8]