Skip to content

Commit 8b5d756

Browse files
committed
Add fmt, clippy in CI
Signed-off-by: Arshdeep54 <balarsh535@gmail.com>
1 parent 04f4650 commit 8b5d756

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

.github/workflows/rust.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Rust CI
2+
3+
on:
4+
push:
5+
branches: ['**']
6+
pull_request:
7+
branches: ['**']
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build_and_test:
14+
name: Build and Test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set Up Rust
21+
uses: actions-rs/toolchain@v1
22+
with:
23+
toolchain: stable
24+
components: clippy, rustfmt
25+
override: true
26+
27+
- name: Cache Cargo Dependencies
28+
uses: Swatinem/rust-cache@v2
29+
30+
- name: Check Code Formatting
31+
run: cargo fmt --all -- --check
32+
33+
- name: Run Clippy (Linter)
34+
run: cargo clippy --all-targets --all-features -- -D warnings
35+
36+
- name: Build Project
37+
run: cargo build --verbose
38+
39+
- name: Run Tests
40+
run: cargo test --verbose

crates/index/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn distance(a: DenseVector, b: DenseVector, dist_type: Similarity) -> f32 {
4242
let score: Vec<f32> = a
4343
.iter()
4444
.zip(b.iter())
45-
.map(|(&x, &y)| (if (x - y) > 1e-8 { 1f32 } else { 0f32 }))
45+
.map(|(&x, &y)| if (x - y) > 1e-8 { 1f32 } else { 0f32 })
4646
.collect();
4747
score.iter().sum::<f32>()
4848
}

0 commit comments

Comments
 (0)