Skip to content

Commit 253037d

Browse files
committed
UFCS is a thing now
1 parent c0a948c commit 253037d

File tree

8 files changed

+3
-30
lines changed

8 files changed

+3
-30
lines changed

src/bin/update-downloads.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ mod test {
135135
use postgres;
136136
use semver;
137137

138-
use cargo_registry::{Version, Crate, User};
138+
use cargo_registry::{Version, Crate, User, Model};
139139

140140
fn conn() -> postgres::Connection {
141141
postgres::Connection::connect(&::env("TEST_DATABASE_URL")[..],

src/download.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
use pg::GenericConnection;
21
use pg::rows::Row;
32
use time::Timespec;
43

54
use Model;
6-
use util::CargoResult;
75

86
pub struct VersionDownload {
97
pub id: i32,
@@ -22,11 +20,6 @@ pub struct EncodableVersionDownload {
2220
}
2321

2422
impl VersionDownload {
25-
pub fn find(conn: &GenericConnection,
26-
id: i32) -> CargoResult<VersionDownload> {
27-
Model::find(conn, id)
28-
}
29-
3023
pub fn encodable(self) -> EncodableVersionDownload {
3124
let VersionDownload { id, version_id, downloads, counted: _,
3225
date } = self;
@@ -60,12 +53,6 @@ pub struct CrateDownload {
6053
pub date: Timespec,
6154
}
6255

63-
impl CrateDownload {
64-
pub fn find(conn: &GenericConnection, id: i32) -> CargoResult<CrateDownload> {
65-
Model::find(conn, id)
66-
}
67-
}
68-
6956
impl Model for CrateDownload {
7057
fn from_row(row: &Row) -> CrateDownload {
7158
CrateDownload {

src/keyword.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ pub struct EncodableKeyword {
3030
}
3131

3232
impl Keyword {
33-
pub fn find(conn: &GenericConnection, id: i32) -> CargoResult<Keyword> {
34-
Model::find(conn, id)
35-
}
36-
3733
pub fn find_by_keyword(conn: &GenericConnection, name: &str)
3834
-> CargoResult<Option<Keyword>> {
3935
let stmt = try!(conn.prepare("SELECT * FROM keywords \

src/krate.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ pub struct CrateLinks {
8181
}
8282

8383
impl Crate {
84-
pub fn find(conn: &GenericConnection, id: i32) -> CargoResult<Crate> {
85-
Model::find(conn, id)
86-
}
87-
8884
pub fn find_by_name(conn: &GenericConnection,
8985
name: &str) -> CargoResult<Crate> {
9086
let stmt = try!(conn.prepare("SELECT * FROM crates \

src/tests/user.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use conduit::{Handler, Request, Response, Method};
44
use conduit_middleware::Middleware;
55
use conduit_test::MockRequest;
66

7+
use cargo_registry::Model;
78
use cargo_registry::krate::EncodableCrate;
89
use cargo_registry::user::{User, EncodableUser};
910
use cargo_registry::db::RequestTransaction;

src/user/middleware.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use conduit_middleware;
44
use conduit::Request;
55
use conduit_cookie::RequestSession;
66

7+
use Model;
78
use db::RequestTransaction;
89
use super::User;
910
use util::errors::{CargoResult, Unauthorized, ChainError, std_error};

src/user/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ pub struct EncodableUser {
4141
}
4242

4343
impl User {
44-
pub fn find(conn: &GenericConnection, id: i32) -> CargoResult<User> {
45-
Model::find(conn, id)
46-
}
47-
4844
pub fn find_by_login(conn: &GenericConnection,
4945
login: &str) -> CargoResult<User> {
5046
let stmt = try!(conn.prepare("SELECT * FROM users

src/version.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ pub struct VersionLinks {
6161
}
6262

6363
impl Version {
64-
pub fn find(conn: &GenericConnection, id: i32) -> CargoResult<Version> {
65-
Model::find(conn, id)
66-
}
67-
6864
pub fn find_by_num(conn: &GenericConnection,
6965
crate_id: i32,
7066
num: &semver::Version)

0 commit comments

Comments
 (0)