Skip to content

Commit

Permalink
chore(fmt): cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lomirus committed Dec 20, 2023
1 parent 1455546 commit 405f973
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub async fn listen<R: Into<PathBuf>>(
host: &str,
port: u16,
root: R,
try_to_switch_to_an_available_port: bool
try_to_switch_to_an_available_port: bool,
) -> Result<(), Box<dyn Error>> {
HOST.set(host.to_string()).unwrap();
ROOT.set(root.into()).unwrap();
Expand Down
5 changes: 4 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ pub async fn serve(port: u16, switch_to_available_ports: bool) -> Result<(), Str
Ok(())
}

async fn create_listener(port: u16, switch_to_available_ports: bool) -> Result<TcpListener, String> {
async fn create_listener(
port: u16,
switch_to_available_ports: bool,
) -> Result<TcpListener, String> {
let host = HOST.get().unwrap();
let mut port = port;
// Loop until the port is available
Expand Down
4 changes: 3 additions & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use reqwest::StatusCode;
#[tokio::test]
async fn request() {
tokio::spawn(async {
listen("127.0.0.1", 8000, "./tests/page", false).await.unwrap();
listen("127.0.0.1", 8000, "./tests/page", false)
.await
.unwrap();
});

// Test requesting index.html
Expand Down

0 comments on commit 405f973

Please sign in to comment.