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

Add clippy CI and fail on warnings #24

Merged
merged 5 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
pull_request:
workflow_dispatch:

env:
RUSTFLAGS: "-Dwarnings"

jobs:
build:
strategy:
Expand All @@ -18,6 +21,8 @@ jobs:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install -y libadwaita-1-dev libgtk-4-dev
Expand All @@ -26,3 +31,5 @@ jobs:
run: brew install libadwaita gtk4
- name: Build and Test
run: cargo test --all --all-features
- name: Lint
run: cargo clippy --all-targets --all-features
10 changes: 9 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@ on:
- '*'
workflow_dispatch:

# Fail CI on warnings
env:
RUSTFLAGS: "-Dwarnings"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Install system dependencies
run: sudo apt-get install -y libadwaita-1-dev libgtk-4-dev
- name: Test package
run: cargo test
run: cargo test --all --all-features
- name: Lint package
run: cargo clippy --all-targets --all-features
- name: Publish nuit-derive
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
working-directory: nuit-derive
Expand Down
1 change: 1 addition & 0 deletions nuit-bridge-swiftui/rust/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(target_vendor = "apple")]
use nuit_core::CRoot;

#[cfg(target_vendor = "apple")]
Expand Down
2 changes: 1 addition & 1 deletion nuit-derive/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn derive(input: TokenStream) -> TokenStream {
new_child.value().record_diff(old_child.value(), &id_path.child(new_child.id().clone()), difference);
}

fn recurse_on_container<'a>(new_child_container: &'a Vec<Identified<#name>>, old_child_container: &'a Vec<Identified<#name>>, id_path: &IdPath, difference: &mut Difference<&'a #name>) {
fn recurse_on_container<'a>(new_child_container: &'a [Identified<#name>], old_child_container: &'a [Identified<#name>], id_path: &IdPath, difference: &mut Difference<&'a #name>) {
let new_children: HashMap<&Id, &Identified<#name>> = new_child_container.iter().map(|c| (c.id(), c)).collect();
let old_children: HashMap<&Id, &Identified<#name>> = old_child_container.iter().map(|c| (c.id(), c)).collect();

Expand Down
Loading