Restructure macro-related exports into private mods for frame (#14375)

* minor refactor

* Update frame/election-provider-support/src/lib.rs

* Update frame/election-provider-support/solution-type/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>
This commit is contained in:
Guillaume Yu Thiolliere
2023-06-14 21:44:01 +09:00
committed by GitHub
parent b78473d28a
commit 7db4d74c43
8 changed files with 94 additions and 102 deletions
@@ -194,13 +194,27 @@ use sp_runtime::TryRuntimeError;
// re-export for the solution macro, with the dependencies of the macro.
#[doc(hidden)]
pub use codec;
#[doc(hidden)]
pub use scale_info;
#[doc(hidden)]
pub use sp_arithmetic;
#[doc(hidden)]
pub use sp_std;
pub mod private {
pub use codec;
pub use scale_info;
pub use sp_arithmetic;
pub use sp_std;
// Simple Extension trait to easily convert `None` from index closures to `Err`.
//
// This is only generated and re-exported for the solution code to use.
pub trait __OrInvalidIndex<T> {
fn or_invalid_index(self) -> Result<T, crate::Error>;
}
impl<T> __OrInvalidIndex<T> for Option<T> {
fn or_invalid_index(self) -> Result<T, crate::Error> {
self.ok_or(crate::Error::SolutionInvalidIndex)
}
}
}
use private::__OrInvalidIndex;
pub mod weights;
pub use weights::WeightInfo;
@@ -209,19 +223,6 @@ pub use weights::WeightInfo;
mod mock;
#[cfg(test)]
mod tests;
// Simple Extension trait to easily convert `None` from index closures to `Err`.
//
// This is only generated and re-exported for the solution code to use.
#[doc(hidden)]
pub trait __OrInvalidIndex<T> {
fn or_invalid_index(self) -> Result<T, Error>;
}
impl<T> __OrInvalidIndex<T> for Option<T> {
fn or_invalid_index(self) -> Result<T, Error> {
self.ok_or(Error::SolutionInvalidIndex)
}
}
/// The [`IndexAssignment`] type is an intermediate between the assignments list
/// ([`&[Assignment<T>]`][Assignment]) and `SolutionOf<T>`.