···39394040impl Header {
4141 /// Subtract `distance` from `pack_offset` safely without the chance for overflow or no-ops if `distance` is 0.
4242- pub fn verified_base_pack_offset(pack_offset: data::Offset, distance: u64) -> Option<data::Offset> {
4242+ pub fn verified_base_pack_offset(
4343+ pack_offset: data::Offset,
4444+ distance: u64,
4545+ ) -> Option<data::Offset> {
4346 if distance == 0 {
4447 return None;
4548 }
···8386 ///
8487 /// Returns the amount of bytes written to `out`.
8588 /// `decompressed_size_in_bytes` is the full size in bytes of the object that this header represents
8686- pub fn write_to(&self, decompressed_size_in_bytes: u64, out: &mut dyn io::Write) -> io::Result<usize> {
8989+ pub fn write_to(
9090+ &self,
9191+ decompressed_size_in_bytes: u64,
9292+ out: &mut dyn io::Write,
9393+ ) -> io::Result<usize> {
8794 let mut size = decompressed_size_in_bytes;
8895 let mut written = 1;
8996 let mut c: u8 = (self.as_type_id() << 4) | (size as u8 & 0b0000_1111);
···133140 *out = 0b1000_0000 | (n as u8 & 0b0111_1111);
134141 bytes_written += 1;
135142 }
136136- debug_assert_eq!(n, 0, "BUG: buffer must be large enough to hold a 64 bit integer");
143143+ debug_assert_eq!(
144144+ n, 0,
145145+ "BUG: buffer must be large enough to hold a 64 bit integer"
146146+ );
137147 &buf[buf.len() - bytes_written..]
138148}
139149···145155 fn leb64_encode_max_int() {
146156 let mut buf = [0u8; 10];
147157 let buf = leb64_encode(u64::MAX, &mut buf);
148148- assert_eq!(buf.len(), 10, "10 bytes should be used when 64bits are encoded");
158158+ assert_eq!(
159159+ buf.len(),
160160+ 10,
161161+ "10 bytes should be used when 64bits are encoded"
162162+ );
149163 }
150164}
···1515 /// The checksum in the trailer of this pack data file
1616 pub fn checksum(&self) -> gix_hash::ObjectId {
1717 let trailer = self
1818- .read_span((self.data_len() - self.object_hash.len_in_bytes()) as u64..self.data_len() as u64)
1818+ .read_span(
1919+ (self.data_len() - self.object_hash.len_in_bytes()) as u64..self.data_len() as u64,
2020+ )
1921 .expect("pack trailer is within the pack data");
2022 gix_hash::ObjectId::from_bytes_or_panic(&trailer)
2123 }
···66 /// Create a new input entry from a given data `obj` set to be placed at the given `pack_offset`.
77 ///
88 /// This method is useful when arbitrary base entries are created
99- pub fn from_data_obj(obj: &gix_object::Data<'_>, pack_offset: u64) -> Result<Self, input::Error> {
99+ pub fn from_data_obj(
1010+ obj: &gix_object::Data<'_>,
1111+ pack_offset: u64,
1212+ ) -> Result<Self, input::Error> {
1013 let header = to_header(obj.kind);
1114 let compressed = compress_data(obj)?;
1215 let compressed_size = compressed.len() as u64;
···99 PackParse(#[from] crate::data::header::decode::Error),
1010 #[error("Failed to verify pack checksum in trailer")]
1111 Verify(#[from] gix_hash::verify::Error),
1212- #[error("pack is incomplete: it was decompressed into {actual} bytes but {expected} bytes where expected.")]
1212+ #[error(
1313+ "pack is incomplete: it was decompressed into {actual} bytes but {expected} bytes where expected."
1414+ )]
1315 IncompletePack { actual: u64, expected: u64 },
1416 #[error("The object {object_id} could not be decoded or wasn't found")]
1517 NotFound { object_id: gix_hash::ObjectId },