From 1e31bd57764bc0972fd00aa50fe01c360966912d Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Fri, 6 Dec 2024 17:31:08 +0100 Subject: [PATCH] chore: only implement Error with feature "std" `core::error` needs an MSRV of 1.81, which is a bit too new for this crate --- src/distribution/beta.rs | 1 + src/distribution/binomial.rs | 1 + src/distribution/categorical.rs | 1 + src/distribution/cauchy.rs | 1 + src/distribution/chi.rs | 1 + src/distribution/dirac.rs | 1 + src/distribution/dirichlet.rs | 1 + src/distribution/discrete_uniform.rs | 1 + src/distribution/exponential.rs | 1 + src/distribution/fisher_snedecor.rs | 1 + src/distribution/gamma.rs | 1 + src/distribution/geometric.rs | 1 + src/distribution/gumbel.rs | 1 + src/distribution/hypergeometric.rs | 1 + src/distribution/inverse_gamma.rs | 1 + src/distribution/laplace.rs | 1 + src/distribution/log_normal.rs | 1 + src/distribution/multinomial.rs | 1 + src/distribution/multivariate_normal.rs | 1 + src/distribution/multivariate_students_t.rs | 1 + src/distribution/negative_binomial.rs | 1 + src/distribution/normal.rs | 1 + src/distribution/pareto.rs | 1 + src/distribution/poisson.rs | 1 + src/distribution/students_t.rs | 1 + src/distribution/triangular.rs | 1 + src/distribution/uniform.rs | 1 + src/distribution/weibull.rs | 1 + src/function/beta.rs | 1 + src/function/gamma.rs | 1 + src/stats_tests/fisher.rs | 1 + 31 files changed, 31 insertions(+) diff --git a/src/distribution/beta.rs b/src/distribution/beta.rs index c2b567d6..e2ec79e5 100644 --- a/src/distribution/beta.rs +++ b/src/distribution/beta.rs @@ -43,6 +43,7 @@ impl core::fmt::Display for BetaError { } } +#[cfg(feature = "std")] impl std::error::Error for BetaError {} impl Beta { diff --git a/src/distribution/binomial.rs b/src/distribution/binomial.rs index 11140780..5326f5d5 100644 --- a/src/distribution/binomial.rs +++ b/src/distribution/binomial.rs @@ -41,6 +41,7 @@ impl core::fmt::Display for BinomialError { } } +#[cfg(feature = "std")] impl std::error::Error for BinomialError {} impl Binomial { diff --git a/src/distribution/categorical.rs b/src/distribution/categorical.rs index 8a1b9373..4d153d9b 100644 --- a/src/distribution/categorical.rs +++ b/src/distribution/categorical.rs @@ -53,6 +53,7 @@ impl core::fmt::Display for CategoricalError { } } +#[cfg(feature = "std")] impl std::error::Error for CategoricalError {} impl Categorical { diff --git a/src/distribution/cauchy.rs b/src/distribution/cauchy.rs index 22e35b08..7a7f68b0 100644 --- a/src/distribution/cauchy.rs +++ b/src/distribution/cauchy.rs @@ -42,6 +42,7 @@ impl core::fmt::Display for CauchyError { } } +#[cfg(feature = "std")] impl std::error::Error for CauchyError {} impl Cauchy { diff --git a/src/distribution/chi.rs b/src/distribution/chi.rs index ea553354..85e7c348 100644 --- a/src/distribution/chi.rs +++ b/src/distribution/chi.rs @@ -42,6 +42,7 @@ impl core::fmt::Display for ChiError { } } +#[cfg(feature = "std")] impl std::error::Error for ChiError {} impl Chi { diff --git a/src/distribution/dirac.rs b/src/distribution/dirac.rs index d18ea733..c2a7913e 100644 --- a/src/distribution/dirac.rs +++ b/src/distribution/dirac.rs @@ -33,6 +33,7 @@ impl core::fmt::Display for DiracError { } } +#[cfg(feature = "std")] impl std::error::Error for DiracError {} impl Dirac { diff --git a/src/distribution/dirichlet.rs b/src/distribution/dirichlet.rs index 4e7cebf1..2af8193a 100644 --- a/src/distribution/dirichlet.rs +++ b/src/distribution/dirichlet.rs @@ -54,6 +54,7 @@ impl core::fmt::Display for DirichletError { } } +#[cfg(feature = "std")] impl std::error::Error for DirichletError {} impl Dirichlet { diff --git a/src/distribution/discrete_uniform.rs b/src/distribution/discrete_uniform.rs index b0193bac..f47ae4c7 100644 --- a/src/distribution/discrete_uniform.rs +++ b/src/distribution/discrete_uniform.rs @@ -38,6 +38,7 @@ impl core::fmt::Display for DiscreteUniformError { } } +#[cfg(feature = "std")] impl std::error::Error for DiscreteUniformError {} impl DiscreteUniform { diff --git a/src/distribution/exponential.rs b/src/distribution/exponential.rs index a31d7876..0af1e53a 100644 --- a/src/distribution/exponential.rs +++ b/src/distribution/exponential.rs @@ -40,6 +40,7 @@ impl core::fmt::Display for ExpError { } } +#[cfg(feature = "std")] impl std::error::Error for ExpError {} impl Exp { diff --git a/src/distribution/fisher_snedecor.rs b/src/distribution/fisher_snedecor.rs index 0f8453d5..78b0b56d 100644 --- a/src/distribution/fisher_snedecor.rs +++ b/src/distribution/fisher_snedecor.rs @@ -49,6 +49,7 @@ impl core::fmt::Display for FisherSnedecorError { } } +#[cfg(feature = "std")] impl std::error::Error for FisherSnedecorError {} impl FisherSnedecor { diff --git a/src/distribution/gamma.rs b/src/distribution/gamma.rs index 1251f504..eebeeef9 100644 --- a/src/distribution/gamma.rs +++ b/src/distribution/gamma.rs @@ -48,6 +48,7 @@ impl core::fmt::Display for GammaError { } } +#[cfg(feature = "std")] impl std::error::Error for GammaError {} impl Gamma { diff --git a/src/distribution/geometric.rs b/src/distribution/geometric.rs index f7b93408..0ccce76c 100644 --- a/src/distribution/geometric.rs +++ b/src/distribution/geometric.rs @@ -39,6 +39,7 @@ impl core::fmt::Display for GeometricError { } } +#[cfg(feature = "std")] impl std::error::Error for GeometricError {} impl Geometric { diff --git a/src/distribution/gumbel.rs b/src/distribution/gumbel.rs index 48a5dd68..d224230c 100644 --- a/src/distribution/gumbel.rs +++ b/src/distribution/gumbel.rs @@ -45,6 +45,7 @@ impl core::fmt::Display for GumbelError { } } +#[cfg(feature = "std")] impl std::error::Error for GumbelError {} impl Gumbel { diff --git a/src/distribution/hypergeometric.rs b/src/distribution/hypergeometric.rs index b88d7e1e..b599f4d7 100644 --- a/src/distribution/hypergeometric.rs +++ b/src/distribution/hypergeometric.rs @@ -48,6 +48,7 @@ impl core::fmt::Display for HypergeometricError { } } +#[cfg(feature = "std")] impl std::error::Error for HypergeometricError {} impl Hypergeometric { diff --git a/src/distribution/inverse_gamma.rs b/src/distribution/inverse_gamma.rs index c359843b..3cdd6d84 100644 --- a/src/distribution/inverse_gamma.rs +++ b/src/distribution/inverse_gamma.rs @@ -49,6 +49,7 @@ impl core::fmt::Display for InverseGammaError { } } +#[cfg(feature = "std")] impl std::error::Error for InverseGammaError {} impl InverseGamma { diff --git a/src/distribution/laplace.rs b/src/distribution/laplace.rs index 31d3fb5c..9c8052d8 100644 --- a/src/distribution/laplace.rs +++ b/src/distribution/laplace.rs @@ -42,6 +42,7 @@ impl core::fmt::Display for LaplaceError { } } +#[cfg(feature = "std")] impl std::error::Error for LaplaceError {} impl Laplace { diff --git a/src/distribution/log_normal.rs b/src/distribution/log_normal.rs index 447173f9..9704b0ac 100644 --- a/src/distribution/log_normal.rs +++ b/src/distribution/log_normal.rs @@ -46,6 +46,7 @@ impl core::fmt::Display for LogNormalError { } } +#[cfg(feature = "std")] impl std::error::Error for LogNormalError {} impl LogNormal { diff --git a/src/distribution/multinomial.rs b/src/distribution/multinomial.rs index a96c483b..fc4437ba 100644 --- a/src/distribution/multinomial.rs +++ b/src/distribution/multinomial.rs @@ -59,6 +59,7 @@ impl core::fmt::Display for MultinomialError { } } +#[cfg(feature = "std")] impl std::error::Error for MultinomialError {} impl Multinomial { diff --git a/src/distribution/multivariate_normal.rs b/src/distribution/multivariate_normal.rs index 7d1a0ea8..9b61a923 100644 --- a/src/distribution/multivariate_normal.rs +++ b/src/distribution/multivariate_normal.rs @@ -135,6 +135,7 @@ impl core::fmt::Display for MultivariateNormalError { } } +#[cfg(feature = "std")] impl std::error::Error for MultivariateNormalError {} impl MultivariateNormal { diff --git a/src/distribution/multivariate_students_t.rs b/src/distribution/multivariate_students_t.rs index 8bf75755..9d3dfd21 100644 --- a/src/distribution/multivariate_students_t.rs +++ b/src/distribution/multivariate_students_t.rs @@ -82,6 +82,7 @@ impl core::fmt::Display for MultivariateStudentError { } } +#[cfg(feature = "std")] impl std::error::Error for MultivariateStudentError {} impl MultivariateStudent { diff --git a/src/distribution/negative_binomial.rs b/src/distribution/negative_binomial.rs index d28c0e23..c1c62884 100644 --- a/src/distribution/negative_binomial.rs +++ b/src/distribution/negative_binomial.rs @@ -60,6 +60,7 @@ impl core::fmt::Display for NegativeBinomialError { } } +#[cfg(feature = "std")] impl std::error::Error for NegativeBinomialError {} impl NegativeBinomial { diff --git a/src/distribution/normal.rs b/src/distribution/normal.rs index f93bd279..4f14b248 100644 --- a/src/distribution/normal.rs +++ b/src/distribution/normal.rs @@ -46,6 +46,7 @@ impl core::fmt::Display for NormalError { } } +#[cfg(feature = "std")] impl std::error::Error for NormalError {} impl Normal { diff --git a/src/distribution/pareto.rs b/src/distribution/pareto.rs index 75d035a2..efa358de 100644 --- a/src/distribution/pareto.rs +++ b/src/distribution/pareto.rs @@ -43,6 +43,7 @@ impl core::fmt::Display for ParetoError { } } +#[cfg(feature = "std")] impl std::error::Error for ParetoError {} impl Pareto { diff --git a/src/distribution/poisson.rs b/src/distribution/poisson.rs index 27f4ff36..986634c3 100644 --- a/src/distribution/poisson.rs +++ b/src/distribution/poisson.rs @@ -39,6 +39,7 @@ impl core::fmt::Display for PoissonError { } } +#[cfg(feature = "std")] impl std::error::Error for PoissonError {} impl Poisson { diff --git a/src/distribution/students_t.rs b/src/distribution/students_t.rs index 5731edeb..c144b459 100644 --- a/src/distribution/students_t.rs +++ b/src/distribution/students_t.rs @@ -51,6 +51,7 @@ impl core::fmt::Display for StudentsTError { } } +#[cfg(feature = "std")] impl std::error::Error for StudentsTError {} impl StudentsT { diff --git a/src/distribution/triangular.rs b/src/distribution/triangular.rs index 89191ae2..77d9223d 100644 --- a/src/distribution/triangular.rs +++ b/src/distribution/triangular.rs @@ -58,6 +58,7 @@ impl core::fmt::Display for TriangularError { } } +#[cfg(feature = "std")] impl std::error::Error for TriangularError {} impl Triangular { diff --git a/src/distribution/uniform.rs b/src/distribution/uniform.rs index 462073bc..f13f74d1 100644 --- a/src/distribution/uniform.rs +++ b/src/distribution/uniform.rs @@ -49,6 +49,7 @@ impl core::fmt::Display for UniformError { } } +#[cfg(feature = "std")] impl std::error::Error for UniformError {} impl Uniform { diff --git a/src/distribution/weibull.rs b/src/distribution/weibull.rs index f30f5259..447a8139 100644 --- a/src/distribution/weibull.rs +++ b/src/distribution/weibull.rs @@ -47,6 +47,7 @@ impl core::fmt::Display for WeibullError { } } +#[cfg(feature = "std")] impl std::error::Error for WeibullError {} impl Weibull { diff --git a/src/function/beta.rs b/src/function/beta.rs index 98ff74c4..b67b8033 100644 --- a/src/function/beta.rs +++ b/src/function/beta.rs @@ -30,6 +30,7 @@ impl core::fmt::Display for BetaFuncError { } } +#[cfg(feature = "std")] impl std::error::Error for BetaFuncError {} /// Computes the natural logarithm diff --git a/src/function/gamma.rs b/src/function/gamma.rs index 7d90112c..cbb59b35 100644 --- a/src/function/gamma.rs +++ b/src/function/gamma.rs @@ -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 diff --git a/src/stats_tests/fisher.rs b/src/stats_tests/fisher.rs index 39747885..3f8ab8e8 100644 --- a/src/stats_tests/fisher.rs +++ b/src/stats_tests/fisher.rs @@ -117,6 +117,7 @@ impl core::fmt::Display for FishersExactTestError { } } +#[cfg(feature = "std")] impl std::error::Error for FishersExactTestError {} impl From for FishersExactTestError {