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

ci: add a rustfmt and clippy job #52

Merged
merged 1 commit into from
Sep 18, 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
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