src: misc formatting fixes

This commit is contained in:
Ujjwal Sharma 2021-04-01 22:19:03 +05:30
parent f9fed6013d
commit 5ad54fd523
Signed by untrusted user: ryzokuken
GPG Key ID: 460B292812C67D9F
2 changed files with 6 additions and 9 deletions

View File

@ -1,6 +1,6 @@
use async_std::{fs, task};
use async_std::path::PathBuf;
use async_std::sync::Arc;
use async_std::{fs, task};
use clap::{load_yaml, App};
use ed25519_dalek::Keypair;
@ -9,8 +9,6 @@ use keypair::{SSBKeypair, SSBPublicKey};
mod network;
type Config = toml::map::Map<String, toml::Value>;
#[async_std::main]
async fn main() {
let options = load_yaml!("options.yaml");
@ -26,7 +24,7 @@ async fn main() {
),
};
let config = fs::read_to_string(config_file).await.unwrap();
let config: Config = toml::from_str(config.as_str()).unwrap();
let config: toml::map::Map<String, toml::Value> = toml::from_str(config.as_str()).unwrap();
let path = match options.value_of("path") {
Some(path) => PathBuf::from(path),

View File

@ -1,6 +1,6 @@
use async_std::task;
use async_std::net::{IpAddr, UdpSocket};
use async_std::sync::Arc;
use async_std::task;
use ed25519_dalek::PublicKey;
use crate::keypair::SSBPublicKey;
@ -31,8 +31,7 @@ pub struct Peer {
impl Peer {
// TODO: do this properly
pub fn to_discovery_packet(&self) -> String {
let parts: Vec<String> = self
.addresses
self.addresses
.iter()
.map(|address| {
let proto = match address.protocol {
@ -53,8 +52,8 @@ impl Peer {
self.key.to_base64(),
)
})
.collect();
parts.join(";")
.collect::<Vec<String>>()
.join(";")
}
// TODO: do this properly