Follow some of clippy's suggestions

This commit is contained in:
Thinkofname 2016-03-26 14:24:26 +00:00
parent 57bced4a9b
commit f3377c17c6
3 changed files with 8 additions and 9 deletions

View File

@ -802,17 +802,16 @@ impl Conn {
}
}
pub fn enable_encyption(&mut self, key: &Vec<u8>, decrypt: bool) {
pub fn enable_encyption(&mut self, key: &[u8], decrypt: bool) {
self.cipher = Option::Some(openssl::EVPCipher::new(key, key, decrypt));
}
pub fn set_compresssion(&mut self, threshold: i32, read: bool) {
self.compression_threshold = threshold;
if !read {
self.compression_write = Some(ZlibEncoder::new(io::Cursor::new(Vec::new()),
flate2::Compression::Default));
} else {
if read {
self.compression_read = Some(ZlibDecoder::new(io::Cursor::new(Vec::new())));
} else {
self.compression_write = Some(ZlibEncoder::new(io::Cursor::new(Vec::new()), flate2::Compression::Default));
}
}

View File

@ -100,11 +100,11 @@ impl Profile {
Ok(self)
}
pub fn join_server(&self, server_id: &str, shared_key: &Vec<u8>, public_key: &Vec<u8>) -> Result<(), super::Error> {
pub fn join_server(&self, server_id: &str, shared_key: &[u8], public_key: &[u8]) -> Result<(), super::Error> {
let mut sha1 = openssl::SHA1::new();
sha1.update(server_id.as_bytes());
sha1.update(&shared_key[..]);
sha1.update(&public_key[..]);
sha1.update(shared_key);
sha1.update(public_key);
let mut hash = sha1.bytes();
// Mojang uses a hex method which allows for

View File

@ -59,7 +59,7 @@ state_packets!(
text: String =,
assume_command: bool =,
has_target: bool =,
target: Option<types::Position> = when(|p: &TabComplete| p.has_target == true),
target: Option<types::Position> = when(|p: &TabComplete| p.has_target),
}
// ChatMessage is sent by the client when it sends a chat message or
// executes a command (prefixed by '/').