blob: c0b14c2a4b66e3cdfe9c3d88251e7e862352879c [file]
use super::INLINE_ALWAYS;
use clippy_utils::diagnostics::span_lint;
use rustc_hir::attrs::InlineAttr;
use rustc_hir::{Attribute, find_attr};
use rustc_lint::LateContext;
use rustc_span::Span;
use rustc_span::symbol::Symbol;
pub(super) fn check(cx: &LateContext<'_>, span: Span, name: Symbol, attrs: &[Attribute]) {
if span.from_expansion() {
return;
}
if let Some(span) = find_attr!(attrs, Inline(InlineAttr::Always, span) => *span) {
span_lint(
cx,
INLINE_ALWAYS,
span,
format!("you have declared `#[inline(always)]` on `{name}`. This is usually a bad idea"),
);
}
}