diff options
author | Hristo Venev <hristo@venev.name> | 2019-03-19 17:46:48 +0200 |
---|---|---|
committer | Hristo Venev <hristo@venev.name> | 2019-03-19 17:47:02 +0200 |
commit | 51c9e1433bf139759a41173aa63fa40855a10fac (patch) | |
tree | 5e7094a6eeaa5853717f6dbd3b57880aa28574c9 /src/builder.rs | |
parent | b7632fb35571f63fe28368c6508aa67fe8d775c8 (diff) |
lintv0.1.0
Diffstat (limited to 'src/builder.rs')
-rw-r--r-- | src/builder.rs | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/builder.rs b/src/builder.rs index cc42fa8..ba3843b 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -3,9 +3,8 @@ // See COPYING. use crate::{config, model, proto}; -use std::{error, fmt}; use std::collections::hash_map; - +use std::{error, fmt}; #[derive(Debug)] pub struct ConfigError { @@ -68,11 +67,7 @@ impl<'a> ConfigBuilder<'a> { } #[inline] - pub fn add_server( - &mut self, - s: &config::Source, - p: &proto::Server, - ) { + pub fn add_server(&mut self, s: &config::Source, p: &proto::Server) { if p.peer.public_key == self.public_key { return; } @@ -88,13 +83,14 @@ impl<'a> ConfigBuilder<'a> { } #[inline] - pub fn add_road_warrior( - &mut self, - s: &config::Source, - p: &proto::RoadWarrior, - ) { + pub fn add_road_warrior(&mut self, s: &config::Source, p: &proto::RoadWarrior) { if p.peer.public_key == self.public_key { - self.err.push(ConfigError::new("The local peer cannot be a road warrior", s, &p.peer, true)); + self.err.push(ConfigError::new( + "The local peer cannot be a road warrior", + s, + &p.peer, + true, + )); return; } @@ -104,7 +100,8 @@ impl<'a> ConfigBuilder<'a> { match self.c.peers.get_mut(&p.base) { Some(ent) => ent, None => { - self.err.push(ConfigError::new("Unknown base peer", s, &p.peer, true)); + self.err + .push(ConfigError::new("Unknown base peer", s, &p.peer, true)); return; } } @@ -140,7 +137,12 @@ fn insert_peer<'b>( } } -fn add_peer(err: &mut Vec<ConfigError>, ent: &mut model::Peer, s: &config::Source, p: &proto::Peer) { +fn add_peer( + err: &mut Vec<ConfigError>, + ent: &mut model::Peer, + s: &config::Source, + p: &proto::Peer, +) { let mut added = false; let mut removed = false; |