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) } }