@@ -142,14 +142,14 @@ impl ChunkedEncoder {
142
142
// CRLF, then the content, then another CRLF. Calculate how many bytes
143
143
// each part should be.
144
144
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) ;
146
146
// Calculate the max char count encoding the `len_prefix` statement
147
147
// 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 ;
149
149
let framing_len = hex_len + CRLF_LEN * 2 ;
150
150
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 ( ) ;
153
153
154
154
// Request a new buf if the current buf is too small to write any data
155
155
// into. Empty frames should only be sent to mark the end of a stream.
@@ -168,10 +168,10 @@ impl ChunkedEncoder {
168
168
169
169
// Copy the bytes from our source into the output buffer.
170
170
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 ;
175
175
176
176
// Finalize the chunk with a closing CRLF.
177
177
let idx = self . bytes_written ;
0 commit comments