Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter fixes #27

Merged
merged 6 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions descriptors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// Coding conventions
#![recursion_limit = "256"]
#![deny(dead_code, /* missing_docs, */ warnings)]
#![allow(clippy::init_numbered_fields)]

//! General workflow for working with ScriptPubkey* types:
//! ```text
Expand Down
4 changes: 2 additions & 2 deletions hd/src/indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ impl SegmentIndexes for AccountStep {
#[inline]
fn is_hardened(&self) -> bool {
match self {
AccountStep::Normal(_) => false,
AccountStep::Normal { .. } => false,
AccountStep::Hardened { .. } => true,
}
}
Expand Down Expand Up @@ -642,7 +642,7 @@ pub enum TerminalStep {
#[display(inner)]
Range(IndexRangeList<UnhardenedIndex>),

/// Wildcrard implying full range of unhardened indexes
/// Wildcard implying full range of unhardened indexes
#[display("*")]
Wildcard,
}
Expand Down
1 change: 1 addition & 0 deletions hd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// Coding conventions
#![recursion_limit = "256"]
#![deny(dead_code, missing_docs, warnings)]
#![allow(clippy::init_numbered_fields)]

#[macro_use]
extern crate amplify;
Expand Down
6 changes: 5 additions & 1 deletion libbitcoin/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ impl string_result_t {
pub fn success(data: impl ToString) -> string_result_t {
let (code, details) = match CString::new(data.to_string()) {
Ok(s) => (error_t::success, result_details_t { data: s.into_raw() }),
Err(err) => (error_t::invalid_result_data, (&err).into()),
Err(err) => (error_t::invalid_result_data, result_details_t {
data: CString::new(err.to_string())
.expect("Null byte in string_result_t success code doc comments")
.into_raw(),
}),
};
string_result_t { code, details }
}
Expand Down
2 changes: 1 addition & 1 deletion psbt/src/sign/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ where
}
(CompositeDescrType::Wsh, Some(witness_script))
| (CompositeDescrType::ShWsh, Some(witness_script)) => {
sig_hasher.segwit_signature_hash(index, &witness_script, spent_value, sighash_type)?
sig_hasher.segwit_signature_hash(index, witness_script, spent_value, sighash_type)?
}
(CompositeDescrType::Wsh, None) | (CompositeDescrType::ShWsh, None) => {
return Err(SignInputError::NoWitnessScript)
Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.59"
14 changes: 4 additions & 10 deletions scripts/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ pub(crate) mod test {
sk[2] = (i >> 16) as u8;

ret.push(secp256k1::PublicKey::from_secret_key(
&secp256k1::SECP256K1,
secp256k1::SECP256K1,
&secp256k1::SecretKey::from_slice(&sk[..]).unwrap(),
));
}
Expand All @@ -198,7 +198,7 @@ pub(crate) mod test {
}

pub(crate) fn no_keys_or_hashes_suite(proc: fn(LockScript) -> ()) {
let sha_hash = sha256::Hash::hash(&"(nearly)random string".as_bytes());
let sha_hash = sha256::Hash::hash("(nearly)random string".as_bytes());
let dummy_hashes: Vec<hash160::Hash> = (1..13)
.map(|i| hash160::Hash::from_inner([i; 20]))
.collect();
Expand Down Expand Up @@ -364,10 +364,7 @@ pub(crate) mod test {
#[test]
fn test_script_parse_complex_keys() {
complex_keys_suite(|lockscript, keys| {
assert_eq!(
lockscript.extract_pubkeys::<Segwitv0>().unwrap(),
keys.clone()
);
assert_eq!(lockscript.extract_pubkeys::<Segwitv0>().unwrap(), keys);
assert_eq!(
lockscript.extract_pubkey_hash_set::<Segwitv0>().unwrap(),
(BTreeSet::from_iter(keys), BTreeSet::new())
Expand All @@ -387,10 +384,7 @@ pub(crate) mod test {
#[test]
fn test_script_parse_complex_script() {
complex_suite(|lockscript, keys| {
assert_eq!(
lockscript.extract_pubkeys::<Segwitv0>().unwrap(),
keys.clone()
);
assert_eq!(lockscript.extract_pubkeys::<Segwitv0>().unwrap(), keys);
assert_eq!(
lockscript.extract_pubkeyset::<Segwitv0>().unwrap(),
BTreeSet::from_iter(keys)
Expand Down
7 changes: 4 additions & 3 deletions slip132/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,14 @@ impl KeyApplication {
}
let bip48_purpose = ChildNumber::Hardened { index: 48 };
if path.len() >= 4 && path[0] == bip48_purpose {
return match path[3] {
match path[3] {
ChildNumber::Hardened { index: 1 } => Some(KeyApplication::NestedMultisig),
ChildNumber::Hardened { index: 2 } => Some(KeyApplication::SegWitMiltisig),
_ => None,
};
}
} else {
None
}
return None;
}

pub fn to_derivation_path(&self) -> Option<DerivationPath> {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Coding conventions
#![recursion_limit = "256"]
#![deny(dead_code, /* missing_docs, */ warnings)]
#![allow(clippy::init_numbered_fields)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this will go away after resolving LNP-BP/client_side_validation#54

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pls check that we still need this with the latest 0.59 stable release?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this allow statement presents this warning/error on 1.59:

Screenshot from 2022-03-07 05-09-12


#[macro_use]
extern crate amplify;
Expand Down