Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unused imports #350

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/algorithms/div/knuth.rs
Original file line number Diff line number Diff line change
@@ -193,13 +193,15 @@ pub fn div_nxm(numerator: &mut [u64], divisor: &mut [u64]) {
mod tests {
use super::*;
use crate::algorithms::{addmul, cmp, sbb_n};
use alloc::vec::Vec;
use core::cmp::Ordering;
use proptest::{
collection, num, proptest,
strategy::{Just, Strategy},
};

#[allow(unused_imports)]
use alloc::vec::Vec;

// Basic test without exceptional paths
#[test]
fn test_divrem_8by4() {
1 change: 1 addition & 0 deletions src/bit_arr.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ use core::{
};

#[cfg(feature = "alloc")]
#[allow(unused_imports)]
use alloc::{borrow::Cow, vec::Vec};

/// A newtype wrapper around [`Uint`] that restricts operations to those
1 change: 1 addition & 0 deletions src/bytes.rs
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ use crate::Uint;
use core::slice;

#[cfg(feature = "alloc")]
#[allow(unused_imports)]
use alloc::{borrow::Cow, vec::Vec};

// OPT: *_to_smallvec to avoid allocation.
2 changes: 1 addition & 1 deletion src/cmp.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::Uint;
use core::cmp::{Ord, Ordering, PartialOrd};
use core::cmp::Ordering;

impl<const BITS: usize, const LIMBS: usize> Ord for Uint<BITS, LIMBS> {
#[inline]
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
// Unstable features
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(feature = "nightly", feature(core_intrinsics))]
#![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(
feature = "generic_const_exprs",
feature(generic_const_exprs),
2 changes: 1 addition & 1 deletion src/mul.rs
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ impl_bin_op!(Mul, mul, MulAssign, mul_assign, wrapping_mul);
#[cfg(test)]
mod tests {
use super::*;
use crate::{const_for, nlimbs};
use crate::const_for;
use proptest::proptest;

#[test]
4 changes: 3 additions & 1 deletion src/string.rs
Original file line number Diff line number Diff line change
@@ -214,9 +214,11 @@ impl<const BITS: usize, const LIMBS: usize> FromStr for Uint<BITS, LIMBS> {
#[cfg(test)]
mod tests {
use super::*;
use alloc::string::ToString;
use proptest::proptest;

#[allow(unused_imports)]
use alloc::string::ToString;

#[allow(clippy::unreadable_literal)]
const N: Uint<256, 4> = Uint::from_limbs([
0xa8ec92344438aaf4_u64,
4 changes: 3 additions & 1 deletion src/support/arbitrary.rs
Original file line number Diff line number Diff line change
@@ -34,9 +34,11 @@ impl<'a, const BITS: usize, const LIMBS: usize> Arbitrary<'a> for Uint<BITS, LIM
mod tests {
use super::*;
use crate::{const_for, nlimbs};
use alloc::vec::Vec;
use core::iter::repeat;

#[allow(unused_imports)]
use alloc::vec::Vec;

#[test]
fn test_arbitrary() {
const_for!(BITS in NON_ZERO {
4 changes: 3 additions & 1 deletion src/support/scale.rs
Original file line number Diff line number Diff line change
@@ -4,12 +4,14 @@
#![cfg_attr(docsrs, doc(cfg(feature = "parity-scale-codec")))]

use crate::Uint;
use alloc::vec::Vec;
use parity_scale_codec::{
Compact, CompactAs, Decode, Encode, EncodeAsRef, EncodeLike, Error, HasCompact, Input,
MaxEncodedLen, Output,
};

#[allow(unused_imports)]
use alloc::vec::Vec;

// Compact encoding is supported only for 0-(2**536-1) values:
// https://docs.substrate.io/reference/scale-codec/#fn-1
const COMPACT_BITS_LIMIT: usize = 536;
8 changes: 6 additions & 2 deletions src/support/serde.rs
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
#![cfg_attr(docsrs, doc(cfg(feature = "serde")))]

use crate::{nbytes, Bits, Uint};
use alloc::string::String;
use core::{
fmt::{Formatter, Result as FmtResult, Write},
str,
@@ -14,6 +13,9 @@ use serde::{
Deserialize, Deserializer, Serialize, Serializer,
};

#[allow(unused_imports)]
use alloc::string::String;

/// Canonical serialization for all human-readable instances of `Uint<0, 0>`,
/// and minimal human-readable `Uint<BITS, LIMBS>::ZERO` for any bit size.
const ZERO_STR: &str = "0x0";
@@ -175,9 +177,11 @@ impl<'de, const BITS: usize, const LIMBS: usize> Visitor<'de> for ByteVisitor<BI
mod tests {
use super::*;
use crate::{const_for, nlimbs};
use alloc::vec::Vec;
use proptest::proptest;

#[allow(unused_imports)]
use alloc::vec::Vec;

#[test]
fn test_serde_human_readable() {
const_for!(BITS in SIZES {
1 change: 1 addition & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[cfg(feature = "alloc")]
#[allow(unused_imports)]
use alloc::vec::Vec;

/// Like `a % b` but returns `b` instead of `0`.