clippy-advanced by laurigates/claude-plugins
npx skills add https://github.com/laurigates/claude-plugins --skill clippy-advanced用于全面 Rust 代码检查的高级 Clippy 配置,包括自定义规则、检查类别、禁止的方法和 IDE 集成。
| 使用此技能当... | 使用其他工具当... |
|---|---|
| 配置 Clippy 检查规则 | 格式化代码(使用 rustfmt) |
| 为 Rust 设置 CI 检查 | 构建/编译(使用 cargo build) |
| 自定义 clippy.toml | 运行测试(使用 cargo test) |
| 强制执行代码标准 | 管理依赖项(使用 cargo add) |
# Clippy 包含在 rustup 中
rustup component add clippy
# 验证安装
cargo clippy --version
# 通过 Rust 工具链更新 clippy
rustup update
# 在当前项目上运行 clippy
cargo clippy
# 在所有目标上运行(库、二进制文件、测试、示例、基准测试)
cargo clippy --all-targets
# 启用所有功能后运行
cargo clippy --all-features
# 在工作区上运行
cargo clippy --workspace --all-targets --all-features
# 显示详细的检查说明
cargo clippy -- -W clippy::all -A clippy::pedantic
# 将警告视为错误
cargo clippy -- -D warnings
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 类别 | 用途 | 默认值 |
|---|---|---|
clippy::correctness | 可能的错误 | 拒绝 |
clippy::complexity | 过于复杂的代码 | 警告 |
clippy::perf | 性能问题 | 警告 |
clippy::style | 代码风格 | 警告 |
clippy::suspicious | 看起来有问题的代码 | 警告 |
clippy::pedantic | 主观风格 | 关闭 |
clippy::restriction | 选择性约束 | 关闭 |
clippy::nursery | 实验性 | 关闭 |
clippy::cargo | Cargo.toml 问题 | 关闭 |
[workspace.lints.clippy]
# 拒绝正确性问题(可能的错误)
correctness = "deny"
complexity = "warn"
perf = "warn"
style = "warn"
suspicious = "warn"
# 启用 pedantic 但允许一些嘈杂的检查
pedantic = "warn"
must_use_candidate = "allow"
missing_errors_doc = "allow"
# 选择性启用一些限制性检查
clone_on_ref_ptr = "warn"
dbg_macro = "warn"
print_stdout = "warn"
todo = "warn"
unimplemented = "warn"
unwrap_used = "warn"
# 启用 nursery 检查(实验性)
use_self = "warn"
在项目根目录创建 clippy.toml 以设置阈值和禁止项:
cognitive-complexity-threshold = 15
too-many-lines-threshold = 100
too-many-arguments-threshold = 5
disallowed-methods = [
{ path = "std::env::var", reason = "Use std::env::var_os for better Unicode handling" },
{ path = "std::process::exit", reason = "Use Result propagation instead" },
]
disallowed-names = ["foo", "bar", "baz"]
// 函数级别
#[allow(clippy::too_many_arguments)]
fn complex_function(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32) {}
// 模块级别(src/lib.rs)
#![warn(clippy::all)]
#![warn(clippy::pedantic)]
#![deny(clippy::unwrap_used)]
#![allow(clippy::module_name_repetitions)]
// 内联
#[allow(clippy::cast_possible_truncation)]
let x = value as u8;
| 上下文 | 命令 |
|---|---|
| CI 严格检查 | cargo clippy --workspace --all-targets -- -D warnings |
| JSON 输出 | cargo clippy --message-format=json |
| 紧凑错误格式 | cargo clippy --message-format=short |
| 快速检查 | cargo clippy --message-format=short -- -D warnings |
| Pedantic 检查 | cargo clippy -- -W clippy::pedantic -D clippy::correctness |
| 标志 | 描述 |
|---|---|
--all-targets | 检查库、二进制文件、测试、示例、基准测试 |
--all-features | 启用所有功能 |
--workspace | 检查整个工作区 |
--message-format=json | 用于工具的 JSON 输出 |
--message-format=short | 紧凑的错误格式 |
-- -D warnings | 将警告视为错误 |
-- -W clippy::pedantic | 启用 pedantic 检查 |
-- -A clippy::lint_name | 允许特定检查 |
| 级别 | 属性 | 效果 |
|---|---|---|
| 允许 | #[allow(...)] | 抑制检查 |
| 警告 | #[warn(...)] | 显示警告 |
| 拒绝 | #[deny(...)] | 编译错误 |
有关详细配置示例、CI 集成、IDE 设置和最佳实践,请参阅 REFERENCE.md。
每周安装次数
82
代码仓库
GitHub 星标数
19
首次出现
2026年1月29日
安全审计
安装于
gemini-cli80
github-copilot80
codex80
opencode80
cline78
cursor78
Advanced Clippy configuration for comprehensive Rust linting, including custom rules, lint categories, disallowed methods, and IDE integration.
| Use this skill when... | Use another tool instead when... |
|---|---|
| Configuring Clippy lint rules | Formatting code (use rustfmt) |
| Setting up CI linting for Rust | Building/compiling (use cargo build) |
| Customizing clippy.toml | Running tests (use cargo test) |
| Enforcing code standards | Managing dependencies (use cargo add) |
# Clippy is included with rustup
rustup component add clippy
# Verify installation
cargo clippy --version
# Update clippy with rust toolchain
rustup update
# Run clippy on current project
cargo clippy
# Run on all targets (lib, bins, tests, examples, benches)
cargo clippy --all-targets
# Run with all features enabled
cargo clippy --all-features
# Run on workspace
cargo clippy --workspace --all-targets --all-features
# Show detailed lint explanations
cargo clippy -- -W clippy::all -A clippy::pedantic
# Treat warnings as errors
cargo clippy -- -D warnings
| Category | Purpose | Default |
|---|---|---|
clippy::correctness | Likely bugs | Deny |
clippy::complexity | Overly complex code | Warn |
clippy::perf | Performance issues | Warn |
clippy::style | Code style | Warn |
clippy::suspicious | Code that looks wrong | Warn |
[workspace.lints.clippy]
# Deny correctness issues (likely bugs)
correctness = "deny"
complexity = "warn"
perf = "warn"
style = "warn"
suspicious = "warn"
# Enable pedantic but allow some noisy lints
pedantic = "warn"
must_use_candidate = "allow"
missing_errors_doc = "allow"
# Enable some restriction lints selectively
clone_on_ref_ptr = "warn"
dbg_macro = "warn"
print_stdout = "warn"
todo = "warn"
unimplemented = "warn"
unwrap_used = "warn"
# Enable nursery lints (experimental)
use_self = "warn"
Create clippy.toml in project root for thresholds and disallowed items:
cognitive-complexity-threshold = 15
too-many-lines-threshold = 100
too-many-arguments-threshold = 5
disallowed-methods = [
{ path = "std::env::var", reason = "Use std::env::var_os for better Unicode handling" },
{ path = "std::process::exit", reason = "Use Result propagation instead" },
]
disallowed-names = ["foo", "bar", "baz"]
// Function-level
#[allow(clippy::too_many_arguments)]
fn complex_function(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32) {}
// Module-level (src/lib.rs)
#![warn(clippy::all)]
#![warn(clippy::pedantic)]
#![deny(clippy::unwrap_used)]
#![allow(clippy::module_name_repetitions)]
// Inline
#[allow(clippy::cast_possible_truncation)]
let x = value as u8;
| Context | Command |
|---|---|
| CI strict | cargo clippy --workspace --all-targets -- -D warnings |
| JSON output | cargo clippy --message-format=json |
| Compact errors | cargo clippy --message-format=short |
| Quick check | cargo clippy --message-format=short -- -D warnings |
| Pedantic check | cargo clippy -- -W clippy::pedantic -D clippy::correctness |
| Flag | Description |
|---|---|
--all-targets | Check lib, bins, tests, examples, benches |
--all-features | Enable all features |
--workspace | Check entire workspace |
--message-format=json | JSON output for tooling |
--message-format=short | Compact error format |
-- -D warnings | Treat warnings as errors |
| Level | Attribute | Effect |
|---|---|---|
| Allow | #[allow(...)] | Suppress lint |
| Warn | #[warn(...)] | Show warning |
| Deny | #[deny(...)] | Compile error |
For detailed configuration examples, CI integration, IDE setup, and best practices, see REFERENCE.md.
Weekly Installs
82
Repository
GitHub Stars
19
First Seen
Jan 29, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli80
github-copilot80
codex80
opencode80
cline78
cursor78
Rust 开发模式与最佳实践:构建安全高性能应用程序的惯用模式指南
1,100 周安装
Box自动化工具包:通过Rube MCP实现文件上传、搜索、文件夹管理
69 周安装
Datadog自动化监控:通过Rube MCP与Composio实现指标、日志、仪表板管理
69 周安装
Intercom自动化指南:通过Rube MCP与Composio实现客户支持对话管理
69 周安装
二进制初步分析指南:使用ReVa工具快速识别恶意软件与逆向工程
69 周安装
PrivateInvestigator 道德人员查找工具 | 公开数据调查、反向搜索与背景研究
69 周安装
TorchTitan:PyTorch原生分布式大语言模型预训练平台,支持4D并行与H100 GPU加速
69 周安装
clippy::pedantic | Opinionated style | Off |
clippy::restriction | Opt-in constraints | Off |
clippy::nursery | Experimental | Off |
clippy::cargo | Cargo.toml issues | Off |
-- -W clippy::pedantic | Enable pedantic lints |
-- -A clippy::lint_name | Allow specific lint |