Skip to content

Commit

Permalink
chore: only implement Error with feature "std"
Browse files Browse the repository at this point in the history
`core::error` needs an MSRV of 1.81,
which is a bit too new for this crate
  • Loading branch information
FreezyLemon committed Dec 6, 2024
1 parent fc8c695 commit 1e31bd5
Show file tree
Hide file tree
Showing 31 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/distribution/beta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl core::fmt::Display for BetaError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for BetaError {}

impl Beta {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/binomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ impl core::fmt::Display for BinomialError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for BinomialError {}

impl Binomial {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/categorical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl core::fmt::Display for CategoricalError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for CategoricalError {}

impl Categorical {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/cauchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl core::fmt::Display for CauchyError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for CauchyError {}

impl Cauchy {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/chi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl core::fmt::Display for ChiError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for ChiError {}

impl Chi {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/dirac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ impl core::fmt::Display for DiracError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for DiracError {}

impl Dirac {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/dirichlet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl core::fmt::Display for DirichletError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for DirichletError {}

impl Dirichlet<Dyn> {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/discrete_uniform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ impl core::fmt::Display for DiscreteUniformError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for DiscreteUniformError {}

impl DiscreteUniform {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/exponential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl core::fmt::Display for ExpError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for ExpError {}

impl Exp {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/fisher_snedecor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl core::fmt::Display for FisherSnedecorError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for FisherSnedecorError {}

impl FisherSnedecor {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/gamma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl core::fmt::Display for GammaError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for GammaError {}

impl Gamma {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/geometric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl core::fmt::Display for GeometricError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for GeometricError {}

impl Geometric {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/gumbel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ impl core::fmt::Display for GumbelError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for GumbelError {}

impl Gumbel {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/hypergeometric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl core::fmt::Display for HypergeometricError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for HypergeometricError {}

impl Hypergeometric {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/inverse_gamma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl core::fmt::Display for InverseGammaError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for InverseGammaError {}

impl InverseGamma {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/laplace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl core::fmt::Display for LaplaceError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for LaplaceError {}

impl Laplace {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/log_normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl core::fmt::Display for LogNormalError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for LogNormalError {}

impl LogNormal {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/multinomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ impl core::fmt::Display for MultinomialError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for MultinomialError {}

impl Multinomial<Dyn> {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/multivariate_normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ impl core::fmt::Display for MultivariateNormalError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for MultivariateNormalError {}

impl MultivariateNormal<Dyn> {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/multivariate_students_t.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ impl core::fmt::Display for MultivariateStudentError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for MultivariateStudentError {}

impl MultivariateStudent<Dyn> {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/negative_binomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl core::fmt::Display for NegativeBinomialError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for NegativeBinomialError {}

impl NegativeBinomial {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl core::fmt::Display for NormalError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for NormalError {}

impl Normal {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/pareto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl core::fmt::Display for ParetoError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for ParetoError {}

impl Pareto {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/poisson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl core::fmt::Display for PoissonError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for PoissonError {}

impl Poisson {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/students_t.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl core::fmt::Display for StudentsTError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for StudentsTError {}

impl StudentsT {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/triangular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl core::fmt::Display for TriangularError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for TriangularError {}

impl Triangular {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/uniform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl core::fmt::Display for UniformError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for UniformError {}

impl Uniform {
Expand Down
1 change: 1 addition & 0 deletions src/distribution/weibull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl core::fmt::Display for WeibullError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for WeibullError {}

impl Weibull {
Expand Down
1 change: 1 addition & 0 deletions src/function/beta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ impl core::fmt::Display for BetaFuncError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for BetaFuncError {}

/// Computes the natural logarithm
Expand Down
1 change: 1 addition & 0 deletions src/function/gamma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ impl core::fmt::Display for GammaFuncError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for GammaFuncError {}

/// Auxiliary variable when evaluating the `gamma_ln` function
Expand Down
1 change: 1 addition & 0 deletions src/stats_tests/fisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ impl core::fmt::Display for FishersExactTestError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for FishersExactTestError {}

impl From<HypergeometricError> for FishersExactTestError {
Expand Down

0 comments on commit 1e31bd5

Please sign in to comment.