From db103f8e04ff16df80cb35e8d5b1d5be904d9105 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Mon, 20 Mar 2023 07:15:47 +0000 Subject: [PATCH] more refactoring --- build/parser.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/parser.rs b/build/parser.rs index fc3cbaa7b4..c42f96fb17 100644 --- a/build/parser.rs +++ b/build/parser.rs @@ -57,7 +57,7 @@ impl MavProfile { fn update_enums(mut self) -> Self { for msg in self.messages.values() { for field in &msg.fields { - if let Some(ref enum_name) = field.enumtype { + if let Some(enum_name) = &field.enumtype { // it is a bitmask if let Some("bitmask") = field.display.as_deref() { // find the corresponding enum @@ -355,7 +355,7 @@ impl MavEnum { let value; #[cfg(feature = "emit-description")] - let description = if let Some(description) = enum_entry.description.as_ref() { + let description = if let Some(description) = &enum_entry.description { quote!(#[doc = #description]) } else { quote!() @@ -399,7 +399,7 @@ impl MavEnum { let enum_name = self.emit_name(); #[cfg(feature = "emit-description")] - let description = if let Some(description) = self.description.as_ref() { + let description = if let Some(description) = &self.description { quote!(#[doc = #description]) } else { quote!() @@ -624,7 +624,7 @@ impl MavField { if matches!(self.mavtype, MavType::Array(_, _)) { let rt = TokenStream::from_str(&self.mavtype.rust_type()).unwrap(); mavtype = quote!(#rt); - } else if let Some(ref enumname) = self.enumtype { + } else if let Some(enumname) = &self.enumtype { let en = TokenStream::from_str(enumname).unwrap(); mavtype = quote!(#en); } else { @@ -1223,7 +1223,7 @@ pub fn parse_profile( entry.description = Some(s.replace('\n', " ")); } (Some(&Param), Some(&Entry)) => { - if let Some(ref mut params) = entry.params { + if let Some(params) = &mut entry.params { // Some messages can jump between values, like: // 0, 1, 2, 7 if params.len() < paramid.unwrap() {