[REQ] Rust generated code should follow Clippy suggestions
Created by: UkonnRa
Is your feature request related to a problem? Please describe.
Now, when using cargo clippy
to check the generated code, some bad smell may raise.
For example, when running cargo clippy --all-targets --all-features --allow-dirty --allow-staged --fix -Z unstable-options -- -D warnings
, the following warning may raise:
About naming
warning: structure field `UID` should have a snake case name
--> external\hydra-client\src\models\plugin_config_user.rs:20:9
|
20 | pub UID: Option<i32>,
| ^^^ help: convert the identifier to snake case: `uid`
About rules like new_without_default
warning: you should consider adding a `Default` implementation for `models::logout_request::LogoutRequest`
--> external\hydra-client\src\models\logout_request.rs:28:5
|
28 | / pub fn new() -> LogoutRequest {
29 | | LogoutRequest { request_url: None, rp_initiated: None, sid: None, subject: None }
30 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
|
27 | impl Default for models::logout_request::LogoutRequest {
28 | fn default() -> Self {
29 | Self::new()
30 | }
31 | }
|
Describe the solution you'd like
More strict lint test is needed when testing the generator
Describe alternatives you've considered
No alternative
Additional context
You can test by using the following schema: https://github.com/ory/hydra/blob/master/.schema/config.schema.json