rust/clippy: fix lint: while_let_loop

pull/8251/head
Jason Ish 4 years ago committed by Victor Julien
parent 4daee8bae1
commit 925bc74c1f

@ -50,7 +50,6 @@
#![allow(clippy::single_match)] #![allow(clippy::single_match)]
#![allow(clippy::type_complexity)] #![allow(clippy::type_complexity)]
#![allow(clippy::upper_case_acronyms)] #![allow(clippy::upper_case_acronyms)]
#![allow(clippy::while_let_loop)]
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;

@ -28,16 +28,11 @@ use widestring::U16CString;
pub fn le_slice_to_string(input: &[u8]) -> Result<String, Box<dyn std::error::Error>> { pub fn le_slice_to_string(input: &[u8]) -> Result<String, Box<dyn std::error::Error>> {
let mut vec = Vec::new(); let mut vec = Vec::new();
let mut cursor = Cursor::new(input); let mut cursor = Cursor::new(input);
loop { while let Ok(x) = cursor.read_u16::<byteorder::LittleEndian>() {
match cursor.read_u16::<byteorder::LittleEndian>() {
Ok(x) => {
if x == 0 { if x == 0 {
break; break;
};
vec.push(x)
}
Err(_) => break,
} }
vec.push(x);
} }
match U16CString::new(vec) { match U16CString::new(vec) {
Ok(x) => match x.to_string() { Ok(x) => match x.to_string() {

Loading…
Cancel
Save