Skip to content

Commit 476ab7f

Browse files
committed
make lint happy
1 parent 465843f commit 476ab7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1152
-965
lines changed

crates/lagrange-core/src/common/app_info.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,9 @@ impl AppInfo {
184184

185185
pub fn android(variant: AndroidVariant) -> Self {
186186
let (sub_app_id, current_version, package_name) = match variant {
187-
AndroidVariant::Phone => (
188-
537275636,
189-
"9.1.60.045f5d19",
190-
"com.tencent.mobileqq",
191-
),
192-
AndroidVariant::Pad => (
193-
537275675,
194-
"9.1.60.045f5d19",
195-
"com.tencent.mobileqq",
196-
),
197-
AndroidVariant::Watch => (
198-
537258298,
199-
"testrevision",
200-
"com.tencent.qqlite",
201-
),
187+
AndroidVariant::Phone => (537275636, "9.1.60.045f5d19", "com.tencent.mobileqq"),
188+
AndroidVariant::Pad => (537275675, "9.1.60.045f5d19", "com.tencent.mobileqq"),
189+
AndroidVariant::Watch => (537258298, "testrevision", "com.tencent.qqlite"),
202190
};
203191

204192
Self {
@@ -210,8 +198,8 @@ impl AppInfo {
210198
sso_version: 22,
211199
package_name: package_name.to_string(),
212200
apk_signature_md5: vec![
213-
0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3,
214-
0x6E, 0xB6, 0x8D,
201+
0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3, 0x6E,
202+
0xB6, 0x8D,
215203
],
216204
sdk_info: WtLoginSdkInfo::android(variant),
217205
app_id: 16,

crates/lagrange-core/src/common/sign.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ impl AndroidSignProvider {
5454
#[async_trait]
5555
impl SignProvider for AndroidSignProvider {
5656
async fn sign(&self, cmd: &str, seq: u32, data: &[u8]) -> Option<SignResult> {
57-
tracing::debug!("Android sign request: cmd={}, seq={}, len={}", cmd, seq, data.len());
57+
tracing::debug!(
58+
"Android sign request: cmd={}, seq={}, len={}",
59+
cmd,
60+
seq,
61+
data.len()
62+
);
5863
None
5964
}
6065

crates/lagrange-core/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl BotConfig {
9494
pub fn get_sign_provider(&self) -> BoxedSignProvider {
9595
self.sign_provider
9696
.clone()
97-
.unwrap_or_else(|| Arc::new(DefaultSignProvider::default()))
97+
.unwrap_or_else(|| Arc::new(DefaultSignProvider))
9898
}
9999
}
100100

crates/lagrange-core/src/context.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::{
22
common::BotAppInfo,
33
config::BotConfig,
4-
keystore::BotKeystore,
54
internal::context::{CacheContext, EventContext, PacketContext, ServiceContext, SocketContext},
5+
keystore::BotKeystore,
66
protocol::{EventMessage, ProtocolEvent},
77
};
88
use std::sync::Arc;
@@ -126,11 +126,7 @@ impl BotContextBuilder {
126126
let app_info_arc = Arc::new(app_info.clone());
127127

128128
// PacketContext needs keystore, app_info, and config
129-
let packet = PacketContext::new(
130-
keystore_arc,
131-
app_info_arc,
132-
&config,
133-
);
129+
let packet = PacketContext::new(keystore_arc, app_info_arc, &config);
134130

135131
let service = ServiceContext::new(&config);
136132

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pub mod services;
21
pub mod context;
32
mod packets;
3+
pub mod services;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
pub mod cache;
2+
pub mod event;
23
pub mod packet;
34
pub mod service;
45
pub mod socket;
5-
pub mod event;
66

77
pub use cache::CacheContext;
8+
pub use event::EventContext;
89
pub use packet::PacketContext;
910
pub use service::ServiceContext;
1011
pub use socket::SocketContext;
11-
pub use event::EventContext;

crates/lagrange-core/src/internal/context/event.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,5 @@ impl<T> Clone for TypedEventReceiver<T> {
8181
}
8282

8383
impl Drop for EventContext {
84-
fn drop(&mut self) {
85-
}
84+
fn drop(&mut self) {}
8685
}

crates/lagrange-core/src/internal/context/packet.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ use crate::{
22
common::{sign::BoxedSignProvider, AppInfo, BotAppInfo},
33
config::BotConfig,
44
error::{Error, Result},
5-
internal::packets::{EncryptType, RequestType, ServicePacker, SsoPacket, SsoPacker, SsoSecureInfo},
5+
internal::packets::{
6+
EncryptType, RequestType, ServicePacker, SsoPacker, SsoPacket, SsoSecureInfo,
7+
},
68
keystore::BotKeystore,
79
protocol::Protocols,
810
};
@@ -169,7 +171,8 @@ impl PacketContext {
169171
}
170172

171173
async fn get_secure_info(&self, packet: &SsoPacket) -> Option<SsoSecureInfo> {
172-
let sign_result = self.sign_provider
174+
let sign_result = self
175+
.sign_provider
173176
.sign(&packet.command, packet.sequence as u32, &packet.data)
174177
.await?;
175178

@@ -187,9 +190,11 @@ impl PacketContext {
187190
let service_packer = ServicePacker::new(&keystore, app_info);
188191
let sso_packer = SsoPacker::new(&keystore, app_info, self.protocol);
189192

190-
let sso_data = service_packer.parse(&data)
193+
let sso_data = service_packer
194+
.parse(&data)
191195
.map_err(|e| Error::ParseError(format!("Service parse failed: {}", e)))?;
192-
let packet = sso_packer.parse(&sso_data)
196+
let packet = sso_packer
197+
.parse(&sso_data)
193198
.map_err(|e| Error::ParseError(format!("SSO parse failed: {}", e)))?;
194199

195200
Ok(packet)

crates/lagrange-core/src/internal/context/socket.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use bytes::{Bytes, BytesMut, BufMut};
1+
use bytes::{BufMut, Bytes, BytesMut};
22
use std::sync::Arc;
3-
use tokio::sync::mpsc;
4-
use tokio::net::TcpStream;
53
use tokio::io::{AsyncReadExt, AsyncWriteExt};
4+
use tokio::net::TcpStream;
5+
use tokio::sync::mpsc;
66

77
const IPV4_SERVER: &str = "msfwifi.3g.qq.com:8080";
88
const IPV6_SERVER: &str = "msfwifiv6.3g.qq.com:8080";
@@ -61,7 +61,9 @@ impl SocketContext {
6161
.lock()
6262
.expect("Mutex poisoned")
6363
.take()
64-
.ok_or_else(|| crate::error::Error::NetworkError("Outbound receiver already taken".to_string()))?;
64+
.ok_or_else(|| {
65+
crate::error::Error::NetworkError("Outbound receiver already taken".to_string())
66+
})?;
6567
self.set_connected(true);
6668

6769
let read_task = {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub mod login;
1+
pub mod login;
22
pub mod structs;
33

44
// Re-exports are kept for future use when implementing login handlers
@@ -8,7 +8,7 @@ pub use login::{EncryptMethod, Tlv, TlvQrCode, WtLogin};
88
// Re-export commonly used structs
99
pub use structs::{
1010
service_packer::{EncryptType, RequestType, ServicePacker},
11-
sso_packet::SsoPacket,
1211
sso_packer::SsoPacker,
12+
sso_packet::SsoPacket,
1313
sso_secure_info::SsoSecureInfo,
14-
};
14+
};

0 commit comments

Comments
 (0)