@@ -103,8 +103,8 @@ pub fn parse_configurations_from_autorest_config_file(
103103mod literate_config {
104104 use super :: * ;
105105 use comrak:: {
106- nodes:: { AstNode , NodeCode , NodeCodeBlock , NodeValue } ,
107- parse_document, Arena , ComrakOptions ,
106+ nodes:: { AstNode , NodeCode , NodeValue } ,
107+ parse_document, Arena , Options ,
108108 } ;
109109
110110 // Per the [Literage Configuration format](https://azure.github.io/autorest/user/literate-file-formats/configuration.html),
@@ -121,7 +121,7 @@ mod literate_config {
121121 /// [Literate Configuration](http://azure.github.io/autorest/user/literate-file-formats/configuration.html) [CommonMark](https://commonmark.org/) file.
122122 pub ( crate ) fn parse_configuration ( cmark_content : & str ) -> Result < Configuration > {
123123 let arena = Arena :: new ( ) ;
124- let root = parse_document ( & arena, cmark_content, & ComrakOptions :: default ( ) ) ;
124+ let root = parse_document ( & arena, cmark_content, & Options :: default ( ) ) ;
125125
126126 // Get the AST node corresponding with "## Configuration".
127127 let configuration_heading_node =
@@ -186,8 +186,11 @@ mod literate_config {
186186 // from https://github.com/kivikakk/comrak/blob/main/examples/headers.rs
187187 fn collect_text < ' a > ( node : & ' a AstNode < ' a > , output : & mut String ) {
188188 match node. data . borrow ( ) . value {
189- NodeValue :: Text ( ref literal) | NodeValue :: Code ( NodeCode { ref literal, .. } ) => {
190- output. push_str ( literal)
189+ NodeValue :: Text ( ref literal) => {
190+ output. push_str ( literal. as_ref ( ) )
191+ }
192+ NodeValue :: Code ( NodeCode { ref literal, .. } ) => {
193+ output. push_str ( literal. as_ref ( ) )
191194 }
192195 NodeValue :: LineBreak | NodeValue :: SoftBreak => output. push ( ' ' ) ,
193196 _ => {
@@ -250,18 +253,12 @@ mod literate_config {
250253 )
251254 } ) ?;
252255 loop {
253- if let NodeValue :: CodeBlock ( NodeCodeBlock {
254- info,
255- literal,
256- fenced,
257- ..
258- } ) = & current_node. data . borrow ( ) . value
259- {
260- if !fenced {
256+ if let NodeValue :: CodeBlock ( ref code_block) = & current_node. data . borrow ( ) . value {
257+ if !code_block. fenced {
261258 continue ;
262259 }
263- if info. trim_start ( ) . to_lowercase ( ) . starts_with ( "yaml" ) {
264- return Ok ( Some ( literal. to_owned ( ) ) ) ;
260+ if code_block . info . trim_start ( ) . to_lowercase ( ) . starts_with ( "yaml" ) {
261+ return Ok ( Some ( code_block . literal . to_string ( ) ) ) ;
265262 }
266263 }
267264 current_node = current_node. next_sibling ( ) . ok_or_else ( || {
0 commit comments