Skip to content

Commit c7807df

Browse files
committed
Run the formatter
Currently we are not running the formatter in CI, in preparation for doing so run `cargo +nightly fmt` to clear all current formatting issues. No manual changes.
1 parent d5065cc commit c7807df

File tree

6 files changed

+17
-24
lines changed

6 files changed

+17
-24
lines changed

src/ecdh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ mod tests {
288288
}
289289

290290
#[cfg(bench)]
291-
#[cfg(feature = "rand-std")] // Currently only a single bench that requires "rand-std".
291+
#[cfg(feature = "rand-std")] // Currently only a single bench that requires "rand-std".
292292
mod benches {
293293
use test::{black_box, Bencher};
294294

src/ecdsa/recovery.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ mod tests {
432432
}
433433

434434
#[cfg(bench)]
435-
#[cfg(feature = "rand-std")] // Currently only a single bench that requires "rand-std".
435+
#[cfg(feature = "rand-std")] // Currently only a single bench that requires "rand-std".
436436
mod benches {
437437
use test::{black_box, Bencher};
438438

src/key.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ impl<'a> From<&'a KeyPair> for PublicKey {
951951
impl str::FromStr for KeyPair {
952952
type Err = Error;
953953

954-
#[allow(unused_variables, unreachable_code)] // When built with no default features.
954+
#[allow(unused_variables, unreachable_code)] // When built with no default features.
955955
fn from_str(s: &str) -> Result<Self, Self::Err> {
956956
#[cfg(feature = "global-context")]
957957
let ctx = SECP256K1;
@@ -1515,7 +1515,7 @@ mod test {
15151515
use core::str::FromStr;
15161516

15171517
#[cfg(feature = "rand")]
1518-
use rand::{self, RngCore, rngs::mock::StepRng};
1518+
use rand::{self, rngs::mock::StepRng, RngCore};
15191519
use serde_test::{Configure, Token};
15201520
#[cfg(target_arch = "wasm32")]
15211521
use wasm_bindgen_test::wasm_bindgen_test as test;

src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -530,19 +530,16 @@ pub(crate) fn random_32_bytes<R: rand::Rng + ?Sized>(rng: &mut R) -> [u8; 32] {
530530

531531
#[cfg(test)]
532532
mod tests {
533-
#[allow(unused_imports)] // When building with no default features.
534-
use super::*;
535-
536533
use std::str::FromStr;
537534

538535
#[cfg(target_arch = "wasm32")]
539536
use wasm_bindgen_test::wasm_bindgen_test as test;
540537

538+
#[allow(unused_imports)] // When building with no default features.
539+
use super::*;
540+
use crate::{constants, ecdsa, from_hex, Error, Message};
541541
#[cfg(feature = "alloc")]
542542
use crate::{ffi, PublicKey, Secp256k1, SecretKey};
543-
use crate::{
544-
constants, ecdsa, from_hex, Error, Message,
545-
};
546543

547544
macro_rules! hex {
548545
($hex:expr) => {{
@@ -889,9 +886,10 @@ mod tests {
889886
#[test]
890887
#[cfg(feature = "rand-std")]
891888
fn test_hex() {
892-
use super::to_hex;
893889
use rand::RngCore;
894890

891+
use super::to_hex;
892+
895893
let mut rng = rand::thread_rng();
896894
const AMOUNT: usize = 1024;
897895
for i in 0..AMOUNT {

src/macros.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,17 @@
1717
#[macro_export]
1818
macro_rules! impl_array_newtype {
1919
($thing:ident, $ty:ty, $len:expr) => {
20-
2120
// We cannot derive these traits because Rust 1.41.1 requires `std::array::LengthAtMost32`.
2221

2322
impl PartialEq for $thing {
2423
#[inline]
25-
fn eq(&self, other: &$thing) -> bool {
26-
&self[..] == &other[..]
27-
}
24+
fn eq(&self, other: &$thing) -> bool { &self[..] == &other[..] }
2825
}
2926

3027
impl Eq for $thing {}
3128

3229
impl core::hash::Hash for $thing {
33-
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
34-
(&self[..]).hash(state)
35-
}
30+
fn hash<H: core::hash::Hasher>(&self, state: &mut H) { (&self[..]).hash(state) }
3631
}
3732

3833
impl PartialOrd for $thing {
@@ -44,9 +39,7 @@ macro_rules! impl_array_newtype {
4439

4540
impl Ord for $thing {
4641
#[inline]
47-
fn cmp(&self, other: &$thing) -> core::cmp::Ordering {
48-
self[..].cmp(&other[..])
49-
}
42+
fn cmp(&self, other: &$thing) -> core::cmp::Ordering { self[..].cmp(&other[..]) }
5043
}
5144

5245
impl AsRef<[$ty; $len]> for $thing {
@@ -81,7 +74,7 @@ macro_rules! impl_array_newtype {
8174
dat.as_mut_ptr()
8275
}
8376
}
84-
}
77+
};
8578
}
8679

8780
macro_rules! impl_pretty_debug {
@@ -139,5 +132,5 @@ macro_rules! impl_fast_comparisons {
139132
self.0.eq_fast_unstable(&other.0)
140133
}
141134
}
142-
}
135+
};
143136
}

src/schnorr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ use crate::ffi::{self, CPtr};
1111
use crate::key::{KeyPair, XOnlyPublicKey};
1212
#[cfg(feature = "global-context")]
1313
use crate::SECP256K1;
14-
use crate::{constants, from_hex, impl_array_newtype, Error, Message, Secp256k1, Signing, Verification};
14+
use crate::{
15+
constants, from_hex, impl_array_newtype, Error, Message, Secp256k1, Signing, Verification,
16+
};
1517

1618
/// Represents a Schnorr signature.
1719
#[derive(Copy, Clone)]

0 commit comments

Comments
 (0)