Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleades committed Oct 22, 2023
1 parent e4441f8 commit b17d729
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readme = "README.md"
license = "MIT/Apache-2.0"
repository = "https://github.com/mavlink/rust-mavlink"
edition = "2018"
rust-version = "1.60.0"
rust-version = "1.65.0"

[build-dependencies]
crc-any = { version = "2.3.0", default-features = false }
Expand Down
29 changes: 13 additions & 16 deletions build/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,14 @@ 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 {
// it is an enum
if let Some(ref dsp) = field.display {
// it is a bitmask
if dsp == "bitmask" {
// find the corresponding enum
for enm in self.enums.values_mut() {
if enm.name == *enum_name {
// this is the right enum
enm.bitfield = Some(field.mavtype.rust_primitive_type());
}
if let Some(enum_name) = &field.enumtype {
// it is a bitmask
if let Some("bitmask") = &field.display.as_deref() {
// find the corresponding enum
for enm in self.enums.values_mut() {
if enm.name == *enum_name {
// this is the right enum
enm.bitfield = Some(field.mavtype.rust_primitive_type());
}
}
}
Expand Down Expand Up @@ -643,7 +640,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 @@ -1122,7 +1119,7 @@ pub fn parse_profile(
let attr = attr.unwrap();
match stack.last() {
Some(&MavXmlElement::Enum) => {
if let b"name" = attr.key.into_inner() {
if attr.key.into_inner() == b"name" {
mavenum.name = attr
.value
.clone()
Expand Down Expand Up @@ -1273,7 +1270,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 Expand Up @@ -1452,7 +1449,7 @@ impl MavXmlFilter {
}
Some(kind) => kind,
};
if let MavXmlElement::Extensions = id {
if id == MavXmlElement::Extensions {
self.extension_filter.is_in = true;
}
}
Expand All @@ -1467,7 +1464,7 @@ impl MavXmlFilter {
Some(kind) => kind,
};

if let MavXmlElement::Message = id {
if id == MavXmlElement::Message {
self.extension_filter.is_in = false;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/connection/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ struct PacketBuf {

impl PacketBuf {
pub fn new() -> Self {
let mut v = Vec::new();
v.resize(65536, 0);
let v = vec![0; 65536];
Self {
buf: v,
start: 0,
Expand Down

0 comments on commit b17d729

Please sign in to comment.