Commit 5d54ee3
committed
57bbde8 remove PartialEq bound from top-level Error type (Andrew Poelstra)
3649850 tests: remove all uses of Eq on error types (Andrew Poelstra)
4f52fb7 introduce `StaticDebugAndDisplay` blanket trait, use it for all errors (Andrew Poelstra)
Pull request description:
This is a short PR in terms of LOC, but may be controversial. I think it is necessary though.
Currently we have `PartialEq` on our giant `Error` enum (though amusingly not `Eq`) so that we can use `assert_eq` in unit tests. We can get away with this because our error enum does not contain any `std::io::Error`s anywhere, which can't be compared, nor does it contain any boxed errors.
In the next couple of PRs I am going to clean up the `expression` module to make the parser non-recursive and the error types strongly typed and detailed. To do this, I want to store `<Pk as FromStr>::Err`s, which to avoid a `Pk` parameter on `Error`, will need to be boxed. When we box the type we need to declare upfront what traits the error types have, and these traits will become requirements of the `MiniscriptKey` type.
It's not really reasonable to require `PartialEq` or `Eq` since these are not common traits for errors. Really the only things we *can* reasonaby require are `Debug`, `Display` and `'static`. (I would like to also require `std::error::Error` but as far as I can tell there is no way to do this while retaining both nostd compatibility and additive features. See this [users.rust-lang.org thread about this](https://users.rust-lang.org/t/how-to-box-an-error-type-retaining-std-error-only-when-std-is-enabled/)).
ACKs for top commit:
sanket1729:
ACK 57bbde8.
Tree-SHA512: 58400af38e50da8ebee39ad8cb14be3532d801311d8afd2b3854446f89d22019d2e1711d58b971244aefd0f7685b50ca3f6c2da1bcbec95c49962306cbbcf014
3 files changed
+27
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| |||
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
39 | | - | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
49 | | - | |
| 54 | + | |
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| |||
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
59 | | - | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| |||
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
69 | | - | |
| 74 | + | |
70 | 75 | | |
71 | | - | |
| 76 | + | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
| |||
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
412 | | - | |
| 412 | + | |
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1472 | 1472 | | |
1473 | 1473 | | |
1474 | 1474 | | |
1475 | | - | |
| 1475 | + | |
1476 | 1476 | | |
1477 | 1477 | | |
1478 | 1478 | | |
1479 | 1479 | | |
1480 | 1480 | | |
1481 | | - | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
1482 | 1485 | | |
1483 | 1486 | | |
1484 | 1487 | | |
| |||
1492 | 1495 | | |
1493 | 1496 | | |
1494 | 1497 | | |
1495 | | - | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
1496 | 1502 | | |
1497 | 1503 | | |
1498 | 1504 | | |
| |||
1512 | 1518 | | |
1513 | 1519 | | |
1514 | 1520 | | |
1515 | | - | |
| 1521 | + | |
1516 | 1522 | | |
1517 | 1523 | | |
1518 | | - | |
| 1524 | + | |
1519 | 1525 | | |
1520 | 1526 | | |
1521 | 1527 | | |
| |||
0 commit comments