mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-07 23:27:51 +00:00
Optimize Rust code with Clippy
This commit is contained in:
parent
64a92195dd
commit
d43b49e7e4
7 changed files with 71 additions and 73 deletions
|
@ -31,7 +31,7 @@ async fn main() -> std::io::Result<()> {
|
|||
if args.len() > 1 {
|
||||
for arg in args {
|
||||
if arg.starts_with("--address=") || arg.starts_with("-a=") {
|
||||
let split: Vec<&str> = arg.split("=").collect();
|
||||
let split: Vec<&str> = arg.split('=').collect();
|
||||
address = split[1].to_string();
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ async fn main() -> std::io::Result<()> {
|
|||
.default_service(web::get().to(utils::error))
|
||||
// GENERAL SERVICES
|
||||
.route("/style.css/", web::get().to(style))
|
||||
.route("/favicon.ico/", web::get().to(|| HttpResponse::Ok()))
|
||||
.route("/favicon.ico/", web::get().to(HttpResponse::Ok))
|
||||
.route("/robots.txt/", web::get().to(robots))
|
||||
// PROXY SERVICE
|
||||
.route("/proxy/{url:.*}/", web::get().to(proxy::handler))
|
||||
|
@ -72,7 +72,7 @@ async fn main() -> std::io::Result<()> {
|
|||
.route("/r/{sub}/comments/{id}/{title}/{comment_id}/", web::get().to(post::item))
|
||||
})
|
||||
.bind(address.clone())
|
||||
.expect(format!("Cannot bind to the address: {}", address).as_str())
|
||||
.unwrap_or_else(|_| panic!("Cannot bind to the address: {}", address))
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue