Skip to content

Commit 3286677

Browse files
committed
Remove _most_ leading double colons
Leading double colons are a relic of edition 2015. Remove all leading double colons that follow a space, done like this so that reviewers can do the same and verify the diff. Done with search-and-replace ' ::' '::' And, for the record: ```bash function search-and-replace() { if (($# != 2)) then echo "Usage: $0 <this> <that>" return fi local this="$1" local that="$2" for file in $(git grep -l "$this") do perl -pi -e "s/$this/$that/g" "$file" done } ```
1 parent 07692bb commit 3286677

File tree

13 files changed

+107
-107
lines changed

13 files changed

+107
-107
lines changed

src/blockdata/script.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl hex::FromHex for Script {
123123
}
124124
}
125125

126-
impl ::core::str::FromStr for Script {
126+
impl core::str::FromStr for Script {
127127
type Err = hex::Error;
128128
fn from_str(s: &str) -> Result<Self, hex::Error> {
129129
hex::FromHex::from_hex(s)
@@ -314,7 +314,7 @@ pub fn read_uint(data: &[u8], size: usize) -> Result<usize, Error> {
314314

315315
// We internally use implementation based on iterator so that it automatically advances as needed
316316
// Errors are same as above, just different type.
317-
fn read_uint_iter(data: &mut ::core::slice::Iter<'_, u8>, size: usize) -> Result<usize, UintError> {
317+
fn read_uint_iter(data: &mut core::slice::Iter<'_, u8>, size: usize) -> Result<usize, UintError> {
318318
if data.len() < size {
319319
Err(UintError::EarlyEndOfScript)
320320
} else if size > usize::from(u16::max_value() / 8) {
@@ -637,7 +637,7 @@ impl Script {
637637
#[cfg(feature="bitcoinconsensus")]
638638
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoinconsensus")))]
639639
pub fn verify (&self, index: usize, amount: crate::Amount, spending: &[u8]) -> Result<(), Error> {
640-
self.verify_with_flags(index, amount, spending, ::bitcoinconsensus::VERIFY_ALL)
640+
self.verify_with_flags(index, amount, spending, bitcoinconsensus::VERIFY_ALL)
641641
}
642642

643643
/// Verifies spend of an input script.
@@ -767,7 +767,7 @@ pub enum Instruction<'a> {
767767

768768
/// Iterator over a script returning parsed opcodes.
769769
pub struct Instructions<'a> {
770-
data: ::core::slice::Iter<'a, u8>,
770+
data: core::slice::Iter<'a, u8>,
771771
enforce_minimal: bool,
772772
}
773773

@@ -863,7 +863,7 @@ impl<'a> Iterator for Instructions<'a> {
863863
}
864864
}
865865

866-
impl<'a> ::core::iter::FusedIterator for Instructions<'a> {}
866+
impl<'a> core::iter::FusedIterator for Instructions<'a> {}
867867

868868
impl Builder {
869869
/// Creates a new empty script.
@@ -1501,14 +1501,14 @@ mod test {
15011501
let script = Script::from(vec![0u8, 1u8, 2u8]);
15021502

15031503
// Serialize
1504-
let json = ::serde_json::to_string(&script).unwrap();
1504+
let json = serde_json::to_string(&script).unwrap();
15051505
assert_eq!(json, "\"000102\"");
1506-
let bincode = ::bincode::serialize(&script).unwrap();
1506+
let bincode = bincode::serialize(&script).unwrap();
15071507
assert_eq!(bincode, [3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2]); // bincode adds u64 for length, serde_cbor use varint
15081508

15091509
// Deserialize
1510-
assert_eq!(script, ::serde_json::from_str(&json).unwrap());
1511-
assert_eq!(script, ::bincode::deserialize(&bincode).unwrap());
1510+
assert_eq!(script, serde_json::from_str(&json).unwrap());
1511+
assert_eq!(script, bincode::deserialize(&bincode).unwrap());
15121512
}
15131513

15141514
#[test]

src/blockdata/transaction.rs

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

165-
impl ::core::str::FromStr for OutPoint {
165+
impl core::str::FromStr for OutPoint {
166166
type Err = ParseOutPointError;
167167

168168
fn from_str(s: &str) -> Result<Self, Self::Err> {
@@ -690,7 +690,7 @@ impl Transaction {
690690
where
691691
S: FnMut(&OutPoint) -> Option<TxOut>
692692
{
693-
self.verify_with_flags(spent, ::bitcoinconsensus::VERIFY_ALL)
693+
self.verify_with_flags(spent, bitcoinconsensus::VERIFY_ALL)
694694
}
695695

696696
/// 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
@@ -121,15 +121,15 @@ macro_rules! impl_array_newtype {
121121
macro_rules! display_from_debug {
122122
($thing:ident) => {
123123
impl core::fmt::Display for $thing {
124-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> Result<(), ::core::fmt::Error> {
125-
::core::fmt::Debug::fmt(self, f)
124+
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
125+
core::fmt::Debug::fmt(self, f)
126126
}
127127
}
128128
}
129129
}
130130

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

134134
#[cfg(test)]
135135
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()));
@@ -146,8 +146,8 @@ macro_rules! serde_string_impl {
146146
where
147147
D: $crate::serde::de::Deserializer<'de>,
148148
{
149-
use ::core::fmt::{self, Formatter};
150-
use ::core::str::FromStr;
149+
use core::fmt::{self, Formatter};
150+
use core::str::FromStr;
151151

152152
struct Visitor;
153153
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
@@ -194,8 +194,8 @@ macro_rules! serde_struct_human_string_impl {
194194
D: $crate::serde::de::Deserializer<'de>,
195195
{
196196
if deserializer.is_human_readable() {
197-
use ::core::fmt::{self, Formatter};
198-
use ::core::str::FromStr;
197+
use core::fmt::{self, Formatter};
198+
use core::str::FromStr;
199199

200200
struct Visitor;
201201
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
@@ -216,7 +216,7 @@ macro_rules! serde_struct_human_string_impl {
216216

217217
deserializer.deserialize_str(Visitor)
218218
} else {
219-
use ::core::fmt::{self, Formatter};
219+
use core::fmt::{self, Formatter};
220220
use $crate::serde::de::IgnoredAny;
221221

222222
#[allow(non_camel_case_types)]
@@ -365,33 +365,33 @@ macro_rules! serde_struct_human_string_impl {
365365
macro_rules! impl_bytes_newtype {
366366
($t:ident, $len:literal) => (
367367

368-
impl ::core::fmt::LowerHex for $t {
369-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
368+
impl core::fmt::LowerHex for $t {
369+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
370370
for &ch in self.0.iter() {
371371
write!(f, "{:02x}", ch)?;
372372
}
373373
Ok(())
374374
}
375375
}
376376

377-
impl ::core::fmt::Display for $t {
378-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
379-
::core::fmt::LowerHex::fmt(self, f)
377+
impl core::fmt::Display for $t {
378+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
379+
core::fmt::LowerHex::fmt(self, f)
380380
}
381381
}
382382

383-
impl ::core::fmt::Debug for $t {
384-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
385-
::core::fmt::LowerHex::fmt(self, f)
383+
impl core::fmt::Debug for $t {
384+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
385+
core::fmt::LowerHex::fmt(self, f)
386386
}
387387
}
388388

389389
impl $crate::hashes::hex::FromHex for $t {
390390
fn from_byte_iter<I>(iter: I) -> Result<Self, $crate::hashes::hex::Error>
391391
where
392-
I: ::core::iter::Iterator<Item=Result<u8, $crate::hashes::hex::Error>>
393-
+ ::core::iter::ExactSizeIterator
394-
+ ::core::iter::DoubleEndedIterator,
392+
I: core::iter::Iterator<Item=Result<u8, $crate::hashes::hex::Error>>
393+
+ core::iter::ExactSizeIterator
394+
+ core::iter::DoubleEndedIterator,
395395
{
396396
if iter.len() == $len {
397397
let mut ret = [0; $len];
@@ -405,7 +405,7 @@ macro_rules! impl_bytes_newtype {
405405
}
406406
}
407407

408-
impl ::core::str::FromStr for $t {
408+
impl core::str::FromStr for $t {
409409
type Err = $crate::hashes::hex::Error;
410410
fn from_str(s: &str) -> Result<Self, Self::Err> {
411411
$crate::hashes::hex::FromHex::from_hex(s)
@@ -434,15 +434,15 @@ macro_rules! impl_bytes_newtype {
434434
impl<'de> $crate::serde::de::Visitor<'de> for HexVisitor {
435435
type Value = $t;
436436

437-
fn expecting(&self, formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
437+
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
438438
formatter.write_str("an ASCII hex string")
439439
}
440440

441441
fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
442442
where
443443
E: $crate::serde::de::Error,
444444
{
445-
if let Ok(hex) = ::core::str::from_utf8(v) {
445+
if let Ok(hex) = core::str::from_utf8(v) {
446446
$crate::hashes::hex::FromHex::from_hex(hex).map_err(E::custom)
447447
} else {
448448
return Err(E::invalid_value($crate::serde::de::Unexpected::Bytes(v), &self));
@@ -464,7 +464,7 @@ macro_rules! impl_bytes_newtype {
464464
impl<'de> $crate::serde::de::Visitor<'de> for BytesVisitor {
465465
type Value = $t;
466466

467-
fn expecting(&self, formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
467+
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
468468
formatter.write_str("a bytestring")
469469
}
470470

@@ -502,15 +502,15 @@ macro_rules! user_enum {
502502
$(#[$doc] $elem),*
503503
}
504504

505-
impl ::core::fmt::Display for $name {
506-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
505+
impl core::fmt::Display for $name {
506+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
507507
f.pad(match *self {
508508
$($name::$elem => $txt),*
509509
})
510510
}
511511
}
512512

513-
impl ::core::str::FromStr for $name {
513+
impl core::str::FromStr for $name {
514514
type Err = $crate::io::Error;
515515
#[inline]
516516
fn from_str(s: &str) -> Result<Self, Self::Err> {
@@ -536,7 +536,7 @@ macro_rules! user_enum {
536536
where
537537
D: $crate::serde::Deserializer<'de>,
538538
{
539-
use ::core::fmt::{self, Formatter};
539+
use core::fmt::{self, Formatter};
540540

541541
struct Visitor;
542542
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
@@ -260,7 +260,7 @@ impl WitnessVersion {
260260
/// If the integer does not correspond to any witness version, errors with
261261
/// [`Error::InvalidWitnessVersion`].
262262
#[deprecated(since = "0.29.0", note = "use try_from instead")]
263-
pub fn from_u5(value: ::bech32::u5) -> Result<Self, Error> {
263+
pub fn from_u5(value: bech32::u5) -> Result<Self, Error> {
264264
Self::try_from(value)
265265
}
266266

@@ -428,10 +428,10 @@ impl<'a> TryFrom<Instruction<'a>> for WitnessVersion {
428428
}
429429
}
430430

431-
impl From<WitnessVersion> for ::bech32::u5 {
431+
impl From<WitnessVersion> for bech32::u5 {
432432
/// Converts [`WitnessVersion`] instance into corresponding Bech32(m) u5-value ([`bech32::u5`]).
433433
fn from(version: WitnessVersion) -> Self {
434-
::bech32::u5::try_from_u8(version.to_num()).expect("WitnessVersion must be 0..=16")
434+
bech32::u5::try_from_u8(version.to_num()).expect("WitnessVersion must be 0..=16")
435435
}
436436
}
437437

src/util/amount.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ impl FromStr for Amount {
772772
}
773773
}
774774

775-
impl ::core::iter::Sum for Amount {
775+
impl core::iter::Sum for Amount {
776776
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
777777
let sats: u64 = iter.map(|amt| amt.0).sum();
778778
Amount::from_sat(sats)
@@ -1203,7 +1203,7 @@ impl FromStr for SignedAmount {
12031203
}
12041204
}
12051205

1206-
impl ::core::iter::Sum for SignedAmount {
1206+
impl core::iter::Sum for SignedAmount {
12071207
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
12081208
let sats: i64 = iter.map(|amt| amt.0).sum();
12091209
SignedAmount::from_sat(sats)

src/util/bip32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,13 @@ impl<'a> From<&'a [ChildNumber]> for DerivationPath {
295295
}
296296
}
297297

298-
impl ::core::iter::FromIterator<ChildNumber> for DerivationPath {
298+
impl core::iter::FromIterator<ChildNumber> for DerivationPath {
299299
fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item=ChildNumber> {
300300
DerivationPath(Vec::from_iter(iter))
301301
}
302302
}
303303

304-
impl<'a> ::core::iter::IntoIterator for &'a DerivationPath {
304+
impl<'a> core::iter::IntoIterator for &'a DerivationPath {
305305
type Item = &'a ChildNumber;
306306
type IntoIter = slice::Iter<'a, ChildNumber>;
307307
fn into_iter(self) -> Self::IntoIter {

src/util/endian.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ macro_rules! define_slice_to_be {
22
($name: ident, $type: ty) => {
33
#[inline]
44
pub fn $name(slice: &[u8]) -> $type {
5-
assert_eq!(slice.len(), ::core::mem::size_of::<$type>());
5+
assert_eq!(slice.len(), core::mem::size_of::<$type>());
66
let mut res = 0;
77
for i in 0..::core::mem::size_of::<$type>() {
88
res |= (slice[i] as $type) << (::core::mem::size_of::<$type>() - i - 1)*8;
@@ -15,7 +15,7 @@ macro_rules! define_slice_to_le {
1515
($name: ident, $type: ty) => {
1616
#[inline]
1717
pub fn $name(slice: &[u8]) -> $type {
18-
assert_eq!(slice.len(), ::core::mem::size_of::<$type>());
18+
assert_eq!(slice.len(), core::mem::size_of::<$type>());
1919
let mut res = 0;
2020
for i in 0..::core::mem::size_of::<$type>() {
2121
res |= (slice[i] as $type) << i*8;
@@ -91,7 +91,7 @@ macro_rules! define_chunk_slice_to_int {
9191
($name: ident, $type: ty, $converter: ident) => {
9292
#[inline]
9393
pub fn $name(inp: &[u8], outp: &mut [$type]) {
94-
assert_eq!(inp.len(), outp.len() * ::core::mem::size_of::<$type>());
94+
assert_eq!(inp.len(), outp.len() * core::mem::size_of::<$type>());
9595
for (outp_val, data_bytes) in outp.iter_mut().zip(inp.chunks(::core::mem::size_of::<$type>())) {
9696
*outp_val = $converter(data_bytes);
9797
}

0 commit comments

Comments
 (0)