better help text for "match -> if let" lint
Implements the suggestion from #87. Changes span_help_and_lint(), which is only used for this lint, to use fileline_help() instead of span_help() to avoid printing the span twice. Also adds complete suggested new code. I had to distinguish between blocks, which need no additionals braces, and other exprs.
This commit is contained in:
@@ -77,10 +77,10 @@ pub fn span_lint(cx: &Context, lint: &'static Lint, sp: Span, msg: &str) {
|
||||
cx.span_lint(lint, sp, msg);
|
||||
}
|
||||
|
||||
pub fn span_help_and_lint(cx: &Context, lint: &'static Lint, span: Span,
|
||||
pub fn span_help_and_lint(cx: &Context, lint: &'static Lint, span: Span,
|
||||
msg: &str, help: &str) {
|
||||
span_lint(cx, lint, span, msg);
|
||||
if cx.current_level(lint) != Level::Allow {
|
||||
cx.sess().span_help(span, help);
|
||||
cx.sess().fileline_help(span, help);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user