1

Consider the following snippet

        #[weight = 100_000_000] //TODO: update weights
        pub fn test(
            _origin,
            _outputs: frame_support::BoundedBTreeSet<JoyBalanceOf<T>, <T as Config>::MaxOutputs>
        ) -> DispatchResult {
            Ok(())
        }

MaxOutputshas been defined in the Config trait as

pub type MaxOutputs = Get<u32>;

When running clippy this will result in the following error

 error[E0277]: `BoundedBTreeSet<<T as pallet_balances::Config>::Balance, <T as Config>::MaxOutputs>` doesn't implement `core::fmt::Debug`
     --> /home/ignazio/developer/joystream/runtime-modules/project-token/src/lib.rs:219:1
      |
  219 | / decl_module! {
  220 | |     pub struct Module<T: Config> for enum Call
  221 | |     where
  222 | |         origin: T::Origin
  ...   |
  993 | |     }
  994 | | }
      | |_^ `BoundedBTreeSet<<T as pallet_balances::Config>::Balance, <T as Config>::MaxOutputs>` cannot be formatted using `{:?}` because it doesn't implement `core::fmt::Debug`
      |
      = help: the trait `core::fmt::Debug` is not implemented for `BoundedBTreeSet<<T as pallet_balances::Config>::Balance, <T as Config>::MaxOutputs>`
      = help: the following other types implement trait `core::fmt::Debug`:
                ()
                (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
                (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
                (T10, T11)
                (T11,)
                (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
                (T3, T4, T5, T6, T7, T8, T9, T10, T11)
                (T4, T5, T6, T7, T8, T9, T10, T11)
              and 5 others
      = note: this error originates in the macro `$crate::format_args` (in Nightly builds, run with -Z macro-backtrace for more info)

However when replacing the BoundedBTreeSet with its unbounded BTreeSet version no errors of this kind are thrown.

#Versions

  • frame-support: 4.0.0-dev
  • cargo: 1.62.0-nightly (a44758ac8 2022-05-04)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.