From f7033bb0433f6a9ba109007027781ba46ea9ba27 Mon Sep 17 00:00:00 2001 From: romanstingler Date: Mon, 11 Aug 2025 22:17:00 +0200 Subject: [PATCH] Add explicit lifetimes to borrowed return types (#411) --- src/attrs.rs | 8 ++++---- src/buffer.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/attrs.rs b/src/attrs.rs index dd105b1..a926c85 100644 --- a/src/attrs.rs +++ b/src/attrs.rs @@ -88,7 +88,7 @@ impl FamilyOwned { } } - pub fn as_family(&self) -> Family { + pub fn as_family(&self) -> Family<'_> { match self { Self::Name(name) => Family::Name(name), Self::Serif => Family::Serif, @@ -388,7 +388,7 @@ impl AttrsOwned { } } - pub fn as_attrs(&self) -> Attrs { + pub fn as_attrs(&self) -> Attrs<'_> { Attrs { color_opt: self.color_opt, family: self.family_owned.as_family(), @@ -422,7 +422,7 @@ impl AttrsList { } /// Get the default [Attrs] - pub fn defaults(&self) -> Attrs { + pub fn defaults(&self) -> Attrs<'_> { self.defaults.as_attrs() } @@ -454,7 +454,7 @@ impl AttrsList { /// Get the attribute span for an index /// /// This returns a span that contains the index - pub fn get_span(&self, index: usize) -> Attrs { + pub fn get_span(&self, index: usize) -> Attrs<'_> { self.spans .get(&index) .map(|v| v.as_attrs()) diff --git a/src/buffer.rs b/src/buffer.rs index 0905c86..9d0154c 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -864,7 +864,7 @@ impl Buffer { } /// Get the visible layout runs for rendering and other tasks - pub const fn layout_runs(&self) -> LayoutRunIter { + pub fn layout_runs(&self) -> LayoutRunIter<'_> { LayoutRunIter::new(self) }