diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2017-10-11 20:17:16 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2017-10-11 20:17:16 +0200 |
commit | cbcc7d080211a5706937d991145fea0c76a0f248 (patch) | |
tree | 31d1a10d84517f0b40b86f4923804cd831c98f43 | |
parent | a38df68e8aa7e237b52a46e6437b14a029ea001a (diff) | |
download | servo-cbcc7d080211a5706937d991145fea0c76a0f248.tar.gz servo-cbcc7d080211a5706937d991145fea0c76a0f248.zip |
Remove usage of unstable feature iterator_step_by
-rw-r--r-- | components/net/image_cache.rs | 5 | ||||
-rw-r--r-- | components/net/lib.rs | 1 | ||||
-rw-r--r-- | components/net_traits/image/base.rs | 5 | ||||
-rw-r--r-- | components/net_traits/lib.rs | 1 |
4 files changed, 8 insertions, 4 deletions
diff --git a/components/net/image_cache.rs b/components/net/image_cache.rs index 920330008d1..e4401ac64a0 100644 --- a/components/net/image_cache.rs +++ b/components/net/image_cache.rs @@ -109,7 +109,8 @@ fn is_image_opaque(format: webrender_api::ImageFormat, bytes: &[u8]) -> bool { fn premultiply(data: &mut [u8]) { let length = data.len(); - for i in Iterator::step_by(0..length, 4) { + let mut i = 0; + while i < length { let b = data[i + 0] as u32; let g = data[i + 1] as u32; let r = data[i + 2] as u32; @@ -118,6 +119,8 @@ fn premultiply(data: &mut [u8]) { data[i + 0] = (b * a / 255) as u8; data[i + 1] = (g * a / 255) as u8; data[i + 2] = (r * a / 255) as u8; + + i += 4; } } diff --git a/components/net/lib.rs b/components/net/lib.rs index c22825ad066..5b85793f71d 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -4,7 +4,6 @@ #![deny(unsafe_code)] #![feature(box_syntax)] -#![feature(iterator_step_by)] extern crate base64; extern crate brotli; diff --git a/components/net_traits/image/base.rs b/components/net_traits/image/base.rs index 9b66b131c53..0c6e023cece 100644 --- a/components/net_traits/image/base.rs +++ b/components/net_traits/image/base.rs @@ -50,7 +50,8 @@ pub struct ImageMetadata { fn byte_swap_and_premultiply(data: &mut [u8]) { let length = data.len(); - for i in Iterator::step_by(0..length, 4) { + let mut i = 0; + while i < length { let r = data[i + 2]; let g = data[i + 1]; let b = data[i + 0]; @@ -58,6 +59,8 @@ fn byte_swap_and_premultiply(data: &mut [u8]) { data[i + 0] = r; data[i + 1] = g; data[i + 2] = b; + + i += 4; } } diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 5625d111119..98485d927da 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(box_syntax)] -#![feature(iterator_step_by)] #![deny(unsafe_code)] |