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

Replace remaining usage of deprecated Range::step_by #17605

Merged
merged 2 commits into from Jul 5, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -962,13 +962,29 @@ impl InlineFlow {
Some(ref runs) => runs[run_count - run_idx - 1], // reverse order for RTL runs
None => (line.range, bidi::Level::ltr())
};

struct MaybeReverse<I> {
iter: I,
reverse: bool,
}

impl<I: DoubleEndedIterator> Iterator for MaybeReverse<I> {
type Item = I::Item;

fn next(&mut self) -> Option<I::Item> {
if self.reverse {
self.iter.next_back()
} else {
self.iter.next()
}
}
}

// If the bidi embedding direction is opposite the layout direction, lay out this
// run in reverse order.
let reverse = level.is_ltr() != is_ltr;
let fragment_indices = if reverse {
(range.end().get() - 1..range.begin().get() - 1).step_by(-1)
} else {
(range.begin().get()..range.end().get()).step_by(1)
let fragment_indices = MaybeReverse {
iter: range.begin().get()..range.end().get(),
reverse: level.is_ltr() != is_ltr,
};

for fragment_index in fragment_indices {
@@ -8,7 +8,6 @@
#![feature(conservative_impl_trait)]
#![feature(nonzero)]
#![feature(raw)]
#![feature(step_by)]

extern crate app_units;
extern crate atomic_refcell;
@@ -1572,7 +1572,6 @@ pub mod tests {
use builder::HAS_PSEUDO_BIT;
use cssparser::{Parser as CssParser, ToCss, serialize_identifier, ParserInput};
use parser;
use std::borrow::Cow;
use std::collections::HashMap;
use std::fmt;
use super::*;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.