Run clippy in CI (#2443)

* Run clippy in CI

* Fix clippy warnings in build output

* Update PR template
This commit is contained in:
marc0246 2024-01-05 09:08:36 +01:00 committed by GitHub
parent e243c2699d
commit e7f37adfa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 8 deletions

View File

@ -2,16 +2,18 @@
2. [ ] Make sure that the changes are covered by unit-tests. 2. [ ] Make sure that the changes are covered by unit-tests.
3. [ ] Run `cargo +nightly fmt` on the changes. 3. [ ] Run `cargo clippy` on the changes.
4. [ ] Please put changelog entries **in the description of this Pull Request** 4. [ ] Run `cargo +nightly fmt` on the changes.
5. [ ] Please put changelog entries **in the description of this Pull Request**
if knowledge of this change could be valuable to users. No need to put the if knowledge of this change could be valuable to users. No need to put the
entries to the changelog directly, they will be transferred to the changelog entries to the changelog directly, they will be transferred to the changelog
file by maintainers right after the Pull Request merge. file by maintainers right after the Pull Request merge.
Please remove any items from the template below that are not applicable. Please remove any items from the template below that are not applicable.
5. [ ] Describe in common words what is the purpose of this change, related 6. [ ] Describe in common words what is the purpose of this change, related
Github Issues, and highlight important implementation aspects. Github Issues, and highlight important implementation aspects.
Changelog: Changelog:

View File

@ -51,11 +51,19 @@ jobs:
run: | run: |
cd examples cd examples
cargo build --verbose cargo build --verbose
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run clippy check
run: |
rustup component add clippy
cargo clippy -- -Dwarnings
fmt: fmt:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Check formatting - name: Run fmt check
run: | run: |
rustup toolchain install nightly --component rustfmt rustup toolchain install nightly --component rustfmt
cargo +nightly fmt --check cargo +nightly fmt --check

View File

@ -254,13 +254,18 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream {
} }
} }
}, },
); )
.collect::<Vec<_>>();
if requires_all_of_items.is_empty() {
quote! {}
} else {
quote! { quote! {
if self.#name { if self.#name {
#(#requires_all_of_items)* #(#requires_all_of_items)*
} }
} }
}
}, },
); );