@@ -142,14 +142,14 @@ impl ChunkedEncoder {
142142 // CRLF, then the content, then another CRLF. Calculate how many bytes
143143 // each part should be.
144144 let buf_len = buf. len ( ) . checked_sub ( self . bytes_written ) . unwrap_or ( 0 ) ;
145- let amt = src. len ( ) . min ( buf_len) ;
145+ let msg_len = src. len ( ) . min ( buf_len) ;
146146 // Calculate the max char count encoding the `len_prefix` statement
147147 // as hex would take. This is done by rounding up `log16(amt + 1)`.
148- let hex_len = ( ( amt + 1 ) as f64 ) . log ( 16.0 ) . ceil ( ) as usize ;
148+ let hex_len = ( ( msg_len + 1 ) as f64 ) . log ( 16.0 ) . ceil ( ) as usize ;
149149 let framing_len = hex_len + CRLF_LEN * 2 ;
150150 let buf_upper = buf_len. checked_sub ( framing_len) . unwrap_or ( 0 ) ;
151- let amt = amt . min ( buf_upper) ;
152- let len_prefix = format ! ( "{:X}" , amt ) . into_bytes ( ) ;
151+ let msg_len = msg_len . min ( buf_upper) ;
152+ let len_prefix = format ! ( "{:X}" , msg_len ) . into_bytes ( ) ;
153153
154154 // Request a new buf if the current buf is too small to write any data
155155 // into. Empty frames should only be sent to mark the end of a stream.
@@ -168,10 +168,10 @@ impl ChunkedEncoder {
168168
169169 // Copy the bytes from our source into the output buffer.
170170 let lower = self . bytes_written ;
171- let upper = self . bytes_written + amt ;
172- buf[ lower..upper] . copy_from_slice ( & src[ 0 ..amt ] ) ;
173- Pin :: new ( & mut res) . consume ( amt ) ;
174- self . bytes_written += amt ;
171+ let upper = self . bytes_written + msg_len ;
172+ buf[ lower..upper] . copy_from_slice ( & src[ 0 ..msg_len ] ) ;
173+ Pin :: new ( & mut res) . consume ( msg_len ) ;
174+ self . bytes_written += msg_len ;
175175
176176 // Finalize the chunk with a closing CRLF.
177177 let idx = self . bytes_written ;
0 commit comments