From 4f362c63710fe6fced8fc441608527970c0ba2d7 Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Wed, 7 Aug 2024 12:31:07 +0200 Subject: [PATCH] Remove unused imports --- src/distribution/beta.rs | 1 - src/distribution/dirac.rs | 4 ++-- src/distribution/dirichlet.rs | 6 ------ src/distribution/empirical.rs | 5 ++--- src/distribution/internal.rs | 2 +- src/distribution/mod.rs | 6 ++---- src/distribution/multivariate_normal.rs | 5 +---- src/lib.rs | 1 - src/statistics/iter_statistics.rs | 4 ---- src/statistics/mod.rs | 1 - src/statistics/traits.rs | 3 --- 11 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/distribution/beta.rs b/src/distribution/beta.rs index cfe1bb0f..c6df005b 100644 --- a/src/distribution/beta.rs +++ b/src/distribution/beta.rs @@ -431,7 +431,6 @@ impl Continuous for Beta { mod tests { use super::*; use super::super::internal::*; - use crate::statistics::*; use crate::testing_boiler; testing_boiler!(a: f64, b: f64; Beta); diff --git a/src/distribution/dirac.rs b/src/distribution/dirac.rs index 4fa6a390..c664d8db 100644 --- a/src/distribution/dirac.rs +++ b/src/distribution/dirac.rs @@ -1,4 +1,4 @@ -use crate::distribution::{Continuous, ContinuousCDF}; +use crate::distribution::ContinuousCDF; use crate::statistics::*; use crate::{Result, StatsError}; use rand::Rng; @@ -194,7 +194,7 @@ impl Mode> for Dirac { #[cfg(test)] mod tests { use crate::statistics::*; - use crate::distribution::{ContinuousCDF, Continuous, Dirac}; + use crate::distribution::{ContinuousCDF, Dirac}; fn try_create(v: f64) -> Dirac { let d = Dirac::new(v); diff --git a/src/distribution/dirichlet.rs b/src/distribution/dirichlet.rs index 55795a7a..cc96e102 100644 --- a/src/distribution/dirichlet.rs +++ b/src/distribution/dirichlet.rs @@ -4,9 +4,6 @@ use crate::statistics::*; use crate::{prec, Result, StatsError}; use nalgebra::DMatrix; use nalgebra::DVector; -use nalgebra::{ - base::allocator::Allocator, base::dimension::DimName, DefaultAllocator, Dim, DimMin, U1, -}; use rand::Rng; use std::f64; @@ -310,9 +307,6 @@ fn is_valid_alpha(a: &[f64]) -> bool { #[cfg(test)] mod tests { use super::*; - use nalgebra::{DVector}; - use crate::function::gamma; - use crate::statistics::*; use crate::distribution::{Continuous, Dirichlet}; #[test] diff --git a/src/distribution/empirical.rs b/src/distribution/empirical.rs index 9afd7022..104169aa 100644 --- a/src/distribution/empirical.rs +++ b/src/distribution/empirical.rs @@ -1,7 +1,6 @@ -use crate::distribution::{Continuous, ContinuousCDF, Uniform}; +use crate::distribution::{ContinuousCDF, Uniform}; use crate::statistics::*; -use crate::{Result, StatsError}; -use ::num_traits::float::Float; +use crate::Result; use core::cmp::Ordering; use rand::Rng; use std::collections::BTreeMap; diff --git a/src/distribution/internal.rs b/src/distribution/internal.rs index 15c24c10..b6e71136 100644 --- a/src/distribution/internal.rs +++ b/src/distribution/internal.rs @@ -1,4 +1,4 @@ -use num_traits::{Bounded, Float, Num}; +use num_traits::Num; /// Returns true if there are no elements in `x` in `arr` /// such that `x <= 0.0` or `x` is `f64::NAN` and `sum(arr) > 0.0`. diff --git a/src/distribution/mod.rs b/src/distribution/mod.rs index 56deb09a..dea1f9af 100644 --- a/src/distribution/mod.rs +++ b/src/distribution/mod.rs @@ -2,8 +2,8 @@ //! and provides //! concrete implementations for a variety of distributions. use super::statistics::{Max, Min}; -use ::num_traits::{Bounded, Float, Num}; -use num_traits::{NumAssign, NumAssignOps, NumAssignRef}; +use ::num_traits::{Float, Num}; +use num_traits::NumAssignOps; pub use self::bernoulli::Bernoulli; pub use self::beta::Beta; @@ -71,8 +71,6 @@ mod weibull; mod ziggurat; mod ziggurat_tables; -use crate::Result; - /// The `ContinuousCDF` trait is used to specify an interface for univariate /// distributions for which cdf float arguments are sensible. pub trait ContinuousCDF: Min + Max { diff --git a/src/distribution/multivariate_normal.rs b/src/distribution/multivariate_normal.rs index 993bb9ba..9949d676 100644 --- a/src/distribution/multivariate_normal.rs +++ b/src/distribution/multivariate_normal.rs @@ -2,10 +2,7 @@ use crate::distribution::Continuous; use crate::distribution::Normal; use crate::statistics::{Max, MeanN, Min, Mode, VarianceN}; use crate::{Result, StatsError}; -use nalgebra::{ - base::allocator::Allocator, Cholesky, Const, DMatrix, DVector, DefaultAllocator, Dim, DimMin, - Dyn, OMatrix, OVector, -}; +use nalgebra::{Cholesky, Const, DMatrix, DVector, Dim, DimMin, Dyn, OMatrix, OVector}; use rand::Rng; use std::f64; use std::f64::consts::{E, PI}; diff --git a/src/lib.rs b/src/lib.rs index df65187c..56f9b162 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,7 +47,6 @@ #![crate_name = "statrs"] #![allow(clippy::excessive_precision)] #![allow(clippy::many_single_char_names)] -#![allow(unused_imports)] #![forbid(unsafe_code)] #[macro_use] diff --git a/src/statistics/iter_statistics.rs b/src/statistics/iter_statistics.rs index e568e531..97b7fd17 100644 --- a/src/statistics/iter_statistics.rs +++ b/src/statistics/iter_statistics.rs @@ -244,10 +244,6 @@ where #[cfg(test)] mod tests { use std::f64::consts; - use rand::rngs::StdRng; - use rand::SeedableRng; - use rand::distributions::Distribution; - use crate::distribution::Normal; use crate::statistics::Statistics; use crate::generate::{InfinitePeriodic, InfiniteSinusoidal}; diff --git a/src/statistics/mod.rs b/src/statistics/mod.rs index 6a2d3342..272091a4 100644 --- a/src/statistics/mod.rs +++ b/src/statistics/mod.rs @@ -1,6 +1,5 @@ //! Provides traits for statistical computation -pub use self::iter_statistics::*; pub use self::order_statistics::*; pub use self::slice_statistics::*; pub use self::statistics::*; diff --git a/src/statistics/traits.rs b/src/statistics/traits.rs index d264d719..e5211075 100644 --- a/src/statistics/traits.rs +++ b/src/statistics/traits.rs @@ -1,6 +1,3 @@ -use ::nalgebra::{ - base::allocator::Allocator, base::dimension::DimName, DefaultAllocator, Dim, DimMin, U1, -}; use ::num_traits::float::Float; const STEPS: usize = 1_000;