The world's most clever kitty cat
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Clippy fixes

Ben C a943d036 1fe3cd9e

+11 -11
+1 -1
src/brain.rs
··· 243 243 Self( 244 244 map.into_iter() 245 245 .map(|(k, v)| { 246 - let sum = v.values().map(|w| *w as u64).sum::<u64>() as u64; 246 + let sum = v.values().map(|w| *w as u64).sum::<u64>(); 247 247 let edges = Edges( 248 248 v.into_iter() 249 249 .map(|(t, w)| (Self::read_legacy_token(t), w))
+1 -1
src/cmd/load_chain.rs
··· 54 54 let mut brain = ctx.brain_handle.write().await; 55 55 brain.merge_from(new_brain); 56 56 ctx.pending_save.store(true, Ordering::Relaxed); 57 - update_status(&*brain, &ctx.shard_sender).context("Failed to update status")?; 57 + update_status(&brain, &ctx.shard_sender).context("Failed to update status")?; 58 58 } 59 59 60 60 client
+2 -2
src/main.rs
··· 81 81 Event::Ready(ev) => { 82 82 info!("Connected to gateway as {}", ev.user.name); 83 83 let brain = ctx.brain_handle.read().await; 84 - update_status(&*brain, &ctx.shard_sender).context("Failed to update status on ready") 84 + update_status(&brain, &ctx.shard_sender).context("Failed to update status on ready") 85 85 } 86 86 _ => Ok(()), 87 87 } ··· 101 101 let mut file = File::open(path).context("Failed to open brain file")?; 102 102 let mut brotli_stream = brotli::Decompressor::new(&mut file, BROTLI_BUF_SIZE); 103 103 rmp_serde::from_read(&mut brotli_stream) 104 - .map(|b| Some(b)) 104 + .map(Some) 105 105 .context("Failed to decode brain file") 106 106 } else { 107 107 Ok(None)
+7 -7
src/on_message.rs
··· 17 17 18 18 async fn learn_message(msg: &str, ctx: Arc<BotContext>) -> Result { 19 19 let mut brain = ctx.brain_handle.write().await; 20 - let learned_new_word = brain.ingest(&msg); 20 + let learned_new_word = brain.ingest(msg); 21 21 ctx.pending_save.store(true, Ordering::Relaxed); 22 22 23 23 if learned_new_word { 24 - update_status(&*brain, &ctx.shard_sender).context("Failed to update status")?; 24 + update_status(&brain, &ctx.shard_sender).context("Failed to update status")?; 25 25 } 26 26 27 27 Ok(()) ··· 40 40 let ctx_typ = ctx.clone(); 41 41 let typ_id = channel_id; 42 42 tokio::spawn(async move { 43 - if typ_rx.await.ok().is_some_and(|start| start) { 44 - if let Err(why) = ctx_typ.http.create_typing_trigger(typ_id).await { 45 - warn!("Failed to set typing indicator:\n{why:?}"); 46 - } 43 + if typ_rx.await.ok().is_some_and(|start| start) 44 + && let Err(why) = ctx_typ.http.create_typing_trigger(typ_id).await 45 + { 46 + warn!("Failed to set typing indicator:\n{why:?}"); 47 47 } 48 48 done_tx.send(()).ok(); 49 49 }); 50 50 51 51 let brain = ctx.brain_handle.read().await; 52 52 if let Some(reply_text) = brain 53 - .respond(&msg, is_self, Some(typ_tx)) 53 + .respond(msg, is_self, Some(typ_tx)) 54 54 .filter(|s| !s.trim().is_empty()) 55 55 { 56 56 drop(brain);