mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
Clean clippy warnings
This commit is contained in:
@@ -184,9 +184,9 @@ impl From<PairingFile> for RawPairingFile {
|
||||
/// Converts a structured pairing file into a raw pairing file for serialization
|
||||
fn from(value: PairingFile) -> Self {
|
||||
// Ensure certificates include proper PEM format
|
||||
let device_cert_data = ensure_pem_headers(&value.device_certificate.to_vec(), "CERTIFICATE");
|
||||
let host_cert_data = ensure_pem_headers(&value.host_certificate.to_vec(), "CERTIFICATE");
|
||||
let root_cert_data = ensure_pem_headers(&value.root_certificate.to_vec(), "CERTIFICATE");
|
||||
let device_cert_data = ensure_pem_headers(&value.device_certificate, "CERTIFICATE");
|
||||
let host_cert_data = ensure_pem_headers(&value.host_certificate, "CERTIFICATE");
|
||||
let root_cert_data = ensure_pem_headers(&value.root_certificate, "CERTIFICATE");
|
||||
|
||||
// Ensure private keys include proper PEM format
|
||||
let host_private_key_data = ensure_pem_headers(&value.host_private_key, "PRIVATE KEY");
|
||||
@@ -226,9 +226,10 @@ fn ensure_pem_headers(data: &[u8], pem_type: &str) -> Vec<u8> {
|
||||
let base64_content = if is_base64(data) {
|
||||
// Clean up any existing whitespace/newlines
|
||||
let data_str = String::from_utf8_lossy(data);
|
||||
data_str.replace('\n', "").replace('\r', "").replace(' ', "").into_bytes()
|
||||
data_str.replace(['\n', '\r', ' '], "").into_bytes()
|
||||
} else {
|
||||
base64::encode(data).into_bytes()
|
||||
let engine = base64::prelude::BASE64_STANDARD;
|
||||
base64::Engine::encode(&engine, data).into_bytes()
|
||||
};
|
||||
|
||||
// Format base64 content with proper line breaks (64 chars per line)
|
||||
@@ -282,4 +283,3 @@ fn test_pairing_file_roundtrip() {
|
||||
|
||||
assert_eq!(f[..output.len()], output);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user