Skip to content

Commit

Permalink
Simplify the doc annotations.
Browse files Browse the repository at this point in the history
This removes all but the lint internal features, making it so `doc_autocfg` can work as expected, and avoiding disconnects between the docs and the required features.
  • Loading branch information
Alexhuszagh committed Jan 10, 2025
1 parent 60a85da commit 4565e0d
Show file tree
Hide file tree
Showing 35 changed files with 166 additions and 341 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Deprecated `Options::set_*` in our write float API since options should be considered immutable.
- Removed `static_assertions` dependency.
- Migrate to using an external crate for our half-precision floats.
- Simplify feature detection internally to make auto-doc more reliable

### Fixed

Expand Down
4 changes: 1 addition & 3 deletions extras/benchmark/algorithm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[features]
default = ["std", "integers", "floats", "json"]
default = ["std", "json"]
std = ["lexical-util/std", "lexical-parse-float/std"]
integers = ["lexical-util/integers"]
floats = ["lexical-util/floats"]
json = []

[[bench]]
Expand Down
20 changes: 10 additions & 10 deletions extras/benchmark/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use core::fmt::Debug;
use core::str::FromStr;

use fastrand::Rng;
#[cfg(feature = "floats")]
#[cfg(any(feature = "parse-floats", feature = "write-floats"))]
use lexical_util::num::Float;
#[cfg(feature = "integers")]
#[cfg(any(feature = "parse-integers", feature = "write-integers"))]
use lexical_util::num::Integer;

// PATH
Expand Down Expand Up @@ -158,7 +158,7 @@ pub trait NumberRng: Sized + ToString {
fn gen(strategy: RandomGen, rng: &mut Rng) -> String;
}

