Auto merge of #105416 - nnethercote:more-linting-tweaks, r=cjgillot

More linting tweaks

Squeeze a little more blood from this stone.

r? `@cjgillot`
This commit is contained in:
bors 2022-12-10 19:49:51 +00:00
commit c6fcdb6906
6 changed files with 80 additions and 58 deletions

View file

@ -97,6 +97,7 @@ fn pierce_parens(mut expr: &ast::Expr) -> &ast::Expr {
}
impl EarlyLintPass for WhileTrue {
#[inline]
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
if let ast::ExprKind::While(cond, _, label) = &e.kind
&& let cond = pierce_parens(cond)
@ -361,6 +362,7 @@ impl EarlyLintPass for UnsafeCode {
}
}
#[inline]
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
if let ast::ExprKind::Block(ref blk, _) = e.kind {
// Don't warn about generated blocks; that'll just pollute the output.
@ -583,6 +585,7 @@ impl MissingDoc {
}
impl<'tcx> LateLintPass<'tcx> for MissingDoc {
#[inline]
fn enter_lint_attrs(&mut self, _cx: &LateContext<'_>, attrs: &[ast::Attribute]) {
let doc_hidden = self.doc_hidden()
|| attrs.iter().any(|attr| {