From f4a368f81ebe60b9ec08340460ddf9666f5711b1 Mon Sep 17 00:00:00 2001 From: Vincent Botbol Date: Mon, 8 Oct 2018 12:01:34 +0200 Subject: [PATCH] RPC: replace `return ()` with `return_unit` --- src/lib_p2p/p2p.ml | 12 ++++++------ src/lib_rpc/RPC_answer.ml | 1 + src/lib_rpc/RPC_answer.mli | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib_p2p/p2p.ml b/src/lib_p2p/p2p.ml index b0302e953..40e05944a 100644 --- a/src/lib_p2p/p2p.ml +++ b/src/lib_p2p/p2p.ml @@ -718,7 +718,7 @@ let build_rpc_directory net = | None -> RPC_answer.not_found | Some pool -> P2p_pool.Peers.forget pool peer_id ; - RPC_answer.return () + RPC_answer.return_unit end in let dir = @@ -729,7 +729,7 @@ let build_rpc_directory net = | Some pool -> P2p_pool.Peers.unset_trusted pool peer_id; P2p_pool.Peers.ban pool peer_id ; - RPC_answer.return () + RPC_answer.return_unit end in let dir = @@ -739,7 +739,7 @@ let build_rpc_directory net = | None -> RPC_answer.not_found | Some pool -> P2p_pool.Peers.set_trusted pool peer_id ; - RPC_answer.return () + RPC_answer.return_unit end in let dir = @@ -823,7 +823,7 @@ let build_rpc_directory net = | None -> RPC_answer.not_found | Some pool -> P2p_pool.Points.forget pool point ; - RPC_answer.return () + RPC_answer.return_unit end in let dir = @@ -834,7 +834,7 @@ let build_rpc_directory net = | Some pool -> P2p_pool.Points.unset_trusted pool point; P2p_pool.Points.ban pool point; - RPC_answer.return () + RPC_answer.return_unit end in let dir = @@ -844,7 +844,7 @@ let build_rpc_directory net = | None -> RPC_answer.not_found | Some pool -> P2p_pool.Points.set_trusted pool point ; - RPC_answer.return () + RPC_answer.return_unit end in let dir = diff --git a/src/lib_rpc/RPC_answer.ml b/src/lib_rpc/RPC_answer.ml index b964a536a..873bde1ae 100644 --- a/src/lib_rpc/RPC_answer.ml +++ b/src/lib_rpc/RPC_answer.ml @@ -42,6 +42,7 @@ and 'a stream = 'a Resto_directory.Answer.stream = { } let return x = Lwt.return (`Ok x) +let return_unit = Lwt.return (`Ok ()) let return_stream x = Lwt.return (`OkStream x) let not_found = Lwt.return (`Not_found None) diff --git a/src/lib_rpc/RPC_answer.mli b/src/lib_rpc/RPC_answer.mli index f2f78c1a0..26bbc359f 100644 --- a/src/lib_rpc/RPC_answer.mli +++ b/src/lib_rpc/RPC_answer.mli @@ -42,6 +42,7 @@ and 'a stream = 'a Resto_directory.Answer.stream = { } val return: 'o -> 'o t Lwt.t +val return_unit: unit t Lwt.t val return_stream: 'o stream -> 'o t Lwt.t val not_found: 'o t Lwt.t