Skip to content

Commit 0c75e92

Browse files
committed
remove mut
1 parent 090fd6f commit 0c75e92

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ui/chat_box.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ impl<'a> ChatBox<'a> {
5353
.map(std::borrow::Cow::into_owned)
5454
.map(Line::from)
5555
.collect_vec();
56-
let mut row_height: u16 = name.len().try_into().unwrap();
5756

5857
let message_string = message_data
5958
.get_message()
@@ -66,8 +65,11 @@ impl<'a> ChatBox<'a> {
6665
.collect_vec()
6766
})
6867
.collect_vec();
69-
if message_string.len() > row_height as usize {
70-
row_height = message_string.len().try_into().unwrap();
68+
69+
let row_height: u16 = if message_string.len() > name.len() {
70+
message_string.len().try_into().expect("message too long")
71+
} else {
72+
name.len().try_into().expect("name too long")
7173
};
7274
let message: Vec<Cell> = vec![
7375
message_data.get_time_str().into(),

0 commit comments

Comments
 (0)