Skip to content

Commit bb482ed

Browse files
madsmtmpyfisch
authored andcommitted
Raise MSRV to 1.81 with no_std
To get access to core::error::Error.
1 parent e1cd821 commit bb482ed

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
@@ -111,6 +111,8 @@ def convert_key(text, file):
111111
112112
use core::fmt::{self, Display};
113113
use core::str::FromStr;
114+
#[cfg(not(feature = "std"))]
115+
use core::error::Error;
114116
#[cfg(feature = "std")]
115117
use std::error::Error;
116118
@@ -176,7 +178,6 @@ def convert_key(text, file):
176178
}
177179
}
178180
179-
#[cfg(feature = "std")]
180181
impl Error for UnrecognizedNamedKeyError {}""", file=file)
181182

182183

@@ -189,6 +190,8 @@ def convert_code(text, file):
189190
190191
use core::fmt::{self, Display};
191192
use core::str::FromStr;
193+
#[cfg(not(feature = "std"))]
194+
use core::error::Error;
192195
#[cfg(feature = "std")]
193196
use std::error::Error;
194197
@@ -305,7 +308,6 @@ def convert_code(text, file):
305308
}
306309
}
307310
308-
#[cfg(feature = "std")]
309311
impl Error for UnrecognizedCodeError {}""", file=file)
310312

311313

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

@@ -949,5 +951,4 @@ impl fmt::Display for UnrecognizedCodeError {
949951
}
950952
}
951953

952-
#[cfg(feature = "std")]
953954
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

@@ -1315,5 +1317,4 @@ impl fmt::Display for UnrecognizedNamedKeyError {
13151317
}
13161318
}
13171319

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

0 commit comments

Comments
 (0)