mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Replace uses of for foo in bar.iter()
and for foo in bar.iter_mut()
closes #7197
This commit is contained in:
parent
13e7de482c
commit
0038580abf
55 changed files with 141 additions and 154 deletions
|
@ -715,7 +715,7 @@ fn can_interpolate_list(from_list: &Vec<TransformOperation>,
|
|||
}
|
||||
|
||||
// Each transform operation must match primitive type in other list
|
||||
for (from, to) in from_list.iter().zip(to_list.iter()) {
|
||||
for (from, to) in from_list.iter().zip(to_list) {
|
||||
match (from, to) {
|
||||
(&TransformOperation::Matrix(..), &TransformOperation::Matrix(..)) |
|
||||
(&TransformOperation::Skew(..), &TransformOperation::Skew(..)) |
|
||||
|
@ -740,7 +740,7 @@ fn interpolate_transform_list(from_list: &Vec<TransformOperation>,
|
|||
let mut result = vec!();
|
||||
|
||||
if can_interpolate_list(from_list, to_list) {
|
||||
for (from, to) in from_list.iter().zip(to_list.iter()) {
|
||||
for (from, to) in from_list.iter().zip(to_list) {
|
||||
match (from, to) {
|
||||
(&TransformOperation::Matrix(from),
|
||||
&TransformOperation::Matrix(_to)) => {
|
||||
|
@ -870,4 +870,3 @@ impl<T> GetMod for Vec<T> {
|
|||
&(*self)[i % self.len()]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1112,7 +1112,7 @@ pub mod longhands {
|
|||
impl ToCss for SpecifiedValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
let mut first = true;
|
||||
for pair in self.0.iter() {
|
||||
for pair in &self.0 {
|
||||
if !first {
|
||||
try!(dest.write_str(" "));
|
||||
}
|
||||
|
@ -1186,7 +1186,7 @@ pub mod longhands {
|
|||
impl ToCss for SpecifiedValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
let mut first = true;
|
||||
for pair in self.0.iter() {
|
||||
for pair in &self.0 {
|
||||
if !first {
|
||||
try!(dest.write_str(" "));
|
||||
}
|
||||
|
@ -3313,7 +3313,7 @@ pub mod longhands {
|
|||
pub fn opacity(&self) -> CSSFloat {
|
||||
let mut opacity = 1.0;
|
||||
|
||||
for filter in self.filters.iter() {
|
||||
for filter in &self.filters {
|
||||
if let Filter::Opacity(ref opacity_value) = *filter {
|
||||
opacity *= *opacity_value
|
||||
}
|
||||
|
@ -3635,7 +3635,7 @@ pub mod longhands {
|
|||
impl ToCss for SpecifiedValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
let mut first = true;
|
||||
for operation in self.0.iter() {
|
||||
for operation in &self.0 {
|
||||
if !first {
|
||||
try!(dest.write_str(" "));
|
||||
}
|
||||
|
@ -3889,7 +3889,7 @@ pub mod longhands {
|
|||
}
|
||||
|
||||
let mut result = vec!();
|
||||
for operation in self.0.iter() {
|
||||
for operation in &self.0 {
|
||||
match *operation {
|
||||
SpecifiedOperation::Matrix(ref matrix) => {
|
||||
result.push(computed_value::ComputedOperation::Matrix(*matrix));
|
||||
|
@ -6219,7 +6219,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
|
|||
|
||||
// Initialize `context`
|
||||
// Declarations blocks are already stored in increasing precedence order.
|
||||
for sub_list in applicable_declarations.iter() {
|
||||
for sub_list in applicable_declarations {
|
||||
// Declarations are stored in reverse source order, we want them in forward order here.
|
||||
for declaration in sub_list.declarations.iter().rev() {
|
||||
match *declaration {
|
||||
|
|
|
@ -60,7 +60,7 @@ impl Stylist {
|
|||
// FIXME: Add iso-8859-9.css when the document’s encoding is ISO-8859-8.
|
||||
// FIXME: presentational-hints.css should be at author origin with zero specificity.
|
||||
// (Does it make a difference?)
|
||||
for &filename in ["user-agent.css", "servo.css", "presentational-hints.css"].iter() {
|
||||
for &filename in &["user-agent.css", "servo.css", "presentational-hints.css"] {
|
||||
match read_resource_file(&[filename]) {
|
||||
Ok(res) => {
|
||||
let ua_stylesheet = Stylesheet::from_bytes(
|
||||
|
@ -104,7 +104,7 @@ impl Stylist {
|
|||
self.after_map = PerPseudoElementSelectorMap::new();
|
||||
self.rules_source_order = 0;
|
||||
|
||||
for stylesheet in self.stylesheets.iter() {
|
||||
for stylesheet in &self.stylesheets {
|
||||
let (mut element_map, mut before_map, mut after_map) = match stylesheet.origin {
|
||||
Origin::UserAgent => (
|
||||
&mut self.element_map.user_agent,
|
||||
|
@ -129,7 +129,7 @@ impl Stylist {
|
|||
macro_rules! append(
|
||||
($style_rule: ident, $priority: ident) => {
|
||||
if $style_rule.declarations.$priority.len() > 0 {
|
||||
for selector in $style_rule.selectors.iter() {
|
||||
for selector in &$style_rule.selectors {
|
||||
let map = match selector.pseudo_element {
|
||||
None => &mut element_map,
|
||||
Some(PseudoElement::Before) => &mut before_map,
|
||||
|
|
|
@ -671,7 +671,7 @@ pub mod specified {
|
|||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
try!(dest.write_str("linear-gradient("));
|
||||
try!(self.angle_or_corner.to_css(dest));
|
||||
for stop in self.stops.iter() {
|
||||
for stop in &self.stops {
|
||||
try!(dest.write_str(", "));
|
||||
try!(stop.to_css(dest));
|
||||
}
|
||||
|
@ -1160,7 +1160,7 @@ pub mod computed {
|
|||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
try!(dest.write_str("linear-gradient("));
|
||||
try!(self.angle_or_corner.to_css(dest));
|
||||
for stop in self.stops.iter() {
|
||||
for stop in &self.stops {
|
||||
try!(dest.write_str(", "));
|
||||
try!(stop.to_css(dest));
|
||||
}
|
||||
|
@ -1172,7 +1172,7 @@ pub mod computed {
|
|||
impl fmt::Debug for LinearGradient {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let _ = write!(f, "{:?}", self.angle_or_corner);
|
||||
for stop in self.stops.iter() {
|
||||
for stop in &self.stops {
|
||||
let _ = write!(f, ", {:?}", stop);
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -363,7 +363,7 @@ impl ViewportConstraints {
|
|||
let mut orientation = Orientation::Auto;
|
||||
|
||||
// collapse the list of declarations into descriptor values
|
||||
for declaration in rule.declarations.iter() {
|
||||
for declaration in &rule.declarations {
|
||||
match declaration.descriptor {
|
||||
ViewportDescriptor::MinWidth(value) => min_width = Some(value),
|
||||
ViewportDescriptor::MaxWidth(value) => max_width = Some(value),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue