Skip to content

Commit

Permalink
Improve clone efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
altugbakan committed Jun 11, 2024
1 parent d054166 commit 52a6cf3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ pub struct Config {
impl Default for Config {
fn default() -> Self {
Self {
ip_address: IpAddr::V4(Ipv4Addr::LOCALHOST),
port: 69,
directory: env::current_dir().unwrap_or_else(|_| env::temp_dir()),
ip_address: IpAddr::V4(Ipv4Addr::LOCALHOST),
port: 69,
directory: env::current_dir().unwrap_or_else(|_| env::temp_dir()),
receive_directory: Default::default(),
send_directory: Default::default(),
single_port: Default::default(),
read_only: Default::default(),
duplicate_packets: Default::default(),
overwrite: Default::default(),
}
}
}
}

Expand Down Expand Up @@ -159,10 +159,10 @@ impl Config {
}

if config.receive_directory == PathBuf::new() {
config.receive_directory = config.directory.clone();
config.receive_directory.clone_from(&config.directory);
}
if config.send_directory == PathBuf::new() {
config.send_directory = config.directory.clone();
config.send_directory.clone_from(&config.directory);
}

Ok(config)
Expand Down

0 comments on commit 52a6cf3

Please sign in to comment.