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

codegen: allow(unreachable_patterns) #1814

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all 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
4 changes: 2 additions & 2 deletions codegen/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl RuntimeGenerator {

Ok(quote! {
#( #item_mod_attrs )*
#[allow(dead_code, unused_imports, non_camel_case_types)]
#[allow(dead_code, unused_imports, non_camel_case_types, unreachable_patterns)]
Copy link
Member

@niklasad1 niklasad1 Oct 6, 2024

Choose a reason for hiding this comment

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

This is not really a clippy lint but a rustc warning.

I don't mind adding this but more interesting why/when the codegen would generate something like an empty enum or something that can't be instantiated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@niklasad1 e.g. you can generate it for rococo/westend and run cargo +nighlty clippy, e.g.:
https://github.com/paritytech/parity-bridges-common/pull/3059/files#diff-611bdbe35fbbfe14f550dc53edae00c57c91bbd07b6fc7ad3cdec38f7f2c6cdb

git clone [email protected]:paritytech/parity-bridges-common.git
cd parity-bridges-common/tools/runtime-codegen

cargo run --bin runtime-codegen -- --from-node-url "wss://rococo-rpc.polkadot.io:443" > ../../relay-clients/client-rococo/src/codegen_runtime.rs

cargo run --bin runtime-codegen -- --from-node-url "wss://westend-rpc.polkadot.io:443" > ../../relay-clients/client-westend/src/codegen_runtime.rs

#[allow(clippy::all)]
#[allow(rustdoc::broken_intra_doc_links)]
pub mod #mod_ident {
Expand Down Expand Up @@ -233,7 +233,7 @@ impl RuntimeGenerator {

Ok(quote! {
#( #item_mod_attrs )*
#[allow(dead_code, unused_imports, non_camel_case_types)]
#[allow(dead_code, unused_imports, non_camel_case_types, unreachable_patterns)]
#[allow(clippy::all)]
#[allow(rustdoc::broken_intra_doc_links)]
pub mod #mod_ident {
Expand Down
Loading