pub fn span_lint_and_sugg<T: LintContext>(
    cx: &T,
    lint: &'static Lint,
    sp: Span,
    msg: &str,
    help: &str,
    sugg: String,
    applicability: Applicability
)
Expand description

Add a span lint with a suggestion on how to fix it.

These suggestions can be parsed by rustfix to allow it to automatically fix your code. In the example below, help is "try" and sugg is the suggested replacement ".any(|x| x > 2)".

If you change the signature, remember to update the internal lint CollapsibleCalls

§Example

error: This `.fold` can be more succinctly expressed as `.any`
--> tests/ui/methods.rs:390:13
    |
390 |     let _ = (0..3).fold(false, |acc, x| acc || x > 2);
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)`
    |
    = note: `-D fold-any` implied by `-D warnings`