Skip to content

Commit 25f5873

Browse files
committed
Replace from with as
1 parent 398a770 commit 25f5873

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

crates/iceberg/src/puffin/metadata.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ impl FileMetadata {
145145
file_read: &dyn FileRead,
146146
input_file_length: u64,
147147
) -> Result<u32> {
148-
let start = input_file_length - u64::from(FileMetadata::FOOTER_STRUCT_LENGTH);
149-
let end = start + u64::from(FileMetadata::FOOTER_STRUCT_PAYLOAD_LENGTH_LENGTH);
148+
let start = input_file_length - FileMetadata::FOOTER_STRUCT_LENGTH as u64;
149+
let end = start + FileMetadata::FOOTER_STRUCT_PAYLOAD_LENGTH_LENGTH as u64;
150150
let footer_payload_length_bytes = file_read.read(start..end).await?;
151151
let mut buf = [0; 4];
152152
buf.copy_from_slice(&footer_payload_length_bytes);
@@ -159,9 +159,9 @@ impl FileMetadata {
159159
input_file_length: u64,
160160
footer_payload_length: u32,
161161
) -> Result<Bytes> {
162-
let footer_length = u64::from(footer_payload_length)
163-
+ u64::from(FileMetadata::FOOTER_STRUCT_LENGTH)
164-
+ u64::from(FileMetadata::MAGIC_LENGTH);
162+
let footer_length = footer_payload_length as u64
163+
+ FileMetadata::FOOTER_STRUCT_LENGTH as u64
164+
+ FileMetadata::MAGIC_LENGTH as u64;
165165
let start = input_file_length - footer_length;
166166
let end = input_file_length;
167167
file_read.read(start..end).await
@@ -172,9 +172,9 @@ impl FileMetadata {
172172

173173
for byte_idx in 0..FileMetadata::FOOTER_STRUCT_FLAGS_LENGTH {
174174
let byte_offset = footer_bytes.len()
175-
- usize::from(FileMetadata::MAGIC_LENGTH)
176-
- usize::from(FileMetadata::FOOTER_STRUCT_FLAGS_LENGTH)
177-
+ usize::from(byte_idx);
175+
- FileMetadata::MAGIC_LENGTH as usize
176+
- FileMetadata::FOOTER_STRUCT_FLAGS_LENGTH as usize
177+
+ byte_idx as usize;
178178

179179
let flag_byte = *footer_bytes.get(byte_offset).ok_or_else(|| {
180180
Error::new(ErrorKind::DataInvalid, "Index range is out of bounds.")
@@ -202,9 +202,9 @@ impl FileMetadata {
202202
CompressionCodec::None
203203
};
204204

205-
let start_offset = usize::from(FileMetadata::MAGIC_LENGTH);
205+
let start_offset = FileMetadata::MAGIC_LENGTH as usize;
206206
let end_offset =
207-
usize::from(FileMetadata::MAGIC_LENGTH) + usize::try_from(footer_payload_length)?;
207+
FileMetadata::MAGIC_LENGTH as usize + usize::try_from(footer_payload_length)?;
208208
let footer_payload_bytes = footer_bytes
209209
.get(start_offset..end_offset)
210210
.ok_or_else(|| Error::new(ErrorKind::DataInvalid, "Index range is out of bounds."))?;
@@ -237,7 +237,7 @@ impl FileMetadata {
237237
FileMetadata::read_footer_bytes(&file_read, input_file_length, footer_payload_length)
238238
.await?;
239239

240-
let magic_length = usize::from(FileMetadata::MAGIC_LENGTH);
240+
let magic_length = FileMetadata::MAGIC_LENGTH as usize;
241241
// check first four bytes of footer
242242
FileMetadata::check_magic(&footer_bytes[..magic_length])?;
243243
// check last four bytes of footer

0 commit comments

Comments
 (0)