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:
parent
d8b2c17f83
commit
da04367669
|
@ -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;
|
||||||
|
|
|
@ -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)?)
|
||||||
|
|
Loading…
Reference in New Issue