Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use longer lifetime when returning normalize iter #6060

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions components/normalizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1763,10 +1763,10 @@ impl DecomposingNormalizerBorrowed<'static> {
}
}

impl DecomposingNormalizerBorrowed<'_> {
impl<'data> DecomposingNormalizerBorrowed<'data> {
/// Wraps a delegate iterator into a decomposing iterator
/// adapter by using the data already held by this normalizer.
pub fn normalize_iter<I: Iterator<Item = char>>(&self, iter: I) -> Decomposition<I> {
pub fn normalize_iter<I: Iterator<Item = char>>(&self, iter: I) -> Decomposition<'data, I> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these functions also take self? It's going to copy those parameters anyway.

Decomposition::new_with_supplements(
iter,
self.decompositions,
Expand Down Expand Up @@ -2335,18 +2335,18 @@ impl ComposingNormalizerBorrowed<'static> {
}
}

impl ComposingNormalizerBorrowed<'_> {
impl<'data> ComposingNormalizerBorrowed<'data> {
/// Wraps a delegate iterator into a composing iterator
/// adapter by using the data already held by this normalizer.
pub fn normalize_iter<I: Iterator<Item = char>>(&self, iter: I) -> Composition<I> {
pub fn normalize_iter<I: Iterator<Item = char>>(&self, iter: I) -> Composition<'data, I> {
self.normalize_iter_private(iter, IgnorableBehavior::Unsupported)
}

fn normalize_iter_private<I: Iterator<Item = char>>(
&self,
iter: I,
ignorable_behavior: IgnorableBehavior,
) -> Composition<I> {
) -> Composition<'data, I> {
Composition::new(
Decomposition::new_with_supplements(
iter,
Expand Down
Loading