node: Infer the arg type

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier 2022-09-05 22:33:46 +02:00
parent ec865ee9f4
commit 8fbcb51963
No known key found for this signature in database
1 changed files with 1 additions and 3 deletions

View File

@ -4,12 +4,10 @@ use std::io::BufReader;
use std::os::unix::net::UnixListener; use std::os::unix::net::UnixListener;
use std::os::unix::net::UnixStream; use std::os::unix::net::UnixStream;
use std::path::Path; use std::path::Path;
use std::str::FromStr;
use std::{fs, io, net}; use std::{fs, io, net};
use crate::client; use crate::client;
use crate::client::handle::traits::Handle; use crate::client::handle::traits::Handle;
use crate::identity::ProjId;
/// Default name for control socket file. /// Default name for control socket file.
pub const DEFAULT_SOCKET_NAME: &str = "radicle.sock"; pub const DEFAULT_SOCKET_NAME: &str = "radicle.sock";
@ -65,7 +63,7 @@ fn drain<H: Handle>(stream: &UnixStream, handle: &H) -> Result<(), DrainError> {
for line in reader.by_ref().lines().flatten() { for line in reader.by_ref().lines().flatten() {
match line.split_once(' ') { match line.split_once(' ') {
Some(("update", arg)) => { Some(("update", arg)) => {
if let Ok(id) = ProjId::from_str(arg) { if let Ok(id) = arg.parse() {
if let Err(e) = handle.updated(id) { if let Err(e) = handle.updated(id) {
return Err(DrainError::Client(e)); return Err(DrainError::Client(e));
} }