Skip to content

Commit 9af6e22

Browse files
committed
Set minimal supported Rust version to 1.77
Current code has `Option::is_none_or()` which released 2024 Oct 17, considering old compiler environment like Ubuntu LTS, RHEL and SLES, replaced it to: ```rust self.unsolicited_messages_tx.as_ref().is_none() || self.unsolicited_messages_tx.as_ref().map(|x| x.is_closed()) ``` Set minimum supported Rust version to 1.77 to `Cargo.toml` and enabled CI test for it. Signed-off-by: Gris Ge <[email protected]>
1 parent 8811b0d commit 9af6e22

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

Diff for: .github/workflows/main.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,21 @@ on:
1010
jobs:
1111
ci:
1212
name: CI (stable)
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
include:
17+
- rust_version: "stable"
18+
- rust_version: "1.77"
1319
runs-on: ubuntu-latest
1420

1521
steps:
1622
- uses: actions/checkout@v3
1723

18-
- name: Install Rust Stable
24+
- name: Install Rust ${{ matrix.rust_version }}
1925
run: |
20-
rustup override set stable
21-
rustup update stable
26+
rustup override set ${{ matrix.rust_version }}
27+
rustup update ${{ matrix.rust_version }}
2228
2329
- name: Test with default feature
2430
run: cargo test

Diff for: Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ authors = ["Corentin Henry <[email protected]>"]
33
name = "netlink-proto"
44
version = "0.11.4"
55
edition = "2018"
6+
rust-version = "1.77"
67

78
homepage = "https://github.com/rust-netlink/netlink-proto"
89
keywords = ["netlink", "linux", "async"]

Diff for: src/connection.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,14 @@ where
236236
}
237237
}
238238

239+
// Rust 1.82 has Option::is_none_or() which can simplify
240+
// below checks but that version is too new(2025-Jan-26).
241+
// For this fundamental crate, we should consider old compiler
242+
// environment like Ubuntu LTS, RHEL and SLES.
239243
if ready
240-
|| self
241-
.unsolicited_messages_tx
242-
.as_ref()
243-
.is_none_or(|x| x.is_closed())
244+
|| self.unsolicited_messages_tx.as_ref().is_none()
245+
|| self.unsolicited_messages_tx.as_ref().map(|x| x.is_closed())
246+
== Some(true)
244247
{
245248
// The channel is closed so we can drop the sender.
246249
let _ = self.unsolicited_messages_tx.take();

0 commit comments

Comments
 (0)