@@ -84,7 +84,7 @@ fn check_directory(dir: &Path, bad: &mut bool) -> Result<(), Box<dyn Error>> {
8484}
8585
8686fn cmark_check ( path : & Path , bad : & mut bool , contents : & str ) -> Result < ( ) , Box < dyn Error > > {
87- use pulldown_cmark:: { BrokenLink , CodeBlockKind , Event , Options , Parser , Tag } ;
87+ use pulldown_cmark:: { CodeBlockKind , Event , Options , Parser , Tag } ;
8888
8989 macro_rules! cmark_error {
9090 ( $bad: expr, $path: expr, $range: expr, $( $arg: tt) * ) => {
@@ -96,20 +96,7 @@ fn cmark_check(path: &Path, bad: &mut bool, contents: &str) -> Result<(), Box<dy
9696 }
9797
9898 let options = Options :: all ( ) ;
99- // Can't use `bad` because it would get captured in closure.
100- let mut link_err = false ;
101- let mut cb = |link : BrokenLink < ' _ > | {
102- cmark_error ! (
103- & mut link_err,
104- path,
105- link. span,
106- "broken {:?} link (reference `{}`)" ,
107- link. link_type,
108- link. reference
109- ) ;
110- None
111- } ;
112- let parser = Parser :: new_with_broken_link_callback ( contents, options, Some ( & mut cb) ) ;
99+ let parser = Parser :: new_ext ( contents, options) ;
113100
114101 for ( event, range) in parser. into_offset_iter ( ) {
115102 match event {
@@ -135,6 +122,5 @@ fn cmark_check(path: &Path, bad: &mut bool, contents: &str) -> Result<(), Box<dy
135122 _ => { }
136123 }
137124 }
138- * bad |= link_err;
139125 Ok ( ( ) )
140126}
0 commit comments