Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
notmandatory committed Aug 12, 2021
1 parent 086496f commit c6ca004
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ use std::env;
fn main() {
let electrum = env::var_os("CARGO_FEATURE_ELECTRUM").map(|_| "electrum".to_string());
let esplora = env::var_os("CARGO_FEATURE_ESPLORA").map(|_| "esplora".to_string());
let compact_filters = env::var_os("CARGO_FEATURE_COMPACT_FILTERS").map(|_| "compact_filters".to_string());
let compact_filters =
env::var_os("CARGO_FEATURE_COMPACT_FILTERS").map(|_| "compact_filters".to_string());

let blockchain_features : Vec<String> = vec!(electrum, esplora, compact_filters)
let blockchain_features: Vec<String> = vec![electrum, esplora, compact_filters]
.iter()
.map(|f| f.to_owned())
.flatten()
.collect();

if blockchain_features.len() > 1 {
panic!("At most one blockchain client feature can be enabled but these features were enabled: {:?}", blockchain_features)
}
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
pub extern crate bdk;
#[macro_use]
extern crate serde_json;

#[cfg(any(feature = "electrum", feature = "esplora", feature = "compact_filters"))]
#[macro_use]
extern crate bdk_macros;

Expand Down Expand Up @@ -673,11 +675,11 @@ fn parse_recipient(s: &str) -> Result<(Script, u64), String> {
return Err("Invalid format".to_string());
}

let addr = Address::from_str(&parts[0]);
let addr = Address::from_str(parts[0]);
if let Err(e) = addr {
return Err(format!("{:?}", e));
}
let val = u64::from_str(&parts[1]);
let val = u64::from_str(parts[1]);
if let Err(e) = val {
return Err(format!("{:?}", e));
}
Expand Down

0 comments on commit c6ca004

Please sign in to comment.