Skip to content

Commit

Permalink
fix: Enum entries without value are generated as isize
Browse files Browse the repository at this point in the history
  • Loading branch information
pv42 committed Jul 31, 2024
1 parent ab925ad commit 3c28fcc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mavlink-bindgen/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ impl MavEnum {
}

fn emit_defs(&self) -> Vec<TokenStream> {
let mut cnt = 0isize;
let mut cnt = 0u32;
self.entries
.iter()
.map(|enum_entry| {
Expand All @@ -330,7 +330,7 @@ impl MavEnum {
value = quote!(#cnt);
} else {
let tmp_value = enum_entry.value.unwrap();
cnt = cnt.max(tmp_value as isize);
cnt = cnt.max(tmp_value as u32);

Check warning on line 333 in mavlink-bindgen/src/parser.rs

View workflow job for this annotation

GitHub Actions / linting

casting to the same type is unnecessary (`u32` -> `u32`)

warning: casting to the same type is unnecessary (`u32` -> `u32`) --> mavlink-bindgen/src/parser.rs:333:35 | 333 | cnt = cnt.max(tmp_value as u32); | ^^^^^^^^^^^^^^^^ help: try: `tmp_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `#[warn(clippy::unnecessary_cast)]` on by default
let tmp = TokenStream::from_str(&tmp_value.to_string()).unwrap();
value = quote!(#tmp);
};
Expand Down

0 comments on commit 3c28fcc

Please sign in to comment.