Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup a few hidden imports in frame-support #1770

Merged
merged 3 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions substrate/frame/staking/reward-curve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ pub fn build(input: TokenStream) -> TokenStream {

let imports = match crate_name("sp-runtime") {
Ok(FoundCrate::Itself) => quote!(
extern crate sp_runtime as _sp_runtime;
#[doc(hidden)]
pub use sp_runtime as _sp_runtime;
),
Ok(FoundCrate::Name(sp_runtime)) => {
let ident = syn::Ident::new(&sp_runtime, Span::call_site());
quote!( extern crate #ident as _sp_runtime; )
quote!( #[doc(hidden)] pub use #ident as _sp_runtime; )
},
Err(e) => syn::Error::new(Span::call_site(), e).to_compile_error(),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ pub fn expand_outer_inherent(
use #scrate::inherent::{ProvideInherent, IsFatalError};
use #scrate::traits::{IsSubType, ExtrinsicCall};
use #scrate::sp_runtime::traits::Block as _;
use #scrate::_private::sp_inherents::Error;
use #scrate::__private::log;
use #scrate::__private::{sp_inherents::Error, log};

let mut result = #scrate::inherent::CheckInherentsResult::new();

Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/support/procedural/tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn generate_hidden_includes(unique_id: &str, def_crate: &str) -> TokenStream
quote::quote!(
#[doc(hidden)]
mod #mod_name {
pub extern crate #name as hidden_include;
pub use #name as hidden_include;
}
)
},
Expand Down
8 changes: 2 additions & 6 deletions substrate/frame/support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#![cfg_attr(not(feature = "std"), no_std)]

/// Export ourself as `frame_support` to make tests happy.
#[doc(hidden)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be visible by default any way?

extern crate self as frame_support;

/// Private exports that are being used by macros.
Expand All @@ -45,6 +46,7 @@ pub mod __private {
pub use serde;
pub use sp_core::{OpaqueMetadata, Void};
pub use sp_core_hashing_proc_macro;
pub use sp_inherents;
pub use sp_io::{self, storage::root as storage_root};
pub use sp_metadata_ir as metadata_ir;
#[cfg(feature = "std")]
Expand Down Expand Up @@ -786,12 +788,6 @@ pub use serde::{Deserialize, Serialize};
#[cfg(not(no_std))]
pub use macro_magic;

/// Private module re-exporting items used by frame support macros.
#[doc(hidden)]
pub mod _private {
pub use sp_inherents;
}

/// Prelude to be used for pallet testing, for ease of use.
#[cfg(feature = "std")]
pub mod testing_prelude {
Expand Down
Loading