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 {} \;
This commit is contained in:
ice_iix 2018-11-04 13:43:30 -08:00
parent 2af7307d8b
commit 77cd4ecf35
35 changed files with 183 additions and 183 deletions

View File

@ -13,9 +13,9 @@ pub struct Position {
impl Position { impl Position {
pub fn new(x: i32, y: i32, z: i32) -> Position { pub fn new(x: i32, y: i32, z: i32) -> Position {
Position { Position {
x: x, x,
y: y, y,
z: z, z,
} }
} }

View File

@ -37,10 +37,10 @@ impl ChunkBuilder {
free.push((i, vec![], vec![])); free.push((i, vec![], vec![]));
} }
ChunkBuilder { ChunkBuilder {
threads: threads, threads,
free_builders: free, free_builders: free,
built_recv: built_recv, built_recv,
models: models, models,
resource_version: 0xFFFF, resource_version: 0xFFFF,
} }
} }
@ -80,7 +80,7 @@ impl ChunkBuilder {
let mut snapshot = world.capture_snapshot(cx - 2, cy - 2, cz - 2, 20, 20, 20); let mut snapshot = world.capture_snapshot(cx - 2, cy - 2, cz - 2, 20, 20, 20);
snapshot.make_relative(-2, -2, -2); snapshot.make_relative(-2, -2, -2);
self.threads[t_id.0].0.send(BuildReq { self.threads[t_id.0].0.send(BuildReq {
snapshot: snapshot, snapshot,
position: (x, y, z), position: (x, y, z),
solid_buffer: t_id.1, solid_buffer: t_id.1,
trans_buffer: t_id.2, trans_buffer: t_id.2,
@ -189,12 +189,12 @@ fn build_func(id: usize, models: Arc<RwLock<model::Factory>>, work_recv: mpsc::R
let cull_info = build_cull_info(&snapshot); let cull_info = build_cull_info(&snapshot);
built_send.send((id, BuildReply { built_send.send((id, BuildReply {
position: position, position,
solid_buffer: solid_buffer, solid_buffer,
solid_count: solid_count, solid_count,
trans_buffer: trans_buffer, trans_buffer,
trans_count: trans_count, trans_count,
cull_info: cull_info, cull_info,
})).unwrap(); })).unwrap();
} }
} }

View File

@ -242,7 +242,7 @@ impl Console {
.draw_index(500) .draw_index(500)
.create(ui_container); .create(ui_container);
self.elements = Some(ConsoleElements { self.elements = Some(ConsoleElements {
background: background, background,
lines: vec![], lines: vec![],
}); });
self.dirty = true; self.dirty = true;

View File

@ -228,7 +228,7 @@ impl Manager {
}); });
entity.1 += 1; entity.1 += 1;
return Entity { return Entity {
id: id, id,
generation: entity.1, generation: entity.1,
} }
} }
@ -242,7 +242,7 @@ impl Manager {
0 0
)); ));
Entity { Entity {
id: id, id,
generation: 0, generation: 0,
} }
} }

View File

@ -57,8 +57,8 @@ impl SignRenderer {
filter: ecs::Filter::new() filter: ecs::Filter::new()
.with(position) .with(position)
.with(sign_info), .with(sign_info),
position: position, position,
sign_info: sign_info, sign_info,
} }
} }
} }
@ -145,7 +145,7 @@ impl ecs::System for SignRenderer {
width: 0.0, width: 0.0,
offset: 0.0, offset: 0.0,
text: Vec::new(), text: Vec::new(),
renderer: renderer, renderer,
y_scale: Y_SCALE, y_scale: Y_SCALE,
x_scale: X_SCALE, x_scale: X_SCALE,
}; };

View File

