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

[REQ] Rust generated code should follow Clippy suggestions #7270

Open
UkonnRa opened this issue Aug 22, 2020 · 2 comments
Open

[REQ] Rust generated code should follow Clippy suggestions #7270

UkonnRa opened this issue Aug 22, 2020 · 2 comments

Comments

@UkonnRa
Copy link
Contributor

UkonnRa commented Aug 22, 2020

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

@wing328
Copy link
Member

wing328 commented Aug 25, 2020

Good idea 👍

We just did the same for the C petstore client using a different code analysis tool.

I wonder if you can put the full report here so that the community can work on these issues reported by Clippy one by one.

Thank you.

@UkonnRa
Copy link
Contributor Author

UkonnRa commented Aug 25, 2020

Well, that will be a long list, but the main problems are the two mentioned:

warning: you should consider adding a `Default` implementation for `models::error_container::ErrorContainer`
  --> external\kratos-client\src\models\error_container.rs:20:5
   |
20 |     pub fn new() -> ErrorContainer { ErrorContainer { errors: None, id: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(clippy::new_without_default)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
19 | impl Default for models::error_container::ErrorContainer {
20 |     fn default() -> Self {
21 |         Self::new()
22 |     }
23 | }
   |

warning: you should consider adding a `Default` implementation for `models::generic_error::GenericError`
  --> external\kratos-client\src\models\generic_error.rs:21:5
   |
21 |     pub fn new() -> GenericError { GenericError { error: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
19 | impl Default for models::generic_error::GenericError {
20 |     fn default() -> Self {
21 |         Self::new()
22 |     }
23 | }
   |

warning: you should consider adding a `Default` implementation for `models::generic_error_payload::GenericErrorPayload`
  --> external\kratos-client\src\models\generic_error_payload.rs:32:5
   |
32 | /     pub fn new() -> GenericErrorPayload {
33 | |         GenericErrorPayload {
34 | |             code: None,
35 | |             debug: None,
...  |
41 | |         }
42 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
31 | impl Default for models::generic_error_payload::GenericErrorPayload {
32 |     fn default() -> Self {
33 |         Self::new()
34 |     }
35 | }
   |

warning: you should consider adding a `Default` implementation for `models::health_not_ready_status::HealthNotReadyStatus`
  --> external\kratos-client\src\models\health_not_ready_status.rs:19:5
   |
19 |     pub fn new() -> HealthNotReadyStatus { HealthNotReadyStatus { errors: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::health_not_ready_status::HealthNotReadyStatus {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::health_status::HealthStatus`
  --> external\kratos-client\src\models\health_status.rs:19:5
   |
19 |     pub fn new() -> HealthStatus { HealthStatus { status: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::health_status::HealthStatus {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::message::Message`
  --> external\kratos-client\src\models\message.rs:24:5
   |
24 |     pub fn new() -> Message { Message { context: None, id: None, text: None, _type: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
23 | impl Default for models::message::Message {
24 |     fn default() -> Self {
25 |         Self::new()
26 |     }
27 | }
   |

warning: you should consider adding a `Default` implementation for `models::provider_credentials_config::ProviderCredentialsConfig`
  --> external\kratos-client\src\models\provider_credentials_config.rs:20:5
   |
20 | /     pub fn new() -> ProviderCredentialsConfig {
21 | |         ProviderCredentialsConfig { provider: None, subject: None }
22 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
19 | impl Default for models::provider_credentials_config::ProviderCredentialsConfig {
20 |     fn default() -> Self {
21 |         Self::new()
22 |     }
23 | }
   |

warning: you should consider adding a `Default` implementation for `models::recovery_request_method::RecoveryRequestMethod`
  --> external\kratos-client\src\models\recovery_request_method.rs:21:5
   |
21 |     pub fn new() -> RecoveryRequestMethod { RecoveryRequestMethod { config: None, method: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::recovery_request_method::RecoveryRequestMethod {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

warning: you should consider adding a `Default` implementation for `models::registration_request_method::RegistrationRequestMethod`
  --> external\kratos-client\src\models\registration_request_method.rs:21:5
   |
21 | /     pub fn new() -> RegistrationRequestMethod {
22 | |         RegistrationRequestMethod { config: None, method: None }
23 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::registration_request_method::RegistrationRequestMethod {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

warning: you should consider adding a `Default` implementation for `models::settings_request_method::SettingsRequestMethod`
  --> external\kratos-client\src\models\settings_request_method.rs:21:5
   |
21 |     pub fn new() -> SettingsRequestMethod { SettingsRequestMethod { config: None, method: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::settings_request_method::SettingsRequestMethod {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

warning: you should consider adding a `Default` implementation for `models::verification_request::VerificationRequest`
  --> external\kratos-client\src\models\verification_request.rs:39:5
   |
39 | /     pub fn new() -> VerificationRequest {
40 | |         VerificationRequest {
41 | |             expires_at: None,
42 | |             form: None,
...  |
49 | |         }
50 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
37 | impl Default for models::verification_request::VerificationRequest {
38 |     fn default() -> Self {
39 |         Self::new()
40 |     }
41 | }
   |

warning: you should consider adding a `Default` implementation for `models::version::Version`
  --> external\kratos-client\src\models\version.rs:19:5
   |
19 |     pub fn new() -> Version { Version { version: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::version::Version {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: 12 warnings emitted

    Checking kratos v0.1.0 (E:\Workspaces\RustWorkspace\doorknob-rs\kratos)
warning: you should consider adding a `Default` implementation for `models::accept_consent_request::AcceptConsentRequest`
  --> external\hydra-client\src\models\accept_consent_request.rs:30:5
   |
30 | /     pub fn new() -> AcceptConsentRequest {
31 | |         AcceptConsentRequest {
32 | |             grant_access_token_audience: None,
33 | |             grant_scope: None,
...  |
38 | |         }
39 | |     }
   | |_____^
   |
   = note: `#[warn(clippy::new_without_default)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
29 | impl Default for models::accept_consent_request::AcceptConsentRequest {
30 |     fn default() -> Self {
31 |         Self::new()
32 |     }
33 | }
   |

warning: you should consider adding a `Default` implementation for `models::consent_request_session::ConsentRequestSession`
  --> external\hydra-client\src\models\consent_request_session.rs:22:5
   |
22 | /     pub fn new() -> ConsentRequestSession {
23 | |         ConsentRequestSession { access_token: None, id_token: None }
24 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
21 | impl Default for models::consent_request_session::ConsentRequestSession {
22 |     fn default() -> Self {
23 |         Self::new()
24 |     }
25 | }
   |

warning: you should consider adding a `Default` implementation for `models::container_wait_ok_body_error::ContainerWaitOkBodyError`
  --> external\hydra-client\src\models\container_wait_ok_body_error.rs:22:5
   |
22 |     pub fn new() -> ContainerWaitOkBodyError { ContainerWaitOkBodyError { message: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::container_wait_ok_body_error::ContainerWaitOkBodyError {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

warning: you should consider adding a `Default` implementation for `models::flush_inactive_o_auth2_tokens_request::FlushInactiveOAuth2TokensRequest`
  --> external\hydra-client\src\models\flush_inactive_o_auth2_tokens_request.rs:19:5
   |
19 | /     pub fn new() -> FlushInactiveOAuth2TokensRequest {
20 | |         FlushInactiveOAuth2TokensRequest { not_after: None }
21 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::flush_inactive_o_auth2_tokens_request::FlushInactiveOAuth2TokensRequest {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::health_not_ready_status::HealthNotReadyStatus`
  --> external\hydra-client\src\models\health_not_ready_status.rs:19:5
   |
19 |     pub fn new() -> HealthNotReadyStatus { HealthNotReadyStatus { errors: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::health_not_ready_status::HealthNotReadyStatus {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::health_status::HealthStatus`
  --> external\hydra-client\src\models\health_status.rs:19:5
   |
19 |     pub fn new() -> HealthStatus { HealthStatus { status: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::health_status::HealthStatus {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::json_web_key_set::JsonWebKeySet`
  --> external\hydra-client\src\models\json_web_key_set.rs:22:5
   |
22 |     pub fn new() -> JsonWebKeySet { JsonWebKeySet { keys: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::json_web_key_set::JsonWebKeySet {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

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 | }
   |

warning: you should consider adding a `Default` implementation for `models::o_auth2_client::OAuth2Client`
   --> external\hydra-client\src\models\o_auth2_client.rs:111:5
    |
111 | /     pub fn new() -> OAuth2Client {
112 | |         OAuth2Client {
113 | |             allowed_cors_origins: None,
114 | |             audience: None,
...   |
146 | |         }
147 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
    |
110 | impl Default for models::o_auth2_client::OAuth2Client {
111 |     fn default() -> Self {
112 |         Self::new()
113 |     }
114 | }
    |

warning: you should consider adding a `Default` implementation for `models::oauth2_token_response::Oauth2TokenResponse`
  --> external\hydra-client\src\models\oauth2_token_response.rs:31:5
   |
31 | /     pub fn new() -> Oauth2TokenResponse {
32 | |         Oauth2TokenResponse {
33 | |             access_token: None,
34 | |             expires_in: None,
...  |
39 | |         }
40 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
29 | impl Default for models::oauth2_token_response::Oauth2TokenResponse {
30 |     fn default() -> Self {
31 |         Self::new()
32 |     }
33 | }
   |

warning: you should consider adding a `Default` implementation for `models::open_id_connect_context::OpenIdConnectContext`
  --> external\hydra-client\src\models\open_id_connect_context.rs:31:5
   |
31 | /     pub fn new() -> OpenIdConnectContext {
32 | |         OpenIdConnectContext {
33 | |             acr_values: None,
34 | |             display: None,
...  |
38 | |         }
39 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
30 | impl Default for models::open_id_connect_context::OpenIdConnectContext {
31 |     fn default() -> Self {
32 |         Self::new()
33 |     }
34 | }
   |

warning: this function has too many arguments (13/7)
  --> external\hydra-client\src\models\plugin_config.rs:58:5
   |
58 | /     pub fn new(
59 | |         args: crate::models::PluginConfigArgs, description: String, documentation: String,
60 | |         entrypoint: Vec<String>, env: Vec<crate::models::PluginEnv>,
61 | |         interface: crate::models::PluginConfigInterface, ipc_host: bool,
...  |
64 | |         work_dir: String,
65 | |     ) -> PluginConfig {
   | |_____________________^
   |
   = note: `#[warn(clippy::too_many_arguments)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

warning: you should consider adding a `Default` implementation for `models::plugin_config_rootfs::PluginConfigRootfs`
  --> external\hydra-client\src\models\plugin_config_rootfs.rs:25:5
   |
25 |     pub fn new() -> PluginConfigRootfs { PluginConfigRootfs { diff_ids: None, _type: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
23 | impl Default for models::plugin_config_rootfs::PluginConfigRootfs {
24 |     fn default() -> Self {
25 |         Self::new()
26 |     }
27 | }
   |

warning: you should consider adding a `Default` implementation for `models::plugin_config_user::PluginConfigUser`
  --> external\hydra-client\src\models\plugin_config_user.rs:25:5
   |
25 |     pub fn new() -> PluginConfigUser { PluginConfigUser { GID: None, UID: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
23 | impl Default for models::plugin_config_user::PluginConfigUser {
24 |     fn default() -> Self {
25 |         Self::new()
26 |     }
27 | }
   |

warning: you should consider adding a `Default` implementation for `models::previous_consent_session::PreviousConsentSession`
  --> external\hydra-client\src\models\previous_consent_session.rs:35:5
   |
35 | /     pub fn new() -> PreviousConsentSession {
36 | |         PreviousConsentSession {
37 | |             consent_request: None,
38 | |             grant_access_token_audience: None,
...  |
44 | |         }
45 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
33 | impl Default for models::previous_consent_session::PreviousConsentSession {
34 |     fn default() -> Self {
35 |         Self::new()
36 |     }
37 | }
   |

warning: you should consider adding a `Default` implementation for `models::reject_request::RejectRequest`
  --> external\hydra-client\src\models\reject_request.rs:31:5
   |
31 | /     pub fn new() -> RejectRequest {
32 | |         RejectRequest {
33 | |             error: None,
34 | |             error_debug: None,
...  |
38 | |         }
39 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
30 | impl Default for models::reject_request::RejectRequest {
31 |     fn default() -> Self {
32 |         Self::new()
33 |     }
34 | }
   |

warning: you should consider adding a `Default` implementation for `models::userinfo_response::UserinfoResponse`
  --> external\hydra-client\src\models\userinfo_response.rs:76:5
   |
76 | /     pub fn new() -> UserinfoResponse {
77 | |         UserinfoResponse {
78 | |             birthdate: None,
79 | |             email: None,
...  |
97 | |         }
98 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
74 | impl Default for models::userinfo_response::UserinfoResponse {
75 |     fn default() -> Self {
76 |         Self::new()
77 |     }
78 | }
   |

warning: you should consider adding a `Default` implementation for `models::version::Version`
  --> external\hydra-client\src\models\version.rs:19:5
   |
19 |     pub fn new() -> Version { Version { version: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::version::Version {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: structure field `GID` should have a snake case name
  --> external\hydra-client\src\models\plugin_config_user.rs:17:9
   |
17 |     pub GID: Option<i32>,
   |         ^^^ help: convert the identifier to snake case: `gid`
   |
   = note: `#[warn(non_snake_case)]` on by default

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`

warning: 20 warnings emitted

    Checking hydra v0.1.0 (E:\Workspaces\RustWorkspace\doorknob-rs\hydra)
warning: you should consider adding a `Default` implementation for `models::error_container::ErrorContainer`
  --> external\kratos-client\src\models\error_container.rs:20:5
   |
20 |     pub fn new() -> ErrorContainer { ErrorContainer { errors: None, id: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(clippy::new_without_default)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
19 | impl Default for models::error_container::ErrorContainer {
20 |     fn default() -> Self {
21 |         Self::new()
22 |     }
23 | }
   |

warning: you should consider adding a `Default` implementation for `models::generic_error::GenericError`
  --> external\kratos-client\src\models\generic_error.rs:21:5
   |
21 |     pub fn new() -> GenericError { GenericError { error: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
19 | impl Default for models::generic_error::GenericError {
20 |     fn default() -> Self {
21 |         Self::new()
22 |     }
23 | }
   |

warning: you should consider adding a `Default` implementation for `models::generic_error_payload::GenericErrorPayload`
  --> external\kratos-client\src\models\generic_error_payload.rs:32:5
   |
32 | /     pub fn new() -> GenericErrorPayload {
33 | |         GenericErrorPayload {
34 | |             code: None,
35 | |             debug: None,
...  |
41 | |         }
42 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
31 | impl Default for models::generic_error_payload::GenericErrorPayload {
32 |     fn default() -> Self {
33 |         Self::new()
34 |     }
35 | }
   |

warning: you should consider adding a `Default` implementation for `models::health_not_ready_status::HealthNotReadyStatus`
  --> external\kratos-client\src\models\health_not_ready_status.rs:19:5
   |
19 |     pub fn new() -> HealthNotReadyStatus { HealthNotReadyStatus { errors: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::health_not_ready_status::HealthNotReadyStatus {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::health_status::HealthStatus`
  --> external\kratos-client\src\models\health_status.rs:19:5
   |
19 |     pub fn new() -> HealthStatus { HealthStatus { status: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::health_status::HealthStatus {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::message::Message`
  --> external\kratos-client\src\models\message.rs:24:5
   |
24 |     pub fn new() -> Message { Message { context: None, id: None, text: None, _type: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
23 | impl Default for models::message::Message {
24 |     fn default() -> Self {
25 |         Self::new()
26 |     }
27 | }
   |

warning: you should consider adding a `Default` implementation for `models::provider_credentials_config::ProviderCredentialsConfig`
  --> external\kratos-client\src\models\provider_credentials_config.rs:20:5
   |
20 | /     pub fn new() -> ProviderCredentialsConfig {
21 | |         ProviderCredentialsConfig { provider: None, subject: None }
22 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
19 | impl Default for models::provider_credentials_config::ProviderCredentialsConfig {
20 |     fn default() -> Self {
21 |         Self::new()
22 |     }
23 | }
   |

warning: you should consider adding a `Default` implementation for `models::recovery_request_method::RecoveryRequestMethod`
  --> external\kratos-client\src\models\recovery_request_method.rs:21:5
   |
21 |     pub fn new() -> RecoveryRequestMethod { RecoveryRequestMethod { config: None, method: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::recovery_request_method::RecoveryRequestMethod {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

warning: you should consider adding a `Default` implementation for `models::registration_request_method::RegistrationRequestMethod`
  --> external\kratos-client\src\models\registration_request_method.rs:21:5
   |
21 | /     pub fn new() -> RegistrationRequestMethod {
22 | |         RegistrationRequestMethod { config: None, method: None }
23 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::registration_request_method::RegistrationRequestMethod {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

warning: you should consider adding a `Default` implementation for `models::settings_request_method::SettingsRequestMethod`
  --> external\kratos-client\src\models\settings_request_method.rs:21:5
   |
21 |     pub fn new() -> SettingsRequestMethod { SettingsRequestMethod { config: None, method: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::settings_request_method::SettingsRequestMethod {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

warning: you should consider adding a `Default` implementation for `models::verification_request::VerificationRequest`
  --> external\kratos-client\src\models\verification_request.rs:39:5
   |
39 | /     pub fn new() -> VerificationRequest {
40 | |         VerificationRequest {
41 | |             expires_at: None,
42 | |             form: None,
...  |
49 | |         }
50 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
37 | impl Default for models::verification_request::VerificationRequest {
38 |     fn default() -> Self {
39 |         Self::new()
40 |     }
41 | }
   |

warning: you should consider adding a `Default` implementation for `models::version::Version`
  --> external\kratos-client\src\models\version.rs:19:5
   |
19 |     pub fn new() -> Version { Version { version: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::version::Version {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: 12 warnings emitted

      Fixing hydra\src\endpoint_client.rs (1 fix)
warning: you should consider adding a `Default` implementation for `models::accept_consent_request::AcceptConsentRequest`
  --> external\hydra-client\src\models\accept_consent_request.rs:30:5
   |
30 | /     pub fn new() -> AcceptConsentRequest {
31 | |         AcceptConsentRequest {
32 | |             grant_access_token_audience: None,
33 | |             grant_scope: None,
...  |
38 | |         }
39 | |     }
   | |_____^
   |
   = note: `#[warn(clippy::new_without_default)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
29 | impl Default for models::accept_consent_request::AcceptConsentRequest {
30 |     fn default() -> Self {
31 |         Self::new()
32 |     }
33 | }
   |

warning: you should consider adding a `Default` implementation for `models::consent_request_session::ConsentRequestSession`
  --> external\hydra-client\src\models\consent_request_session.rs:22:5
   |
22 | /     pub fn new() -> ConsentRequestSession {
23 | |         ConsentRequestSession { access_token: None, id_token: None }
24 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
21 | impl Default for models::consent_request_session::ConsentRequestSession {
22 |     fn default() -> Self {
23 |         Self::new()
24 |     }
25 | }
   |

warning: you should consider adding a `Default` implementation for `models::container_wait_ok_body_error::ContainerWaitOkBodyError`
  --> external\hydra-client\src\models\container_wait_ok_body_error.rs:22:5
   |
22 |     pub fn new() -> ContainerWaitOkBodyError { ContainerWaitOkBodyError { message: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::container_wait_ok_body_error::ContainerWaitOkBodyError {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

warning: you should consider adding a `Default` implementation for `models::flush_inactive_o_auth2_tokens_request::FlushInactiveOAuth2TokensRequest`
  --> external\hydra-client\src\models\flush_inactive_o_auth2_tokens_request.rs:19:5
   |
19 | /     pub fn new() -> FlushInactiveOAuth2TokensRequest {
20 | |         FlushInactiveOAuth2TokensRequest { not_after: None }
21 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::flush_inactive_o_auth2_tokens_request::FlushInactiveOAuth2TokensRequest {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::health_not_ready_status::HealthNotReadyStatus`
  --> external\hydra-client\src\models\health_not_ready_status.rs:19:5
   |
19 |     pub fn new() -> HealthNotReadyStatus { HealthNotReadyStatus { errors: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::health_not_ready_status::HealthNotReadyStatus {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::health_status::HealthStatus`
  --> external\hydra-client\src\models\health_status.rs:19:5
   |
19 |     pub fn new() -> HealthStatus { HealthStatus { status: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::health_status::HealthStatus {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: you should consider adding a `Default` implementation for `models::json_web_key_set::JsonWebKeySet`
  --> external\hydra-client\src\models\json_web_key_set.rs:22:5
   |
22 |     pub fn new() -> JsonWebKeySet { JsonWebKeySet { keys: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
20 | impl Default for models::json_web_key_set::JsonWebKeySet {
21 |     fn default() -> Self {
22 |         Self::new()
23 |     }
24 | }
   |

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 | }
   |

warning: you should consider adding a `Default` implementation for `models::o_auth2_client::OAuth2Client`
   --> external\hydra-client\src\models\o_auth2_client.rs:111:5
    |
111 | /     pub fn new() -> OAuth2Client {
112 | |         OAuth2Client {
113 | |             allowed_cors_origins: None,
114 | |             audience: None,
...   |
146 | |         }
147 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
    |
110 | impl Default for models::o_auth2_client::OAuth2Client {
111 |     fn default() -> Self {
112 |         Self::new()
113 |     }
114 | }
    |

warning: you should consider adding a `Default` implementation for `models::oauth2_token_response::Oauth2TokenResponse`
  --> external\hydra-client\src\models\oauth2_token_response.rs:31:5
   |
31 | /     pub fn new() -> Oauth2TokenResponse {
32 | |         Oauth2TokenResponse {
33 | |             access_token: None,
34 | |             expires_in: None,
...  |
39 | |         }
40 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
29 | impl Default for models::oauth2_token_response::Oauth2TokenResponse {
30 |     fn default() -> Self {
31 |         Self::new()
32 |     }
33 | }
   |

warning: you should consider adding a `Default` implementation for `models::open_id_connect_context::OpenIdConnectContext`
  --> external\hydra-client\src\models\open_id_connect_context.rs:31:5
   |
31 | /     pub fn new() -> OpenIdConnectContext {
32 | |         OpenIdConnectContext {
33 | |             acr_values: None,
34 | |             display: None,
...  |
38 | |         }
39 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
30 | impl Default for models::open_id_connect_context::OpenIdConnectContext {
31 |     fn default() -> Self {
32 |         Self::new()
33 |     }
34 | }
   |

warning: this function has too many arguments (13/7)
  --> external\hydra-client\src\models\plugin_config.rs:58:5
   |
58 | /     pub fn new(
59 | |         args: crate::models::PluginConfigArgs, description: String, documentation: String,
60 | |         entrypoint: Vec<String>, env: Vec<crate::models::PluginEnv>,
61 | |         interface: crate::models::PluginConfigInterface, ipc_host: bool,
...  |
64 | |         work_dir: String,
65 | |     ) -> PluginConfig {
   | |_____________________^
   |
   = note: `#[warn(clippy::too_many_arguments)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

warning: you should consider adding a `Default` implementation for `models::plugin_config_rootfs::PluginConfigRootfs`
  --> external\hydra-client\src\models\plugin_config_rootfs.rs:25:5
   |
25 |     pub fn new() -> PluginConfigRootfs { PluginConfigRootfs { diff_ids: None, _type: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
23 | impl Default for models::plugin_config_rootfs::PluginConfigRootfs {
24 |     fn default() -> Self {
25 |         Self::new()
26 |     }
27 | }
   |

warning: you should consider adding a `Default` implementation for `models::plugin_config_user::PluginConfigUser`
  --> external\hydra-client\src\models\plugin_config_user.rs:25:5
   |
25 |     pub fn new() -> PluginConfigUser { PluginConfigUser { GID: None, UID: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
23 | impl Default for models::plugin_config_user::PluginConfigUser {
24 |     fn default() -> Self {
25 |         Self::new()
26 |     }
27 | }
   |

warning: you should consider adding a `Default` implementation for `models::previous_consent_session::PreviousConsentSession`
  --> external\hydra-client\src\models\previous_consent_session.rs:35:5
   |
35 | /     pub fn new() -> PreviousConsentSession {
36 | |         PreviousConsentSession {
37 | |             consent_request: None,
38 | |             grant_access_token_audience: None,
...  |
44 | |         }
45 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
33 | impl Default for models::previous_consent_session::PreviousConsentSession {
34 |     fn default() -> Self {
35 |         Self::new()
36 |     }
37 | }
   |

warning: you should consider adding a `Default` implementation for `models::reject_request::RejectRequest`
  --> external\hydra-client\src\models\reject_request.rs:31:5
   |
31 | /     pub fn new() -> RejectRequest {
32 | |         RejectRequest {
33 | |             error: None,
34 | |             error_debug: None,
...  |
38 | |         }
39 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
30 | impl Default for models::reject_request::RejectRequest {
31 |     fn default() -> Self {
32 |         Self::new()
33 |     }
34 | }
   |

warning: you should consider adding a `Default` implementation for `models::userinfo_response::UserinfoResponse`
  --> external\hydra-client\src\models\userinfo_response.rs:76:5
   |
76 | /     pub fn new() -> UserinfoResponse {
77 | |         UserinfoResponse {
78 | |             birthdate: None,
79 | |             email: None,
...  |
97 | |         }
98 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
74 | impl Default for models::userinfo_response::UserinfoResponse {
75 |     fn default() -> Self {
76 |         Self::new()
77 |     }
78 | }
   |

warning: you should consider adding a `Default` implementation for `models::version::Version`
  --> external\hydra-client\src\models\version.rs:19:5
   |
19 |     pub fn new() -> Version { Version { version: None } }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
18 | impl Default for models::version::Version {
19 |     fn default() -> Self {
20 |         Self::new()
21 |     }
22 | }
   |

warning: structure field `GID` should have a snake case name
  --> external\hydra-client\src\models\plugin_config_user.rs:17:9
   |
17 |     pub GID: Option<i32>,
   |         ^^^ help: convert the identifier to snake case: `gid`
   |
   = note: `#[warn(non_snake_case)]` on by default

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`

warning: 20 warnings emitted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants