1
0
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:
Sven-Hendrik Haase
2019-07-29 12:44:00 +02:00
parent 16b8702252
commit 0ff37e7454
5 changed files with 6 additions and 6 deletions

View File

@ -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 {

View File

@ -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!"))
}