@ -97,8 +97,8 @@ pub struct Rotation {
impl Rotation { impl Rotation {
pub fn new(yaw: f64, pitch: f64) -> Rotation { pub fn new(yaw: f64, pitch: f64) -> Rotation {
Rotation { Rotation {
yaw: yaw, yaw,
pitch: pitch, pitch,
} }
} }
@ -115,8 +115,8 @@ pub struct TargetRotation {
impl TargetRotation { impl TargetRotation {
pub fn new(yaw: f64, pitch: f64) -> TargetRotation { pub fn new(yaw: f64, pitch: f64) -> TargetRotation {
TargetRotation { TargetRotation {
yaw: yaw, yaw,
pitch: pitch, pitch,
} }
} }
@ -141,7 +141,7 @@ pub struct Bounds {
impl Bounds { impl Bounds {
pub fn new(bounds: Aabb3<f64>) -> Bounds { pub fn new(bounds: Aabb3<f64>) -> Bounds {
Bounds { Bounds {
bounds: bounds, bounds,
} }
} }
} }

View File

@ -93,9 +93,9 @@ impl PlayerModel {
dirty: false, dirty: false,
name: name.to_owned(), name: name.to_owned(),
has_head: has_head, has_head,
has_name_tag: has_name_tag, has_name_tag,
first_person: first_person, first_person,
dir: 0, dir: 0,
time: 0.0, time: 0.0,
@ -132,11 +132,11 @@ impl PlayerRenderer {
.with(position) .with(position)
.with(rotation) .with(rotation)
.with(light), .with(light),
player_model: player_model, player_model,
position: position, position,
rotation: rotation, rotation,
game_info: m.get_key(), game_info: m.get_key(),
light: light, light,
} }
} }
} }
@ -386,7 +386,7 @@ impl ecs::System for PlayerRenderer {
width: 0.0, width: 0.0,
offset: 0.0, offset: 0.0,
text: Vec::new(), text: Vec::new(),
renderer: renderer, renderer,
y_scale: 0.16, y_scale: 0.16,
x_scale: 0.01, x_scale: 0.01,
}; };
@ -505,13 +505,13 @@ impl MovementHandler {
.with(velocity) .with(velocity)
.with(bounds) .with(bounds)
.with(rotation), .with(rotation),
movement: movement, movement,
gravity: m.get_key(), gravity: m.get_key(),
gamemode: m.get_key(), gamemode: m.get_key(),
position: position, position,
velocity: velocity, velocity,
bounds: bounds, bounds,
rotation: rotation, rotation,
} }
} }
} }

View File

@ -21,8 +21,8 @@ impl ApplyVelocity {
filter: ecs::Filter::new() filter: ecs::Filter::new()
.with(position) .with(position)
.with(velocity), .with(velocity),
position: position, position,
velocity: velocity, velocity,
movement: m.get_key(), movement: m.get_key(),
} }
} }
@ -61,7 +61,7 @@ impl ApplyGravity {
filter: ecs::Filter::new() filter: ecs::Filter::new()
.with(gravity) .with(gravity)
.with(velocity), .with(velocity),
velocity: velocity, velocity,
movement: m.get_key(), movement: m.get_key(),
} }
} }
@ -100,7 +100,7 @@ impl UpdateLastPosition {
UpdateLastPosition { UpdateLastPosition {
filter: ecs::Filter::new() filter: ecs::Filter::new()
.with(position), .with(position),
position: position, position,
} }
} }
} }
@ -136,8 +136,8 @@ impl LerpPosition {
filter: ecs::Filter::new() filter: ecs::Filter::new()
.with(position) .with(position)
.with(target_position), .with(target_position),
position: position, position,
target_position: target_position, target_position,
game_info: m.get_key(), game_info: m.get_key(),
} }
} }
@ -180,8 +180,8 @@ impl LerpRotation {
filter: ecs::Filter::new() filter: ecs::Filter::new()
.with(rotation) .with(rotation)
.with(target_rotation), .with(target_rotation),
rotation: rotation, rotation,
target_rotation: target_rotation, target_rotation,
game_info: m.get_key(), game_info: m.get_key(),
} }
} }
@ -238,9 +238,9 @@ impl LightEntity {
.with(position) .with(position)
.with(bounds) .with(bounds)
.with(light), .with(light),
position: position, position,
bounds: bounds, bounds,
light: light, light,
} }
} }
} }

View File

@ -41,7 +41,7 @@ impl Component {
if let Some(val) = v.as_str() { if let Some(val) = v.as_str() {
Component::Text(TextComponent { Component::Text(TextComponent {
text: val.to_owned(), text: val.to_owned(),
modifier: modifier, modifier,
}) })
} else if v.get("text").is_some() { } else if v.get("text").is_some() {
Component::Text(TextComponent::from_value(v, modifier)) Component::Text(TextComponent::from_value(v, modifier))
@ -49,7 +49,7 @@ impl Component {
modifier.color = Some(Color::RGB(255, 0, 0)); modifier.color = Some(Color::RGB(255, 0, 0));
Component::Text(TextComponent { Component::Text(TextComponent {
text: "UNHANDLED".to_owned(), text: "UNHANDLED".to_owned(),
modifier: modifier, modifier,
}) })
} }
} }
@ -136,7 +136,7 @@ impl TextComponent {
pub fn from_value(v: &serde_json::Value, modifier: Modifier) -> Self { pub fn from_value(v: &serde_json::Value, modifier: Modifier) -> Self {
TextComponent { TextComponent {
text: v.get("text").unwrap().as_str().unwrap_or("").to_owned(), text: v.get("text").unwrap().as_str().unwrap_or("").to_owned(),
modifier: modifier, modifier,
} }
} }

View File

@ -777,7 +777,7 @@ impl Buffer {
unsafe { unsafe {
MappedBuffer { MappedBuffer {
inner: Vec::from_raw_parts(gl::MapBuffer(target, access) as *mut u8, 0, length), inner: Vec::from_raw_parts(gl::MapBuffer(target, access) as *mut u8, 0, length),
target: target, target,
} }
} }
} }

