Skip to content

Commit

Permalink
Add clippy to CI
Browse files Browse the repository at this point in the history
This patch adds clippy to the CI and fixes all current clippy warnings.
  • Loading branch information
robin-nitrokey committed Feb 15, 2025
1 parent 84d6c5b commit f2788f3
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 14 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,17 @@ jobs:
components: "rustfmt"
- name: Run rustfmt
run: cargo fmt -- --check

clippy:
name: Run clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: "clippy"
- name: Run clippy
run: cargo clippy --all-features --all-targets
4 changes: 4 additions & 0 deletions generator/src/main/resources/crust/lib.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// ureq v2 has a large error type, thus our errors are large too.
// This will be fixed by updating to ureq v3.
#![allow(clippy::result_large_err)]

#[macro_use]
extern crate serde_derive;

Expand Down
8 changes: 6 additions & 2 deletions generator/src/main/resources/crust/model.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

{{!-- for enum schemas --}}
{{#isEnum}}
/// {{{description}}}
{{#description}}
/// {{{.}}}
{{/description}}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum {{{classname}}} {
{{#allowableValues}}
Expand Down Expand Up @@ -93,7 +95,9 @@ impl {{{classname}}} {
{{!-- for properties that are of enum type --}}
{{#vars}}
{{#isEnum}}
/// {{{description}}}
{{#description}}
/// {{{.}}}
{{/description}}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum {{{enumName}}} {
{{#allowableValues}}
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// ureq v2 has a large error type, thus our errors are large too.
// This will be fixed by updating to ureq v3.
#![allow(clippy::result_large_err)]

#[macro_use]
extern crate serde_derive;

Expand Down
1 change: 0 additions & 1 deletion src/models/decrypt_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DecryptMode {
#[serde(rename = "RAW")]
Expand Down
1 change: 0 additions & 1 deletion src/models/encrypt_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum EncryptMode {
#[serde(rename = "AES_CBC")]
Expand Down
1 change: 0 additions & 1 deletion src/models/key_mechanism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum KeyMechanism {
#[serde(rename = "RSA_Decryption_RAW")]
Expand Down
1 change: 0 additions & 1 deletion src/models/key_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum KeyType {
#[serde(rename = "RSA")]
Expand Down
1 change: 0 additions & 1 deletion src/models/log_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum LogLevel {
#[serde(rename = "debug")]
Expand Down
1 change: 0 additions & 1 deletion src/models/sign_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SignMode {
#[serde(rename = "PKCS1")]
Expand Down
1 change: 0 additions & 1 deletion src/models/switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Switch {
#[serde(rename = "on")]
Expand Down
1 change: 0 additions & 1 deletion src/models/system_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SystemState {
#[serde(rename = "Unprovisioned")]
Expand Down
1 change: 0 additions & 1 deletion src/models/tls_key_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TlsKeyType {
#[serde(rename = "RSA")]
Expand Down
1 change: 0 additions & 1 deletion src/models/user_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Generated by: https://openapi-generator.tech
*/

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum UserRole {
#[serde(rename = "Administrator")]
Expand Down
4 changes: 2 additions & 2 deletions tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async fn test_restore() {
}

fn list_keys(config: &Configuration) -> BTreeSet<String> {
default_api::keys_get(&config, None)
default_api::keys_get(config, None)
.unwrap()
.entity
.into_iter()
Expand All @@ -210,7 +210,7 @@ fn list_keys(config: &Configuration) -> BTreeSet<String> {
}

fn list_namespaces(config: &Configuration) -> BTreeSet<String> {
default_api::namespaces_get(&config)
default_api::namespaces_get(config)
.unwrap()
.entity
.into_iter()
Expand Down

0 comments on commit f2788f3

Please sign in to comment.