@@ -24,7 +24,7 @@ pub mod write;
2424pub struct Editor < ' a > {
2525 /// A way to lookup trees.
2626 find : & ' a dyn crate :: FindExt ,
27- /// The kind of hashes to produce
27+ /// The kind of hashes to produce>
2828 object_hash : gix_hash:: Kind ,
2929 /// All trees we currently hold in memory. Each of these may change while adding and removing entries.
3030 /// null-object-ids mark tree-entries whose value we don't know yet, they are placeholders that will be
@@ -46,7 +46,7 @@ pub struct Editor<'a> {
4646#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
4747pub struct EntryMode {
4848 // Represents the value read from Git, except that "040000" is represented with 0o140000 but
49- // "40000" is represented with 0o40000
49+ // "40000" is represented with 0o40000.
5050 internal : u16 ,
5151}
5252
@@ -62,10 +62,10 @@ impl TryFrom<u32> for tree::EntryMode {
6262}
6363
6464impl EntryMode {
65- /// Expose the value as a u16 (lossy, unlike the internal representation that is hidden)
65+ /// Expose the value as u16 (lossy, unlike the internal representation that is hidden).
6666 pub const fn value ( self ) -> u16 {
6767 // Demangle the hack: In the case where the second leftmost octet is 4 (Tree), the leftmost bit is
68- // there to represent whether the bytes representation should have 5 or 6 octets
68+ // there to represent whether the bytes representation should have 5 or 6 octets.
6969 if self . internal & IFMT == 0o140000 {
7070 0o040000
7171 } else {
@@ -85,7 +85,7 @@ impl EntryMode {
8585 let digit = ( self . internal & oct_mask) >> bit_pos;
8686 * backing_octet = b'0' + digit as u8 ;
8787 }
88- // Hack: `0o140000` represents `"040000"`, `0o40000` represents `"40000"`
88+ // Hack: `0o140000` represents `"040000"`, `0o40000` represents `"40000"`.
8989 if backing[ 1 ] == b'4' {
9090 if backing[ 0 ] == b'1' {
9191 backing[ 0 ] = b'0' ;
@@ -101,43 +101,43 @@ impl EntryMode {
101101 }
102102
103103 /// Construct an EntryMode from bytes represented as in the git internal format
104- /// Return the mode and the remainder of the bytes
104+ /// Return the mode and the remainder of the bytes.
105105 pub ( crate ) fn extract_from_bytes ( i : & [ u8 ] ) -> Option < ( Self , & ' _ [ u8 ] ) > {
106106 let mut mode = 0 ;
107107 let mut idx = 0 ;
108108 let mut space_pos = 0 ;
109109 if i. is_empty ( ) {
110110 return None ;
111111 }
112- // const fn, this is why we can't have nice things (like `.iter().any()`)
112+ // const fn, this is why we can't have nice things (like `.iter().any()`).
113113 while idx < i. len ( ) {
114114 let b = i[ idx] ;
115115 // Delimiter, return what we got
116116 if b == b' ' {
117117 space_pos = idx;
118118 break ;
119119 }
120- // Not a pure octal input
121- // Performance matters here, so `!(b'0'..=b'7').contains(&b)` won't do
120+ // Not a pure octal input.
121+ // Performance matters here, so `!(b'0'..=b'7').contains(&b)` won't do.
122122 #[ allow( clippy:: manual_range_contains) ]
123123 if b < b'0' || b > b'7' {
124124 return None ;
125125 }
126- // More than 6 octal digits we must have hit the delimiter or the input was malformed
126+ // More than 6 octal digits we must have hit the delimiter or the input was malformed.
127127 if idx > 6 {
128128 return None ;
129129 }
130130 mode = ( mode << 3 ) + ( b - b'0' ) as u16 ;
131131 idx += 1 ;
132132 }
133- // Hack: `0o140000` represents `"040000"`, `0o40000` represents `"40000"`
133+ // Hack: `0o140000` represents `"040000"`, `0o40000` represents `"40000"`.
134134 if mode == 0o040000 && i[ 0 ] == b'0' {
135135 mode += 0o100000 ;
136136 }
137137 Some ( ( Self { internal : mode } , & i[ ( space_pos + 1 ) ..] ) )
138138 }
139139
140- /// Construct an EntryMode from bytes represented as in the git internal format
140+ /// Construct an EntryMode from bytes represented as in the git internal format.
141141 pub fn from_bytes ( i : & [ u8 ] ) -> Option < Self > {
142142 Self :: extract_from_bytes ( i) . map ( |( mode, _rest) | mode)
143143 }
@@ -158,7 +158,7 @@ impl std::fmt::Octal for EntryMode {
158158/// A discretized version of ideal and valid values for entry modes.
159159///
160160/// Note that even though it can represent every valid [mode](EntryMode), it might
161- /// loose information due to that as well.
161+ /// lose information due to that as well.
162162#[ derive( Clone , Copy , PartialEq , Eq , Debug , Ord , PartialOrd , Hash ) ]
163163#[ repr( u16 ) ]
164164#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
0 commit comments