Skip to content

Commit 8c32d7b

Browse files
committed
Merge torrust#818: feat: prepare for Rust 2024 edition and update dependencies
47189a3 chore: fix formatting (Cameron Garnham) 2b76d6f refactor: migrate to axum 0.8, axum-server 0.8, and rand 0.10 APIs (Cameron Garnham) 7cf635c chore: update cargo dependencies (Cameron Garnham) b72f7ad refactor: migrate to Cargo lint workspace and address new warnings (Cameron Garnham) 9238b66 chore: address clippy warnings and code cleanup (Cameron Garnham) Pull request description: ## Summary This PR prepares the codebase for migration to Rust 2024 edition while updating dependencies and improving code quality. The changes include adding Rust 2024 compatibility lint warnings, updating multiple dependencies to their latest versions, and applying modern Rust patterns throughout the codebase. ## Key Changes ### Rust 2024 Preparation - Added `rust-2024-compatibility` lint with warning level - Updated lints configuration to use workspace inheritance - Applied `Self::` pattern for enum variant matching - Added `const fn` to many default value functions for compile-time evaluation ### Dependency Updates - Updated multiple crates in `Cargo.lock` to latest versions - Removed `rand_core` as it is included implicitly now. - Added `query` feature to `reqwest` for improved URL query handling - Updated `ahash`, `anstream`, `aho-corasick` and other dependencies ### Code Quality Improvements - Replaced `.into()` with `.try_into().expect(...)` for multipart form handling to provide clearer error messages - Applied clippy suggestions including `Self` usage and `const` functions - Fixed `.clone()` calls where direct references could be used - Added missing `Eq` derives to structs that require it ### Development Workflow - Added `AGENTS.md` with cargo command guidelines - Simplified GitHub Actions cargo commands by removing redundant flags - Updated `.cargo/config.toml` to remove overly restrictive rustflags - Improved VS Code settings for better rust-analyzer integration ## Testing Performed - All existing tests continue to pass with updated dependencies - Multipart form handling changes maintain backward compatibility - Const function additions are compile-time verified - No breaking changes to public API ## Breaking Changes None. This is a preparatory change that maintains full backward compatibility. ## Migration Needed No migration required. The Rust 2024 compatibility is currently at warning level only, allowing gradual migration when the edition is officially adopted. ## References - Rust 2024 Edition RFC and migration guide - Dependency changelogs for updated crates - Internal code quality improvement initiative ACKs for top commit: da2ce7: ACK 47189a3 Tree-SHA512: aa6695966585836a6947cccfe0548a69676fb080ea8c727377e9874103de54b14a5bcf83031b4422f1015cfbf9ca15d88e2800a588946fee49e261c9c98d4acc
2 parents f9c17f3 + 47189a3 commit 8c32d7b

111 files changed

Lines changed: 2627 additions & 1971 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,11 @@ cov-html = "llvm-cov --html"
44
cov-lcov = "llvm-cov --lcov --output-path=./.coverage/lcov.info"
55
time = "build --timings --all-targets"
66

7+
[env]
8+
79
[build]
8-
rustflags = [
9-
"-D",
10-
"warnings",
11-
"-D",
12-
"future-incompatible",
13-
"-D",
14-
"let-underscore",
15-
"-D",
16-
"nonstandard-style",
17-
"-D",
18-
"rust-2018-compatibility",
19-
"-D",
20-
"rust-2018-idioms",
21-
"-D",
22-
"rust-2021-compatibility",
23-
"-D",
24-
"unused",
25-
]
10+
rustflags = []
11+
12+
[term]
13+
quiet = false
14+
verbose = false

.github/workflows/testing.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ jobs:
6565

6666
- id: check
6767
name: Run Build Checks
68-
run: cargo check --tests --benches --examples --workspace --all-targets --all-features
68+
run: cargo check --workspace --all-targets --all-features
6969

7070
- id: lint
7171
name: Run Lint Checks
72-
run: cargo clippy --tests --benches --examples --workspace --all-targets --all-features
72+
run: cargo clippy --workspace --all-targets --all-features
7373

7474
- id: docs
7575
name: Lint Documentation
@@ -83,7 +83,7 @@ jobs:
8383

8484
- id: deps
8585
name: Check Unused Dependencies
86-
run: cargo machete
86+
run: cargo machete --with-metadata
8787

8888
unit:
8989
name: Units
@@ -120,7 +120,7 @@ jobs:
120120

121121
- id: test
122122
name: Run Unit Tests
123-
run: cargo test --tests --benches --examples --workspace --all-targets --all-features
123+
run: cargo test --workspace --all-targets --all-features
124124

125125
integration:
126126
name: Integrations

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
},
55
"rust-analyzer.checkOnSave": true,
66
"rust-analyzer.check.command": "clippy",
7+
"rust-analyzer.check.workspace": true,
78
"rust-analyzer.check.allTargets": true,
9+
"rust-analyzer.check.extraArgs": [],
810
"evenBetterToml.formatter.allowedBlankLines": 1,
911
"evenBetterToml.formatter.columnWidth": 130,
1012
"evenBetterToml.formatter.trailingNewline": true,
1113
"evenBetterToml.formatter.reorderKeys": true,
12-
"evenBetterToml.formatter.reorderArrays": true,
13-
}
14+
"evenBetterToml.formatter.reorderArrays": true
15+
}

AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Agent Instructions
2+
3+
## Cargo Commands
4+
5+
Prefer using `--workspace --all-targets --all-features` when running `cargo check`, `cargo clippy`, or `cargo test`.

0 commit comments

Comments
 (0)