diff --git a/ci/test.sh b/ci/test.sh index d3033de2..4aa134b6 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -78,16 +78,17 @@ check() { check_test "write-integer" # ensure our partial features aren't allowed, as are unsupported features - cd "${home}/lexical-core" - partial=(parse write floats integers) - for feature in "${partial[@]}"; do - check_error "${feature}" - done - - cd "${home}/lexical" - for feature in "${partial[@]}"; do - check_error "${feature}" - done + # FIXME: Restore once we remove our partial features + # cd "${home}/lexical-core" + # partial=(parse write floats integers) + # for feature in "${partial[@]}"; do + # check_error "${feature}" + # done + # + # cd "${home}/lexical" + # for feature in "${partial[@]}"; do + # check_error "${feature}" + # done cd "${home}" } diff --git a/clippy.toml b/clippy.toml index 8bd81b7e..d2610034 100644 --- a/clippy.toml +++ b/clippy.toml @@ -4,7 +4,7 @@ disallowed-macros = [ { path = "std::print", reason = "no IO allowed" }, { path = "std::println", reason = "no IO allowed" }, { path = "std::format", reason = "no string allocation allowed" }, - { path = "std::debug", reason = "debugging macros should not be present in any release" }, + { path = "std::dbg", reason = "debugging macros should not be present in any release" }, # NOTE: unimplemented is fine because this can be for intentionally disabled methods { path = "std::todo", reason = "should never have TODO macros in releases" }, ] @@ -14,7 +14,7 @@ disallowed-methods = [ { path = "std::io::stderr", reason = "no IO allowed" }, ] disallowed-types = [ - { path = "std::io::File", reason = "no IO allowed" }, + { path = "std::fs::File", reason = "no IO allowed" }, { path = "std::io::BufReader", reason = "need our own abstractions for reading/writing" }, { path = "std::io::BufWriter", reason = "need our own abstractions for reading/writing" }, ] diff --git a/extras/Cargo.toml b/extras/Cargo.toml index 0ff0778c..245c9ae8 100644 --- a/extras/Cargo.toml +++ b/extras/Cargo.toml @@ -19,3 +19,7 @@ opt-level = 3 debug = false debug-assertions = false lto = true + +# FIXME: Support 0.61.0+ when we only support Rustc 1.71.0+. +[patch.crates-io] +windows-sys = { git = "https://github.com/microsoft/windows-rs.git", rev = "308e08e" } diff --git a/extras/benchmark/write-float/special.rs b/extras/benchmark/write-float/special.rs index 36fa15b9..c0c52f3e 100644 --- a/extras/benchmark/write-float/special.rs +++ b/extras/benchmark/write-float/special.rs @@ -19,7 +19,14 @@ macro_rules! gen_vec { let value = fastrand::$i($exp_mask..); // NOTE: We want mem::transmute, not from_bits because we // don't want the special handling of from_bits - #[allow(clippy::transmute_int_to_float)] + // FIXME: Move to `to_bits` in 1.83.0+ (const stable) + // FIXME: change to `unnecessary_transmutes` when supported. + #[allow( + renamed_and_removed_lints, + unknown_lints, + clippy::transmute_int_to_float, + unnecessary_transmutes + )] vec.push(unsafe { mem::transmute::<$i, $f>(value) }); } vec diff --git a/extras/clippy.toml b/extras/clippy.toml index 8bd81b7e..d2610034 100644 --- a/extras/clippy.toml +++ b/extras/clippy.toml @@ -4,7 +4,7 @@ disallowed-macros = [ { path = "std::print", reason = "no IO allowed" }, { path = "std::println", reason = "no IO allowed" }, { path = "std::format", reason = "no string allocation allowed" }, - { path = "std::debug", reason = "debugging macros should not be present in any release" }, + { path = "std::dbg", reason = "debugging macros should not be present in any release" }, # NOTE: unimplemented is fine because this can be for intentionally disabled methods { path = "std::todo", reason = "should never have TODO macros in releases" }, ] @@ -14,7 +14,7 @@ disallowed-methods = [ { path = "std::io::stderr", reason = "no IO allowed" }, ] disallowed-types = [ - { path = "std::io::File", reason = "no IO allowed" }, + { path = "std::fs::File", reason = "no IO allowed" }, { path = "std::io::BufReader", reason = "need our own abstractions for reading/writing" }, { path = "std::io::BufWriter", reason = "need our own abstractions for reading/writing" }, ] diff --git a/extras/parse-float/Cargo.toml b/extras/parse-float/Cargo.toml index 07b4ef97..ef1ff816 100644 --- a/extras/parse-float/Cargo.toml +++ b/extras/parse-float/Cargo.toml @@ -23,7 +23,8 @@ default-features = false # Issue: https://github.com/BurntSushi/quickcheck/issues/295 # Fix: https://github.com/BurntSushi/quickcheck/pull/296 quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" } -proptest = ">=1.5.0" +# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+. +proptest = ">=1.5.0, <1.7.0" [features] default = ["std"] diff --git a/extras/parse-integer/Cargo.toml b/extras/parse-integer/Cargo.toml index e7fd8bb7..c174512f 100644 --- a/extras/parse-integer/Cargo.toml +++ b/extras/parse-integer/Cargo.toml @@ -23,7 +23,8 @@ default-features = false # Issue: https://github.com/BurntSushi/quickcheck/issues/295 # Fix: https://github.com/BurntSushi/quickcheck/pull/296 quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" } -proptest = ">=1.5.0" +# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+. +proptest = ">=1.5.0, <1.7.0" [features] default = ["std"] diff --git a/extras/util/Cargo.toml b/extras/util/Cargo.toml index 89b08ddf..3b77008d 100644 --- a/extras/util/Cargo.toml +++ b/extras/util/Cargo.toml @@ -19,7 +19,8 @@ default-features = false # Issue: https://github.com/BurntSushi/quickcheck/issues/295 # Fix: https://github.com/BurntSushi/quickcheck/pull/296 quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" } -proptest = ">=1.5.0" +# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+. +proptest = ">=1.5.0, <1.7.0" [features] default = ["std"] diff --git a/extras/write-float/Cargo.toml b/extras/write-float/Cargo.toml index 82ec701f..719c1403 100644 --- a/extras/write-float/Cargo.toml +++ b/extras/write-float/Cargo.toml @@ -28,8 +28,9 @@ approx = "0.5.0" # Issue: https://github.com/BurntSushi/quickcheck/issues/295 # Fix: https://github.com/BurntSushi/quickcheck/pull/296 quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" } -proptest = ">=1.5.0" fraction = "0.15.0" +# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+. +proptest = ">=1.5.0, <1.7.0" [features] default = ["std"] diff --git a/extras/write-integer/Cargo.toml b/extras/write-integer/Cargo.toml index 94f1817b..967216a1 100644 --- a/extras/write-integer/Cargo.toml +++ b/extras/write-integer/Cargo.toml @@ -23,8 +23,9 @@ default-features = false # Issue: https://github.com/BurntSushi/quickcheck/issues/295 # Fix: https://github.com/BurntSushi/quickcheck/pull/296 quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" } -proptest = ">=1.5.0" rustversion = ">=1.0.18" +# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+. +proptest = ">=1.5.0, <1.7.0" [features] default = ["std"] diff --git a/lexical-core/Cargo.toml b/lexical-core/Cargo.toml index 2a197072..bf8e2473 100644 --- a/lexical-core/Cargo.toml +++ b/lexical-core/Cargo.toml @@ -129,6 +129,16 @@ f128 = [ "lexical-write-float?/f128" ] +# DEPRECATED +# ---------- +# These were never supported, however, they exist in case existing code +# uses them. They should not be used under any circumstances and should +# be removed. +parse = ["parse-integers", "parse-floats"] +write = ["write-integers", "write-floats"] +integers = ["parse-integers", "write-integers"] +floats = ["parse-floats", "write-floats"] + [package.metadata.docs.rs] features = ["radix", "format", "write-integers", "write-floats", "parse-integers", "parse-floats", "f16"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/lexical-core/src/lib.rs b/lexical-core/src/lib.rs index 2a60b6a8..80b218b6 100644 --- a/lexical-core/src/lib.rs +++ b/lexical-core/src/lib.rs @@ -629,6 +629,11 @@ //! [`lexical-write-float`], and [`lexical-write-integer`]) could cause those //! safety invariants to be broken. //! +//! [`lexical-parse-float`]: https://crates.io/crates/lexical-parse-float +//! [`lexical-parse-integer`]: https://crates.io/crates/lexical-parse-integer +//! [`lexical-write-float`]: https://crates.io/crates/lexical-write-float +//! [`lexical-write-integer`]: https://crates.io/crates/lexical-write-integer +//! //! #![cfg_attr( any(feature = "write-floats", feature = "write-integers"), @@ -686,8 +691,7 @@ clippy::unnecessary_safety_comment, clippy::semicolon_if_nothing_returned, clippy::unwrap_used, - clippy::as_underscore, - clippy::doc_markdown + clippy::as_underscore )] #![allow( // used when concepts are logically separate diff --git a/lexical-parse-float/src/bigint.rs b/lexical-parse-float/src/bigint.rs index 143da7e0..2422a61b 100644 --- a/lexical-parse-float/src/bigint.rs +++ b/lexical-parse-float/src/bigint.rs @@ -635,7 +635,7 @@ impl StackVec { /// Create a reverse view of the vector for indexing. #[must_use] #[inline(always)] - pub fn rview(&self) -> ReverseView { + pub fn rview(&self) -> ReverseView<'_, Limb> { ReverseView { inner: self, } diff --git a/lexical-parse-float/src/float.rs b/lexical-parse-float/src/float.rs index 1af794b4..e40c9f6d 100644 --- a/lexical-parse-float/src/float.rs +++ b/lexical-parse-float/src/float.rs @@ -64,7 +64,6 @@ pub trait RawFloat: Float + ExactFloat + MaxDigits { #[must_use] #[inline(always)] fn int_pow_fast_path(exponent: usize, radix: u32) -> u64 { - // SAFETY: safe as long as the exponent is smaller than the radix table. #[cfg(not(feature = "compact"))] return get_small_int_power(exponent, radix); @@ -76,7 +75,6 @@ pub trait RawFloat: Float + ExactFloat + MaxDigits { impl RawFloat for f32 { #[inline(always)] fn pow_fast_path(exponent: usize, radix: u32) -> Self { - // SAFETY: safe as long as the exponent is smaller than the radix table. #[cfg(not(feature = "compact"))] return get_small_f32_power(exponent, radix); @@ -88,7 +86,6 @@ impl RawFloat for f32 { impl RawFloat for f64 { #[inline(always)] fn pow_fast_path(exponent: usize, radix: u32) -> Self { - // SAFETY: safe as long as the exponent is smaller than the radix table. #[cfg(not(feature = "compact"))] return get_small_f64_power(exponent, radix); diff --git a/lexical-parse-float/src/lib.rs b/lexical-parse-float/src/lib.rs index ad36d3f4..27dab290 100644 --- a/lexical-parse-float/src/lib.rs +++ b/lexical-parse-float/src/lib.rs @@ -518,8 +518,7 @@ clippy::unnecessary_safety_comment, clippy::semicolon_if_nothing_returned, clippy::unwrap_used, - clippy::as_underscore, - clippy::doc_markdown + clippy::as_underscore )] #![allow( // used when concepts are logically separate diff --git a/lexical-parse-float/src/options.rs b/lexical-parse-float/src/options.rs index f2253529..f8f3cf86 100644 --- a/lexical-parse-float/src/options.rs +++ b/lexical-parse-float/src/options.rs @@ -653,7 +653,8 @@ impl OptionsBuilder { /// /// # Panics /// - /// If the built options are not valid. + /// If the built options are not valid. This should always + /// be used within a const context to avoid panics at runtime. #[inline(always)] pub const fn build_strict(&self) -> Options { match self.build() { diff --git a/lexical-parse-integer/src/lib.rs b/lexical-parse-integer/src/lib.rs index ebee0ed0..72d1ae18 100644 --- a/lexical-parse-integer/src/lib.rs +++ b/lexical-parse-integer/src/lib.rs @@ -263,8 +263,7 @@ clippy::unnecessary_safety_comment, clippy::semicolon_if_nothing_returned, clippy::unwrap_used, - clippy::as_underscore, - clippy::doc_markdown + clippy::as_underscore )] #![allow( // used when concepts are logically separate diff --git a/lexical-parse-integer/src/options.rs b/lexical-parse-integer/src/options.rs index e34c0c81..eda3fbb6 100644 --- a/lexical-parse-integer/src/options.rs +++ b/lexical-parse-integer/src/options.rs @@ -131,7 +131,15 @@ impl OptionsBuilder { } } - /// Build the [`Options`] struct. This can never panic. + /// Build the [`Options`] struct. + /// + /// This can never panic. + /// + /// #[inline(always)] pub const fn build_strict(&self) -> Options { match self.build() { diff --git a/lexical-util/Cargo.toml b/lexical-util/Cargo.toml index 669feefb..64bbace3 100644 --- a/lexical-util/Cargo.toml +++ b/lexical-util/Cargo.toml @@ -64,6 +64,16 @@ lint = [] # Enable support for 128-bit floats. f128 = ["parse-floats", "write-floats"] +# DEPRECATED +# ---------- +# These were never supported, however, they exist in case existing code +# uses them. They should not be used under any circumstances and should +# be removed. +parse = ["parse-integers", "parse-floats"] +write = ["write-integers", "write-floats"] +integers = ["parse-integers", "write-integers"] +floats = ["parse-floats", "write-floats"] + [package.metadata.docs.rs] features = ["radix", "format", "write-integers", "write-floats", "parse-integers", "parse-floats", "f16"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/lexical-util/src/format_builder.rs b/lexical-util/src/format_builder.rs index b4577e1f..f7a8f337 100644 --- a/lexical-util/src/format_builder.rs +++ b/lexical-util/src/format_builder.rs @@ -3277,7 +3277,8 @@ impl NumberFormatBuilder { /// /// # Panics /// - /// If the built format is not valid. + /// If the built format is not valid. This should always + /// be used within a const context to avoid panics at runtime. #[inline(always)] pub const fn build_strict(&self) -> u128 { use crate::format::format_error_impl; diff --git a/lexical-util/src/lib.rs b/lexical-util/src/lib.rs index 9252c95a..7f2ccb53 100644 --- a/lexical-util/src/lib.rs +++ b/lexical-util/src/lib.rs @@ -86,8 +86,7 @@ clippy::unnecessary_safety_comment, clippy::semicolon_if_nothing_returned, clippy::unwrap_used, - clippy::as_underscore, - clippy::doc_markdown + clippy::as_underscore )] #![allow( // used when concepts are logically separate diff --git a/lexical-util/src/options.rs b/lexical-util/src/options.rs index 07549486..e6f9e4b6 100644 --- a/lexical-util/src/options.rs +++ b/lexical-util/src/options.rs @@ -115,106 +115,110 @@ macro_rules! literal { }; } -literal!(RUST_LITERAL, None, "A Rust literal number (uses default options)."); +literal!(RUST_LITERAL, None, "A `Rust` literal number (uses default options)."); // RUST_STRING -literal!(PYTHON_LITERAL, None, "A Python literal number (uses default options)."); +literal!(PYTHON_LITERAL, None, "A `Python` literal number (uses default options)."); // PYTHON_STRING -literal!(CXX_LITERAL_NAN, b"NAN", "A C++ literal NaN (`NAN`)."); -literal!(CXX_LITERAL_INF, b"INFINITY", "A C++ literal short infinity (`INFINITY`)."); -literal!(CXX_LITERAL_INFINITY, b"INFINITY", "A C++ literal long infinity (`INFINITY`)."); +literal!(CXX_LITERAL_NAN, b"NAN", "A `C++` literal NaN (`NAN`)."); +literal!(CXX_LITERAL_INF, b"INFINITY", "A `C++` literal short infinity (`INFINITY`)."); +literal!(CXX_LITERAL_INFINITY, b"INFINITY", "A `C++` literal long infinity (`INFINITY`)."); // CXX_STRING -literal!(C_LITERAL_NAN, b"NAN", "A C literal NaN (`NAN`)."); -literal!(C_LITERAL_INF, b"INFINITY", "A C literal short infinity (`INFINITY`)."); -literal!(C_LITERAL_INFINITY, b"INFINITY", "A C literal long infinity (`INFINITY`)."); +literal!(C_LITERAL_NAN, b"NAN", "A `C` literal NaN (`NAN`)."); +literal!(C_LITERAL_INF, b"INFINITY", "A `C` literal short infinity (`INFINITY`)."); +literal!(C_LITERAL_INFINITY, b"INFINITY", "A `C` literal long infinity (`INFINITY`)."); // RUBY_LITERAL -literal!(RUBY_LITERAL_NAN, b"NaN", "A Ruby literal NaN (`NaN`)."); -literal!(RUBY_LITERAL_INF, b"Infinity", "A C literal short infinity (`Infinity`)."); -literal!(RUBY_STRING_NONE, None, "A Ruby string (uses default options)."); +literal!(RUBY_LITERAL_NAN, b"NaN", "A `Ruby` literal NaN (`NaN`)."); +literal!(RUBY_LITERAL_INF, b"Infinity", "A `Ruby` literal short infinity (`Infinity`)."); +literal!(RUBY_STRING_NONE, None, "A `Ruby` string (uses default options)."); // C_STRING -literal!(SWIFT_LITERAL, None, "A Swift literal number (uses default options)."); +literal!(SWIFT_LITERAL, None, "A `Swift` literal number (uses default options)."); // SWIFT_STRING -literal!(GO_LITERAL, None, "A Golang literal number (uses default options)."); +literal!(GO_LITERAL, None, "A `Golang` literal number (uses default options)."); // GO_STRING -literal!(HASKELL_LITERAL, None, "A Haskell literal number (uses default options)."); -literal!(HASKELL_STRING_INF, b"Infinity", "A Haskell string short infinity (`Infinity`)."); -literal!(HASKELL_STRING_INFINITY, b"Infinity", "A Haskell string long infinity (`Infinity`)."); -literal!(JAVASCRIPT_INF, b"Infinity", "A JavaScript string short infinity (`Infinity`)."); -literal!(JAVASCRIPT_INFINITY, b"Infinity", "A JavaScript string long infinity (`Infinity`)."); -literal!(PERL_LITERAL, None, "A Perl literal literal (uses default options)."); +literal!(HASKELL_LITERAL, None, "A `Haskell` literal number (uses default options)."); +literal!(HASKELL_STRING_INF, b"Infinity", "A `Haskell` string short infinity (`Infinity`)."); +literal!(HASKELL_STRING_INFINITY, b"Infinity", "A `Haskell` string long infinity (`Infinity`)."); +literal!(JAVASCRIPT_INF, b"Infinity", "A `JavaScript` string short infinity (`Infinity`)."); +literal!(JAVASCRIPT_INFINITY, b"Infinity", "A `JavaScript` string long infinity (`Infinity`)."); +literal!(PERL_LITERAL, None, "A `Perl` literal literal (uses default options)."); // PERL_STRING -literal!(PHP_LITERAL_NAN, b"NAN", "A PHP literal NaN (`NAN`)."); -literal!(PHP_LITERAL_INF, b"INF", "A PHP literal short infinity (`INF`)."); -literal!(PHP_LITERAL_INFINITY, b"INF", "A PHP literal long infinity (`INF`)."); +literal!(PHP_LITERAL_NAN, b"NAN", "A `PHP` literal NaN (`NAN`)."); +literal!(PHP_LITERAL_INF, b"INF", "A `PHP` literal short infinity (`INF`)."); +literal!(PHP_LITERAL_INFINITY, b"INF", "A `PHP` literal long infinity (`INF`)."); // PHP_STRING -literal!(JAVA_LITERAL, None, "A Java literal number (uses default options)."); -literal!(JAVA_STRING_INF, b"Infinity", "A Java string short infinity (`Infinity`)."); -literal!(JAVA_STRING_INFINITY, b"Infinity", "A Java string long infinity (`Infinity`)."); -literal!(R_LITERAL_INF, b"Inf", "An R literal short infinity (`Inf`)."); -literal!(R_LITERAL_INFINITY, b"Inf", "An R literal long infinity (`Inf`)."); +literal!(JAVA_LITERAL, None, "A `Java` literal number (uses default options)."); +literal!(JAVA_STRING_INF, b"Infinity", "A `Java` string short infinity (`Infinity`)."); +literal!(JAVA_STRING_INFINITY, b"Infinity", "A `Java` string long infinity (`Infinity`)."); +literal!(R_LITERAL_INF, b"Inf", "An `R` literal short infinity (`Inf`)."); +literal!(R_LITERAL_INFINITY, b"Inf", "An `R` literal long infinity (`Inf`)."); // R_STRING -literal!(KOTLIN_LITERAL, None, "A Kotlin literal number (uses default options)."); -literal!(KOTLIN_STRING_INF, b"Infinity", "A Kotlin string short infinity (`Infinity`)."); -literal!(KOTLIN_STRING_INFINITY, b"Infinity", "A Kotlin string long infinity (`Infinity`)."); -literal!(JULIA_LITERAL_INF, b"Inf", "A Julia string short infinity (`Inf`)."); -literal!(JULIA_LITERAL_INFINITY, b"Inf", "A Julia string long infinity (`Inf`)."); +literal!(KOTLIN_LITERAL, None, "A `Kotlin` literal number (uses default options)."); +literal!(KOTLIN_STRING_INF, b"Infinity", "A `Kotlin` string short infinity (`Infinity`)."); +literal!(KOTLIN_STRING_INFINITY, b"Infinity", "A `Kotlin` string long infinity (`Infinity`)."); +literal!(JULIA_LITERAL_INF, b"Inf", "A `Julia` string short infinity (`Inf`)."); +literal!(JULIA_LITERAL_INFINITY, b"Inf", "A `Julia` string long infinity (`Inf`)."); // JULIA_STRING -literal!(CSHARP_LITERAL, None, "A C# literal number (uses default options)."); -literal!(CSHARP_STRING_INF, b"Infinity", "A C# string short infinity (`Infinity`)."); -literal!(CSHARP_STRING_INFINITY, b"Infinity", "A C# string long infinity (`Infinity`)."); -literal!(KAWA, None, "A Kawa (List) literal number (uses default options)."); -literal!(GAMBITC, None, "A Gambit-C (List) literal number (uses default options)."); -literal!(GUILE, None, "A Guile (List) literal number (uses default options)."); -literal!(CLOJURE_LITERAL, None, "A Clojure (Lisp) literal number (uses default options)."); -literal!(CLOJURE_STRING_INF, b"Infinity", "A Clojure string short infinity (`Infinity`)."); -literal!(CLOJURE_STRING_INFINITY, b"Infinity", "A Clojure string long infinity (`Infinity`)."); -literal!(ERLANG_LITERAL_NAN, b"nan", "An Erlang literal NaN (`nan`)."); -literal!(ERLANG_STRING, None, "An Erlang string number (uses default options)."); -literal!(ELM_LITERAL, None, "An Elm literal number (uses default options)."); -literal!(ELM_STRING_NAN, None, "An Elm stromg NaN (uses default options)."); -literal!(ELM_STRING_INF, b"Infinity", "An Elm string short infinity (`Infinity`)."); -literal!(ELM_STRING_INFINITY, b"Infinity", "An Elm string long infinity (`Infinity`)."); -literal!(SCALA_LITERAL, None, "A Scala literal number (uses default options)."); -literal!(SCALA_STRING_INF, b"Infinity", "A Scala string short infinity (`Infinity`)."); -literal!(SCALA_STRING_INFINITY, b"Infinity", "A Scala string long infinity (`Infinity`)."); -literal!(ELIXIR, None, "An Elixir number (uses default options)."); -literal!(FORTRAN_LITERAL, None, "A FORTRAN literal number (uses default options)."); +literal!(CSHARP_LITERAL, None, "A `C#` literal number (uses default options)."); +literal!(CSHARP_STRING_INF, b"Infinity", "A `C#` string short infinity (`Infinity`)."); +literal!(CSHARP_STRING_INFINITY, b"Infinity", "A `C#` string long infinity (`Infinity`)."); +literal!(KAWA, None, "A `Kawa` (Lisp) literal number (uses default options)."); +literal!(GAMBITC, None, "A `Gambit-C` (Lisp) literal number (uses default options)."); +literal!(GUILE, None, "A `Guile` (Lisp) literal number (uses default options)."); +literal!(CLOJURE_LITERAL, None, "A `Clojure` (Lisp) literal number (uses default options)."); +literal!(CLOJURE_STRING_INF, b"Infinity", "A `Clojure` string short infinity (`Infinity`)."); +literal!(CLOJURE_STRING_INFINITY, b"Infinity", "A `Clojure` string long infinity (`Infinity`)."); +literal!(ERLANG_LITERAL_NAN, b"nan", "An `Erlang` literal NaN (`nan`)."); +literal!(ERLANG_STRING, None, "An `Erlang` string number (uses default options)."); +literal!(ELM_LITERAL, None, "An `Elm` literal number (uses default options)."); +literal!(ELM_STRING_NAN, None, "An `Elm` strong NaN (uses default options)."); +literal!(ELM_STRING_INF, b"Infinity", "An `Elm` string short infinity (`Infinity`)."); +literal!(ELM_STRING_INFINITY, b"Infinity", "An `Elm` string long infinity (`Infinity`)."); +literal!(SCALA_LITERAL, None, "A `Scala` literal number (uses default options)."); +literal!(SCALA_STRING_INF, b"Infinity", "A `Scala` string short infinity (`Infinity`)."); +literal!(SCALA_STRING_INFINITY, b"Infinity", "A `Scala` string long infinity (`Infinity`)."); +literal!(ELIXIR, None, "An `Elixir` number (uses default options)."); +literal!(FORTRAN_LITERAL, None, "A `FORTRAN` literal number (uses default options)."); // FORTRAN_STRING -literal!(D_LITERAL, None, "A D-Lang literal number (uses default options)."); +literal!(D_LITERAL, None, "A `D-Lang` literal number (uses default options)."); // D_STRING -literal!(COFFEESCRIPT_INF, b"Infinity", "A CoffeeScript string short infinity (`Infinity`)."); -literal!(COFFEESCRIPT_INFINITY, b"Infinity", "A CoffeeScript string long infinity (`Infinity`)."); -literal!(COBOL, None, "A COBOL literal number (uses default options)."); -literal!(FSHARP_LITERAL_NAN, b"nan", "An F# literal NaN (`nan`)."); -literal!(FSHARP_LITERAL_INF, b"infinity", "An F# literal short infinity (`infinity`)."); -literal!(FSHARP_LITERAL_INFINITY, b"infinity", "An F# literal long infinity (`infinity`)."); +literal!(COFFEESCRIPT_INF, b"Infinity", "A `CoffeeScript` string short infinity (`Infinity`)."); +literal!(COFFEESCRIPT_INFINITY, b"Infinity", "A `CoffeeScript` string long infinity (`Infinity`)."); +literal!(COBOL, None, "A `COBOL` literal number (uses default options)."); +literal!(FSHARP_LITERAL_NAN, b"nan", "An `F#` literal NaN (`nan`)."); +literal!(FSHARP_LITERAL_INF, b"infinity", "An `F#` literal short infinity (`infinity`)."); +literal!(FSHARP_LITERAL_INFINITY, b"infinity", "An `F#` literal long infinity (`infinity`)."); // FSHARP_STRING -literal!(VB_LITERAL, None, "A Visual Basic literal number (uses default options)"); -literal!(VB_STRING_INF, None, "A Visual Basic short string infinity (uses default options)"); -literal!(VB_STRING_INFINITY, None, "A Visual Basic long string number (uses default options)"); -literal!(OCAML_LITERAL_NAN, b"nan", "An OCAML literal NaN (`nan`)."); -literal!(OCAML_LITERAL_INF, b"infinity", "An OCAML literal short infinity (`infinity`)."); -literal!(OCAML_LITERAL_INFINITY, b"infinity", "An OCAML literal long infinity (`infinity`)."); +literal!(VB_LITERAL, None, "A `Visual Basic` literal number (uses default options)"); +literal!(VB_STRING_INF, None, "A `Visual Basic` short string infinity (uses default options)"); +literal!(VB_STRING_INFINITY, None, "A `Visual Basic` long string number (uses default options)"); +literal!(OCAML_LITERAL_NAN, b"nan", "An `OCAML` literal NaN (`nan`)."); +literal!(OCAML_LITERAL_INF, b"infinity", "An `OCAML` literal short infinity (`infinity`)."); +literal!(OCAML_LITERAL_INFINITY, b"infinity", "An `OCAML` literal long infinity (`infinity`)."); // OCAML_STRING -literal!(OBJECTIVEC, None, "An Objective-C number (uses default options)."); -literal!(REASONML_LITERAL_NAN, b"nan", "A ReasonML literal NaN (`nan`)."); -literal!(REASONML_LITERAL_INF, b"infinity", "A ReasonML literal short infinity (`infinity`)."); -literal!(REASONML_LITERAL_INFINITY, b"infinity", "A ReasonML literal long infinity (`infinity`)."); +literal!(OBJECTIVEC, None, "An `Objective-C` number (uses default options)."); +literal!(REASONML_LITERAL_NAN, b"nan", "A `ReasonML` literal NaN (`nan`)."); +literal!(REASONML_LITERAL_INF, b"infinity", "A `ReasonML` literal short infinity (`infinity`)."); +literal!( + REASONML_LITERAL_INFINITY, + b"infinity", + "A `ReasonML` literal long infinity (`infinity`)." +); // REASONML_STRING -literal!(MATLAB_LITERAL_INF, b"inf", "A MATLAB literal short infinity (`inf`)."); -literal!(MATLAB_LITERAL_INFINITY, b"Inf", "A MATLAB literal long infinity (`Inf`)."); +literal!(MATLAB_LITERAL_INF, b"inf", "A `MATLAB` literal short infinity (`inf`)."); +literal!(MATLAB_LITERAL_INFINITY, b"Inf", "A `MATLAB` literal long infinity (`Inf`)."); // MATLAB_STRING -literal!(ZIG_LITERAL, None, "A Zig literal number (uses default options)."); +literal!(ZIG_LITERAL, None, "A `Zig` literal number (uses default options)."); // ZIG_STRING -literal!(SAGE_LITERAL_INF, b"infinity", "A SageMath literal short infinity (`infinity`)."); -literal!(SAGE_LITERAL_INFINITY, b"Infinity", "A SageMath literal long infinity (`Infinity`)."); +literal!(SAGE_LITERAL_INF, b"infinity", "A `SageMath` literal short infinity (`infinity`)."); +literal!(SAGE_LITERAL_INFINITY, b"Infinity", "A `SageMath` literal long infinity (`Infinity`)."); // SAGE_STRING -literal!(JSON, None, "A JSON number (uses default options)."); -literal!(TOML, None, "A TOML number (uses default options)."); -literal!(YAML, None, "A YAML number (uses default options)."); -literal!(XML_INF, None, "An XML short infinity (uses default options)."); -literal!(XML_INFINITY, None, "An XML short infinity (uses default options)."); -literal!(SQLITE, None, "A SQLite number (uses default options)."); -literal!(POSTGRESQL, None, "A PostgreSQL number (uses default options)."); -literal!(MYSQL, None, "A MySQL number (uses default options)."); -literal!(MONGODB_INF, b"Infinity", "A MongoDB short infinity (`Infinity`)."); -literal!(MONGODB_INFINITY, b"Infinity", "A MongoDB long infinity (`Infinity`)."); +literal!(JSON, None, "A `JSON` number (uses default options)."); +literal!(TOML, None, "A `TOML` number (uses default options)."); +literal!(YAML, None, "A `YAML` number (uses default options)."); +literal!(XML_INF, None, "An `XML` short infinity (uses default options)."); +literal!(XML_INFINITY, None, "An `XML` short infinity (uses default options)."); +literal!(SQLITE, None, "A `SQLite` number (uses default options)."); +literal!(POSTGRESQL, None, "A `PostgreSQL` number (uses default options)."); +literal!(MYSQL, None, "A `MySQL` number (uses default options)."); +literal!(MONGODB_INF, b"Infinity", "A `MongoDB` short infinity (`Infinity`)."); +literal!(MONGODB_INFINITY, b"Infinity", "A `MongoDB` long infinity (`Infinity`)."); diff --git a/lexical-write-float/src/lib.rs b/lexical-write-float/src/lib.rs index 99a3fbbf..0c5fe269 100644 --- a/lexical-write-float/src/lib.rs +++ b/lexical-write-float/src/lib.rs @@ -449,8 +449,7 @@ clippy::unnecessary_safety_comment, clippy::semicolon_if_nothing_returned, clippy::unwrap_used, - clippy::as_underscore, - clippy::doc_markdown + clippy::as_underscore )] #![allow( // used when concepts are logically separate diff --git a/lexical-write-float/src/options.rs b/lexical-write-float/src/options.rs index dc925bb7..7b2ec6dc 100644 --- a/lexical-write-float/src/options.rs +++ b/lexical-write-float/src/options.rs @@ -1014,7 +1014,8 @@ impl OptionsBuilder { /// /// # Panics /// - /// If the built options are not valid. + /// If the built options are not valid. This should always + /// be used within a const context to avoid panics at runtime. #[inline(always)] pub const fn build_strict(&self) -> Options { match self.build() { diff --git a/lexical-write-integer/src/lib.rs b/lexical-write-integer/src/lib.rs index 7cd7a1ad..9d435ae2 100644 --- a/lexical-write-integer/src/lib.rs +++ b/lexical-write-integer/src/lib.rs @@ -328,8 +328,7 @@ clippy::unnecessary_safety_comment, clippy::semicolon_if_nothing_returned, clippy::unwrap_used, - clippy::as_underscore, - clippy::doc_markdown + clippy::as_underscore )] #![allow( // used when concepts are logically separate diff --git a/lexical-write-integer/src/options.rs b/lexical-write-integer/src/options.rs index 89a89626..bb2da507 100644 --- a/lexical-write-integer/src/options.rs +++ b/lexical-write-integer/src/options.rs @@ -78,7 +78,15 @@ impl OptionsBuilder { Options {} } - /// Build the [`Options`] struct. This can never panic. + /// Build the [`Options`] struct. + /// + /// This can never panic. + /// + /// #[inline(always)] pub const fn build_strict(&self) -> Options { match self.build() { diff --git a/lexical/Cargo.toml b/lexical/Cargo.toml index 36efc126..cade5284 100644 --- a/lexical/Cargo.toml +++ b/lexical/Cargo.toml @@ -60,6 +60,16 @@ lint = ["lexical-core/lint"] # https://github.com/Alexhuszagh/rust-lexical/issues/46 f128 = ["lexical-core/f128"] +# DEPRECATED +# ---------- +# These were never supported, however, they exist in case existing code +# uses them. They should not be used under any circumstances and should +# be removed. +parse = ["parse-integers", "parse-floats"] +write = ["write-integers", "write-floats"] +integers = ["parse-integers", "write-integers"] +floats = ["parse-floats", "write-floats"] + [package.metadata.docs.rs] features = ["radix", "format", "write-integers", "write-floats", "parse-integers", "parse-floats", "f16"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/lexical/src/lib.rs b/lexical/src/lib.rs index 64642dec..2fcbdfbf 100644 --- a/lexical/src/lib.rs +++ b/lexical/src/lib.rs @@ -612,8 +612,7 @@ clippy::unnecessary_safety_comment, clippy::semicolon_if_nothing_returned, clippy::unwrap_used, - clippy::as_underscore, - clippy::doc_markdown + clippy::as_underscore )] #![allow( // used when concepts are logically separate