From: Stephen Seo Date: Thu, 16 Sep 2021 05:44:31 +0000 (+0900) Subject: Apply cargo clippy fixes X-Git-Tag: 0.1.0~34 X-Git-Url: https://git.seodisparate.com/tbm-server-edit-damage-sources.png?a=commitdiff_plain;h=a373cf6a87931f3e239dcaa920506700cc35a682;p=mpd_info_screen Apply cargo clippy fixes --- diff --git a/src/main.rs b/src/main.rs index 3917096..506d0de 100644 --- a/src/main.rs +++ b/src/main.rs @@ -96,8 +96,8 @@ fn check_next_chars( )) } else if buf[idx] & 0b11110000 == 0b11100000 { if idx + 2 >= buf.len() { - for tidx in idx..buf.len() { - saved.push(buf[tidx]); + for c in buf.iter().skip(idx) { + saved.push(*c); } return Err(( String::from("Is three byte UTF-8, but not enough bytes provided"), @@ -113,8 +113,8 @@ fn check_next_chars( )) } else if buf[idx] & 0b11111000 == 0b11110000 { if idx + 2 >= buf.len() { - for tidx in idx..buf.len() { - saved.push(buf[tidx]); + for c in buf.iter().skip(idx) { + saved.push(*c); } return Err(( String::from("Is four byte UTF-8, but not enough bytes provided"), @@ -159,7 +159,7 @@ fn read_line( skip_count -= 1; continue; } - let next_char_result = check_next_chars(&mut buf_to_read, idx, saved); + let next_char_result = check_next_chars(&buf_to_read, idx, saved); if let Ok((c, s)) = next_char_result { if !init { prev_two.push(c); @@ -196,7 +196,7 @@ fn read_line( Err((String::from("Newline not reached"), result)) } -fn debug_write_albumart_to_file(data: &Vec) -> Result<(), String> { +fn debug_write_albumart_to_file(data: &[u8]) -> Result<(), String> { let mut f = File::create("albumartOut.jpg") .map_err(|_| String::from("Failed to open file for writing albumart"))?; f.write_all(data)