@@ -354,26 +354,28 @@ impl ValueDecoder {
354354
355355 fn read_geometry < R : AsRef < [ u8 ] > > ( & self , reader : & mut Cursor < R > ) -> Result < Value > {
356356 let mut buf = Vec :: new ( ) ;
357- if reader. read_quoted_text ( & mut buf, b'"' ) . is_err ( ) {
358- if let Ok ( val) = self . read_json ( reader) {
359- return Ok ( Value :: Variant ( val) ) ;
360- }
361- reader. read_quoted_text ( & mut buf, b'\'' ) ?;
357+ if reader. read_quoted_text ( & mut buf, b'"' ) . is_ok ( )
358+ || reader. read_quoted_text ( & mut buf, b'\'' ) . is_ok ( )
359+ {
360+ Ok ( Value :: Geometry ( unsafe { String :: from_utf8_unchecked ( buf) } ) )
361+ } else {
362+ let val = self . read_json ( reader) ?;
363+ Ok ( Value :: Geometry ( val) )
362364 }
363- Ok ( Value :: Geometry ( unsafe { String :: from_utf8_unchecked ( buf) } ) )
364365 }
365366
366367 fn read_geography < R : AsRef < [ u8 ] > > ( & self , reader : & mut Cursor < R > ) -> Result < Value > {
367368 let mut buf = Vec :: new ( ) ;
368- if reader. read_quoted_text ( & mut buf, b'"' ) . is_err ( ) {
369- if let Ok ( val) = self . read_json ( reader) {
370- return Ok ( Value :: Variant ( val) ) ;
371- }
372- reader. read_quoted_text ( & mut buf, b'\'' ) ?;
369+ if reader. read_quoted_text ( & mut buf, b'"' ) . is_ok ( )
370+ || reader. read_quoted_text ( & mut buf, b'\'' ) . is_ok ( )
371+ {
372+ Ok ( Value :: Geography ( unsafe {
373+ String :: from_utf8_unchecked ( buf)
374+ } ) )
375+ } else {
376+ let val = self . read_json ( reader) ?;
377+ Ok ( Value :: Geography ( val) )
373378 }
374- Ok ( Value :: Geography ( unsafe {
375- String :: from_utf8_unchecked ( buf)
376- } ) )
377379 }
378380
379381 fn read_nullable < R : AsRef < [ u8 ] > > (
0 commit comments