Skip to content

Commit

Permalink
pr feedback: macro, pub(super), _=> none
Browse files Browse the repository at this point in the history
  • Loading branch information
AshwinSekar committed Mar 27, 2024
1 parent a082627 commit 8fe3ce6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions ledger/src/shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ impl ErasureSetId {
macro_rules! dispatch {
($vis:vis fn $name:ident(&self $(, $arg:ident : $ty:ty)?) $(-> $out:ty)?) => {
#[inline]
#[allow(dead_code)]
$vis fn $name(&self $(, $arg:$ty)?) $(-> $out)? {
match self {
Self::ShredCode(shred) => shred.$name($($arg, )?),
Expand All @@ -334,16 +335,6 @@ macro_rules! dispatch {
Self::ShredData(shred) => shred.$name($($arg, )?),
}
}
};
(allow_dead $vis:vis fn $name:ident(&self $(, $arg:ident : $ty:ty)?) $(-> $out:ty)?) => {
#[allow(dead_code)]
#[inline]
$vis fn $name(&self $(, $arg:$ty)?) $(-> $out)? {
match self {
Self::ShredCode(shred) => shred.$name($($arg, )?),
Self::ShredData(shred) => shred.$name($($arg, )?),
}
}
}
}

Expand All @@ -354,7 +345,7 @@ impl Shred {
dispatch!(fn set_signature(&mut self, signature: Signature));
dispatch!(fn signed_data(&self) -> Result<SignedData, Error>);

dispatch!(allow_dead pub(crate) fn chained_merkle_root(&self) -> Result<Hash, Error>);
dispatch!(pub(crate) fn chained_merkle_root(&self) -> Result<Hash, Error>);
// Returns the portion of the shred's payload which is erasure coded.
dispatch!(pub(crate) fn erasure_shard(self) -> Result<Vec<u8>, Error>);
// Like Shred::erasure_shard but returning a slice.
Expand Down Expand Up @@ -751,7 +742,16 @@ pub mod layout {
chained: true,
resigned,
} => merkle::ShredData::get_chained_merkle_root_offset(proof_size, resigned).ok(),
_ => None,
ShredVariant::MerkleCode {
proof_size: _,
chained: false,
resigned: _,
} => None,
ShredVariant::MerkleData {
proof_size: _,
chained: false,
resigned: _,
} => None,
}?;
shred
.get(offset..offset + SIZE_OF_MERKLE_ROOT)
Expand Down
4 changes: 2 additions & 2 deletions ledger/src/shred/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl ShredData {
Self::get_chained_merkle_root_offset(proof_size, resigned)
}

pub(crate) fn get_chained_merkle_root_offset(
pub(super) fn get_chained_merkle_root_offset(
proof_size: u8,
resigned: bool,
) -> Result<usize, Error> {
Expand Down Expand Up @@ -379,7 +379,7 @@ impl ShredCode {
Self::get_chained_merkle_root_offset(proof_size, resigned)
}

pub(crate) fn get_chained_merkle_root_offset(
pub(super) fn get_chained_merkle_root_offset(
proof_size: u8,
resigned: bool,
) -> Result<usize, Error> {
Expand Down

0 comments on commit 8fe3ce6

Please sign in to comment.