Skip to content

Commit

Permalink
Use .is_empty() instead of .len() == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed May 29, 2024
1 parent 4aad069 commit f7ecf31
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Rust linting
on:
pull_request:
paths:
- .github/workflows/linting.yml
- '**/*.rs'
workflow_dispatch:
jobs:
clippy-linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rs/[email protected]
with:
toolchain: stable
profile: minimal
components: clippy
default: true

- name: Clippy check
env:
RUSTFLAGS: --deny warnings
run: cargo clippy --locked --all-targets
2 changes: 1 addition & 1 deletion tests/filter_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ test!(flush_filter_rules {
assert_matches!(pf.flush_rules(ANCHOR_NAME, pfctl::RulesetKind::Filter), Ok(()));
assert_matches!(
pfcli::get_rules(ANCHOR_NAME),
Ok(ref v) if v.len() == 0
Ok(ref v) if v.is_empty()
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/redirect_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test!(flush_redirect_rules {
assert_matches!(pf.flush_rules(ANCHOR_NAME, pfctl::RulesetKind::Redirect), Ok(()));
assert_matches!(
pfcli::get_nat_rules(ANCHOR_NAME),
Ok(ref v) if v.len() == 0
Ok(ref v) if v.is_empty()
);
}
});
Expand Down

0 comments on commit f7ecf31

Please sign in to comment.