From 26c0da41b402854b8e958a10c96733886a783429 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 30 Dec 2022 10:14:10 +1100 Subject: [PATCH 1/2] locktime: Add inline to public functions Add `#[inline]` to all public functions/methods excluding error types and `Display` impls. Error paths do not need to be fast and presumably `Display` is called on code paths that do IO so this also does not need to be fast. --- bitcoin/src/blockdata/locktime/absolute.rs | 16 ++++++++++++++++ bitcoin/src/blockdata/locktime/relative.rs | 5 ++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bitcoin/src/blockdata/locktime/absolute.rs b/bitcoin/src/blockdata/locktime/absolute.rs index 34c255f3..1dd8965d 100644 --- a/bitcoin/src/blockdata/locktime/absolute.rs +++ b/bitcoin/src/blockdata/locktime/absolute.rs @@ -226,6 +226,7 @@ impl LockTime { /// let check = LockTime::from_consensus(100 + 1); /// assert!(lock_time.is_implied_by(check)); /// ``` + #[inline] pub fn is_implied_by(&self, other: LockTime) -> bool { use LockTime::*; @@ -273,18 +274,21 @@ impl LockTime { impl_parse_str_through_int!(LockTime, from_consensus); impl From for LockTime { + #[inline] fn from(h: Height) -> Self { LockTime::Blocks(h) } } impl From