diff --git a/rust/hg-core/src/revlog/path_encode.rs b/rust/hg-core/src/revlog/path_encode.rs --- a/rust/hg-core/src/revlog/path_encode.rs +++ b/rust/hg-core/src/revlog/path_encode.rs @@ -47,15 +47,15 @@ fn inset(bitset: &[u32; 8], c: u8) -> bo const MAXENCODE: usize = 4096 * 4; -struct DestArr { - buf: [u8; MAXENCODE], +struct DestArr { + buf: [u8; N], pub len: usize, } -impl DestArr { +impl DestArr { pub fn create() -> Self { DestArr { - buf: [0; MAXENCODE], + buf: [0; N], len: 0, } } @@ -65,7 +65,7 @@ impl DestArr { } } -impl Sink for DestArr { +impl Sink for DestArr { fn write_byte(&mut self, c: u8) { self.buf[self.len] = c; self.len += 1; @@ -600,9 +600,9 @@ fn hash_mangle(src: &[u8], sha: &[u8]) - } fn hash_encode(src: &[u8]) -> Vec { - let mut dired = DestArr::create(); - let mut lowered = DestArr::create(); - let mut auxed = DestArr::create(); + let mut dired: DestArr = DestArr::create(); + let mut lowered: DestArr = DestArr::create(); + let mut auxed: DestArr = DestArr::create(); let baselen = (src.len() - 5) * 3; if baselen >= MAXENCODE { panic!("path_encode::hash_encore: string too long: {}", baselen)