9
9
//!
10
10
//! use syntax::edition::Edition;
11
11
//! use rustdoc::html::markdown::{IdMap, Markdown, ErrorCodes};
12
- //! use std::cell::RefCell;
13
12
//!
14
13
//! let s = "My *markdown* _text_";
15
14
//! 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);
18
16
//! let html = md.to_string();
19
17
//! // ... something using html
20
18
//! ```
@@ -51,7 +49,7 @@ pub struct Markdown<'a>(
51
49
/// A list of link replacements.
52
50
pub & ' a [ ( String , String ) ] ,
53
51
/// The current list of used header IDs.
54
- pub RefCell < & ' a mut IdMap > ,
52
+ pub & ' a mut IdMap ,
55
53
/// Whether to allow the use of explicit error codes in doctest lang strings.
56
54
pub ErrorCodes ,
57
55
/// Default edition to use when parsing doctests (to add a `fn main`).
@@ -61,15 +59,15 @@ pub struct Markdown<'a>(
61
59
/// A tuple struct like `Markdown` that renders the markdown with a table of contents.
62
60
pub struct MarkdownWithToc < ' a > (
63
61
pub & ' a str ,
64
- pub RefCell < & ' a mut IdMap > ,
62
+ pub & ' a mut IdMap ,
65
63
pub ErrorCodes ,
66
64
pub Edition ,
67
65
pub & ' a Option < Playground > ,
68
66
) ;
69
67
/// A tuple struct like `Markdown` that renders the markdown escaping HTML tags.
70
68
pub struct MarkdownHtml < ' a > (
71
69
pub & ' a str ,
72
- pub RefCell < & ' a mut IdMap > ,
70
+ pub & ' a mut IdMap ,
73
71
pub ErrorCodes ,
74
72
pub Edition ,
75
73
pub & ' a Option < Playground > ,
@@ -690,8 +688,7 @@ impl LangString {
690
688
691
689
impl Markdown < ' _ > {
692
690
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 ;
695
692
696
693
// This is actually common enough to special-case
697
694
if md. is_empty ( ) { return String :: new ( ) ; }
@@ -719,8 +716,7 @@ impl Markdown<'_> {
719
716
720
717
impl MarkdownWithToc < ' _ > {
721
718
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 ;
724
720
725
721
let p = Parser :: new_ext ( md, opts ( ) ) ;
726
722
@@ -741,8 +737,7 @@ impl MarkdownWithToc<'_> {
741
737
742
738
impl MarkdownHtml < ' _ > {
743
739
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 ;
746
741
747
742
// This is actually common enough to special-case
748
743
if md. is_empty ( ) { return String :: new ( ) ; }
0 commit comments