Repository: rustless/rustless (language: rust)

Issue:
Could not compile `queryst`
When I try to cargo run, I get te following fail:

```
Build failed, waiting for other jobs to finish...
error: error writing dependencies to `/Users/milanvanschaik/Development/rust-test/target/debug/deps/plugin-ba6ebe376fbbceb7.d`: Permission denied (os error 13)
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/typeable-0.0.9/src/lib.rs:15:36: 15:54 error: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/typeable-0.0.9/src/lib.rs:15     fn get_type(&self) -> TypeId { TypeId::of::<Self>() }
                                                                                                                                      ^~~~~~~~~~~~~~~~~~
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/typeable-0.0.9/src/lib.rs:15:36: 15:54 note: `Self` does not have a constant size known at compile-time
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/typeable-0.0.9/src/lib.rs:15     fn get_type(&self) -> TypeId { TypeId::of::<Self>() }
                                                                                                                                      ^~~~~~~~~~~~~~~~~~
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/typeable-0.0.9/src/lib.rs:15:36: 15:54 error: the trait `core::marker::Reflect` is not implemented for the type `Self` [E0277]
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/typeable-0.0.9/src/lib.rs:15     fn get_type(&self) -> TypeId { TypeId::of::<Self>() }
                                                                                                                                      ^~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Could not compile `queryst`.
```

My Rust version:

```
rustc 1.0.0-nightly (c89de2c56 2015-03-28) (built 2015-03-28)
```

Seems to fail at queryst which is also a dependency of Rustless. Any idea what is going wrong?

Update:
With rustc 1.0.0-nightly (6cf3b0b74 2015-03-30) (built 2015-03-30) I get the following:

```
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/queryst-0.1.13/src/lib.rs:5:14: 5:31 error: expected ident, found `"rustc-serialize"`
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/queryst-0.1.13/src/lib.rs:5 extern crate "rustc-serialize" as serialize;
                                                                                                               ^~~~~~~~~~~~~~~~~
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/valico-0.7.4/src/lib.rs:8:14: 8:31 error: expected ident, found `"rustc-serialize"`
/Users/milanvanschaik/.cargo/registry/src/github.com-1ecc6299db9ec823/valico-0.7.4/src/lib.rs:8 extern crate "rustc-serialize" as rustc_serialize;
```



Discussion / hints:

Fix patch:
diff --git a/examples/simple.rs b/examples/simple.rs
index cdc040a9..f37b4ec0 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -1,4 +1,3 @@
-#![feature(core)]
 #![feature(plugin)]
 
 #![plugin(dsl_macros)]
@@ -8,7 +7,7 @@ extern crate rustless;
 
 extern crate iron;
 extern crate url;
-extern crate "rustc-serialize" as serialize;
+extern crate rustc_serialize as serialize;
 extern crate valico;
 extern crate cookie;
 
@@ -23,7 +22,7 @@ use rustless::batteries::swagger;
 use rustless::batteries::cookie::CookieExt;
 use rustless::{Nesting};
 
