Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions bitcoin/src/blockdata/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,7 @@ mod tests {
);
assert_eq!(real_decode.total_size(), some_block.len());
assert_eq!(block_base_size(real_decode.transactions()), some_block.len());
assert_eq!(
real_decode.weight(),
Weight::from_vb_unchecked(some_block.len().to_u64())
);
assert_eq!(real_decode.weight(), Weight::from_vb_unchecked(some_block.len().to_u64()));

assert_eq!(serialize(&real_decode), some_block);
}
Expand Down
2 changes: 1 addition & 1 deletion bitcoin/src/blockdata/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ internal_macros::define_extension_trait! {
/// Returns the total number of bytes that this input contributes to a transaction.
///
/// Total size includes the witness data (for base size see [`Self::base_size`]).
///
///
/// # Panics
///
/// If the size calculation overflows.
Expand Down
9 changes: 2 additions & 7 deletions consensus_encoding/src/encode/encoders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ pub struct BytesEncoder<'sl> {

impl<'sl> BytesEncoder<'sl> {
/// Constructs a byte encoder which encodes the given byte slice, with no length prefix.
pub fn without_length_prefix(sl: &'sl [u8]) -> Self {
Self { sl: Some(sl) }
}
pub fn without_length_prefix(sl: &'sl [u8]) -> Self { Self { sl: Some(sl) } }
}

impl Encoder for BytesEncoder<'_> {
Expand Down Expand Up @@ -255,9 +253,7 @@ mod tests {
where
Self: 's;

fn encoder(&self) -> Self::Encoder<'_> {
BytesEncoder::without_length_prefix(self.0)
}
fn encoder(&self) -> Self::Encoder<'_> { BytesEncoder::without_length_prefix(self.0) }
}

struct TestArray<const N: usize>([u8; N]);
Expand Down Expand Up @@ -315,7 +311,6 @@ mod tests {
assert_eq!(encoder.current_chunk(), None);
}


#[test]
fn encode_slice_with_elements() {
// Should have the element chunks, then exhausted.
Expand Down
4 changes: 1 addition & 3 deletions fuzz/fuzz_targets/units/arbitrary_weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ fn do_test(data: &[u8]) {
}

// Constructors that return a Weight
for constructor in
[Weight::from_wu]
{
for constructor in [Weight::from_wu] {
if let Ok(val) = u.arbitrary() {
constructor(val);
} else {
Expand Down
2 changes: 1 addition & 1 deletion hashes/src/sha256t/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ macro_rules! sha256t_tag_constructor {

#[cfg(test)]
mod tests {
use crate::sha256t;
#[cfg(feature = "alloc")]
use crate::sha256;
use crate::sha256t;

const TEST_MIDSTATE: [u8; 32] = [
156, 224, 228, 230, 124, 17, 108, 57, 56, 179, 202, 242, 195, 15, 80, 137, 211, 243, 147,
Expand Down
10 changes: 4 additions & 6 deletions primitives/src/script/borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,10 @@ impl<T> Encodable for Script<T> {
Self: 'a;

fn encoder(&self) -> Self::Encoder<'_> {
ScriptEncoder(
Encoder2::new(
CompactSizeEncoder::new(self.as_bytes().len()),
BytesEncoder::without_length_prefix(self.as_bytes())
)
)
ScriptEncoder(Encoder2::new(
CompactSizeEncoder::new(self.as_bytes().len()),
BytesEncoder::without_length_prefix(self.as_bytes()),
))
}
}

Expand Down
2 changes: 1 addition & 1 deletion units/src/amount/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use core::num::{NonZeroI64, NonZeroU64};
use std::panic;

use super::*;
use crate::result::NumOpResult;
#[cfg(feature = "alloc")]
use crate::result::MathOp;
use crate::result::NumOpResult;
#[cfg(feature = "alloc")]
use crate::{FeeRate, Weight};

Expand Down
2 changes: 1 addition & 1 deletion units/src/weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Weight {
pub const fn from_witness_data_size(witness_size: u64) -> Self { Weight::from_wu(witness_size) }

/// Constructs a new [`Weight`] from non-witness size.
///
///
/// # Panics
///
/// If the conversion from virtual bytes overflows.
Expand Down