Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[Fix] parameter_types! dead code errors #12340

Merged
merged 2 commits into from
Sep 23, 2022
Merged
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions frame/support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ macro_rules! parameter_types_impl_thread_local {
}

/// Mutate the internal value in place.
#[allow(unused)]
Copy link
Member

@ggwpez ggwpez Sep 23, 2022

Choose a reason for hiding this comment

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

Can we mark the whole impl as allow(unused)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe more fine grained control over this is better, that way nothing ever gets lost. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

pub fn mutate<R, F: FnOnce(&mut $type) -> R>(mutate: F) -> R{
let mut current = Self::get();
let result = mutate(&mut current);
Expand All @@ -456,6 +457,7 @@ macro_rules! parameter_types_impl_thread_local {
}

/// Get current value and replace with initial value of the parameter type.
#[allow(unused)]
pub fn take() -> $type {
let current = Self::get();
Self::set($value);
Expand Down