diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index affaf6b..612019b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,8 @@ jobs: - name: Build all Apple targets and examples/tools run: | + export HOMEBREW_PREFIX=$(brew --prefix) + export CXXFLAGS="-I$HOMEBREW_PREFIX/include" just macos-ci-check - name: Upload static libraries diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt index 007c72d..63d607d 100644 --- a/cpp/examples/CMakeLists.txt +++ b/cpp/examples/CMakeLists.txt @@ -18,8 +18,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") -find_package(PkgConfig REQUIRED) - # Find all C++ example files file(GLOB EXAMPLE_SOURCES ${EXAMPLES_DIR}/*.cpp) @@ -39,7 +37,6 @@ foreach(EXAMPLE_FILE ${EXAMPLE_SOURCES}) # Link the static Rust library target_link_libraries(${EXAMPLE_NAME} PRIVATE ${STATIC_LIB}) - # Bulk-link common macOS system frameworks if(APPLE) target_link_libraries(${EXAMPLE_NAME} PRIVATE diff --git a/idevice/src/pairing_file.rs b/idevice/src/pairing_file.rs index b4e8dda..7f2b5b2 100644 --- a/idevice/src/pairing_file.rs +++ b/idevice/src/pairing_file.rs @@ -219,7 +219,7 @@ fn ensure_pem_headers(data: &[u8], pem_type: &str) -> Vec { 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 { 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 diff --git a/idevice/src/services/afc/errors.rs b/idevice/src/services/afc/errors.rs index 7aa9fc3..a6c726e 100644 --- a/idevice/src/services/afc/errors.rs +++ b/idevice/src/services/afc/errors.rs @@ -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}") } } diff --git a/idevice/src/services/debug_proxy.rs b/idevice/src/services/debug_proxy.rs index 97f230b..8fa2a28 100644 --- a/idevice/src/services/debug_proxy.rs +++ b/idevice/src/services/debug_proxy.rs @@ -107,10 +107,10 @@ impl DebugProxyClient { 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 DebugProxyClient { // 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 DebugProxyClient { /// 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 diff --git a/idevice/src/services/dvt/message.rs b/idevice/src/services/dvt/message.rs index 156d352..006fad7 100644 --- a/idevice/src/services/dvt/message.rs +++ b/idevice/src/services/dvt/message.rs @@ -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})"), } } } diff --git a/idevice/src/tunneld.rs b/idevice/src/tunneld.rs index 2c4acbd..dcbb8de 100644 --- a/idevice/src/tunneld.rs +++ b/idevice/src/tunneld.rs @@ -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}"), } } } diff --git a/idevice/src/util.rs b/idevice/src/util.rs index 1b7ee06..4e69565 100644 --- a/idevice/src/util.rs +++ b/idevice/src/util.rs @@ -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::>() .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(), } diff --git a/idevice/src/xpc/format.rs b/idevice/src/xpc/format.rs index 2c73029..2bfbc6a 100644 --- a/idevice/src/xpc/format.rs +++ b/idevice/src/xpc/format.rs @@ -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!( diff --git a/justfile b/justfile index 7502428..f339e34 100644 --- a/justfile +++ b/justfile @@ -45,7 +45,7 @@ xcframework: apple-build -library swift/libs/idevice-macos.a -headers swift/include \ -output swift/IDevice.xcframework - zip -r bundle.zip IDevice.xcframework + zip -r bundle.zip swift/IDevice.xcframework openssl dgst -sha256 bundle.zip [working-directory: 'ffi']