Apply clippy lints

This commit is contained in:
Lucas Schwiderski 2023-11-09 19:48:05 +01:00 committed by Lucas Schwiderski
parent 871a54020e
commit e633a571b5
3 changed files with 7 additions and 10 deletions

View file

@ -154,7 +154,7 @@ impl Api {
self.mods_download_link(nxm.mod_id, nxm.file_id, nxm.key, nxm.expires)
)?;
let Some(download_url) = download_info.get(0).map(|i| i.uri.clone()) else {
let Some(download_url) = download_info.first().map(|i| i.uri.clone()) else {
return Err(Error::InvalidNXM("no download link", url));
};

View file

@ -227,12 +227,9 @@ impl Bundle {
let _enter = span.enter();
tracing::trace!(num_files = self.files.len());
self.files
.iter()
.fold(Ok::<Vec<u8>, Report>(Vec::new()), |data, file| {
let mut data = data?;
self.files.iter().try_fold(Vec::new(), |mut data, file| {
data.append(&mut file.to_binary()?);
Ok(data)
Ok::<_, Report>(data)
})?
};

View file

@ -53,8 +53,8 @@ where
let mut buf = vec![0u8; length];
r.read_exact(&mut buf)?;
let mut s = String::from_utf8(buf)
.wrap_err_with(|| format!("Invalid byte sequence for LuaJIT bytecode name"))?;
let mut s =
String::from_utf8(buf).wrap_err("Invalid byte sequence for LuaJIT bytecode name")?;
// Remove the leading `@`
s.remove(0);
s