99//!
1010//! use syntax::edition::Edition;
1111//! use rustdoc::html::markdown::{IdMap, Markdown, ErrorCodes};
12- //! use std::cell::RefCell;
1312//!
1413//! let s = "My *markdown* _text_";
1514//! let mut id_map = IdMap::new();
16- //! let md = Markdown(s, &[], RefCell::new(&mut id_map),
17- //! ErrorCodes::Yes, Edition::Edition2015, None);
15+ //! let md = Markdown(s, &[], &mut id_map, ErrorCodes::Yes, Edition::Edition2015, &None);
1816//! let html = md.to_string();
1917//! // ... something using html
2018//! ```
@@ -51,7 +49,7 @@ pub struct Markdown<'a>(
5149 /// A list of link replacements.
5250 pub & ' a [ ( String , String ) ] ,
5351 /// The current list of used header IDs.
54- pub RefCell < & ' a mut IdMap > ,
52+ pub & ' a mut IdMap ,
5553 /// Whether to allow the use of explicit error codes in doctest lang strings.
5654 pub ErrorCodes ,
5755 /// Default edition to use when parsing doctests (to add a `fn main`).
@@ -61,15 +59,15 @@ pub struct Markdown<'a>(
6159/// A tuple struct like `Markdown` that renders the markdown with a table of contents.
6260pub struct MarkdownWithToc < ' a > (
6361 pub & ' a str ,
64- pub RefCell < & ' a mut IdMap > ,
62+ pub & ' a mut IdMap ,
6563 pub ErrorCodes ,
6664 pub Edition ,
6765 pub & ' a Option < Playground > ,
6866) ;
6967/// A tuple struct like `Markdown` that renders the markdown escaping HTML tags.
7068pub struct MarkdownHtml < ' a > (
7169 pub & ' a str ,
72- pub RefCell < & ' a mut IdMap > ,
70+ pub & ' a mut IdMap ,
7371 pub ErrorCodes ,
7472 pub Edition ,
7573 pub & ' a Option < Playground > ,
@@ -690,8 +688,7 @@ impl LangString {
690688
691689impl Markdown < ' _ > {
692690 pub fn to_string ( self ) -> String {
693- let Markdown ( md, links, ids, codes, edition, playground) = self ;
694- let mut ids = ids. borrow_mut ( ) ;
691+ let Markdown ( md, links, mut ids, codes, edition, playground) = self ;
695692
696693 // This is actually common enough to special-case
697694 if md. is_empty ( ) { return String :: new ( ) ; }
@@ -719,8 +716,7 @@ impl Markdown<'_> {
719716
720717impl MarkdownWithToc < ' _ > {
721718 pub fn to_string ( self ) -> String {
722- let MarkdownWithToc ( md, ref ids, codes, edition, playground) = self ;
723- let mut ids = ids. borrow_mut ( ) ;
719+ let MarkdownWithToc ( md, mut ids, codes, edition, playground) = self ;
724720
725721 let p = Parser :: new_ext ( md, opts ( ) ) ;
726722
@@ -741,8 +737,7 @@ impl MarkdownWithToc<'_> {
741737
742738impl MarkdownHtml < ' _ > {
743739 pub fn to_string ( self ) -> String {
744- let MarkdownHtml ( md, ref ids, codes, edition, playground) = self ;
745- let mut ids = ids. borrow_mut ( ) ;
740+ let MarkdownHtml ( md, mut ids, codes, edition, playground) = self ;
746741
747742 // This is actually common enough to special-case
748743 if md. is_empty ( ) { return String :: new ( ) ; }
0 commit comments