Rollup merge of #115478 - gurry:115462-exprfield-no-warn, r=compiler-errors
Emit unused doc comment warnings for pat and expr fields Fixes #115462
This commit is contained in:
commit
3db7fc1481
4 changed files with 68 additions and 6 deletions
|
@ -1001,8 +1001,22 @@ impl EarlyLintPass for UnusedDocComment {
|
|||
warn_if_doc(cx, arm_span, "match arms", &arm.attrs);
|
||||
}
|
||||
|
||||
fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &ast::Pat) {
|
||||
if let ast::PatKind::Struct(_, _, fields, _) = &pat.kind {
|
||||
for field in fields {
|
||||
warn_if_doc(cx, field.span, "pattern fields", &field.attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) {
|
||||
warn_if_doc(cx, expr.span, "expressions", &expr.attrs);
|
||||
|
||||
if let ExprKind::Struct(s) = &expr.kind {
|
||||
for field in &s.fields {
|
||||
warn_if_doc(cx, field.span, "expression fields", &field.attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn check_generic_param(&mut self, cx: &EarlyContext<'_>, param: &ast::GenericParam) {
|
||||
|
|
|
@ -555,8 +555,8 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
|||
subpattern: pattern,
|
||||
ascription: Ascription {
|
||||
annotation,
|
||||
/// Note that use `Contravariant` here. See the
|
||||
/// `variance` field documentation for details.
|
||||
// Note that use `Contravariant` here. See the
|
||||
// `variance` field documentation for details.
|
||||
variance: ty::Variance::Contravariant,
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue