提交 99ae898c 编写于 作者: N nxnfufunezn

Add span_lint_note and span_lint_help to the LintContext

上级 87e26efb
......@@ -435,6 +435,28 @@ fn span_lint(&self, lint: &'static Lint, span: Span, msg: &str) {
self.lookup_and_emit(lint, Some(span), msg);
}
/// Emit a lint and note at the appropriate level, for a particular span.
fn span_lint_note(&self, lint: &'static Lint, span: Span, msg: &str,
note_span: Span, note: &str) {
self.span_lint(lint, span, msg);
if self.current_level(lint) != Level::Allow {
if note_span == span {
self.sess().fileline_note(note_span, note)
} else {
self.sess().span_note(note_span, note)
}
}
}
/// Emit a lint and help at the appropriate level, for a particular span.
fn span_lint_help(&self, lint: &'static Lint, span: Span,
msg: &str, help: &str) {
self.span_lint(lint, span, msg);
if self.current_level(lint) != Level::Allow {
self.sess().span_help(span, help)
}
}
/// Emit a lint at the appropriate level, with no associated span.
fn lint(&self, lint: &'static Lint, msg: &str) {
self.lookup_and_emit(lint, None, msg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册