Make gen module private for now; lint fixes

This commit is contained in:
Luke Street 2025-08-18 12:30:34 -06:00
parent 4b4564207a
commit 5e7269ddcc
9 changed files with 16 additions and 12 deletions

View File

@ -1,4 +1,4 @@
#![allow(missing_docs)] // TODO #![allow(missing_docs, unused)] // TODO
use std::{ use std::{
io, io,
io::{Read, Seek, Write}, io::{Read, Seek, Write},

View File

@ -264,7 +264,7 @@ impl fmt::Display for PartitionKind {
impl PartitionKind { impl PartitionKind {
/// Returns the directory name for the partition kind. /// Returns the directory name for the partition kind.
#[inline] #[inline]
pub fn dir_name(&self) -> Cow<str> { pub fn dir_name(&self) -> Cow<'_, str> {
match self { match self {
Self::Data => Cow::Borrowed("DATA"), Self::Data => Cow::Borrowed("DATA"),
Self::Update => Cow::Borrowed("UPDATE"), Self::Update => Cow::Borrowed("UPDATE"),
@ -356,7 +356,7 @@ impl PartitionInfo {
/// A view into the file system table (FST). /// A view into the file system table (FST).
#[inline] #[inline]
pub fn fst(&self) -> Option<Fst> { pub fn fst(&self) -> Option<Fst<'_>> {
// FST has already been parsed, so we can safely unwrap // FST has already been parsed, so we can safely unwrap
Some(Fst::new(self.raw_fst.as_deref()?).unwrap()) Some(Fst::new(self.raw_fst.as_deref()?).unwrap())
} }

View File

@ -154,7 +154,7 @@ impl<'a> Fst<'a> {
/// Iterate over the nodes in the FST. /// Iterate over the nodes in the FST.
#[inline] #[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. /// Get the name of a node.
pub fn get_name(&self, node: Node) -> Result<Cow<'a, str>, String> { pub fn get_name(&self, node: Node) -> Result<Cow<'a, str>, String> {

View File

@ -231,7 +231,7 @@ impl DiscReader {
/// A reference to the raw FST for GameCube discs. /// A reference to the raw FST for GameCube discs.
/// For Wii discs, use the FST from the appropriate [PartitionInfo]. /// For Wii discs, use the FST from the appropriate [PartitionInfo].
#[inline] #[inline]
pub fn fst(&self) -> Option<Fst> { pub fn fst(&self) -> Option<Fst<'_>> {
match &self.disc_data { match &self.disc_data {
DiscReaderData::GameCube { raw_fst } => { DiscReaderData::GameCube { raw_fst } => {
raw_fst.as_deref().and_then(|v| Fst::new(v).ok()) raw_fst.as_deref().and_then(|v| Fst::new(v).ok())

View File

@ -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 common;
pub mod disc; pub mod disc;
pub(crate) mod io; pub(crate) mod io;

View File

@ -359,7 +359,7 @@ impl dyn PartitionReader + '_ {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
pub fn open_file(&mut self, node: Node) -> io::Result<FileReader> { pub fn open_file(&mut self, node: Node) -> io::Result<FileReader<'_>> {
if !node.is_file() { if !node.is_file() {
return Err(io::Error::new( return Err(io::Error::new(
io::ErrorKind::InvalidInput, io::ErrorKind::InvalidInput,
@ -475,7 +475,7 @@ impl PartitionMeta {
/// A view into the file system table (FST). /// A view into the file system table (FST).
#[inline] #[inline]
pub fn fst(&self) -> Result<Fst, &'static str> { Fst::new(&self.raw_fst) } pub fn fst(&self) -> Result<Fst<'_>, &'static str> { Fst::new(&self.raw_fst) }
/// A view into the DOL header. /// A view into the DOL header.
#[inline] #[inline]

View File

@ -1,6 +1,7 @@
pub mod convert; pub mod convert;
pub mod dat; pub mod dat;
pub mod extract; 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 info;
pub mod verify; pub mod verify;

View File

@ -12,8 +12,9 @@ pub enum SubCommand {
Convert(cmd::convert::Args), Convert(cmd::convert::Args),
Dat(cmd::dat::Args), Dat(cmd::dat::Args),
Extract(cmd::extract::Args), Extract(cmd::extract::Args),
// [WIP] Disc image building is incomplete and not yet exposed.
// Gen(cmd::gen::Args), // Gen(cmd::gen::Args),
GenTest(cmd::r#gen::TestArgs), // GenTest(cmd::r#gen::TestArgs),
Info(cmd::info::Args), Info(cmd::info::Args),
Verify(cmd::verify::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::Convert(c_args) => cmd::convert::run(c_args),
SubCommand::Dat(c_args) => cmd::dat::run(c_args), SubCommand::Dat(c_args) => cmd::dat::run(c_args),
SubCommand::Extract(c_args) => cmd::extract::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::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::Info(c_args) => cmd::info::run(c_args),
SubCommand::Verify(c_args) => cmd::verify::run(c_args), SubCommand::Verify(c_args) => cmd::verify::run(c_args),
} }

View File

@ -8,7 +8,7 @@ use std::{
path::{MAIN_SEPARATOR, Path}, 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> { pub struct PathDisplay<'a> {
path: &'a Path, path: &'a Path,