enable string_slice lint

Also swaps out vendored HTML-escaping code for a dependency that I
imagine has decent testing considering all of its reverse depedencies.
This commit is contained in:
Charles Hall 2024-05-12 19:08:12 -07:00
parent 9abe4799db
commit 844b32f097
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
7 changed files with 35 additions and 73 deletions

View file

@ -1,4 +1,4 @@
use crate::{services, utils::HtmlEscape, Error, Result, Ruma};
use crate::{services, Error, Result, Ruma};
use ruma::{
api::client::{error::ErrorKind, room::report_content},
events::room::message,
@ -61,7 +61,7 @@ pub(crate) async fn report_event_route(
pdu.room_id,
pdu.sender,
body.score,
HtmlEscape(body.reason.as_deref().unwrap_or(""))
html_escape::encode_safe(body.reason.as_deref().unwrap_or(""))
),
));

View file

@ -107,7 +107,7 @@ impl FedDest {
fn port(&self) -> Option<u16> {
match &self {
Self::Literal(addr) => Some(addr.port()),
Self::Named(_, port) => port[1..].parse().ok(),
Self::Named(_, port) => port.strip_prefix(':').and_then(|x| x.parse().ok()),
}
}
}