Skip to content

Commit

Permalink
Apply some clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
msuchane committed Jun 27, 2024
1 parent 808b9cf commit 933351c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl Document {
// Make sure that the output directory exists.
fs::create_dir_all(generated_dir)?;

Self::write_chapters(modules, summary, generated_dir)?;
Self::write_chapters(modules, generated_dir)?;

// Save the appendix.
let summary_file = generated_dir.join("ref_list-of-tickets-by-component.adoc");
Expand All @@ -200,9 +200,9 @@ impl Document {

/// Write the top-level chapters. These need special treatment so that they get created even
/// if they're completely empty, in order not to break include directives.
fn write_chapters(modules: &[Module], summary: &str, generated_dir: &Path) -> Result<()> {
fn write_chapters(modules: &[Module], generated_dir: &Path) -> Result<()> {
for chapter in modules {
let out_file = generated_dir.join(&chapter.file_name());
let out_file = generated_dir.join(chapter.file_name());
log::debug!("Writing file: {}", out_file.display());

let text = match chapter {
Expand All @@ -219,7 +219,7 @@ impl Document {
} = chapter
{
if let Some(included_modules) = included_modules {
Self::write_modules(included_modules, summary, generated_dir)?;
Self::write_modules(included_modules, generated_dir)?;
}
}
}
Expand All @@ -228,7 +228,7 @@ impl Document {
}

/// Write modules for all sub-sections recursively. Only create files if they have some content.
fn write_modules(modules: &[Module], summary: &str, generated_dir: &Path) -> Result<()> {
fn write_modules(modules: &[Module], generated_dir: &Path) -> Result<()> {
for module in modules {
if let Module::WithContent {
file_name,
Expand All @@ -243,7 +243,7 @@ impl Document {
// If the currently processed module is an assembly,
// recursively descend into the assembly and write its included modules.
if let Some(included_modules) = included_modules {
Self::write_modules(included_modules, summary, generated_dir)?;
Self::write_modules(included_modules, generated_dir)?;
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/templating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ impl Module {
/// The module's file name.
pub fn file_name(&self) -> &str {
match self {
Self::WithContent { file_name, .. } => file_name,
Self::Blank { file_name, .. } => file_name,
Self::Blank { file_name, .. } | Self::WithContent { file_name, .. } => file_name,
}
}
/// Return `true` if the module is of the `WithContent` variant.
Expand Down Expand Up @@ -259,7 +258,7 @@ impl config::Section {
ticket_stats,
)
})
.filter(|module| module.has_content())
.filter(Module::has_content)
.collect();
// If the assembly receives no modules, because all its modules are empty, return Blank.
if included_modules.is_empty() {
Expand Down

0 comments on commit 933351c

Please sign in to comment.