Skip to content

Commit

Permalink
Document the new Sugg functions
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed Feb 16, 2019
1 parent 21bbd83 commit 186cf45
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clippy_lints/src/utils/sugg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..)
Expand Down

0 comments on commit 186cf45

Please sign in to comment.