Skip to content

Commit b905474

Browse files
committed
chore: rework workspace params, MSRV 1.64
* Move common workspace settings to the `[workspace]` sections in the root. * Remove Cargo settings that are identical to the defaults (per Cargo [recommendations](https://doc.rust-lang.org/cargo/reference/manifest.html)) * Add common clippy lint configuration * These require MSRV 1.64 `workspace-inheritance` feature * Fix perl-based method to extract MSRV
1 parent bf63904 commit b905474

File tree

7 files changed

+57
-35
lines changed

7 files changed

+57
-35
lines changed

.github/workflows/ci.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
name: Verify build
3535
strategy:
3636
matrix:
37-
toolchain: [stable, nightly, 1.63.0]
37+
toolchain: [stable, nightly, 1.64.0]
3838
os: [ubuntu-24.04, macos-14, windows-2022]
3939
include:
4040
- toolchain: beta
@@ -49,7 +49,7 @@ jobs:
4949
- name: Update RUSTFLAGS
5050
run: |
5151
set -eux
52-
[ "${{ matrix.toolchain }}" = "1.63.0" ] && echo 'RUSTFLAGS=' >> "$GITHUB_ENV" || true
52+
[ "${{ matrix.toolchain }}" = "1.64.0" ] && echo 'RUSTFLAGS=' >> "$GITHUB_ENV" || true
5353
5454
- name: Setup Rust toolchain
5555
run: ./ci/install-rust.sh
@@ -255,7 +255,7 @@ jobs:
255255
steps:
256256
- uses: actions/checkout@master
257257
- run: |
258-
msrv="$(perl -ne 'print if s/rust-version\s*=\s*"(.*)"/\1/g' ctest/Cargo.toml)"
258+
msrv="$(cargo metadata --format-version 1 | jq -r --arg CRATE_NAME ctest '.packages | map(select(.name == $CRATE_NAME)) | first | .rust_version')"
259259
echo "MSRV: $msrv"
260260
echo "MSRV=$msrv" >> "$GITHUB_ENV"
261261
- name: Install Rust

Cargo.toml

+32-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
[package]
22
name = "libc"
33
version = "1.0.0-alpha.1"
4-
authors = ["The Rust Project Developers"]
5-
license = "MIT OR Apache-2.0"
6-
readme = "README.md"
7-
edition = "2021"
8-
repository = "https://github.com/rust-lang/libc"
9-
homepage = "https://github.com/rust-lang/libc"
10-
documentation = "https://docs.rs/libc/"
114
keywords = ["libc", "ffi", "bindings", "operating", "system"]
125
categories = ["external-ffi-bindings", "no-std", "os"]
13-
build = "build.rs"
146
exclude = ["/ci/*", "/.github/*", "/.cirrus.yml", "/triagebot.toml"]
15-
rust-version = "1.63"
167
description = "Raw FFI bindings to platform libraries like libc."
178
publish = false # On the main branch, we don't want to publish anything
9+
authors.workspace = true
10+
edition.workspace = true
11+
license.workspace = true
12+
repository.workspace = true
13+
rust-version.workspace = true
1814

1915
[package.metadata.docs.rs]
2016
features = ["extra_traits"]
@@ -140,9 +136,36 @@ std = []
140136
rustc-dep-of-std = ["rustc-std-workspace-core"]
141137
extra_traits = []
142138

139+
[lints]
140+
workspace = true
141+
143142
[workspace]
144143
members = [
145144
"ctest",
146145
"ctest-test",
147146
"libc-test",
148147
]
148+
149+
[workspace.package]
150+
authors = ["The Rust Project Developers"]
151+
license = "MIT OR Apache-2.0"
152+
edition = "2021"
153+
repository = "https://github.com/rust-lang/libc"
154+
rust-version = "1.64"
155+
156+
[workspace.lints.rust]
157+
# TODO: make idents consistent in each file
158+
# unused_qualifications = "warn"
159+
160+
[workspace.lints.clippy]
161+
# TODO: all these are default lints and should probably be fixed
162+
identity_op = "allow"
163+
if_same_then_else = "allow"
164+
missing_safety_doc = "allow"
165+
non_minimal_cfg = "allow"
166+
precedence = "allow"
167+
redundant_field_names = "allow"
168+
redundant_static_lifetimes = "allow"
169+
unnecessary_cast = "allow"
170+
unused_unit = "allow"
171+
zero_ptr = "allow"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ libc = "0.2"
5151

5252
## Rust version support
5353

54-
The minimum supported Rust toolchain version is currently **Rust 1.63**.
54+
The minimum supported Rust toolchain version is currently **Rust 1.64**.
5555

5656
Increases to the MSRV are allowed to change without a major (i.e. semver-
5757
breaking) release in order to avoid a ripple effect in the ecosystem. A policy

ctest-test/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
name = "ctest-test"
33
version = "0.1.0"
44
authors = ["Alex Crichton <[email protected]>"]
5-
build = "build.rs"
6-
edition = "2021"
75
publish = false
6+
edition.workspace = true
7+
8+
[lints]
9+
workspace = true
810

911
[build-dependencies]
1012
ctest = { path = "../ctest" }

ctest/Cargo.toml

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
[package]
22
name = "ctest"
33
version = "0.4.11"
4-
license = "MIT OR Apache-2.0"
5-
readme = "README.md"
6-
repository = "https://github.com/rust-lang/libc"
7-
homepage = "https://github.com/rust-lang/libc"
8-
documentation = "https://docs.rs/ctest"
9-
description = """
10-
Automated tests of FFI bindings.
11-
"""
4+
description = "Automated tests of FFI bindings."
125
exclude = ["CHANGELOG.md"]
13-
edition = "2021"
14-
rust-version = "1.63.0"
6+
edition.workspace = true
7+
license.workspace = true
8+
repository.workspace = true
9+
rust-version.workspace = true
10+
11+
[lints]
12+
workspace = true
1513

1614
[dependencies]
1715
garando_syntax = "0.1"

ctest/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ APIs in Rust match the APIs defined in C.
1010

1111
## MSRV (Minimum Supported Rust Version)
1212

13-
The MSRV is 1.63.0 because of the transitive dependencies.
13+
The MSRV is 1.64.0 because of the transitive dependencies.
1414
Note that MSRV may be changed anytime by dependencies.
1515

1616
## Example

libc-test/Cargo.toml

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
[package]
22
name = "libc-test"
33
version = "0.1.0"
4-
edition = "2021"
5-
authors = ["The Rust Project Developers"]
6-
license = "MIT OR Apache-2.0"
7-
build = "build.rs"
4+
description = "A test crate for the libc crate."
85
publish = false
9-
repository = "https://github.com/rust-lang/libc"
10-
homepage = "https://github.com/rust-lang/libc"
11-
description = """
12-
A test crate for the libc crate.
13-
"""
6+
authors.workspace = true
7+
edition.workspace = true
8+
license.workspace = true
9+
repository.workspace = true
10+
11+
[lints]
12+
workspace = true
1413

1514
[dependencies]
1615
cfg-if = "1.0.0"

0 commit comments

Comments
 (0)