Skip to content

Commit

Permalink
more refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleades committed Mar 20, 2023
1 parent b8b2321 commit db103f8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!()
Expand Down Expand Up @@ -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!()
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit db103f8

Please sign in to comment.