Just cast as u8

This commit is contained in:
Yash Karandikar 2022-01-15 11:15:08 -06:00
parent 61f46d9e08
commit a5fd0b1e31
Signed by: karx
GPG key ID: A794DA2529474BA5

View file

@ -54,9 +54,7 @@ impl EventHandler for Handler {
}
};
let mut b = [0; 1];
nick.chars().nth(0).unwrap().encode_utf8(&mut b);
let byte = b[0];
let byte = nick.chars().nth(0).unwrap() as u8;
let colour_index = (byte as usize + nick.len()) % 12;
let formatted = format!("\x03{:02}", colour_index);