meta: make clippy happy

pull/76/head
Jake McGinty 2021-05-10 00:09:50 +09:00
parent e166619883
commit 426916fadd
3 changed files with 7 additions and 9 deletions

View File

@ -143,13 +143,11 @@ pub fn init_wizard(conf: &ServerConfig, opts: InitializeOpts) -> Result<(), Erro
let endpoint: Endpoint = if let Some(endpoint) = opts.external_endpoint {
endpoint
} else if opts.auto_external_endpoint {
let ip = publicip::get_any(Preference::Ipv4)?.ok_or("couldn't get external IP")?;
SocketAddr::new(ip, 51820).into()
} else {
if opts.auto_external_endpoint {
let ip = publicip::get_any(Preference::Ipv4)?.ok_or("couldn't get external IP")?;
SocketAddr::new(ip, 51820).into()
} else {
prompts::ask_endpoint()?
}
prompts::ask_endpoint()?
};
let listen_port: u16 = if let Some(listen_port) = opts.listen_port {

View File

@ -204,7 +204,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
if let Err(e) = initialize::init_wizard(&conf, opts) {
println!("{}: {}.", "creation failed".red(), e);
}
},
}
Command::Uninstall { interface } => uninstall(&interface, &conf)?,
Command::Serve { interface } => serve(*interface, &conf).await?,
Command::AddPeer { interface, args } => add_peer(&interface, &conf, args)?,
@ -402,8 +402,8 @@ async fn serve(interface: InterfaceName, conf: &ServerConfig) -> Result<(), Erro
let context = Context {
db,
interface,
endpoints,
interface,
public_key,
};

View File

@ -35,7 +35,7 @@ pub fn ensure_dirs_exist(dirs: &[&Path]) -> Result<(), WrappedIoError> {
for dir in dirs {
match fs::create_dir(dir).with_path(dir) {
Err(e) if e.kind() != io::ErrorKind::AlreadyExists => {
return Err(e.into());
return Err(e);
}
_ => {
let target_file = File::open(dir).with_path(dir)?;