Skip to content

Commit 7e40eed

Browse files
committed
switch to stable rust and reformat imports
1 parent c89f46f commit 7e40eed

File tree

27 files changed

+109
-131
lines changed

27 files changed

+109
-131
lines changed

.github/workflows/bench.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
with:
1717
lfs: true
1818

19-
- run: rustup toolchain install nightly --profile minimal --no-self-update
19+
- run: rustup toolchain install stable --profile minimal --no-self-update
20+
- uses: Swatinem/rust-cache@v2
2021
- uses: cargo-bins/cargo-binstall@main
2122
- run: cargo binstall cargo-codspeed
2223

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222

23-
- run: rustup toolchain install nightly --profile minimal --component rustfmt --component clippy --no-self-update
23+
- run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy --no-self-update
24+
- uses: Swatinem/rust-cache@v2
2425

2526
- run: cargo fmt --all -- --check
2627
- run: cargo clippy --all-features --workspace --tests --examples -- -D clippy::all
@@ -46,7 +47,8 @@ jobs:
4647
steps:
4748
- uses: actions/checkout@v4
4849

49-
- run: rustup toolchain install nightly --profile minimal --no-self-update
50+
- run: rustup toolchain install stable --profile minimal --no-self-update
51+
- uses: Swatinem/rust-cache@v2
5052

5153
- run: cargo test --workspace --all-features --doc
5254
- run: cargo doc --workspace --all-features --document-private-items --no-deps
@@ -57,14 +59,12 @@ jobs:
5759
steps:
5860
- uses: actions/checkout@v4
5961

60-
- run: rustup toolchain install nightly --profile minimal --no-self-update
62+
- run: rustup toolchain install stable --profile minimal --no-self-update
63+
- uses: Swatinem/rust-cache@v2
6164
- uses: taiki-e/install-action@cargo-llvm-cov
6265
- uses: taiki-e/install-action@nextest
6366

64-
# FIXME(swatinem): We should pass `--all-targets` to also compile and tests benchmarks
65-
# Though currently `divan` does not support all CLI arguments as used by `nextest`,
66-
# and benchmarks are unbearably slow anyway, so its not feasible to run in debug builds.
67-
- run: cargo llvm-cov nextest --lcov --output-path core.lcov --workspace --all-features
67+
- run: cargo llvm-cov nextest --lcov --output-path core.lcov --workspace --all-features --all-targets
6868
- run: mv target/nextest/default/core-test-results.xml .
6969

7070
- uses: actions/setup-python@v5

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@ All details (e.g. SQLite schema, code interfaces) subject to breaking changes un
1717
## Developing
1818

