mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-07 23:27:51 +00:00
Optimize use of Result<>
This commit is contained in:
parent
0adbb1556e
commit
7e96bb3d80
6 changed files with 31 additions and 31 deletions
|
@ -34,8 +34,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();
|
||||
address = split[1].to_string();
|
||||
address = arg.split('=').collect::<Vec<&str>>()[1].to_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,6 +80,9 @@ async fn main() -> std::io::Result<()> {
|
|||
.route("/r/{sub}/comments/{id}/{title}/{comment_id}/", web::get().to(post::item))
|
||||
})
|
||||
.bind(&address)
|
||||
.map(|x| {
|
||||
x
|
||||
})
|
||||
.unwrap_or_else(|_| panic!("Cannot bind to the address: {}", address))
|
||||
.run()
|
||||
.await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue