From 2ab67858a184ca74dca6d5e788c5cf0f910f4c18 Mon Sep 17 00:00:00 2001 From: danieleades <33452915+danieleades@users.noreply.github.com> Date: Sun, 25 Aug 2024 16:23:09 +0100 Subject: [PATCH] move to 2021 edition (#262) --- Cargo.toml | 3 +++ mavlink-bindgen/Cargo.toml | 2 +- mavlink-bindgen/src/parser.rs | 3 +-- mavlink-core/Cargo.toml | 2 +- mavlink-core/src/bytes.rs | 3 +-- mavlink-core/src/bytes_mut.rs | 15 ++++----------- mavlink/Cargo.toml | 2 +- 7 files changed, 12 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 65e9ef8b1d..064abc84b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/mavlink-bindgen/Cargo.toml b/mavlink-bindgen/Cargo.toml index 4a6e365f7d..f34d44ab1d 100644 --- a/mavlink-bindgen/Cargo.toml +++ b/mavlink-bindgen/Cargo.toml @@ -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" diff --git a/mavlink-bindgen/src/parser.rs b/mavlink-bindgen/src/parser.rs index e6ee66f3ab..2b45e5d17b 100644 --- a/mavlink-bindgen/src/parser.rs +++ b/mavlink-bindgen/src/parser.rs @@ -1107,9 +1107,8 @@ pub fn parse_profile( assert!( is_valid_parent(stack.last().copied(), id), - "not valid parent {:?} of {:?}", + "not valid parent {:?} of {id:?}", stack.last(), - id ); match id { diff --git a/mavlink-core/Cargo.toml b/mavlink-core/Cargo.toml index 8883a15ded..246c657537 100644 --- a/mavlink-core/Cargo.toml +++ b/mavlink-core/Cargo.toml @@ -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] diff --git a/mavlink-core/src/bytes.rs b/mavlink-core/src/bytes.rs index 712ca36623..e1b11ff433 100644 --- a/mavlink-core/src/bytes.rs +++ b/mavlink-core/src/bytes.rs @@ -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 ); } diff --git a/mavlink-core/src/bytes_mut.rs b/mavlink-core/src/bytes_mut.rs index 1fc22b9cf6..df607c83c8 100644 --- a/mavlink-core/src/bytes_mut.rs +++ b/mavlink-core/src/bytes_mut.rs @@ -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 ); } @@ -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(); @@ -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(); diff --git a/mavlink/Cargo.toml b/mavlink/Cargo.toml index 597a6c756b..46896b017c 100644 --- a/mavlink/Cargo.toml +++ b/mavlink/Cargo.toml @@ -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]