1919
Set up your development environment:
20-
- Install the nightly compiler via [rustup](https://rustup.rs/). At time of writing, `codecov-rs` requires the nightly compiler for niceties such as `#[feature(trait_alias)]`.
20+
2121
- To work on the Python bindings, run `source .envrc` (or use `direnv`) to set up a virtual environment. Update development dependencies with `pip install -r python/requirements.dev.txt`
2222
- Install lint hooks with `pip install pre-commit && pre-commit install`.
2323
- Large sample test reports are checked in using [Git LFS](https://git-lfs.com/) in `test_utils/fixtures/**/large` directories (e.g. `test_utils/fixtures/pyreport/large`). Tests and benchmarks may reference them so installing it yourself is recommended.
2424

2525
`codecov-rs` aims to serve as effective documentation for every flavor of every format it supports. To that end, the following are greatly appreciated in submissions:
26+
2627
- Thorough doc comments (`///` / `/**`). For parsers, include snippets that show what inputs look like
2728
- Granular, in-module unit tests
2829
- Integration tests with real-world samples (that are safe to distribute; don't send us data from your private repo)
2930

3031
The `core/examples/` directory contains runnable commands for developers including:
32+
3133
- `parse_pyreport`: converts a given pyreport into a SQLite report
3234
- `sql_to_pyreport`: converts a given SQLite report into a pyreport (report JSON + chunks file)
3335

@@ -53,9 +55,8 @@ New parsers should be optional via Cargo features. Adding them to the default fe
5355
Where possible, parsers should not load their entire input or output into RAM. On the input side, you can avoid that with a _streaming_ parser or by using `memmap2` to map the input file into virtual memory. SQLite makes it straightforward enough to stream outputs to the database.
5456

5557
Coverage formats really run the gamut so there's no one-size-fits-all framework we can use. Some options:
58+
5659
- [`quick_xml`](https://crates.io/crates/quick_xml), a streaming XML parser
57-
- [`winnow`](https://crates.io/crates/winnow), a parser combinator framework (fork of [`nom`](https://crates.io/crates/nom))
58-
- `winnow`'s docs illustrate [how one can write a streaming parser](https://docs.rs/winnow/latest/winnow/_topic/partial/index.html)
5960
- [`serde`](https://serde.rs/), a popular serialization/deserialization framework
6061
- `serde`'s docs illustrate [how one can write a streaming parser](https://serde.rs/stream-array.html)
6162

@@ -64,6 +65,7 @@ Non-XML formats lack clean OOTB support for streaming so `codecov-rs` currently
6465
### Testing
6566

6667
Run tests with:
68+
6769
```
6870
# Rust tests
6971
$ cargo test
@@ -75,6 +77,7 @@ $ pytest
7577
### Benchmarks
7678

7779
Run benchmarks with:
80+
7881
```
7982
$ cargo bench --features testing
8083
```

bindings/src/error.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pub use codecov_rs::error::CodecovError as RsCodecovError;
2-
use pyo3::{exceptions::PyRuntimeError, prelude::*};
2+
use pyo3::exceptions::PyRuntimeError;
3+
use pyo3::prelude::*;
34

45
pub struct PyCodecovError(RsCodecovError);
56

bindings/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use std::{fs::File, path::PathBuf};
1+
use std::fs::File;
2+
use std::path::PathBuf;
23

34
use codecov_rs::{parsers, report};
45
use pyo3::prelude::*;

core/benches/pyreport.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::collections::HashMap;
22

3-
use codecov_rs::{
4-
parsers::pyreport::{chunks, report_json},
5-
test_utils::test_report::TestReportBuilder,
6-
};
3+
use codecov_rs::parsers::pyreport::{chunks, report_json};
4+
use codecov_rs::test_utils::test_report::TestReportBuilder;
75
use criterion::{criterion_group, criterion_main, Criterion};
8-
use test_utils::fixtures::{read_fixture, FixtureFormat::Pyreport, FixtureSize::Large};
6+
use test_utils::fixtures::read_fixture;
7+
use test_utils::fixtures::FixtureFormat::Pyreport;
8+
use test_utils::fixtures::FixtureSize::Large;
99

1010
criterion_group!(
1111
benches,

core/examples/parse_pyreport.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
use std::{env, fs::File, path::PathBuf};
1+
use std::env;
2+
use std::fs::File;
3+
use std::path::PathBuf;
24

3-
use codecov_rs::{error::Result, parsers::pyreport::parse_pyreport, report::SqliteReportBuilder};
5+
use codecov_rs::error::Result;
6+
use codecov_rs::parsers::pyreport::parse_pyreport;
7+
use codecov_rs::report::SqliteReportBuilder;
48

59
fn usage_error() -> ! {
610
println!("Usage:");

core/examples/sql_to_pyreport.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use std::{env, fs::File};
1+
use std::env;
2+
use std::fs::File;
23

3-
use codecov_rs::{
4-
error::Result,
5-
report::{pyreport::ToPyreport, SqliteReport},
6-
};
4+
use codecov_rs::error::Result;
5+
use codecov_rs::report::pyreport::ToPyreport;
6+
use codecov_rs::report::SqliteReport;
77

88
fn usage_error() -> ! {
99
println!("Usage:");

core/src/error.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ pub enum CodecovError {
1515
#[error("report builder error: '{0}'")]
1616
ReportBuilderError(String),
1717

18-
// Can't use #[from]
19-
#[error("parser error: '{0}'")]
20-
ParserError(winnow::error::ContextError),
21-
2218
#[error("parser error: '{0}'")]
2319
Json(#[from] serde_json::Error),
2420

core/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(trait_alias)]
2-
31
pub mod report;
42

53
pub mod parsers;

0 commit comments

Comments
 (0)