Function clippy_utils::diagnostics::span_lint_and_note
source · pub fn span_lint_and_note<T: LintContext>(
cx: &T,
lint: &'static Lint,
span: impl Into<MultiSpan>,
msg: &str,
note_span: Option<Span>,
note: &str
)
Expand description
Like span_lint
but with a note
section instead of a help
message.
The note
message is presented separately from the main lint message
and is attached to a specific span:
If you change the signature, remember to update the internal lint CollapsibleCalls
Example
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:10:5
|
10 | forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::forget-ref` implied by `-D warnings`
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:10:12
|
10 | forget(&SomeStruct);
| ^^^^^^^^^^^