Skip to content

Commit 75f3988

Browse files
committed
Document the new Sugg functions
1 parent 0ce564a commit 75f3988

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clippy_lints/src/utils/sugg.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,15 @@ impl<'a> Sugg<'a> {
8080
})
8181
}
8282

83+
/// Same as `hir`, but will use the pre expansion span if the `expr` was in a macro.
8384
pub fn hir_with_macro_callsite(cx: &LateContext<'_, '_>, expr: &hir::Expr, default: &'a str) -> Self {
8485
let snippet = snippet_with_macro_callsite(cx, expr.span, default);
8586

8687
Self::hir_from_snippet(expr, snippet)
8788
}
8889

90+
/// Generate a suggestion for an expression with the given snippet. This is used by the `hir_*`
91+
/// function variants of `Sugg`, since these use different snippet functions.
8992
fn hir_from_snippet(expr: &hir::Expr, snippet: Cow<'a, str>) -> Self {
9093
match expr.node {
9194
hir::ExprKind::AddrOf(..)

0 commit comments

Comments
 (0)