From 573af32d3850b2c15a128c766519004e57f289bf Mon Sep 17 00:00:00 2001 From: Clover Johnson <95094165+callmeclover@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:23:01 -0400 Subject: [PATCH] fix 8 --- src/message/func.rs | 2 +- src/user/model.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/message/func.rs b/src/message/func.rs index a8a9d6ab..24aebf8a 100644 --- a/src/message/func.rs +++ b/src/message/func.rs @@ -27,7 +27,7 @@ pub fn into_censored_md(html: &str, user: &mut User) -> Result = document.descendants().text_nodes().map(|text| { as Clone>::clone(&text).into_inner()}).collect(); let mut nodes_char: Vec; - match user.glass.process(&nodes_text.join("")) { + match &user.glass.process(&nodes_text.join("")) { Ok(val) => { nodes_char = val.chars().collect() }, Err(err) => { return Err(err); } } diff --git a/src/user/model.rs b/src/user/model.rs index 7ab7c83e..47e9d64c 100644 --- a/src/user/model.rs +++ b/src/user/model.rs @@ -40,7 +40,7 @@ impl GlassModeration { /// This will add reports if it finds Type::OFFENSIVE, returning an error. /// If it finds no Type::OFFENSIVE, but Type::EVASIVE, it will instead warn the user. /// If the user is muted, it returns an error. - pub fn process(&mut self, input: &str) -> Result<&str, Box> { + pub fn process(&mut self, input: &str) -> Result> { if self.is_muted { return Err("User is muted".into()); } let (censored, analysis) = Censor::from_str(input) @@ -58,7 +58,7 @@ impl GlassModeration { if analysis.is(Type::EVASIVE) { self.warn(); } - Ok(&censored) + Ok(censored) } }