From e2160b4ea81782898a5b46ee606a04b024a94960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= Date: Sun, 28 Jul 2024 20:09:12 +0200 Subject: [PATCH] More descriptive feature flag names --- Cargo.toml | 6 +++--- src/lib.rs | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5ca15ad..acb81b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,11 +16,11 @@ repository = "https://github.com/JSorngard/lambert_w" approx = "0.5.1" [features] -default = ["24", "50"] +default = ["24bits", "50bits"] # Enables the function versions with 50 bits of accuracy. -50 = [] +50bits = [] # Enables the function versions with 24 bits of accuracy. -24 = [] +24bits = [] # docs.rs-specific configuration. Taken from . [package.metadata.docs.rs] diff --git a/src/lib.rs b/src/lib.rs index e86450c..f2be512 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,7 @@ //! //! Evaluate the principal branch of the Lambert W function to 50 bits of accuracy: #![cfg_attr( - feature = "50", + feature = "50bits", doc = r##" ``` use lambert_w::accurate::lambert_w_0; @@ -26,7 +26,7 @@ assert_abs_diff_eq!(w, 1.0736581947961492); //! //! or to only 24 bits of accuracy, but with faster execution time: #![cfg_attr( - feature = "24", + feature = "24bits", doc = r##" ``` use lambert_w::fast::lambert_w_0; @@ -49,20 +49,20 @@ assert_abs_diff_eq!(w, 1.0736581947961492, epsilon = 1e-7); //! //! You can disable one of these feature flags to potentially save a little bit of binary size. //! -//! `50` *(enabled by default)*: enables the function versions with 50 bits of accuracy. +//! `50bits` *(enabled by default)*: enables the more accurate function versions with 50 bits of accuracy. //! -//! `24` *(enabled by default)*: enables the function versions with 24 bits of accuracy. +//! `24bits` *(enabled by default)*: enables the faster function versions with 24 bits of accuracy. //! //! It is a compile error to disable both features. #![cfg_attr(docsrs, feature(doc_auto_cfg))] -#[cfg(not(any(feature = "50", feature = "24")))] -compile_error!("one or both of the '24' and '50' features must be enabled"); +#[cfg(not(any(feature = "50bits", feature = "24bits")))] +compile_error!("one or both of the '24bits' and '50bits' features must be enabled"); -#[cfg(feature = "50")] +#[cfg(feature = "50bits")] pub mod accurate; -#[cfg(feature = "24")] +#[cfg(feature = "24bits")] pub mod fast; // -1/e @@ -71,16 +71,16 @@ const Z0: f64 = -0.367_879_441_171_442_33; // 1/sqrt(e) const X0: f64 = 0.606_530_659_712_633_4; -#[cfg(all(test, any(feature = "24", feature = "50")))] +#[cfg(all(test, any(feature = "24bits", feature = "50bits")))] mod tets { - #[cfg(feature = "50")] + #[cfg(feature = "50bits")] use super::accurate::{lambert_w_0 as lambert_w_0_50, lambert_w_m1 as lambert_w_m1_50}; - #[cfg(feature = "24")] + #[cfg(feature = "24bits")] use super::fast::{lambert_w_0 as lambert_w_0_24, lambert_w_m1 as lambert_w_m1_24}; use approx::assert_abs_diff_eq; use core::f64::consts::E; - #[cfg(feature = "50")] + #[cfg(feature = "50bits")] #[test] fn test_lambert_w_0_50() { assert_eq!(lambert_w_0_50(-1.0 / E - f64::EPSILON), None); @@ -203,7 +203,7 @@ mod tets { ); } - #[cfg(feature = "24")] + #[cfg(feature = "24bits")] #[test] fn test_lambert_w_0_24() { assert_eq!(lambert_w_0_24(-1.0 / E - f64::EPSILON), None); @@ -339,7 +339,7 @@ mod tets { ); } - #[cfg(feature = "50")] + #[cfg(feature = "50bits")] #[test] fn test_lambert_w_m1_50() { assert_eq!(lambert_w_m1_50(-1.0 / E - f64::EPSILON), None); @@ -408,7 +408,7 @@ mod tets { assert_eq!(lambert_w_m1_50(f64::EPSILON), None); } - #[cfg(feature = "24")] + #[cfg(feature = "24bits")] #[test] fn test_lambert_w_m1_24() { assert_eq!(lambert_w_m1_24(-1.0 / E - f64::EPSILON), None);