mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-21 23:47:39 +00:00
Address clippy warnings
This commit is contained in:
parent
4fff2aa7d8
commit
4eaf701cb7
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::useless_conversion)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::ffi::CStr;
|
||||
use std::fmt::{Display, Formatter, Write as FmtWrite};
|
||||
|
@ -86,8 +86,7 @@ pub fn patch_encryption(buf: &mut [u8]) -> usize {
|
||||
}
|
||||
|
||||
fn hex2byte(hex: &[u8]) -> Vec<u8> {
|
||||
let mut v = Vec::new();
|
||||
v.reserve(hex.len() / 2);
|
||||
let mut v = Vec::with_capacity(hex.len() / 2);
|
||||
for bytes in hex.chunks(2) {
|
||||
if bytes.len() != 2 {
|
||||
break;
|
||||
|
@ -60,8 +60,7 @@ fn do_extract_boot_from_payload(
|
||||
return Err(bad_payload!("manifest signature length is zero"));
|
||||
}
|
||||
|
||||
let mut buf = Vec::new();
|
||||
buf.resize(manifest_len, 0u8);
|
||||
let mut buf = vec![0; manifest_len];
|
||||
|
||||
let manifest = {
|
||||
let manifest = &mut buf[..manifest_len];
|
||||
@ -171,7 +170,7 @@ fn do_extract_boot_from_payload(
|
||||
if !ffi::decompress(data, out_file.as_raw_fd()) {
|
||||
return Err(bad_payload!("decompression failed"));
|
||||
}
|
||||
},
|
||||
}
|
||||
_ => return Err(bad_payload!("unsupported operation type")),
|
||||
};
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ use base::{log_err, LoggedResult, MappedFile, ResultExt, StrErr, Utf8CStr};
|
||||
|
||||
use crate::ffi::BootImage;
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub enum SHA {
|
||||
SHA1(Sha1),
|
||||
SHA256(Sha256),
|
||||
@ -319,5 +320,5 @@ pub fn sign_boot_image(
|
||||
};
|
||||
sig.to_der().log()
|
||||
}
|
||||
inner(payload, name, cert, key).unwrap_or(Vec::new())
|
||||
inner(payload, name, cert, key).unwrap_or_default()
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ pub fn setup_klog() {
|
||||
unsafe {
|
||||
let mut fd = open(raw_cstr!("/dev/null"), O_RDWR | O_CLOEXEC);
|
||||
if fd < 0 {
|
||||
mknod(raw_cstr!("/null"), S_IFCHR | 0666, makedev(1, 3));
|
||||
mknod(raw_cstr!("/null"), S_IFCHR | 0o666, makedev(1, 3));
|
||||
fd = open(raw_cstr!("/null"), O_RDWR | O_CLOEXEC);
|
||||
fs::remove_file("/null").ok();
|
||||
}
|
||||
@ -34,7 +34,7 @@ pub fn setup_klog() {
|
||||
KMSG.set(kmsg).ok();
|
||||
} else {
|
||||
unsafe {
|
||||
mknod(raw_cstr!("/kmsg"), S_IFCHR | 0666, makedev(1, 11));
|
||||
mknod(raw_cstr!("/kmsg"), S_IFCHR | 0o666, makedev(1, 11));
|
||||
KMSG.set(File::options().write(true).open("/kmsg").unwrap())
|
||||
.ok();
|
||||
unlink(raw_cstr!("/kmsg"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user