From 1d3fc19d26bd7222055e265b71a8c56ac0cb1c43 Mon Sep 17 00:00:00 2001 From: malezjaa Date: Wed, 12 Aug 2026 12:28:12 +0200 Subject: [PATCH] migrate to edition 2024 --- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 2 +- Cargo.toml | 2 +- README.md | 2 +- src/lib.rs | 20 ++++++++++++-------- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 628c3e5..f9273e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: include: # MSRV - - rust: 1.82.0 + - rust: 1.85.0 TARGET: x86_64-unknown-linux-gnu # Test nightly but don't fail @@ -109,7 +109,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.82.0 + toolchain: 1.85.0 components: clippy - uses: actions-rs/clippy-check@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 135e768..e64896e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ Versioning](https://semver.org/spec/v2.0.0.html). ### Changed -- MSRV is now 1.82.0. +- MSRV is now 1.85.0. ## [v0.6.0] - 2023-09-11 diff --git a/Cargo.toml b/Cargo.toml index c7d44a9..a3f1057 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" categories = ["embedded", "hardware-support", "os", "os::unix-apis"] keywords = ["linux", "gpio", "gpiochip", "embedded"] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2024" [features] default = [] diff --git a/README.md b/README.md index a44d08d..35a059c 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ to be considered reliable. ## Minimum Supported Rust Version (MSRV) -This crate is guaranteed to compile on stable Rust 1.82.0 and up. It *might* +This crate is guaranteed to compile on stable Rust 1.85.0 and up. It *might* compile with older versions but that may change in any new patch release. ## License diff --git a/src/lib.rs b/src/lib.rs index b8b6506..138b675 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,7 +91,7 @@ extern crate nix; use std::cmp::min; use std::ffi::CStr; -use std::fs::{read_dir, File, ReadDir}; +use std::fs::{File, ReadDir, read_dir}; use std::io::Read; use std::mem; use std::ops::Index; @@ -123,9 +123,11 @@ pub use crate::async_tokio::AsyncLineEventHandle; pub use errors::*; unsafe fn rstr_lcpy(dst: *mut libc::c_char, src: &str, length: usize) { - let copylen = min(src.len() + 1, length); - ptr::copy_nonoverlapping(src.as_bytes().as_ptr().cast(), dst, copylen - 1); - slice::from_raw_parts_mut(dst, length)[copylen - 1] = 0; + unsafe { + let copylen = min(src.len() + 1, length); + ptr::copy_nonoverlapping(src.as_bytes().as_ptr().cast(), dst, copylen - 1); + slice::from_raw_parts_mut(dst, length)[copylen - 1] = 0; + } } #[derive(Debug)] @@ -396,10 +398,12 @@ pub enum LineDirection { } unsafe fn cstrbuf_to_string(buf: &[libc::c_char]) -> Option { - if buf[0] == 0 { - None - } else { - Some(CStr::from_ptr(buf.as_ptr()).to_string_lossy().into_owned()) + unsafe { + if buf[0] == 0 { + None + } else { + Some(CStr::from_ptr(buf.as_ptr()).to_string_lossy().into_owned()) + } } }