Skip to content

Commit b0ac40a

Browse files
committed
sha2 -- introduce locals to clarify which subportions are being borrowed
1 parent 8dff89c commit b0ac40a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/librustc/util/sha2.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,18 +453,20 @@ impl Engine256 {
453453
assert!(!self.finished)
454454
// Assumes that input.len() can be converted to u64 without overflow
455455
self.length_bits = add_bytes_to_bits(self.length_bits, input.len() as u64);
456-
self.buffer.input(input, |input: &[u8]| { self.state.process_block(input) });
456+
let self_state = &mut self.state;
457+
self.buffer.input(input, |input: &[u8]| { self_state.process_block(input) });
457458
}
458459

459460
fn finish(&mut self) {
460461
if self.finished {
461462
return;
462463
}
463464

464-
self.buffer.standard_padding(8, |input: &[u8]| { self.state.process_block(input) });
465+
let self_state = &mut self.state;
466+
self.buffer.standard_padding(8, |input: &[u8]| { self_state.process_block(input) });
465467
write_u32_be(self.buffer.next(4), (self.length_bits >> 32) as u32 );
466468
write_u32_be(self.buffer.next(4), self.length_bits as u32);
467-
self.state.process_block(self.buffer.full_buffer());
469+
self_state.process_block(self.buffer.full_buffer());
468470

469471
self.finished = true;
470472
}

0 commit comments

Comments
 (0)