fix build on recent rust: use unwrap on encode

This commit is contained in:
Сухарик 2015-01-24 01:55:25 +03:00
parent 213afc02dc
commit 95b426262f

View file

@ -105,7 +105,7 @@ impl Registry {
}
pub fn add_owners(&mut self, krate: &str, owners: &[&str]) -> Result<()> {
let body = json::encode(&OwnersReq { users: owners });
let body = json::encode(&OwnersReq { users: owners }).unwrap();
let body = try!(self.put(format!("/crates/{}/owners", krate),
body.as_bytes()));
assert!(json::decode::<R>(body.as_slice()).unwrap().ok);
@ -113,7 +113,7 @@ impl Registry {
}
pub fn remove_owners(&mut self, krate: &str, owners: &[&str]) -> Result<()> {
let body = json::encode(&OwnersReq { users: owners });
let body = json::encode(&OwnersReq { users: owners }).unwrap();
let body = try!(self.delete(format!("/crates/{}/owners", krate),
Some(body.as_bytes())));
assert!(json::decode::<R>(body.as_slice()).unwrap().ok);
@ -126,7 +126,7 @@ impl Registry {
}
pub fn publish(&mut self, krate: &NewCrate, tarball: &Path) -> Result<()> {
let json = json::encode(krate);
let json = json::encode(krate).unwrap();
// Prepare the body. The format of the upload request is:
//
// <le u32 of json>