Skip to content

Commit 3d7d979

Browse files
committed
Merge rust-bitcoin/rust-bitcoin#1001: Remove leading colons
73bc2bb Remove leading colons from ::core::cmp::Ordering (Tobin C. Harding) bffe0e8 Remove _most_ leading double colons (Tobin C. Harding) Pull request description: Leading double colons are a relic of edition 2015. Attempt to remove _all_ leading double colons (assuming I didn't miss any). - Patch 1 is done mechanically so it can be repeated by reviewers, just search-and-replace ' ::' with '::' (note the leading space). - Patch 2 does a single other instance of leading `::` ACKs for top commit: apoelstra: ACK 73bc2bb sanket1729: utACK 73bc2bb. Tree-SHA512: 8f7aafdda1aed5b69dcc83f544e65085dfec6590765839f0a6f259b99872805d1f00602fd9deac05c80a5cac3bc222d454dde0117dff4484e5cd34ea930fdfa1
2 parents 9cf3a70 + 41cf859 commit 3d7d979

File tree

13 files changed

+108
-108
lines changed

13 files changed

+108
-108
lines changed

src/blockdata/script.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl hex::FromHex for Script {
112112
}
113113
}
114114

115-
impl ::core::str::FromStr for Script {
115+
impl core::str::FromStr for Script {
116116
type Err = hex::Error;
117117
fn from_str(s: &str) -> Result<Self, hex::Error> {
118118
hex::FromHex::from_hex(s)
@@ -303,7 +303,7 @@ pub fn read_uint(data: &[u8], size: usize) -> Result<usize, Error> {
303303

304304
// We internally use implementation based on iterator so that it automatically advances as needed
305305
// Errors are same as above, just different type.
306-
fn read_uint_iter(data: &mut ::core::slice::Iter<'_, u8>, size: usize) -> Result<usize, UintError> {
306+
fn read_uint_iter(data: &mut core::slice::Iter<'_, u8>, size: usize) -> Result<usize, UintError> {
307307
if data.len() < size {
308308
Err(UintError::EarlyEndOfScript)
309309
} else if size > usize::from(u16::max_value() / 8) {
@@ -626,7 +626,7 @@ impl Script {
626626
#[cfg(feature="bitcoinconsensus")]
627627
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoinconsensus")))]
628628
pub fn verify (&self, index: usize, amount: crate::Amount, spending: &[u8]) -> Result<(), Error> {
629-
self.verify_with_flags(index, amount, spending, ::bitcoinconsensus::VERIFY_ALL)
629+
self.verify_with_flags(index, amount, spending, bitcoinconsensus::VERIFY_ALL)
630630
}
631631

632632
/// Verifies spend of an input script.
@@ -756,7 +756,7 @@ pub enum Instruction<'a> {
756756

757757
/// Iterator over a script returning parsed opcodes.
758758
pub struct Instructions<'a> {
759-
data: ::core::slice::Iter<'a, u8>,
759+
data: core::slice::Iter<'a, u8>,
760760
enforce_minimal: bool,
761761
}
762762

@@ -852,7 +852,7 @@ impl<'a> Iterator for Instructions<'a> {
852852
}
853853
}
854854

855-
impl<'a> ::core::iter::FusedIterator for Instructions<'a> {}
855+
impl<'a> core::iter::FusedIterator for Instructions<'a> {}
856856

857857
impl Builder {
858858
/// Creates a new empty script.
@@ -1490,14 +1490,14 @@ mod test {
14901490
let script = Script::from(vec![0u8, 1u8, 2u8]);
14911491

14921492
// Serialize
1493-
let json = ::serde_json::to_string(&script).unwrap();
1493+
let json = serde_json::to_string(&script).unwrap();
14941494
assert_eq!(json, "\"000102\"");
1495-
let bincode = ::bincode::serialize(&script).unwrap();
1495+
let bincode = bincode::serialize(&script).unwrap();
14961496
assert_eq!(bincode, [3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2]); // bincode adds u64 for length, serde_cbor use varint
14971497

14981498
// Deserialize
1499-
assert_eq!(script, ::serde_json::from_str(&json).unwrap());
1500-
assert_eq!(script, ::bincode::deserialize(&bincode).unwrap());
1499+
assert_eq!(script, serde_json::from_str(&json).unwrap());
1500+
assert_eq!(script, bincode::deserialize(&bincode).unwrap());
15011501
}
15021502

15031503
#[test]

src/blockdata/transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn parse_vout(s: &str) -> Result<u32, ParseOutPointError> {
152152
s.parse().map_err(ParseOutPointError::Vout)
153153
}
154154

155-
impl ::core::str::FromStr for OutPoint {
155+
impl core::str::FromStr for OutPoint {
156156
type Err = ParseOutPointError;
157157

158158
fn from_str(s: &str) -> Result<Self, Self::Err> {
@@ -880,7 +880,7 @@ impl Transaction {
880880
where
881881
S: FnMut(&OutPoint) -> Option<TxOut>
882882
{
883-
self.verify_with_flags(spent, ::bitcoinconsensus::VERIFY_ALL)
883+
self.verify_with_flags(spent, bitcoinconsensus::VERIFY_ALL)
884884
}
885885

886886
/// Verify that this transaction is able to spend its inputs.

src/internal_macros.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ macro_rules! impl_array_newtype {
110110
macro_rules! display_from_debug {
111111
($thing:ident) => {
112112
impl core::fmt::Display for $thing {
113-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> Result<(), ::core::fmt::Error> {
114-
::core::fmt::Debug::fmt(self, f)
113+
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
114+
core::fmt::Debug::fmt(self, f)
115115
}
116116
}
117117
}
118118
}
119119

120120
#[cfg(test)]
121-
macro_rules! hex_script (($s:expr) => (<$crate::Script as ::core::str::FromStr>::from_str($s).unwrap()));
121+
macro_rules! hex_script (($s:expr) => (<$crate::Script as core::str::FromStr>::from_str($s).unwrap()));
122122

123123
#[cfg(test)]
124124
macro_rules! hex_hash (($h:ident, $s:expr) => ($h::from_slice(&<$crate::prelude::Vec<u8> as $crate::hashes::hex::FromHex>::from_hex($s).unwrap()).unwrap()));
@@ -135,8 +135,8 @@ macro_rules! serde_string_impl {
135135
where
136136
D: $crate::serde::de::Deserializer<'de>,
137137
{
138-
use ::core::fmt::{self, Formatter};
139-
use ::core::str::FromStr;
138+
use core::fmt::{self, Formatter};
139+
use core::str::FromStr;
140140

141141
struct Visitor;
142142
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
@@ -183,8 +183,8 @@ macro_rules! serde_struct_human_string_impl {
183183
D: $crate::serde::de::Deserializer<'de>,
184184
{
185185
if deserializer.is_human_readable() {
186-
use ::core::fmt::{self, Formatter};
187-
use ::core::str::FromStr;
186+
use core::fmt::{self, Formatter};
187+
use core::str::FromStr;
188188

189189
struct Visitor;
190190
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
@@ -205,7 +205,7 @@ macro_rules! serde_struct_human_string_impl {
205205

206206
deserializer.deserialize_str(Visitor)
207207
} else {
208-
use ::core::fmt::{self, Formatter};
208+
use core::fmt::{self, Formatter};
209209
use $crate::serde::de::IgnoredAny;
210210

211211
#[allow(non_camel_case_types)]
@@ -354,33 +354,33 @@ macro_rules! serde_struct_human_string_impl {
354354
macro_rules! impl_bytes_newtype {
355355
($t:ident, $len:literal) => (
356356

357-
impl ::core::fmt::LowerHex for $t {
358-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
357+
impl core::fmt::LowerHex for $t {
358+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
359359
for &ch in self.0.iter() {
360360
write!(f, "{:02x}", ch)?;
361361
}
362362
Ok(())
363363
}
364364
}
365365

366-
impl ::core::fmt::Display for $t {
367-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
368-
::core::fmt::LowerHex::fmt(self, f)
366+
impl core::fmt::Display for $t {
367+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
368+
core::fmt::LowerHex::fmt(self, f)
369369
}
370370
}
371371

372-
impl ::core::fmt::Debug for $t {
373-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
374-
::core::fmt::LowerHex::fmt(self, f)
372+
impl core::fmt::Debug for $t {
373+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
374+
core::fmt::LowerHex::fmt(self, f)
375375
}
376376
}
377377

378378
impl $crate::hashes::hex::FromHex for $t {
379379
fn from_byte_iter<I>(iter: I) -> Result<Self, $crate::hashes::hex::Error>
380380
where
381-
I: ::core::iter::Iterator<Item=Result<u8, $crate::hashes::hex::Error>>
382-
+ ::core::iter::ExactSizeIterator
383-
+ ::core::iter::DoubleEndedIterator,
381+
I: core::iter::Iterator<Item=Result<u8, $crate::hashes::hex::Error>>
382+
+ core::iter::ExactSizeIterator
383+
+ core::iter::DoubleEndedIterator,
384384
{
385385
if iter.len() == $len {
386386
let mut ret = [0; $len];
@@ -394,7 +394,7 @@ macro_rules! impl_bytes_newtype {
394394
}
395395
}
396396

397-
impl ::core::str::FromStr for $t {
397+
impl core::str::FromStr for $t {
398398
type Err = $crate::hashes::hex::Error;
399399
fn from_str(s: &str) -> Result<Self, Self::Err> {
400400
$crate::hashes::hex::FromHex::from_hex(s)
@@ -423,15 +423,15 @@ macro_rules! impl_bytes_newtype {
423423
impl<'de> $crate::serde::de::Visitor<'de> for HexVisitor {
424424
type Value = $t;
425425

426-
fn expecting(&self, formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
426+
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
427427
formatter.write_str("an ASCII hex string")
428428
}
429429

430430
fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
431431
where
432432
E: $crate::serde::de::Error,
433433
{
434-
if let Ok(hex) = ::core::str::from_utf8(v) {
434+
if let Ok(hex) = core::str::from_utf8(v) {
435435
$crate::hashes::hex::FromHex::from_hex(hex).map_err(E::custom)
436436
} else {
437437
return Err(E::invalid_value($crate::serde::de::Unexpected::Bytes(v), &self));
@@ -453,7 +453,7 @@ macro_rules! impl_bytes_newtype {
453453
impl<'de> $crate::serde::de::Visitor<'de> for BytesVisitor {
454454
type Value = $t;
455455

456-
fn expecting(&self, formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
456+
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
457457
formatter.write_str("a bytestring")
458458
}
459459

@@ -491,15 +491,15 @@ macro_rules! user_enum {
491491
$(#[$doc] $elem),*
492492
}
493493

494-
impl ::core::fmt::Display for $name {
495-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
494+
impl core::fmt::Display for $name {
495+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
496496
f.pad(match *self {
497497
$($name::$elem => $txt),*
498498
})
499499
}
500500
}
501501

502-
impl ::core::str::FromStr for $name {
502+
impl core::str::FromStr for $name {
503503
type Err = $crate::io::Error;
504504
#[inline]
505505
fn from_str(s: &str) -> Result<Self, Self::Err> {
@@ -525,7 +525,7 @@ macro_rules! user_enum {
525525
where
526526
D: $crate::serde::Deserializer<'de>,
527527
{
528-
use ::core::fmt::{self, Formatter};
528+
use core::fmt::{self, Formatter};
529529

530530
struct Visitor;
531531
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {

src/util/address.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl WitnessVersion {
254254
/// If the integer does not correspond to any witness version, errors with
255255
/// [`Error::InvalidWitnessVersion`].
256256
#[deprecated(since = "0.29.0", note = "use try_from instead")]
257-
pub fn from_u5(value: ::bech32::u5) -> Result<Self, Error> {
257+
pub fn from_u5(value: bech32::u5) -> Result<Self, Error> {
258258
Self::try_from(value)
259259
}
260260

@@ -422,10 +422,10 @@ impl<'a> TryFrom<Instruction<'a>> for WitnessVersion {
422422
}
423423
}
424424

425-
impl From<WitnessVersion> for ::bech32::u5 {
425+
impl From<WitnessVersion> for bech32::u5 {
426426
/// Converts [`WitnessVersion`] instance into corresponding Bech32(m) u5-value ([`bech32::u5`]).
427427
fn from(version: WitnessVersion) -> Self {
428-
::bech32::u5::try_from_u8(version.to_num()).expect("WitnessVersion must be 0..=16")
428+
bech32::u5::try_from_u8(version.to_num()).expect("WitnessVersion must be 0..=16")
429429
}
430430
}
431431

src/util/amount.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ impl FromStr for Amount {
779779
}
780780
}
781781

782-
impl ::core::iter::Sum for Amount {
782+
impl core::iter::Sum for Amount {
783783
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
784784
let sats: u64 = iter.map(|amt| amt.0).sum();
785785
Amount::from_sat(sats)
@@ -1210,7 +1210,7 @@ impl FromStr for SignedAmount {
12101210
}
12111211
}
12121212

1213-
impl ::core::iter::Sum for SignedAmount {
1213+
impl core::iter::Sum for SignedAmount {
12141214
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
12151215
let sats: i64 = iter.map(|amt| amt.0).sum();
12161216
SignedAmount::from_sat(sats)

src/util/bip32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,13 @@ impl<'a> From<&'a [ChildNumber]> for DerivationPath {
285285
}
286286
}
287287

288-
impl ::core::iter::FromIterator<ChildNumber> for DerivationPath {
288+
impl core::iter::FromIterator<ChildNumber> for DerivationPath {
289289
fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item=ChildNumber> {
290290
DerivationPath(Vec::from_iter(iter))
291291
}
292292
}
293293

294-
impl<'a> ::core::iter::IntoIterator for &'a DerivationPath {
294+
impl<'a> core::iter::IntoIterator for &'a DerivationPath {
295295
type Item = &'a ChildNumber;
296296
type IntoIter = slice::Iter<'a, ChildNumber>;
297297
fn into_iter(self) -> Self::IntoIter {

src/util/endian.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ macro_rules! define_slice_to_be {
44
($name: ident, $type: ty) => {
55
#[inline]
66
pub fn $name(slice: &[u8]) -> $type {
7-
assert_eq!(slice.len(), ::core::mem::size_of::<$type>());
7+
assert_eq!(slice.len(), core::mem::size_of::<$type>());
88
let mut res = 0;
99
for i in 0..::core::mem::size_of::<$type>() {
1010
res |= (slice[i] as $type) << (::core::mem::size_of::<$type>() - i - 1)*8;
@@ -17,7 +17,7 @@ macro_rules! define_slice_to_le {
1717
($name: ident, $type: ty) => {
1818
#[inline]
1919
pub fn $name(slice: &[u8]) -> $type {
20-
assert_eq!(slice.len(), ::core::mem::size_of::<$type>());
20+
assert_eq!(slice.len(), core::mem::size_of::<$type>());
2121
let mut res = 0;
2222
for i in 0..::core::mem::size_of::<$type>() {
2323
res |= (slice[i] as $type) << i*8;
@@ -93,7 +93,7 @@ macro_rules! define_chunk_slice_to_int {
9393
($name: ident, $type: ty, $converter: ident) => {
9494
#[inline]
9595
pub fn $name(inp: &[u8], outp: &mut [$type]) {
96-
assert_eq!(inp.len(), outp.len() * ::core::mem::size_of::<$type>());
96+
assert_eq!(inp.len(), outp.len() * core::mem::size_of::<$type>());
9797
for (outp_val, data_bytes) in outp.iter_mut().zip(inp.chunks(::core::mem::size_of::<$type>())) {
9898
*outp_val = $converter(data_bytes);
9999
}

0 commit comments

Comments
 (0)