Fix various new clippy lints

This commit is contained in:
Filip Tibell 2025-03-24 19:43:53 +01:00
parent dc08b91314
commit 6902ecaa7c
No known key found for this signature in database
8 changed files with 12 additions and 12 deletions

View file

@ -41,7 +41,7 @@ where
}
fn remove_matching_prop(inst: &mut DomInstance, ty: DomType, name: &'static str) {
if inst.properties.get(name).map_or(false, |u| u.ty() == ty) {
if inst.properties.get(name).is_some_and(|u| u.ty() == ty) {
inst.properties.remove(name);
}
}

View file

@ -23,7 +23,7 @@ pub fn make_list_writer() -> Box<ListWriter> {
})
}
/**
/*
Userdata metamethod implementations
Note that many of these return [`LuaResult`] even though they don't

View file

@ -60,7 +60,7 @@ where
}
}
/**
/*
Conversion methods between `DateTimeValues` and plain lua tables
Note that the `IntoLua` implementation here uses a read-only table,
@ -117,7 +117,7 @@ impl IntoLua<'_> for DateTimeValues {
}
}
/**
/*
Conversion methods between chrono's timezone-aware `DateTime` to
and from our non-timezone-aware `DateTimeValues` values struct
*/

View file

@ -33,7 +33,7 @@ where
}
}
impl<'a, W> AsyncWrite for AsyncTeeWriter<'a, W>
impl<W> AsyncWrite for AsyncTeeWriter<'_, W>
where
W: AsyncWrite + Unpin,
{

View file

@ -117,7 +117,7 @@ impl<'lua> FromLua<'lua> for CompressDecompressFormat {
Errors when the compression fails.
*/
pub async fn compress<'lua>(
pub async fn compress(
source: impl AsRef<[u8]>,
format: CompressDecompressFormat,
level: Option<i32>,
@ -163,7 +163,7 @@ pub async fn compress<'lua>(
Errors when the decompression fails.
*/
pub async fn decompress<'lua>(
pub async fn decompress(
source: impl AsRef<[u8]>,
format: CompressDecompressFormat,
) -> LuaResult<Vec<u8>> {

View file

@ -150,9 +150,9 @@ impl RequireContext {
self.get_from_cache(lua, abs_path.as_ref())
}
async fn load<'lua>(
async fn load(
&self,
lua: &'lua Lua,
lua: &Lua,
abs_path: impl AsRef<Path>,
rel_path: impl AsRef<Path>,
) -> LuaResult<LuaRegistryKey> {

View file

@ -64,8 +64,8 @@ pub fn discover_script_path(path: impl AsRef<str>, in_home_dir: bool) -> Result<
// NOTE: We use metadata directly here to try to
// avoid accessing the file path more than once
let file_meta = file_path.metadata();
let is_file = file_meta.as_ref().map_or(false, Metadata::is_file);
let is_dir = file_meta.as_ref().map_or(false, Metadata::is_dir);
let is_file = file_meta.as_ref().is_ok_and(Metadata::is_file);
let is_dir = file_meta.as_ref().is_ok_and(Metadata::is_dir);
let is_abs = file_path.is_absolute();
let ext = file_path.extension();
if is_file {

View file

@ -334,7 +334,7 @@ impl<'lua> LuaSchedulerExt<'lua> for Lua {
}
}
impl<'lua> LuaSpawnExt<'lua> for Lua {
impl LuaSpawnExt<'_> for Lua {
fn spawn<F, T>(&self, fut: F) -> Task<T>
where
F: Future<Output = T> + Send + 'static,