Update Android source for Rust 1.67.1

This CL fixes several lints introduced in Rust 1.67.1

Test: m rust
Bug: 268053615
Change-Id: I50fc2e5a9a906ad37eafac95939047f51dd8be07
This commit is contained in:
Chris Wailes 2023-02-14 16:06:32 -08:00
parent f4bf7cab98
commit 738be14804
2 changed files with 6 additions and 3 deletions

View File

@ -18,9 +18,12 @@
use anyhow::{ensure, Result};
use bytes::{Buf, BufMut};
use std::io::{Read, Seek, SeekFrom};
use std::io::{Read, Seek};
use zip::ZipArchive;
#[cfg(test)]
use std::io::SeekFrom;
const EOCD_SIZE_WITHOUT_COMMENT: usize = 22;
const EOCD_CENTRAL_DIRECTORY_SIZE_FIELD_OFFSET: usize = 12;
const EOCD_CENTRAL_DIRECTORY_OFFSET_FIELD_OFFSET: usize = 16;
@ -45,7 +48,7 @@ pub fn zip_sections<R: Read + Seek>(mut reader: R) -> Result<(R, ZipSections)> {
// retrieve reader back
reader = archive.into_inner();
// the current position should point EOCD offset
let eocd_offset = reader.seek(SeekFrom::Current(0))? as u32;
let eocd_offset = reader.stream_position()? as u32;
let mut eocd = vec![0u8; eocd_size];
reader.read_exact(&mut eocd)?;
ensure!(

View File

@ -90,7 +90,7 @@ fn detach_bootconfig(initrd_bc: PathBuf, initrd: PathBuf, bootconfig: PathBuf) -
let initrd_size: usize = initrd_bc_size - bc_size - INITRD_FOOTER_LEN;
initrd_bc.seek(SeekFrom::Start(0))?;
initrd_bc.rewind()?;
copyfile2file(&mut initrd_bc, &mut initrd, initrd_size)?;
copyfile2file(&mut initrd_bc, &mut bootconfig, bc_size)?;
Ok(())