From 75f39881d4ad76a2aa2bfacdfbd8d49e5d92a0e8 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sat, 16 Feb 2019 22:52:20 +0100 Subject: [PATCH] Document the new `Sugg` functions --- clippy_lints/src/utils/sugg.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index f9e7bf0c9712..7ff7b71ffa41 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -80,12 +80,15 @@ impl<'a> Sugg<'a> { }) } + /// Same as `hir`, but will use the pre expansion span if the `expr` was in a macro. pub fn hir_with_macro_callsite(cx: &LateContext<'_, '_>, expr: &hir::Expr, default: &'a str) -> Self { let snippet = snippet_with_macro_callsite(cx, expr.span, default); Self::hir_from_snippet(expr, snippet) } + /// Generate a suggestion for an expression with the given snippet. This is used by the `hir_*` + /// function variants of `Sugg`, since these use different snippet functions. fn hir_from_snippet(expr: &hir::Expr, snippet: Cow<'a, str>) -> Self { match expr.node { hir::ExprKind::AddrOf(..)