Remove unnecessary PeerId parsing code

This commit is contained in:
Antonio Scandurra 2022-12-16 11:45:42 +01:00
parent aa44de3d16
commit 21ab1bb434

View file

@ -6,7 +6,6 @@ use prost::Message as _;
use serde::Serialize;
use std::any::{Any, TypeId};
use std::fmt;
use std::str::FromStr;
use std::{
cmp,
fmt::Debug,
@ -119,23 +118,6 @@ impl fmt::Display for PeerId {
}
}
impl FromStr for PeerId {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut components = s.split('/');
let owner_id = components
.next()
.ok_or_else(|| anyhow!("invalid peer id {:?}", s))?
.parse()?;
let id = components
.next()
.ok_or_else(|| anyhow!("invalid peer id {:?}", s))?
.parse()?;
Ok(PeerId { owner_id, id })
}
}
messages!(
(Ack, Foreground),
(AddProjectCollaborator, Foreground),