From 84f4f609b94f0da848c5a507050f8cab2ef4f1bc Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Wed, 31 Jul 2024 18:50:13 -0500 Subject: [PATCH] chore: set rust edition to 2021 --- Cargo.toml | 1 + src/api.rs | 4 ++-- src/batch.rs | 2 +- src/client.rs | 10 +++++----- src/raw_client.rs | 10 +++++----- src/utils.rs | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 692f474..8b31904 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ description = "Bitcoin Electrum client library. Supports plaintext, TLS and Onio keywords = ["bitcoin", "electrum"] readme = "README.md" rust-version = "1.63.0" +edition = "2021" # loosely based on https://github.com/evgeniy-scherbina/rust-electrumx-client diff --git a/src/api.rs b/src/api.rs index e027a80..e7522de 100644 --- a/src/api.rs +++ b/src/api.rs @@ -6,8 +6,8 @@ use std::convert::TryInto; use bitcoin::consensus::encode::{deserialize, serialize}; use bitcoin::{block, Script, Transaction, Txid}; -use batch::Batch; -use types::*; +use crate::batch::Batch; +use crate::types::*; /// API calls exposed by an Electrum client pub trait ElectrumApi { diff --git a/src/batch.rs b/src/batch.rs index f0cd77c..3ca4da0 100644 --- a/src/batch.rs +++ b/src/batch.rs @@ -4,7 +4,7 @@ use bitcoin::{Script, Txid}; -use types::{Call, Param, ToElectrumScriptHash}; +use crate::types::{Call, Param, ToElectrumScriptHash}; /// Helper structure that caches all the requests before they are actually sent to the server. /// diff --git a/src/client.rs b/src/client.rs index 81cbd38..267c9ea 100644 --- a/src/client.rs +++ b/src/client.rs @@ -6,12 +6,12 @@ use log::{info, warn}; use bitcoin::{Script, Txid}; -use api::ElectrumApi; -use batch::Batch; -use config::Config; -use raw_client::*; +use crate::api::ElectrumApi; +use crate::batch::Batch; +use crate::config::Config; +use crate::raw_client::*; +use crate::types::*; use std::convert::TryFrom; -use types::*; /// Generalized Electrum client that supports multiple backends. This wraps /// [`RawClient`](client/struct.RawClient.html) and provides a more user-friendly diff --git a/src/raw_client.rs b/src/raw_client.rs index 1b83c73..3bc320e 100644 --- a/src/raw_client.rs +++ b/src/raw_client.rs @@ -39,11 +39,11 @@ use rustls::{ #[cfg(any(feature = "default", feature = "proxy"))] use crate::socks::{Socks5Stream, TargetAddr, ToTargetAddr}; -use stream::ClonableStream; +use crate::stream::ClonableStream; -use api::ElectrumApi; -use batch::Batch; -use types::*; +use crate::api::ElectrumApi; +use crate::batch::Batch; +use crate::types::*; macro_rules! impl_batch_call { ( $self:expr, $data:expr, $call:ident ) => {{ @@ -298,7 +298,7 @@ impl RawClient { not(feature = "use-openssl") ))] mod danger { - use raw_client::ServerName; + use crate::raw_client::ServerName; use rustls::client::danger::ServerCertVerified; use rustls::pki_types::CertificateDer; use rustls::pki_types::UnixTime; diff --git a/src/utils.rs b/src/utils.rs index fc30154..fc02dfb 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,10 +1,10 @@ //! Utilities helping to handle Electrum-related data. +use crate::types::GetMerkleRes; use bitcoin::hash_types::TxMerkleNode; use bitcoin::hashes::sha256d::Hash as Sha256d; use bitcoin::hashes::{Hash, HashEngine}; use bitcoin::Txid; -use types::GetMerkleRes; /// Verifies a Merkle inclusion proof as retrieved via [`transaction_get_merkle`] for a transaction with the /// given `txid` and `merkle_root` as included in the [`BlockHeader`].