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 0ede95c
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 77 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: CI

on: [push, pull_request]

env:
RUSTFLAGS: --deny warnings

jobs:
check:
name: Check library
Expand Down Expand Up @@ -42,3 +45,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
1 change: 0 additions & 1 deletion generator/src/main/resources/crust/reqwest/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ impl {{{operationIdCamelCase}}}Error {
{{#notes}}
/// {{{.}}}
{{/notes}}

{{#vendorExtensions.x-consumeMultipleMediaTypes}}
pub fn {{{operationId}}}(configuration: &configuration::Configuration, {{#allParams}} {{#isBodyParam}} body : {{{operationIdCamelCase}}}Body{{/isBodyParam}}
{{^isBodyParam}} {{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}}
Expand Down
Loading

0 comments on commit 0ede95c

Please sign in to comment.