summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReiner Herrmann <reiner@reiner-h.de>2020-01-19 15:33:33 +0100
committerReiner Herrmann <reiner@reiner-h.de>2020-01-19 15:33:33 +0100
commit16c25588ee55261b9bbd58b5f2c61f3327f7596c (patch)
tree01b2ba1eccb1f5e406db344814db16c8e3be1469
parenteacce736ad2cedb0e65d15f5bd0abcee5405ec01 (diff)
Some cleanup as suggested by clippy
-rw-r--r--src/tftpc.rs5
-rw-r--r--src/tftpd.rs6
2 files changed, 4 insertions, 7 deletions
diff --git a/src/tftpc.rs b/src/tftpc.rs
index a134293..1e08982 100644
--- a/src/tftpc.rs
+++ b/src/tftpc.rs
@@ -218,10 +218,7 @@ impl Tftpc {
};
match err {
Ok(msg) => println!("{}", msg),
- Err(err) => {
- println!("Error: {}", err);
- return;
- }
+ Err(err) => println!("Error: {}", err),
}
}
}
diff --git a/src/tftpd.rs b/src/tftpd.rs
index e135d9f..dcc9f09 100644
--- a/src/tftpd.rs
+++ b/src/tftpd.rs
@@ -82,7 +82,7 @@ impl Tftpd {
}
}
- fn handle_wrq(&mut self, socket: &UdpSocket, cl: &SocketAddr, buf: &[u8]) -> Result<(String), io::Error> {
+ fn handle_wrq(&mut self, socket: &UdpSocket, cl: &SocketAddr, buf: &[u8]) -> Result<String, io::Error> {
let (filename, mode, mut options) = self.tftp.parse_file_mode_options(buf)?;
self.tftp.init_tftp_options(&socket, &mut options)?;
@@ -129,7 +129,7 @@ impl Tftpd {
}
}
- fn handle_rrq(&mut self, socket: &UdpSocket, cl: &SocketAddr, buf: &[u8]) -> Result<(String), io::Error> {
+ fn handle_rrq(&mut self, socket: &UdpSocket, cl: &SocketAddr, buf: &[u8]) -> Result<String, io::Error> {
let (filename, mode, mut options) = self.tftp.parse_file_mode_options(buf)?;
self.tftp.init_tftp_options(&socket, &mut options)?;
@@ -351,7 +351,7 @@ fn parse_commandline(args: &[String]) -> Option<Configuration> {
usage(&opts, &program, Some(String::from("Only one of r (read-only) and w (write-only) allowed")));
return None;
}
- if matches.free.len() > 0 {
+ if !matches.free.is_empty() {
conf.dir = Path::new(&matches.free[0]).to_path_buf();
}