Replace complex conditional with pattern matching

This commit is contained in:
Philipp Hansch 2021-04-10 14:42:33 +02:00
parent 1573d10325
commit dde46c9340

View File

@ -106,7 +106,7 @@ fn get_chunks_of_tabs(the_str: &str) -> Vec<(u32, u32)> {
let char_indices: Vec<_> = the_str.char_indices().collect();
if char_indices.len() == 1 && char_indices.first().unwrap().1 == '\t' {
if let &[(_, '\t')] = &char_indices.as_slice() {
return vec![(0, 1)];
}