fix: Removing all warnings.

This commit is contained in:
Sergiotarxz 2020-11-06 21:12:33 +01:00
parent f877abacd6
commit 91e112d825
3 changed files with 5 additions and 8 deletions

View File

@ -1,8 +1,6 @@
use fake_sftp::packet::Packet;
use fake_sftp::packet::dispatch_packet; use fake_sftp::packet::dispatch_packet;
use std::io::{stdin, BufReader, BufWriter, Read, Write}; use std::io::{BufWriter, Write};
use std::process::Command; use std::process::Command;
fn main() { fn main() {
@ -19,7 +17,7 @@ fn execute_php(command: &str) -> String {
.output() .output()
.expect(""); .expect("");
let mut buff_stderr = BufWriter::new(std::io::stderr()); let mut buff_stderr = BufWriter::new(std::io::stderr());
buff_stderr.write(&output.stderr); buff_stderr.write(&output.stderr).expect("Unable to write to stderr.");
buff_stderr.flush(); buff_stderr.flush().expect("Unable to flush stderr.");
return String::from_utf8(output.stdout).expect("Unable to parse php response"); return String::from_utf8(output.stdout).expect("Unable to parse php response");
} }

View File

@ -31,8 +31,8 @@ pub fn dispatch_packet(packet: Packet) {
}; };
let serialized_response = response_packet.serialize(); let serialized_response = response_packet.serialize();
eprintln!("{:#?}", &serialized_response); eprintln!("{:#?}", &serialized_response);
buff_stdout.write(&serialized_response); buff_stdout.write(&serialized_response).expect("Unable to write to stdout.");
buff_stdout.flush(); buff_stdout.flush().expect("Unable to flush stdout.");
} }
} }

View File

@ -14,7 +14,6 @@ impl PacketHeader {
} }
} }
pub fn serialize(&self) -> [u8; 5] { pub fn serialize(&self) -> [u8; 5] {
let serializated_data: [u8; 5] = [0; 5];
let length = self.length.to_be_bytes(); let length = self.length.to_be_bytes();
let type_packet = self.type_packet; let type_packet = self.type_packet;
let mut return_bytes = length.to_vec(); let mut return_bytes = length.to_vec();