mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
Fix cargo clippy warnings
This commit is contained in:
@@ -25,7 +25,7 @@ pub use services::*;
|
||||
#[cfg(feature = "xpc")]
|
||||
pub use xpc::RemoteXpcClient;
|
||||
|
||||
use log::{debug, error, trace, warn};
|
||||
use log::{debug, error, trace};
|
||||
use provider::{IdeviceProvider, RsdProvider};
|
||||
use rustls::{crypto::CryptoProvider, pki_types::ServerName};
|
||||
use std::{
|
||||
@@ -443,7 +443,7 @@ impl Idevice {
|
||||
// My sanity while debugging the workspace crates are more important.
|
||||
|
||||
debug!("Using ring crypto backend, because both were passed");
|
||||
warn!("Both ring && aws-lc are selected as idevice crypto backends!");
|
||||
log::warn!("Both ring && aws-lc are selected as idevice crypto backends!");
|
||||
rustls::crypto::ring::default_provider()
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ use log::warn;
|
||||
use opcode::{AfcFopenMode, AfcOpcode};
|
||||
use packet::{AfcPacket, AfcPacketHeader};
|
||||
|
||||
use crate::{obf, Idevice, IdeviceError, IdeviceService};
|
||||
use crate::{Idevice, IdeviceError, IdeviceService, obf};
|
||||
|
||||
pub mod errors;
|
||||
pub mod file;
|
||||
@@ -376,11 +376,11 @@ impl AfcClient {
|
||||
///
|
||||
/// # Returns
|
||||
/// A `FileDescriptor` struct for the opened file
|
||||
pub async fn open(
|
||||
&mut self,
|
||||
pub async fn open<'f>(
|
||||
&'f mut self,
|
||||
path: impl Into<String>,
|
||||
mode: AfcFopenMode,
|
||||
) -> Result<FileDescriptor, IdeviceError> {
|
||||
) -> Result<FileDescriptor<'f>, IdeviceError> {
|
||||
let path = path.into();
|
||||
let mut header_payload = (mode as u64).to_le_bytes().to_vec();
|
||||
header_payload.extend(path.as_bytes());
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use log::warn;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{obf, IdeviceError, ReadWrite, RsdService};
|
||||
use crate::{IdeviceError, ReadWrite, RsdService, obf};
|
||||
|
||||
use super::CoreDeviceServiceClient;
|
||||
|
||||
@@ -128,7 +128,7 @@ pub struct IconUuid {
|
||||
pub classes: Vec<String>,
|
||||
}
|
||||
|
||||
impl<'a, R: ReadWrite + 'a> AppServiceClient<R> {
|
||||
impl<R: ReadWrite> AppServiceClient<R> {
|
||||
pub async fn new(stream: R) -> Result<Self, IdeviceError> {
|
||||
Ok(Self {
|
||||
inner: CoreDeviceServiceClient::new(stream).await?,
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
use log::warn;
|
||||
|
||||
use crate::{
|
||||
xpc::{self, XPCObject},
|
||||
IdeviceError, ReadWrite, RemoteXpcClient,
|
||||
xpc::{self, XPCObject},
|
||||
};
|
||||
|
||||
mod app_service;
|
||||
@@ -17,7 +17,7 @@ pub struct CoreDeviceServiceClient<R: ReadWrite> {
|
||||
inner: RemoteXpcClient<R>,
|
||||
}
|
||||
|
||||
impl<'a, R: ReadWrite + 'a> CoreDeviceServiceClient<R> {
|
||||
impl<R: ReadWrite> CoreDeviceServiceClient<R> {
|
||||
pub async fn new(inner: R) -> Result<Self, IdeviceError> {
|
||||
let mut client = RemoteXpcClient::new(inner).await?;
|
||||
client.do_handshake().await?;
|
||||
|
||||
@@ -55,8 +55,8 @@ use log::{debug, warn};
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
||||
use crate::{
|
||||
dvt::message::{Aux, AuxValue, Message, MessageHeader, PayloadHeader},
|
||||
IdeviceError, ReadWrite,
|
||||
dvt::message::{Aux, AuxValue, Message, MessageHeader, PayloadHeader},
|
||||
};
|
||||
|
||||
/// Message type identifier for instruments protocol
|
||||
@@ -112,7 +112,7 @@ impl<R: ReadWrite> RemoteServerClient<R> {
|
||||
}
|
||||
|
||||
/// Returns a handle to the root channel (channel 0)
|
||||
pub fn root_channel(&mut self) -> Channel<R> {
|
||||
pub fn root_channel<'c>(&'c mut self) -> Channel<'c, R> {
|
||||
Channel {
|
||||
client: self,
|
||||
channel: 0,
|
||||
@@ -131,10 +131,10 @@ impl<R: ReadWrite> RemoteServerClient<R> {
|
||||
/// # Errors
|
||||
/// * `IdeviceError::UnexpectedResponse` if server responds with unexpected data
|
||||
/// * Other IO or serialization errors
|
||||
pub async fn make_channel(
|
||||
&mut self,
|
||||
pub async fn make_channel<'c>(
|
||||
&'c mut self,
|
||||
identifier: impl Into<String>,
|
||||
) -> Result<Channel<R>, IdeviceError> {
|
||||
) -> Result<Channel<'c, R>, IdeviceError> {
|
||||
let code = self.new_channel;
|
||||
self.new_channel += 1;
|
||||
|
||||
@@ -164,7 +164,7 @@ impl<R: ReadWrite> RemoteServerClient<R> {
|
||||
self.build_channel(code)
|
||||
}
|
||||
|
||||
fn build_channel(&mut self, code: u32) -> Result<Channel<R>, IdeviceError> {
|
||||
fn build_channel<'c>(&'c mut self, code: u32) -> Result<Channel<'c, R>, IdeviceError> {
|
||||
Ok(Channel {
|
||||
client: self,
|
||||
channel: code,
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::collections::HashMap;
|
||||
use log::warn;
|
||||
use plist::Dictionary;
|
||||
|
||||
use crate::{obf, Idevice, IdeviceError, IdeviceService};
|
||||
use crate::{Idevice, IdeviceError, IdeviceService, obf};
|
||||
|
||||
/// Client for interacting with the iOS installation proxy service
|
||||
///
|
||||
@@ -376,10 +376,10 @@ impl InstallationProxyClient {
|
||||
break;
|
||||
}
|
||||
|
||||
if let Some(status) = res.get("Status").and_then(|x| x.as_string()) {
|
||||
if status == "Complete" {
|
||||
break;
|
||||
}
|
||||
if let Some(status) = res.get("Status").and_then(|x| x.as_string())
|
||||
&& status == "Complete"
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(values)
|
||||
@@ -424,10 +424,10 @@ impl InstallationProxyClient {
|
||||
callback((c, state.clone())).await;
|
||||
}
|
||||
|
||||
if let Some(c) = res.remove("Status").and_then(|x| x.into_string()) {
|
||||
if c == "Complete" {
|
||||
break;
|
||||
}
|
||||
if let Some(c) = res.remove("Status").and_then(|x| x.into_string())
|
||||
&& c == "Complete"
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
use log::debug;
|
||||
|
||||
use crate::{obf, Idevice, IdeviceError, IdeviceService};
|
||||
use crate::{Idevice, IdeviceError, IdeviceService, obf};
|
||||
use sha2::{Digest, Sha384};
|
||||
|
||||
#[cfg(feature = "tss")]
|
||||
@@ -710,10 +710,9 @@ impl ImageMounter {
|
||||
.and_then(|l| l.as_dictionary())
|
||||
.and_then(|l| l.get("Info"))
|
||||
.and_then(|i| i.as_dictionary())
|
||||
&& let Some(plist::Value::Array(rules)) = info.get("RestoreRequestRules")
|
||||
{
|
||||
if let Some(plist::Value::Array(rules)) = info.get("RestoreRequestRules") {
|
||||
crate::tss::apply_restore_request_rules(&mut tss_entry, ¶meters, rules);
|
||||
}
|
||||
crate::tss::apply_restore_request_rules(&mut tss_entry, ¶meters, rules);
|
||||
}
|
||||
|
||||
if manifest_item.get("Digest").is_none() {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
use log::{debug, warn};
|
||||
use plist::Value;
|
||||
|
||||
use crate::{util::plist_to_xml_bytes, IdeviceError};
|
||||
use crate::{IdeviceError, util::plist_to_xml_bytes};
|
||||
|
||||
/// TSS client version string sent in requests
|
||||
const TSS_CLIENT_VERSION_STRING: &str = "libauthinstall-1033.0.2";
|
||||
@@ -172,15 +172,15 @@ pub fn apply_restore_request_rules(
|
||||
|
||||
for (key, value) in actions {
|
||||
// Skip special values (255 typically means "ignore")
|
||||
if let Some(i) = value.as_unsigned_integer() {
|
||||
if i == 255 {
|
||||
continue;
|
||||
}
|
||||
if let Some(i) = value.as_unsigned_integer()
|
||||
&& i == 255
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if let Some(i) = value.as_signed_integer() {
|
||||
if i == 255 {
|
||||
continue;
|
||||
}
|
||||
if let Some(i) = value.as_signed_integer()
|
||||
&& i == 255
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
input.remove(key); // Explicitly remove before inserting
|
||||
|
||||
@@ -17,7 +17,7 @@ pub struct Http2Client<R: ReadWrite> {
|
||||
cache: HashMap<u32, VecDeque<Vec<u8>>>,
|
||||
}
|
||||
|
||||
impl<'a, R: ReadWrite + 'a> Http2Client<R> {
|
||||
impl<R: ReadWrite> Http2Client<R> {
|
||||
/// Writes the magic and inits the caches
|
||||
pub async fn new(mut inner: R) -> Result<Self, IdeviceError> {
|
||||
inner.write_all(HTTP2_MAGIC).await?;
|
||||
|
||||
@@ -17,15 +17,14 @@ const REPLY_CHANNEL: u32 = 3;
|
||||
pub struct RemoteXpcClient<R: ReadWrite> {
|
||||
h2_client: http2::Http2Client<R>,
|
||||
root_id: u64,
|
||||
reply_id: u64,
|
||||
// reply_id: u64 // maybe not used?
|
||||
}
|
||||
|
||||
impl<'a, R: ReadWrite + 'a> RemoteXpcClient<R> {
|
||||
impl<R: ReadWrite> RemoteXpcClient<R> {
|
||||
pub async fn new(socket: R) -> Result<Self, IdeviceError> {
|
||||
Ok(Self {
|
||||
h2_client: http2::Http2Client::new(socket).await?,
|
||||
root_id: 1,
|
||||
reply_id: 1,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -86,11 +85,11 @@ impl<'a, R: ReadWrite + 'a> RemoteXpcClient<R> {
|
||||
|
||||
match msg.message {
|
||||
Some(msg) => {
|
||||
if let Some(d) = msg.as_dictionary() {
|
||||
if d.is_empty() {
|
||||
msg_buffer.clear();
|
||||
continue;
|
||||
}
|
||||
if let Some(d) = msg.as_dictionary()
|
||||
&& d.is_empty()
|
||||
{
|
||||
msg_buffer.clear();
|
||||
continue;
|
||||
}
|
||||
break Ok(msg.to_plist());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user