Skip to content

Commit e42dbe2

Browse files
committed
Feature gate the NonZero implementations
1 parent 98a1d9b commit e42dbe2

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ ryu = "1.0.17"
1717

1818
[dev-dependencies]
1919
paste = "1"
20+
21+
[features]
22+
nonzero_impls = []

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ A no-std version of ToString implemented for bool/integer/float types formatting
44

55
## Minimum Supported Rust Version
66

7-
This is currently 1.56, and is considered a breaking update to increase.
7+
This is currently 1.56 with no features active, and is considered a breaking update to increase.
8+
9+
- Using the `nonzero_impls` feature, this increases to 1.79.

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
//! ## Minimum Supported Rust Version
44
//!
55
//! This is currently 1.56, and is considered a breaking update to increase.
6+
//!
7+
//! - Using the `nonzero_impls` feature, this increases to 1.79.
68
79
#![no_std]
810
#![warn(clippy::pedantic)]

src/macros.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ macro_rules! impl_int {
2424
}
2525
}
2626

27+
#[cfg(feature = "nonzero_impls")]
2728
impl ToArrayString for core::num::NonZero<$type> {
2829
const MAX_LENGTH: usize = $len;
2930
type ArrayString = ArrayString<$len>;
@@ -56,6 +57,8 @@ macro_rules! generate_test {
5657
#[test]
5758
fn [<check_ $type>]() {
5859
test_impl($type::MIN, $type::MAX);
60+
61+
#[cfg(feature = "nonzero_impls")]
5962
test_impl(core::num::NonZero::<$type>::MIN, core::num::NonZero::<$type>::MAX);
6063
}
6164
)*);

0 commit comments

Comments
 (0)