]> git.lizzy.rs Git - rust.git/commitdiff
Inline some hot lint pass functions.
authorNicholas Nethercote <n.nethercote@gmail.com>
Wed, 7 Dec 2022 03:52:28 +0000 (14:52 +1100)
committerNicholas Nethercote <n.nethercote@gmail.com>
Wed, 7 Dec 2022 08:29:31 +0000 (19:29 +1100)
These each have a single call site, due to being called from a
"combined" lint pass.

compiler/rustc_lint/src/builtin.rs
compiler/rustc_lint/src/hidden_unicode_codepoints.rs
compiler/rustc_lint/src/unused.rs

index 825093384fba7f4688948e4f1eb963decf7fc9e3..db3e0f20423bcf9dfcb68905376b2006b0424e9b 100644 (file)
@@ -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 @@ fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
         }
     }
 
+    #[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 @@ fn check_missing_docs_attrs(
 }
 
 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| {
index 7106e75dba290ebcac26a9deac25964eff0afaec..dc2f5c0e2967e86e45c838e288272132b5eb4bf4 100644 (file)
@@ -121,6 +121,7 @@ fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
         }
     }
 
+    #[inline]
     fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) {
         // byte strings are already handled well enough by `EscapeError::NonAsciiCharInByteString`
         match &expr.kind {
index b5db94f8c0684b3235fa92972c5f453df2c71c6f..df46e37eea8f1e8510f892339d991d9740bf2d85 100644 (file)
@@ -946,6 +946,7 @@ fn check_unused_parens_pat(
 }
 
 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 @@ fn check_stmt(&mut self, cx: &EarlyContext<'_>, s: &ast::Stmt) {
         <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);