diff --git a/build/parser.rs b/build/parser.rs index c9303e9a32..2436502314 100644 --- a/build/parser.rs +++ b/build/parser.rs @@ -1379,7 +1379,7 @@ pub fn extra_crc(msg: &MavMessage) -> u8 { let mut crc = CRCu16::crc16mcrf4cc(); crc.digest(msg.name.as_bytes()); - crc.digest(" ".as_bytes()); + crc.digest(b" "); let mut f = msg.fields.clone(); // only mavlink 1 fields should be part of the extra_crc @@ -1387,13 +1387,13 @@ pub fn extra_crc(msg: &MavMessage) -> u8 { f.sort_by(|a, b| a.mavtype.compare(&b.mavtype)); for field in &f { crc.digest(field.mavtype.primitive_type().as_bytes()); - crc.digest(" ".as_bytes()); + crc.digest(b" "); if field.name == "mavtype" { - crc.digest("type".as_bytes()); + crc.digest(b"type"); } else { crc.digest(field.name.as_bytes()); } - crc.digest(" ".as_bytes()); + crc.digest(b" "); if let MavType::Array(_, size) = field.mavtype { crc.digest(&[size as u8]); } @@ -1440,28 +1440,22 @@ impl MavXmlFilter { Ok(content) => { match content { Event::Start(bytes) | Event::Empty(bytes) => { - let id = match identify_element(bytes.name().into_inner()) { - None => { - panic!( - "unexpected element {:?}", - String::from_utf8_lossy(bytes.name().into_inner()) - ); - } - Some(kind) => kind, + let Some(id) = identify_element(bytes.name().into_inner()) else { + panic!( + "unexpected element {:?}", + String::from_utf8_lossy(bytes.name().into_inner()) + ); }; if id == MavXmlElement::Extensions { self.extension_filter.is_in = true; } } Event::End(bytes) => { - let id = match identify_element(bytes.name().into_inner()) { - None => { - panic!( - "unexpected element {:?}", - String::from_utf8_lossy(bytes.name().into_inner()) - ); - } - Some(kind) => kind, + let Some(id) = identify_element(bytes.name().into_inner()) else { + panic!( + "unexpected element {:?}", + String::from_utf8_lossy(bytes.name().into_inner()) + ); }; if id == MavXmlElement::Message {