Inline some hot lint pass functions.
These each have a single call site, due to being called from a "combined" lint pass.
This commit is contained in:
parent
ec117c0ebd
commit
b08fd6e8ef
@ -96,6 +96,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)
|
||||
@ -360,6 +361,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.
|
||||
@ -582,6 +584,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| {
|
||||
|
@ -121,6 +121,7 @@ impl EarlyLintPass for HiddenUnicodeCodepoints {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) {
|
||||
// byte strings are already handled well enough by `EscapeError::NonAsciiCharInByteString`
|
||||
match &expr.kind {
|
||||
|
@ -946,6 +946,7 @@ impl UnusedParens {
|
||||
}
|
||||
|
||||
impl EarlyLintPass for UnusedParens {
|
||||
#[inline]
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
|
||||
match e.kind {
|
||||
ExprKind::Let(ref pat, _, _) | ExprKind::ForLoop(ref pat, ..) => {
|
||||
@ -1164,6 +1165,7 @@ impl EarlyLintPass for UnusedBraces {
|
||||
<Self as UnusedDelimLint>::check_stmt(self, cx, s)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
|
||||
<Self as UnusedDelimLint>::check_expr(self, cx, e);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user