File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -105,21 +105,19 @@ impl Anchorizer {
105105 static REJECTED_CHARS : Lazy < Regex > =
106106 Lazy :: new ( || Regex :: new ( r"[^\p{L}\p{M}\p{N}\p{Pc} -]" ) . unwrap ( ) ) ;
107107
108- let mut id = header;
109- id = id. to_lowercase ( ) ;
110- id = REJECTED_CHARS . replace_all ( & id, "" ) . to_string ( ) ;
111- id = id. replace ( ' ' , "-" ) ;
108+ let mut id = header. to_lowercase ( ) ;
109+ id = REJECTED_CHARS . replace_all ( & id, "" ) . replace ( ' ' , "-" ) ;
112110
113111 let mut uniq = 0 ;
114112 id = loop {
115113 let anchor = if uniq == 0 {
116- Cow :: from ( & * id)
114+ Cow :: from ( & id)
117115 } else {
118- Cow :: from ( format ! ( "{}-{}" , & id, uniq) )
116+ Cow :: from ( format ! ( "{}-{}" , id, uniq) )
119117 } ;
120118
121119 if !self . 0 . contains ( & * anchor) {
122- break anchor. to_string ( ) ;
120+ break anchor. into_owned ( ) ;
123121 }
124122
125123 uniq += 1 ;
You can’t perform that action at this time.
0 commit comments