-
Notifications
You must be signed in to change notification settings - Fork 754
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
Fix warnings for rust 1.80 #5150
Conversation
@@ -17,7 +17,6 @@ | |||
|
|||
// Custom inner attributes are unstable, so we need to faky disable the attribute. | |||
// rustfmt still honors the attribute to not format the rustdocs below. | |||
#![cfg_attr(feature = "never", rustfmt::skip)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you read the comment above? :D Not sure this is already fixed in rustfmt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed it, but I did run cargo fmt -p sp-runtime-interface
the file was unchanged so I thought it wasn't relevant anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI uses a specific nightly for formatting: cargo +nightly-2024-04-14 fmt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also tested with this version, anyway CI should tell if the formatting of the crate is changing with this PR, in this case I'll revert this change.
@@ -35,6 +35,7 @@ std = [ | |||
"sp-arithmetic/std", | |||
"sp-debug-derive/std", | |||
] | |||
runtime-benchmarks = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there code in sp-weights
that is guarded by the feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this, we could also remove it IMO:
polkadot-sdk/substrate/primitives/weights/src/weight_v2.rs
Lines 404 to 416 in 18db502
#[cfg(any(test, feature = "std", feature = "runtime-benchmarks"))] | |
impl From<u64> for Weight { | |
fn from(value: u64) -> Self { | |
Self::from_parts(value, value) | |
} | |
} | |
#[cfg(any(test, feature = "std", feature = "runtime-benchmarks"))] | |
impl From<(u64, u64)> for Weight { | |
fn from(value: (u64, u64)) -> Self { | |
Self::from_parts(value.0, value.1) | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it was never used, let's remove it.
The CI pipeline was cancelled due to failure one of the required jobs. |
@@ -869,7 +869,6 @@ macro_rules! hypothetically_ok { | |||
pub use serde::{Deserialize, Serialize}; | |||
|
|||
#[doc(hidden)] | |||
#[cfg(not(no_std))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually needed in both std and not std: #5150 (comment)
@@ -401,14 +401,14 @@ where | |||
} | |||
} | |||
|
|||
#[cfg(any(test, feature = "std", feature = "runtime-benchmarks"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better not to add some conditional code for runtime-benchmark here IMO.
This code was never generated, better not to start generating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea feel free to delete in that case. I normally generate helpers on the fly if i need to.
7250937
I made mistake on previous PR #5150. It disabled all unexpected cfgs instead of just allowing `substrate_runtime` condition. In this PR: unexpected cfgs other than `substrate_runtime` are still checked. and some warnings appear about them
Fix warnings for rust 1.80
I made mistake on previous PR paritytech#5150. It disabled all unexpected cfgs instead of just allowing `substrate_runtime` condition. In this PR: unexpected cfgs other than `substrate_runtime` are still checked. and some warnings appear about them
Fix warnings for rust 1.80