Skip to content

Commit 6b1f2a6

Browse files
committed
Auto merge of #8947 - Serial-ATA:lint-produces-output, r=<try>
Add lint output to lint list changelog: Add the ability to show the lint output in the lint list This just adds the logic to produce the output, it hasn't been added to any lints yet. It did help find some mistakes in some docs though 😄. ### Screenshots <details> <summary>A single code block</summary> ![single-code-block](https://user-images.githubusercontent.com/69764315/172013766-145b22b1-1d91-4fb8-9cd0-b967a52d6330.png) </details> <details> <summary>A single code block with a "Use instead" section</summary> ![with-usage](https://user-images.githubusercontent.com/69764315/172013792-d2dd6c9c-defa-41e0-8c27-8e8e311adb63.png) </details> <details> <summary>Multiple code blocks</summary> ![multi-code-block](https://user-images.githubusercontent.com/69764315/172013808-5328f59b-e7c5-4914-a396-253822a6d350.png) </details> This is the last task in #7172 🎉. r? `@xFrednet` (?)
2 parents c07cbb9 + fdadebe commit 6b1f2a6

File tree

9 files changed

+246
-32
lines changed

9 files changed

+246
-32
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ rustc_tools_util = { version = "0.2", path = "rustc_tools_util" }
5959
[features]
6060
deny-warnings = ["clippy_lints/deny-warnings"]
6161
integration = ["tempfile"]
62-
internal = ["clippy_lints/internal"]
62+
internal = ["clippy_lints/internal", "tempfile"]
6363

6464
[package.metadata.rust-analyzer]
6565
# This package uses #[feature(rustc_private)]

clippy_lints/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ edition = "2021"
1010

1111
[dependencies]
1212
cargo_metadata = "0.14"
13+
clippy_dev = { path = "../clippy_dev", optional = true }
1314
clippy_utils = { path = "../clippy_utils" }
1415
if_chain = "1.0"
1516
itertools = "0.10.1"
@@ -18,6 +19,7 @@ quine-mc_cluskey = "0.2"
1819
regex-syntax = "0.6"
1920
serde = { version = "1.0", features = ["derive"] }
2021
serde_json = { version = "1.0", optional = true }
22+
tempfile = { version = "3.3.0", optional = true }
2123
toml = "0.5"
2224
unicode-normalization = "0.1"
2325
unicode-script = { version = "0.5", default-features = false }
@@ -30,7 +32,7 @@ url = { version = "2.2", features = ["serde"] }
3032
[features]
3133
deny-warnings = ["clippy_utils/deny-warnings"]
3234
# build clippy with internal lints enabled, off by default
33-
internal = ["clippy_utils/internal", "serde_json"]
35+
internal = ["clippy_utils/internal", "serde_json", "tempfile", "clippy_dev"]
3436

3537
[package.metadata.rust-analyzer]
3638
# This crate uses #[feature(rustc_private)]

clippy_lints/src/collapsible_if.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ declare_clippy_lint! {
3232
/// makes code look more complex than it really is.
3333
///
3434
/// ### Example
35-
/// ```rust,ignore
35+
/// ```rust
36+
/// # let (x, y) = (true, true);
3637
/// if x {
3738
/// if y {
38-
/// …
39+
/// //
3940
/// }
4041
/// }
41-
///
4242
/// ```
4343
///
4444
/// Use instead:
45-
///
46-
/// ```rust,ignore
45+
/// ```rust
46+
/// # let (x, y) = (true, true);
4747
/// if x && y {
48-
/// …
48+
/// //
4949
/// }
5050
/// ```
5151
#[clippy::version = "pre 1.29.0"]

clippy_lints/src/doc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ declare_clippy_lint! {
178178
/// if the `fn main()` is left implicit.
179179
///
180180
/// ### Examples
181-
/// ``````rust
181+
/// ```rust
182182
/// /// An example of a doctest with a `main()` function
183183
/// ///
184184
/// /// # Examples
@@ -191,7 +191,7 @@ declare_clippy_lint! {
191191
/// fn needless_main() {
192192
/// unimplemented!();
193193
/// }
194-
/// ``````
194+
/// ```
195195
#[clippy::version = "1.40.0"]
196196
pub NEEDLESS_DOCTEST_MAIN,
197197
style,

clippy_lints/src/large_include_file.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ declare_clippy_lint! {
2222
/// let included_bytes = include_bytes!("very_large_file.txt");
2323
/// ```
2424
///
25-
/// Instead, you can load the file at runtime:
25+
/// Use instead:
2626
/// ```rust,ignore
2727
/// use std::fs;
2828
///
29+
/// // You can load the file at runtime
2930
/// let string = fs::read_to_string("very_large_file.txt")?;
3031
/// let bytes = fs::read("very_large_file.txt")?;
3132
/// ```

clippy_lints/src/literal_representation.rs

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ declare_clippy_lint! {
5151
/// - Does not match on `_127` since that is a valid grouping for decimal and octal numbers
5252
///
5353
/// ### Example
54+
/// ```ignore
5455
/// `2_32` => `2_i32`
5556
/// `250_8 => `250_u8`
5657
/// ```

0 commit comments

Comments
 (0)