Skip to content

Commit e3ca1c2

Browse files
committed
str -- borrow fields of self for use in closure since self.iter is borrowed
1 parent b0ac40a commit e3ca1c2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/libstd/str.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,17 @@ impl<'a> Iterator<char> for Normalizations<'a> {
625625

626626
if !self.sorted {
627627
for ch in self.iter {
628+
let buffer = &mut self.buffer;
629+
let sorted = &mut self.sorted;
628630
decomposer(ch, |d| {
629631
let class = canonical_combining_class(d);
630-
if class == 0 && !self.sorted {
631-
canonical_sort(self.buffer);
632-
self.sorted = true;
632+
if class == 0 && !*sorted {
633+
canonical_sort(*buffer);
634+
*sorted = true;
633635
}
634-
self.buffer.push((d, class));
636+
buffer.push((d, class));
635637
});
636-
if self.sorted { break }
638+
if *sorted { break }
637639
}
638640
}
639641

0 commit comments

Comments
 (0)