Skip to content

Commit 2f93cda

Browse files
authored
chore: Update from _rust/main template (#664)
2 parents 14bfe26 + 8ff96c1 commit 2f93cda

File tree

12 files changed

+62
-42
lines changed

12 files changed

+62
-42
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[resolver]
2+
incompatible-rust-versions = "fallback"

.github/renovate.json5

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
customManagers: [
1010
{
1111
customType: 'regex',
12-
fileMatch: [
13-
'^rust-toolchain\\.toml$',
14-
'Cargo.toml$',
15-
'clippy.toml$',
16-
'\\.clippy.toml$',
17-
'^\\.github/workflows/ci.yml$',
18-
'^\\.github/workflows/rust-next.yml$',
12+
managerFilePatterns: [
13+
'/^rust-toolchain\\.toml$/',
14+
'/Cargo.toml$/',
15+
'/clippy.toml$/',
16+
'/\\.clippy.toml$/',
17+
'/^\\.github/workflows/ci.yml$/',
18+
'/^\\.github/workflows/rust-next.yml$/',
1919
],
2020
matchStrings: [
2121
'STABLE.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',

.github/workflows/ci.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,8 @@ jobs:
4949
- uses: taiki-e/install-action@cargo-hack
5050
- name: Build
5151
run: cargo test --workspace --no-run
52-
- name: Default features
53-
run: cargo test --workspace
54-
- name: All features
55-
run: cargo test --workspace --all-features
56-
- name: No-default features
57-
run: cargo test --workspace --no-default-features
52+
- name: Test
53+
run: cargo hack test --each-feature --workspace
5854
msrv:
5955
name: "Check MSRV"
6056
runs-on: ubuntu-latest
@@ -68,7 +64,7 @@ jobs:
6864
- uses: Swatinem/rust-cache@v2
6965
- uses: taiki-e/install-action@cargo-hack
7066
- name: Default features
71-
run: cargo hack check --feature-powerset --locked --rust-version --ignore-private --workspace --all-targets
67+
run: cargo hack check --each-feature --locked --rust-version --ignore-private --workspace --all-targets --keep-going
7268
minimal-versions:
7369
name: Minimal versions
7470
runs-on: ubuntu-latest
@@ -88,7 +84,7 @@ jobs:
8884
- name: Hack around bad deps
8985
run: cargo update --recursive json5
9086
- name: Compile with minimal versions
91-
run: cargo +stable check --workspace --all-features --locked
87+
run: cargo +stable check --workspace --all-features --locked --keep-going
9288
lockfile:
9389
runs-on: ubuntu-latest
9490
steps:
@@ -115,7 +111,7 @@ jobs:
115111
- name: Check documentation
116112
env:
117113
RUSTDOCFLAGS: -D warnings
118-
run: cargo doc --workspace --all-features --no-deps --document-private-items
114+
run: cargo doc --workspace --all-features --no-deps --document-private-items --keep-going
119115
rustfmt:
120116
name: rustfmt
121117
runs-on: ubuntu-latest
@@ -150,7 +146,7 @@ jobs:
150146
run: cargo install sarif-fmt --locked
151147
- name: Check
152148
run: >
153-
cargo clippy --workspace --all-features --all-targets --message-format=json -- -D warnings --allow deprecated
149+
cargo clippy --workspace --all-features --all-targets --message-format=json
154150
| clippy-sarif
155151
| tee clippy-results.sarif
156152
| sarif-fmt
@@ -161,7 +157,7 @@ jobs:
161157
sarif_file: clippy-results.sarif
162158
wait-for-processing: true
163159
- name: Report status
164-
run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated
160+
run: cargo clippy --workspace --all-features --all-targets --keep-going -- -D warnings --allow deprecated
165161
coverage:
166162
name: Coverage
167163
runs-on: ubuntu-latest

.github/workflows/rust-next.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ jobs:
3939
- uses: taiki-e/install-action@cargo-hack
4040
- name: Build
4141
run: cargo test --workspace --no-run
42-
- name: Default features
43-
run: cargo test --workspace
44-
- name: All features
45-
run: cargo test --workspace --all-features
46-
- name: No-default features
47-
run: cargo test --workspace --no-default-features
42+
- name: Test
43+
run: cargo hack test --each-feature --workspace
4844
latest:
4945
name: "Check latest dependencies"
5046
runs-on: ubuntu-latest
@@ -62,4 +58,4 @@ jobs:
6258
- name: Build
6359
run: cargo test --workspace --no-run
6460
- name: Test
65-
run: cargo hack test --feature-powerset --workspace
61+
run: cargo hack test --each-feature --workspace

.pre-commit-config.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1+
exclude: |
2+
(?x)^(
3+
tests/.*|
4+
examples/.*
5+
)$
6+
default_install_hook_types: ["pre-commit", "commit-msg"]
17
repos:
28
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
9+
rev: v5.0.0
410
hooks:
11+
- id: check-yaml
12+
- id: check-json
13+
- id: check-toml
514
- id: check-merge-conflict
6-
stages: [commit]
715
- id: check-case-conflict
8-
stages: [commit]
16+
- id: detect-private-key
917
- repo: https://github.com/crate-ci/typos
10-
rev: v1.26.0
18+
rev: v1.32.0
1119
hooks:
1220
- id: typos
13-
stages: [commit]
1421
- repo: https://github.com/crate-ci/committed
15-
rev: v1.0.20
22+
rev: v1.1.7
1623
hooks:
1724
- id: committed
18-
stages: [commit-msg]

CONTRIBUTING.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ appreciate any level you're willing to do.
77

88
Need some new functionality to help? You can let us know by opening an
99
[issue][new issue]. It's helpful to look through [all issues][all issues] in
10-
case its already being talked about.
10+
case it's already being talked about.
1111

1212
## Bug Reports
1313

1414
Please let us know about what problems you run into, whether in behavior or
1515
ergonomics of API. You can do this by opening an [issue][new issue]. It's
16-
helpful to look through [all issues][all issues] in case its already being
16+
helpful to look through [all issues][all issues] in case it's already being
1717
talked about.
1818

1919
## Pull Requests
2020

21-
Looking for an idea? Check our [issues][issues]. If it's look more open ended,
21+
Looking for an idea? Check our [issues][issues]. If the issue looks open ended,
2222
it is probably best to post on the issue how you are thinking of resolving the
2323
issue so you can get feedback early in the process. We want you to be
2424
successful and it can be discouraging to find out a lot of re-work is needed.
@@ -41,15 +41,18 @@ As a heads up, we'll be running your PR through the following gauntlet:
4141
Not everything can be checked automatically though.
4242

4343
We request that the commit history gets cleaned up.
44+
4445
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+
A complete commit should build, pass tests, update documentation and tests, and not have dead code.
47+
48+
PRs should tell a cohesive story, with refactor and test commits that keep the
4649
fix or feature commits simple and clear.
4750

4851
Specifically, we would encourage
4952
- File renames be isolated into their own commit
50-
- Add tests in a commit before their feature or fix, showing the current behavior.
53+
- Add tests in a commit before their feature or fix, showing the current behavior (i.e. they should pass).
5154
The diff for the feature/fix commit will then show how the behavior changed,
52-
making it clearer to reviewers and the community and showing people that the
55+
making the commit's intent clearer to reviewers and the community, and showing people that the
5356
test is verifying the expected state.
5457
- e.g. [clap#5520](https://github.com/clap-rs/clap/pull/5520)
5558

Cargo.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ include = [
1313
"Cargo.lock",
1414
"LICENSE*",
1515
"README.md",
16-
"benches/**/*",
1716
"examples/**/*"
1817
]
1918

2019
[workspace.lints.rust]
2120
rust_2018_idioms = { level = "warn", priority = -1 }
21+
unnameable_types = "warn"
2222
unreachable_pub = "warn"
2323
unsafe_op_in_unsafe_fn = "warn"
2424
unused_lifetimes = "warn"
@@ -61,7 +61,7 @@ lossy_float_literal = "warn"
6161
macro_use_imports = "warn"
6262
mem_forget = "warn"
6363
mutex_integer = "warn"
64-
needless_continue = "warn"
64+
needless_continue = "allow"
6565
needless_for_each = "warn"
6666
negative_feature_names = "warn"
6767
path_buf_push_overwrite = "warn"
@@ -70,6 +70,7 @@ rc_mutex = "warn"
7070
redundant_feature_names = "warn"
7171
ref_option_ref = "warn"
7272
rest_pat_in_fully_bound_structs = "warn"
73+
result_large_err = "allow"
7374
same_functions_in_if_condition = "warn"
7475
self_named_module_files = "warn"
7576
semicolon_if_nothing_returned = "warn"
@@ -85,6 +86,15 @@ verbose_file_reads = "warn"
8586
wildcard_imports = "warn"
8687
zero_sized_map_values = "warn"
8788

89+
[profile.dev]
90+
panic = "abort"
91+
92+
[profile.release]
93+
panic = "abort"
94+
codegen-units = 1
95+
lto = true
96+
# debug = "line-tables-only" # requires Cargo 1.71
97+
8898
[package]
8999
name = "config"
90100
version = "0.15.11"

deny.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ allow = [
8787
"MIT",
8888
"MIT-0",
8989
"Apache-2.0",
90+
"BSD-2-Clause",
9091
"BSD-3-Clause",
9192
"MPL-2.0",
9293
"Unicode-DFS-2016",

src/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::result;
55
use serde::de;
66
use serde::ser;
77

8+
#[allow(unnameable_types)] // Unsure if/how to expose this
89
#[derive(Debug)]
910
pub enum Unexpected {
1011
Bool(bool),

src/file/source/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ where
1717
) -> Result<FileSourceResult, Box<dyn Error + Send + Sync>>;
1818
}
1919

20+
#[allow(unnameable_types)] // Unsure if/how to expose this
2021
pub struct FileSourceResult {
2122
pub(crate) uri: Option<String>,
2223
pub(crate) content: String,

0 commit comments

Comments
 (0)