The latest nightly has a good set of warnings that are generally good to fix already.
Log output generated with: cargo +nightly test --workspace --features runtime-benchmarks,frequency-lint-check
Important to fix: warning: unexpectedcfgcondition value...
Related to #2006
Relevant log output
warning: unexpected `cfg` condition value: `test`
--> common/primitives/src/node.rs:59:44
|
59 | #[cfg(any(feature = "runtime-benchmarks", feature = "test"))]
| ^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `runtime-benchmarks`, and `std`
= help: consider adding `test` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `frequency`
--> pallets/schemas/src/migration/v3.rs:16:7
|
16 | #[cfg(feature = "frequency")]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `numtoa`, `runtime-benchmarks`, `std`, and `try-runtime`
= help: consider adding `frequency` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `frequency`
--> pallets/schemas/src/migration/v3.rs:32:11
|
32 | #[cfg(not(feature = "frequency"))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `numtoa`, `runtime-benchmarks`, `std`, and `try-runtime`
= help: consider adding `frequency` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: associated function `decode` is never used
--> pallets/stateful-storage/src/stateful_child_tree.rs:62:5
|
56 | pub trait MultipartKey<H: MultipartKeyStorageHasher>: MultipartStorageKeyPart {
| ------------ associated function in this trait
...
62 | fn decode(hash: &[u8]) -> Result<Self, parity_scale_codec::Error> {
| ^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: unexpected `cfg` condition value: `test`
--> pallets/msa/src/tests/mock.rs:176:44
|
176 | #[cfg(any(feature = "runtime-benchmarks", feature = "test"))]
| ^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `runtime-benchmarks`, `std`, and `try-runtime`
= help: consider adding `test` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `test`
--> pallets/frequency-tx-payment/src/tests/mock.rs:138:44
|
138 | #[cfg(any(feature = "runtime-benchmarks", feature = "test"))]
| ^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `runtime-benchmarks`, `std`, and `try-runtime`
= help: consider adding `test` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `test`
--> pallets/schemas/src/tests/mock.rs:106:44
|
106 | #[cfg(any(feature = "runtime-benchmarks", feature = "test"))]
| ^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `numtoa`, `runtime-benchmarks`, `std`, and `try-runtime`
= help: consider adding `test` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `frequency`
--> pallets/schemas/src/migration/v3.rs:16:7
|
16 | #[cfg(feature = "frequency")]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `numtoa`, `runtime-benchmarks`, `std`, and `try-runtime`
= help: consider adding `frequency` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: struct `BlockWeights` is never constructed
--> pallets/frequency-tx-payment/src/weights.rs:90:10
|
90 | struct BlockWeights;
| ^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: unused import: `parity_scale_codec::Encode`
--> pallets/msa/src/rpc/src/tests/mod.rs:8:5
|
8 | use parity_scale_codec::Encode;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused imports: `offchain::OffchainStorage` and `sr25519::Public`
--> pallets/msa/src/rpc/src/tests/mod.rs:10:15
|
10 | use sp_core::{offchain::OffchainStorage, sr25519::Public};
| ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
warning: unexpected `cfg` condition value: `test`
--> pallets/capacity/src/tests/mock.rs:109:44
|
109 | #[cfg(any(feature = "runtime-benchmarks", feature = "test"))]
| ^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `runtime-benchmarks`, `std`, and `try-runtime`
= help: consider adding `test` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: struct `BlockWeights` is never constructed
--> runtime/common/src/weights/pallet_utility.rs:89:10
|
89 | struct BlockWeights;
| ^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:9:48
|
9 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:974:48
|
974 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:978:48
|
978 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:982:48
|
982 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:988:48
|
988 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:1004:48
|
1004 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:1183:39
|
1183 | #[cfg(any(not(feature = "frequency"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:1584:48
|
1584 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:1305:49
|
1305 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:1440:49
|
1440 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `test`
--> runtime/frequency/src/lib.rs:110:44
|
110 | #[cfg(any(feature = "runtime-benchmarks", feature = "test"))]
| ^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `test` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:514:49
|
514 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `frequency-lint-check`
--> runtime/frequency/src/lib.rs:621:49
|
621 | #[cfg(any(not(feature = "frequency-no-relay"), feature = "frequency-lint-check"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `frequency-lint-check` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `parameterized-consensus-hook`
--> runtime/frequency/src/lib.rs:1000:8
|
1000 | #[cfg(feature = "parameterized-consensus-hook")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `parameterized-consensus-hook` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `experimental`
--> runtime/frequency/src/lib.rs:1039:8
|
1039 | #[cfg(feature = "experimental")]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `frame-benchmarking`, `frame-system-benchmarking`, `frame-try-runtime`, `frequency`, `frequency-local`, `frequency-no-relay`, `frequency-testnet`, `hex-literal`, `no-metadata-docs`, `on-chain-release-build`, `runtime-benchmarks`, `serde`, `std`, and `try-runtime`
= help: consider adding `experimental` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> runtime/frequency/src/lib.rs:1566:4
|
1560 | / fn dispatch_benchmark(
1561 | | config: frame_benchmarking::BenchmarkConfig
1562 | | ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
| |_______________________________________________________________________________________- move the `impl` block outside of this associated function `dispatch_benchmark`
...
1566 | impl frame_system_benchmarking::Config for Runtime {}
| ^^^^^---------------------------------^^^^^-------
| | |
| | `Runtime` is not local
| `Config` is not local
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
= note: `#[warn(non_local_definitions)]` on by default
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> runtime/frequency/src/lib.rs:1569:4
|
1560 | / fn dispatch_benchmark(
1561 | | config: frame_benchmarking::BenchmarkConfig
1562 | | ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
| |_______________________________________________________________________________________- move the `impl` block outside of this associated function `dispatch_benchmark`
...
1569 | impl cumulus_pallet_session_benchmarking::Config for Runtime {}
| ^^^^^-------------------------------------------^^^^^-------
| | |
| | `Runtime` is not local
| `Config` is not local
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
What happened?
The latest nightly has a good set of warnings that are generally good to fix already.
Log output generated with:
cargo +nightly test --workspace --features runtime-benchmarks,frequency-lint-check
Important to fix:
warning: unexpected
cfgcondition value...
Related to #2006
Relevant log output