Replace #[allow(...)] with #[expect(...)]#12788
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
Pull request overview
This PR tightens Rust lint suppression across the monorepo by replacing #[allow(...)] with #[expect(...)] (and removing some no-longer-needed suppressions), ensuring builds/clippy fail if a suppression becomes unnecessary.
Changes:
- Replaced many
#[allow(clippy::…)]with#[expect(clippy::…)]for argument-count, indexing/slicing, enum-size, and type-complexity lints. - Replaced/adjusted compiler-lint suppressions (e.g.,
dead_code,unused,unused_variables,invalid_from_utf8) to use#[expect(...)]where still required. - Removed a subset of
#[allow(...)]attributes that no longer appear to be needed.
Reviewed changes
Copilot reviewed 43 out of 44 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/gitbutler-tauri/src/claude.rs | Switches too_many_arguments suppression to #[expect] for a Tauri command. |
| crates/gitbutler-repo-actions/src/repository.rs | Switches too_many_arguments suppression to #[expect] for a trait with wide APIs. |
| crates/but/vendor/cli-prompts/examples/general.rs | Switches acronym naming suppression to #[expect] in a vendored example. |
| crates/but/src/command/legacy/status/mod.rs | Switches too_many_arguments suppression to #[expect]. |
| crates/but/src/command/legacy/status/json.rs | Removes a too_many_arguments suppression that appears unnecessary. |
| crates/but/src/command/legacy/rub/squash.rs | Switches too_many_arguments suppression to #[expect]. |
| crates/but/src/command/legacy/rub/mod.rs | Removes a private_interfaces suppression that appears unnecessary. |
| crates/but/src/command/legacy/forge/review.rs | Switches multiple too_many_arguments suppressions to #[expect]. |
| crates/but/src/command/legacy/diff/show.rs | Switches large_enum_variant suppression to #[expect]. |
| crates/but/src/command/legacy/branch/show.rs | Removes a too_many_arguments suppression that appears unnecessary. |
| crates/but/src/command/legacy/branch/mod.rs | Switches too_many_arguments suppression to #[expect]. |
| crates/but/src/command/legacy/branch/list.rs | Switches too_many_arguments suppressions to #[expect]. |
| crates/but/src/command/legacy/absorb.rs | Switches too_many_arguments suppression to #[expect]. |
| crates/but-worktrees/tests/worktree/main.rs | Switches unused suppression to #[expect] for test helper context. |
| crates/but-workspace/src/tree_manipulation/create_tree_without_diff.rs | Removes a dead_code suppression that appears unnecessary. |
| crates/but-workspace/src/commit/mod.rs | Switches indexing_slicing suppression to #[expect]. |
| crates/but-workspace/src/branch/apply.rs | Switches indexing_slicing suppression to #[expect]. |
| crates/but-schemars/src/lib.rs | Switches multiple dead_code suppressions to #[expect] for schema-only helper types. |
| crates/but-rebase/src/graph_rebase/mod.rs | Removes an unused suppression that appears unnecessary. |
| crates/but-rebase/src/graph_rebase/cherry_pick.rs | Switches too_many_arguments suppression to #[expect]. |
| crates/but-project-handle/src/project_handle.rs | Switches invalid_from_utf8 suppression to #[expect] in tests. |
| crates/but-meta/src/virtual_branches_legacy_types.rs | Switches dead_code suppression to #[expect] for a serde helper variant. |
| crates/but-meta/src/legacy/storage.rs | Switches large_enum_variant suppression to #[expect]. |
| crates/but-link/tests/repo.rs | Switches dead_code suppressions to #[expect] for test module includes. |
| crates/but-link/tests/payloads.rs | Switches dead_code suppressions to #[expect] for test module includes. |
| crates/but-link/tests/db.rs | Switches dead_code/unused_imports suppressions to #[expect] for test module includes. |
| crates/but-link/tests/cli.rs | Switches dead_code suppression to #[expect] for test module include. |
| crates/but-link/tests/claiming.rs | Switches dead_code/unused_imports suppressions to #[expect] for test module includes. |
| crates/but-hunk-dependency/tests/hunk_dependency/workspace_dependencies.rs | Switches dead_code suppression to #[expect] in test util context. |
| crates/but-hunk-dependency/tests/hunk_dependency/ui.rs | Switches dead_code suppression to #[expect] in test util context. |
| crates/but-hunk-dependency/src/ui.rs | Switches dead_code suppression to #[expect] for schema-only helper type. |
| crates/but-gitlab/src/token.rs | Removes dead_code suppressions on enum variants that appear unnecessary. |
| crates/but-github/src/token.rs | Removes dead_code suppressions on enum variants that appear unnecessary. |
| crates/but-ctx/src/lib.rs | Switches some type_complexity suppressions to #[expect] and removes others where unnecessary. |
| crates/but-core/src/worktree/checkout/tree.rs | Switches indexing_slicing suppression to #[expect]. |
| crates/but-core/src/tree/mod.rs | Switches indexing_slicing suppression to #[expect]. |
| crates/but-claude/src/session.rs | Switches unused_variables suppression to #[expect] for a hook factory. |
| crates/but-claude/src/permissions/patterns.rs | Removes a dead_code suppression that appears unnecessary. |
| crates/but-claude/src/claude_transcript.rs | Switches large_enum_variant suppression to #[expect]. |
| crates/but-bot/src/lib.rs | Switches too_many_arguments suppression to #[expect]. |
| crates/but-api/src/legacy/open.rs | Switches unused_imports suppression to #[expect]. |
| crates/but-api-macros/src/lib.rs | Switches dead_code suppression to #[expect] for a helper function in macro expansion. |
| crates/but-action/src/lib.rs | Switches too_many_arguments suppression to #[expect]. |
| crates/but-action/src/auto_commit.rs | Switches multiple too_many_arguments suppressions to #[expect]. |
Comments suppressed due to low confidence (1)
crates/but-claude/src/session.rs:1597
stack_idis passed intocreate_pretool_use_hookbut never used. Instead of keeping an#[expect(unused_variables)]on the whole function, consider removing this parameter (and updating the call site) or renaming it to_stack_idand dropping the lint expectation.
#[expect(unused_variables)]
fn create_pretool_use_hook(
sync_ctx: ThreadSafeContext,
stack_id: but_core::ref_metadata::StackId,
) -> claude_agent_sdk_rs::HookCallback {
You can also share your feedback on Copilot code review. Take the survey.
ed94dfc to
668dd46
Compare
Byron
left a comment
There was a problem hiding this comment.
Thanks a lot!
It would be great to have a clippy lint to enforce expect() over allow as well.
`expect` works like `allow` except it fails if the lint isn't actually required. So helps to catch things like unnecessary `#[allow(dead_code)]`.
668dd46 to
b4b567b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 43 out of 44 changed files in this pull request and generated 1 comment.
You can also share your feedback on Copilot code review. Take the survey.
Replace `#[allow(...)]` with `#[expect(...)]`
expectworks likeallowexcept it fails if the lint isn't actually required. So helps to catch things like unnecessary#[allow(dead_code)].Done with search-n-replace and having an agent fixing
cargo clippy.