Skip to content

Commit 0679c7a

Browse files
committed
miniscript/iter: make test module non-pub
We have a `pub mod tests` module which is commented as being public "in case dependent libraries want to use these functions". However, it's also gated by #[cfg(test)]. I am not aware of any way that dependent libraries could compile *this* one with cfg(test) on. So this module was, in effect, never public. Make it non-pub to make things clearer, and also to silence all the "missing docs" warnings that appear when running clippy with --all-targets. This is NOT an API-breaking change even though it removes a public module, because the module was never actually usable.
1 parent 57795f0 commit 0679c7a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/miniscript/iter.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,25 +222,23 @@ impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> Iterator for PkIter<'a, Pk, Ctx>
222222
}
223223
}
224224

225-
// Module is public since it export testcase generation which may be used in
226-
// dependent libraries for their own tasts based on Miniscript AST
227225
#[cfg(test)]
228-
pub mod test {
226+
mod test {
229227
use bitcoin;
230228
use bitcoin::hashes::{hash160, ripemd160, sha256, sha256d, Hash};
231229
use bitcoin::secp256k1;
232230

233231
use super::Miniscript;
234232
use crate::miniscript::context::Segwitv0;
235233

236-
pub type TestData = (
234+
type TestData = (
237235
Miniscript<bitcoin::PublicKey, Segwitv0>,
238236
Vec<bitcoin::PublicKey>,
239237
Vec<hash160::Hash>,
240238
bool, // Indicates that the top-level contains public key or hashes
241239
);
242240

243-
pub fn gen_secp_pubkeys(n: usize) -> Vec<secp256k1::PublicKey> {
241+
fn gen_secp_pubkeys(n: usize) -> Vec<secp256k1::PublicKey> {
244242
let mut ret = Vec::with_capacity(n);
245243
let secp = secp256k1::Secp256k1::new();
246244
let mut sk = [0; 32];
@@ -258,14 +256,14 @@ pub mod test {
258256
ret
259257
}
260258

261-
pub fn gen_bitcoin_pubkeys(n: usize, compressed: bool) -> Vec<bitcoin::PublicKey> {
259+
fn gen_bitcoin_pubkeys(n: usize, compressed: bool) -> Vec<bitcoin::PublicKey> {
262260
gen_secp_pubkeys(n)
263261
.into_iter()
264262
.map(|inner| bitcoin::PublicKey { inner, compressed })
265263
.collect()
266264
}
267265

268-
pub fn gen_testcases() -> Vec<TestData> {
266+
fn gen_testcases() -> Vec<TestData> {
269267
let k = gen_bitcoin_pubkeys(10, true);
270268
let _h: Vec<hash160::Hash> = k
271269
.iter()

0 commit comments

Comments
 (0)