Skip to content

Commit a0ed391

Browse files
committed
chore: Update from '_rust/main' template
2 parents 349ed30 + 87d9ae5 commit a0ed391

File tree

5 files changed

+195
-61
lines changed

5 files changed

+195
-61
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, check, lockfile, docs, rustfmt, clippy, cffconvert]
26+
needs: [test, check, lockfile, docs, rustfmt, clippy, minimal-versions, cffconvert]
2727
runs-on: ubuntu-latest
2828
if: "always()"
2929
steps:
@@ -45,7 +45,7 @@ jobs:
4545
rust: "stable"
4646
features: "full"
4747
- build: mac
48-
os: macos-14
48+
os: macos-latest
4949
rust: "stable"
5050
features: "full"
5151
- build: minimal
@@ -142,6 +142,24 @@ jobs:
142142
- uses: Swatinem/rust-cache@v2
143143
- name: UI Tests
144144
run: make test-ui-${{ matrix.features }}
145+
minimal-versions:
146+
name: Minimal versions
147+
runs-on: ubuntu-latest
148+
steps:
149+
- name: Checkout repository
150+
uses: actions/checkout@v4
151+
- name: Install stable Rust
152+
uses: dtolnay/rust-toolchain@stable
153+
with:
154+
toolchain: stable
155+
- name: Install nightly Rust
156+
uses: dtolnay/rust-toolchain@stable
157+
with:
158+
toolchain: nightly
159+
- name: Downgrade dependencies to minimal versions
160+
run: cargo +nightly generate-lockfile -Z minimal-versions
161+
- name: Compile with minimal versions
162+
run: cargo +stable check --workspace --all-features --locked
145163
lockfile:
146164
runs-on: ubuntu-latest
147165
steps:

.github/workflows/rust-next.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
rust: "beta"
3737
features: "full"
3838
- build: mac
39-
os: macos-14
39+
os: macos-latest
4040
rust: "beta"
4141
features: "full"
4242
- build: nightly
@@ -102,7 +102,7 @@ jobs:
102102
- name: Install shells
103103
if: runner.os == 'Linux'
104104
run: sudo apt-get install -y elvish fish zsh
105-
- name: Update dependencues
105+
- name: Update dependencies
106106
run: cargo update
107107
- name: Build
108108
run: make build-${{matrix.features}}

CONTRIBUTING.md

+36-14
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,42 @@ $ cargo test --test <test_name> --features debug
9999

100100
### Preparing the PR
101101

