Remove trait
This commit is contained in:
parent
b44b4ca602
commit
494dd0b719
@ -738,24 +738,7 @@ impl EarlyLintPass for DeprecatedAttr {
|
||||
}
|
||||
}
|
||||
|
||||
trait UnusedDocCommentExt {
|
||||
fn warn_if_doc(
|
||||
&self,
|
||||
cx: &EarlyContext<'_>,
|
||||
node_span: Span,
|
||||
node_kind: &str,
|
||||
attrs: &[ast::Attribute],
|
||||
);
|
||||
}
|
||||
|
||||
impl UnusedDocCommentExt for UnusedDocComment {
|
||||
fn warn_if_doc(
|
||||
&self,
|
||||
cx: &EarlyContext<'_>,
|
||||
node_span: Span,
|
||||
node_kind: &str,
|
||||
attrs: &[ast::Attribute],
|
||||
) {
|
||||
fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &[ast::Attribute]) {
|
||||
let mut attrs = attrs.into_iter().peekable();
|
||||
|
||||
// Accumulate a single span for sugared doc comments.
|
||||
@ -763,9 +746,8 @@ impl UnusedDocCommentExt for UnusedDocComment {
|
||||
|
||||
while let Some(attr) = attrs.next() {
|
||||
if attr.is_doc_comment() {
|
||||
sugared_span = Some(
|
||||
sugared_span.map_or_else(|| attr.span, |span| span.with_hi(attr.span.hi())),
|
||||
);
|
||||
sugared_span =
|
||||
Some(sugared_span.map_or_else(|| attr.span, |span| span.with_hi(attr.span.hi())));
|
||||
}
|
||||
|
||||
if attrs.peek().map(|next_attr| next_attr.is_doc_comment()).unwrap_or_default() {
|
||||
@ -786,7 +768,6 @@ impl UnusedDocCommentExt for UnusedDocComment {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl EarlyLintPass for UnusedDocComment {
|
||||
fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &ast::Stmt) {
|
||||
@ -797,16 +778,16 @@ impl EarlyLintPass for UnusedDocComment {
|
||||
ast::StmtKind::Semi(..) | ast::StmtKind::Expr(..) | ast::StmtKind::Mac(..) => return,
|
||||
};
|
||||
|
||||
self.warn_if_doc(cx, stmt.span, kind, stmt.kind.attrs());
|
||||
warn_if_doc(cx, stmt.span, kind, stmt.kind.attrs());
|
||||
}
|
||||
|
||||
fn check_arm(&mut self, cx: &EarlyContext<'_>, arm: &ast::Arm) {
|
||||
let arm_span = arm.pat.span.with_hi(arm.body.span.hi());
|
||||
self.warn_if_doc(cx, arm_span, "match arms", &arm.attrs);
|
||||
warn_if_doc(cx, arm_span, "match arms", &arm.attrs);
|
||||
}
|
||||
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) {
|
||||
self.warn_if_doc(cx, expr.span, "expressions", &expr.attrs);
|
||||
warn_if_doc(cx, expr.span, "expressions", &expr.attrs);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user