mirror of
https://github.com/actix/actix-web.git
synced 2025-04-25 11:04:06 +00:00
Add explicit dyn
s
This commit is contained in:
parent
87b7162473
commit
d47a8e0d06
2 changed files with 5 additions and 5 deletions
|
@ -269,9 +269,9 @@ where
|
||||||
.map(|protos| protos.windows(2).any(|w| w == H2))
|
.map(|protos| protos.windows(2).any(|w| w == H2))
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
if h2 {
|
if h2 {
|
||||||
(Box::new(sock) as Box<Io>, Protocol::Http2)
|
(Box::new(sock) as Box<dyn Io>, Protocol::Http2)
|
||||||
} else {
|
} else {
|
||||||
(Box::new(sock) as Box<Io>, Protocol::Http1)
|
(Box::new(sock) as Box<dyn Io>, Protocol::Http1)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
@ -288,9 +288,9 @@ where
|
||||||
.map(|protos| protos.windows(2).any(|w| w == H2))
|
.map(|protos| protos.windows(2).any(|w| w == H2))
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
if h2 {
|
if h2 {
|
||||||
(Box::new(sock) as Box<Io>, Protocol::Http2)
|
(Box::new(sock) as Box<dyn Io>, Protocol::Http2)
|
||||||
} else {
|
} else {
|
||||||
(Box::new(sock) as Box<Io>, Protocol::Http1)
|
(Box::new(sock) as Box<dyn Io>, Protocol::Http1)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1072,7 +1072,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_error_casting() {
|
fn test_error_casting() {
|
||||||
let err = PayloadError::Overflow;
|
let err = PayloadError::Overflow;
|
||||||
let resp_err: &ResponseError = &err;
|
let resp_err: &dyn ResponseError = &err;
|
||||||
let err = resp_err.downcast_ref::<PayloadError>().unwrap();
|
let err = resp_err.downcast_ref::<PayloadError>().unwrap();
|
||||||
assert_eq!(err.to_string(), "A payload reached size limit.");
|
assert_eq!(err.to_string(), "A payload reached size limit.");
|
||||||
let not_err = resp_err.downcast_ref::<ContentTypeError>();
|
let not_err = resp_err.downcast_ref::<ContentTypeError>();
|
||||||
|
|
Loading…
Reference in a new issue