Giter Site home page Giter Site logo

chinanf-boy / rust-clippy-zh Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 50 KB

🇨🇳翻译: <rust-clippy> 一系列的lints,以捕捉常见的错误,并改善你的Rust ❤️ 校对 🀄️

Home Page: https://chinanf-boy.github.io/rust-clippy-zh

HTML 100.00%
zh rust lint better

rust-clippy-zh's Introduction

rust-clippy translate-svg

「 一系列的lints,以捕捉常见的错误,并改善你的Rust代码. 」

中文 | english


校对 🀄️

翻译的原文 与日期 最新更新 更多
commit ⏰ 2018 9.7 last 中文翻译

此项目的重心在 gh-pages分支, 的 网页内容

贡献

欢迎 👏 勘误/校对/更新贡献 😊 具体贡献请看

生活

If help, buy me coffee —— 营养跟不上了,给我来瓶营养快线吧! 💰


目录

我们目前正在通过RFC,讨论Clippy 1.0rust-lang/rfcs#2476. RFC的目标是阐明有关lint分类的策略以及,lint在编译器中的策略,以及哪些lint应该在Clippy中. 请在RFC PR留下你的看法.

Clippy

Build Status Windows Build status Current Version License: MPL-2.0

一系列的lints,以捕捉常见的错误,并改善你的码.

这个箱子里有275个棉花!

我们有一堆lint类别,允许您选择Clippy应该有多少搅扰帮你:

  • clippy::all (没有误报的一切)
  • clippy::pedantic (一切)
  • clippy::nursery (尚未准备好的新lints)
  • clippy::style (应该以更惯用的方式编写的代码)
  • clippy::complexity (执行简单但复杂的代码的代码)
  • clippy::perf (可以更快的方式编写的代码)
  • clippy::cargo (检查货物清单)
  • clippy::correctness (代码完全错误或非常无用)

请来更多提出问题如果你有想法!

目录:

用法

由于这是一个帮助库或应用程序开发人员编写更好代码的工具,因此建议不要将Clippy作为硬依赖项包含在内. 选项包括将其用作可选依赖项,货物子命令或构建期间包含的功能. 这些选项详述如下.

作为货物子命令 (cargo clippy)

使用Clippy的一种方法是通过rustup安装Clippy作为货物子命令.

第1步: 安装rustup

你可以安装rustup在支持的平台上. 这将有助于我们安装clippy及其依赖项.

如果您已经安装了rustup,请更新以确保您拥有最新的rustup和编译器:

rustup update

第2步: 安装夜间工具链

Rustup集成仍然是新的,你需要一个相对较新的夜间 (2018-07-15或更高版本) .

用Night安装Rustrustup:

rustup install nightly

第3步: 安装clippy

一旦生锈并安装了夜间工具链,请运行以下命令:

rustup component add clippy-preview --toolchain=nightly

现在您可以通过调用来运行Clippycargo +nightly clippy. 如果夜间是你生锈的默认工具链,cargo clippy会很好的.

从命令行运行Clippy而不安装它

要使用Clippy编译您的箱子而不在代码中安装Clippy,您可以使用:

cargo run --bin cargo-clippy --manifest-path=path_to_clippys_Cargo.toml

*注意: *确保Clippy编译时使用与此处调用的相同版本的rustc!

组态

可以在名为的TOML文件中配置一些lintsclippy.toml要么.clippy.toml. 它包含一个基本的variable = value映射例如.

blacklisted-names = ["toto", "tata", "titi"]
cyclomatic-complexity-threshold = 30

lints列表有关可以配置哪些lints以及变量含义的更多信息.

要取消激活"有关详细信息,请访问皮棉链接"你可以定义的消息CLIPPY_DISABLE_DOCS_LINKS环境变量.

允许/拒绝lints

您可以添加选项allow/warn/deny:

  • 整套的Warn使用的lintsclippy皮棉组 (#![deny(clippy::all)])

  • 所有的lints都使用了clippyclippy::pedantic棉绒组 (#![deny(clippy::all)],#![deny(clippy::pedantic)]) . 注意clippy::pedantic包含一些非常积极的lint容易出现误报.

  • 只有一些棉绒 (#![deny(clippy::single_match, clippy::box_vec)]等)

  • allow/warn/deny可以限制为单个功能或模块使用#[allow(...)]等等

注意: deny产生错误而不是警告.

更新rustc

有时候,没有Clippy追赶,rustc会向前移动. 因此,更新rustc可能会使Clippy处于非功能状态,直到我们修复产生的断裂.

你可以使用防锈更新仅当Clippy也能正确更新时才更新rustc的脚本.

执照

许可下MPL. 如果您遇到许可证问题,请告诉我,我会尝试将其更改为更宽松的内容.

rust-clippy-zh's People

Contributors

chinanf-boy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.