From 77cd4ecf3541de3ee53cd2b2975ec56e2b214e50 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Sun, 4 Nov 2018 13:43:30 -0800 Subject: [PATCH] Use field init shorthand, instead of x:x, just x, https://rust-lang-nursery.github.io/edition-guide/rust-2018/data-types/field-init-shorthand.html find src -name '*.rs' -exec perl -pe 's/\b(\w+): \1,/$1,/g' -i {} \; --- shared/src/position.rs | 6 +++--- src/chunk_builder.rs | 20 +++++++++--------- src/console/mod.rs | 2 +- src/ecs/mod.rs | 4 ++-- src/entity/block_entity/sign.rs | 6 +++--- src/entity/mod.rs | 10 ++++----- src/entity/player.rs | 26 ++++++++++++------------ src/entity/systems.rs | 22 ++++++++++---------- src/format.rs | 6 +++--- src/gl/mod.rs | 2 +- src/main.rs | 8 ++++---- src/model/mod.rs | 10 ++++----- src/protocol/mod.rs | 14 ++++++------- src/protocol/packet.rs | 10 ++++----- src/render/atlas.rs | 10 ++++----- src/render/clouds.rs | 32 ++++++++++++++--------------- src/render/mod.rs | 36 ++++++++++++++++----------------- src/render/model.rs | 8 ++++---- src/render/ui.rs | 14 ++++++------- src/resources.rs | 6 +++--- src/screen/connecting.rs | 2 +- src/screen/edit_server.rs | 4 ++-- src/screen/login.rs | 18 ++++++++--------- src/screen/mod.rs | 2 +- src/screen/server_list.rs | 22 ++++++++++---------- src/screen/settings_menu.rs | 8 ++++---- src/server/mod.rs | 24 +++++++++++----------- src/server/plugin_messages.rs | 2 +- src/server/target.rs | 4 ++-- src/types/bit/map.rs | 2 +- src/types/metadata.rs | 2 +- src/ui/logo.rs | 6 +++--- src/ui/mod.rs | 6 +++--- src/world/biome.rs | 2 +- src/world/mod.rs | 10 ++++----- 35 files changed, 183 insertions(+), 183 deletions(-) diff --git a/shared/src/position.rs b/shared/src/position.rs index a823202..c2ad4f1 100644 --- a/shared/src/position.rs +++ b/shared/src/position.rs @@ -13,9 +13,9 @@ pub struct Position { impl Position { pub fn new(x: i32, y: i32, z: i32) -> Position { Position { - x: x, - y: y, - z: z, + x, + y, + z, } } diff --git a/src/chunk_builder.rs b/src/chunk_builder.rs index 3fdef6d..0a2cfa6 100644 --- a/src/chunk_builder.rs +++ b/src/chunk_builder.rs @@ -37,10 +37,10 @@ impl ChunkBuilder { free.push((i, vec![], vec![])); } ChunkBuilder { - threads: threads, + threads, free_builders: free, - built_recv: built_recv, - models: models, + built_recv, + models, resource_version: 0xFFFF, } } @@ -80,7 +80,7 @@ impl ChunkBuilder { let mut snapshot = world.capture_snapshot(cx - 2, cy - 2, cz - 2, 20, 20, 20); snapshot.make_relative(-2, -2, -2); self.threads[t_id.0].0.send(BuildReq { - snapshot: snapshot, + snapshot, position: (x, y, z), solid_buffer: t_id.1, trans_buffer: t_id.2, @@ -189,12 +189,12 @@ fn build_func(id: usize, models: Arc>, work_recv: mpsc::R let cull_info = build_cull_info(&snapshot); built_send.send((id, BuildReply { - position: position, - solid_buffer: solid_buffer, - solid_count: solid_count, - trans_buffer: trans_buffer, - trans_count: trans_count, - cull_info: cull_info, + position, + solid_buffer, + solid_count, + trans_buffer, + trans_count, + cull_info, })).unwrap(); } } diff --git a/src/console/mod.rs b/src/console/mod.rs index 591ef0e..f994c4a 100644 --- a/src/console/mod.rs +++ b/src/console/mod.rs @@ -242,7 +242,7 @@ impl Console { .draw_index(500) .create(ui_container); self.elements = Some(ConsoleElements { - background: background, + background, lines: vec![], }); self.dirty = true; diff --git a/src/ecs/mod.rs b/src/ecs/mod.rs index 627054a..81ed279 100644 --- a/src/ecs/mod.rs +++ b/src/ecs/mod.rs @@ -228,7 +228,7 @@ impl Manager { }); entity.1 += 1; return Entity { - id: id, + id, generation: entity.1, } } @@ -242,7 +242,7 @@ impl Manager { 0 )); Entity { - id: id, + id, generation: 0, } } diff --git a/src/entity/block_entity/sign.rs b/src/entity/block_entity/sign.rs index 060210f..27fa73c 100644 --- a/src/entity/block_entity/sign.rs +++ b/src/entity/block_entity/sign.rs @@ -57,8 +57,8 @@ impl SignRenderer { filter: ecs::Filter::new() .with(position) .with(sign_info), - position: position, - sign_info: sign_info, + position, + sign_info, } } } @@ -145,7 +145,7 @@ impl ecs::System for SignRenderer { width: 0.0, offset: 0.0, text: Vec::new(), - renderer: renderer, + renderer, y_scale: Y_SCALE, x_scale: X_SCALE, }; diff --git a/src/entity/mod.rs b/src/entity/mod.rs index b5e7572..8b5f432 100644 --- a/src/entity/mod.rs +++ b/src/entity/mod.rs @@ -97,8 +97,8 @@ pub struct Rotation { impl Rotation { pub fn new(yaw: f64, pitch: f64) -> Rotation { Rotation { - yaw: yaw, - pitch: pitch, + yaw, + pitch, } } @@ -115,8 +115,8 @@ pub struct TargetRotation { impl TargetRotation { pub fn new(yaw: f64, pitch: f64) -> TargetRotation { TargetRotation { - yaw: yaw, - pitch: pitch, + yaw, + pitch, } } @@ -141,7 +141,7 @@ pub struct Bounds { impl Bounds { pub fn new(bounds: Aabb3) -> Bounds { Bounds { - bounds: bounds, + bounds, } } } diff --git a/src/entity/player.rs b/src/entity/player.rs index 8f103b3..ca869cb 100644 --- a/src/entity/player.rs +++ b/src/entity/player.rs @@ -93,9 +93,9 @@ impl PlayerModel { dirty: false, name: name.to_owned(), - has_head: has_head, - has_name_tag: has_name_tag, - first_person: first_person, + has_head, + has_name_tag, + first_person, dir: 0, time: 0.0, @@ -132,11 +132,11 @@ impl PlayerRenderer { .with(position) .with(rotation) .with(light), - player_model: player_model, - position: position, - rotation: rotation, + player_model, + position, + rotation, game_info: m.get_key(), - light: light, + light, } } } @@ -386,7 +386,7 @@ impl ecs::System for PlayerRenderer { width: 0.0, offset: 0.0, text: Vec::new(), - renderer: renderer, + renderer, y_scale: 0.16, x_scale: 0.01, }; @@ -505,13 +505,13 @@ impl MovementHandler { .with(velocity) .with(bounds) .with(rotation), - movement: movement, + movement, gravity: m.get_key(), gamemode: m.get_key(), - position: position, - velocity: velocity, - bounds: bounds, - rotation: rotation, + position, + velocity, + bounds, + rotation, } } } diff --git a/src/entity/systems.rs b/src/entity/systems.rs index ca026b7..06b9fe1 100644 --- a/src/entity/systems.rs +++ b/src/entity/systems.rs @@ -21,8 +21,8 @@ impl ApplyVelocity { filter: ecs::Filter::new() .with(position) .with(velocity), - position: position, - velocity: velocity, + position, + velocity, movement: m.get_key(), } } @@ -61,7 +61,7 @@ impl ApplyGravity { filter: ecs::Filter::new() .with(gravity) .with(velocity), - velocity: velocity, + velocity, movement: m.get_key(), } } @@ -100,7 +100,7 @@ impl UpdateLastPosition { UpdateLastPosition { filter: ecs::Filter::new() .with(position), - position: position, + position, } } } @@ -136,8 +136,8 @@ impl LerpPosition { filter: ecs::Filter::new() .with(position) .with(target_position), - position: position, - target_position: target_position, + position, + target_position, game_info: m.get_key(), } } @@ -180,8 +180,8 @@ impl LerpRotation { filter: ecs::Filter::new() .with(rotation) .with(target_rotation), - rotation: rotation, - target_rotation: target_rotation, + rotation, + target_rotation, game_info: m.get_key(), } } @@ -238,9 +238,9 @@ impl LightEntity { .with(position) .with(bounds) .with(light), - position: position, - bounds: bounds, - light: light, + position, + bounds, + light, } } } diff --git a/src/format.rs b/src/format.rs index 88dba9c..79248d4 100644 --- a/src/format.rs +++ b/src/format.rs @@ -41,7 +41,7 @@ impl Component { if let Some(val) = v.as_str() { Component::Text(TextComponent { text: val.to_owned(), - modifier: modifier, + modifier, }) } else if v.get("text").is_some() { Component::Text(TextComponent::from_value(v, modifier)) @@ -49,7 +49,7 @@ impl Component { modifier.color = Some(Color::RGB(255, 0, 0)); Component::Text(TextComponent { text: "UNHANDLED".to_owned(), - modifier: modifier, + modifier, }) } } @@ -136,7 +136,7 @@ impl TextComponent { pub fn from_value(v: &serde_json::Value, modifier: Modifier) -> Self { TextComponent { text: v.get("text").unwrap().as_str().unwrap_or("").to_owned(), - modifier: modifier, + modifier, } } diff --git a/src/gl/mod.rs b/src/gl/mod.rs index eaf02b1..4e96bec 100644 --- a/src/gl/mod.rs +++ b/src/gl/mod.rs @@ -777,7 +777,7 @@ impl Buffer { unsafe { MappedBuffer { inner: Vec::from_raw_parts(gl::MapBuffer(target, access) as *mut u8, 0, length), - target: target, + target, } } } diff --git a/src/main.rs b/src/main.rs index 11c2ab7..d3a6fbe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -202,15 +202,15 @@ fn main() { let mut game = Game { server: server::Server::dummy_server(resource_manager.clone()), focused: false, - renderer: renderer, - screen_sys: screen_sys, + renderer, + screen_sys, resource_manager: resource_manager.clone(), console: con, - vars: vars, + vars, should_close: false, chunk_builder: chunk_builder::ChunkBuilder::new(resource_manager, textures), connect_reply: None, - sdl: sdl, + sdl, }; game.renderer.camera.pos = cgmath::Point3::new(0.5, 13.2, 0.5); diff --git a/src/model/mod.rs b/src/model/mod.rs index 4685071..f9bb0c1 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -63,8 +63,8 @@ impl Factory { Factory { grass_colors: Factory::load_biome_colors(resources.clone(), "grass"), foliage_colors: Factory::load_biome_colors(resources.clone(), "foliage"), - resources: resources, - textures: textures, + resources, + textures, models: HashMap::with_hasher(BuildHasherDefault::default()), } @@ -218,8 +218,8 @@ impl Factory { Self::parse_rules(when, &mut rules); } model.multipart.push(MultipartRule { - apply: apply, - rules: rules, + apply, + rules, }) } } @@ -1050,7 +1050,7 @@ pub struct BlockVertex { impl BlockVertex { const fn base(x: f32, y: f32, z: f32, tx: i16, ty: i16) -> BlockVertex { BlockVertex { - x: x, y: y, z: z, + x, y, z, tx: 0, ty: 0, tw: 0, th: 0, toffsetx: tx, toffsety: ty, tatlas: 0, r: 0, g: 0, b: 0, diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index ba2d9f8..1e16cc5 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -405,7 +405,7 @@ impl LenPrefixed { pub fn new(data: Vec) -> LenPrefixed { LenPrefixed { len: Default::default(), - data: data, + data, } } } @@ -420,7 +420,7 @@ impl Serializable for LenPrefixed { } Result::Ok(LenPrefixed { len: len_data, - data: data, + data, }) } @@ -461,7 +461,7 @@ impl LenPrefixedBytes { pub fn new(data: Vec) -> LenPrefixedBytes { LenPrefixedBytes { len: Default::default(), - data: data, + data, } } } @@ -474,7 +474,7 @@ impl Serializable for LenPrefixedBytes { buf.take(len as u64).read_to_end(&mut data)?; Result::Ok(LenPrefixedBytes { len: len_data, - data: data, + data, }) } @@ -765,7 +765,7 @@ impl Conn { }; let stream = TcpStream::connect(&*address)?; Result::Ok(Conn { - stream: stream, + stream, host: parts[0].to_owned(), port: parts[1].parse().unwrap(), direction: Direction::Serverbound, @@ -875,8 +875,8 @@ impl Conn { let port = self.port; self.write_packet(Handshake { protocol_version: VarInt(SUPPORTED_PROTOCOL), - host: host, - port: port, + host, + port, next: VarInt(1), })?; self.state = State::Status; diff --git a/src/protocol/packet.rs b/src/protocol/packet.rs index ea97def..b491cd0 100644 --- a/src/protocol/packet.rs +++ b/src/protocol/packet.rs @@ -1121,8 +1121,8 @@ impl Serializable for PlayerInfoData { props.push(prop); } let p = PlayerDetail::Add { - uuid: uuid, - name: name, + uuid, + name, properties: props, gamemode: Serializable::read_from(buf)?, ping: Serializable::read_from(buf)?, @@ -1138,19 +1138,19 @@ impl Serializable for PlayerInfoData { } 1 => { m.players.push(PlayerDetail::UpdateGamemode { - uuid: uuid, + uuid, gamemode: Serializable::read_from(buf)?, }) } 2 => { m.players.push(PlayerDetail::UpdateLatency { - uuid: uuid, + uuid, ping: Serializable::read_from(buf)?, }) } 3 => { m.players.push(PlayerDetail::UpdateDisplayName { - uuid: uuid, + uuid, display: { if bool::read_from(buf)? { Some(Serializable::read_from(buf)?) diff --git a/src/render/atlas.rs b/src/render/atlas.rs index 9eda5b1..abc47f7 100644 --- a/src/render/atlas.rs +++ b/src/render/atlas.rs @@ -30,8 +30,8 @@ impl Atlas { a.free_space.push(Rect { x: 0, y: 0, - width: width, - height: height, + width, + height, }); a } @@ -62,8 +62,8 @@ impl Atlas { let ret = Rect { x: t.x, y: t.y, - width: width, - height: height, + width, + height, }; if width == t.width { @@ -82,7 +82,7 @@ impl Atlas { Rect { x: t.x, y: t.y + height, - width: width, + width, height: t.height - height, }); target_index += 1; diff --git a/src/render/clouds.rs b/src/render/clouds.rs index 68142e6..082a482 100644 --- a/src/render/clouds.rs +++ b/src/render/clouds.rs @@ -134,31 +134,31 @@ impl Clouds { texture.set_parameter(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST); Clouds { - program: program, + program, // Shader props _a_position: a_position, - u_perspective_matrix: u_perspective_matrix, - u_camera_matrix: u_camera_matrix, - u_light_level: u_light_level, - u_sky_offset: u_sky_offset, - u_offset: u_offset, - u_texture_info: u_texture_info, - u_atlas: u_atlas, - u_textures: u_textures, - u_cloud_map: u_cloud_map, - u_cloud_offset: u_cloud_offset, + u_perspective_matrix, + u_camera_matrix, + u_light_level, + u_sky_offset, + u_offset, + u_texture_info, + u_atlas, + u_textures, + u_cloud_map, + u_cloud_offset, - array: array, + array, _buffer: buffer, - textures: textures, + textures, - texture: texture, - heightmap_data: heightmap_data, + texture, + heightmap_data, dirty: false, offset: 0.0, - num_points: num_points, + num_points, } } diff --git a/src/render/mod.rs b/src/render/mod.rs index 0ac052b..bcc538e 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -199,15 +199,15 @@ impl Renderer { resource_version: version, model: model::Manager::new(&greg), clouds: clouds::Clouds::new(&greg, textures.clone()), - textures: textures, - ui: ui, + textures, + ui, resources: res, gl_texture: tex, texture_layers: 1, - chunk_shader: chunk_shader, - chunk_shader_alpha: chunk_shader_alpha, - trans_shader: trans_shader, + chunk_shader, + chunk_shader_alpha, + trans_shader, element_buffer: gl::Buffer::new(), element_buffer_size: 0, @@ -233,7 +233,7 @@ impl Renderer { light_level: 0.8, sky_offset: 1.0, skin_request: skin_req, - skin_reply: skin_reply, + skin_reply, } } @@ -743,15 +743,15 @@ impl TransInfo { shader.position.vertex_pointer(2, gl::FLOAT, false, 8, 0); TransInfo { - main: main, - fb_color: fb_color, + main, + fb_color, _fb_depth: fb_depth, - trans: trans, - accum: accum, - revealage: revealage, + trans, + accum, + revealage, _depth: trans_depth, - array: array, + array, _buffer: buffer, } } @@ -1105,9 +1105,9 @@ impl TextureManager { }; return Some(AnimatedTexture { - frames: frames, - data: data, - interpolate: interpolate, + frames, + data, + interpolate, current_frame: 0, remaining_time: 0.0, texture: self.get_texture("steven:missing_texture").unwrap(), @@ -1134,7 +1134,7 @@ impl TextureManager { let tex = Texture { name: full_name.clone(), version: self.version, - atlas: atlas, + atlas, x: rect.x, y: rect.y, width: rect.width, @@ -1209,8 +1209,8 @@ impl TextureManager { let rect = atlas::Rect { x: tex.x, y: tex.y, - width: width, - height: height, + width, + height, }; self.pending_uploads.push((tex.atlas, rect, data)); let mut t = tex.relative(0.0, 0.0, (width as f32) / (tex.width as f32), (height as f32) / (tex.height as f32)); diff --git a/src/render/model.rs b/src/render/model.rs index a871fc4..501a7ca 100644 --- a/src/render/model.rs +++ b/src/render/model.rs @@ -56,8 +56,8 @@ impl Manager { let collection = Collection { shader: ModelShader::new_manual(vert, frag), models: HashMap::with_hasher(BuildHasherDefault::default()), - blend_s: blend_s, - blend_d: blend_d, + blend_s, + blend_d, next_id: 0, }; self.collections.push(collection); @@ -102,8 +102,8 @@ impl Manager { block_light: 15.0, sky_light: 15.0, - array: array, - buffer: buffer, + array, + buffer, buffer_size: 0, count: 0, diff --git a/src/render/ui.rs b/src/render/ui.rs index 6c6fc44..2c54258 100644 --- a/src/render/ui.rs +++ b/src/render/ui.rs @@ -107,7 +107,7 @@ impl UIState { } let mut state = UIState { - textures: textures, + textures, resources: res, version: 0xFFFF, @@ -116,17 +116,17 @@ impl UIState { prev_size: 0, index_type: gl::UNSIGNED_BYTE, - array: array, - buffer: buffer, - index_buffer: index_buffer, + array, + buffer, + index_buffer, max_index: 0, - shader: shader, + shader, // Font font_pages: pages, font_character_info: vec![(0, 0); 0x10000], - char_map: char_map, + char_map, page_width: 0.0, page_height: 0.0, }; @@ -393,7 +393,7 @@ impl UIState { offset += w + 2.0; } UIText { - elements: elements, + elements, width: (offset - 2.0) * sx, } } diff --git a/src/resources.rs b/src/resources.rs index 129d306..2b3a4c1 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -202,8 +202,8 @@ impl Manager { position: -UI_HEIGHT, closing: false, progress: 0.0, - background: background, - progress_bar: progress_bar, + background, + progress_bar, }); } } @@ -368,7 +368,7 @@ impl Manager { read: res, progress: &progress_info, task_name: "Downloading Core Assets".into(), - task_file: task_file, + task_file, }; io::copy(&mut progress, &mut file).unwrap(); } diff --git a/src/screen/connecting.rs b/src/screen/connecting.rs index 37bfa97..c2de47e 100644 --- a/src/screen/connecting.rs +++ b/src/screen/connecting.rs @@ -63,7 +63,7 @@ impl super::Screen for Connecting { .create(ui_container); self.elements = Some(UIElements { - logo: logo, + logo, _disclaimer: disclaimer, _msg: msg, _connect_msg: connect_msg, diff --git a/src/screen/edit_server.rs b/src/screen/edit_server.rs index be18753..89f6b78 100644 --- a/src/screen/edit_server.rs +++ b/src/screen/edit_server.rs @@ -38,7 +38,7 @@ impl EditServerEntry { pub fn new(entry_info: Option<(usize, String, String)>) -> EditServerEntry { EditServerEntry { elements: None, - entry_info: entry_info, + entry_info, } } @@ -156,7 +156,7 @@ impl super::Screen for EditServerEntry { } self.elements = Some(UIElements { - logo: logo, + logo, _name: server_name, _address: server_address, _done: done, diff --git a/src/screen/login.rs b/src/screen/login.rs index 6d64969..c54e157 100644 --- a/src/screen/login.rs +++ b/src/screen/login.rs @@ -136,19 +136,19 @@ impl super::Screen for Login { try_login.set(refresh); self.elements = Some(UIElements { - logo: logo, - profile: profile, - login_btn: login_btn, - login_btn_text: login_btn_text, - login_error: login_error, - try_login: try_login, - refresh: refresh, + logo, + profile, + login_btn, + login_btn_text, + login_error, + try_login, + refresh, login_res: None, _disclaimer: disclaimer, - username_txt: username_txt, - password_txt: password_txt, + username_txt, + password_txt, }); } fn on_deactive(&mut self, _renderer: &mut render::Renderer, _ui_container: &mut ui::Container) { diff --git a/src/screen/mod.rs b/src/screen/mod.rs index 161fe4b..6048b11 100644 --- a/src/screen/mod.rs +++ b/src/screen/mod.rs @@ -69,7 +69,7 @@ impl ScreenSystem { pub fn add_screen(&mut self, screen: Box) { self.screens.push(ScreenInfo { - screen: screen, + screen, init: false, active: false, }); diff --git a/src/screen/server_list.rs b/src/screen/server_list.rs index 54e8b5d..c82c01e 100644 --- a/src/screen/server_list.rs +++ b/src/screen/server_list.rs @@ -92,7 +92,7 @@ impl ServerList { pub fn new(disconnect_reason: Option) -> ServerList { ServerList { elements: None, - disconnect_reason: disconnect_reason, + disconnect_reason, needs_reload: Rc::new(RefCell::new(false)), } } @@ -239,18 +239,18 @@ impl ServerList { } let mut server = Server { - back: back, - offset: offset, + back, + offset, y: 0.0, done_ping: false, - recv: recv, + recv, - motd: motd, - ping: ping, - players: players, - version: version, + motd, + ping, + players, + version, - icon: icon, + icon, icon_texture: None, }; server.update_position(); @@ -278,7 +278,7 @@ impl ServerList { max: res.0.players.max, protocol_version: res.0.version.protocol, protocol_name: res.0.version.name, - favicon: favicon, + favicon, })); } Err(err) => { @@ -406,7 +406,7 @@ impl super::Screen for ServerList { }; self.elements = Some(UIElements { - logo: logo, + logo, servers: Vec::new(), _add_btn: add, diff --git a/src/screen/settings_menu.rs b/src/screen/settings_menu.rs index d4f42c1..d68a9e2 100644 --- a/src/screen/settings_menu.rs +++ b/src/screen/settings_menu.rs @@ -150,7 +150,7 @@ impl super::Screen for SettingsMenu { } self.elements = Some(UIElements { - background: background, + background, _buttons: buttons, }); @@ -195,7 +195,7 @@ pub struct VideoSettingsMenu { impl VideoSettingsMenu { pub fn new(vars: Rc) -> VideoSettingsMenu { VideoSettingsMenu { - vars: vars, + vars, elements: None, } } @@ -299,7 +299,7 @@ impl super::Screen for VideoSettingsMenu { } buttons.push(done_button); self.elements = Some(UIElements { - background: background, + background, _buttons: buttons, }); @@ -384,7 +384,7 @@ impl super::Screen for AudioSettingsMenu { buttons.push(done_button); self.elements = Some(UIElements { - background: background, + background, _buttons: buttons, }); diff --git a/src/server/mod.rs b/src/server/mod.rs index a434b3b..e75cf5f 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -110,8 +110,8 @@ impl Server { let port = conn.port; conn.write_packet(protocol::packet::handshake::serverbound::Handshake { protocol_version: protocol::VarInt(protocol::SUPPORTED_PROTOCOL), - host: host, - port: port, + host, + port, next: protocol::VarInt(2), })?; conn.state = protocol::State::Login; @@ -261,9 +261,9 @@ impl Server { let version = resources.read().unwrap().version(); Server { - uuid: uuid, - conn: conn, - read_queue: read_queue, + uuid, + conn, + read_queue, disconnect_reason: None, just_disconnected: false, @@ -273,11 +273,11 @@ impl Server { world_time_target: 0.0, tick_time: true, - version: version, - resources: resources, + version, + resources, // Entity accessors - game_info: game_info, + game_info, player_movement: entities.get_key(), gravity: entities.get_key(), position: entities.get_key(), @@ -288,7 +288,7 @@ impl Server { target_rotation: entities.get_key(), // - entities: entities, + entities, player: None, entity_map: HashMap::with_hasher(BuildHasherDefault::default()), players: HashMap::with_hasher(BuildHasherDefault::default()), @@ -494,7 +494,7 @@ impl Server { z: position.position.z, yaw: -(rotation.yaw as f32) * (180.0 / PI), pitch: (-rotation.pitch as f32) * (180.0 / PI) + 180.0, - on_ground: on_ground, + on_ground, }; self.write_packet(packet); } @@ -749,7 +749,7 @@ impl Server { Add { name, uuid, properties, display, gamemode, ping} => { let info = self.players.entry(uuid.clone()).or_insert(PlayerInfo { name: name.clone(), - uuid: uuid, + uuid, skin_url: None, display_name: display.clone(), @@ -846,7 +846,7 @@ impl Server { } self.on_block_entity_update(packet::play::clientbound::UpdateBlockEntity { location: Position::new(x, y, z), - action: action, + action, nbt: Some(block_entity.clone()), }); } diff --git a/src/server/plugin_messages.rs b/src/server/plugin_messages.rs index 8fcad1e..ecbfa08 100644 --- a/src/server/plugin_messages.rs +++ b/src/server/plugin_messages.rs @@ -12,7 +12,7 @@ impl Brand { Serializable::write_to(&self.brand, &mut data).unwrap(); PluginMessageServerbound { channel: "MC|Brand".into(), - data: data, + data, } } } diff --git a/src/server/target.rs b/src/server/target.rs index 8dfa0b3..299d9fd 100644 --- a/src/server/target.rs +++ b/src/server/target.rs @@ -210,8 +210,8 @@ pub fn trace_ray(world: &world::World, max: f64, s: cgmath::Vector3, }; Gen { count: 0, - base: base, - d: d, + base, + d, } } diff --git a/src/types/bit/map.rs b/src/types/bit/map.rs index 11979fe..2f86979 100644 --- a/src/types/bit/map.rs +++ b/src/types/bit/map.rs @@ -63,7 +63,7 @@ impl Map { Map { length: (bits.len()*64 + (size-1)) / size, bit_size: size, - bits: bits, + bits, } } diff --git a/src/types/metadata.rs b/src/types/metadata.rs index 5af4fcc..228a034 100644 --- a/src/types/metadata.rs +++ b/src/types/metadata.rs @@ -31,7 +31,7 @@ impl MetadataKey { #[allow(dead_code)] fn new(index: i32) -> MetadataKey { MetadataKey { - index: index, + index, ty: PhantomData, } } diff --git a/src/ui/logo.rs b/src/ui/logo.rs index 500a36d..44afdc3 100644 --- a/src/ui/logo.rs +++ b/src/ui/logo.rs @@ -126,10 +126,10 @@ impl Logo { _shadow: shadow_batch, _layer0: layer0, text: txt, - text_base_scale: text_base_scale, - text_orig_x: text_orig_x, + text_base_scale, + text_orig_x, text_index: -1, - text_strings: text_strings, + text_strings, } } diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 0819498..90e6a80 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -1021,7 +1021,7 @@ impl UIElement for Formatted { offset: 0.0, text: Vec::new(), max_width: self.max_width, - renderer: renderer, + renderer, }; state.build(&self.text, format::Color::White); self.text_elements = state.text; @@ -1079,8 +1079,8 @@ impl Formatted { width: 0.0, offset: 0.0, text: Vec::new(), - max_width: max_width, - renderer: renderer, + max_width, + renderer, }; state.build(text, format::Color::White); (state.width + 2.0, (state.lines + 1) as f64 * 18.0) diff --git a/src/world/biome.rs b/src/world/biome.rs index 0f331a5..e5b0998 100644 --- a/src/world/biome.rs +++ b/src/world/biome.rs @@ -12,7 +12,7 @@ pub struct Biome { impl Biome { const fn new(id: usize, t: i16, m: i16) -> Biome { Biome { - id: id, + id, temperature: t, moisture: m*t, } diff --git a/src/world/mod.rs b/src/world/mod.rs index 6ef31a0..ea0179d 100644 --- a/src/world/mod.rs +++ b/src/world/mod.rs @@ -178,8 +178,8 @@ impl World { fn update_light(&mut self, pos: Position, ty: LightType) { self.light_updates.push_back(LightUpdate { - ty: ty, - pos: pos, + ty, + pos, }); } @@ -470,8 +470,8 @@ impl World { sky_light: nibble::Array::new((w * h * d) as usize), biomes: vec![0; (w * d) as usize], - x: x, y: y, z: z, - w: w, _h: h, d: d, + x, y, z, + w, _h: h, d, }; for i in 0 .. (w * h * d) as usize { snapshot.sky_light.set(i, 0xF); @@ -914,7 +914,7 @@ impl Section { let mut section = Section { cull_info: chunk_builder::CullInfo::all_vis(), render_buffer: render::ChunkBuffer::new(), - y: y, + y, blocks: storage::BlockStorage::new(4096),