Skip to content

missing_inline_in_public_items: false positive on externally exported function #15301

@DaniPopes

Description

@DaniPopes

Summary

Adding #[inline] to an externally exported function triggers unused_attributes, so missing_inline_in_public_items shouldn't trigger.

Lint Name

missing_inline_in_public_items

Reproducer

I tried this code:

#![warn(clippy::missing_inline_in_public_items)]

#[no_mangle]
pub extern "C" fn my_fn() {}

Adding inline gives:

warning: `#[inline]` is ignored on externally exported functions
  --> src/lib.rs:91:1
   |
91 | #[inline]
   | ^^^^^^^^^
   |
   = help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`
   = note: `#[warn(unused_attributes)]` on by default

I expected to see this happen: no fp

Version

rustc 1.90.0-nightly (5795086bd 2025-07-16)
binary: rustc
commit-hash: 5795086bdfe7ed988aa53a110bd0692c33d8755b
commit-date: 2025-07-16
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.8

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions