@@ -36,7 +36,9 @@ fn parse_kinds(raw: Option<&str>) -> Result<Vec<u32>, CliError> {
3636 out. push ( k) ;
3737 }
3838 if out. is_empty ( ) {
39- return Err ( CliError :: Usage ( "--kinds must list at least one kind" . into ( ) ) ) ;
39+ return Err ( CliError :: Usage (
40+ "--kinds must list at least one kind" . into ( ) ,
41+ ) ) ;
4042 }
4143 Ok ( out)
4244 }
@@ -88,10 +90,7 @@ async fn post_webhook(client: &reqwest::Client, url: &str, body: &str) {
8890 . send ( )
8991 . await
9092 {
91- eprintln ! (
92- "{}" ,
93- json!( { "error" : "webhook" , "message" : format!( "{e}" ) } )
94- ) ;
93+ eprintln ! ( "{}" , json!( { "error" : "webhook" , "message" : format!( "{e}" ) } ) ) ;
9594 }
9695}
9796
@@ -184,13 +183,10 @@ async fn listen_session(
184183) -> Result < ( ) , CliError > {
185184 use buzz_ws_client:: { NostrWsConnection , RelayMessage } ;
186185
187- let mut conn = NostrWsConnection :: connect_authenticated (
188- ws_url,
189- client. keys ( ) ,
190- client. auth_tag ( ) ,
191- )
192- . await
193- . map_err ( |e| CliError :: Other ( format ! ( "websocket: {e}" ) ) ) ?;
186+ let mut conn =
187+ NostrWsConnection :: connect_authenticated ( ws_url, client. keys ( ) , client. auth_tag ( ) )
188+ . await
189+ . map_err ( |e| CliError :: Other ( format ! ( "websocket: {e}" ) ) ) ?;
194190
195191 let sub_id = format ! ( "buzz-listen-{}" , & Uuid :: new_v4( ) . to_string( ) [ ..8 ] ) ;
196192 let mut req = vec ! [ json!( "REQ" ) , json!( sub_id) ] ;
@@ -215,8 +211,7 @@ async fn listen_session(
215211 . map_err ( |e| CliError :: Other ( format ! ( "event serialize: {e}" ) ) ) ?;
216212 let line = normalize_events ( std:: slice:: from_ref ( & raw ) ) ;
217213 // normalize_events returns a JSON array; unwrap first element for NDJSON stream.
218- let arr: Vec < serde_json:: Value > =
219- serde_json:: from_str ( & line) . unwrap_or_default ( ) ;
214+ let arr: Vec < serde_json:: Value > = serde_json:: from_str ( & line) . unwrap_or_default ( ) ;
220215 let body = arr. first ( ) . cloned ( ) . unwrap_or ( raw) ;
221216 let text = serde_json:: to_string ( & body) . unwrap_or_default ( ) ;
222217 println ! ( "{text}" ) ;
@@ -256,7 +251,13 @@ mod tests {
256251 #[ test]
257252 fn channel_filter_uses_h_tag ( ) {
258253 let ch = "11111111-1111-1111-1111-111111111111" . to_string ( ) ;
259- let f = build_listen_filters ( & [ ch. clone ( ) ] , false , & "a" . repeat ( 64 ) , DEFAULT_KINDS ) . unwrap ( ) ;
254+ let f = build_listen_filters (
255+ std:: slice:: from_ref ( & ch) ,
256+ false ,
257+ & "a" . repeat ( 64 ) ,
258+ DEFAULT_KINDS ,
259+ )
260+ . unwrap ( ) ;
260261 assert_eq ! ( f. len( ) , 1 ) ;
261262 assert_eq ! ( f[ 0 ] [ "#h" ] [ 0 ] , ch) ;
262263 }
0 commit comments