Skip to content

Commit 2f65ba1

Browse files
committed
style(binary_encoding): apply cargo +nightly fmt
1 parent aa96879 commit 2f65ba1

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

src/binary_encoding.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,12 @@ pub struct KeyDecoder {
5555
}
5656

5757
impl Default for KeyDecoder {
58-
fn default() -> Self {
59-
Self::new()
60-
}
58+
fn default() -> Self { Self::new() }
6159
}
6260

6361
impl KeyDecoder {
6462
/// Constructs a new [`KeyDecoder`].
65-
pub const fn new() -> Self {
66-
Self { state: KeyDecoderState::KeyLength(ByteVecDecoder::new()) }
67-
}
63+
pub const fn new() -> Self { Self { state: KeyDecoderState::KeyLength(ByteVecDecoder::new()) } }
6864
}
6965

7066
/// An error consensus decoding a PSBT [`Key`]
@@ -111,9 +107,7 @@ pub enum KeyDecoderState {
111107

112108
impl Decodable for Key {
113109
type Decoder = KeyDecoder;
114-
fn decoder() -> Self::Decoder {
115-
KeyDecoder::new()
116-
}
110+
fn decoder() -> Self::Decoder { KeyDecoder::new() }
117111
}
118112

119113
impl Decoder for KeyDecoder {
@@ -137,7 +131,7 @@ impl Decoder for KeyDecoder {
137131
return Ok(true);
138132
}
139133
*key_as_bytes = (*key_as_bytes_slice).to_vec();
140-
},
134+
}
141135
State::Done(..) => return Ok(false),
142136
State::Errored => panic!("call to push_bytes() after decoder errored"),
143137
}
@@ -161,14 +155,11 @@ impl Decoder for KeyDecoder {
161155

162156
let data = (*type_and_data).to_vec();
163157

164-
self.state = State::Done(Key {
165-
type_value: key_type_u8,
166-
key: data,
167-
});
168-
},
158+
self.state = State::Done(Key { type_value: key_type_u8, key: data });
159+
}
169160
State::Done(..) => {
170161
return Ok(false);
171-
},
162+
}
172163
State::Errored => panic!("call to push_bytes() after decoder errored"),
173164
}
174165
}
@@ -203,11 +194,10 @@ impl Decoder for KeyDecoder {
203194

204195
#[cfg(test)]
205196
mod tests {
206-
use super::{
207-
Key, KeyDecoder, Vec,
208-
};
209197
use encoding::{Decodable, Decoder, Encodable, Encoder};
210198

199+
use super::{Key, KeyDecoder, Vec};
200+
211201
fn encode_key(key: Key) -> Vec<u8> {
212202
let mut key_encoder = key.encoder();
213203
let mut advance = true;

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ mod macros;
3939
mod serde_utils;
4040
mod sighash_type;
4141

42+
pub mod binary_encoding;
4243
pub mod raw;
4344
pub mod serialize;
4445
pub mod v0;
4546
pub mod v2;
46-
pub mod binary_encoding;
4747
mod version;
4848

4949
use bitcoin::io;

0 commit comments

Comments
 (0)