]> git.lizzy.rs Git - rust.git/commitdiff
Build the Clippy book as part of x.py doc
authorflip1995 <hello@philkrones.com>
Sun, 3 Jul 2022 15:35:24 +0000 (17:35 +0200)
committerPhilipp Krones <hello@philkrones.com>
Wed, 6 Jul 2022 08:01:27 +0000 (10:01 +0200)
src/bootstrap/builder.rs
src/bootstrap/doc.rs
src/tools/clippy/book/src/README.md
src/tools/clippy/book/src/development/adding_lints.md
src/tools/clippy/book/src/development/basics.md
src/tools/clippy/book/src/development/common_tools_writing_lints.md
src/tools/clippy/book/src/usage.md

index dc6a0f6f241462e3519118f6caf7ffe71b6a9e1b..2f03259ac49ae6fe4cec466e73b880cd33f01a0b 100644 (file)
@@ -701,6 +701,7 @@ macro_rules! describe {
                 doc::RustcBook,
                 doc::CargoBook,
                 doc::Clippy,
+                doc::ClippyBook,
                 doc::Miri,
                 doc::EmbeddedBook,
                 doc::EditionGuide,
index 5b96145607611b67e4533777dce625dd9599f611..2852442d0be6fbb7986a84f211a84a6494cde744 100644 (file)
@@ -74,6 +74,7 @@ fn run(self, builder: &Builder<'_>) {
 // and checking against it?).
 book!(
     CargoBook, "src/tools/cargo/src/doc", "cargo", submodule = "src/tools/cargo";
+    ClippyBook, "src/tools/clippy/book", "clippy";
     EditionGuide, "src/doc/edition-guide", "edition-guide", submodule;
     EmbeddedBook, "src/doc/embedded-book", "embedded-book", submodule;
     Nomicon, "src/doc/nomicon", "nomicon", submodule;
index d941f8b65e8ee0cfba44334286379151a3797476..6248d588a890b9dc13038eaa051ca56cd46d18b6 100644 (file)
@@ -1,7 +1,7 @@
 # Clippy
 
 [![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test/badge.svg?branch=auto&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test%22+event%3Apush+branch%3Aauto)
-[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](#license)
+[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](https://github.com/rust-lang/rust-clippy#license)
 
 A collection of lints to catch common mistakes and improve your
 [Rust](https://github.com/rust-lang/rust) code.
index 3da07fcb9686363fe3948d265202e32f1c9b930c..d06297f2e079a23b077f08e5b7bbf5d58f0d0f67 100644 (file)
@@ -13,7 +13,6 @@ because that's clearly a non-descriptive name.
   - [Testing](#testing)
     - [Cargo lints](#cargo-lints)
   - [Rustfix tests](#rustfix-tests)
-  - [Edition 2018 tests](#edition-2018-tests)
   - [Testing manually](#testing-manually)
   - [Lint declaration](#lint-declaration)
   - [Lint registration](#lint-registration)
@@ -402,9 +401,8 @@ need to ensure that the MSRV configured for the project is >= the MSRV of the
 required Rust feature. If multiple features are required, just use the one with
 a lower MSRV.
 
-First, add an MSRV alias for the required feature in
-[`clippy_utils::msrvs`](/clippy_utils/src/msrvs.rs). This can be accessed later
-as `msrvs::STR_STRIP_PREFIX`, for example.
+First, add an MSRV alias for the required feature in [`clippy_utils::msrvs`].
+This can be accessed later as `msrvs::STR_STRIP_PREFIX`, for example.
 
 ```rust
 msrv_aliases! {
@@ -468,6 +466,8 @@ define_Conf! {
 }
 ```
 
+[`clippy_utils::msrvs`]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/msrvs/index.html
+
 ## Author lint
 
 If you have trouble implementing your lint, there is also the internal `author`
@@ -583,8 +583,7 @@ the workspace directory. Adding a configuration to a lint can be useful for
 thresholds or to constrain some behavior that can be seen as a false positive
 for some users. Adding a configuration is done in the following steps:
 
-1. Adding a new configuration entry to
-   [clippy_lints::utils::conf](/clippy_lints/src/utils/conf.rs) like this:
+1. Adding a new configuration entry to [`clippy_lints::utils::conf`] like this:
 
    ```rust
    /// Lint: LINT_NAME.
@@ -635,9 +634,9 @@ for some users. Adding a configuration is done in the following steps:
        ```
 3. Passing the configuration value to the lint impl struct:
 
-   First find the struct construction in the [clippy_lints lib
-   file](/clippy_lints/src/lib.rs). The configuration value is now cloned or
-   copied into a local value that is then passed to the impl struct like this:
+   First find the struct construction in the [`clippy_lints` lib file]. The
+   configuration value is now cloned or copied into a local value that is then
+   passed to the impl struct like this:
 
    ```rust
    // Default generated registration:
@@ -653,12 +652,16 @@ for some users. Adding a configuration is done in the following steps:
 
 4. Adding tests:
     1. The default configured value can be tested like any normal lint in
-       [`tests/ui`](/tests/ui).
-    2. The configuration itself will be tested separately in
-       [`tests/ui-toml`](/tests/ui-toml). Simply add a new subfolder with a
-       fitting name. This folder contains a `clippy.toml` file with the
-       configuration value and a rust file that should be linted by Clippy. The
-       test can otherwise be written as usual.
+       [`tests/ui`].
+    2. The configuration itself will be tested separately in [`tests/ui-toml`].
+       Simply add a new subfolder with a fitting name. This folder contains a
+       `clippy.toml` file with the configuration value and a rust file that
+       should be linted by Clippy. The test can otherwise be written as usual.
+
+[`clippy_lints::utils::conf`]: https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/utils/conf.rs
+[`clippy_lints` lib file]: https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/lib.rs
+[`tests/ui`]: https://github.com/rust-lang/rust-clippy/blob/master/tests/ui
+[`tests/ui-toml`]: https://github.com/rust-lang/rust-clippy/blob/master/tests/ui-toml
 
 ## Cheat Sheet
 
index 78c429ea0132247f555723fb03bf1452bcd3a05c..605897ff49cdb4dc42d468e2976cef59e7f8d9d2 100644 (file)
@@ -98,7 +98,7 @@ cargo dev setup intellij
 ```
 
 More about intellij command usage and reasons
-[here](../CONTRIBUTING.md#intellij-rust)
+[here](https://github.com/rust-lang/rust-clippy/blob/master/CONTRIBUTING.md#intellij-rust)
 
 ## lintcheck
 
index e1ed89262f677c925ff49c0c77d8e20c9de82611..15e00c7d7ce4c3e56faea6be845039c50dc6f034 100644 (file)
@@ -276,4 +276,4 @@ functions to deal with macros:
 [LateContext]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/struct.LateContext.html
 [TyCtxt]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html
 [pat_ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TypeckResults.html#method.pat_ty
-[paths]: ../clippy_utils/src/paths.rs
+[paths]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/paths/index.html
index 337680aa3139b3921d9f959aa25b167f4a2bad55..5d858e0da46898210058e2e678697b1f56081417 100644 (file)
@@ -148,4 +148,4 @@ clippy-driver --edition 2018 -Cpanic=abort foo.rs
 > that are not optimized as expected, for example.
 
 [Installation]: installation.md
-[CI]: continuous_integration
+[CI]: continuous_integration/index.md