Skip to content

Commit 239efd5

Browse files
committed
Fill in default definitions
1 parent dcc9d0f commit 239efd5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/miniscript/types/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,21 +339,23 @@ pub trait Property: Sized {
339339
fn cast_zeronotequal(self) -> Result<Self, ErrorKind>;
340340

341341
/// Cast by changing `[X]` to `AndV([X], True)`
342-
fn cast_true(self) -> Result<Self, ErrorKind>;
342+
fn cast_true(self) -> Result<Self, ErrorKind> {
343+
Self::and_v(self, Self::from_true())
344+
}
343345

344346
/// Cast by changing `[X]` to `or_i([X], 0)` or `or_i(0, [X])`
345347
fn cast_or_i_false(self) -> Result<Self, ErrorKind>;
346348

347349
/// Cast by changing `[X]` to `or_i([X], 0)`. Default implementation
348350
/// simply passes through to `cast_or_i_false`
349351
fn cast_unlikely(self) -> Result<Self, ErrorKind> {
350-
self.cast_or_i_false()
352+
Self::or_i(self, Self::from_false())
351353
}
352354

353355
/// Cast by changing `[X]` to `or_i(0, [X])`. Default implementation
354356
/// simply passes through to `cast_or_i_false`
355357
fn cast_likely(self) -> Result<Self, ErrorKind> {
356-
self.cast_or_i_false()
358+
Self::or_i(Self::from_false(), self)
357359
}
358360

359361
/// Computes the type of an `AndB` fragment

0 commit comments

Comments
 (0)