Skip to content

Commit

Permalink
Merge pull request #12 from stevenroose/rust-1.24.0
Browse files Browse the repository at this point in the history
Add support for Rust v1.24.0
  • Loading branch information
dpc committed Feb 1, 2019
2 parents e1539d0 + 5872fa1 commit 0ce7c8d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -3,7 +3,7 @@ rust:
- stable
- beta
- nightly
- 1.21.0 # first cargo that supports [patch]
- 1.24.0

script:
- cargo build --verbose
Expand Down
6 changes: 5 additions & 1 deletion client/examples/test_against_node.rs
Expand Up @@ -15,7 +15,7 @@ extern crate bitcoincore_rpc;

use bitcoincore_rpc::{Client, Error};

fn main() -> Result<(), Error> {
fn main_result() -> Result<(), Error> {
let mut args = std::env::args();

let _exe_name = args.next().unwrap();
Expand Down Expand Up @@ -43,3 +43,7 @@ fn main() -> Result<(), Error> {

Ok(())
}

fn main() {
main_result().unwrap();
}
10 changes: 7 additions & 3 deletions client/src/client.rs
Expand Up @@ -10,7 +10,10 @@

use std::result;

use hex;
use bitcoin;
use jsonrpc;
use serde;
use serde_json;

use bitcoin::util::hash::Sha256dHash;
Expand Down Expand Up @@ -96,7 +99,7 @@ fn handle_defaults<'a, 'b>(
let required_num = args.len() - defaults.len();

if let Some(i) = first_non_null_optional_idx {
&args[..=i]
&args[..i+1]
} else {
&args[..required_num]
}
Expand Down Expand Up @@ -351,7 +354,7 @@ impl Client {
pub fn create_raw_transaction_hex(
&self,
utxos: &[json::CreateRawTransactionInput],
outs: Option<&std::collections::HashMap<String, f64>>,
outs: Option<&HashMap<String, f64>>,
locktime: Option<i64>,
replaceable: Option<bool>,
) -> Result<String> {
Expand All @@ -369,7 +372,7 @@ impl Client {
pub fn create_raw_transaction(
&self,
utxos: &[json::CreateRawTransactionInput],
outs: Option<&std::collections::HashMap<String, f64>>,
outs: Option<&HashMap<String, f64>>,
locktime: Option<i64>,
replaceable: Option<bool>,
) -> Result<Transaction> {
Expand Down Expand Up @@ -527,6 +530,7 @@ impl Client {
#[cfg(tests)]
mod tests {
use super::*;
use serde_json;

#[test]
fn test_handle_defaults() -> Result<()> {
Expand Down
3 changes: 3 additions & 0 deletions client/src/queryable.rs
Expand Up @@ -8,6 +8,9 @@
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
//

use bitcoin;
use serde_json;

use bitcoin::util::hash::Sha256dHash;
use client::Client;
use client::Result;
Expand Down
4 changes: 2 additions & 2 deletions json/src/lib.rs
Expand Up @@ -551,7 +551,7 @@ impl serde::Serialize for AddressType {
where
S: serde::Serializer,
{
serializer.serialize_str(match self {
serializer.serialize_str(match *self {
AddressType::Legacy => "legacy",
AddressType::P2shSegwit => "p2sh-segwit",
AddressType::Bech32 => "bech32",
Expand All @@ -571,7 +571,7 @@ impl<'a> serde::Serialize for PubKeyOrAddress<'a> {
where
S: serde::Serializer,
{
match self {
match *self {
PubKeyOrAddress::Address(a) => serde::Serialize::serialize(a, serializer),
PubKeyOrAddress::PubKey(k) => serde::Serialize::serialize(k, serializer),
}
Expand Down

0 comments on commit 0ce7c8d

Please sign in to comment.