SuperAPI AI 工具集

clippy-advanced

编程与开发

查看项目

更新于 10-15 23:49

技能介绍

用途:为 Rust 项目提供全面的 Clippy lint 配置,包括自定义规则、lint 类别、禁用方法与 IDE 集成。适合在配置 Clippy lint 规则、搭建 Rust 的 CI linting、定制 clippy.toml、强制执行代码标准时使用;格式化代码应改用 rustfmt,构建用 cargo build,测试用 cargo test,依赖管理用 cargo add。

安装:Clippy 随 rustup 提供,执行 rustup component add clippy 安装,用 cargo clippy --version 验证,用 rustup update 随工具链更新。

主要能力与用法:cargo clippy 在当前项目运行;cargo clippy --all-targets 覆盖 lib、bin、测试、示例与基准;--all-features 启用全部特性;--workspace 检查整个工作区;-- -D warnings 将警告视为错误;-- -W clippy::pedantic 启用 pedantic;-- -A clippy::lint_name 允许特定 lint。lint 类别含 correctness(默认 deny)、complexity/perf/style/suspicious(默认 warn)、pedantic/restriction/nursery/cargo(默认 off)。可在 Cargo.toml 的 [workspace.lints.clippy] 中按类别和具体 lint 设置 deny/warn/allow。clippy.toml 可设置 cognitive-complexity-threshold、too-many-lines-threshold、too-many-arguments-threshold,以及 disallowed-methods、disallowed-names。可用函数级、模块级或内联的 #[allow(...)] 抑制 lint。

适用场景:CI 严格检查、JSON 或短格式输出对接工具、快速检查与 pedantic 检查。

限制:部分高级配置细节与最佳实践需参见 REFERENCE.md;具体价格、平台或效果资料暂未提供。