Skip to content

Commit 03551ce

Browse files
authored
Don't inline functions that are never called (#346)
Our traits define the `only_derive_is_allowed_to_implement_this_trait` method. It is `#[doc(hidden)]`, exists only as a speedbump to manual impls, and is presumably never called by users. It's a waste to have it marked as `#[inline]`.
1 parent 3773da2 commit 03551ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/macros.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ macro_rules! safety_comment {
3232
macro_rules! unsafe_impl {
3333
// Implement `$trait` for `$ty` with no bounds.
3434
($ty:ty: $trait:ty) => {
35-
unsafe impl $trait for $ty { #[inline] fn only_derive_is_allowed_to_implement_this_trait() {} }
35+
unsafe impl $trait for $ty { #[allow(clippy::missing_inline_in_public_items)] fn only_derive_is_allowed_to_implement_this_trait() {} }
3636
};
3737
// Implement all `$traits` for `$ty` with no bounds.
3838
($ty:ty: $($traits:ty),*) => {
@@ -92,7 +92,8 @@ macro_rules! unsafe_impl {
9292
=> $trait:ident for $ty:ty
9393
) => {
9494
unsafe impl<$(const $constname: $constty,)* $($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> $trait for $ty {
95-
#[inline] fn only_derive_is_allowed_to_implement_this_trait() {}
95+
#[allow(clippy::missing_inline_in_public_items)]
96+
fn only_derive_is_allowed_to_implement_this_trait() {}
9697
}
9798
};
9899
}

0 commit comments

Comments
 (0)