Skip to content

Commit 79b0ad3

Browse files
committed
Raise MSRV to 1.81 with no_std
To get access to core::error::Error.
1 parent 7ca56e7 commit 79b0ad3

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed

.github/workflows/ci.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
toolchain:
1212
- stable
1313
- "1.61"
14+
- "1.81"
1415
steps:
1516
- uses: actions/checkout@v4
1617
- uses: dtolnay/rust-toolchain@master
@@ -19,9 +20,11 @@ jobs:
1920
# All features
2021
- run: cargo check --all-targets --all-features
2122
- run: cargo test --all-features
22-
# No default features
23-
- run: cargo check --all-targets --no-default-features
24-
- run: cargo test --no-default-features
23+
# No default features. Only works on Rust 1.81
24+
- if: matrix.toolchain != 1.61
25+
run: cargo check --all-targets --no-default-features
26+
- if: matrix.toolchain != 1.61
27+
run: cargo test --no-default-features
2528

2629
clippy-fmt:
2730
name: Run Clippy and format code

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0"
88
repository = "https://github.com/pyfisch/keyboard-types"
99
keywords = ["keyboard", "input", "event", "webdriver"]
1010
edition = "2021"
11+
# 1.61 with `std` feature, 1.81 without.
1112
rust-version = "1.61"
1213

1314
[features]

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ input in a cross-platform way.
1414
See also: [UI Events Specification](https://w3c.github.io/uievents/), and in
1515
particular [the section on keyboard events](https://w3c.github.io/uievents/#keys).
1616

17+
Minimum Support Rust Version (MSRV)
18+
-----------------------------------
19+
20+
The minimum supported Rust version is 1.61, or 1.81 if the `"std"` Cargo
21+
feature is disabled. This is not defined by policy, and may change at any time
22+
in a patch release.
23+
1724
Updating Generated Code
1825
-----------------------
1926

convert.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ def convert_key(text, file):
100100
101101
use core::fmt::{self, Display};
102102
use core::str::FromStr;
103+
#[cfg(not(feature = "std"))]
104+
use core::error::Error;
103105
#[cfg(feature = "std")]
104106
use std::error::Error;
105107
@@ -161,7 +163,6 @@ def convert_key(text, file):
161163
}
162164
}
163165
164-
#[cfg(feature = "std")]
165166
impl Error for UnrecognizedNamedKeyError {}""", file=file)
166167

167168

@@ -174,6 +175,8 @@ def convert_code(text, file):
174175
175176
use core::fmt::{self, Display};
176177
use core::str::FromStr;
178+
#[cfg(not(feature = "std"))]
179+
use core::error::Error;
177180
#[cfg(feature = "std")]
178181
use std::error::Error;
179182
@@ -281,7 +284,6 @@ def convert_code(text, file):
281284
}
282285
}
283286
284-
#[cfg(feature = "std")]
285287
impl Error for UnrecognizedCodeError {}""", file=file)
286288

287289

src/code.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use core::fmt::{self, Display};
88
use core::str::FromStr;
9+
#[cfg(not(feature = "std"))]
10+
use core::error::Error;
911
#[cfg(feature = "std")]
1012
use std::error::Error;
1113

@@ -937,5 +939,4 @@ impl fmt::Display for UnrecognizedCodeError {
937939
}
938940
}
939941

940-
#[cfg(feature = "std")]
941942
impl Error for UnrecognizedCodeError {}

src/named_key.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use core::fmt::{self, Display};
88
use core::str::FromStr;
9+
#[cfg(not(feature = "std"))]
10+
use core::error::Error;
911
#[cfg(feature = "std")]
1012
use std::error::Error;
1113

@@ -1313,5 +1315,4 @@ impl fmt::Display for UnrecognizedNamedKeyError {
13131315
}
13141316
}
13151317

1316-
#[cfg(feature = "std")]
13171318
impl Error for UnrecognizedNamedKeyError {}

0 commit comments

Comments
 (0)