Document the new Sugg functions

This commit is contained in:
flip1995 2019-02-16 22:52:20 +01:00
parent 0ce564a7e1
commit 75f39881d4
No known key found for this signature in database
GPG key ID: 693086869D506637

View file

@ -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(..)