File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,6 +117,10 @@ impl DateDashHighlighter {
117117
118118impl Highlight for DateDashHighlighter {
119119 fn apply < ' a > ( & self , input : & ' a str ) -> Cow < ' a , str > {
120+ if !input. as_bytes ( ) . contains ( & b'-' ) && !input. as_bytes ( ) . contains ( & b'/' ) {
121+ return Cow :: Borrowed ( input) ;
122+ }
123+
120124 let mut it = self . regex . captures_iter ( input) . peekable ( ) ;
121125 if it. peek ( ) . is_none ( ) {
122126 return Cow :: Borrowed ( input) ;
Original file line number Diff line number Diff line change @@ -76,8 +76,7 @@ impl TimeHighlighter {
7676
7777impl Highlight for TimeHighlighter {
7878 fn apply < ' a > ( & self , input : & ' a str ) -> Cow < ' a , str > {
79- let mut it = self . regex . captures_iter ( input) . peekable ( ) ;
80- if it. peek ( ) . is_none ( ) {
79+ if !input. as_bytes ( ) . contains ( & b':' ) {
8180 return Cow :: Borrowed ( input) ;
8281 }
8382
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ impl UuidHighlighter {
3939
4040impl Highlight for UuidHighlighter {
4141 fn apply < ' a > ( & self , input : & ' a str ) -> Cow < ' a , str > {
42+ if !input. as_bytes ( ) . contains ( & b'-' ) {
43+ return Cow :: Borrowed ( input) ;
44+ }
45+
4246 self . regex . replace_all ( input, |caps : & Captures < ' _ > | {
4347 let matched = & caps[ 0 ] ;
4448 let mut buf = String :: with_capacity ( matched. len ( ) + 32 ) ;
You can’t perform that action at this time.
0 commit comments