Skip to content

Commit

Permalink
Add clippy and formatting to CI (#59)
Browse files Browse the repository at this point in the history
* add clippy and formatting to ci

* fix clippy warnings

* pin rust version for tests
  • Loading branch information
PgBiel authored Sep 26, 2024
1 parent a43de9c commit 3dd8eed
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
name: Continuous integration
on: [push, pull_request]

env:
RUSTFLAGS: "-Dwarnings"
RUSTDOCFLAGS: "-Dwarnings"

jobs:
ci:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.81.0
- run: cargo build
- run: cargo test

checks:
name: Check clippy, formatting, and documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.81.0
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --workspace --all-targets --all-features
- run: cargo fmt --check --all
- run: cargo doc --workspace --no-deps
8 changes: 4 additions & 4 deletions src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,11 @@ pub(crate) fn split_token_lists(vals: ChunksRef, keyword: &str) -> Vec<Chunks> {
///
/// For Normal Chunks,
/// - The leading/trailing keyword is not considered as a valid split
/// (regardless of whether the keyword is preceded/followed by some
/// whitespace).
/// (regardless of whether the keyword is preceded/followed by some
/// whitespace).
/// - If there are consecutive keywords, the characters between two consecutive
/// keywords (whether only whitespace or not) will be considered as a valid
/// split.
/// keywords (whether only whitespace or not) will be considered as a valid
/// split.
pub(crate) fn split_token_lists_with_kw(vals: ChunksRef, keyword: &str) -> Vec<Chunks> {
let mut out = vec![];
let mut latest = vec![];
Expand Down
2 changes: 1 addition & 1 deletion src/types/person.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Person {
let prefix = person.remove("prefix").unwrap_or_default();
let suffix = person.remove("suffix").unwrap_or_default();

return Self { name, given_name, prefix, suffix };
Self { name, given_name, prefix, suffix }
}

fn parse_bibtex(chunks: ChunksRef) -> Self {
Expand Down

0 comments on commit 3dd8eed

Please sign in to comment.