Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
ci: add a rustfmt and clippy job (#52)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Sep 18, 2024
1 parent f5c04de commit 5d3654e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,13 @@ jobs:
run: tox run --skip-pkg-install -e ${{ matrix.env }}
env:
PYTEST_ADDOPTS: "-vv --durations=20"

rust-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
- name: Lint
run: cargo clippy --all-targets -- -D warnings
4 changes: 1 addition & 3 deletions rust/src/helpers/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ where
.filter(|x| *x == COMMA || *x == VALUE)
.last()
== Some(COMMA);
let multiline = array_node
.children_with_tokens()
.any(|e| e.kind() == NEWLINE);
let multiline = array_node.children_with_tokens().any(|e| e.kind() == NEWLINE);
let mut value_set = Vec::<Vec<SyntaxElement>>::new();
let entry_set = RefCell::new(Vec::<SyntaxElement>::new());
let mut key_to_pos = HashMap::<String, usize>::new();
Expand Down
4 changes: 3 additions & 1 deletion rust/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ pub fn fix(
}
"dependencies" | "optional-dependencies" => {
transform(entry, &|s| format_requirement(s, keep_full_version));
sort(entry, |e| get_canonic_requirement_name(e).to_lowercase() + " " + &format_requirement(e, keep_full_version));
sort(entry, |e| {
get_canonic_requirement_name(e).to_lowercase() + " " + &format_requirement(e, keep_full_version)
});
}
"dynamic" | "keywords" => {
transform(entry, &|s| String::from(s));
Expand Down

0 comments on commit 5d3654e

Please sign in to comment.