mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
6de87829da
This change addresses cases where doc comments are separated by blank lines, comments, or non-doc-comment attributes, like this: ```rust /// - first line // not part of doc comment /// second line ``` Before this commit, Clippy gave a pedantically-correct warning about how you needed to indent the second line. This is unlikely to be what the user intends, and has been described as a "false positive" (since Clippy is warning you about a highly unintuitive behavior that Rustdoc actually has, we definitely want it to output *something*, but the suggestion to indent was poor). https://github.com/rust-lang/rust-clippy/issues/12917
80 lines
2.2 KiB
Rust
80 lines
2.2 KiB
Rust
#![warn(clippy::doc_lazy_continuation)]
|
|
|
|
/// 1. nest here
|
|
/// lazy continuation
|
|
//~^ ERROR: doc list item without indentation
|
|
fn one() {}
|
|
|
|
/// 1. first line
|
|
/// lazy list continuations don't make warnings with this lint
|
|
///
|
|
//~^ ERROR: doc list item without indentation
|
|
/// because they don't have the
|
|
//~^ ERROR: doc list item without indentation
|
|
fn two() {}
|
|
|
|
/// - nest here
|
|
/// lazy continuation
|
|
//~^ ERROR: doc list item without indentation
|
|
fn three() {}
|
|
|
|
/// - first line
|
|
/// lazy list continuations don't make warnings with this lint
|
|
///
|
|
//~^ ERROR: doc list item without indentation
|
|
/// because they don't have the
|
|
//~^ ERROR: doc list item without indentation
|
|
fn four() {}
|
|
|
|
/// - nest here
|
|
/// lazy continuation
|
|
//~^ ERROR: doc list item without indentation
|
|
fn five() {}
|
|
|
|
/// - - first line
|
|
/// this will warn on the lazy continuation
|
|
///
|
|
//~^ ERROR: doc list item without indentation
|
|
/// and so should this
|
|
//~^ ERROR: doc list item without indentation
|
|
fn six() {}
|
|
|
|
/// - - first line
|
|
///
|
|
/// this is not a lazy continuation
|
|
fn seven() {}
|
|
|
|
#[rustfmt::skip]
|
|
// https://github.com/rust-lang/rust-clippy/pull/12770#issuecomment-2118601768
|
|
/// Returns a list of ProtocolDescriptors from a Serde JSON input.
|
|
///
|
|
/// Defined Protocol Identifiers for the Protocol Descriptor
|
|
/// We intentionally omit deprecated profile identifiers.
|
|
/// From Bluetooth Assigned Numbers:
|
|
/// https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
|
|
///
|
|
/// # Arguments
|
|
/// * `protocol_descriptors`: A Json Representation of the ProtocolDescriptors
|
|
/// to set up. Example:
|
|
/// 'protocol_descriptors': [
|
|
//~^ ERROR: doc list item without indentation
|
|
/// {
|
|
/// 'protocol': 25, # u64 Representation of ProtocolIdentifier::AVDTP
|
|
/// 'params': [
|
|
/// {
|
|
/// 'data': 0x0103 # to indicate 1.3
|
|
/// },
|
|
/// {
|
|
/// 'data': 0x0105 # to indicate 1.5
|
|
/// }
|
|
/// ]
|
|
/// },
|
|
/// {
|
|
/// 'protocol': 1, # u64 Representation of ProtocolIdentifier::SDP
|
|
/// 'params': [{
|
|
/// 'data': 0x0019
|
|
/// }]
|
|
/// }
|
|
/// ]
|
|
//~^ ERROR: doc list item without indentation
|
|
fn eight() {}
|