rust-review
БесплатноБез исполняемых скриптовНе проверенReviewing Rust code - what to flag, and what rustc and clippy already flag for you USE WHEN: you are reviewing, critiquing or auditing existing Rust code - a…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Reviewing Rust
A reviewer's leverage is what the toolchain cannot say — and in Rust the
toolchain says an unusual amount. rustc plus a default clippy run covers
most of what a reviewer would flag in other languages, so the "already
covered" list is long and the check list is short. Reviewing Rust as if it
were C++ produces almost entirely noise.
What remains clusters in four places the compiler cannot reach by construction:
runtime-checked interior mutability, reference cycles, deadlock, and unsafe.
The snippets are fragments cut down to the defect, not runnable programs.
Already covered - do not spend review on it
| Defect | Reported by |
|---|---|
| Use after move, use after free, dangling reference | rustc — borrow checker |
| Data race between threads | rustc — Send/Sync |
Unhandled Result |
rustc unused_must_use (deny-by-default warning) |
Non-exhaustive match |
rustc |
| Unused variable, unused import | rustc |
unwrap() on an Option in obvious shapes |
clippy unnecessary_unwrap, option_map_unit_fn |
| Needless clone, needless borrow, needless range loop | clippy redundant_clone, needless_borrow, needless_range_loop |
Inefficient string building, &String parameters |
clippy ptr_arg, format_push_string |
| Integer overflow in debug builds | runtime panic — but silent wrap in release |
Missing #[must_use] on a builder |
clippy return_self_not_must_use |
Clippy's default set is broad and on in most CI. Before commenting, assume it
ran; check #![allow(...)] at crate root and clippy.toml for what was
switched off, because that is where the interesting exemptions hide.
The table above dates; the tools do not. Verify a default set with
mcp__documentation__fetch_docson technologyrust-quality— topicsclippy-lints,rustc-lints,cargo-profiles. Those entries point at the indexes the tool authors maintain, so they follow the version the project actually pins rather than the one this skill was written against.
The checks that earn their place
RefCell moving an aliasing error to runtime
let a = cell.borrow_mut();
let b = cell.borrow(); // panics: already mutably borrowed
When you see it: two borrow/borrow_mut calls whose guards can be alive at
once — often one held across a function call that reaches back into the same
cell.
Ask: what is the longest a guard lives here? RefCell does not remove the
aliasing rule, it moves the check from compile time to a panic — so the review
question is whether every path releases before re-entering. Re-entrancy through
a callback or an observer is the usual source, and it is invisible locally.
An Rc cycle that never drops
struct Node { parent: Rc<Node>, children: Vec<Rc<Node>> } // both strong
When you see it: Rc (or Arc) in both directions of a relationship —
parent/child, observer/subject, a graph edge stored on both nodes.
Ask: which direction should be Weak? Reference counting cannot collect a
cycle, so this is a leak the borrow checker is entirely happy with. Nothing in
the default toolchain reports it.
A lock held across an await
let guard = state.lock().unwrap(); // std::sync::Mutex
do_io(&guard).await; // task can be parked while holding it
When you see it: a std::sync guard alive across an .await, or two locks
acquired in different orders in different functions.
Ask: can another task need this lock while the first is parked? A blocking
mutex held across a yield point stalls the executor thread; clippy's
await_holding_lock catches the direct shape, but not the case where the guard
is passed into a helper that awaits. Lock ordering it cannot see at all.
Integer arithmetic that wraps in release
let remaining = total - used; // panics in debug, wraps silently in release
When you see it: subtraction on unsigned types, or any arithmetic on values
derived from input, in code that ships as --release.
Ask: is underflow reachable? Overflow checks are on in debug and off in
release by default, so the test suite proves nothing about production. This is
the one Rust defect that behaves differently in the two profiles, which makes it
worth flagging even when tests pass. checked_sub/saturating_sub say which
behaviour was meant.
unsafe whose invariant is not written down
unsafe { slice::from_raw_parts(ptr, len) } // no comment on why this is sound
When you see it: any unsafe block without a // SAFETY: comment stating
the invariant the caller must uphold.
Ask: what makes this sound, and who guarantees it? The compiler verifies
nothing inside unsafe; the block is a claim, and an unstated claim cannot be
re-checked when the surrounding code changes. clippy::undocumented_unsafe_blocks
exists but is not in the default set.
unwrap on a value whose invariant
Установить rust-review в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobFAQ
Что делает скилл rust-review?
Reviewing Rust code - what to flag, and what rustc and clippy already flag for you USE WHEN: you are reviewing, critiquing or auditing existing Rust code - a "code review", a "review" of a .rs file, a diff, a PR or a pull request; deciding what to comment on in Rust; avoiding false positives on Rust code DO NOT USE FOR: writing, explaining or learning Rust - use `languages/rust`; anything rustc or a default clippy run already reports (this skill lists those so you can stay silent about them); async runtime specifics - use the tokio material; FFI binding generation - use `languages/uniffi`
Как установить скилл rust-review?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл rust-review запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic