mirror of
https://github.com/encounter/decomp-toolkit.git
synced 2025-12-13 23:26:15 +00:00
Fix clippy lints and address cargo deny advisories (#117)
This commit is contained in:
@@ -123,7 +123,7 @@ pub fn run(args: Args) -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
fn load_obj(buf: &[u8]) -> Result<File> {
|
||||
fn load_obj(buf: &[u8]) -> Result<File<'_>> {
|
||||
let obj = File::parse(buf)?;
|
||||
match obj.architecture() {
|
||||
Architecture::PowerPc => {}
|
||||
|
||||
@@ -144,7 +144,7 @@ pub fn touch(path: &Utf8NativePath) -> io::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn decompress_if_needed(buf: &[u8]) -> Result<Bytes> {
|
||||
pub fn decompress_if_needed(buf: &[u8]) -> Result<Bytes<'_>> {
|
||||
if buf.len() > 4 {
|
||||
match *array_ref!(buf, 0, 4) {
|
||||
YAZ0_MAGIC => return decompress_yaz0(buf).map(Bytes::Owned),
|
||||
|
||||
@@ -200,7 +200,7 @@ impl<'a> RarcView<'a> {
|
||||
}
|
||||
|
||||
/// Get a string from the string table at the given offset.
|
||||
pub fn get_string(&self, offset: u32) -> Result<Cow<str>, String> {
|
||||
pub fn get_string(&self, offset: u32) -> Result<Cow<'_, str>, String> {
|
||||
let name_buf = self.string_table.get(offset as usize..).ok_or_else(|| {
|
||||
format!(
|
||||
"RARC: name offset {} out of bounds (string table size: {})",
|
||||
|
||||
@@ -121,10 +121,10 @@ impl<'a> U8View<'a> {
|
||||
}
|
||||
|
||||
/// Iterate over the nodes in the U8 archive.
|
||||
pub fn iter(&self) -> U8Iter { U8Iter { inner: self, idx: 1 } }
|
||||
pub fn iter(&self) -> U8Iter<'_> { U8Iter { inner: self, idx: 1 } }
|
||||
|
||||
/// Get the name of a node.
|
||||
pub fn get_name(&self, node: U8Node) -> Result<Cow<str>, String> {
|
||||
pub fn get_name(&self, node: U8Node) -> Result<Cow<'_, str>, String> {
|
||||
let name_buf = self.string_table.get(node.name_offset() as usize..).ok_or_else(|| {
|
||||
format!(
|
||||
"U8: name offset {} out of bounds (string table size: {})",
|
||||
|
||||
@@ -47,7 +47,7 @@ impl DiscFs {
|
||||
Ok(Self { disc, base, meta, mtime })
|
||||
}
|
||||
|
||||
fn find(&self, path: &Utf8UnixPath) -> VfsResult<DiscNode> {
|
||||
fn find(&self, path: &Utf8UnixPath) -> VfsResult<DiscNode<'_>> {
|
||||
let path = path.as_str().trim_matches('/');
|
||||
let mut split = path.split('/');
|
||||
let mut segment = next_non_empty(&mut split);
|
||||
|
||||
@@ -13,7 +13,7 @@ pub struct RarcFs {
|
||||
impl RarcFs {
|
||||
pub fn new(file: Box<dyn VfsFile>) -> io::Result<Self> { Ok(Self { file }) }
|
||||
|
||||
fn view(&mut self) -> io::Result<RarcView> {
|
||||
fn view(&mut self) -> io::Result<RarcView<'_>> {
|
||||
let data = self.file.map()?;
|
||||
RarcView::new(data).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ pub struct U8Fs {
|
||||
impl U8Fs {
|
||||
pub fn new(file: Box<dyn VfsFile>) -> io::Result<Self> { Ok(Self { file }) }
|
||||
|
||||
fn view(&mut self) -> io::Result<U8View> {
|
||||
fn view(&mut self) -> io::Result<U8View<'_>> {
|
||||
let data = self.file.map()?;
|
||||
U8View::new(data).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ impl WadFs {
|
||||
Ok(Self { file, wad, mtime })
|
||||
}
|
||||
|
||||
fn find(&self, path: &str) -> Option<WadFindResult> {
|
||||
fn find(&self, path: &str) -> Option<WadFindResult<'_>> {
|
||||
let filename = path.trim_start_matches('/');
|
||||
if filename.contains('/') {
|
||||
return None;
|
||||
|
||||
Reference in New Issue
Block a user