Skip to content

missing_inline_in_public_items not controllable on individual default trait method #15491

@kpreid

Description

@kpreid

Summary

allow(clippy::missing_inline_in_public_items) has no effect, but should, when applied to a method with a default body in a trait definition.

Lint Name

missing_inline_in_public_items

Reproducer

I tried this code:

#![warn(clippy::missing_inline_in_public_items)]

pub trait Write {
    #[allow(clippy::missing_inline_in_public_items)]
    fn foo(&mut self) {}
}

I saw this happen:

warning: missing `#[inline]` for a default trait method
 --> src/lib.rs:5:5
  |
5 |     fn foo(&mut self) {}
  |     ^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_inline_in_public_items
note: the lint level is defined here
 --> src/lib.rs:1:9
  |
1 | #![warn(clippy::missing_inline_in_public_items)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I expected to see this happen: No warning

Version

rustc 1.89.0 (29483883e 2025-08-04)
binary: rustc
commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2
commit-date: 2025-08-04
host: aarch64-apple-darwin
release: 1.89.0
LLVM version: 20.1.7

Additional Labels

No response

Metadata

Metadata

Assignees

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