Skip to content

Commit c861370

Browse files
authored
Merge pull request #222 from tcharding/05-18-edition-2018
Enable edition 2018
2 parents 657eebd + 18d14b6 commit c861370

File tree

12 files changed

+56
-86
lines changed

12 files changed

+56
-86
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
- rust: nightly
1616
env:
1717
RUSTFMTCHK: false
18-
- rust: 1.29.0
18+
- rust: 1.41.1
1919
env:
20-
PIN_VERSIONS: true
20+
RUSTFMTCHK: false
2121
steps:
2222
- name: Checkout Crate
2323
uses: actions/checkout@v2

README.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,4 @@ The following versions are officially supported and automatically tested:
4747
* 0.21.0
4848

4949
# Minimum Supported Rust Version (MSRV)
50-
This library should always compile with any combination of features on **Rust 1.29**.
51-
52-
Because some dependencies have broken the build in minor/patch releases, to
53-
compile with 1.29.0 you will need to run the following version-pinning command:
54-
```
55-
cargo update --package "cc" --precise "1.0.41"
56-
cargo update --package "log:0.4.x" --precise "0.4.13" # x being the highest patch version, currently 14
57-
cargo update --package "cfg-if" --precise "0.1.9"
58-
cargo update --package "serde_json" --precise "1.0.39"
59-
cargo update --package "serde" --precise "1.0.98"
60-
cargo update --package "serde_derive" --precise "1.0.98"
61-
cargo update --package "byteorder" --precise "1.3.4"
62-
```
50+
This library should always compile with any combination of features on **Rust 1.41.1**.

client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ repository = "https://github.com/rust-bitcoin/rust-bitcoincore-rpc/"
1212
description = "RPC client library for the Bitcoin Core JSON-RPC API."
1313
keywords = ["crypto", "bitcoin", "bitcoin-core", "rpc"]
1414
readme = "README.md"
15+
edition = "2018"
1516

1617
[lib]
1718
name = "bitcoincore_rpc"

client/src/client.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ use std::iter::FromIterator;
1414
use std::path::PathBuf;
1515
use std::{fmt, result};
1616

17-
use bitcoin;
17+
use crate::bitcoin;
1818
use jsonrpc;
1919
use serde;
2020
use serde_json;
2121

