1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-02 19:32:25 +01:00

Run 'cargo fmt'

This commit is contained in:
sharkdp
2020-04-24 16:09:56 +02:00
committed by David Peter
parent 81488adf8b
commit 8e18786556
5 changed files with 11 additions and 7 deletions

View File

@@ -36,7 +36,10 @@ pub fn expand_tabs(line: &str, width: usize, cursor: &mut usize) -> String {
fn try_parse_utf8_char(input: &[u8]) -> Option<(char, usize)> {
let str_from_utf8 = |seq| std::str::from_utf8(seq).ok();
let decoded = input.get(0..1).and_then(str_from_utf8).map(|c| (c, 1))
let decoded = input
.get(0..1)
.and_then(str_from_utf8)
.map(|c| (c, 1))
.or_else(|| input.get(0..2).and_then(str_from_utf8).map(|c| (c, 2)))
.or_else(|| input.get(0..3).and_then(str_from_utf8).map(|c| (c, 3)))
.or_else(|| input.get(0..4).and_then(str_from_utf8).map(|c| (c, 4)));