From 5e7269ddccdba0c3cf173bce6012ff68da3fe0a6 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 18 Aug 2025 12:30:34 -0600 Subject: [PATCH] Make `gen` module private for now; lint fixes --- nod/src/build/gc.rs | 2 +- nod/src/common.rs | 4 ++-- nod/src/disc/fst.rs | 2 +- nod/src/disc/reader.rs | 2 +- nod/src/lib.rs | 3 ++- nod/src/read.rs | 4 ++-- nodtool/src/cmd/mod.rs | 3 ++- nodtool/src/lib.rs | 6 ++++-- nodtool/src/util/mod.rs | 2 +- 9 files changed, 16 insertions(+), 12 deletions(-) diff --git a/nod/src/build/gc.rs b/nod/src/build/gc.rs index a9150e6..2e40335 100644 --- a/nod/src/build/gc.rs +++ b/nod/src/build/gc.rs @@ -1,4 +1,4 @@ -#![allow(missing_docs)] // TODO +#![allow(missing_docs, unused)] // TODO use std::{ io, io::{Read, Seek, Write}, diff --git a/nod/src/common.rs b/nod/src/common.rs index e4883f0..55f9692 100644 --- a/nod/src/common.rs +++ b/nod/src/common.rs @@ -264,7 +264,7 @@ impl fmt::Display for PartitionKind { impl PartitionKind { /// Returns the directory name for the partition kind. #[inline] - pub fn dir_name(&self) -> Cow { + pub fn dir_name(&self) -> Cow<'_, str> { match self { Self::Data => Cow::Borrowed("DATA"), Self::Update => Cow::Borrowed("UPDATE"), @@ -356,7 +356,7 @@ impl PartitionInfo { /// A view into the file system table (FST). #[inline] - pub fn fst(&self) -> Option { + pub fn fst(&self) -> Option> { // FST has already been parsed, so we can safely unwrap Some(Fst::new(self.raw_fst.as_deref()?).unwrap()) } diff --git a/nod/src/disc/fst.rs b/nod/src/disc/fst.rs index 142ab24..49899f8 100644 --- a/nod/src/disc/fst.rs +++ b/nod/src/disc/fst.rs @@ -154,7 +154,7 @@ impl<'a> Fst<'a> { /// Iterate over the nodes in the FST. #[inline] - pub fn iter(&self) -> FstIter { FstIter { fst: self.clone(), idx: 1, segments: vec![] } } + pub fn iter(&self) -> FstIter<'_> { FstIter { fst: self.clone(), idx: 1, segments: vec![] } } /// Get the name of a node. pub fn get_name(&self, node: Node) -> Result, String> { diff --git a/nod/src/disc/reader.rs b/nod/src/disc/reader.rs index adf2b80..6a94b38 100644 --- a/nod/src/disc/reader.rs +++ b/nod/src/disc/reader.rs @@ -231,7 +231,7 @@ impl DiscReader { /// A reference to the raw FST for GameCube discs. /// For Wii discs, use the FST from the appropriate [PartitionInfo]. #[inline] - pub fn fst(&self) -> Option { + pub fn fst(&self) -> Option> { match &self.disc_data { DiscReaderData::GameCube { raw_fst } => { raw_fst.as_deref().and_then(|v| Fst::new(v).ok()) diff --git a/nod/src/lib.rs b/nod/src/lib.rs index 5a6841e..6628952 100644 --- a/nod/src/lib.rs +++ b/nod/src/lib.rs @@ -147,7 +147,8 @@ //! // ... //! ``` -pub mod build; +// [WIP] Disc image building is incomplete and not yet exposed. +pub(crate) mod build; pub mod common; pub mod disc; pub(crate) mod io; diff --git a/nod/src/read.rs b/nod/src/read.rs index c833b3f..9531d06 100644 --- a/nod/src/read.rs +++ b/nod/src/read.rs @@ -359,7 +359,7 @@ impl dyn PartitionReader + '_ { /// Ok(()) /// } /// ``` - pub fn open_file(&mut self, node: Node) -> io::Result { + pub fn open_file(&mut self, node: Node) -> io::Result> { if !node.is_file() { return Err(io::Error::new( io::ErrorKind::InvalidInput, @@ -475,7 +475,7 @@ impl PartitionMeta { /// A view into the file system table (FST). #[inline] - pub fn fst(&self) -> Result { Fst::new(&self.raw_fst) } + pub fn fst(&self) -> Result, &'static str> { Fst::new(&self.raw_fst) } /// A view into the DOL header. #[inline] diff --git a/nodtool/src/cmd/mod.rs b/nodtool/src/cmd/mod.rs index d5afd72..40a37c4 100644 --- a/nodtool/src/cmd/mod.rs +++ b/nodtool/src/cmd/mod.rs @@ -1,6 +1,7 @@ pub mod convert; pub mod dat; pub mod extract; -pub mod r#gen; +// [WIP] Disc image building is incomplete and not yet exposed. +// pub mod r#gen; pub mod info; pub mod verify; diff --git a/nodtool/src/lib.rs b/nodtool/src/lib.rs index 2478263..eafcfba 100644 --- a/nodtool/src/lib.rs +++ b/nodtool/src/lib.rs @@ -12,8 +12,9 @@ pub enum SubCommand { Convert(cmd::convert::Args), Dat(cmd::dat::Args), Extract(cmd::extract::Args), + // [WIP] Disc image building is incomplete and not yet exposed. // Gen(cmd::gen::Args), - GenTest(cmd::r#gen::TestArgs), + // GenTest(cmd::r#gen::TestArgs), Info(cmd::info::Args), Verify(cmd::verify::Args), } @@ -23,8 +24,9 @@ pub fn run(command: SubCommand) -> nod::Result<()> { SubCommand::Convert(c_args) => cmd::convert::run(c_args), SubCommand::Dat(c_args) => cmd::dat::run(c_args), SubCommand::Extract(c_args) => cmd::extract::run(c_args), + // [WIP] Disc image building is incomplete and not yet exposed. // SubCommand::Gen(c_args) => cmd::gen::run(c_args), - SubCommand::GenTest(c_args) => cmd::r#gen::run_test(c_args), + // SubCommand::GenTest(c_args) => cmd::r#gen::run_test(c_args), SubCommand::Info(c_args) => cmd::info::run(c_args), SubCommand::Verify(c_args) => cmd::verify::run(c_args), } diff --git a/nodtool/src/util/mod.rs b/nodtool/src/util/mod.rs index 917e1f8..c3ec9d1 100644 --- a/nodtool/src/util/mod.rs +++ b/nodtool/src/util/mod.rs @@ -8,7 +8,7 @@ use std::{ path::{MAIN_SEPARATOR, Path}, }; -pub fn path_display(path: &Path) -> PathDisplay { PathDisplay { path } } +pub fn path_display(path: &Path) -> PathDisplay<'_> { PathDisplay { path } } pub struct PathDisplay<'a> { path: &'a Path,