Skip to content

Raise MSRV to 1.81 on no_std #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2025
Merged
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
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
toolchain:
- stable
- "1.61"
- "1.81"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand All @@ -19,9 +20,11 @@ jobs:
# All features
- run: cargo check --all-targets --all-features
- run: cargo test --all-features
# No default features
- run: cargo check --all-targets --no-default-features
- run: cargo test --no-default-features
# No default features. Only works on Rust 1.81
- if: matrix.toolchain != 1.61
run: cargo check --all-targets --no-default-features
- if: matrix.toolchain != 1.61
run: cargo test --no-default-features

clippy-fmt:
name: Run Clippy and format code
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/pyfisch/keyboard-types"
keywords = ["keyboard", "input", "event", "webdriver"]
edition = "2021"
# 1.61 with `std` feature, 1.81 without.
rust-version = "1.61"

[features]
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ input in a cross-platform way.
See also: [UI Events Specification](https://w3c.github.io/uievents/), and in
particular [the section on keyboard events](https://w3c.github.io/uievents/#keys).

Minimum Support Rust Version (MSRV)
-----------------------------------

The minimum supported Rust version is 1.61, or 1.81 if the `"std"` Cargo
feature is disabled. This is not defined by policy, and may change at any time
in a patch release.

Updating Generated Code
-----------------------

Expand Down
6 changes: 4 additions & 2 deletions convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def convert_key(text, file):

use core::fmt::{self, Display};
use core::str::FromStr;
#[cfg(not(feature = "std"))]
use core::error::Error;
#[cfg(feature = "std")]
use std::error::Error;

Expand Down Expand Up @@ -161,7 +163,6 @@ def convert_key(text, file):
}
}

#[cfg(feature = "std")]
impl Error for UnrecognizedNamedKeyError {}""", file=file)


Expand All @@ -174,6 +175,8 @@ def convert_code(text, file):

use core::fmt::{self, Display};
use core::str::FromStr;
#[cfg(not(feature = "std"))]
use core::error::Error;
#[cfg(feature = "std")]
use std::error::Error;

Expand Down Expand Up @@ -281,7 +284,6 @@ def convert_code(text, file):
}
}

#[cfg(feature = "std")]
impl Error for UnrecognizedCodeError {}""", file=file)


Expand Down
3 changes: 2 additions & 1 deletion src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use core::fmt::{self, Display};
use core::str::FromStr;
#[cfg(not(feature = "std"))]
use core::error::Error;
#[cfg(feature = "std")]
use std::error::Error;

Expand Down Expand Up @@ -937,5 +939,4 @@ impl fmt::Display for UnrecognizedCodeError {
}
}

#[cfg(feature = "std")]
impl Error for UnrecognizedCodeError {}
3 changes: 2 additions & 1 deletion src/named_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use core::fmt::{self, Display};
use core::str::FromStr;
#[cfg(not(feature = "std"))]
use core::error::Error;
#[cfg(feature = "std")]
use std::error::Error;

Expand Down Expand Up @@ -1313,5 +1315,4 @@ impl fmt::Display for UnrecognizedNamedKeyError {
}
}

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