Skip to content

Commit

Permalink
Some code grooming (#2276)
Browse files Browse the repository at this point in the history
* some code grooming: enable warn(missing_docs) for all piblic crates + added missing documentation + removed obsolete clippy/deny workarounds

* removed strange allow + added comment related to other allow

* removed incorrect_clone_impl_on_copy_type which is unknown to CI clippy
  • Loading branch information
svyatonik authored and bkontur committed Jun 12, 2024
1 parent 9112b92 commit 46f3c36
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
32 changes: 0 additions & 32 deletions bridges/primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,38 +457,6 @@ macro_rules! generate_static_str_provider {
};
}

/// Error message that is only displayable in `std` environment.
#[derive(Encode, Decode, Clone, Eq, PartialEq, PalletError, TypeInfo)]
#[scale_info(skip_type_params(T))]
pub struct StrippableError<T> {
_phantom_data: sp_std::marker::PhantomData<T>,
#[codec(skip)]
#[cfg(feature = "std")]
message: String,
}

impl<T: Debug> From<T> for StrippableError<T> {
fn from(_err: T) -> Self {
Self {
_phantom_data: Default::default(),
#[cfg(feature = "std")]
message: format!("{:?}", _err),
}
}
}

impl<T> Debug for StrippableError<T> {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
f.write_str(&self.message)
}

#[cfg(not(feature = "std"))]
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
f.write_str("Stripped error")
}
}

/// A trait defining helper methods for `RangeInclusive` (start..=end)
pub trait RangeInclusiveExt<Idx> {
/// Computes the length of the `RangeInclusive`, checking for underflow and overflow.
Expand Down
4 changes: 2 additions & 2 deletions bridges/primitives/runtime/src/storage_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ impl VerifiedStorageProof {
#[cfg(feature = "test-helpers")]
#[derive(Clone, Copy, Debug, Default)]
pub struct UnverifiedStorageProofParams {
#[allow(missing_docs)]
/// Expected storage proof size in bytes.
pub db_size: Option<u32>,
}

#[cfg(feature = "test-helpers")]
impl UnverifiedStorageProofParams {
#[allow(missing_docs)]
/// Make storage proof parameters that require proof of at least `db_size` bytes.
pub fn from_db_size(db_size: u32) -> Self {
Self { db_size: Some(db_size) }
}
Expand Down

0 comments on commit 46f3c36

Please sign in to comment.