| Crates.io | flexpect |
| lib.rs | flexpect |
| version | 0.1.1 |
| created_at | 2024-09-25 10:29:11.915047+00 |
| updated_at | 2025-03-16 08:39:57.961133+00 |
| description | #[flexpect::e(...)] compiles to #[expect(...)] for newer versions of Rust and to #[allow(...)] when not supported. |
| homepage | https://github.com/rusticstuff/flexpect |
| repository | https://github.com/rusticstuff/flexpect |
| max_upload_size | |
| id | 1386223 |
| size | 27,245 |
#[flexpect::e(...)] compiles to #[expect(...)] for newer versions of Rust and to #[allow(...)] when not supported.
This crate enables getting the benefits of #[expect(...)] while maintaining a minimum supported Rust version that's earlier than 1.81.
Add flexpect to your Cargo.toml:
[dependencies]
flexpect = "0.1.0"
Then use the #[flexpect::e(...)] or #[flexpect::flexpect(...)] attributes instead of #[expect(...)]:
// instead of #[expect(unused_variables)]
#[flexpect::e(unused_variables)]
fn example() {
let x = 1;
}
use flexpect::flexpect;
// instead of #[expect(clippy::clone_on_copy)]
#[flexpect(clippy::clone_on_copy)]
fn clippy_example() {
let _ = 32.clone();
}
#[allow(...)].#[expect(...)].The minimum supported Rust version is 1.38.
flexpect does not work as inner attributes (#![flexpect::e(...)]) nor on statements, expressions or blocks due to compiler limitations.