File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 11#![ deny( rust_2018_idioms, unused_lifetimes) ]
22
3+ use anyhow:: Result ;
34use mdbook:: book:: { Book , Chapter } ;
45use mdbook:: errors:: Error ;
56use mdbook:: preprocess:: { CmdPreprocessor , Preprocessor , PreprocessorContext } ;
@@ -20,7 +21,8 @@ static ADMONITION_RE: Lazy<Regex> = Lazy::new(|| {
2021 Regex :: new ( r"(?m)^ *> \[!(?<admon>[^]]+)\]\n(?<blockquote>(?: *>.*\n)+)" ) . unwrap ( )
2122} ) ;
2223
23- pub fn handle_preprocessing ( pre : & dyn Preprocessor ) -> Result < ( ) , Error > {
24+ pub fn handle_preprocessing ( ) -> Result < ( ) , Error > {
25+ let pre = Spec :: new ( ) ?;
2426 let ( ctx, book) = CmdPreprocessor :: parse_input ( io:: stdin ( ) ) ?;
2527
2628 let book_version = Version :: parse ( & ctx. mdbook_version ) ?;
@@ -49,10 +51,9 @@ pub struct Spec {
4951}
5052
5153impl Spec {
52- pub fn new ( ) -> Spec {
53- Spec {
54- deny_warnings : std:: env:: var ( "SPEC_DENY_WARNINGS" ) . as_deref ( ) == Ok ( "1" ) ,
55- }
54+ fn new ( ) -> Result < Spec > {
55+ let deny_warnings = std:: env:: var ( "SPEC_DENY_WARNINGS" ) . as_deref ( ) == Ok ( "1" ) ;
56+ Ok ( Spec { deny_warnings } )
5657 }
5758
5859 /// Generates link references to all rules on all pages, so you can easily
Original file line number Diff line number Diff line change @@ -12,9 +12,7 @@ fn main() {
1212 None => { }
1313 }
1414
15- let preprocessor = mdbook_spec:: Spec :: new ( ) ;
16-
17- if let Err ( e) = mdbook_spec:: handle_preprocessing ( & preprocessor) {
15+ if let Err ( e) = mdbook_spec:: handle_preprocessing ( ) {
1816 eprintln ! ( "{}" , e) ;
1917 std:: process:: exit ( 1 ) ;
2018 }
You can’t perform that action at this time.
0 commit comments