22-
use bitcoin::hashes::hex::{FromHex, ToHex};
23-
use bitcoin::secp256k1::ecdsa::Signature;
24-
use bitcoin::{
22+
use crate::bitcoin::hashes::hex::{FromHex, ToHex};
23+
use crate::bitcoin::secp256k1::ecdsa::Signature;
24+
use crate::bitcoin::{
2525
Address, Amount, Block, BlockHeader, OutPoint, PrivateKey, PublicKey, Script, Transaction,
2626
};
2727
use log::Level::{Debug, Trace, Warn};
2828

29-
use error::*;
30-
use json;
31-
use queryable;
29+
use crate::error::*;
30+
use crate::json;
31+
use crate::queryable;
3232

3333
/// Crate-specific Result type, shorthand for `std::result::Result` with our
3434
/// crate-specific Error type;
@@ -382,7 +382,7 @@ pub trait RpcApi: Sized {
382382
// - 0.18.x returns a "softforks" array and a "bip9_softforks" map.
383383
// - 0.19.x returns a "softforks" map.
384384
Ok(if self.version()? < 190000 {
385-
use Error::UnexpectedStructure as err;
385+
use crate::Error::UnexpectedStructure as err;
386386

387387
// First, remove both incompatible softfork fields.
388388
// We need to scope the mutable ref here for v1.29 borrowck.
@@ -1256,12 +1256,12 @@ fn log_response(cmd: &str, resp: &Result<jsonrpc::Response>) {
12561256
#[cfg(test)]
12571257
mod tests {
12581258
use super::*;
1259-
use bitcoin;
1259+
use crate::bitcoin;
12601260
use serde_json;
12611261

12621262
#[test]
12631263
fn test_raw_tx() {
1264-
use bitcoin::consensus::encode;
1264+
use crate::bitcoin::consensus::encode;
12651265
let client = Client::new("http://localhost/".into(), Auth::None).unwrap();
12661266
let tx: bitcoin::Transaction = encode::deserialize(&Vec::<u8>::from_hex("0200000001586bd02815cf5faabfec986a4e50d25dbee089bd2758621e61c5fab06c334af0000000006b483045022100e85425f6d7c589972ee061413bcf08dc8c8e589ce37b217535a42af924f0e4d602205c9ba9cb14ef15513c9d946fa1c4b797883e748e8c32171bdf6166583946e35c012103dae30a4d7870cd87b45dd53e6012f71318fdd059c1c2623b8cc73f8af287bb2dfeffffff021dc4260c010000001976a914f602e88b2b5901d8aab15ebe4a97cf92ec6e03b388ac00e1f505000000001976a914687ffeffe8cf4e4c038da46a9b1d37db385a472d88acfd211500").unwrap()).unwrap();
12671267

client/src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
use std::{error, fmt, io};
1212

13-
use bitcoin;
14-
use bitcoin::hashes::hex;
15-
use bitcoin::secp256k1;
13+
use crate::bitcoin;
14+
use crate::bitcoin::hashes::hex;
15+
use crate::bitcoin::secp256k1;
1616
use jsonrpc;
1717
use serde_json;
1818

client/src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@ extern crate log;
2121
#[allow(unused)]
2222
#[macro_use] // `macro_use` is needed for v1.24.0 compilation.
2323
extern crate serde;
24-
extern crate serde_json;
2524

2625
pub extern crate jsonrpc;
2726

2827
pub extern crate bitcoincore_rpc_json;
28+
pub use crate::json::bitcoin;
2929
pub use bitcoincore_rpc_json as json;
30-
pub use json::bitcoin;
3130

3231
mod client;
3332
mod error;
3433
mod queryable;
3534

36-
pub use client::*;
37-
pub use error::Error;
38-
pub use queryable::*;
35+
pub use crate::client::*;
36+
pub use crate::error::Error;
37+
pub use crate::queryable::*;

client/src/queryable.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
99
//
1010

11-
use bitcoin;
11+
use crate::bitcoin;
1212
use serde_json;
1313

14-
use client::Result;
15-
use client::RpcApi;
14+
use crate::client::Result;
15+
use crate::client::RpcApi;
1616

1717
/// A type that can be queried from Bitcoin Core.
1818
pub trait Queryable<C: RpcApi>: Sized {
@@ -44,7 +44,7 @@ impl<C: RpcApi> Queryable<C> for bitcoin::blockdata::transaction::Transaction {
4444
}
4545
}
4646

47-
impl<C: RpcApi> Queryable<C> for Option<::json::GetTxOutResult> {
47+
impl<C: RpcApi> Queryable<C> for Option<crate::json::GetTxOutResult> {
4848
type Id = bitcoin::OutPoint;
4949

5050
fn query(rpc: &C, id: &Self::Id) -> Result<Self> {

contrib/test.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@ echo "RUSTFMTCHECK: \"$RUSTFMTCHECK\""
66
echo "BITCOINVERSION: \"$BITCOINVERSION\""
77
echo "PATH: \"$PATH\""
88

9-
10-
# Pin dependencies for Rust v1.29
11-
if [ -n $"$PIN_VERSIONS" ]; then
12-
cargo generate-lockfile --verbose
13-
14-
cargo update --verbose --package "log" --precise "0.4.13"
15-
cargo update --verbose --package "cc" --precise "1.0.41"
16-
cargo update --verbose --package "cfg-if" --precise "0.1.9"
17-
cargo update --verbose --package "serde_json" --precise "1.0.39"
18-
cargo update --verbose --package "serde" --precise "1.0.98"
19-
cargo update --verbose --package "serde_derive" --precise "1.0.98"
20-
cargo update --verbose --package "byteorder" --precise "1.3.4"
21-
fi
22-
239
if [ -n "$RUSTFMTCHECK" ]; then
2410
rustup component add rustfmt
2511
cargo fmt --all -- --check

integration_test/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "integration_test"
33
version = "0.1.0"
44
authors = ["Steven Roose <steven@stevenroose.org>"]
5+
edition = "2018"
56

67
[dependencies]
78
bitcoincore-rpc = { path = "../client" }

integration_test/src/main.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,27 @@
1010
1111
#![deny(unused)]
1212

13-
extern crate bitcoin;
14-
extern crate bitcoincore_rpc;
1513
#[macro_use]
1614
extern crate lazy_static;
17-
extern crate log;
1815

1916
use std::collections::HashMap;
2017

2118
use bitcoincore_rpc::json;
2219
use bitcoincore_rpc::jsonrpc::error::Error as JsonRpcError;
2320
use bitcoincore_rpc::{Auth, Client, Error, RpcApi};
2421

22+
use crate::json::BlockStatsFields as BsFields;
2523
use bitcoin::consensus::encode::{deserialize, serialize};
2624
use bitcoin::hashes::hex::{FromHex, ToHex};
2725
use bitcoin::hashes::Hash;
2826
use bitcoin::secp256k1;
2927
use bitcoin::{
30-
Address, Amount, Network, OutPoint, PrivateKey, Script, EcdsaSighashType, SignedAmount, Transaction,
31-
TxIn, TxOut, Txid, Witness,
28+
Address, Amount, EcdsaSighashType, Network, OutPoint, PrivateKey, Script, SignedAmount,
29+
Transaction, TxIn, TxOut, Txid, Witness,
3230
};
3331
use bitcoincore_rpc::bitcoincore_rpc_json::{
3432
GetBlockTemplateModes, GetBlockTemplateRules, ScanTxOutRequest,
3533
};
36-
use json::BlockStatsFields as BsFields;
3734

3835
lazy_static! {
3936
static ref SECP: secp256k1::Secp256k1<secp256k1::All> = secp256k1::Secp256k1::new();
@@ -596,8 +593,9 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) {
596593
}],
597594
};
598595

599-
let res =
600-
cl.sign_raw_transaction_with_key(&tx, &[sk], None, Some(EcdsaSighashType::All.into())).unwrap();
596+
let res = cl
597+
.sign_raw_transaction_with_key(&tx, &[sk], None, Some(EcdsaSighashType::All.into()))
598+
.unwrap();
601599
assert!(res.complete);
602600
let _ = cl.send_raw_transaction(&res.transaction().unwrap()).unwrap();
603601
}
@@ -1081,11 +1079,7 @@ fn test_add_ban(cl: &Client) {
10811079
let res = cl.list_banned().unwrap();
10821080
assert_eq!(res.len(), 0);
10831081

1084-
assert_error_message!(
1085-
cl.add_ban("INVALID_STRING", 0, false),
1086-
-30,
1087-
"Error: Invalid IP/Subnet"
1088-
);
1082+
assert_error_message!(cl.add_ban("INVALID_STRING", 0, false), -30, "Error: Invalid IP/Subnet");
10891083
}
10901084

10911085
fn test_set_network_active(cl: &Client) {

0 commit comments

Comments
 (0)