From 19948ff397119a41db6be997211f78d072305431 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Thu, 30 May 2019 18:13:54 -0700 Subject: [PATCH] Fix redundant imports on rustc 0.35.0. Fixes #175 --- src/chunk_builder.rs | 4 ++-- src/protocol/mod.rs | 2 +- src/render/mod.rs | 4 +++- src/server/mod.rs | 7 ++----- src/world/mod.rs | 8 +------- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/chunk_builder.rs b/src/chunk_builder.rs index 5b6c33f8..a3eb2364 100644 --- a/src/chunk_builder.rs +++ b/src/chunk_builder.rs @@ -9,6 +9,8 @@ use crate::resources; use crate::model; use crate::types::bit::Set; use crate::shared::Direction; +use rand::{self, SeedableRng, Rng}; +use rand_xorshift; const NUM_WORKERS: usize = 8; @@ -109,8 +111,6 @@ struct BuildReply { } fn build_func(id: usize, models: Arc>, work_recv: mpsc::Receiver, built_send: mpsc::Sender<(usize, BuildReply)>) { - use rand::{self, SeedableRng, Rng}; - use rand_xorshift; loop { let BuildReq { snapshot, diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index ae069f95..76a98884 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -22,6 +22,7 @@ use serde_json; use std_or_web::fs; #[cfg(not(target_arch = "wasm32"))] use reqwest; +use hex; pub mod mojang; pub mod forge; @@ -409,7 +410,6 @@ pub struct UUID(u64, u64); impl UUID { pub fn from_str(s: &str) -> UUID { - use hex; // TODO: Panics aren't the best idea here if s.len() != 36 { panic!("Invalid UUID format"); diff --git a/src/render/mod.rs b/src/render/mod.rs index 06139a62..deb2a760 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -40,6 +40,9 @@ use std::sync::atomic::{AtomicIsize, Ordering}; use std::thread; use std::sync::mpsc; +#[cfg(not(target_arch = "wasm32"))] +use reqwest; + const ATLAS_SIZE: usize = 1024; // TEMP @@ -843,7 +846,6 @@ impl TextureManager { #[cfg(not(target_arch = "wasm32"))] fn process_skins(recv: mpsc::Receiver, reply: mpsc::Sender<(String, Option)>) { - use reqwest; let client = reqwest::Client::new(); loop { let hash = match recv.recv() { diff --git a/src/server/mod.rs b/src/server/mod.rs index 2b68dbfc..9c4fc7d7 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -33,6 +33,8 @@ use crate::shared::{Axis, Position}; use crate::format; use rsa_public_encrypt_pkcs1; use log::{error, debug, warn}; +use base64; +use serde_json; mod sun; pub mod plugin_messages; @@ -1072,7 +1074,6 @@ impl Server { }, Some(nbt) => { if block_update.action == 9 { - use crate::format; let line1 = format::Component::from_string(nbt.1.get("Text1").unwrap().as_str().unwrap()); let line2 = format::Component::from_string(nbt.1.get("Text2").unwrap().as_str().unwrap()); let line3 = format::Component::from_string(nbt.1.get("Text3").unwrap().as_str().unwrap()); @@ -1094,7 +1095,6 @@ impl Server { } fn on_sign_update(&mut self, mut update_sign: packet::play::clientbound::UpdateSign) { - use crate::format; format::convert_legacy(&mut update_sign.line1); format::convert_legacy(&mut update_sign.line2); format::convert_legacy(&mut update_sign.line3); @@ -1109,7 +1109,6 @@ impl Server { } fn on_sign_update_u16(&mut self, mut update_sign: packet::play::clientbound::UpdateSign_u16) { - use crate::format; format::convert_legacy(&mut update_sign.line1); format::convert_legacy(&mut update_sign.line2); format::convert_legacy(&mut update_sign.line3); @@ -1130,8 +1129,6 @@ impl Server { fn on_player_info(&mut self, player_info: packet::play::clientbound::PlayerInfo) { use crate::protocol::packet::PlayerDetail::*; - use base64; - use serde_json; for detail in player_info.inner.players { match detail { Add { name, uuid, properties, display, gamemode, ping} => { diff --git a/src/world/mod.rs b/src/world/mod.rs index 6087d160..50786301 100644 --- a/src/world/mod.rs +++ b/src/world/mod.rs @@ -327,8 +327,6 @@ impl World { } pub fn compute_render_list(&mut self, renderer: &mut render::Renderer) { - use crate::chunk_builder; - use std::collections::VecDeque; self.render_list.clear(); let mut valid_dirs = [false; 6]; @@ -587,7 +585,6 @@ impl World { } pub fn load_chunk18(&mut self, x: i32, z: i32, new: bool, _skylight: bool, mask: u16, data: &mut std::io::Cursor>) -> Result<(), protocol::Error> { - use std::io::Read; use byteorder::ReadBytesExt; let cpos = CPos(x, z); @@ -705,9 +702,6 @@ impl World { } fn load_uncompressed_chunk17(&mut self, x: i32, z: i32, new: bool, skylight: bool, mask: u16, mask_add: u16, data: &mut std::io::Cursor>) -> Result<(), protocol::Error> { - use std::io::Read; - use crate::types::nibble; - let cpos = CPos(x, z); { let chunk = if new { @@ -836,7 +830,7 @@ impl World { } pub fn load_chunk19(&mut self, x: i32, z: i32, new: bool, mask: u16, data: Vec) -> Result<(), protocol::Error> { - use std::io::{Cursor, Read}; + use std::io::Cursor; use byteorder::ReadBytesExt; use crate::protocol::{VarInt, Serializable, LenPrefixed};