enable single_use_lifetimes lint

This commit is contained in:
Charles Hall 2024-05-12 14:49:24 -07:00
parent bc2f7c6826
commit 5d5e28770b
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
4 changed files with 5 additions and 10 deletions

View file

@ -6,6 +6,7 @@ macro_use_extern_crate = "warn"
missing_abi = "warn" missing_abi = "warn"
noop_method_call = "warn" noop_method_call = "warn"
pointer_structural_match = "warn" pointer_structural_match = "warn"
single_use_lifetimes = "warn"
unreachable_pub = "warn" unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "warn" unsafe_op_in_unsafe_fn = "warn"
unused_extern_crates = "warn" unused_extern_crates = "warn"

View file

@ -264,7 +264,7 @@ impl service::rooms::state_cache::Data for KeyValueDatabase {
} }
#[tracing::instrument(skip(self))] #[tracing::instrument(skip(self))]
fn server_in_room<'a>(&'a self, server: &ServerName, room_id: &RoomId) -> Result<bool> { fn server_in_room(&self, server: &ServerName, room_id: &RoomId) -> Result<bool> {
let mut key = server.as_bytes().to_vec(); let mut key = server.as_bytes().to_vec();
key.push(0xff); key.push(0xff);
key.extend_from_slice(room_id.as_bytes()); key.extend_from_slice(room_id.as_bytes());

View file

@ -226,11 +226,7 @@ impl Service {
} }
#[tracing::instrument(skip(self))] #[tracing::instrument(skip(self))]
pub(crate) fn server_in_room<'a>( pub(crate) fn server_in_room(&self, server: &ServerName, room_id: &RoomId) -> Result<bool> {
&'a self,
server: &ServerName,
room_id: &RoomId,
) -> Result<bool> {
self.db.server_in_room(server, room_id) self.db.server_in_room(server, room_id)
} }

View file

@ -128,9 +128,7 @@ pub(crate) fn deserialize_from_str<
deserializer: D, deserializer: D,
) -> Result<T, D::Error> { ) -> Result<T, D::Error> {
struct Visitor<T: FromStr<Err = E>, E>(std::marker::PhantomData<T>); struct Visitor<T: FromStr<Err = E>, E>(std::marker::PhantomData<T>);
impl<'de, T: FromStr<Err = Err>, Err: std::fmt::Display> serde::de::Visitor<'de> impl<T: FromStr<Err = Err>, Err: std::fmt::Display> serde::de::Visitor<'_> for Visitor<T, Err> {
for Visitor<T, Err>
{
type Value = T; type Value = T;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "a parsable string") write!(formatter, "a parsable string")
@ -152,7 +150,7 @@ pub(crate) fn deserialize_from_str<
/// string when passed to a format string. /// string when passed to a format string.
pub(crate) struct HtmlEscape<'a>(pub(crate) &'a str); pub(crate) struct HtmlEscape<'a>(pub(crate) &'a str);
impl<'a> fmt::Display for HtmlEscape<'a> { impl fmt::Display for HtmlEscape<'_> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
// Because the internet is always right, turns out there's not that many // Because the internet is always right, turns out there's not that many
// characters to escape: http://stackoverflow.com/questions/7381974 // characters to escape: http://stackoverflow.com/questions/7381974