@@ -115,10 +115,7 @@ impl Clone for SmolStr {
115115impl Default for SmolStr {
116116 #[ inline( always) ]
117117 fn default ( ) -> SmolStr {
118- SmolStr ( Repr :: Inline {
119- len : InlineSize :: _V0,
120- buf : [ 0 ; INLINE_CAP ] ,
121- } )
118+ SmolStr ( Repr :: Inline { len : InlineSize :: _V0, buf : [ 0 ; INLINE_CAP ] } )
122119 }
123120}
124121
@@ -216,13 +213,13 @@ impl hash::Hash for SmolStr {
216213}
217214
218215impl fmt:: Debug for SmolStr {
219- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
216+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
220217 fmt:: Debug :: fmt ( self . as_str ( ) , f)
221218 }
222219}
223220
224221impl fmt:: Display for SmolStr {
225- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
222+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
226223 fmt:: Display :: fmt ( self . as_str ( ) , f)
227224 }
228225}
@@ -245,11 +242,8 @@ fn from_buf_and_chars(
245242) -> SmolStr {
246243 let min_size = iter. size_hint ( ) . 0 + buf_len;
247244 if min_size > INLINE_CAP {
248- let heap: String = core:: str:: from_utf8 ( & buf[ ..buf_len] )
249- . unwrap ( )
250- . chars ( )
251- . chain ( iter)
252- . collect ( ) ;
245+ let heap: String =
246+ core:: str:: from_utf8 ( & buf[ ..buf_len] ) . unwrap ( ) . chars ( ) . chain ( iter) . collect ( ) ;
253247 if heap. len ( ) <= INLINE_CAP {
254248 // size hint lied
255249 return SmolStr :: new_inline ( & heap) ;
@@ -490,10 +484,7 @@ impl InlineSize {
490484
491485#[ derive( Clone , Debug ) ]
492486enum Repr {
493- Inline {
494- len : InlineSize ,
495- buf : [ u8 ; INLINE_CAP ] ,
496- } ,
487+ Inline { len : InlineSize , buf : [ u8 ; INLINE_CAP ] } ,
497488 Static ( & ' static str ) ,
498489 Heap ( Arc < str > ) ,
499490}
@@ -521,10 +512,8 @@ impl Repr {
521512 if len <= N_NEWLINES + N_SPACES {
522513 let bytes = text. as_bytes ( ) ;
523514 let possible_newline_count = cmp:: min ( len, N_NEWLINES ) ;
524- let newlines = bytes[ ..possible_newline_count]
525- . iter ( )
526- . take_while ( |& & b| b == b'\n' )
527- . count ( ) ;
515+ let newlines =
516+ bytes[ ..possible_newline_count] . iter ( ) . take_while ( |& & b| b == b'\n' ) . count ( ) ;
528517 let possible_space_count = len - newlines;
529518 if possible_space_count <= N_SPACES && bytes[ newlines..] . iter ( ) . all ( |& b| b == b' ' ) {
530519 let spaces = possible_space_count;
@@ -576,16 +565,9 @@ impl Repr {
576565 match ( self , other) {
577566 ( Self :: Heap ( l0) , Self :: Heap ( r0) ) => Arc :: ptr_eq ( l0, r0) ,
578567 ( Self :: Static ( l0) , Self :: Static ( r0) ) => core:: ptr:: eq ( l0, r0) ,
579- (
580- Self :: Inline {
581- len : l_len,
582- buf : l_buf,
583- } ,
584- Self :: Inline {
585- len : r_len,
586- buf : r_buf,
587- } ,
588- ) => l_len == r_len && l_buf == r_buf,
568+ ( Self :: Inline { len : l_len, buf : l_buf } , Self :: Inline { len : r_len, buf : r_buf } ) => {
569+ l_len == r_len && l_buf == r_buf
570+ }
589571 _ => false ,
590572 }
591573 }
@@ -649,11 +631,7 @@ impl StrExt for str {
649631 let len = self . len ( ) ;
650632 if len <= INLINE_CAP {
651633 let ( buf, rest) = inline_convert_while_ascii ( self , u8:: to_ascii_lowercase) ;
652- from_buf_and_chars (
653- buf,
654- len - rest. len ( ) ,
655- rest. chars ( ) . flat_map ( |c| c. to_lowercase ( ) ) ,
656- )
634+ from_buf_and_chars ( buf, len - rest. len ( ) , rest. chars ( ) . flat_map ( |c| c. to_lowercase ( ) ) )
657635 } else {
658636 self . to_lowercase ( ) . into ( )
659637 }
@@ -664,11 +642,7 @@ impl StrExt for str {
664642 let len = self . len ( ) ;
665643 if len <= INLINE_CAP {
666644 let ( buf, rest) = inline_convert_while_ascii ( self , u8:: to_ascii_uppercase) ;
667- from_buf_and_chars (
668- buf,
669- len - rest. len ( ) ,
670- rest. chars ( ) . flat_map ( |c| c. to_uppercase ( ) ) ,
671- )
645+ from_buf_and_chars ( buf, len - rest. len ( ) , rest. chars ( ) . flat_map ( |c| c. to_uppercase ( ) ) )
672646 } else {
673647 self . to_uppercase ( ) . into ( )
674648 }
@@ -878,21 +852,15 @@ enum SmolStrBuilderRepr {
878852impl Default for SmolStrBuilderRepr {
879853 #[ inline]
880854 fn default ( ) -> Self {
881- SmolStrBuilderRepr :: Inline {
882- buf : [ 0 ; INLINE_CAP ] ,
883- len : 0 ,
884- }
855+ SmolStrBuilderRepr :: Inline { buf : [ 0 ; INLINE_CAP ] , len : 0 }
885856 }
886857}
887858
888859impl SmolStrBuilder {
889860 /// Creates a new empty [`SmolStrBuilder`].
890861 #[ must_use]
891862 pub const fn new ( ) -> Self {
892- Self ( SmolStrBuilderRepr :: Inline {
893- buf : [ 0 ; INLINE_CAP ] ,
894- len : 0 ,
895- } )
863+ Self ( SmolStrBuilderRepr :: Inline { buf : [ 0 ; INLINE_CAP ] , len : 0 } )
896864 }
897865
898866 /// Builds a [`SmolStr`] from `self`.
0 commit comments