191897f9ea Manually format (Tobin C. Harding)

Pull request description:

  Run `rustfmt` and manually fix the places where comments are moved to the wrong place.

ACKs for top commit:
  Kixunil:
    ACK 191897f9ea
  apoelstra:
    ACK 191897f9ea successfully ran local tests

Tree-SHA512: f977ff373d1d410012734208c090bfcd8f9dbda414d0b19400acf8f552df481b4a2bc20d77c61538895a6fb66197be13cbdadf74956d67fd4d055b99ba8ab356
This commit is contained in:
merge-script 2024-08-08 17:36:36 +00:00
commit 5a53cfe81f
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
4 changed files with 9 additions and 10 deletions

View File

@ -113,7 +113,8 @@ impl ScriptBuf {
self.0.push((n % 0x100) as u8); self.0.push((n % 0x100) as u8);
self.0.push((n / 0x100) as u8); self.0.push((n / 0x100) as u8);
} }
n => { // `PushBytes` enforces len < 0x100000000 // `PushBytes` enforces len < 0x100000000
n => {
self.0.push(opcodes::Ordinary::OP_PUSHDATA4.to_u8()); self.0.push(opcodes::Ordinary::OP_PUSHDATA4.to_u8());
self.0.push((n % 0x100) as u8); self.0.push((n % 0x100) as u8);
self.0.push(((n / 0x100) % 0x100) as u8); self.0.push(((n / 0x100) % 0x100) as u8);

View File

@ -197,7 +197,6 @@ macro_rules! hash_type {
<Self as crate::GeneralHash>::hash_byte_chunks(byte_slices) <Self as crate::GeneralHash>::hash_byte_chunks(byte_slices)
} }
/// Hashes the entire contents of the `reader`. /// Hashes the entire contents of the `reader`.
#[cfg(feature = "bitcoin-io")] #[cfg(feature = "bitcoin-io")]
pub fn hash_reader<R: io::BufRead>(reader: &mut R) -> Result<Self, io::Error> { pub fn hash_reader<R: io::BufRead>(reader: &mut R) -> Result<Self, io::Error> {

View File

@ -247,8 +247,9 @@ pub trait GeneralHash: Hash {
let bytes = reader.fill_buf()?; let bytes = reader.fill_buf()?;
let read = bytes.len(); let read = bytes.len();
if read == 0 { // Empty slice means EOF. // Empty slice means EOF.
break if read == 0 {
break;
} }
engine.input(bytes); engine.input(bytes);
@ -352,9 +353,6 @@ mod tests {
#[test] #[test]
fn hash_reader() { fn hash_reader() {
let mut reader: &[u8] = b"hello"; let mut reader: &[u8] = b"hello";
assert_eq!( assert_eq!(sha256::Hash::hash_reader(&mut reader).unwrap(), sha256::Hash::hash(b"hello"),)
sha256::Hash::hash_reader(&mut reader).unwrap(),
sha256::Hash::hash(b"hello"),
)
} }
} }

View File

@ -104,8 +104,9 @@ where
let bytes = reader.fill_buf()?; let bytes = reader.fill_buf()?;
let read = bytes.len(); let read = bytes.len();
if read == 0 { // Empty slice means EOF. // Empty slice means EOF.
break if read == 0 {
break;
} }
engine.input(bytes); engine.input(bytes);