#[cfg(feature = "integers")]
#[cfg(any(feature = "parse-integers", feature = "write-integers"))]
pub trait IntegerRng: NumberRng + Integer {
fn uniform(rng: &mut Rng) -> String;
fn simple(rng: &mut Rng) -> String;
Expand All @@ -173,7 +173,7 @@ pub trait IntegerRng: NumberRng + Integer {
/// - `max` - The max for simple values
/// - `lmin` - The min for large values
/// - `lmax` - The max for large values
#[cfg(feature = "integers")]
#[cfg(any(feature = "parse-integers", feature = "write-integers"))]
macro_rules! unsigned_rng {
($($t:ident $smin:literal $smax:literal $lmin:literal $lmax:literal ; )*) => ($(
impl NumberRng for $t {
Expand Down Expand Up @@ -228,7 +228,7 @@ macro_rules! unsigned_rng {
/// - `lmax` - The max for large values
/// - `lsmin` - The min for signed, large values
/// - `lsmax` - The max for signed, large values
#[cfg(feature = "integers")]
#[cfg(any(feature = "parse-integers", feature = "write-integers"))]
macro_rules! signed_rng {
($(
$t:ident
Expand Down Expand Up @@ -278,7 +278,7 @@ macro_rules! signed_rng {
)*);
}

#[cfg(feature = "integers")]
#[cfg(any(feature = "parse-integers", feature = "write-integers"))]
unsigned_rng! {
u8 0 50 100 255 ;
u16 0 1000 1024 65535 ;
Expand All @@ -287,7 +287,7 @@ unsigned_rng! {
u128 0 1000 5316911983139663491615228241121378304 340282366920938463463374607431768211455 ;
}

#[cfg(feature = "integers")]
#[cfg(any(feature = "parse-integers", feature = "write-integers"))]
signed_rng! {
i8 0 50 100 127 -50 50 -127 -100 ;
i16 0 1000 1024 32767 -1000 1000 -32767 -1024 ;
Expand All @@ -296,7 +296,7 @@ signed_rng! {
i128 0 1000 5316911983139663491615228241121378304 170141183460469231731687303715884105727 -1000 1000 -170141183460469231731687303715884105727 -5316911983139663491615228241121378304 ;
}

#[cfg(feature = "floats")]
#[cfg(any(feature = "parse-floats", feature = "write-floats"))]
pub trait FloatRng: NumberRng + Float {
fn uniform(rng: &mut Rng) -> String;
fn one_over_rand32(rng: &mut Rng) -> String;
Expand All @@ -308,7 +308,7 @@ pub trait FloatRng: NumberRng + Float {
fn big_ints(rng: &mut Rng) -> String;
}

#[cfg(feature = "floats")]
#[cfg(any(feature = "parse-floats", feature = "write-floats"))]
macro_rules! float_rng {
($($t:ident)*) => ($(
impl NumberRng for $t {
Expand Down Expand Up @@ -371,7 +371,7 @@ macro_rules! float_rng {
)*);
}

#[cfg(feature = "floats")]
#[cfg(any(feature = "parse-floats", feature = "write-floats"))]
float_rng! { f32 f64 }

// Generate a static array of random values.
Expand Down
4 changes: 1 addition & 3 deletions extras/benchmark/parse-float/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[features]
default = ["std", "floats", "json"]
default = ["std", "json"]
std = ["lexical-util/std", "lexical-parse-float/std"]
radix = ["lexical-util/radix", "lexical-parse-float/radix"]
power-of-two = ["lexical-util/power-of-two", "lexical-parse-float/power-of-two"]
format = ["lexical-util/format", "lexical-parse-float/format"]
compact = ["lexical-util/compact", "lexical-parse-float/compact"]
asm = []
integers = ["lexical-util/integers"]
floats = ["lexical-util/floats"]
json = []

[[bench]]
Expand Down
4 changes: 1 addition & 3 deletions extras/benchmark/write-float/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[features]
default = ["std", "floats", "json"]
default = ["std", "json"]
std = ["lexical-util/std", "lexical-write-float/std"]
radix = ["lexical-util/radix", "lexical-write-float/radix"]
power-of-two = ["lexical-util/power-of-two", "lexical-write-float/power-of-two"]
format = ["lexical-util/format", "lexical-write-float/format"]
compact = ["lexical-util/compact", "lexical-write-float/compact"]
integers = ["lexical-util/integers"]
floats = ["lexical-util/floats"]
json = []

[[bench]]
Expand Down
12 changes: 4 additions & 8 deletions extras/util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ std = ["lexical-util/std"]
power-of-two = ["lexical-util/power-of-two"]
radix = ["lexical-util/radix"]
format = ["lexical-util/format"]
write-integers = ["lexical-util/write-integers", "write", "integers"]
write-floats = ["lexical-util/write-floats", "write", "floats"]
parse-integers = ["lexical-util/parse-integers", "parse", "integers"]
parse-floats = ["lexical-util/parse-floats", "parse", "floats"]
write-integers = ["lexical-util/write-integers"]
write-floats = ["lexical-util/write-floats"]
parse-integers = ["lexical-util/parse-integers"]
parse-floats = ["lexical-util/parse-floats"]
compact = ["lexical-util/compact"]
f16 = ["lexical-util/f16", "parse-floats", "write-floats"]
lint = ["lexical-util/lint"]
write = ["lexical-util/write"]
parse = ["lexical-util/parse"]
integers = ["lexical-util/integers"]
floats = ["lexical-util/floats"]
2 changes: 1 addition & 1 deletion extras/util/tests/div128_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg(not(feature = "compact"))]
#![cfg(feature = "write")]
#![cfg(any(feature = "write-floats", feature = "write-integers"))]

mod util;

Expand Down
20 changes: 4 additions & 16 deletions lexical-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ std = [
"lexical-parse-float/std"
]
# Add support for writing integers.
write-integers = ["lexical-write-integer", "write", "integers"]
write-integers = ["lexical-write-integer"]
# Add support for writing floats.
write-floats = ["lexical-write-float", "write", "floats"]
write-floats = ["lexical-write-float"]
# Add support for parsing integers.
parse-integers = ["lexical-parse-integer", "parse", "integers"]
parse-integers = ["lexical-parse-integer"]
# Add support for parsing floats.
parse-floats = ["lexical-parse-float", "parse", "floats"]
parse-floats = ["lexical-parse-float"]

# Add support for parsing power-of-two float strings.
power-of-two = [
Expand Down Expand Up @@ -117,18 +117,6 @@ lint = [
"lexical-parse-integer?/lint",
"lexical-parse-float?/lint"
]
# Add support for writing numbers.
# Library users should use `write-integers` and `write-floats` instead.
write = ["lexical-util/write"]
# Add support for parsing numbers.
# Library users should use `parse-integers` and `parse-floats` instead.
parse = ["lexical-util/parse"]
# Add support for conversions to or from integers.
# Library users should use `write-integers` and `parse-integers` instead.
integers = ["lexical-util/integers"]
# Add support for conversions to or from floats.
# Library users should use `write-floats` and `parse-floats` instead.
floats = ["lexical-util/floats"]

# UNSUPPORTED
# -----------
Expand Down
Loading

0 comments on commit 4565e0d

Please sign in to comment.