5f3c340bfb
As discussed in rust-lang/rust#47475 the #[inline] attribute is currently allowed on trait methods without bodies (i.e. without a default implementation). This is misleading as it could be interpreted as affecting the implementations of the trait method. Add a lint for any use of #[inline] on a trait method without a body. Fixes rust-lang/rust#47475
19 lines
216 B
Rust
19 lines
216 B
Rust
|
|
|
|
|
|
#![warn(inline_fn_without_body)]
|
|
#![allow(inline_always)]
|
|
trait Foo {
|
|
#[inline]
|
|
fn default_inline();
|
|
|
|
#[inline(always)]
|
|
fn always_inline();
|
|
|
|
#[inline]
|
|
fn has_body() {
|
|
}
|
|
}
|
|
|
|
fn main() {}
|