From fea273e172b10c1ff0851b0fd835a65b496a04d6 Mon Sep 17 00:00:00 2001 From: Coil Date: Sat, 30 Mar 2024 10:43:31 +0100 Subject: [PATCH] URLs should not be pathbufs --- src/cmd/shelf.rs | 7 +++---- src/config.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cmd/shelf.rs b/src/cmd/shelf.rs index bfaeac9f43..4716c1f7aa 100644 --- a/src/cmd/shelf.rs +++ b/src/cmd/shelf.rs @@ -68,7 +68,7 @@ fn update_index( Ok(()) } -fn process_book(path: &str, books_dir: &PathBuf, shelf_url: &PathBuf) -> Result { +fn process_book(path: &str, books_dir: &PathBuf, shelf_url: &str) -> Result { let book_dir = path.try_resolve()?; let book_dir = std::fs::canonicalize(book_dir)?; let mut book = MDBook::load(book_dir)?; @@ -112,9 +112,8 @@ pub fn execute(_args: &ArgMatches) -> Result<()> { } else { "".to_owned() }; - let shelf_url = PathBuf::from(format!( - "{shelf_url_prefix}/{shelf_book_dir}/{shelf_build_dir}/{INDEX_HTML_FILE}" - )); + let shelf_url = + format!("{shelf_url_prefix}/{shelf_book_dir}/{shelf_build_dir}/{INDEX_HTML_FILE}"); let mut index_file_name = shelf_book.source_dir(); index_file_name.push(INDEX_MD_FILE); diff --git a/src/config.rs b/src/config.rs index dbf67d2da1..c923c315aa 100644 --- a/src/config.rs +++ b/src/config.rs @@ -416,7 +416,7 @@ pub struct BookConfig { pub text_direction: Option, /// Indicates if the book is part of a bookshelf /// and how to return to the index of the shelf if so - pub shelf_url: Option, + pub shelf_url: Option, } impl Default for BookConfig {