From 156bbc9ef6ba3f523b75457a24372a316d09c860 Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Mon, 22 Jul 2024 16:34:39 +0100 Subject: [PATCH] chore: cln enforce docs --- crates/cdk-cln/src/error.rs | 5 +++-- crates/cdk-cln/src/lib.rs | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/cdk-cln/src/error.rs b/crates/cdk-cln/src/error.rs index c37b357f..cabc78bb 100644 --- a/crates/cdk-cln/src/error.rs +++ b/crates/cdk-cln/src/error.rs @@ -1,5 +1,8 @@ +//! CLN Errors + use thiserror::Error; +/// CLN Error #[derive(Debug, Error)] pub enum Error { /// Invoice amount not defined @@ -17,8 +20,6 @@ pub enum Error { /// Cln Rpc Error #[error(transparent)] ClnRpc(#[from] cln_rpc::RpcError), - #[error("`{0}`")] - Custom(String), } impl From for cdk::cdk_lightning::Error { diff --git a/crates/cdk-cln/src/lib.rs b/crates/cdk-cln/src/lib.rs index e0ce63de..2ec98cba 100644 --- a/crates/cdk-cln/src/lib.rs +++ b/crates/cdk-cln/src/lib.rs @@ -1,5 +1,8 @@ //! CDK lightning backend for CLN +#![warn(missing_docs)] +#![warn(rustdoc::bare_urls)] + use std::path::PathBuf; use std::pin::Pin; use std::str::FromStr; @@ -30,6 +33,7 @@ use uuid::Uuid; pub mod error; +/// CLN mint backend #[derive(Clone)] pub struct Cln { rpc_socket: PathBuf, @@ -40,6 +44,7 @@ pub struct Cln { } impl Cln { + /// Create new ['Cln] pub async fn new( rpc_socket: PathBuf, fee_reserve: FeeReserve, @@ -282,7 +287,7 @@ impl MintLightning for Cln { } _ => { tracing::warn!("CLN returned wrong response kind"); - return Err(Error::Custom("CLN returned wrong response kind".to_string()).into()); + return Err(Error::WrongClnResponse.into()); } }; @@ -291,6 +296,7 @@ impl MintLightning for Cln { } impl Cln { + /// Get last pay index for cln async fn get_last_pay_index(&self) -> Result, Error> { let mut cln_client = self.cln_client.lock().await; let cln_response = cln_client