Skip to content

Commit b8b3f48

Browse files
committed
Update to rust master
1 parent 24662f9 commit b8b3f48

17 files changed

+129
-128
lines changed

Cargo.lock

Lines changed: 35 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub trait RequestApp<'a> {
7575
fn app(self) -> &'a Arc<App>;
7676
}
7777

78-
impl<'a> RequestApp<'a> for &'a Request + 'a {
78+
impl<'a> RequestApp<'a> for &'a (Request + 'a) {
7979
fn app(self) -> &'a Arc<App> {
8080
self.extensions().find::<Arc<App>>()
8181
.expect("Missing app")

src/bin/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ fn main() {
3333

3434
let heroku = os::getenv("HEROKU").is_some();
3535
let cargo_env = if heroku {
36-
cargo_registry::Production
36+
cargo_registry::Env::Production
3737
} else {
38-
cargo_registry::Development
38+
cargo_registry::Env::Development
3939
};
4040
let config = cargo_registry::Config {
4141
s3_bucket: env("S3_BUCKET"),

src/db.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl Transaction {
8080
Ok(&**self.slot.borrow().unwrap())
8181
}
8282

83-
fn tx<'a>(&'a self) -> CargoResult<&'a Connection + 'a> {
83+
fn tx<'a>(&'a self) -> CargoResult<&'a (Connection + 'a)> {
8484
// Similar to above, the transaction for this request is actually tied
8585
// to the connection in the request itself, not 'static. We transmute it
8686
// to static as its paired with the inner connection to achieve the
@@ -137,22 +137,22 @@ pub trait RequestTransaction<'a> {
137137
///
138138
/// The transaction will live for the duration of the request, and it will
139139
/// only be set to commit() if a successful response code of 200 is seen.
140-
fn tx(self) -> CargoResult<&'a Connection + 'a>;
140+
fn tx(self) -> CargoResult<&'a (Connection + 'a)>;
141141

142142
/// Flag the transaction to not be committed
143143
fn rollback(self);
144144
/// Flag this transaction to be committed
145145
fn commit(self);
146146
}
147147

148-
impl<'a> RequestTransaction<'a> for &'a Request + 'a {
148+
impl<'a> RequestTransaction<'a> for &'a (Request + 'a) {
149149
fn db_conn(self) -> CargoResult<&'a pg::Connection> {
150150
self.extensions().find::<Transaction>()
151151
.expect("Transaction not present in request")
152152
.conn()
153153
}
154154

155-
fn tx(self) -> CargoResult<&'a Connection + 'a> {
155+
fn tx(self) -> CargoResult<&'a (Connection + 'a)> {
156156
self.extensions().find::<Transaction>()
157157
.expect("Transaction not present in request")
158158
.tx()

src/git.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ fn commit_and_push(repo: &git2::Repository,
235235
try!(origin.fetch(None, None));
236236
let head = try!(repo.head()).target().unwrap();
237237
let obj = try!(repo.find_object(head, None));
238-
try!(repo.reset(&obj, git2::Hard, None, None));
238+
try!(repo.reset(&obj, git2::ResetType::Hard, None, None));
239239
}
240240

241241
Err(internal("Too many rebase failures"))

src/s3/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl Bucket {
7878
headers = "",
7979
resource = format!("/{}/{}", self.name, path));
8080
let signature = {
81-
let mut hmac = hmac::HMAC(hash::SHA1, self.secret_key.as_bytes());
81+
let mut hmac = hmac::HMAC(hash::HashType::SHA1, self.secret_key.as_bytes());
8282
hmac.update(string.as_bytes());
8383
hmac.finalize().as_slice().to_base64(STANDARD)
8484
};

src/tests/all.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::io::Command;
1717
use std::io::process::InheritFd;
1818
use std::os;
1919
use std::sync::{Once, ONCE_INIT, Arc};
20-
use serialize::json;
20+
use serialize::json::{mod, Json};
2121

2222
use conduit::Request;
2323
use conduit_test::MockRequest;
@@ -81,7 +81,7 @@ fn app() -> (record::Bomb, Arc<App>, conduit_middleware::MiddlewareBuilder) {
8181
gh_client_id: "".to_string(),
8282
gh_client_secret: "".to_string(),
8383
db_url: env("TEST_DATABASE_URL"),
84-
env: cargo_registry::Test,
84+
env: cargo_registry::Env::Test,
8585
max_upload_size: 1000,
8686
};
8787
unsafe { INIT.doit(|| db_setup(config.db_url.as_slice())); }
@@ -150,10 +150,10 @@ fn json<T>(r: &mut conduit::Response) -> T
150150
};
151151

152152

153-
fn fixup(json: json::Json) -> json::Json {
153+
fn fixup(json: Json) -> Json {
154154
match json {
155-
json::Object(object) => {
156-
json::Object(object.into_iter().map(|(k, v)| {
155+
Json::Object(object) => {
156+
Json::Object(object.into_iter().map(|(k, v)| {
157157
let k = if k.as_slice() == "crate" {
158158
"krate".to_string()
159159
} else {
@@ -162,8 +162,8 @@ fn json<T>(r: &mut conduit::Response) -> T
162162
(k, fixup(v))
163163
}).collect())
164164
}
165-
json::Array(list) => {
166-
json::Array(list.into_iter().map(fixup).collect())
165+
Json::Array(list) => {
166+
Json::Array(list.into_iter().map(fixup).collect())
167167
}
168168
j => j,
169169
}

src/tests/keyword.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use serialize::Decoder;
22

3-
use conduit::{mod, Handler, Request};
3+
use conduit::{Handler, Request, Method};
44
use conduit_test::MockRequest;
55

66
use cargo_registry::db::{RequestTransaction, Connection};
@@ -16,7 +16,7 @@ struct GoodKeyword { keyword: EncodableKeyword }
1616
#[test]
1717
fn index() {
1818
let (_b, app, middle) = ::app();
19-
let mut req = ::req(app, conduit::Get, "/api/v1/keywords");
19+
let mut req = ::req(app, Method::Get, "/api/v1/keywords");
2020
let mut response = ok_resp!(middle.call(&mut req));
2121
let json: KeywordList = ::json(&mut response);
2222
assert_eq!(json.keywords.len(), 0);
@@ -33,7 +33,7 @@ fn index() {
3333
#[test]
3434
fn show() {
3535
let (_b, app, middle) = ::app();
36-
let mut req = ::req(app, conduit::Get, "/api/v1/keywords/foo");
36+
let mut req = ::req(app, Method::Get, "/api/v1/keywords/foo");
3737
let response = t_resp!(middle.call(&mut req));
3838
assert_eq!(response.status.val0(), 404);
3939

@@ -48,7 +48,7 @@ fn tx(req: &Request) -> &Connection { req.tx().unwrap() }
4848
#[test]
4949
fn update_crate() {
5050
let (_b, app, middle) = ::app();
51-
let mut req = ::req(app, conduit::Get, "/api/v1/keywords/foo");
51+
let mut req = ::req(app, Method::Get, "/api/v1/keywords/foo");
5252
let cnt = |req: &mut MockRequest, kw: &str| {
5353
req.with_path(format!("/api/v1/keywords/{}", kw).as_slice());
5454
let mut response = ok_resp!(middle.call(req));

0 commit comments

Comments
 (0)