From 1341cde3658b3a99330e17a5304530ffbf86cc7b Mon Sep 17 00:00:00 2001 From: memoryruins Date: Wed, 11 Sep 2019 10:54:29 -0400 Subject: [PATCH] refactor(examples): remove lifetime workaround in send_file example The lifetime workaround is no longer required due to changes in rustc. This removes the line and comment from the example. --- examples/send_file.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/send_file.rs b/examples/send_file.rs index 821e773d..ec8bbc6b 100644 --- a/examples/send_file.rs +++ b/examples/send_file.rs @@ -61,13 +61,11 @@ fn internal_server_error() -> Response { .unwrap() } -async fn simple_file_send(f: &str) -> Result> { +async fn simple_file_send(filename: &str) -> Result> { // Serve a file by asynchronously reading it entirely into memory. // Uses tokio_fs to open file asynchronously, then tokio::io::AsyncReadExt // to read into memory asynchronously. - let filename = f.to_string(); // we need to copy for lifetime issues - if let Ok(mut file) = File::open(filename).await { let mut buf = Vec::new(); if let Ok(_) = file.read_to_end(&mut buf).await {