Function clippy_lints::utils::snippet_block [] [src]

pub fn snippet_block<'a, 'b, T: LintContext<'b>>(cx: &T,
                                                 span: Span,
                                                 default: &'a str)
                                                 -> Cow<'a, str>

Convert a span (from a block) to a code snippet if available, otherwise use default. This trims the code of indentation, except for the first line. Use it for blocks or block-like things which need to be printed as such.

Example

snippet(cx, expr.span, "..")