Skip to content

Commit 5faef51

Browse files
authored
Merge pull request #202 from epage/template
chore: Update from '_rust/main' into template
2 parents 6e96e96 + a98422f commit 5faef51

File tree

7 files changed

+192
-63
lines changed

7 files changed

+192
-63
lines changed

.github/workflows/ci.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
permissions:
2424
contents: none
2525
name: CI
26-
needs: [test, msrv, lockfile, docs, rustfmt, clippy]
26+
needs: [test, msrv, lockfile, docs, rustfmt, clippy, minimal-versions]
2727
runs-on: ubuntu-latest
2828
if: "always()"
2929
steps:
@@ -34,7 +34,7 @@ jobs:
3434
name: Test
3535
strategy:
3636
matrix:
37-
os: ["ubuntu-latest", "windows-latest", "macos-14"]
37+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
3838
rust: ["stable"]
3939
continue-on-error: ${{ matrix.rust != 'stable' }}
4040
runs-on: ${{ matrix.os }}
@@ -66,6 +66,24 @@ jobs:
6666
- uses: taiki-e/install-action@cargo-hack
6767
- name: Default features
6868
run: cargo hack check --feature-powerset --locked --rust-version --ignore-private --workspace
69+
minimal-versions:
70+
name: Minimal versions
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v4
75+
- name: Install stable Rust
76+
uses: dtolnay/rust-toolchain@stable
77+
with:
78+
toolchain: stable
79+
- name: Install nightly Rust
80+
uses: dtolnay/rust-toolchain@stable
81+
with:
82+
toolchain: nightly
83+
- name: Downgrade dependencies to minimal versions
84+
run: cargo +nightly generate-lockfile -Z minimal-versions
85+
- name: Compile with minimal versions
86+
run: cargo +stable check --workspace --all-features --locked
6987
lockfile:
7088
runs-on: ubuntu-latest
7189
steps:

.github/workflows/rust-next.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
name: Test
2222
strategy:
2323
matrix:
24-
os: ["ubuntu-latest", "windows-latest", "macos-latest", "macos-14"]
24+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
2525
rust: ["stable", "beta"]
2626
include:
2727
- os: ubuntu-latest
@@ -55,7 +55,7 @@ jobs:
5555
components: rustfmt
5656
- uses: Swatinem/rust-cache@v2
5757
- uses: taiki-e/install-action@cargo-hack
58-
- name: Update dependencues
58+
- name: Update dependencies
5959
run: cargo update
6060
- name: Build
6161
run: cargo test --workspace --no-run

CONTRIBUTING.md

+30-15
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,42 @@ to re-work some of it and the discouragement that goes along with that.
2929

3030
### Process
3131

32-
When you first post a PR, we request that the the commit history get cleaned
33-
up. We recommend avoiding this during the PR to make it easier to review how
34-
feedback was handled. Once the commit is ready, we'll ask you to clean up the
35-
commit history. Once you let us know this is done, we can move forward with
36-
merging! If you are uncomfortable with these parts of git, let us know and we
37-
can help.
38-
39-
For commit messages, we use [Conventional](https://www.conventionalcommits.org)
40-
style. If you already wrote your commits and don't feel comfortable changing
41-
them, don't worry and go ahead and create your PR. We'll work with you on the
42-
best route forward. You can check your branch locally with
43-
[`committed`](https://github.com/crate-ci/committed).
44-
4532
As a heads up, we'll be running your PR through the following gauntlet:
4633
- warnings turned to compile errors
4734
- `cargo test`
4835
- `rustfmt`
4936
- `clippy`
5037
- `rustdoc`
51-
- [`committed`](https://github.com/crate-ci/committed)
52-
- [`typos`](https://github.com/crate-ci/typos)
38+
- [`committed`](https://github.com/crate-ci/committed) as we use [Conventional](https://www.conventionalcommits.org) commit style
39+
- [`typos`](https://github.com/crate-ci/typos) to check spelling
40+
41+
Not everything can be checked automatically though.
42+
43+
We request that the commit history gets cleaned up.
44+
We ask that commits are atomic, meaning they are complete and have a single responsibility.
45+
PRs should tell a cohesive story, with test and refactor commits that keep the
46+
fix or feature commits simple and clear.
47+
48+
Specifically, we would encouage
49+
- File renames be isolated into their own commit
50+
- Add tests in a commit before their feature or fix, showing the current behavior.
51+
The diff for the feature/fix commit will then show how the behavior changed,
52+
making it clearer to reviewrs and the community and showing people that the
53+
test is verifying the expected state.
54+
- e.g. [clap#5520](https://github.com/clap-rs/clap/pull/5520)
55+
56+
Note that we are talking about ideals.
57+
We understand having a clean history requires more advanced git skills;
58+
feel free to ask us for help!
59+
We might even suggest where it would work to be lax.
60+
We also understand that editing some early commits may cause a lot of churn
61+
with merge conflicts which can make it not worth editing all of the history.
62+
63+
For code organization, we recommend
64+
- Grouping `impl` blocks next to their type (or trait)
65+
- Grouping private items after the `pub` item that uses them.
66+
- The intent is to help people quickly find the "relevant" details, allowing them to "dig deeper" as needed. Or put another way, the `pub` items serve as a table-of-contents.
67+
- The exact order is fuzzy; do what makes sense
5368

5469
## Releasing
5570

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ members = ["crates/*"]
33
resolver = "2"
44

55
[workspace.package]
6+
repository = "REPOSITORY"
67
license = "MIT OR Apache-2.0"
78
edition = "2021"
89
rust-version = "1.65.0" # MSRV
@@ -18,7 +19,7 @@ include = [
1819
]
1920

2021
[workspace.lints.rust]
21-
rust_2018_idioms = "warn"
22+
rust_2018_idioms = { level = "warn", priority = -1 }
2223
unreachable_pub = "warn"
2324
unsafe_op_in_unsafe_fn = "warn"
2425
unused_lifetimes = "warn"
@@ -52,15 +53,13 @@ inconsistent_struct_constructor = "warn"
5253
inefficient_to_string = "warn"
5354
infinite_loop = "warn"
5455
invalid_upcast_comparisons = "warn"
55-
items_after_statements = "warn"
5656
large_digit_groups = "warn"
5757
large_stack_arrays = "warn"
5858
large_types_passed_by_value = "warn"
5959
let_and_return = "allow" # sometimes good to name what you are returning
6060
linkedlist = "warn"
6161
lossy_float_literal = "warn"
6262
macro_use_imports = "warn"
63-
match_wildcard_for_single_variants = "warn"
6463
mem_forget = "warn"
6564
mutex_integer = "warn"
6665
needless_continue = "warn"
@@ -75,7 +74,6 @@ rest_pat_in_fully_bound_structs = "warn"
7574
same_functions_in_if_condition = "warn"
7675
self_named_module_files = "warn"
7776
semicolon_if_nothing_returned = "warn"
78-
single_match_else = "warn"
7977
str_to_string = "warn"
8078
string_add = "warn"
8179
string_add_assign = "warn"

crates/anstyle-syntect/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pre-release-replacements = [
2727
[dependencies]
2828
anstyle = { version = "1.0.0", path = "../anstyle" }
2929
syntect = { version = "5.0.0", default-features = false }
30+
thiserror = "1.0.2" # workaround bad minimal dep in syntect
3031

3132
[lints]
3233
workspace = true

0 commit comments

Comments
 (0)