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

Commit 5d3654e

Browse files
authored
ci: add a rustfmt and clippy job (#52)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent f5c04de commit 5d3654e

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.github/workflows/check.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,13 @@ jobs:
8282
run: tox run --skip-pkg-install -e ${{ matrix.env }}
8383
env:
8484
PYTEST_ADDOPTS: "-vv --durations=20"
85+
86+
rust-check:
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v4
90+
- uses: actions-rust-lang/setup-rust-toolchain@v1
91+
- name: Rustfmt Check
92+
uses: actions-rust-lang/rustfmt@v1
93+
- name: Lint
94+
run: cargo clippy --all-targets -- -D warnings

rust/src/helpers/array.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ where
3737
.filter(|x| *x == COMMA || *x == VALUE)
3838
.last()
3939
== Some(COMMA);
40-
let multiline = array_node
41-
.children_with_tokens()
42-
.any(|e| e.kind() == NEWLINE);
40+
let multiline = array_node.children_with_tokens().any(|e| e.kind() == NEWLINE);
4341
let mut value_set = Vec::<Vec<SyntaxElement>>::new();
4442
let entry_set = RefCell::new(Vec::<SyntaxElement>::new());
4543
let mut key_to_pos = HashMap::<String, usize>::new();

rust/src/project.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ pub fn fix(
5555
}
5656
"dependencies" | "optional-dependencies" => {
5757
transform(entry, &|s| format_requirement(s, keep_full_version));
58-
sort(entry, |e| get_canonic_requirement_name(e).to_lowercase() + " " + &format_requirement(e, keep_full_version));
58+
sort(entry, |e| {
59+
get_canonic_requirement_name(e).to_lowercase() + " " + &format_requirement(e, keep_full_version)
60+
});
5961
}
6062
"dynamic" | "keywords" => {
6163
transform(entry, &|s| String::from(s));

0 commit comments

Comments
 (0)