Skip to content

Commit d161b06

Browse files
author
cht
committed
cargo clippy cargo fmt
1 parent 91ec50b commit d161b06

2 files changed

Lines changed: 23 additions & 26 deletions

File tree

src/spider.rs

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//extern crate base64;
22
use reqwest::Result;
3-
use serde_json::Value;
43
use serde::{Deserialize, Serialize};
4+
use serde_json::Value;
55
pub fn ascii_to_char(code: u8) -> char {
66
std::char::from_u32(code as u32).unwrap_or('_')
77
}
@@ -56,7 +56,7 @@ enum Tcp {
5656
Ss,
5757
V2,
5858
}
59-
#[derive(Clone,Serialize, Deserialize)]
59+
#[derive(Clone, Serialize, Deserialize)]
6060
pub struct Information {
6161
pub func: String,
6262
pub urls: String,
@@ -462,9 +462,7 @@ impl Information {
462462
\"tls\":\"{}\",
463463
\"typpe\":\"{}\"
464464
}},\n",
465-
466465
self.urls,
467-
468466
self.func,
469467
self.add,
470468
self.aid,
@@ -499,8 +497,8 @@ impl Information {
499497
let header2 = ascii_to_string2(base64::decode(header.as_bytes()).unwrap());
500498
// 通过分号切开两个内容
501499
let header3: Vec<&str> = header2.split(':').collect();
502-
let net = format!("{}", header3[0]);
503-
let id = format!("{}", header3[1]);
500+
let net = header3[0].to_string();
501+
let id = header3[1].to_string();
504502

505503
let first_temp = first[1].to_string();
506504
let second: Vec<&str> = first_temp.split('#').collect();
@@ -509,8 +507,8 @@ impl Information {
509507

510508
let second_temp = second[0].to_string();
511509
let third: Vec<&str> = second_temp.split(':').collect();
512-
let add = format!("{}", third[0]);
513-
let port = format!("{}", third[1]);
510+
let add = third[0].to_string();
511+
let port = third[1].to_string();
514512
Information {
515513
urls: url,
516514
func: "ss".to_string(),
@@ -538,28 +536,28 @@ impl Information {
538536
func: "vmess".to_string(),
539537
add: remove_quotation(input["add"].to_string()),
540538
aid: remove_quotation(input["aid"].to_string()),
541-
host: remove_quotation(input["host"].to_string()),
542-
id: remove_quotation(input["id"].to_string()),
543-
net: remove_quotation(input["net"].to_string()),
544-
path: remove_quotation(input["path"].to_string()),
545-
port: remove_quotation(input["port"].to_string()),
546-
ps: remove_quotation(input["ps"].to_string()),
547-
tls: remove_quotation(input["tls"].to_string()),
539+
host: remove_quotation(input["host"].to_string()),
540+
id: remove_quotation(input["id"].to_string()),
541+
net: remove_quotation(input["net"].to_string()),
542+
path: remove_quotation(input["path"].to_string()),
543+
port: remove_quotation(input["port"].to_string()),
544+
ps: remove_quotation(input["ps"].to_string()),
545+
tls: remove_quotation(input["tls"].to_string()),
548546
typpe: remove_quotation(input["type"].to_string()),
549547
}
550548
}
551549
Err(_) => Information {
552550
urls: url,
553-
func: "vmess".to_string(),
554-
add: "unknown".to_string(),
555-
aid: "unknown".to_string(),
556-
host: "unknown".to_string(),
557-
id: "unknown".to_string(),
558-
net: "unknown".to_string(),
559-
path: "unknown".to_string(),
560-
port: "unknown".to_string(),
561-
ps: "unknown".to_string(),
562-
tls: "unknown".to_string(),
551+
func: "vmess".to_string(),
552+
add: "unknown".to_string(),
553+
aid: "unknown".to_string(),
554+
host: "unknown".to_string(),
555+
id: "unknown".to_string(),
556+
net: "unknown".to_string(),
557+
path: "unknown".to_string(),
558+
port: "unknown".to_string(),
559+
ps: "unknown".to_string(),
560+
tls: "unknown".to_string(),
563561
typpe: "unknown".to_string(),
564562
},
565563
}

src/utils.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,4 @@ pub fn start() -> Vec<Vec<Information>> {
9393
}
9494
};
9595
serde_json::from_str(messages.as_str()).unwrap()
96-
9796
}

0 commit comments

Comments
 (0)