File tree Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -63,22 +63,12 @@ impl<'a> Attribute<'a> {
6363 ///
6464 /// [`encoding`]: ../../index.html#encoding
6565 #[ cfg( any( doc, not( feature = "encoding" ) ) ) ]
66+ #[ inline]
6667 pub fn unescape_value_with < ' entity > (
6768 & self ,
6869 resolve_entity : impl FnMut ( & str ) -> Option < & ' entity str > ,
6970 ) -> XmlResult < Cow < ' a , str > > {
70- // from_utf8 should never fail because content is always UTF-8 encoded
71- let decoded = match & self . value {
72- Cow :: Borrowed ( bytes) => Cow :: Borrowed ( std:: str:: from_utf8 ( bytes) ?) ,
73- // Convert to owned, because otherwise Cow will be bound with wrong lifetime
74- Cow :: Owned ( bytes) => Cow :: Owned ( std:: str:: from_utf8 ( bytes) ?. to_string ( ) ) ,
75- } ;
76-
77- match unescape_with ( & decoded, resolve_entity) ? {
78- // Because result is borrowed, no replacements was done and we can use original string
79- Cow :: Borrowed ( _) => Ok ( decoded) ,
80- Cow :: Owned ( s) => Ok ( s. into ( ) ) ,
81- }
71+ self . decode_and_unescape_value_with ( Decoder :: utf8 ( ) , resolve_entity)
8272 }
8373
8474 /// Decodes then unescapes the value.
You can’t perform that action at this time.
0 commit comments