Files
tty7/clippy.toml
T
l0ng-ai c957231142 chore(lint): put clippy on the CI gate, and clear the ~200 findings behind it
CI checked `cargo fmt --check` and the build, so nothing ever read the
content of the code — ~200 clippy findings had accumulated, a third of them
in `#[cfg(test)]` modules.

Two of them were real:

- `resolved_background_appearance` took `backdrop`, and only the
  `#[cfg(windows)]` arm used it. Renaming it to `_backdrop` is what clippy
  asks for and compiles cleanly on macOS; on Windows it is an undefined
  name. Kept the parameter and discharged it in the non-Windows arm the way
  `package_for_current_install` already does.
- `SettingsSearchBackdropKeywords` and seven other `L10nKey` variants were
  carrying translations in three languages for strings nothing reads.

The rest is mechanical: let-chains for collapsible `if let`s, struct-update
syntax for `Default::default()` reassignment, `sort_by_key` where a manual
reversed comparator was doing the same job the same file already did with
`Reverse` two functions later.

Where clippy was wrong, the reason is now in the tree rather than rediscovered:
per-platform `#[cfg]` blocks each keep their `return` (dropping it only
compiles on whichever target's block lands last), the loopback parser keeps
three parallel arms instead of folding one into a `?`, and the four wide enums
are all built on the stack and consumed immediately, so boxing them would add
an allocation rather than save one.

`L10nKey` cannot be clean under `dead_code` on any single platform, so the
allow there records how to audit it instead — which is how the eight dead keys
were found.

`english()` gained the cross-platform test its doc comment already claimed;
only the Windows hint had been pinned.

The clippy job is non-required until it has green history, for the same
branch-protection reason `host-boundary` documents.

2930 tests pass.
2026-08-15 18:11:17 +08:00

15 lines
879 B
TOML

# Lint thresholds. Lint *levels* live in `[workspace.lints.clippy]` in
# Cargo.toml; only the tunables clippy reads from its own file belong here.
# gpui hands every render, event and constructor path a `&mut Window` and a
# `&mut Context<_>`, so two of any such function's arguments are the framework's
# and not the design's. Seven leaves five for the actual parameters, which is
# tighter than it looks: `new_terminal` and `Pane::spawn` take a cwd, a shell, a
# workspace, an owner and a restore id, all genuinely independent and all better
# read at the call site than bundled into a single-use struct.
#
# Nine is therefore where the lint starts telling us something we did not
# already know. It still fires — this is a threshold, not an `allow` — and a
# function that reaches ten arguments should be taken as the design smell it is.
too-many-arguments-threshold = 9