diff --git a/lib/src/default_index/mutable.rs b/lib/src/default_index/mutable.rs index 69535e78f..7c0adf3ce 100644 --- a/lib/src/default_index/mutable.rs +++ b/lib/src/default_index/mutable.rs @@ -174,7 +174,7 @@ impl MutableIndexSegment { if let Some(parent_file) = &self.parent_file { buf.write_u32::(parent_file.name().len() as u32) .unwrap(); - buf.write_all(parent_file.name().as_bytes()).unwrap(); + buf.extend_from_slice(parent_file.name().as_bytes()); } else { buf.write_u32::(0).unwrap(); } @@ -212,14 +212,14 @@ impl MutableIndexSegment { buf.write_u32::(parent_overflow_pos).unwrap(); assert_eq!(entry.change_id.as_bytes().len(), self.change_id_length); - buf.write_all(entry.change_id.as_bytes()).unwrap(); + buf.extend_from_slice(entry.change_id.as_bytes()); assert_eq!(entry.commit_id.as_bytes().len(), self.commit_id_length); - buf.write_all(entry.commit_id.as_bytes()).unwrap(); + buf.extend_from_slice(entry.commit_id.as_bytes()); } for (commit_id, pos) in &self.lookup { - buf.write_all(commit_id.as_bytes()).unwrap(); + buf.extend_from_slice(commit_id.as_bytes()); buf.write_u32::(pos.0).unwrap(); } diff --git a/lib/src/stacked_table.rs b/lib/src/stacked_table.rs index 1cc91cbc1..adfbbf5f4 100644 --- a/lib/src/stacked_table.rs +++ b/lib/src/stacked_table.rs @@ -258,7 +258,7 @@ impl MutableTable { if let Some(parent_file) = &self.parent_file { buf.write_u32::(parent_file.name.len() as u32) .unwrap(); - buf.write_all(parent_file.name.as_bytes()).unwrap(); + buf.extend_from_slice(parent_file.name.as_bytes()); } else { buf.write_u32::(0).unwrap(); } @@ -268,12 +268,12 @@ impl MutableTable { let mut value_offset = 0; for (key, value) in &self.entries { - buf.write_all(key).unwrap(); + buf.extend_from_slice(key); buf.write_u32::(value_offset).unwrap(); value_offset += value.len() as u32; } for value in self.entries.values() { - buf.write_all(value).unwrap(); + buf.extend_from_slice(value); } buf }