mirror of
https://github.com/actix/actix-website
synced 2025-06-27 15:39:02 +02:00
Add dyn keyword to get rid of some warnings
This commit is contained in:
@ -6,7 +6,7 @@ fn is_error() -> bool {
|
||||
use actix_web::{error, Error, HttpResponse};
|
||||
use futures::future::{result, Future};
|
||||
|
||||
fn index() -> Result<Box<Future<Item = HttpResponse, Error = Error>>, Error> {
|
||||
fn index() -> Result<Box<dyn Future<Item = HttpResponse, Error = Error>>, Error> {
|
||||
if is_error() {
|
||||
Err(error::ErrorBadRequest("bad request"))
|
||||
} else {
|
||||
|
@ -4,13 +4,13 @@ pub mod stream;
|
||||
use actix_web::{Error, HttpResponse};
|
||||
use futures::future::{ok, Future};
|
||||
|
||||
fn index() -> Box<Future<Item = HttpResponse, Error = Error>> {
|
||||
fn index() -> Box<dyn Future<Item = HttpResponse, Error = Error>> {
|
||||
Box::new(ok::<_, Error>(
|
||||
HttpResponse::Ok().content_type("text/html").body("Hello!"),
|
||||
))
|
||||
}
|
||||
|
||||
fn index2() -> Box<Future<Item = &'static str, Error = Error>> {
|
||||
fn index2() -> Box<dyn Future<Item = &'static str, Error = Error>> {
|
||||
Box::new(ok::<_, Error>("Welcome!"))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user