Skip to content

Commit ad51d83

Browse files
committed
Derive Default
We can derive these implementations. Found by clippy.
1 parent ea57d6e commit ad51d83

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

src/interpreter/stack.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'txin> Element<'txin> {
8383

8484
/// Stack Data structure representing the stack input to Miniscript. This Stack
8585
/// is created from the combination of ScriptSig and Witness stack.
86-
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
86+
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Default, Hash)]
8787
pub struct Stack<'txin>(Vec<Element<'txin>>);
8888

8989
impl<'txin> From<Vec<Element<'txin>>> for Stack<'txin> {
@@ -92,12 +92,6 @@ impl<'txin> From<Vec<Element<'txin>>> for Stack<'txin> {
9292
}
9393
}
9494

95-
impl<'txin> Default for Stack<'txin> {
96-
fn default() -> Self {
97-
Stack(vec![])
98-
}
99-
}
100-
10195
impl<'txin> Stack<'txin> {
10296
/// Whether the stack is empty
10397
pub fn is_empty(&self) -> bool {

src/miniscript/types/extra_props.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::cmp;
1313
use std::iter::once;
1414

1515
/// Helper struct Whether any satisfaction of this fragment contains any timelocks
16-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
16+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Default, Hash)]
1717
pub struct TimeLockInfo {
1818
/// csv with heights
1919
pub csv_with_height: bool,
@@ -27,18 +27,6 @@ pub struct TimeLockInfo {
2727
pub contains_combination: bool,
2828
}
2929

30-
impl Default for TimeLockInfo {
31-
fn default() -> Self {
32-
Self {
33-
csv_with_height: false,
34-
csv_with_time: false,
35-
cltv_with_height: false,
36-
cltv_with_time: false,
37-
contains_combination: false,
38-
}
39-
}
40-
}
41-
4230
/// Helper struct to store information about op code limits. Note that this only
4331
/// counts the non-push opcodes. This is not relevant for TapScript context
4432
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]

0 commit comments

Comments
 (0)