-#[derive(Debug, Copy)]
+#[derive(Debug)]
 pub struct UnauthorizedError;
 
 impl error::Error for UnauthorizedError {
@@ -93,13 +92,13 @@ fn main() {
 
                 match params.find("token") {
                     // We can unwrap() safely because token in validated already
-                    Some(token) => if token.as_string().unwrap().as_slice() == "password1" { return Ok(()) },
+                    Some(token) => if token.as_string().unwrap() == "password1" { return Ok(()) },
                     None => ()
                 }
 
                 // Fire error from callback is token is wrong
                 return Err(rustless::ErrorResponse{
-                    error: Box::new(UnauthorizedError) as Box<Error>,
+                    error: Box::new(UnauthorizedError) as Box<Error + Send>,
                     response: None
                 })
 
diff --git a/src/backend/iron.rs b/src/backend/iron.rs
index cd21369b..6dfa4490 100644
--- a/src/backend/iron.rs
+++ b/src/backend/iron.rs
@@ -18,7 +18,7 @@ pub type HandleResultStrict<T> = Result<T, errors::StrictErrorResponse>;
 pub type HandleResult<T> = Result<T, errors::ErrorResponse>;
 pub type HandleSuccessResult = HandleResult<()>;
 
-impl<'a> request::Body for iron::request::Body<'a> { }
+impl<'a, 'b> request::Body for iron::request::Body<'a, 'b> { }
 
 pub trait WrapUrl {
     fn wrap_url(self) -> Url;
@@ -31,7 +31,7 @@ impl WrapUrl for url::Url {
 }
 
 impl backend::AsUrl for Url {
-    fn scheme(&self) -> &str { self.scheme.as_slice() }
+    fn scheme(&self) -> &str { &self.scheme }
     fn host(&self) -> &url::Host { &self.host }
     fn port(&self) -> &u16 { &self.port }
     fn path(&self) -> &Vec<String> { &self.path }
@@ -41,25 +41,25 @@ impl backend::AsUrl for Url {
     fn fragment(&self) -> &Option<String> { &self.fragment }
 }
 
-impl<'a> backend::Request for iron::Request<'a> {
+impl<'a, 'b> backend::Request for iron::Request<'a, 'b> {
     fn remote_addr(&self) -> &net::SocketAddr { &self.remote_addr }
     fn headers(&self) -> &header::Headers { &self.headers }
     fn method(&self) -> &method::Method { &self.method }
     fn url(&self) -> &backend::AsUrl { &self.url }
     fn body(&self) -> &request::Body { &self.body }
     fn body_mut(&mut self) -> &mut request::Body { &mut self.body }
-    fn read_to_end(&mut self) -> Result<Option<String>, Box<errors::Error>> {
-        self.get::<bodyparser::Raw>().map_err(|err| Box::new(err) as Box<errors::Error>)
+    fn read_to_end(&mut self) -> Result<Option<String>, Box<errors::Error + Send>> {
+        self.get::<bodyparser::Raw>().map_err(|err| Box::new(err) as Box<errors::Error + Send>)
     }
 }
 
-impl<'a>  ::Extensible for iron::Request<'a> {
+impl<'a, 'b>  ::Extensible for iron::Request<'a, 'b> {
     fn ext(&self) -> &::typemap::TypeMap { self.extensions() }
     fn ext_mut(&mut self) -> &mut ::typemap::TypeMap { self.extensions_mut() }
 }
 
 impl Handler for framework::Application {
-    fn handle<'a>(&self, req: &mut iron::Request<'a>) -> iron::IronResult<iron::Response> {
+    fn handle<'a, 'b>(&self, req: &mut iron::Request<'a, 'b>) -> iron::IronResult<iron::Response> {
         self.call(req)
             .map(|resp| {
                 iron::Response {
diff --git a/src/backend/request.rs b/src/backend/request.rs
index 02985249..851b557b 100644
--- a/src/backend/request.rs
+++ b/src/backend/request.rs
@@ -32,7 +32,7 @@ pub trait Request: fmt::Debug + ::Extensible {
     fn body(&self) -> &Body;
     fn body_mut(&mut self) -> &mut Body;
 
-    fn read_to_end(&mut self) -> Result<Option<String>, Box<errors::Error>>;
+    fn read_to_end(&mut self) -> Result<Option<String>, Box<errors::Error + Send>>;
 
     fn is_json_body(&self) -> bool {
         self.headers().get::<header::ContentType>().map_or(false, |ct| media::is_json(&ct.0))
diff --git a/src/backend/simple_request.rs b/src/backend/simple_request.rs
index 50611d06..abeb97e6 100644
--- a/src/backend/simple_request.rs
+++ b/src/backend/simple_request.rs
@@ -49,12 +49,12 @@ impl<'a> Request for SimpleRequest {
         return &mut self.body;
     }
 
-    fn read_to_end(&mut self) -> Result<Option<String>, Box<errors::Error>> {
+    fn read_to_end(&mut self) -> Result<Option<String>, Box<errors::Error + Send>> {
         let mut bytes = Vec::new();
         self.body.read_to_end(&mut bytes).unwrap();
         String::from_utf8(bytes)
             .map(|body| Some(body))
-            .map_err(|err| Box::new(err) as Box<errors::Error>)
+            .map_err(|err| Box::new(err) as Box<errors::Error + Send>)
     }
 }
 
diff --git a/src/batteries/cookie.rs b/src/batteries/cookie.rs
index 2dbcc433..b66b9e7d 100644
--- a/src/batteries/cookie.rs
+++ b/src/batteries/cookie.rs
@@ -35,7 +35,7 @@ pub struct CookieDecodeMiddleware {
 
 impl iron::BeforeMiddleware for CookieDecodeMiddleware {
     fn before(&self, req: &mut iron::Request) -> iron::IronResult<()> {
-        let token = self.secret_token.as_slice();
+        let token = &self.secret_token;
         let jar = req.headers().get::<header::Cookie>()
             .map(|cookies| cookies.to_cookie_jar(token))
             .unwrap_or_else(|| cookie::CookieJar::new(token));
diff --git a/src/batteries/schemes.rs b/src/batteries/schemes.rs
index deaf46d4..7ec35d37 100644
--- a/src/batteries/schemes.rs
+++ b/src/batteries/schemes.rs
@@ -10,7 +10,8 @@ impl typemap::Key for SchemesScope {
 }
 
 fn build_schemes(handlers: &mut framework::ApiHandlers, scope: &mut json_schema::Scope) -> Result<(), json_schema::SchemaError> {
-    for handler in handlers.iter_mut() {
+    for handler_ in handlers.iter_mut() {
+        let mut handler = &mut **handler_ as &mut framework::ApiHandler;
         if handler.is::<framework::Api>() {
             let api = handler.downcast_mut::<framework::Api>().unwrap();
             try!(build_schemes(&mut api.handlers, scope))
diff --git a/src/batteries/swagger.rs b/src/batteries/swagger.rs
index d870f9bd..a6db5873 100644
--- a/src/batteries/swagger.rs
+++ b/src/batteries/swagger.rs
@@ -3,12 +3,11 @@ use valico::json_dsl;
 use collections;
 use serialize::json::{self, ToJson};
 use jsonway::{self, MutableJson};
-use framework::{self, Nesting};
+use framework::{self, Nesting, ApiHandler};
 use server::mime;
 use server::header;
 use server::method;
 
-#[derive(Copy)]
 #[allow(dead_code)]
 /// The transfer protocol for the operation. Values MUST be from the list: "http", "https", "ws", "wss".
 /// The value overrides the Swagger Object schemes definition.
@@ -204,7 +203,6 @@ impl json::ToJson for Param {
     }
 }
 
-#[derive(Copy)]
 pub struct SwaggerSpecKey;
 impl ::typemap::Key for SwaggerSpecKey {
     type Value = json::Json;
@@ -293,7 +291,7 @@ pub fn build_spec(app: &framework::Application, spec: Spec) -> json::Json {
 
             let mut base_path = "/".to_string();
             if app.root_api.prefix.is_some() {
-                base_path.push_str(app.root_api.prefix.as_ref().unwrap().as_slice());
+                base_path.push_str(&app.root_api.prefix.as_ref().unwrap());
             }
             if app.root_api.version.is_some() {
                 match app.root_api.version.as_ref().unwrap() {
@@ -301,7 +299,7 @@ pub fn build_spec(app: &framework::Application, spec: Spec) -> json::Json {
                         if base_path.len() > 1 {
                             base_path.push_str("/")
                         }
-                        base_path.push_str(version.as_slice());
+                        base_path.push_str(&version);
                     },
                     _ => ()
                 }
@@ -409,7 +407,7 @@ pub fn create_api(path: &str) -> framework::Api {
             docs.get("", |endpoint| {
                 endpoint.summary("Get Swagger 2.0 specification of this API");
                 endpoint.handle(|mut client, _params| {
-                    client.set_header(header::AccessControlAllowOrigin::AllowStar);
+                    client.set_header(header::AccessControlAllowOrigin::Any);
                     let swagger_spec = client.app.ext.get::<SwaggerSpecKey>();
                     if swagger_spec.is_some() {
                         client.json(swagger_spec.unwrap())
@@ -430,19 +428,20 @@ struct WalkContext<'a> {
 
 /// Walks through the tree and collects the info about Endpoints
 fn fill_paths<'a>(mut context: WalkContext<'a>, paths: &mut jsonway::ObjectBuilder, handlers: &framework::ApiHandlers) {
-    for handler in handlers.iter() {
+    for handler_ in handlers.iter() {
+        let handler = &**handler_ as &framework::ApiHandler;
         if handler.is::<framework::Api>() {
             let mut path = context.path.to_string();
 
             let api = handler.downcast_ref::<framework::Api>().unwrap();
             if api.prefix.is_some() {
-                path.push_str(api.prefix.as_ref().unwrap().as_slice());
+                path.push_str(&api.prefix.as_ref().unwrap());
             }
 
             if api.version.is_some() {
                 match api.version.as_ref().unwrap() {
                     &framework::Version{ref version, versioning: framework::Versioning::Path} => {
-                        path.push_str(version.as_slice());
+                        path.push_str(&version);
                         path.push_str("/");
                     },
                     _ => ()
@@ -450,7 +449,7 @@ fn fill_paths<'a>(mut context: WalkContext<'a>, paths: &mut jsonway::ObjectBuild
             }
 
             fill_paths(WalkContext{
-                path: path.as_slice(),
+                path: &path,
                 params: context.params.clone()
             }, paths, &api.handlers);
 
@@ -458,13 +457,13 @@ fn fill_paths<'a>(mut context: WalkContext<'a>, paths: &mut jsonway::ObjectBuild
 
             let mut path = context.path.to_string();
             let namespace = handler.downcast_ref::<framework::Namespace>().unwrap();
-            path.push_str(("/".to_string() + encode_path_string(&namespace.path).as_slice()).as_slice());
+            path.push_str(&("/".to_string() + &encode_path_string(&namespace.path)));
 
             let mut params = context.params.clone();
             params.append(&mut extract_params(&namespace.coercer, &namespace.path));
 
             fill_paths(WalkContext{
-                path: path.as_slice(),
+                path: &path,
                 params: params,
             }, paths, &namespace.handlers);
 
@@ -473,14 +472,14 @@ fn fill_paths<'a>(mut context: WalkContext<'a>, paths: &mut jsonway::ObjectBuild
             let endpoint = handler.downcast_ref::<framework::Endpoint>().unwrap();
 
             if endpoint.path.path.len() > 0 {
-                path.push_str(("/".to_string() + encode_path_string(&endpoint.path).as_slice()).as_slice());
+                path.push_str(&("/".to_string() + &encode_path_string(&endpoint.path)));
             }
 
             let definition = build_endpoint_definition(endpoint, &mut context);
 
             let method = format!("{:?}", endpoint.method).to_ascii_lowercase();
             let exists = {
-                let maybe_path_obj = paths.object.get_mut(path.as_slice());
+                let maybe_path_obj = paths.object.get_mut(&path);
                 if maybe_path_obj.is_some() {
                     let path_obj = maybe_path_obj.unwrap().as_object_mut().unwrap();
                     path_obj.insert(method.to_string(), definition.to_json());
@@ -491,7 +490,7 @@ fn fill_paths<'a>(mut context: WalkContext<'a>, paths: &mut jsonway::ObjectBuild
             };
 
             if !exists {
-                paths.object(path.as_slice(), |path_item| {
+                paths.object(&path, |path_item| {
                     path_item.set(method.clone(), definition.to_json());
                     path_item.array("parameters", |parameters| {
                         for param in context.params.iter() {
@@ -639,7 +638,7 @@ fn build_endpoint_definition(endpoint: &framework::Endpoint, context: &mut WalkC
 /// Encodes path string to Swagger 2.0 format (e.g. '/user/:user_id' becomes '/user/{user_id}')
 fn encode_path_string(path: &framework::Path) -> String {
     let ref original_path = path.path;
-    return framework::path::MATCHER.replace_all(original_path.as_slice(), "{$1}");
+    return framework::path::MATCHER.replace_all(&original_path, "{$1}");
 }
 
 /// Converts `valico::Param` into Swagger's ParamType
diff --git a/src/errors.rs b/src/errors.rs
index 72662c51..6b1f03ab 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -6,18 +6,18 @@ use valico;
 use super::backend;
 
 pub struct ErrorResponse {
-    pub error: Box<Error>,
+    pub error: Box<Error + Send>,
     pub response: Option<backend::Response>
 }
 
 pub struct StrictErrorResponse {
-    pub error: Box<Error>,
+    pub error: Box<Error + Send>,
     pub response: backend::Response
 }
 
 macro_rules! error_response{
     ($error:expr) => ($crate::errors::ErrorResponse{
-        error: Box::new($error) as Box<$crate::errors::Error>,
+        error: Box::new($error) as Box<$crate::errors::Error + Send>,
         response: None
     })
 }
@@ -46,15 +46,15 @@ macro_rules! impl_basic_err {
     }
 }
 
-#[derive(Debug, Copy)]
+#[derive(Debug)]
 pub struct NotMatch;
 impl_basic_err!(NotMatch, "NotMatch");
 
-#[derive(Debug, Copy)]
+#[derive(Debug)]
 pub struct NotFound;
 impl_basic_err!(NotFound, "NotFound");
 
-#[derive(Debug, Copy)]
+#[derive(Debug)]
 pub struct QueryString;
 impl_basic_err!(QueryString, "QueryString");
 
@@ -82,6 +82,6 @@ impl_basic_err!(Body, "Body");
 pub struct File(pub io::Error);
 impl_basic_err!(File, "File");
 
-#[derive(Debug, Copy)]
+#[derive(Debug)]
 pub struct NotAcceptable;
 impl_basic_err!(NotAcceptable, "NotAcceptable");
diff --git a/src/framework/api.rs b/src/framework/api.rs
index f9bb136f..cfbd2373 100644
--- a/src/framework/api.rs
+++ b/src/framework/api.rs
@@ -84,11 +84,11 @@ impl Api {
     }
 
     pub fn error_formatter<F: 'static>(&mut self, formatter: F)
-    where F: Fn(&Box<Error + 'static>, &media::Media) -> Option<backend::Response> + Send+Sync {
+    where F: Fn(&errors::Error, &media::Media) -> Option<backend::Response> + Send+Sync {
         self.error_formatters.push(Box::new(formatter));
     }
 
-    fn handle_error(&self, err: &Box<Error>, media: &media::Media) -> Option<backend::Response>  {
+    fn handle_error(&self, err: &errors::Error, media: &media::Media) -> Option<backend::Response>  {
         for err_formatter in self.error_formatters.iter() {
             match err_formatter(err, media) {
                 Some(resp) => return Some(resp),
@@ -123,7 +123,7 @@ impl framework::ApiHandler for Api {
         // Check prefix
         let mut rest_path = match self.prefix.as_ref() {
             Some(prefix) => {
-                if rest_path.starts_with(prefix.as_slice()) {
+                if rest_path.starts_with(&prefix[..]) {
                     path::normalize(&rest_path[(prefix.len())..])
                 } else {
                    return Err(error_response!(errors::NotMatch))
@@ -142,7 +142,7 @@ impl framework::ApiHandler for Api {
 
             match versioning {
                 &Versioning::Path => {
-                    if rest_path.starts_with(version.as_slice()) {
+                    if rest_path.starts_with(&version[..]) {
                         rest_path = path::normalize(&rest_path[(version.len())..])
                     } else {
                        return Err(error_response!(errors::NotMatch))
@@ -150,7 +150,7 @@ impl framework::ApiHandler for Api {
                 },
                 &Versioning::Param(ref param_name) => {
                     match params.find(param_name) {
-                        Some(obj) if obj.is_string() && obj.as_string().unwrap() == version.as_slice() => (),
+                        Some(obj) if obj.is_string() && obj.as_string().unwrap() == &version[..] => (),
                         _ => return Err(error_response!(errors::NotMatch))
                     }
                 },
@@ -162,7 +162,7 @@ impl framework::ApiHandler for Api {
                             for qual in quals.iter() {
                                 match media::Media::from_vendor(&qual.item) {
                                     Some(media) => {
-                                        if media.vendor.as_slice() == *vendor &&
+                                        if &media.vendor[..] == *vendor &&
                                            media.version.is_some() &&
                                            media.version.as_ref().unwrap() == version {
                                             matched_media = Some(media);
@@ -200,7 +200,7 @@ impl framework::ApiHandler for Api {
             if err_resp.response.is_some() {
                 err_resp
             } else {
-                let resp = self.handle_error(&err_resp.error, &self.extract_media(req).unwrap_or_else(|| media::Media::default()));
+                let resp = self.handle_error(&*err_resp.error, &self.extract_media(req).unwrap_or_else(|| media::Media::default()));
                 errors::ErrorResponse {
                     error: err_resp.error,
                     response: resp
diff --git a/src/framework/app.rs b/src/framework/app.rs
index a7a3dba6..a7804866 100644
--- a/src/framework/app.rs
+++ b/src/framework/app.rs
@@ -31,7 +31,7 @@ impl Application {
         let parse_result = parse_request(req, &mut params);
 
         parse_result.and_then(|_| {
-            self.root_api.api_call((req.url().path().connect("/").as_slice()).as_slice(), &mut params, req, &mut super::CallInfo::new(self))
+            self.root_api.api_call(&(req.url().path().connect("/")), &mut params, req, &mut super::CallInfo::new(self))
         })
     }
 
@@ -48,11 +48,11 @@ impl Application {
                     let errors::ErrorResponse{error, ..} = error_response;
 
                     // Simple default error responses for common errors
-                    let response = if error.is::<errors::NotMatch>() {
+                    let response = if (&*error as &errors::Error).is::<errors::NotMatch>() {
                         backend::Response::new(
                             status::StatusCode::NotFound
                         )
-                    } else if error.is::<errors::Validation>() {
+                    } else if (&*error as &errors::Error).is::<errors::Validation>() {
                         backend::Response::new(
                             status::StatusCode::BadRequest
                         )
@@ -126,7 +126,7 @@ fn parse_urlencoded_body(req: &mut backend::Request, params: &mut json::Json) ->
         .unwrap_or(String::new());
 
     if maybe_body.len() > 0 {
-        let maybe_json_body = queryst::parse(maybe_body.as_slice());
+        let maybe_json_body = queryst::parse(&maybe_body);
         match maybe_json_body {
             Ok(json_body) => {
                 let params = params.as_object_mut().expect("Params must be object");
@@ -150,7 +150,7 @@ fn parse_urlencoded_body(req: &mut backend::Request, params: &mut json::Json) ->
 fn parse_request(req: &mut backend::Request, params: &mut json::Json) -> backend::HandleSuccessResult {
     // extend params with query-string params if any
     if req.url().query().is_some() {
-        try!(parse_query(req.url().query().as_ref().unwrap().as_slice(), params));
+        try!(parse_query(&req.url().query().as_ref().unwrap(), params));
     }
 
     // extend params with json-encoded body params if any
diff --git a/src/framework/media.rs b/src/framework/media.rs
index b4c748e7..d4cbab2e 100644
--- a/src/framework/media.rs
+++ b/src/framework/media.rs
@@ -67,7 +67,7 @@ impl Media {
     pub fn from_vendor(mime: &mime::Mime) -> Option<Media> {
         match mime {
             &mime::Mime(mime::TopLevel::Application, mime::SubLevel::Ext(ref ext), _) => {
-                match MEDIA_REGEX.captures(ext.as_slice()) {
+                match MEDIA_REGEX.captures(&ext) {
                     Some(captures) => {
                         let vendor = captures.name("vendor");
                         let version = captures.name("version").map(|s| s.to_string());
@@ -75,8 +75,8 @@ impl Media {
                         let format_str = captures.name("format").map(|s| s.to_string());
 
                         let format = match format_str {
-                            Some(format) => if format.as_slice() == "json" { Format::JsonFormat }
-                                            else if format.as_slice() == "txt" { Format::PlainTextFormat }
+                            Some(format) => if &format == "json" { Format::JsonFormat }
+                                            else if &format == "txt" { Format::PlainTextFormat }
                                             else { Format::from_mime(mime) },
                             None => Format::from_mime(mime)
                         };
diff --git a/src/framework/mod.rs b/src/framework/mod.rs
index fcdc0bcb..a21bfe2e 100644
--- a/src/framework/mod.rs
+++ b/src/framework/mod.rs
@@ -39,7 +39,7 @@ pub type ApiHandlers = Vec<Box<ApiHandler + Send + Sync>>;
 pub type Callback = Box<for<'a> Fn(&'a mut client::Client, &json::Json) -> backend::HandleSuccessResult + 'static + Sync + Send>;
 pub type Callbacks = Vec<Callback>;
 
-pub type ErrorFormatter = Box<Fn(&Box<errors::Error + 'static>, &media::Media) -> Option<backend::Response> + 'static + Sync + Send>;
+pub type ErrorFormatter = Box<Fn(&errors::Error, &media::Media) -> Option<backend::Response> + 'static + Sync + Send>;
 pub type ErrorFormatters = Vec<ErrorFormatter>;
 
 impl<'a> CallInfo<'a> {
diff --git a/src/framework/nesting.rs b/src/framework/nesting.rs
index 306cbad0..81c2fc4e 100644
--- a/src/framework/nesting.rs
+++ b/src/framework/nesting.rs
@@ -135,7 +135,7 @@ pub trait Nesting: Node {
             match handler.api_call(rest_path, params, req, info) {
                 Ok(response) => return Ok(response),
                 Err(error_response) => {
-                    if !error_response.error.is::<errors::NotMatch>() {
+                    if !errors::Error::is::<errors::NotMatch>(&*error_response.error) {
                         return Err(error_response)
                     }
                 }
diff --git a/src/framework/path.rs b/src/framework/path.rs
index 8a95fc2a..a92fe5af 100644
--- a/src/framework/path.rs
+++ b/src/framework/path.rs
@@ -23,7 +23,7 @@ impl Path {
     pub fn apply_captures(&self, params: &mut json::Json, captures: regex::Captures) {
         let obj = params.as_object_mut().expect("Params must be object");
         for param in self.params.iter() {
-            obj.insert(param.clone(), captures.name(param.as_slice()).unwrap_or("").to_string().to_json());
+            obj.insert(param.clone(), captures.name(&param).unwrap_or("").to_string().to_json());
         }
     }
 
@@ -32,13 +32,13 @@ impl Path {
     }
 
     pub fn parse(path: &str, endpoint: bool) -> Result<Path,String> {
-        let mut regex_body = "^".to_string() + Path::sub_regex(path).as_slice();
+        let mut regex_body = "^".to_string() + &Path::sub_regex(path);
 
         if endpoint {
             regex_body = regex_body + "$";
         }
 
-        let regex = match regex::Regex::new(regex_body.as_slice()) {
+        let regex = match regex::Regex::new(&regex_body) {
             Ok(re) => re,
             Err(err) => return Err(format!("{}", err))
         };
@@ -71,7 +71,7 @@ fn it_normalize() {
 #[test]
 fn sub_regex() {
     let res = Path::sub_regex(":user_id/messages/:message_id");
-    assert_eq!(res.as_slice(), "(?P<user_id>[^/?&]+)/messages/(?P<message_id>[^/?&]+)")
+    assert_eq!(&res, "(?P<user_id>[^/?&]+)/messages/(?P<message_id>[^/?&]+)")
 }
 
 #[test]
diff --git a/src/lib.rs b/src/lib.rs
index 08982c73..e12a422d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,9 +3,6 @@
 #![feature(plugin)]
 #![feature(collections)]
 #![feature(core)]
-#![feature(io)]
-#![feature(net)]
-#![feature(path)]
 // #![deny(warnings)]
 #![deny(bad_style)]
 
@@ -13,7 +10,7 @@
 
 extern crate regex;
 extern crate hyper;
-extern crate "rustc-serialize" as serialize;
+extern crate rustc_serialize as serialize;
 extern crate url;
 extern crate error;
 extern crate cookie;


Test patch:
diff --git a/tests/callbacks.rs b/tests/callbacks.rs
index 873aa7a7..9c540065 100644
--- a/tests/callbacks.rs
+++ b/tests/callbacks.rs
@@ -45,13 +45,13 @@ fn it_invokes_callbacks() {
             admin_ns.after_validation(|_client, params| {
                 match params.find(&"token".to_string()) {
                     // We can.unwrap() safely because token in validated already
-                    Some(token) => if token.as_string().unwrap().as_slice() == "password1" { return Ok(()) },
+                    Some(token) => if token.as_string().unwrap() == "password1" { return Ok(()) },
                     None => ()
                 }
 
                 // Fire error from callback is token is wrong
                 return Err(rustless::ErrorResponse{
-                    error: Box::new(UnauthorizedError) as Box<Error>,
+                    error: Box::new(UnauthorizedError) as Box<Error + Send>,
                     response: None
                 })
             });
diff --git a/tests/redirect.rs b/tests/redirect.rs
index 49de25df..fe7f1007 100644
--- a/tests/redirect.rs
+++ b/tests/redirect.rs
@@ -17,7 +17,7 @@ fn it_allows_redirect() {
     let response = call_app!(app, Post, "http://127.0.0.1:3000/api/redirect_me/google.com").ok().unwrap();
     assert_eq!(response.status, status::StatusCode::Found);
     let &header::Location(ref location) = response.headers.get::<header::Location>().unwrap();
-    assert_eq!(location.as_slice(), "google.com")
+    assert_eq!(location, "google.com")
 
 }
 
@@ -36,6 +36,6 @@ fn it_allows_permanent_redirect() {
     let response = call_app!(app, Post, "http://127.0.0.1:3000/api/redirect_me/google.com").ok().unwrap();
     assert_eq!(response.status, status::StatusCode::MovedPermanently);
     let &header::Location(ref location) = response.headers.get::<header::Location>().unwrap();
-    assert_eq!(location.as_slice(), "google.com")
+    assert_eq!(location, "google.com")
 
 }
\ No newline at end of file
diff --git a/tests/tests.rs b/tests/tests.rs
index bd895cc9..2fcd3852 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -1,12 +1,10 @@
 // #![deny(warnings)]
 #![deny(bad_style)]
-#![feature(core)]
-#![feature(io)]
 
 #[macro_use]
 extern crate rustless;
 extern crate hyper;
-extern crate "rustc-serialize" as serialize;
+extern crate rustc_serialize as serialize;
 extern crate url;
 extern crate valico;
 extern crate jsonway;