Skip to content

Commit

Permalink
Replace into_iter() -> iter() for arrays, fixes 1.42-nightly warning
Browse files Browse the repository at this point in the history
warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added.
   --> src/entity/player.rs:363:11
    |
363 |         ].into_iter().enumerate() {
    |           ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #66145 <rust-lang/rust#66145>
  • Loading branch information
iceiix committed Jan 5, 2020
1 parent 8502c03 commit 20bcddf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/entity/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ impl ecs::System for PlayerRenderer {
[0.0, 16.0, 0.0, 32.0], // Right Leg
[32.0, 48.0, 48.0, 48.0], // Left arm
[40.0, 16.0, 40.0, 32.0], // Right arm
].into_iter().enumerate() {
].iter().enumerate() {
let (ox, oy) = (offsets[0], offsets[1]);
model::append_box(&mut part_verts[i], -2.0/16.0, -12.0/16.0, -2.0/16.0, 4.0/16.0, 12.0/16.0, 4.0/16.0, [
srel!(ox + 8.0, oy + 0.0, 4.0, 4.0), // Down
Expand Down
6 changes: 3 additions & 3 deletions src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,9 +965,9 @@ fn calculate_light(snapshot: &world::Snapshot, orig_x: i32, orig_y: i32, orig_z:
let dy = (oy as f64) * 0.6;
let dz = (oz as f64) * 0.6;

for ox in [-0.6, 0.0].into_iter() {
for oy in [-0.6, 0.0].into_iter() {
for oz in [-0.6, 0.0].into_iter() {
for ox in [-0.6, 0.0].iter() {
for oy in [-0.6, 0.0].iter() {
for oz in [-0.6, 0.0].iter() {
let lx = (x + ox + dx).round() as i32;
let ly = (y + oy + dy).round() as i32;
let lz = (z + oz + dz).round() as i32;
Expand Down
6 changes: 3 additions & 3 deletions src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ impl Renderer {
gl::clear_buffer(gl::COLOR, 1, &[0.0, 0.0, 0.0, 0.0]);
gl::blend_func_separate(gl::ONE_FACTOR, gl::ONE_FACTOR, gl::ZERO_FACTOR, gl::ONE_MINUS_SRC_ALPHA);

for (pos, info) in world.get_render_list().into_iter().rev() {
for (pos, info) in world.get_render_list().iter().rev() {
if let Some(trans) = info.trans.as_ref() {
if trans.count > 0 {
self.chunk_shader_alpha.offset.set_int3(pos.0, pos.1 * 4096, pos.2);
Expand Down Expand Up @@ -737,7 +737,7 @@ impl TransInfo {
buffer.bind(gl::ARRAY_BUFFER);

let mut data = vec![];
for f in [-1.0, 1.0, 1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0, -1.0, 1.0].into_iter() {
for f in [-1.0, 1.0, 1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0, -1.0, 1.0].iter() {
data.write_f32::<NativeEndian>(*f).unwrap();
}
buffer.set_data(gl::ARRAY_BUFFER, &data, gl::STATIC_DRAW);
Expand Down Expand Up @@ -938,7 +938,7 @@ impl TextureManager {
(32, 48, 16, 16),
(40, 16, 16, 16),
];
for bl in blacklist.into_iter() {
for bl in blacklist.iter() {
for x in bl.0 .. (bl.0 + bl.2) {
for y in bl.1 .. (bl.1 + bl.3) {
let mut col = img.get_pixel(x, y);
Expand Down
4 changes: 2 additions & 2 deletions src/server/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Info {
(bound.min.x, bound.max.z),
(bound.max.x, bound.min.z),
(bound.max.x, bound.max.z),
].into_iter() {
].iter() {
model::append_box(&mut parts,
(point.0-LINE_SIZE) as f32, (bound.min.y-LINE_SIZE) as f32, (point.1-LINE_SIZE) as f32,
(LINE_SIZE*2.0) as f32, ((bound.max.y-bound.min.y)+LINE_SIZE*2.0) as f32, (LINE_SIZE*2.0) as f32,
Expand All @@ -69,7 +69,7 @@ impl Info {
(bound.min.x, bound.max.z, bound.max.x, bound.max.z),
(bound.min.x, bound.min.z, bound.min.x, bound.max.z),
(bound.max.x, bound.min.z, bound.max.x, bound.max.z),
].into_iter() {
].iter() {
model::append_box(&mut parts,
(point.0-LINE_SIZE) as f32, (bound.min.y-LINE_SIZE) as f32, (point.1-LINE_SIZE) as f32,
((point.2-point.0)+(LINE_SIZE*2.0)) as f32, (LINE_SIZE*2.0) as f32, ((point.3-point.1)+(LINE_SIZE*2.0)) as f32,
Expand Down
2 changes: 1 addition & 1 deletion src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ impl World {
for pos in [
(-1, 0, 0), (1, 0, 0),
(0, -1, 0), (0, 1, 0),
(0, 0, -1), (0, 0, 1)].into_iter() {
(0, 0, -1), (0, 0, 1)].iter() {
self.flag_section_dirty(x + pos.0, i as i32 + pos.1, z + pos.2);
}
self.update_range(
Expand Down

0 comments on commit 20bcddf

Please sign in to comment.