aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2026-03-03 18:38:23 +0300
committerA Farzat <a@farzat.xyz>2026-03-03 18:38:23 +0300
commitd34403eddc75188b1657a7076442b48da76bb727 (patch)
tree6deb24eb643cf72a8b2cf12c849677651f9f1f26 /src
parentffd97108068a0dde153dbb64aa4493fa5945a5d3 (diff)
downloadoreilly-epub-d34403eddc75188b1657a7076442b48da76bb727.tar.gz
oreilly-epub-d34403eddc75188b1657a7076442b48da76bb727.zip
Remove the sanity checks
They are no longer needed.
Diffstat (limited to 'src')
-rw-r--r--src/main.rs22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/main.rs b/src/main.rs
index 002f669..3c5956e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,13 +2,12 @@ mod epub;
mod http_client;
mod models;
-use std::collections::HashMap;
use std::path::Path;
use crate::epub::{create_epub_archive, download_all_files};
use crate::http_client::build_authenticated_client;
use crate::models::{Chapter, EpubResponse, FileEntry, Paginated, SpineItem, TocNode};
-use anyhow::{Context, Result, ensure};
+use anyhow::{Context, Result};
use clap::Parser;
use reqwest::Client;
@@ -119,24 +118,5 @@ async fn main() -> Result<()> {
let epub_path = Path::new(&epub_path);
create_epub_archive(dest_root, &epub_path, &file_entries)?;
- // Sanity check: Every entry in spine exists in chapters.
- let chapters: HashMap<String, Chapter> =
- chapters.into_iter().map(|c| (c.ourn.clone(), c)).collect();
- for s in spine_items {
- ensure!(chapters.contains_key(&s.ourn), "{} not in chapters", s.ourn);
- }
- // Sanity check: Every node in the ToC references a file entry.
- let file_entries: HashMap<String, FileEntry> = file_entries
- .into_iter()
- .map(|f| (f.ourn.clone(), f))
- .collect();
- for i in toc_vec {
- ensure!(
- file_entries.contains_key(&i.ourn),
- "{} not in files",
- i.ourn
- );
- }
-
Ok(())
}