-
Notifications
You must be signed in to change notification settings - Fork 1
Fix Clippy warnings and run Clippy in CI #156
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
Changes from 6 commits
9132fd0
a85b255
ff6937d
96fa8c6
c56dba0
6c61292
cae14ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,7 @@ | ||||||
| [package] | ||||||
| name = "dela" | ||||||
| version = "0.0.6" | ||||||
| rust-version = "1.91.1" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial 🧩 Analysis chain🌐 Web query:
💡 Result: The rust-version field in Cargo.toml specifies the Minimum Supported Rust Version (MSRV), the minimum Rust toolchain version supported by the package. It is an optional [package] key that Cargo uses to error on compilation if the toolchain is too old (unless --ignore-rust-version is used). Format: A bare semantic version number with at least one component (major, major.minor, or major.minor.patch), no semver operators or pre-release identifiers. Official docs use "1.56" (major.minor). Full patch like "1.56.1" is allowed but not shown in examples. Convention for patch version: Official Cargo documentation does not mandate including the patch level; major.minor is the standard and sufficient. Cargo treats rust-version with caret-like compatibility internally for resolution (e.g., "^package.rust-version" for deps), but the declared value is exact for checking the user's toolchain (>= declared version). Projects commonly use major.minor (e.g., stable-2 like 1.75 for current stable minus 2), updating minor when raising MSRV, often as a minor SemVer change in the crate (not breaking). Use tools like cargo-msrv to verify the actual MSRV matches the declared value. Support expectations: Dependencies should have at least one compatible version; Cargo resolver prefers compatible ones (with resolver.incompatible-rust-versions = "fallback" default in edition 2024). Policy recommendation: Define a support window (e.g., latest stable, or N-2 minors), test with cargo-msrv verify. Citations:
Use Including the patch version ( Proposed change-rust-version = "1.91.1"
+rust-version = "1.91"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| edition = "2024" | ||||||
| license = "MIT" | ||||||
| authors = ["Alexander Yankov"] | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [toolchain] | ||
| channel = "1.91.1" | ||
| components = ["rustfmt", "clippy"] | ||
|
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Toolchain pin is fine; consider whether you want exact-patch or minor pinning.
🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -68,10 +68,10 @@ pub fn is_task_allowed(task: &Task) -> Result<(bool, bool), String> { | |||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // First pass: Check for deny entries (highest precedence) | ||||||||||||||||||||||||||||||||||||||||||||
| for entry in &allowlist.entries { | ||||||||||||||||||||||||||||||||||||||||||||
| if let AllowScope::Deny = entry.scope { | ||||||||||||||||||||||||||||||||||||||||||||
| if path_matches(&task.file_path, &entry.path, true) { | ||||||||||||||||||||||||||||||||||||||||||||
| return Ok((false, true)); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| if let AllowScope::Deny = entry.scope | ||||||||||||||||||||||||||||||||||||||||||||
| && path_matches(&task.file_path, &entry.path, true) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| return Ok((false, true)); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -89,12 +89,11 @@ pub fn is_task_allowed(task: &Task) -> Result<(bool, bool), String> { | |||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| AllowScope::Task => { | ||||||||||||||||||||||||||||||||||||||||||||
| if path_matches(&task.file_path, &entry.path, false) { | ||||||||||||||||||||||||||||||||||||||||||||
| if let Some(ref tasks) = entry.tasks { | ||||||||||||||||||||||||||||||||||||||||||||
| if tasks.contains(&task.name) { | ||||||||||||||||||||||||||||||||||||||||||||
| return Ok((true, false)); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| if path_matches(&task.file_path, &entry.path, false) | ||||||||||||||||||||||||||||||||||||||||||||
| && let Some(ref tasks) = entry.tasks | ||||||||||||||||||||||||||||||||||||||||||||
| && tasks.contains(&task.name) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| return Ok((true, false)); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
91
to
98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Triple let-chain is hard to follow; flatten it. Beyond the fmt failure (pipeline error at line 90) and MSRV-1.88 requirement, the binding ♻️ Suggested simplification AllowScope::Task => {
- if path_matches(&task.file_path, &entry.path, false)
- && let Some(ref tasks) = entry.tasks
- && tasks.contains(&task.name) {
- return Ok((true, false));
- }
+ let task_listed = entry
+ .tasks
+ .as_ref()
+ .is_some_and(|tasks| tasks.contains(&task.name));
+ if task_listed && path_matches(&task.file_path, &entry.path, false) {
+ return Ok((true, false));
+ }
}📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Actions: Rust CI[error] 90-90: cargo fmt --all -- --check failed. Formatting diff detected in allowlist.rs for AllowScope::Task branch (indentation/brace placement). Run 'cargo fmt --all' to apply rustfmt formatting. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| AllowScope::Deny | AllowScope::Once => { | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
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.
🧹 Nitpick | 🔵 Trivial
Cache key should also key on the Rust toolchain version.
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}does not include the rustc version. When you bumprust-toolchain.tomlfrom1.91.1to a newer version in a future PR, the cachedtarget/will be reused even though it was built by an older rustc, which can cause confusing rebuild diagnostics or, worse, stale artifacts. Consider hashingrust-toolchain.toml(or theCargo.tomlrust-version) into the cache key.Proposed change
📝 Committable suggestion
🤖 Prompt for AI Agents