Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move to 2021 edition #262

Merged
merged 2 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ num-traits = { version = "0.2", default-features = false }
num-derive = "0.3.2"
bitflags = "1.2.1"
byteorder = { version = "1.3.4", default-features = false }

[workspace.package]
edition = "2021"
2 changes: 1 addition & 1 deletion mavlink-bindgen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "mavlink-bindgen"
version = "0.13.2"
edition = "2021"
edition.workspace = true
license = "MIT/Apache-2.0"
description = "Library used by rust-mavlink."
readme = "README.md"
Expand Down
3 changes: 1 addition & 2 deletions mavlink-bindgen/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
value = quote!(#cnt);
} else {
let tmp_value = enum_entry.value.unwrap();
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 Expand Up @@ -1107,9 +1107,8 @@

assert!(
is_valid_parent(stack.last().copied(), id),
"not valid parent {:?} of {:?}",
"not valid parent {:?} of {id:?}",
stack.last(),
id
);

match id {
Expand Down
2 changes: 1 addition & 1 deletion mavlink-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description = "Implements the MAVLink data interchange format for UAVs."
readme = "../README.md"
license = "MIT/Apache-2.0"
repository = "https://github.com/mavlink/rust-mavlink"
edition = "2018"
edition.workspace = true
rust-version = "1.65.0"

[dependencies]
Expand Down
3 changes: 1 addition & 2 deletions mavlink-core/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ impl<'a> Bytes<'a> {
fn check_remaining(&self, count: usize) {
assert!(
self.remaining() >= count,
"read buffer exhausted; remaining {} bytes, try read {} bytes",
"read buffer exhausted; remaining {} bytes, try read {count} bytes",
self.remaining(),
count
);
}

Expand Down
15 changes: 4 additions & 11 deletions mavlink-core/src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ impl<'a> BytesMut<'a> {
fn check_remaining(&self, count: usize) {
assert!(
self.remaining() >= count,
"write buffer overflow; remaining {} bytes, try add {} bytes",
"write buffer overflow; remaining {} bytes, try add {count} bytes",
self.remaining(),
count
);
}

Expand Down Expand Up @@ -87,9 +86,7 @@ impl<'a> BytesMut<'a> {
assert!(
val <= MAX,
"Attempted to put value that is too large for 24 bits, \
attempted to push: {}, max allowed: {}",
val,
MAX
attempted to push: {val}, max allowed: {MAX}",
);

let src = val.to_le_bytes();
Expand All @@ -106,16 +103,12 @@ impl<'a> BytesMut<'a> {
assert!(
val <= MAX,
"Attempted to put value that is too large for 24 bits, \
attempted to push: {}, max allowed: {}",
val,
MAX
attempted to push: {val}, max allowed: {MAX}",
);
assert!(
val >= MIN,
"Attempted to put value that is too negative for 24 bits, \
attempted to push: {}, min allowed: {}",
val,
MIN
attempted to push: {val}, min allowed: {MIN}",
);

let src = val.to_le_bytes();
Expand Down
2 changes: 1 addition & 1 deletion mavlink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description = "Implements the MAVLink data interchange format for UAVs."
readme = "../README.md"
license = "MIT/Apache-2.0"
repository = "https://github.com/mavlink/rust-mavlink"
edition = "2018"
edition.workspace = true
rust-version = "1.65.0"

[build-dependencies]
Expand Down
Loading