mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 22:46:14 +01:00
Cargo clippy fixes
This commit is contained in:
@@ -219,7 +219,7 @@ fn ensure_pem_headers(data: &[u8], pem_type: &str) -> Vec<u8> {
|
||||
let mut result = Vec::new();
|
||||
|
||||
// Add header
|
||||
let header = format!("-----BEGIN {}-----\n", pem_type);
|
||||
let header = format!("-----BEGIN {pem_type}-----\n");
|
||||
result.extend_from_slice(header.as_bytes());
|
||||
|
||||
// Add base64 content with line breaks every 64 characters
|
||||
@@ -244,7 +244,7 @@ fn ensure_pem_headers(data: &[u8], pem_type: &str) -> Vec<u8> {
|
||||
result.push(b'\n');
|
||||
|
||||
// Add footer
|
||||
let footer = format!("-----END {}-----", pem_type);
|
||||
let footer = format!("-----END {pem_type}-----");
|
||||
result.extend_from_slice(footer.as_bytes());
|
||||
|
||||
result
|
||||
|
||||
@@ -66,7 +66,7 @@ impl std::fmt::Display for AfcError {
|
||||
AfcError::NotEnoughData => "Not enough data",
|
||||
AfcError::DirNotEmpty => "Directory not empty",
|
||||
};
|
||||
write!(f, "{}", description)
|
||||
write!(f, "{description}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,10 +107,10 @@ impl<R: ReadWrite> DebugProxyClient<R> {
|
||||
let checksum = calculate_checksum(&packet_data);
|
||||
|
||||
// Construct the full packet
|
||||
let packet = format!("${}#{}", packet_data, checksum);
|
||||
let packet = format!("${packet_data}#{checksum}");
|
||||
|
||||
// Log the packet for debugging
|
||||
debug!("Sending packet: {}", packet);
|
||||
debug!("Sending packet: {packet}");
|
||||
|
||||
// Send the packet
|
||||
self.socket.write_all(packet.as_bytes()).await?;
|
||||
@@ -237,7 +237,7 @@ impl<R: ReadWrite> DebugProxyClient<R> {
|
||||
|
||||
// Hex encode the argument
|
||||
for byte in arg.bytes() {
|
||||
let hex = format!("{:02X}", byte);
|
||||
let hex = format!("{byte:02X}");
|
||||
pkt[pktp..pktp + 2].copy_from_slice(hex.as_bytes());
|
||||
pktp += 2;
|
||||
}
|
||||
@@ -290,7 +290,7 @@ impl<R: ReadWrite> DebugProxyClient<R> {
|
||||
/// between '$' and '#', formatted as two lowercase hex digits.
|
||||
fn calculate_checksum(data: &str) -> String {
|
||||
let checksum = data.bytes().fold(0u8, |acc, byte| acc.wrapping_add(byte));
|
||||
format!("{:02x}", checksum)
|
||||
format!("{checksum:02x}")
|
||||
}
|
||||
|
||||
/// Hex-encodes bytes as uppercase string
|
||||
|
||||
@@ -501,15 +501,15 @@ impl Message {
|
||||
impl std::fmt::Debug for AuxValue {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
AuxValue::String(s) => write!(f, "String({:?})", s),
|
||||
AuxValue::String(s) => write!(f, "String({s:?})"),
|
||||
AuxValue::Array(arr) => write!(
|
||||
f,
|
||||
"Array(len={}, first_bytes={:?})",
|
||||
arr.len(),
|
||||
&arr[..arr.len().min(10)]
|
||||
), // Show only first 10 bytes
|
||||
AuxValue::U32(n) => write!(f, "U32({})", n),
|
||||
AuxValue::I64(n) => write!(f, "I64({})", n),
|
||||
AuxValue::U32(n) => write!(f, "U32({n})"),
|
||||
AuxValue::I64(n) => write!(f, "I64({n})"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,8 +101,8 @@ mod tests {
|
||||
async fn test_get_tunneld_devices() {
|
||||
let host = SocketAddr::new(IpAddr::from_str("127.0.0.1").unwrap(), DEFAULT_PORT);
|
||||
match get_tunneld_devices(host).await {
|
||||
Ok(devices) => println!("Found tunneld devices: {:#?}", devices),
|
||||
Err(e) => println!("Error querying tunneld: {}", e),
|
||||
Ok(devices) => println!("Found tunneld devices: {devices:#?}"),
|
||||
Err(e) => println!("Error querying tunneld: {e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,25 +103,25 @@ fn print_plist(p: &Value, indentation: usize) -> String {
|
||||
.collect();
|
||||
format!("{{\n{}\n{}}}", items.join(",\n"), indent)
|
||||
}
|
||||
Value::Boolean(b) => format!("{}", b),
|
||||
Value::Boolean(b) => format!("{b}"),
|
||||
Value::Data(vec) => {
|
||||
let len = vec.len();
|
||||
let preview: String = vec
|
||||
.iter()
|
||||
.take(20)
|
||||
.map(|b| format!("{:02X}", b))
|
||||
.map(|b| format!("{b:02X}"))
|
||||
.collect::<Vec<String>>()
|
||||
.join(" ");
|
||||
if len > 20 {
|
||||
format!("Data({}... Len: {})", preview, len)
|
||||
format!("Data({preview}... Len: {len})")
|
||||
} else {
|
||||
format!("Data({} Len: {})", preview, len)
|
||||
format!("Data({preview} Len: {len})")
|
||||
}
|
||||
}
|
||||
Value::Date(date) => format!("Date({})", date.to_xml_format()),
|
||||
Value::Real(f) => format!("{}", f),
|
||||
Value::Integer(i) => format!("{}", i),
|
||||
Value::String(s) => format!("\"{}\"", s),
|
||||
Value::Real(f) => format!("{f}"),
|
||||
Value::Integer(i) => format!("{i}"),
|
||||
Value::String(s) => format!("\"{s}\""),
|
||||
Value::Uid(_uid) => "Uid(?)".to_string(),
|
||||
_ => "Unknown".to_string(),
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ impl std::fmt::Debug for XPCMessage {
|
||||
let known_mask = 0x00000001 | 0x00000100 | 0x00010000 | 0x00400000;
|
||||
let custom_bits = self.flags & !known_mask;
|
||||
if custom_bits != 0 {
|
||||
parts.push(format!("Custom(0x{:08X})", custom_bits));
|
||||
parts.push(format!("Custom(0x{custom_bits:08X})"));
|
||||
}
|
||||
|
||||
write!(
|
||||
|
||||
Reference in New Issue
Block a user