Skip to content

Commit 854a6ae

Browse files
authored
refactor(swarm): update ConnectionDenied::new
This allows us to input `String`'s and `&str` on ConnectionDenied::new() as there's [`From<String> for Box<dyn Error + Send + Sync>`](https://doc.rust-lang.org/std/error/trait.Error.html#impl-From%3CString%3E-for-Box%3Cdyn+Error+%2B+Send+%2B+Sync,+Global%3E). Pull-Request: #4530.
1 parent efea490 commit 854a6ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

swarm/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,9 +1728,9 @@ pub struct ConnectionDenied {
17281728
}
17291729

17301730
impl ConnectionDenied {
1731-
pub fn new(cause: impl error::Error + Send + Sync + 'static) -> Self {
1731+
pub fn new(cause: impl Into<Box<dyn error::Error + Send + Sync + 'static>>) -> Self {
17321732
Self {
1733-
inner: Box::new(cause),
1733+
inner: cause.into(),
17341734
}
17351735
}
17361736

0 commit comments

Comments
 (0)