File tree Expand file tree Collapse file tree 3 files changed +3
-5
lines changed Expand file tree Collapse file tree 3 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,6 @@ mod theme;
24
24
mod toc;
25
25
26
26
mod prelude {
27
- pub use crate :: book_test:: BookTest ;
27
+ pub use crate :: book_test:: { BookTest , read_to_string } ;
28
28
pub use snapbox:: str;
29
29
}
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use std::path::Path;
7
7
8
8
fn read_book_index ( root : & Path ) -> serde_json:: Value {
9
9
let index = root. join ( "book/searchindex.js" ) ;
10
- let index = std :: fs :: read_to_string ( index) . unwrap ( ) ;
10
+ let index = read_to_string ( index) ;
11
11
let index =
12
12
index. trim_start_matches ( "window.search = Object.assign(window.search, JSON.parse('" ) ;
13
13
let index = index. trim_end_matches ( "'));" ) ;
Original file line number Diff line number Diff line change 1
1
//! Tests for table of contents (sidebar).
2
2
3
3
use crate :: prelude:: * ;
4
- use anyhow:: Context ;
5
4
use anyhow:: Result ;
6
5
use select:: document:: Document ;
7
6
use select:: predicate:: { Attr , Class , Name , Predicate } ;
8
- use std:: fs;
9
7
10
8
const TOC_TOP_LEVEL : & [ & str ] = & [
11
9
"1. With Readme" ,
@@ -50,7 +48,7 @@ fn toc_fallback_html() -> Result<Document> {
50
48
test. build ( ) ;
51
49
52
50
let toc_path = test. dir . join ( "book" ) . join ( "toc.html" ) ;
53
- let html = fs :: read_to_string ( toc_path) . with_context ( || "Unable to read index.html" ) ? ;
51
+ let html = read_to_string ( toc_path) ;
54
52
Ok ( Document :: from ( html. as_str ( ) ) )
55
53
}
56
54
You can’t perform that action at this time.
0 commit comments