From a3ab86eebe0a18dce40a9dda23dc87977a92cefc Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Mon, 17 Jul 2023 12:26:09 +0300 Subject: [PATCH] Some code grooming (#2276) * 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 --- bridges/primitives/runtime/src/lib.rs | 32 ------------------- .../primitives/runtime/src/storage_proof.rs | 4 +-- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/bridges/primitives/runtime/src/lib.rs b/bridges/primitives/runtime/src/lib.rs index 1c7e153dc6a52..ca709caad7fbb 100644 --- a/bridges/primitives/runtime/src/lib.rs +++ b/bridges/primitives/runtime/src/lib.rs @@ -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 { - _phantom_data: sp_std::marker::PhantomData, - #[codec(skip)] - #[cfg(feature = "std")] - message: String, -} - -impl From for StrippableError { - fn from(_err: T) -> Self { - Self { - _phantom_data: Default::default(), - #[cfg(feature = "std")] - message: format!("{:?}", _err), - } - } -} - -impl Debug for StrippableError { - #[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 { /// Computes the length of the `RangeInclusive`, checking for underflow and overflow. diff --git a/bridges/primitives/runtime/src/storage_proof.rs b/bridges/primitives/runtime/src/storage_proof.rs index f1505e692ef5b..48b766fda1df4 100644 --- a/bridges/primitives/runtime/src/storage_proof.rs +++ b/bridges/primitives/runtime/src/storage_proof.rs @@ -260,13 +260,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, } #[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) } }