102-
1. `git rebase` into concise commits and remove `--fixup`s or `wip` commits (`git rebase -i HEAD~NUM` where `NUM` is number of commits back to start the rebase)
103-
2. Push your changes back to your fork (`git push origin $your-branch`)
104-
3. Create a pull request against `master`! (You can also create the pull request first, and we'll merge when ready. This a good way to discuss proposed changes.)
105-
106-
PR expectations:
107-
- Changes are tested and, if needed, documented
108-
- PRs remain small and focused
109-
- If needed, we can put changes behind feature flags as they evolve
110-
- Commits are atomic (i.e. do a single thing)
111-
- Commits are in [Conventional Commit](https://www.conventionalcommits.org/) style
112-
113-
We recognize that these are ideals and we don't want lack of comfort with git
114-
to get in the way of contributing. If you didn't do these, bring it up with
115-
the maintainers and we can help work around this.
102+
As a heads up, we'll be running your PR through the following gauntlet:
103+
- warnings turned to compile errors
104+
- `cargo test`
105+
- `rustfmt`
106+
- `clippy`
107+
- `rustdoc`
108+
- [`committed`](https://github.com/crate-ci/committed) as we use [Conventional](https://www.conventionalcommits.org) commit style
109+
- [`typos`](https://github.com/crate-ci/typos) to check spelling
110+
111+
Not everything can be checked automatically though.
112+
113+
We request that the commit history gets cleaned up.
114+
We ask that commits are atomic, meaning they are complete and have a single responsibility.
115+
PRs should tell a cohesive story, with test and refactor commits that keep the
116+
fix or feature commits simple and clear.
117+
118+
Specifically, we would encouage
119+
- File renames be isolated into their own commit
120+
- Add tests in a commit before their feature or fix, showing the current behavior.
121+
The diff for the feature/fix commit will then show how the behavior changed,
122+
making it clearer to reviewrs and the community and showing people that the
123+
test is verifying the expected state.
124+
- e.g. [clap#5520](https://github.com/clap-rs/clap/pull/5520)
125+
126+
Note that we are talking about ideals.
127+
We understand having a clean history requires more advanced git skills;
128+
feel free to ask us for help!
129+
We might even suggest where it would work to be lax.
130+
We also understand that editing some early commits may cause a lot of churn
131+
with merge conflicts which can make it not worth editing all of the history.
132+
133+
For code organization, we recommend
134+
- Grouping `impl` blocks next to their type (or trait)
135+
- Grouping private items after the `pub` item that uses them.
136+
- 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.
137+
- The exact order is fuzzy; do what makes sense
116138

117139
## Conditions for fulfilling a bounty:
118140

Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ include = [
2727
]
2828

2929
[workspace.lints.rust]
30-
rust_2018_idioms = "warn"
30+
rust_2018_idioms = { level = "warn", priority = -1 }
3131
unreachable_pub = "warn"
3232
unsafe_op_in_unsafe_fn = "warn"
3333
unused_lifetimes = "warn"
@@ -68,7 +68,6 @@ let_and_return = "allow" # sometimes good to name what you are returning
6868
linkedlist = "warn"
6969
lossy_float_literal = "warn"
7070
macro_use_imports = "warn"
71-
match_wildcard_for_single_variants = "warn"
7271
mem_forget = "warn"
7372
mutex_integer = "warn"
7473
needless_continue = "warn"
@@ -83,7 +82,6 @@ rest_pat_in_fully_bound_structs = "warn"
8382
same_functions_in_if_condition = "warn"
8483
self_named_module_files = "warn"
8584
semicolon_if_nothing_returned = "warn"
86-
# single_match_else = "warn"
8785
# str_to_string = "warn"
8886
# string_add = "warn"
8987
string_add_assign = "warn"

deny.toml

+136-40
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,82 @@
44
# * allow - No warning or error will be produced, though in some cases a note
55
# will be
66

7+
# Root options
8+
9+
# The graph table configures how the dependency graph is constructed and thus
10+
# which crates the checks are performed against
11+
[graph]
12+
# If 1 or more target triples (and optionally, target_features) are specified,
13+
# only the specified targets will be checked when running `cargo deny check`.
14+
# This means, if a particular package is only ever used as a target specific
15+
# dependency, such as, for example, the `nix` crate only being used via the
16+
# `target_family = "unix"` configuration, that only having windows targets in
17+
# this list would mean the nix crate, as well as any of its exclusive
18+
# dependencies not shared by any other crates, would be ignored, as the target
19+
# list here is effectively saying which targets you are building for.
20+
targets = [
21+
# The triple can be any string, but only the target triples built in to
22+
# rustc (as of 1.40) can be checked against actual config expressions
23+
#"x86_64-unknown-linux-musl",
24+
# You can also specify which target_features you promise are enabled for a
25+
# particular target. target_features are currently not validated against
26+
# the actual valid features supported by the target architecture.
27+
#{ triple = "wasm32-unknown-unknown", features = ["atomics"] },
28+
]
29+
# When creating the dependency graph used as the source of truth when checks are
30+
# executed, this field can be used to prune crates from the graph, removing them
31+
# from the view of cargo-deny. This is an extremely heavy hammer, as if a crate
32+
# is pruned from the graph, all of its dependencies will also be pruned unless
33+
# they are connected to another crate in the graph that hasn't been pruned,
34+
# so it should be used with care. The identifiers are [Package ID Specifications]
35+
# (https://doc.rust-lang.org/cargo/reference/pkgid-spec.html)
36+
#exclude = []
37+
# If true, metadata will be collected with `--all-features`. Note that this can't
38+
# be toggled off if true, if you want to conditionally enable `--all-features` it
39+
# is recommended to pass `--all-features` on the cmd line instead
40+
all-features = false
41+
# If true, metadata will be collected with `--no-default-features`. The same
42+
# caveat with `all-features` applies
43+
no-default-features = false
44+
# If set, these feature will be enabled when collecting metadata. If `--features`
45+
# is specified on the cmd line they will take precedence over this option.
46+
#features = []
47+
48+
# The output table provides options for how/if diagnostics are outputted
49+
[output]
50+
# When outputting inclusion graphs in diagnostics that include features, this
51+
# option can be used to specify the depth at which feature edges will be added.
52+
# This option is included since the graphs can be quite large and the addition
53+
# of features from the crate(s) to all of the graph roots can be far too verbose.
54+
# This option can be overridden via `--feature-depth` on the cmd line
55+
feature-depth = 1
56+
757
# This section is considered when running `cargo deny check advisories`
858
# More documentation for the advisories section can be found here:
959
# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
1060
[advisories]
11-
# The lint level for security vulnerabilities
12-
vulnerability = "deny"
13-
# The lint level for unmaintained crates
14-
unmaintained = "warn"
15-
# The lint level for crates that have been yanked from their source registry
16-
yanked = "warn"
17-
# The lint level for crates with security notices. Note that as of
18-
# 2019-12-17 there are no security notice advisories in
19-
# https://github.com/rustsec/advisory-db
20-
notice = "warn"
61+
# The path where the advisory databases are cloned/fetched into
62+
#db-path = "$CARGO_HOME/advisory-dbs"
63+
# The url(s) of the advisory databases to use
64+
#db-urls = ["https://github.com/rustsec/advisory-db"]
2165
# A list of advisory IDs to ignore. Note that ignored advisories will still
2266
# output a note when they are encountered.
23-
#
24-
# e.g. "RUSTSEC-0000-0000",
2567
ignore = [
68+
#"RUSTSEC-0000-0000",
69+
#{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" },
70+
#"[email protected]", # you can also ignore yanked crate versions if you wish
71+
#{ crate = "[email protected]", reason = "you can specify why you are ignoring the yanked crate" },
2672
]
73+
# If this is true, then cargo deny will use the git executable to fetch advisory database.
74+
# If this is false, then it uses a built-in git library.
75+
# Setting this to true can be helpful if you have special authentication requirements that cargo-deny does not support.
76+
# See Git Authentication for more information about setting up git authentication.
77+
#git-fetch-with-cli = true
2778

2879
# This section is considered when running `cargo deny check licenses`
2980
# More documentation for the licenses section can be found here:
3081
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
3182
[licenses]
32-
unlicensed = "deny"
3383
# List of explicitly allowed licenses
3484
# See https://spdx.org/licenses/ for list of possible licenses
3585
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
@@ -42,26 +92,8 @@ allow = [
4292
"Unicode-DFS-2016",
4393
"CC0-1.0",
4494
"ISC",
95+
"OpenSSL",
4596
]
46-
# List of explicitly disallowed licenses
47-
# See https://spdx.org/licenses/ for list of possible licenses
48-
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
49-
deny = [
50-
]
51-
# Lint level for licenses considered copyleft
52-
copyleft = "deny"
53-
# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses
54-
# * both - The license will be approved if it is both OSI-approved *AND* FSF
55-
# * either - The license will be approved if it is either OSI-approved *OR* FSF
56-
# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF
57-
# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved
58-
# * neither - This predicate is ignored and the default lint level is used
59-
allow-osi-fsf-free = "neither"
60-
# Lint level used when no other predicates are matched
61-
# 1. License isn't in the allow or deny lists
62-
# 2. License isn't copyleft
63-
# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither"
64-
default = "deny"
6597
# The confidence threshold for detecting a license from license text.
6698
# The higher the value, the more closely the license text must be to the
6799
# canonical license text of a valid SPDX license file.
@@ -72,7 +104,25 @@ confidence-threshold = 0.8
72104
exceptions = [
73105
# Each entry is the crate and version constraint, and its specific allow
74106
# list
75-
#{ allow = ["Zlib"], name = "adler32", version = "*" },
107+
#{ allow = ["Zlib"], crate = "adler32" },
108+
]
109+
110+
# Some crates don't have (easily) machine readable licensing information,
111+
# adding a clarification entry for it allows you to manually specify the
112+
# licensing information
113+
[[licenses.clarify]]
114+
# The package spec the clarification applies to
115+
crate = "ring"
116+
# The SPDX expression for the license requirements of the crate
117+
expression = "MIT AND ISC AND OpenSSL"
118+
# One or more files in the crate's source used as the "source of truth" for
119+
# the license expression. If the contents match, the clarification will be used
120+
# when running the license check, otherwise the clarification will be ignored
121+
# and the crate will be checked normally, which may produce warnings or errors
122+
# depending on the rest of your configuration
123+
license-files = [
124+
# Each entry is a crate relative path, and the (opaque) hash of its contents
125+
{ path = "LICENSE", hash = 0xbd0eed23 }
76126
]
77127

78128
[licenses.private]
@@ -81,6 +131,12 @@ exceptions = [
81131
# To see how to mark a crate as unpublished (to the official registry),
82132
# visit https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field.
83133
ignore = true
134+
# One or more private registries that you might publish crates to, if a crate
135+
# is only published to private registries, and ignore is true, the crate will
136+
# not have its license(s) checked
137+
registries = [
138+
#"https://sekretz.com/registry
139+
]
84140

85141
# This section is considered when running `cargo deny check bans`.
86142
# More documentation about the 'bans' section can be found here:
@@ -89,7 +145,7 @@ ignore = true
89145
# Lint level for when multiple versions of the same crate are detected
90146
multiple-versions = "warn"
91147
# Lint level for when a crate version requirement is `*`
92-
wildcards = "warn"
148+
wildcards = "allow"
93149
# The graph highlighting used when creating dotgraphs for crates
94150
# with multiple versions
95151
# * lowest-version - The path to the lowest versioned duplicate is highlighted
@@ -106,17 +162,53 @@ workspace-default-features = "allow"
106162
external-default-features = "allow"
107163
# List of crates that are allowed. Use with care!
108164
allow = [
109-
#{ name = "ansi_term", version = "=0.11.0" },
165+
166+
#{ crate = "[email protected]", reason = "you can specify a reason it is allowed" },
110167
]
111168
# List of crates to deny
112169
deny = [
113-
# Each entry the name of a crate and a version range. If version is
114-
# not specified, all versions will be matched.
115-
#{ name = "ansi_term", version = "=0.11.0" },
116-
#
170+
171+
#{ crate = "[email protected]", reason = "you can specify a reason it is banned" },
117172
# Wrapper crates can optionally be specified to allow the crate when it
118173
# is a direct dependency of the otherwise banned crate
119-
#{ name = "ansi_term", version = "=0.11.0", wrappers = [] },
174+
#{ crate = "[email protected]", wrappers = ["this-crate-directly-depends-on-ansi_term"] },
175+
]
176+
177+
# List of features to allow/deny
178+
# Each entry the name of a crate and a version range. If version is
179+
# not specified, all versions will be matched.
180+
#[[bans.features]]
181+
#crate = "reqwest"
182+
# Features to not allow
183+
#deny = ["json"]
184+
# Features to allow
185+
#allow = [
186+
# "rustls",
187+
# "__rustls",
188+
# "__tls",
189+
# "hyper-rustls",
190+
# "rustls",
191+
# "rustls-pemfile",
192+
# "rustls-tls-webpki-roots",
193+
# "tokio-rustls",
194+
# "webpki-roots",
195+
#]
196+
# If true, the allowed features must exactly match the enabled feature set. If
197+
# this is set there is no point setting `deny`
198+
#exact = true
199+
200+
# Certain crates/versions that will be skipped when doing duplicate detection.
201+
skip = [
202+
203+
#{ crate = "[email protected]", reason = "you can specify a reason why it can't be updated/removed" },
204+
]
205+
# Similarly to `skip` allows you to skip certain crates during duplicate
206+
# detection. Unlike skip, it also includes the entire tree of transitive
207+
# dependencies starting at the specified crate, up to a certain depth, which is
208+
# by default infinite.
209+
skip-tree = [
210+
#"[email protected]", # will be skipped along with _all_ of its direct and transitive dependencies
211+
#{ crate = "[email protected]", depth = 20 },
120212
]
121213

122214
# This section is considered when running `cargo deny check sources`.
@@ -138,3 +230,7 @@ allow-git = []
138230
[sources.allow-org]
139231
# 1 or more github.com organizations to allow git sources for
140232
github = []
233+
# 1 or more gitlab.com organizations to allow git sources for
234+
gitlab = []
235+
# 1 or more bitbucket.org organizations to allow git sources for
236+
bitbucket = []

0 commit comments

Comments
 (0)