Skip to content

Commit b08fd6e

Browse files
committed
Inline some hot lint pass functions.
These each have a single call site, due to being called from a "combined" lint pass.
1 parent ec117c0 commit b08fd6e

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

compiler/rustc_lint/src/builtin.rs

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ fn pierce_parens(mut expr: &ast::Expr) -> &ast::Expr {
9696
}
9797

9898
impl EarlyLintPass for WhileTrue {
99+
#[inline]
99100
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
100101
if let ast::ExprKind::While(cond, _, label) = &e.kind
101102
&& let cond = pierce_parens(cond)
@@ -360,6 +361,7 @@ impl EarlyLintPass for UnsafeCode {
360361
}
361362
}
362363

364+
#[inline]
363365
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
364366
if let ast::ExprKind::Block(ref blk, _) = e.kind {
365367
// Don't warn about generated blocks; that'll just pollute the output.
@@ -582,6 +584,7 @@ impl MissingDoc {
582584
}
583585

584586
impl<'tcx> LateLintPass<'tcx> for MissingDoc {
587+
#[inline]
585588
fn enter_lint_attrs(&mut self, _cx: &LateContext<'_>, attrs: &[ast::Attribute]) {
586589
let doc_hidden = self.doc_hidden()
587590
|| attrs.iter().any(|attr| {

compiler/rustc_lint/src/hidden_unicode_codepoints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ impl EarlyLintPass for HiddenUnicodeCodepoints {
121121
}
122122
}
123123

124+
#[inline]
124125
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) {
125126
// byte strings are already handled well enough by `EscapeError::NonAsciiCharInByteString`
126127
match &expr.kind {

compiler/rustc_lint/src/unused.rs

+2
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ impl UnusedParens {
946946
}
947947

948948
impl EarlyLintPass for UnusedParens {
949+
#[inline]
949950
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
950951
match e.kind {
951952
ExprKind::Let(ref pat, _, _) | ExprKind::ForLoop(ref pat, ..) => {
@@ -1164,6 +1165,7 @@ impl EarlyLintPass for UnusedBraces {
11641165
<Self as UnusedDelimLint>::check_stmt(self, cx, s)
11651166
}
11661167

1168+
#[inline]
11671169
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
11681170
<Self as UnusedDelimLint>::check_expr(self, cx, e);
11691171

0 commit comments

Comments
 (0)