1
0
mirror of https://github.com/actix/actix-website synced 2025-01-22 16:15:56 +01:00

Merge pull request #103 from svenstaro/add-dyn-to-traits

Add dyn keyword to get rid of some warnings
This commit is contained in:
Sven-Hendrik Haase 2019-07-30 19:08:48 +02:00 committed by GitHub
commit a03b91023c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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!"))
}

View File

@ -3,7 +3,7 @@ use actix_web::{Either, Error, HttpResponse};
use futures::future::{ok, Future};
type RegisterResult =
Either<HttpResponse, Box<Future<Item = HttpResponse, Error = Error>>>;
Either<HttpResponse, Box<dyn Future<Item = HttpResponse, Error = Error>>>;
fn index() -> RegisterResult {
if is_a_variant() {

View File

@ -50,7 +50,7 @@ where
type Request = ServiceRequest;
type Response = ServiceResponse<B>;
type Error = Error;
type Future = Box<Future<Item = Self::Response, Error = Self::Error>>;
type Future = Box<dyn Future<Item = Self::Response, Error = Self::Error>>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
self.service.poll_ready()

View File

@ -2,7 +2,7 @@
use actix_web::{error, web, Error, HttpResponse};
use futures::{future::result, Future, Stream};
pub fn index(payload: web::Payload) -> Box<Future<Item = HttpResponse, Error = Error>> {
pub fn index(payload: web::Payload) -> Box<dyn Future<Item = HttpResponse, Error = Error>> {
Box::new(
payload
.from_err()