Skip to content

Commit d16c44d

Browse files
Support rust 1.74.1 (#128)
* Add rust 1.74.0 to the test matrix * Add rust 1.74.0 to the test matrix * Correct some mistakes in README.md about older macos versions. * Debug builds * Rollback changes and disable some lints * Bump version for next release fixing lints issues * Add rustc version output to before clippy * Localize the allows * Allow all on those lines
1 parent 359b222 commit d16c44d

File tree

6 files changed

+35
-36
lines changed

6 files changed

+35
-36
lines changed

.github/workflows/clippy_build_test.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
os: [ ubuntu-latest, macos-11, macos-12, macos-13, macos-14 ]
21-
rust: [stable, beta]
21+
rust: [stable, beta, 1.74.1] # Minimum Rust Version Supported = 1.74.1
2222
experimental: [false]
2323
include:
2424
- os: ubuntu-latest
@@ -42,22 +42,18 @@ jobs:
4242
steps:
4343
- uses: actions/checkout@v2
4444

45-
- name: Install latest nightly
45+
- name: Install toolchain
4646
uses: actions-rs/toolchain@v1
4747
with:
4848
profile: minimal
49-
toolchain: nightly
49+
toolchain: ${{ matrix.rust }}
5050
override: true
5151
components: clippy
5252

53-
- name: Clippy
54-
run: make clippy
55-
56-
- name: Compile check on redox
57-
if: runner.os == 'Linux'
53+
- name: Run clippy (installed toolchain version as per matrix)
5854
run: |
59-
rustup target add x86_64-unknown-redox
60-
cargo +nightly check --target x86_64-unknown-redox
55+
rustc --version
56+
cargo clippy --all --tests --no-deps --all-targets --all-features -- --warn clippy::pedantic -D warnings
6157
6258
- name: ConfigureCoverage
6359
if: matrix.rust == 'nightly'
@@ -76,5 +72,5 @@ jobs:
7672
run: sudo env "PATH=$PATH" cargo test
7773

7874
- name: UploadCoverage
79-
if: matrix.rust == 'nightly'
75+
if: matrix.rust == 'stable'
8076
run: make upload-coverage

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libproc"
3-
version = "0.14.5"
3+
version = "0.14.6"
44
description = "A library to get information about running processes - for Mac OS X and Linux"
55
authors = ["Andrew Mackenzie <[email protected]>"]
66
repository = "https://github.com/andrewdavidmackenzie/libproc-rs"
@@ -15,8 +15,7 @@ libc = "^0.2.62"
1515

1616
[features]
1717
default = ["macosx_10_9"]
18-
macosx_10_7 = []
19-
macosx_10_9 = ["macosx_10_7"]
18+
macosx_10_9 = []
2019

2120
[lib]
2221
name = "libproc"

README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,31 @@ You can find the browseable docs for the latest release on [docs.rs](https://doc
2525

2626
NOTE: `master` branch (code and docs) can differ from those docs prior to a new release.
2727

28-
# Rust Channels Tested
29-
The Github Actions CI matrix tests for rust `stable`, `beta` and `nightly` on all platforms
28+
# Minimum rust version
29+
The minimum rust version required is currently: 1.74.1 and this is tested in CI and must pass.
3030

31-
# Platforms
32-
Mac OS X (10.5 and above) and Linux.
31+
# Test Matrix
32+
The Github Actions CI matrix is:
3333

34-
## Mac OS X Versions
35-
Calls were aded to libproc in Mac OS X 10.7 and again in 10.9.
36-
This library can be compiled to not include those calls by using rust `features`
37-
to enable/disable support for those versions.
34+
rust versions:
35+
* `stable` (must pass)
36+
* `beta` (must pass)
37+
* `1.74.1` (currently the minimum rust version supported) (must pass)
38+
* `nightly` (allowed to fail)
3839

39-
The default build is for Mac OS 10.9 or later. See:
40-
```toml
41-
[features]
42-
default = ["macosx_10_9"]
43-
macosx_10_7 = []
44-
macosx_10_9 = ["macosx_10_7"]
45-
```
46-
in Cargo.toml
40+
on the following platforms:
41+
* `ubuntu-latest`
42+
* `macos-11` (Big Sur)
43+
* `macos-12` (Monterey)
44+
* `macos-13` (Ventura)
45+
* `macos-14` (Sonoma)
4746

48-
To build for versions prior to Mac OS 10.7 disable the default features by passing --no-default-features to cargo.
4947

50-
To build for Mac OS X 10.7 (or 10.8) you can enable that feature alone using
51-
--no-default-features --features "macosx_10_7"
48+
## Mac OS X Versions
49+
Calls were added to libproc in 10.9 (Mavericks) and they are under a rust "feature" switch called "macosx_10_9".
50+
The default build includes the "macosx_10_9" feature.
51+
52+
To build for versions prior to Mac OS 10.9 disable the default features by passing `--no-default-features` to cargo.
5253

5354
# Examples
5455
Two simple examples are included to show libproc-rs working.

src/libproc/file_info.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ pub fn pidfdinfo<T: PIDFDInfo>(pid: i32, fd: i32) -> Result<T, String> {
162162
#[allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap)]
163163
let buffer_size = mem::size_of::<T>() as i32;
164164
let mut pidinfo = T::default();
165-
let buffer_ptr = std::ptr::from_mut::<T>(&mut pidinfo).cast::<c_void>();
165+
#[allow(clippy::pedantic)]
166+
let buffer_ptr = &mut pidinfo as *mut _ as *mut c_void;
166167
let ret: i32;
167168

168169
unsafe {

src/libproc/pid_rusage.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,8 @@ impl PIDRUsage for RUsageInfoV4 {
384384
pub fn pidrusage<T: PIDRUsage>(pid: i32) -> Result<T, String> {
385385
let flavor = T::flavor() as i32;
386386
let mut pidrusage = T::default();
387-
let buffer_ptr = std::ptr::from_mut::<T>(&mut pidrusage).cast::<c_void>();
387+
#[allow(clippy::pedantic)]
388+
let buffer_ptr = &mut pidrusage as *mut _ as *mut c_void;
388389
let ret: i32;
389390

390391
unsafe {

src/libproc/proc_pid.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ pub fn pidinfo<T: PIDInfo>(pid: i32, arg: u64) -> Result<T, String> {
238238
#[allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap)]
239239
let buffer_size = mem::size_of::<T>() as c_int;
240240
let mut pidinfo = unsafe { mem::zeroed() };
241-
let buffer_ptr = std::ptr::from_mut::<T>(&mut pidinfo).cast::<c_void>();
241+
#[allow(clippy::pedantic)]
242+
let buffer_ptr = &mut pidinfo as *mut _ as *mut c_void;
242243
let ret: i32;
243244

244245
unsafe {

0 commit comments

Comments
 (0)