Skip to content

Commit 8c1e803

Browse files
committed
models/krate: Inline NewCrate::save_new_crate() fn
1 parent 73c7629 commit 8c1e803

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/models/krate.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'a> NewCrate<'a> {
105105
conn.transaction(|conn| {
106106
// To avoid race conditions, we try to insert
107107
// first so we know whether to add an owner
108-
if let Some(krate) = self.save_new_crate(conn, uploader)? {
108+
if let Some(krate) = conn.transaction(|conn| self.create(conn, uploader).optional())? {
109109
return Ok(krate);
110110
}
111111

@@ -148,10 +148,6 @@ impl<'a> NewCrate<'a> {
148148
Ok(krate)
149149
})
150150
}
151-
152-
fn save_new_crate(&self, conn: &mut PgConnection, user_id: i32) -> QueryResult<Option<Crate>> {
153-
conn.transaction(|conn| self.create(conn, user_id).optional())
154-
}
155151
}
156152

157153
impl Crate {

0 commit comments

Comments
 (0)