-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overindented lines lint (similar to doc_lazy_continuation
)
#13601
Comments
Just a quick report for future work. I was working on this for a bit, and found some difficulties in automatically applying this rule. For example, doc like /// - First line. Here's an sample object:
/// {
/// 'protocol': 25,
/// 'data': 0xffff
/// }
/// - Second line.
would be fixed into: /// - First line. Here's an sample object:
/// {
/// 'protocol': 25,
/// 'data': 0xffff
/// }
/// - Second line.
Similar UI test exists here: rust-clippy/tests/ui/doc/doc_lazy_list.rs Lines 54 to 76 in ccf7c88
|
Thanks for taking a look!
If I understand correctly, that doc is wrong but for other reasons, which makes it hard to offer fixes for; i.e. it should be e.g. /// - First line. Here's an sample object:
/// ```json
/// {
/// 'protocol': 25,
/// 'data': 0xffff
/// }
/// ```
/// - Second line.
In any case, please note that even if the lint does not offer fixes (automatic or not), it would still be valuable to have it! For instance, here it would have detected that broken documentation text. |
Yeah, you're right.
Agreed. I'll probably take another look later. Thanks! |
Yeah, that last example in |
Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]>
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. --- - \[x] Followed [lint naming conventions][lint_naming] - \[x] Added passing UI tests (including committed `.stderr` file) - \[x] `cargo test` passes locally - \[x] Executed `cargo dev update_lints` - \[x] Added lint documentation - \[x] Run `cargo dev fmt` [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints changelog: [`doc_overindented_list_items`]: Added a new lint that detects overindented list items in docs fixes: #13601
Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. ] Signed-off-by: Miguel Ojeda <[email protected]>
Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]>
commit 2e4f982 upstream. Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 2e4f982 upstream. Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 2e4f982 upstream. Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 2e4f982 upstream. Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 2e4f982 upstream. Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 2e4f982 upstream. Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 2e4f982 upstream. Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 2e4f982 upstream. Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]>
commit 0c5928d upstream. Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 0c5928d upstream. Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 0c5928d upstream. Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 0c5928d upstream. Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 0c5928d upstream. Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 0c5928d upstream. Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 0c5928d upstream. Align bullet points and improve indentation in the `Invariants` section of the `GenDisk` struct documentation for better readability. [ Yutaro is also working on implementing the lint we suggested to catch this sort of issue in upstream Rust: rust-lang/rust-clippy#13601 rust-lang/rust-clippy#13711 Thanks a lot! - Miguel ] Fixes: 3253aba ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: Yutaro Ohno <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/ZxkcU5yTFCagg_lX@ohnotp Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Starting with Rust 1.86.0 (to be released 2025-04-03), Clippy will have a new lint, `doc_overindented_list_items` [1], which catches cases of overindented list items. The lint has been added by Yutaro Ohno, based on feedback from the kernel [2] on a patch that fixed a similar case -- commit 0c5928d ("rust: block: fix formatting in GenDisk doc"). Clippy reports a few cases in the kernel, apart from the one already fixed in the commit above. One is this one: error: doc list item overindented --> rust/kernel/rbtree.rs:1152:5 | 1152 | /// null, it is a pointer to the root of the [`RBTree`]. | ^^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items = note: `-D clippy::doc-overindented-list-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_overindented_list_items)]` Thus clean it up. Cc: Yutaro Ohno <[email protected]> Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Fixes: a335e95 ("rust: rbtree: add `RBTree::entry`") Link: rust-lang/rust-clippy#13711 [1] Link: rust-lang/rust-clippy#13601 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Yutaro Ohno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ There are a few other cases, so updated message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
What it does
The lint reports overindented lines, for instance in bullet lists (and potentially elsewhere?).
This could perhaps be considered a false negative of
doc_lazy_continuation
, but "lazy continuation lines" only cover removing indentation, not adding it.Advantage
The advantages would be similar to
doc_lazy_continuation
:Clearer (easier to read) documentation in plain text form, i.e. unrendered, which is important in some projects.
More consistency in documentation comments across a project (and across different projects, for those that enable the lint).
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: