apkdmverity: build for Android.bp
... and some parts of the source code were revised to satisfy the
stricter lint checks for Android.
Bug: 189785765
Test: cargo test
Test: m apkdmverity
Change-Id: Ic3d80922396fb8e7cba29b092d6f74d17e936f7a
diff --git a/apkverity/src/util.rs b/apkverity/src/util.rs
index 415e99b..d2bc799 100644
--- a/apkverity/src/util.rs
+++ b/apkverity/src/util.rs
@@ -16,7 +16,6 @@
use anyhow::{bail, Result};
use nix::sys::stat::FileStat;
-use std::fs;
use std::fs::File;
use std::os::unix::fs::FileTypeExt;
use std::os::unix::io::AsRawFd;
@@ -40,7 +39,7 @@
/// Returns hexadecimal reprentation of a given byte array.
pub fn hexstring_from(s: &[u8]) -> String {
- s.iter().map(|byte| format!("{:02x}", byte)).reduce(|i, j| i + &j).unwrap_or(String::new())
+ s.iter().map(|byte| format!("{:02x}", byte)).reduce(|i, j| i + &j).unwrap_or_default()
}
/// fstat that accepts a path rather than FD