Skip to content

Commit 14c3fc4

Browse files
committed
Satisfy Clippy
1 parent 59c6b76 commit 14c3fc4

9 files changed

Lines changed: 31 additions & 9 deletions

File tree

benches/memcpy.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ in an element individually.
1111
use std::mem::MaybeUninit;
1212

1313
use bitvec::{
14-
mem::{
15-
elts,
16-
},
14+
mem::elts,
1715
prelude::*,
18-
};use funty::IsNumber;
16+
};
1917
use criterion::{
2018
criterion_group,
2119
criterion_main,
@@ -24,6 +22,7 @@ use criterion::{
2422
SamplingMode,
2523
Throughput,
2624
};
25+
use funty::IsNumber;
2726
use tap::tap::Tap;
2827

2928
// One kibibyte

clippy.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
########################################################################
2+
# Clippy Configuration #
3+
# #
4+
# This file controls the `cargo clippy` linter for the lints where it #
5+
# accepts external input. Relatively few lints do; most require #
6+
# attributes set directly in the source code. #
7+
########################################################################
8+
9+
msrv = "1.51.0"

examples/ipv4.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ each modification so that the user can manually step to the next, by running it
66
with the argument "pause": `cargo run --example ipv4 -- pause`
77
!*/
88

9+
#![allow(clippy::single_char_add_str)]
10+
911
use std::{
1012
collections::BTreeSet,
1113
fmt::{

src/devel.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ mod tests {
130130
use super::*;
131131

132132
#[test]
133+
#[allow(clippy::reversed_empty_ranges)] // I know.
133134
fn check_range_asserts() {
134135
assert!(catch_unwind(|| assert_range(7 .. 2, None)).is_err());
135136
assert!(catch_unwind(|| assert_range(0 .. 8, 4)).is_err());

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ the standard libraries.
266266
#![cfg_attr(debug_assertions, warn(missing_docs))]
267267
#![cfg_attr(not(debug_assertions), deny(missing_docs))]
268268
#![deny(unconditional_recursion)]
269+
// Clippy controls applicable in ordinary code.
270+
#![allow(
271+
clippy::single_char_add_str, // Bypass UTF-8 encoding.
272+
)]
273+
// Clippy controls only applicable in #[cfg(test)] testing modules.
274+
#![cfg_attr(test, allow(
275+
clippy::many_single_char_names, // Tests do not need descriptive bind names.
276+
clippy::redundant_clone, // Does not matter in tests.
277+
clippy::unusual_byte_groupings, // Literals are for region patterns.
278+
))]
269279

270280
#[cfg(feature = "alloc")]
271281
extern crate alloc;

src/macros.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,10 @@ macro_rules! bitarr {
158158
type Celled = core::cell::Cell<$store>;
159159

160160
const ELTS: usize = $crate::__count_elts!($store; $($val),*);
161-
type Data = [Celled; ELTS];
162-
const DATA: Data =
163-
$crate::__encode_bits!($order, Cell<$store>; $($val),*);
161+
type Data = [$store; ELTS];
162+
const DATA: Data = $crate::__encode_bits!($order, $store; $($val),*);
164163

165-
type This = $crate::array::BitArray<$order, Data>;
164+
type This = $crate::array::BitArray<$order, [Celled; ELTS]>;
166165
unsafe { core::mem::transmute::<_, This>(DATA) }
167166
}};
168167
(const $order:ident, $store:ident; $($val:expr),* $(,)?) => {{

tests/bincode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ an ABI, it will only be modified in `0.X` or `X.0` releases.
2020

2121
#![cfg(feature = "serde")]
2222

23-
use bincode;
2423
use bitvec::prelude::*;
2524

2625
#[test]

tests/equality.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ fn slice_only() {
103103
#[test]
104104
#[rustfmt::skip]
105105
#[cfg(feature = "alloc")]
106+
#[allow(clippy::eq_op)] // The matrix diagonal is a deliberate style choice.
106107
fn with_alloc() {
107108
let a = bits![Msb0, u8; 0, 1];
108109
let b = bits![mut Lsb0, u16; 0, 1];

tests/issues.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Test cases for defect reports.
22
3+
#![allow(clippy::unusual_byte_groupings)]
4+
35
#[cfg(feature = "alloc")]
46
use bitvec::prelude::*;
57

0 commit comments

Comments
 (0)