Skip to content

Commit aa4e6df

Browse files
committed
Enable edition 2018
Add `edition = "2018"` to each of the three subcrate manifest files. Fix `::serde` imports and remove some of the unnecessary instances of `extern crate Foo`.
1 parent 1a756f8 commit aa4e6df

File tree

6 files changed

+26
-27
lines changed

6 files changed

+26
-27
lines changed

client/Cargo.toml

+1
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/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ 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;
29-
pub use bitcoincore_rpc_json as json;
3028
pub use crate::json::bitcoin;
29+
pub use bitcoincore_rpc_json as json;
3130

3231
mod client;
3332
mod error;

integration_test/Cargo.toml

+1
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 <[email protected]>"]
5+
edition = "2018"
56

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

integration_test/src/main.rs

-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
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

json/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ repository = "https://github.com/rust-bitcoin/rust-bitcoincore-rpc/"
1212
description = "JSON-enabled type structs for bitcoincore-rpc crate."
1313
keywords = [ "crypto", "bitcoin", "bitcoin-core", "rpc" ]
1414
readme = "README.md"
15+
edition = "2018"
1516

1617
[lib]
1718
name = "bitcoincore_rpc_json"

json/src/lib.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ pub struct GetBlockResult {
184184
pub weight: usize,
185185
pub height: usize,
186186
pub version: i32,
187-
#[serde(default, with = "::serde_hex::opt")]
187+
#[serde(default, with = "crate::serde_hex::opt")]
188188
pub version_hex: Option<Vec<u8>>,
189189
pub merkleroot: bitcoin::TxMerkleNode,
190190
pub tx: Vec<bitcoin::Txid>,
@@ -193,7 +193,7 @@ pub struct GetBlockResult {
193193
pub nonce: u32,
194194
pub bits: String,
195195
pub difficulty: f64,
196-
#[serde(with = "::serde_hex")]
196+
#[serde(with = "crate::serde_hex")]
197197
pub chainwork: Vec<u8>,
198198
pub n_tx: usize,
199199
pub previousblockhash: Option<bitcoin::BlockHash>,
@@ -207,7 +207,7 @@ pub struct GetBlockHeaderResult {
207207
pub confirmations: i32,
208208
pub height: usize,
209209
pub version: i32,
210-
#[serde(default, with = "::serde_hex::opt")]
210+
#[serde(default, with = "crate::serde_hex::opt")]
211211
pub version_hex: Option<Vec<u8>>,
212212
#[serde(rename = "merkleroot")]
213213
pub merkle_root: bitcoin::TxMerkleNode,
@@ -217,7 +217,7 @@ pub struct GetBlockHeaderResult {
217217
pub nonce: u32,
218218
pub bits: String,
219219
pub difficulty: f64,
220-
#[serde(with = "::serde_hex")]
220+
#[serde(with = "crate::serde_hex")]
221221
pub chainwork: Vec<u8>,
222222
pub n_tx: usize,
223223
#[serde(rename = "previousblockhash")]
@@ -505,7 +505,7 @@ pub struct GetMiningInfoResult {
505505
#[serde(rename_all = "camelCase")]
506506
pub struct GetRawTransactionResultVinScriptSig {
507507
pub asm: String,
508-
#[serde(with = "::serde_hex")]
508+
#[serde(with = "crate::serde_hex")]
509509
pub hex: Vec<u8>,
510510
}
511511

@@ -520,7 +520,7 @@ impl GetRawTransactionResultVinScriptSig {
520520
pub struct GetRawTransactionResultVin {
521521
pub sequence: u32,
522522
/// The raw scriptSig in case of a coinbase tx.
523-
#[serde(default, with = "::serde_hex::opt")]
523+
#[serde(default, with = "crate::serde_hex::opt")]
524524
pub coinbase: Option<Vec<u8>>,
525525
/// Not provided for coinbase txs.
526526
pub txid: Option<bitcoin::Txid>,
@@ -546,7 +546,7 @@ impl GetRawTransactionResultVin {
546546
#[serde(rename_all = "camelCase")]
547547
pub struct GetRawTransactionResultVoutScriptPubKey {
548548
pub asm: String,
549-
#[serde(with = "::serde_hex")]
549+
#[serde(with = "crate::serde_hex")]
550550
pub hex: Vec<u8>,
551551
pub req_sigs: Option<usize>,
552552
#[serde(rename = "type")]
@@ -574,7 +574,7 @@ pub struct GetRawTransactionResultVout {
574574
pub struct GetRawTransactionResult {
575575
#[serde(rename = "in_active_chain")]
576576
pub in_active_chain: Option<bool>,
577-
#[serde(with = "::serde_hex")]
577+
#[serde(with = "crate::serde_hex")]
578578
pub hex: Vec<u8>,
579579
pub txid: bitcoin::Txid,
580580
pub hash: bitcoin::Wtxid,
@@ -593,7 +593,7 @@ pub struct GetRawTransactionResult {
593593
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
594594
pub struct GetBlockFilterResult {
595595
pub header: bitcoin::FilterHash,
596-
#[serde(with = "::serde_hex")]
596+
#[serde(with = "crate::serde_hex")]
597597
pub filter: Vec<u8>,
598598
}
599599

@@ -683,7 +683,7 @@ pub struct GetTransactionResult {
683683
#[serde(default, with = "bitcoin::util::amount::serde::as_btc::opt")]
684684
pub fee: Option<SignedAmount>,
685685
pub details: Vec<GetTransactionResultDetail>,
686-
#[serde(with = "::serde_hex")]
686+
#[serde(with = "crate::serde_hex")]
687687
pub hex: Vec<u8>,
688688
}
689689

@@ -794,7 +794,7 @@ pub struct SignRawTransactionResultError {
794794
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
795795
#[serde(rename_all = "camelCase")]
796796
pub struct SignRawTransactionResult {
797-
#[serde(with = "::serde_hex")]
797+
#[serde(with = "crate::serde_hex")]
798798
pub hex: Vec<u8>,
799799
pub complete: bool,
800800
pub errors: Option<Vec<SignRawTransactionResultError>>,
@@ -901,11 +901,11 @@ pub struct GetAddressInfoResultEmbedded {
901901
#[serde(rename = "is_witness")]
902902
pub is_witness: Option<bool>,
903903
pub witness_version: Option<u32>,
904-
#[serde(with = "::serde_hex")]
904+
#[serde(with = "crate::serde_hex")]
905905
pub witness_program: Vec<u8>,
906906
pub script: Option<ScriptPubkeyType>,
907907
/// The redeemscript for the p2sh address.
908-
#[serde(default, with = "::serde_hex::opt")]
908+
#[serde(default, with = "crate::serde_hex::opt")]
909909
pub hex: Option<Vec<u8>>,
910910
pub pubkeys: Option<Vec<PublicKey>>,
911911
#[serde(rename = "sigsrequired")]
@@ -953,11 +953,11 @@ pub struct GetAddressInfoResult {
953953
#[serde(rename = "iswitness")]
954954
pub is_witness: Option<bool>,
955955
pub witness_version: Option<u32>,
956-
#[serde(default, with = "::serde_hex::opt")]
956+
#[serde(default, with = "crate::serde_hex::opt")]
957957
pub witness_program: Option<Vec<u8>>,
958958
pub script: Option<ScriptPubkeyType>,
959959
/// The redeemscript for the p2sh address.
960-
#[serde(default, with = "::serde_hex::opt")]
960+
#[serde(default, with = "crate::serde_hex::opt")]
961961
pub hex: Option<Vec<u8>>,
962962
pub pubkeys: Option<Vec<PublicKey>>,
963963
#[serde(rename = "sigsrequired")]
@@ -1002,7 +1002,7 @@ pub struct GetBlockchainInfoResult {
10021002
#[serde(rename = "initialblockdownload")]
10031003
pub initial_block_download: bool,
10041004
/// Total amount of work in active chain, in hexadecimal
1005-
#[serde(rename = "chainwork", with = "::serde_hex")]
1005+
#[serde(rename = "chainwork", with = "crate::serde_hex")]
10061006
pub chain_work: Vec<u8>,
10071007
/// The estimated size of the block and undo files on disk
10081008
pub size_on_disk: u64,
@@ -1474,7 +1474,7 @@ pub enum GetBlockTemplateModes {
14741474
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
14751475
pub struct GetBlockTemplateResult {
14761476
/// The compressed difficulty in hexadecimal
1477-
#[serde(with = "::serde_hex")]
1477+
#[serde(with = "crate::serde_hex")]
14781478
pub bits: Vec<u8>,
14791479
/// The previous block hash the current template is mining on
14801480
#[serde(rename = "previousblockhash")]
@@ -1530,7 +1530,7 @@ pub struct GetBlockTemplateResult {
15301530
#[serde(rename = "coinbasevalue", with = "bitcoin::util::amount::serde::as_sat", default)]
15311531
pub coinbase_value: Amount,
15321532
/// The number which valid hashes must be less than, in big-endian
1533-
#[serde(with = "::serde_hex")]
1533+
#[serde(with = "crate::serde_hex")]
15341534
pub target: Vec<u8>,
15351535
/// The minimum timestamp appropriate for the next block time. Expressed as
15361536
/// UNIX timestamp.
@@ -1540,7 +1540,7 @@ pub struct GetBlockTemplateResult {
15401540
/// block
15411541
pub mutable: Vec<GetBlockTemplateResulMutations>,
15421542
/// A range of valid nonces
1543-
#[serde(with = "::serde_hex", rename = "noncerange")]
1543+
#[serde(with = "crate::serde_hex", rename = "noncerange")]
15441544
pub nonce_range: Vec<u8>,
15451545
}
15461546

@@ -1553,7 +1553,7 @@ pub struct GetBlockTemplateResultTransaction {
15531553
#[serde(rename = "hash")]
15541554
pub wtxid: bitcoin::Wtxid,
15551555
/// The serilaized transaction bytes
1556-
#[serde(with = "::serde_hex", rename = "data")]
1556+
#[serde(with = "crate::serde_hex", rename = "data")]
15571557
pub raw_tx: Vec<u8>,
15581558
// The transaction fee
15591559
#[serde(with = "bitcoin::util::amount::serde::as_sat")]
@@ -1677,7 +1677,7 @@ pub struct WalletCreateFundedPsbtOptions {
16771677
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
16781678
pub struct FinalizePsbtResult {
16791679
pub psbt: Option<String>,
1680-
#[serde(default, with = "::serde_hex::opt")]
1680+
#[serde(default, with = "crate::serde_hex::opt")]
16811681
pub hex: Option<Vec<u8>>,
16821682
pub complete: bool,
16831683
}
@@ -1804,7 +1804,7 @@ pub struct FundRawTransactionOptions {
18041804
#[derive(Deserialize, Clone, PartialEq, Eq, Debug)]
18051805
#[serde(rename_all = "camelCase")]
18061806
pub struct FundRawTransactionResult {
1807-
#[serde(with = "::serde_hex")]
1807+
#[serde(with = "crate::serde_hex")]
18081808
pub hex: Vec<u8>,
18091809
#[serde(with = "bitcoin::util::amount::serde::as_btc")]
18101810
pub fee: Amount,

0 commit comments

Comments
 (0)