View File

@ -202,15 +202,15 @@ fn main() {
let mut game = Game { let mut game = Game {
server: server::Server::dummy_server(resource_manager.clone()), server: server::Server::dummy_server(resource_manager.clone()),
focused: false, focused: false,
renderer: renderer, renderer,
screen_sys: screen_sys, screen_sys,
resource_manager: resource_manager.clone(), resource_manager: resource_manager.clone(),
console: con, console: con,
vars: vars, vars,
should_close: false, should_close: false,
chunk_builder: chunk_builder::ChunkBuilder::new(resource_manager, textures), chunk_builder: chunk_builder::ChunkBuilder::new(resource_manager, textures),
connect_reply: None, connect_reply: None,
sdl: sdl, sdl,
}; };
game.renderer.camera.pos = cgmath::Point3::new(0.5, 13.2, 0.5); game.renderer.camera.pos = cgmath::Point3::new(0.5, 13.2, 0.5);

View File

@ -63,8 +63,8 @@ impl Factory {
Factory { Factory {
grass_colors: Factory::load_biome_colors(resources.clone(), "grass"), grass_colors: Factory::load_biome_colors(resources.clone(), "grass"),
foliage_colors: Factory::load_biome_colors(resources.clone(), "foliage"), foliage_colors: Factory::load_biome_colors(resources.clone(), "foliage"),
resources: resources, resources,
textures: textures, textures,
models: HashMap::with_hasher(BuildHasherDefault::default()), models: HashMap::with_hasher(BuildHasherDefault::default()),
} }
@ -218,8 +218,8 @@ impl Factory {
Self::parse_rules(when, &mut rules); Self::parse_rules(when, &mut rules);
} }
model.multipart.push(MultipartRule { model.multipart.push(MultipartRule {
apply: apply, apply,
rules: rules, rules,
}) })
} }
} }
@ -1050,7 +1050,7 @@ pub struct BlockVertex {
impl BlockVertex { impl BlockVertex {
const fn base(x: f32, y: f32, z: f32, tx: i16, ty: i16) -> BlockVertex { const fn base(x: f32, y: f32, z: f32, tx: i16, ty: i16) -> BlockVertex {
BlockVertex { BlockVertex {
x: x, y: y, z: z, x, y, z,
tx: 0, ty: 0, tw: 0, th: 0, tx: 0, ty: 0, tw: 0, th: 0,
toffsetx: tx, toffsety: ty, tatlas: 0, toffsetx: tx, toffsety: ty, tatlas: 0,
r: 0, g: 0, b: 0, r: 0, g: 0, b: 0,

View File

@ -405,7 +405,7 @@ impl <L: Lengthable, V: Default> LenPrefixed<L, V> {
pub fn new(data: Vec<V>) -> LenPrefixed<L, V> { pub fn new(data: Vec<V>) -> LenPrefixed<L, V> {
LenPrefixed { LenPrefixed {
len: Default::default(), len: Default::default(),
data: data, data,
} }
} }
} }
@ -420,7 +420,7 @@ impl <L: Lengthable, V: Serializable> Serializable for LenPrefixed<L, V> {
} }
Result::Ok(LenPrefixed { Result::Ok(LenPrefixed {
len: len_data, len: len_data,
data: data, data,
}) })
} }
@ -461,7 +461,7 @@ impl <L: Lengthable> LenPrefixedBytes<L> {
pub fn new(data: Vec<u8>) -> LenPrefixedBytes<L> { pub fn new(data: Vec<u8>) -> LenPrefixedBytes<L> {
LenPrefixedBytes { LenPrefixedBytes {
len: Default::default(), len: Default::default(),
data: data, data,
} }
} }
} }
@ -474,7 +474,7 @@ impl <L: Lengthable> Serializable for LenPrefixedBytes<L> {
buf.take(len as u64).read_to_end(&mut data)?; buf.take(len as u64).read_to_end(&mut data)?;
Result::Ok(LenPrefixedBytes { Result::Ok(LenPrefixedBytes {
len: len_data, len: len_data,
data: data, data,
}) })
} }
@ -765,7 +765,7 @@ impl Conn {
}; };
let stream = TcpStream::connect(&*address)?; let stream = TcpStream::connect(&*address)?;
Result::Ok(Conn { Result::Ok(Conn {
stream: stream, stream,
host: parts[0].to_owned(), host: parts[0].to_owned(),
port: parts[1].parse().unwrap(), port: parts[1].parse().unwrap(),
direction: Direction::Serverbound, direction: Direction::Serverbound,
@ -875,8 +875,8 @@ impl Conn {
let port = self.port; let port = self.port;
self.write_packet(Handshake { self.write_packet(Handshake {
protocol_version: VarInt(SUPPORTED_PROTOCOL), protocol_version: VarInt(SUPPORTED_PROTOCOL),
host: host, host,
port: port, port,
next: VarInt(1), next: VarInt(1),
})?; })?;
self.state = State::Status; self.state = State::Status;

View File

@ -1121,8 +1121,8 @@ impl Serializable for PlayerInfoData {
props.push(prop); props.push(prop);
} }
let p = PlayerDetail::Add { let p = PlayerDetail::Add {
uuid: uuid, uuid,
name: name, name,
properties: props, properties: props,
gamemode: Serializable::read_from(buf)?, gamemode: Serializable::read_from(buf)?,
ping: Serializable::read_from(buf)?, ping: Serializable::read_from(buf)?,
@ -1138,19 +1138,19 @@ impl Serializable for PlayerInfoData {
} }
1 => { 1 => {
m.players.push(PlayerDetail::UpdateGamemode { m.players.push(PlayerDetail::UpdateGamemode {
uuid: uuid, uuid,
gamemode: Serializable::read_from(buf)?, gamemode: Serializable::read_from(buf)?,
}) })
} }
2 => { 2 => {
m.players.push(PlayerDetail::UpdateLatency { m.players.push(PlayerDetail::UpdateLatency {
uuid: uuid, uuid,
ping: Serializable::read_from(buf)?, ping: Serializable::read_from(buf)?,
}) })
} }
3 => { 3 => {
m.players.push(PlayerDetail::UpdateDisplayName { m.players.push(PlayerDetail::UpdateDisplayName {
uuid: uuid, uuid,
display: { display: {
if bool::read_from(buf)? { if bool::read_from(buf)? {
Some(Serializable::read_from(buf)?) Some(Serializable::read_from(buf)?)

View File

@ -30,8 +30,8 @@ impl Atlas {
a.free_space.push(Rect { a.free_space.push(Rect {
x: 0, x: 0,
y: 0, y: 0,
width: width, width,
height: height, height,
}); });
a a
} }
@ -62,8 +62,8 @@ impl Atlas {
let ret = Rect { let ret = Rect {
x: t.x, x: t.x,
y: t.y, y: t.y,
width: width, width,
height: height, height,
}; };
if width == t.width { if width == t.width {
@ -82,7 +82,7 @@ impl Atlas {
Rect { Rect {
x: t.x, x: t.x,
y: t.y + height, y: t.y + height,
width: width, width,
height: t.height - height, height: t.height - height,
}); });
target_index += 1; target_index += 1;

View File

@ -134,31 +134,31 @@ impl Clouds {
texture.set_parameter(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST); texture.set_parameter(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST);
Clouds { Clouds {
program: program, program,
// Shader props // Shader props
_a_position: a_position, _a_position: a_position,
u_perspective_matrix: u_perspective_matrix, u_perspective_matrix,
u_camera_matrix: u_camera_matrix, u_camera_matrix,
u_light_level: u_light_level, u_light_level,
u_sky_offset: u_sky_offset, u_sky_offset,
u_offset: u_offset, u_offset,
u_texture_info: u_texture_info, u_texture_info,
u_atlas: u_atlas, u_atlas,
u_textures: u_textures, u_textures,
u_cloud_map: u_cloud_map, u_cloud_map,
u_cloud_offset: u_cloud_offset, u_cloud_offset,
array: array, array,
_buffer: buffer, _buffer: buffer,
textures: textures, textures,
texture: texture, texture,
heightmap_data: heightmap_data, heightmap_data,
dirty: false, dirty: false,
offset: 0.0, offset: 0.0,
num_points: num_points, num_points,
} }
} }

View File

@ -199,15 +199,15 @@ impl Renderer {
resource_version: version, resource_version: version,
model: model::Manager::new(&greg), model: model::Manager::new(&greg),
clouds: clouds::Clouds::new(&greg, textures.clone()), clouds: clouds::Clouds::new(&greg, textures.clone()),
textures: textures, textures,
ui: ui, ui,
resources: res, resources: res,
gl_texture: tex, gl_texture: tex,
texture_layers: 1, texture_layers: 1,
chunk_shader: chunk_shader, chunk_shader,
chunk_shader_alpha: chunk_shader_alpha, chunk_shader_alpha,
trans_shader: trans_shader, trans_shader,
element_buffer: gl::Buffer::new(), element_buffer: gl::Buffer::new(),
element_buffer_size: 0, element_buffer_size: 0,
@ -233,7 +233,7 @@ impl Renderer {
light_level: 0.8, light_level: 0.8,
sky_offset: 1.0, sky_offset: 1.0,
skin_request: skin_req, 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); shader.position.vertex_pointer(2, gl::FLOAT, false, 8, 0);
TransInfo { TransInfo {
main: main, main,
fb_color: fb_color, fb_color,
_fb_depth: fb_depth, _fb_depth: fb_depth,
trans: trans, trans,
accum: accum, accum,
revealage: revealage, revealage,
_depth: trans_depth, _depth: trans_depth,
array: array, array,
_buffer: buffer, _buffer: buffer,
} }
} }
@ -1105,9 +1105,9 @@ impl TextureManager {
}; };
return Some(AnimatedTexture { return Some(AnimatedTexture {
frames: frames, frames,
data: data, data,
interpolate: interpolate, interpolate,
current_frame: 0, current_frame: 0,
remaining_time: 0.0, remaining_time: 0.0,
texture: self.get_texture("steven:missing_texture").unwrap(), texture: self.get_texture("steven:missing_texture").unwrap(),
@ -1134,7 +1134,7 @@ impl TextureManager {
let tex = Texture { let tex = Texture {
name: full_name.clone(), name: full_name.clone(),
version: self.version, version: self.version,
atlas: atlas, atlas,
x: rect.x, x: rect.x,
y: rect.y, y: rect.y,
width: rect.width, width: rect.width,
@ -1209,8 +1209,8 @@ impl TextureManager {
let rect = atlas::Rect { let rect = atlas::Rect {
x: tex.x, x: tex.x,
y: tex.y, y: tex.y,
width: width, width,
height: height, height,
}; };
self.pending_uploads.push((tex.atlas, rect, data)); 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)); let mut t = tex.relative(0.0, 0.0, (width as f32) / (tex.width as f32), (height as f32) / (tex.height as f32));

View File

@ -56,8 +56,8 @@ impl Manager {
let collection = Collection { let collection = Collection {
shader: ModelShader::new_manual(vert, frag), shader: ModelShader::new_manual(vert, frag),
models: HashMap::with_hasher(BuildHasherDefault::default()), models: HashMap::with_hasher(BuildHasherDefault::default()),
blend_s: blend_s, blend_s,
blend_d: blend_d, blend_d,
next_id: 0, next_id: 0,
}; };
self.collections.push(collection); self.collections.push(collection);
@ -102,8 +102,8 @@ impl Manager {
block_light: 15.0, block_light: 15.0,
sky_light: 15.0, sky_light: 15.0,
array: array, array,
buffer: buffer, buffer,
buffer_size: 0, buffer_size: 0,
count: 0, count: 0,

View File

@ -107,7 +107,7 @@ impl UIState {
} }
let mut state = UIState { let mut state = UIState {
textures: textures, textures,
resources: res, resources: res,
version: 0xFFFF, version: 0xFFFF,
@ -116,17 +116,17 @@ impl UIState {
prev_size: 0, prev_size: 0,
index_type: gl::UNSIGNED_BYTE, index_type: gl::UNSIGNED_BYTE,
array: array, array,
buffer: buffer, buffer,
index_buffer: index_buffer, index_buffer,
max_index: 0, max_index: 0,
shader: shader, shader,
// Font // Font
font_pages: pages, font_pages: pages,
font_character_info: vec![(0, 0); 0x10000], font_character_info: vec![(0, 0); 0x10000],
char_map: char_map, char_map,
page_width: 0.0, page_width: 0.0,
page_height: 0.0, page_height: 0.0,
}; };
@ -393,7 +393,7 @@ impl UIState {
offset += w + 2.0; offset += w + 2.0;
} }
UIText { UIText {
elements: elements, elements,
width: (offset - 2.0) * sx, width: (offset - 2.0) * sx,
} }
} }

View File

@ -202,8 +202,8 @@ impl Manager {
position: -UI_HEIGHT, position: -UI_HEIGHT,
closing: false, closing: false,
progress: 0.0, progress: 0.0,
background: background, background,
progress_bar: progress_bar, progress_bar,
}); });
} }
} }
@ -368,7 +368,7 @@ impl Manager {
read: res, read: res,
progress: &progress_info, progress: &progress_info,
task_name: "Downloading Core Assets".into(), task_name: "Downloading Core Assets".into(),
task_file: task_file, task_file,
}; };
io::copy(&mut progress, &mut file).unwrap(); io::copy(&mut progress, &mut file).unwrap();
} }

View File

@ -63,7 +63,7 @@ impl super::Screen for Connecting {
.create(ui_container); .create(ui_container);
self.elements = Some(UIElements { self.elements = Some(UIElements {
logo: logo, logo,
_disclaimer: disclaimer, _disclaimer: disclaimer,
_msg: msg, _msg: msg,
_connect_msg: connect_msg, _connect_msg: connect_msg,

View File

@ -38,7 +38,7 @@ impl EditServerEntry {
pub fn new(entry_info: Option<(usize, String, String)>) -> EditServerEntry { pub fn new(entry_info: Option<(usize, String, String)>) -> EditServerEntry {
EditServerEntry { EditServerEntry {
elements: None, elements: None,
entry_info: entry_info, entry_info,
} }
} }
@ -156,7 +156,7 @@ impl super::Screen for EditServerEntry {
} }
self.elements = Some(UIElements { self.elements = Some(UIElements {
logo: logo, logo,
_name: server_name, _name: server_name,
_address: server_address, _address: server_address,
_done: done, _done: done,

View File

@ -136,19 +136,19 @@ impl super::Screen for Login {
try_login.set(refresh); try_login.set(refresh);
self.elements = Some(UIElements { self.elements = Some(UIElements {
logo: logo, logo,
profile: profile, profile,
login_btn: login_btn, login_btn,
login_btn_text: login_btn_text, login_btn_text,
login_error: login_error, login_error,
try_login: try_login, try_login,
refresh: refresh, refresh,
login_res: None, login_res: None,
_disclaimer: disclaimer, _disclaimer: disclaimer,
username_txt: username_txt, username_txt,
password_txt: password_txt, password_txt,
}); });
} }
fn on_deactive(&mut self, _renderer: &mut render::Renderer, _ui_container: &mut ui::Container) { fn on_deactive(&mut self, _renderer: &mut render::Renderer, _ui_container: &mut ui::Container) {

View File

@ -69,7 +69,7 @@ impl ScreenSystem {
pub fn add_screen(&mut self, screen: Box<Screen>) { pub fn add_screen(&mut self, screen: Box<Screen>) {
self.screens.push(ScreenInfo { self.screens.push(ScreenInfo {
screen: screen, screen,
init: false, init: false,
active: false, active: false,
}); });

View File

@ -92,7 +92,7 @@ impl ServerList {
pub fn new(disconnect_reason: Option<Component>) -> ServerList { pub fn new(disconnect_reason: Option<Component>) -> ServerList {
ServerList { ServerList {
elements: None, elements: None,
disconnect_reason: disconnect_reason, disconnect_reason,
needs_reload: Rc::new(RefCell::new(false)), needs_reload: Rc::new(RefCell::new(false)),
} }
} }
@ -239,18 +239,18 @@ impl ServerList {
} }
let mut server = Server { let mut server = Server {
back: back, back,
offset: offset, offset,
y: 0.0, y: 0.0,
done_ping: false, done_ping: false,
recv: recv, recv,
motd: motd, motd,
ping: ping, ping,
players: players, players,
version: version, version,
icon: icon, icon,
icon_texture: None, icon_texture: None,
}; };
server.update_position(); server.update_position();
@ -278,7 +278,7 @@ impl ServerList {
max: res.0.players.max, max: res.0.players.max,
protocol_version: res.0.version.protocol, protocol_version: res.0.version.protocol,
protocol_name: res.0.version.name, protocol_name: res.0.version.name,
favicon: favicon, favicon,
})); }));
} }
Err(err) => { Err(err) => {
@ -406,7 +406,7 @@ impl super::Screen for ServerList {
}; };
self.elements = Some(UIElements { self.elements = Some(UIElements {
logo: logo, logo,
servers: Vec::new(), servers: Vec::new(),
_add_btn: add, _add_btn: add,

View File

@ -150,7 +150,7 @@ impl super::Screen for SettingsMenu {
} }
self.elements = Some(UIElements { self.elements = Some(UIElements {
background: background, background,
_buttons: buttons, _buttons: buttons,
}); });
@ -195,7 +195,7 @@ pub struct VideoSettingsMenu {
impl VideoSettingsMenu { impl VideoSettingsMenu {
pub fn new(vars: Rc<console::Vars>) -> VideoSettingsMenu { pub fn new(vars: Rc<console::Vars>) -> VideoSettingsMenu {
VideoSettingsMenu { VideoSettingsMenu {
vars: vars, vars,
elements: None, elements: None,
} }
} }
@ -299,7 +299,7 @@ impl super::Screen for VideoSettingsMenu {
} }
buttons.push(done_button); buttons.push(done_button);
self.elements = Some(UIElements { self.elements = Some(UIElements {
background: background, background,
_buttons: buttons, _buttons: buttons,
}); });
@ -384,7 +384,7 @@ impl super::Screen for AudioSettingsMenu {
buttons.push(done_button); buttons.push(done_button);
self.elements = Some(UIElements { self.elements = Some(UIElements {
background: background, background,
_buttons: buttons, _buttons: buttons,
}); });

View File

@ -110,8 +110,8 @@ impl Server {
let port = conn.port; let port = conn.port;
conn.write_packet(protocol::packet::handshake::serverbound::Handshake { conn.write_packet(protocol::packet::handshake::serverbound::Handshake {
protocol_version: protocol::VarInt(protocol::SUPPORTED_PROTOCOL), protocol_version: protocol::VarInt(protocol::SUPPORTED_PROTOCOL),
host: host, host,
port: port, port,
next: protocol::VarInt(2), next: protocol::VarInt(2),
})?; })?;
conn.state = protocol::State::Login; conn.state = protocol::State::Login;
@ -261,9 +261,9 @@ impl Server {
let version = resources.read().unwrap().version(); let version = resources.read().unwrap().version();
Server { Server {
uuid: uuid, uuid,
conn: conn, conn,
read_queue: read_queue, read_queue,
disconnect_reason: None, disconnect_reason: None,
just_disconnected: false, just_disconnected: false,
@ -273,11 +273,11 @@ impl Server {
world_time_target: 0.0, world_time_target: 0.0,
tick_time: true, tick_time: true,
version: version, version,
resources: resources, resources,
// Entity accessors // Entity accessors
game_info: game_info, game_info,
player_movement: entities.get_key(), player_movement: entities.get_key(),
gravity: entities.get_key(), gravity: entities.get_key(),
position: entities.get_key(), position: entities.get_key(),
@ -288,7 +288,7 @@ impl Server {
target_rotation: entities.get_key(), target_rotation: entities.get_key(),
// //
entities: entities, entities,
player: None, player: None,
entity_map: HashMap::with_hasher(BuildHasherDefault::default()), entity_map: HashMap::with_hasher(BuildHasherDefault::default()),
players: HashMap::with_hasher(BuildHasherDefault::default()), players: HashMap::with_hasher(BuildHasherDefault::default()),
@ -494,7 +494,7 @@ impl Server {
z: position.position.z, z: position.position.z,
yaw: -(rotation.yaw as f32) * (180.0 / PI), yaw: -(rotation.yaw as f32) * (180.0 / PI),
pitch: (-rotation.pitch as f32) * (180.0 / PI) + 180.0, pitch: (-rotation.pitch as f32) * (180.0 / PI) + 180.0,
on_ground: on_ground, on_ground,
}; };
self.write_packet(packet); self.write_packet(packet);
} }
@ -749,7 +749,7 @@ impl Server {
Add { name, uuid, properties, display, gamemode, ping} => { Add { name, uuid, properties, display, gamemode, ping} => {
let info = self.players.entry(uuid.clone()).or_insert(PlayerInfo { let info = self.players.entry(uuid.clone()).or_insert(PlayerInfo {
name: name.clone(), name: name.clone(),
uuid: uuid, uuid,
skin_url: None, skin_url: None,
display_name: display.clone(), display_name: display.clone(),
@ -846,7 +846,7 @@ impl Server {
} }
self.on_block_entity_update(packet::play::clientbound::UpdateBlockEntity { self.on_block_entity_update(packet::play::clientbound::UpdateBlockEntity {
location: Position::new(x, y, z), location: Position::new(x, y, z),
action: action, action,
nbt: Some(block_entity.clone()), nbt: Some(block_entity.clone()),
}); });
} }

View File

@ -12,7 +12,7 @@ impl Brand {
Serializable::write_to(&self.brand, &mut data).unwrap(); Serializable::write_to(&self.brand, &mut data).unwrap();
PluginMessageServerbound { PluginMessageServerbound {
channel: "MC|Brand".into(), channel: "MC|Brand".into(),
data: data, data,
} }
} }
} }

View File

@ -210,8 +210,8 @@ pub fn trace_ray<F, R>(world: &world::World, max: f64, s: cgmath::Vector3<f64>,
}; };
Gen { Gen {
count: 0, count: 0,
base: base, base,
d: d, d,
} }
} }

View File

@ -63,7 +63,7 @@ impl Map {
Map { Map {
length: (bits.len()*64 + (size-1)) / size, length: (bits.len()*64 + (size-1)) / size,
bit_size: size, bit_size: size,
bits: bits, bits,
} }
} }

View File

@ -31,7 +31,7 @@ impl <T: MetaValue> MetadataKey<T> {
#[allow(dead_code)] #[allow(dead_code)]
fn new(index: i32) -> MetadataKey<T> { fn new(index: i32) -> MetadataKey<T> {
MetadataKey { MetadataKey {
index: index, index,
ty: PhantomData, ty: PhantomData,
} }
} }

View File

@ -126,10 +126,10 @@ impl Logo {
_shadow: shadow_batch, _shadow: shadow_batch,
_layer0: layer0, _layer0: layer0,
text: txt, text: txt,
text_base_scale: text_base_scale, text_base_scale,
text_orig_x: text_orig_x, text_orig_x,
text_index: -1, text_index: -1,
text_strings: text_strings, text_strings,
} }
} }

View File

@ -1021,7 +1021,7 @@ impl UIElement for Formatted {
offset: 0.0, offset: 0.0,
text: Vec::new(), text: Vec::new(),
max_width: self.max_width, max_width: self.max_width,
renderer: renderer, renderer,
}; };
state.build(&self.text, format::Color::White); state.build(&self.text, format::Color::White);
self.text_elements = state.text; self.text_elements = state.text;
@ -1079,8 +1079,8 @@ impl Formatted {
width: 0.0, width: 0.0,
offset: 0.0, offset: 0.0,
text: Vec::new(), text: Vec::new(),
max_width: max_width, max_width,
renderer: renderer, renderer,
}; };
state.build(text, format::Color::White); state.build(text, format::Color::White);
(state.width + 2.0, (state.lines + 1) as f64 * 18.0) (state.width + 2.0, (state.lines + 1) as f64 * 18.0)

View File

@ -12,7 +12,7 @@ pub struct Biome {
impl Biome { impl Biome {
const fn new(id: usize, t: i16, m: i16) -> Biome { const fn new(id: usize, t: i16, m: i16) -> Biome {
Biome { Biome {
id: id, id,
temperature: t, temperature: t,
moisture: m*t, moisture: m*t,
} }

View File

@ -178,8 +178,8 @@ impl World {
fn update_light(&mut self, pos: Position, ty: LightType) { fn update_light(&mut self, pos: Position, ty: LightType) {
self.light_updates.push_back(LightUpdate { self.light_updates.push_back(LightUpdate {
ty: ty, ty,
pos: pos, pos,
}); });
} }
@ -470,8 +470,8 @@ impl World {
sky_light: nibble::Array::new((w * h * d) as usize), sky_light: nibble::Array::new((w * h * d) as usize),
biomes: vec![0; (w * d) as usize], biomes: vec![0; (w * d) as usize],
x: x, y: y, z: z, x, y, z,
w: w, _h: h, d: d, w, _h: h, d,
}; };
for i in 0 .. (w * h * d) as usize { for i in 0 .. (w * h * d) as usize {
snapshot.sky_light.set(i, 0xF); snapshot.sky_light.set(i, 0xF);
@ -914,7 +914,7 @@ impl Section {
let mut section = Section { let mut section = Section {
cull_info: chunk_builder::CullInfo::all_vis(), cull_info: chunk_builder::CullInfo::all_vis(),
render_buffer: render::ChunkBuffer::new(), render_buffer: render::ChunkBuffer::new(),
y: y, y,
blocks: storage::BlockStorage::new(4096), blocks: storage::BlockStorage::new(4096),