Clean up sc-peerset (#9806)

* Clean up sc-peerset

* cargo +nightly fmt --all

* Nit

* Nit

* .

* Nit

* .

* Apply suggestions from code review

* .

* Update client/peerset/src/peersstate.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Liu-Cheng Xu
2021-10-01 17:43:55 +08:00
committed by GitHub
parent f8ce186496
commit 00973f5b62
6 changed files with 62 additions and 72 deletions
+5 -5
View File
@@ -155,14 +155,14 @@ pub enum Role {
}
impl Role {
/// True for `Role::Authority`
/// True for [`Role::Authority`].
pub fn is_authority(&self) -> bool {
matches!(self, Role::Authority { .. })
matches!(self, Self::Authority { .. })
}
/// True for `Role::Light`
/// True for [`Role::Light`].
pub fn is_light(&self) -> bool {
matches!(self, Role::Light { .. })
matches!(self, Self::Light { .. })
}
}
@@ -329,7 +329,7 @@ impl FromStr for MultiaddrWithPeerId {
fn from_str(s: &str) -> Result<Self, Self::Err> {
let (peer_id, multiaddr) = parse_str_addr(s)?;
Ok(MultiaddrWithPeerId { peer_id, multiaddr })
Ok(Self { peer_id, multiaddr })
}
}