-
Notifications
You must be signed in to change notification settings - Fork 8
Upgrade to Rust 2024 edition #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe PR upgrades Rust edition from 2021 to 2024 across both root and parse-flake-lock packages, modernizes workspace dependency declarations using shorthand syntax, and makes tracing-related dependencies explicit with disabled default features and curated feature lists. Additionally, imports are reordered across several source files, and test error-message expectations are updated. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/flake.rs (1)
157-201: Consider removing duplicated CEL condition test caseThe last two entries in
casesuse the same CEL condition with the same expected result. If this isn’t intentionally checking repeat evaluation, you could drop one to reduce noise:- ( - "has(gitRef) && has(numDaysOld) && has(owner) && has(supportedRefs) && supportedRefs.contains(gitRef) && owner != 'NixOS'", - false, - ),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
Cargo.toml(3 hunks)parse-flake-lock/Cargo.toml(1 hunks)src/condition.rs(1 hunks)src/flake.rs(3 hunks)src/main.rs(1 hunks)src/summary.rs(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/main.rs (2)
src/condition.rs (1)
evaluate_condition(18-69)src/flake.rs (1)
check_flake_lock(79-137)
src/flake.rs (2)
src/condition.rs (1)
evaluate_condition(18-69)src/main.rs (1)
supported_refs(100-113)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Check flake.lock test (clean 👼)
- GitHub Check: Nix and Rust checks
- GitHub Check: Check flake.lock test (CEL condition)
- GitHub Check: Test Rust
- GitHub Check: Check flake.lock test (dirty 😈)
🔇 Additional comments (16)
parse-flake-lock/Cargo.toml (1)
4-9: Edition bump and workspace deps look consistentThe 2024 edition setting and workspace-scoped serde/serde_json/thiserror entries are consistent and keep this crate aligned with the workspace setup. No issues spotted.
src/summary.rs (2)
1-1: Import reorder is harmlessPulling
FlakeCheckConfigto the top of the import block is style-only and doesn’t affect behavior.
130-136: Disallowed-input message block unchanged in behaviorThe formatting tweak around the Disallowed branch keeps the string content intact; the user-facing message remains the same and still reads clearly.
src/main.rs (1)
16-21: Import group reordering onlyReordering the
tracing_subscriberandflakeimports keeps the same items and doesn’t change runtime behavior. Looks good.src/condition.rs (1)
59-62: Trailing comma in error construction is fineAdding the trailing comma in the
NonBooleanConditionconstructor is formatting-only and keeps behavior identical while improving diffs.src/flake.rs (4)
5-7: Issue-type import grouping is fineThe regrouped
crate::issue::{...}import is a style-only change; all previously used types are still imported.
68-73: Improved error message pluralization for missing nixpkgs keysThe new format string correctly switches between “key” and “keys” based on
missing.len(), and still prefixes the missing key list. This aligns with the updated tests and makes the error clearer.
150-155: Test imports regrouping is non-functionalThe consolidated
crate::{...}import in the test module keeps the same symbols and doesn’t affect test behavior.
309-346: Missing-nixpkgs-keys tests now match pluralized error textThe
casesexpectations for single vs multiple missing keys match the new error message format and cover both plural and singular wording. This keeps the error contract well specified.Cargo.toml (7)
18-20: Workspace dependency shorthand syntax looks good.The switch from inline
{ workspace = true }tables to shorthand.workspace = truesyntax is the modern, idiomatic approach in Cargo and aligns with best practices.
30-32: detsys-ids-client: Explicit default-features handling is sound.Disabling default features and explicitly enabling
"tracing-instrument"is a good practice for clarity and supply-chain hygiene.
4-4: Edition 2024 upgrade is valid and established.Rust 1.85.0 stabilized the 2024 edition on February 20, 2025, making this upgrade safe and appropriate for production use. The edition change aligns with the Rust 3-year cadence.
41-41: No issues found—tracing configuration is correct.The codebase does not use the
#[instrument]macro or other features disabled bydefault-features = falseon the tracing crate. The "tracing-instrument" feature mentioned in Cargo.toml is from thedetsys-ids-clientcrate, not the tracing crate. The tracing dependency is used only implicitly through transitive dependencies, and the explicitly enabled features intracing-subscriber(env-filter, fmt, registry) are all available regardless of tracing's default-features setting. The configuration is sound.
42-46: Feature selection verified and confirmed correct.The three features—"env-filter" (EnvFilter type), "fmt" (fmt module), and "registry" (registry module)—are exactly what the codebase uses. An exhaustive search confirms tracing_subscriber is only used in src/main.rs, with imports for
EnvFilter,fmt, andprelude, and usage ofregistry(). All selected features are necessary and there are no missing features required for the observed initialization pattern.
4-4: Edition "2024" is valid and stable. Rust 2024 edition was released as stable with Rust 1.85 on February 20, 2025, and has been available for months as of now.
41-41: Configuration is correct; tracing crate functions without disabled defaults.The codebase does not use any tracing macros or the
#[instrument]attribute—onlytracing_subscriberis used for logging setup (src/main.rs). The disabled default features (attributes,std,tracing-attributes) are unnecessary here. Thetracingdependency is primarily transitive (fromtokioanddetsys-ids-client) and does not require those features. The explicit feature configuration fortracing_subscriberis sufficient.
Summary by CodeRabbit
Chores
Tests