Skip to content

Commit

Permalink
str -- borrow fields of self for use in closure since self.iter is bo…
Browse files Browse the repository at this point in the history
…rrowed
  • Loading branch information
nikomatsakis committed Feb 11, 2014
1 parent b0ac40a commit e3ca1c2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/libstd/str.rs
Expand Up @@ -625,15 +625,17 @@ impl<'a> Iterator<char> for Normalizations<'a> {

if !self.sorted {
for ch in self.iter {
let buffer = &mut self.buffer;
let sorted = &mut self.sorted;
decomposer(ch, |d| {
let class = canonical_combining_class(d);
if class == 0 && !self.sorted {
canonical_sort(self.buffer);
self.sorted = true;
if class == 0 && !*sorted {
canonical_sort(*buffer);
*sorted = true;
}
self.buffer.push((d, class));
buffer.push((d, class));
});
if self.sorted { break }
if *sorted { break }
}
}

Expand Down

0 comments on commit e3ca1c2

Please sign in to comment.