Add a new lint `doc_overindented_list_items` to detect and fix list items
in docs that are overindented.
For example,
```rs
/// - first line
/// second line
fn foo() {}
```
this would be fixed to:
```rs
/// - first line
/// second line
fn foo() {}
```
This lint improves readabiliy and consistency in doc.
28 lines
693 B
Rust
28 lines
693 B
Rust
#![warn(clippy::doc_overindented_list_items)]
|
|
|
|
#[rustfmt::skip]
|
|
/// - first list item
|
|
/// overindented line
|
|
//~^ ERROR: doc list item overindented
|
|
/// this is overindented line too
|
|
//~^ ERROR: doc list item overindented
|
|
/// - second list item
|
|
fn foo() {}
|
|
|
|
#[rustfmt::skip]
|
|
/// - first list item
|
|
/// overindented line
|
|
//~^ ERROR: doc list item overindented
|
|
/// this is overindented line too
|
|
//~^ ERROR: doc list item overindented
|
|
/// - second list item
|
|
fn bar() {}
|
|
|
|
#[rustfmt::skip]
|
|
/// * first list item
|
|
/// overindented line
|
|
//~^ ERROR: doc list item overindented
|
|
/// this is overindented line too
|
|
//~^ ERROR: doc list item overindented
|
|
/// * second list item
|
|
fn baz() {}
|