Commit b33a5fd
fix: import rand distributions from ndarray_rand::rand_distr to fix E0277 trait-bound (#55)
## Why
Both `crates/esn/src/lib.rs` and `crates/lsm/src/lib.rs` import
`Normal`, `Uniform`, `Bernoulli` from the top-level `rand_distr` crate,
then pass those distribution instances to:
- `Array2::random_using(...)` from `ndarray_rand::RandomExt`, which
requires `ndarray_rand::rand_distr::Distribution`
- `rng.sample(...)` which works fine with either
`ndarray-rand` re-exports its own pinned version of `rand_distr` and the
`RandomExt::random_using` trait bound is over that re-exported
`Distribution`. When the top-level `rand_distr` version drifts
(Dependabot bump), it stops being the same type as
`ndarray_rand::rand_distr::Distribution` and the trait bound fails:
```
error[E0277]: the trait bound `rand_distr::Normal<{float}>: ndarray_rand::rand_distr::Distribution<_>` is not satisfied
```
…on every Dependabot PR that touched the `rand` family.
## Fix
Import distributions through `ndarray_rand::rand_distr` so the version
always matches the trait bound. No runtime / behaviour change.
## Tested
Static: rg confirms `Normal`/`Uniform`/`Bernoulli` are only used through
`rng.sample()` and `Array2::random_using()`, both of which accept the
ndarray_rand::rand_distr versions.
After this lands, the workspace's top-level `rand_distr` dep may be
unused — left in place to avoid scope creep; can drop in a follow-up if
cargo-udeps flags it.
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 8d20593 commit b33a5fd
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
0 commit comments