Skip to content

Commit

Permalink
Add and use default() as shorthand for Default::default()
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Mar 25, 2024
1 parent 5bdbe41 commit c99293d
Show file tree
Hide file tree
Showing 25 changed files with 891 additions and 883 deletions.
318 changes: 159 additions & 159 deletions src/index.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/index/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl Context {
self.rpc_server.broadcast_tx(TransactionTemplate {
inputs: &[(block_count, 0, 0, Witness::new())],
p2tr: true,
..Default::default()
..default()
});

self.mine_blocks(RUNE_COMMIT_INTERVAL.into());
Expand Down Expand Up @@ -191,7 +191,7 @@ impl Context {
inputs: &[(block_count + 1, 1, 0, witness)],
op_return: Some(runestone.encipher()),
outputs,
..Default::default()
..default()
});

self.mine_blocks(1);
Expand Down
92 changes: 46 additions & 46 deletions src/inscriptions/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ mod tests {
Vec::new()
])]),
vec![ParsedEnvelope {
..Default::default()
..default()
}]
);
}
Expand Down Expand Up @@ -373,9 +373,9 @@ mod tests {
vec![ParsedEnvelope {
payload: Inscription {
duplicate_field: true,
..Default::default()
..default()
},
..Default::default()
..default()
}]
);
}
Expand All @@ -392,7 +392,7 @@ mod tests {
])]),
vec![ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", "ord"),
..Default::default()
..default()
}]
);
}
Expand All @@ -414,7 +414,7 @@ mod tests {
content_encoding: Some("br".as_bytes().to_vec()),
..inscription("text/plain;charset=utf-8", "ord")
},
..Default::default()
..default()
}]
);
}
Expand All @@ -433,7 +433,7 @@ mod tests {
])]),
vec![ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", "ord"),
..Default::default()
..default()
}]
);
}
Expand All @@ -449,9 +449,9 @@ mod tests {
vec![ParsedEnvelope {
payload: Inscription {
content_type: Some(b"text/plain;charset=utf-8".to_vec()),
..Default::default()
..default()
},
..Default::default()
..default()
}],
);
}
Expand All @@ -463,9 +463,9 @@ mod tests {
vec![ParsedEnvelope {
payload: Inscription {
body: Some(b"foo".to_vec()),
..Default::default()
..default()
},
..Default::default()
..default()
}],
);
}
Expand All @@ -483,7 +483,7 @@ mod tests {
])]),
vec![ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", "foobar"),
..Default::default()
..default()
}],
);
}
Expand All @@ -499,7 +499,7 @@ mod tests {
])]),
vec![ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", ""),
..Default::default()
..default()
}]
);
}
Expand All @@ -520,7 +520,7 @@ mod tests {
])]),
vec![ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", ""),
..Default::default()
..default()
}],
);
}
Expand All @@ -543,7 +543,7 @@ mod tests {
parse(&[Witness::from_slice(&[script.into_bytes(), Vec::new()])]),
vec![ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", "ord"),
..Default::default()
..default()
}],
);
}
Expand All @@ -566,7 +566,7 @@ mod tests {
parse(&[Witness::from_slice(&[script.into_bytes(), Vec::new()])]),
vec![ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", "ord"),
..Default::default()
..default()
}],
);
}
Expand Down Expand Up @@ -597,12 +597,12 @@ mod tests {
vec![
ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", "foo"),
..Default::default()
..default()
},
ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", "bar"),
offset: 1,
..Default::default()
..default()
},
],
);
Expand All @@ -620,7 +620,7 @@ mod tests {
])]),
vec![ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", [0b10000000]),
..Default::default()
..default()
},],
);
}
Expand Down Expand Up @@ -675,7 +675,7 @@ mod tests {
])]),
vec![ParsedEnvelope {
payload: inscription("text/plain;charset=utf-8", "ord"),
..Default::default()
..default()
}],
);
}
Expand All @@ -687,7 +687,7 @@ mod tests {
vec![ParsedEnvelope {
payload: inscription("foo", [1; 1040]),
input: 1,
..Default::default()
..default()
}]
);
}
Expand All @@ -706,12 +706,12 @@ mod tests {
vec![
ParsedEnvelope {
payload: inscription("foo", [1; 100]),
..Default::default()
..default()
},
ParsedEnvelope {
payload: inscription("bar", [1; 100]),
offset: 1,
..Default::default()
..default()
}
]
);
Expand All @@ -729,7 +729,7 @@ mod tests {
])]),
vec![ParsedEnvelope {
payload: inscription("image/png", [1; 100]),
..Default::default()
..default()
}]
);
}
Expand All @@ -746,7 +746,7 @@ mod tests {
parse(&[witness]),
vec![ParsedEnvelope {
payload: inscription("foo", [1; 1040]),
..Default::default()
..default()
}]
);
}
Expand All @@ -763,7 +763,7 @@ mod tests {
parse(&[witness]),
vec![ParsedEnvelope {
payload: Inscription::default(),
..Default::default()
..default()
}],
);
}
Expand All @@ -774,7 +774,7 @@ mod tests {
parse(&[envelope(&[&PROTOCOL_ID, &Tag::Nop.bytes(), &[0]])]),
vec![ParsedEnvelope {
payload: Inscription::default(),
..Default::default()
..default()
}],
);
}
Expand All @@ -786,9 +786,9 @@ mod tests {
vec![ParsedEnvelope {
payload: Inscription {
unrecognized_even_field: true,
..Default::default()
..default()
},
..Default::default()
..default()
}],
);
}
Expand All @@ -800,9 +800,9 @@ mod tests {
vec![ParsedEnvelope {
payload: Inscription {
pointer: Some(vec![1]),
..Default::default()
..default()
},
..Default::default()
..default()
}],
);
}
Expand All @@ -816,9 +816,9 @@ mod tests {
pointer: Some(vec![1]),
duplicate_field: true,
unrecognized_even_field: true,
..Default::default()
..default()
},
..Default::default()
..default()
}],
);
}
Expand All @@ -830,9 +830,9 @@ mod tests {
vec![ParsedEnvelope {
payload: Inscription {
unrecognized_even_field: true,
..Default::default()
..default()
},
..Default::default()
..default()
}],
);
}
Expand All @@ -844,9 +844,9 @@ mod tests {
vec![ParsedEnvelope {
payload: Inscription {
incomplete_field: true,
..Default::default()
..default()
},
..Default::default()
..default()
}],
);
}
Expand All @@ -858,9 +858,9 @@ mod tests {
vec![ParsedEnvelope {
payload: Inscription {
metadata: Some(Vec::new()),
..Default::default()
..default()
},
..Default::default()
..default()
}]
);
}
Expand All @@ -879,9 +879,9 @@ mod tests {
payload: Inscription {
metadata: Some(vec![0, 1]),
duplicate_field: true,
..Default::default()
..default()
},
..Default::default()
..default()
}]
);
}
Expand Down Expand Up @@ -923,10 +923,10 @@ mod tests {
vec![ParsedEnvelope {
payload: Inscription {
body: Some(vec![value]),
..Default::default()
..default()
},
pushnum: true,
..Default::default()
..default()
}],
);
}
Expand All @@ -947,7 +947,7 @@ mod tests {
vec![ParsedEnvelope {
payload: Default::default(),
stutter: true,
..Default::default()
..default()
}],
);

Expand All @@ -965,7 +965,7 @@ mod tests {
vec![ParsedEnvelope {
payload: Default::default(),
stutter: true,
..Default::default()
..default()
}],
);

Expand All @@ -985,7 +985,7 @@ mod tests {
vec![ParsedEnvelope {
payload: Default::default(),
stutter: true,
..Default::default()
..default()
}],
);

Expand All @@ -1004,7 +1004,7 @@ mod tests {
vec![ParsedEnvelope {
payload: Default::default(),
stutter: false,
..Default::default()
..default()
}],
);
}
Expand Down
Loading

0 comments on commit c99293d

Please sign in to comment.