Skip to content
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -396,10 +398,12 @@ pub enum LineDirection {
}

unsafe fn cstrbuf_to_string(buf: &[libc::c_char]) -> Option<String> {
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())
}
}
}

Expand Down
Loading