Skip to content

Commit cc6a399

Browse files
committed
Update to edition 2024
1 parent 60669f8 commit cc6a399

File tree

8 files changed

+27
-23
lines changed

8 files changed

+27
-23
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
build-and-test:
1818
strategy:
1919
matrix:
20-
rust: [stable, beta, nightly, 1.38.0]
20+
rust: [stable, beta, nightly, 1.85.0]
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Install build dependencies

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1818
### Changed
1919
- Rename `Socket::recv` to `Socket::recv_raw`.
2020
- Add new `Socket::recv` that returns an iterator of netlink messages (`NlMessages`).
21+
- Update to Rust 2024 and bump MSRV to 1.85.
2122

2223

2324
## [0.2.3] - 2025-10-28

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ members = [
33
"mnl-sys",
44
"mnl",
55
]
6+
7+
resolver = "3"

mnl-sys/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ repository = "https://github.com/mullvad/mnl-rs"
88
readme = "README.md"
99
keywords = ["netlink", "libmnl"]
1010
categories = ["network-programming", "os::unix-apis", "external-ffi-bindings", "no-std"]
11-
edition = "2018"
12-
rust-version = "1.38"
11+
edition = "2024"
12+
rust-version = "1.85"
1313
links = "mnl"
1414

1515
[badges]

mnl-sys/src/bindings.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use core::option::Option;
2-
use libc::{c_char, c_int, c_uint, c_void, nlattr, nlmsghdr, pid_t, socklen_t, FILE};
2+
use libc::{FILE, c_char, c_int, c_uint, c_void, nlattr, nlmsghdr, pid_t, socklen_t};
33

44
pub const MNL_SOCKET_AUTOPID: c_int = 0;
55
pub const MNL_ALIGNTO: c_int = 4;
@@ -35,7 +35,7 @@ pub struct mnl_socket(c_void);
3535
#[repr(C)]
3636
pub struct mnl_nlmsg_batch(c_void);
3737

38-
extern "C" {
38+
unsafe extern "C" {
3939
pub fn mnl_socket_open(bus: c_int) -> *mut mnl_socket;
4040

4141
#[cfg(feature = "mnl-1-0-4")]
@@ -158,13 +158,13 @@ extern "C" {
158158
pub fn mnl_attr_put_u8_check(nlh: *mut nlmsghdr, buflen: usize, type_: u16, data: u8) -> bool;
159159

160160
pub fn mnl_attr_put_u16_check(nlh: *mut nlmsghdr, buflen: usize, type_: u16, data: u16)
161-
-> bool;
161+
-> bool;
162162

163163
pub fn mnl_attr_put_u32_check(nlh: *mut nlmsghdr, buflen: usize, type_: u16, data: u32)
164-
-> bool;
164+
-> bool;
165165

166166
pub fn mnl_attr_put_u64_check(nlh: *mut nlmsghdr, buflen: usize, type_: u16, data: u64)
167-
-> bool;
167+
-> bool;
168168

169169
pub fn mnl_attr_put_str_check(
170170
nlh: *mut nlmsghdr,

mnl/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ repository = "https://github.com/mullvad/mnl-rs"
88
readme = "../README.md"
99
keywords = ["netlink", "libmnl"]
1010
categories = ["network-programming", "os::unix-apis", "api-bindings"]
11-
edition = "2018"
12-
rust-version = "1.38"
11+
edition = "2024"
12+
rust-version = "1.85"
1313

1414
[badges]
1515
travis-ci = { repository = "mullvad/mnl-rs" }

mnl/src/messages.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ mod tests {
159159

160160
let result: Result<Vec<_>, _> = NlMessages::new(&buffer).collect();
161161
assert!(result.is_err());
162-
assert!(result
163-
.unwrap_err()
164-
.to_string()
165-
.contains("Invalid netlink message length"));
162+
assert!(
163+
result
164+
.unwrap_err()
165+
.to_string()
166+
.contains("Invalid netlink message length")
167+
);
166168
}
167169

168170
#[test]
@@ -173,10 +175,12 @@ mod tests {
173175

174176
let result: Result<Vec<_>, _> = NlMessages::new(&buffer).collect();
175177
assert!(result.is_err());
176-
assert!(result
177-
.unwrap_err()
178-
.to_string()
179-
.contains("exceeds remaining buffer size"));
178+
assert!(
179+
result
180+
.unwrap_err()
181+
.to_string()
182+
.contains("exceeds remaining buffer size")
183+
);
180184
}
181185

182186
#[test]

mnl/src/socket.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88
os::unix::io::{AsRawFd, RawFd},
99
};
1010

11-
use crate::{cvt::cvt, NlMessages};
11+
use crate::{NlMessages, cvt::cvt};
1212

1313
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
1414
#[allow(missing_docs)]
@@ -127,10 +127,7 @@ impl Socket {
127127
{
128128
for data in iter {
129129
if self.send(data)? < data.len() {
130-
return Err(io::Error::new(
131-
io::ErrorKind::Other,
132-
"sendto did not send entire message",
133-
));
130+
return Err(io::Error::other("sendto did not send entire message"));
134131
}
135132
}
136133
Ok(())

0 commit comments

Comments
 (0)