Skip to content

Commit

Permalink
Satisfy Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
myrrlyn committed Mar 28, 2021
1 parent 59c6b76 commit 14c3fc4
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 9 deletions.
7 changes: 3 additions & 4 deletions benches/memcpy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ in an element individually.
use std::mem::MaybeUninit;

use bitvec::{
mem::{
elts,
},
mem::elts,
prelude::*,
};use funty::IsNumber;
};
use criterion::{
criterion_group,
criterion_main,
Expand All @@ -24,6 +22,7 @@ use criterion::{
SamplingMode,
Throughput,
};
use funty::IsNumber;
use tap::tap::Tap;

// One kibibyte
Expand Down
9 changes: 9 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
########################################################################
# Clippy Configuration #
# #
# This file controls the `cargo clippy` linter for the lints where it #
# accepts external input. Relatively few lints do; most require #
# attributes set directly in the source code. #
########################################################################

msrv = "1.51.0"
2 changes: 2 additions & 0 deletions examples/ipv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ each modification so that the user can manually step to the next, by running it
with the argument "pause": `cargo run --example ipv4 -- pause`
!*/

#![allow(clippy::single_char_add_str)]

use std::{
collections::BTreeSet,
fmt::{
Expand Down
1 change: 1 addition & 0 deletions src/devel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ mod tests {
use super::*;

#[test]
#[allow(clippy::reversed_empty_ranges)] // I know.
fn check_range_asserts() {
assert!(catch_unwind(|| assert_range(7 .. 2, None)).is_err());
assert!(catch_unwind(|| assert_range(0 .. 8, 4)).is_err());
Expand Down
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,16 @@ the standard libraries.
#![cfg_attr(debug_assertions, warn(missing_docs))]
#![cfg_attr(not(debug_assertions), deny(missing_docs))]
#![deny(unconditional_recursion)]
// Clippy controls applicable in ordinary code.
#![allow(
clippy::single_char_add_str, // Bypass UTF-8 encoding.
)]
// Clippy controls only applicable in #[cfg(test)] testing modules.
#![cfg_attr(test, allow(
clippy::many_single_char_names, // Tests do not need descriptive bind names.
clippy::redundant_clone, // Does not matter in tests.
clippy::unusual_byte_groupings, // Literals are for region patterns.
))]

#[cfg(feature = "alloc")]
extern crate alloc;
Expand Down
7 changes: 3 additions & 4 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,10 @@ macro_rules! bitarr {
type Celled = core::cell::Cell<$store>;

const ELTS: usize = $crate::__count_elts!($store; $($val),*);
type Data = [Celled; ELTS];
const DATA: Data =
$crate::__encode_bits!($order, Cell<$store>; $($val),*);
type Data = [$store; ELTS];
const DATA: Data = $crate::__encode_bits!($order, $store; $($val),*);

type This = $crate::array::BitArray<$order, Data>;
type This = $crate::array::BitArray<$order, [Celled; ELTS]>;
unsafe { core::mem::transmute::<_, This>(DATA) }
}};
(const $order:ident, $store:ident; $($val:expr),* $(,)?) => {{
Expand Down
1 change: 0 additions & 1 deletion tests/bincode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ an ABI, it will only be modified in `0.X` or `X.0` releases.

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

use bincode;
use bitvec::prelude::*;

#[test]
Expand Down
1 change: 1 addition & 0 deletions tests/equality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ fn slice_only() {
#[test]
#[rustfmt::skip]
#[cfg(feature = "alloc")]
#[allow(clippy::eq_op)] // The matrix diagonal is a deliberate style choice.
fn with_alloc() {
let a = bits![Msb0, u8; 0, 1];
let b = bits![mut Lsb0, u16; 0, 1];
Expand Down
2 changes: 2 additions & 0 deletions tests/issues.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Test cases for defect reports.
#![allow(clippy::unusual_byte_groupings)]

#[cfg(feature = "alloc")]
use bitvec::prelude::*;

Expand Down

0 comments on commit 14c3fc4

Please sign in to comment.