Skip to content

Commit be25b41

Browse files
committed
Fix clippy lints and minor documentation enhancements.
1 parent 988575d commit be25b41

File tree

18 files changed

+132
-112
lines changed

18 files changed

+132
-112
lines changed

clippy.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ disallowed-macros = [
44
{ path = "std::print", reason = "no IO allowed" },
55
{ path = "std::println", reason = "no IO allowed" },
66
{ path = "std::format", reason = "no string allocation allowed" },
7-
{ path = "std::debug", reason = "debugging macros should not be present in any release" },
7+
{ path = "std::dbg", reason = "debugging macros should not be present in any release" },
88
# NOTE: unimplemented is fine because this can be for intentionally disabled methods
99
{ path = "std::todo", reason = "should never have TODO macros in releases" },
1010
]
@@ -14,7 +14,7 @@ disallowed-methods = [
1414
{ path = "std::io::stderr", reason = "no IO allowed" },
1515
]
1616
disallowed-types = [
17-
{ path = "std::io::File", reason = "no IO allowed" },
17+
{ path = "std::fs::File", reason = "no IO allowed" },
1818
{ path = "std::io::BufReader", reason = "need our own abstractions for reading/writing" },
1919
{ path = "std::io::BufWriter", reason = "need our own abstractions for reading/writing" },
2020
]

extras/benchmark/write-float/special.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ macro_rules! gen_vec {
1919
let value = fastrand::$i($exp_mask..);
2020
// NOTE: We want mem::transmute, not from_bits because we
2121
// don't want the special handling of from_bits
22-
#[allow(clippy::transmute_int_to_float)]
22+
// FIXME: Move to `to_bits` in 1.83.0+ (const stable)
23+
// FIXME: change to `unnecessary_transmutes` when supported.
24+
#[allow(
25+
renamed_and_removed_lints,
26+
unknown_lints,
27+
clippy::transmute_int_to_float,
28+
unnecessary_transmutes
29+
)]
2330
vec.push(unsafe { mem::transmute::<$i, $f>(value) });
2431
}
2532
vec

extras/clippy.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ disallowed-macros = [
44
{ path = "std::print", reason = "no IO allowed" },
55
{ path = "std::println", reason = "no IO allowed" },
66
{ path = "std::format", reason = "no string allocation allowed" },
7-
{ path = "std::debug", reason = "debugging macros should not be present in any release" },
7+
{ path = "std::dbg", reason = "debugging macros should not be present in any release" },
88
# NOTE: unimplemented is fine because this can be for intentionally disabled methods
99
{ path = "std::todo", reason = "should never have TODO macros in releases" },
1010
]
@@ -14,7 +14,7 @@ disallowed-methods = [
1414
{ path = "std::io::stderr", reason = "no IO allowed" },
1515
]
1616
disallowed-types = [
17-
{ path = "std::io::File", reason = "no IO allowed" },
17+
{ path = "std::fs::File", reason = "no IO allowed" },
1818
{ path = "std::io::BufReader", reason = "need our own abstractions for reading/writing" },
1919
{ path = "std::io::BufWriter", reason = "need our own abstractions for reading/writing" },
2020
]

lexical-core/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,7 @@
686686
clippy::unnecessary_safety_comment,
687687
clippy::semicolon_if_nothing_returned,
688688
clippy::unwrap_used,
689-
clippy::as_underscore,
690-
clippy::doc_markdown
689+
clippy::as_underscore
691690
)]
692691
#![allow(
693692
// used when concepts are logically separate

lexical-parse-float/src/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ impl<const SIZE: usize> StackVec<SIZE> {
635635
/// Create a reverse view of the vector for indexing.
636636
#[must_use]
637637
#[inline(always)]
638-
pub fn rview(&self) -> ReverseView<Limb> {
638+
pub fn rview(&self) -> ReverseView<'_, Limb> {
639639
ReverseView {
640640
inner: self,
641641
}

lexical-parse-float/src/float.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ pub trait RawFloat: Float + ExactFloat + MaxDigits {
6464
#[must_use]
6565
#[inline(always)]
6666
fn int_pow_fast_path(exponent: usize, radix: u32) -> u64 {
67-
// SAFETY: safe as long as the exponent is smaller than the radix table.
6867
#[cfg(not(feature = "compact"))]
6968
return get_small_int_power(exponent, radix);
7069

@@ -76,7 +75,6 @@ pub trait RawFloat: Float + ExactFloat + MaxDigits {
7675
impl RawFloat for f32 {
7776
#[inline(always)]
7877
fn pow_fast_path(exponent: usize, radix: u32) -> Self {
79-
// SAFETY: safe as long as the exponent is smaller than the radix table.
8078
#[cfg(not(feature = "compact"))]
8179
return get_small_f32_power(exponent, radix);
8280

@@ -88,7 +86,6 @@ impl RawFloat for f32 {
8886
impl RawFloat for f64 {
8987
#[inline(always)]
9088
fn pow_fast_path(exponent: usize, radix: u32) -> Self {
91-
// SAFETY: safe as long as the exponent is smaller than the radix table.
9289
#[cfg(not(feature = "compact"))]
9390
return get_small_f64_power(exponent, radix);
9491

lexical-parse-float/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,7 @@
518518
clippy::unnecessary_safety_comment,
519519
clippy::semicolon_if_nothing_returned,
520520
clippy::unwrap_used,
521-
clippy::as_underscore,
522-
clippy::doc_markdown
521+
clippy::as_underscore
523522
)]
524523
#![allow(
525524
// used when concepts are logically separate

lexical-parse-float/src/options.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,8 @@ impl OptionsBuilder {
653653
///
654654
/// # Panics
655655
///
656-
/// If the built options are not valid.
656+
/// If the built options are not valid. This should always
657+
/// be used within a const context to avoid panics at runtime.
657658
#[inline(always)]
658659
pub const fn build_strict(&self) -> Options {
659660
match self.build() {

lexical-parse-integer/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@
263263
clippy::unnecessary_safety_comment,
264264
clippy::semicolon_if_nothing_returned,
265265
clippy::unwrap_used,
266-
clippy::as_underscore,
267-
clippy::doc_markdown
266+
clippy::as_underscore
268267
)]
269268
#![allow(
270269
// used when concepts are logically separate

lexical-parse-integer/src/options.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,15 @@ impl OptionsBuilder {
131131
}
132132
}
133133

134-
/// Build the [`Options`] struct. This can never panic.
134+
/// Build the [`Options`] struct.
135+
///
136+
/// This can never panic.
137+
///
138+
/// <!-- # Panics
139+
///
140+
/// If the built options are not valid. This should always
141+
/// be used within a const context to avoid panics at runtime.
142+
/// -->
135143
#[inline(always)]
136144
pub const fn build_strict(&self) -> Options {
137145
match self.build() {

0 commit comments

Comments
 (0)