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

Add support for Rust v1.24.0 #12

Merged
merged 1 commit into from
Feb 1, 2019
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 @@ -528,6 +531,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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