Skip to content

Commit 67b47fd

Browse files
Merge pull request #4 from jtgeibel/fix-warnings
Fix warnings
2 parents e5a2353 + 66fd0f3 commit 67b47fd

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/lib.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use router::{Router, Match};
99
use conduit::{Method, Handler, Request, Response};
1010

1111
pub struct RouteBuilder {
12-
routers: HashMap<Method, Router<Box<Handler>>>,
12+
routers: HashMap<Method, Router<Box<dyn Handler>>>,
1313
}
1414

1515
#[derive(Debug)]
@@ -21,7 +21,7 @@ impl RouteBuilder {
2121
}
2222

2323
pub fn recognize<'a>(&'a self, method: &Method, path: &str)
24-
-> Result<Match<&'a Box<Handler>>,
24+
-> Result<Match<&'a Box<dyn Handler>>,
2525
RouterError>
2626
{
2727
match self.routers.get(method) {
@@ -69,14 +69,14 @@ impl RouteBuilder {
6969
}
7070

7171
impl conduit::Handler for RouteBuilder {
72-
fn call(&self, request: &mut Request) -> Result<Response, Box<Error+Send>> {
72+
fn call(&self, request: &mut dyn Request) -> Result<Response, Box<dyn Error+Send>> {
7373
let m = {
7474
let method = request.method();
7575
let path = request.path();
7676

7777
match self.recognize(&method, path) {
7878
Ok(m) => m,
79-
Err(e) => return Err(Box::new(e) as Box<Error+Send>)
79+
Err(e) => return Err(Box::new(e) as Box<dyn Error+Send>)
8080
}
8181
};
8282

@@ -103,12 +103,12 @@ pub trait RequestParams<'a> {
103103
fn params(self) -> &'a router::Params;
104104
}
105105

106-
pub fn params<'a>(req: &'a Request) -> &'a router::Params {
106+
pub fn params<'a>(req: &'a dyn Request) -> &'a router::Params {
107107
req.extensions().find::<router::Params>()
108108
.expect("Missing params")
109109
}
110110

111-
impl<'a> RequestParams<'a> for &'a (Request + 'a) {
111+
impl<'a> RequestParams<'a> for &'a (dyn Request + 'a) {
112112
fn params(self) -> &'a router::Params {
113113
params(self)
114114
}
@@ -153,8 +153,8 @@ mod tests {
153153
fn query_string<'a>(&'a self) -> Option<&'a str> { unimplemented!() }
154154
fn remote_addr(&self) -> SocketAddr { unimplemented!() }
155155
fn content_length(&self) -> Option<u64> { unimplemented!() }
156-
fn headers<'a>(&'a self) -> &'a Headers { unimplemented!() }
157-
fn body<'a>(&'a mut self) -> &'a mut io::Read { unimplemented!() }
156+
fn headers<'a>(&'a self) -> &'a dyn Headers { unimplemented!() }
157+
fn body<'a>(&'a mut self) -> &'a mut dyn io::Read { unimplemented!() }
158158
fn extensions<'a>(&'a self) -> &'a Extensions {
159159
&self.extensions
160160
}
@@ -201,15 +201,15 @@ mod tests {
201201
router
202202
}
203203

204-
fn test_handler(req: &mut conduit::Request) -> io::Result<conduit::Response> {
204+
fn test_handler(req: &mut dyn conduit::Request) -> io::Result<conduit::Response> {
205205
let mut res = vec!();
206206
res.push(req.params()["id"].clone());
207207
res.push(format!("{:?}", req.method()));
208208

209209
Ok(conduit::Response {
210210
status: (200, "OK"),
211211
headers: HashMap::new(),
212-
body: Box::new(io::Cursor::new(res.connect(", ").into_bytes()))
212+
body: Box::new(io::Cursor::new(res.join(", ").into_bytes()))
213213
})
214214
}
215215
}

0 commit comments

Comments
 (0)