Skip to content

Commit 48c8cbc

Browse files
authored
Remove unnecessary derefs (#5070)
1 parent 20b1117 commit 48c8cbc

File tree

11 files changed

+19
-19
lines changed

11 files changed

+19
-19
lines changed

src/boot/categories.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ pub fn sync_with_connection(toml_str: &str, conn: &PgConnection) -> Result<()> {
105105
description.eq(excluded(description)),
106106
))
107107
.returning(slug)
108-
.get_results(&*conn)?;
108+
.get_results(conn)?;
109109

110110
diesel::delete(categories)
111111
.filter(slug.ne(all(slugs)))
112-
.execute(&*conn)?;
112+
.execute(conn)?;
113113
Ok(())
114114
})
115115
}

src/controllers/krate/publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ pub fn add_dependencies(
328328

329329
// Match only identical names to ensure the index always references the original crate name
330330
let krate:Crate = Crate::by_exact_name(&dep.name)
331-
.first(&*conn)
331+
.first(conn)
332332
.map_err(|_| cargo_err(&format_args!("no known crate named `{}`", &*dep.name)))?;
333333

334334
if let Ok(version_req) = semver::VersionReq::parse(&dep.version_req.0) {

src/controllers/version/downloads.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn download(req: &mut dyn RequestExt) -> EndpointResult {
107107
.app()
108108
.config
109109
.uploader()
110-
.crate_location(&crate_name, &*version);
110+
.crate_location(&crate_name, version);
111111

112112
if req.wants_json() {
113113
Ok(req.json(&json!({ "url": redirect_url })))

src/models/crate_owner_invitation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ impl CrateOwnerInvitation {
8484
pub fn find_by_id(user_id: i32, crate_id: i32, conn: &PgConnection) -> AppResult<Self> {
8585
Ok(crate_owner_invitations::table
8686
.find((user_id, crate_id))
87-
.first::<Self>(&*conn)?)
87+
.first::<Self>(conn)?)
8888
}
8989

9090
pub fn find_by_token(token: &str, conn: &PgConnection) -> AppResult<Self> {
9191
Ok(crate_owner_invitations::table
9292
.filter(crate_owner_invitations::token.eq(token))
93-
.first::<Self>(&*conn)?)
93+
.first::<Self>(conn)?)
9494
}
9595

9696
pub fn accept(self, conn: &PgConnection, config: &config::Server) -> AppResult<()> {

src/models/keyword.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl Keyword {
2727
pub fn find_by_keyword(conn: &PgConnection, name: &str) -> QueryResult<Keyword> {
2828
keywords::table
2929
.filter(keywords::keyword.eq(lower(name)))
30-
.first(&*conn)
30+
.first(conn)
3131
}
3232

3333
pub fn find_or_create_all(conn: &PgConnection, names: &[&str]) -> QueryResult<Vec<Keyword>> {

src/models/user.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ impl User {
166166
Email::belonging_to(self)
167167
.select(emails::email)
168168
.filter(emails::verified.eq(true))
169-
.first(&*conn)
169+
.first(conn)
170170
.optional()
171171
}
172172

173173
/// Queries for the email belonging to a particular user
174174
pub fn email(&self, conn: &PgConnection) -> AppResult<Option<String>> {
175175
Ok(Email::belonging_to(self)
176176
.select(emails::email)
177-
.first(&*conn)
177+
.first(conn)
178178
.optional()?)
179179
}
180180
}

src/tests/krate/publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn uploading_new_version_touches_crate() {
3434
app.db(|conn| {
3535
diesel::update(crates::table)
3636
.set(crates::updated_at.eq(crates::updated_at - 1.hour()))
37-
.execute(&*conn)
37+
.execute(conn)
3838
.unwrap();
3939
});
4040

src/tests/krate/search.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,19 +336,19 @@ fn exact_match_on_queries_with_sort() {
336336
// Set the updated at column for each crate
337337
update(&krate1)
338338
.set(crates::updated_at.eq(now - 3.weeks()))
339-
.execute(&*conn)
339+
.execute(conn)
340340
.unwrap();
341341
update(&krate2)
342342
.set(crates::updated_at.eq(now - 5.days()))
343-
.execute(&*conn)
343+
.execute(conn)
344344
.unwrap();
345345
update(&krate3)
346346
.set(crates::updated_at.eq(now - 10.seconds()))
347-
.execute(&*conn)
347+
.execute(conn)
348348
.unwrap();
349349
update(&krate4)
350350
.set(crates::updated_at.eq(now))
351-
.execute(&*conn)
351+
.execute(conn)
352352
.unwrap();
353353
});
354354

src/tests/krate/summary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn summary_new_crates() {
7777
// set total_downloads global value for `num_downloads` prop
7878
update(metadata::table)
7979
.set(metadata::total_downloads.eq(6000))
80-
.execute(&*conn)
80+
.execute(conn)
8181
.unwrap();
8282
});
8383

src/tests/user.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ fn github_with_email_does_not_overwrite_email() {
437437
let original_email: String = app.db(|conn| {
438438
Email::belonging_to(model)
439439
.select(emails::email)
440-
.first(&*conn)
440+
.first(conn)
441441
.unwrap()
442442
});
443443

@@ -573,7 +573,7 @@ fn test_confirm_user_email() {
573573
let email_token: String = app.db(|conn| {
574574
Email::belonging_to(user_model)
575575
.select(emails::token)
576-
.first(&*conn)
576+
.first(conn)
577577
.unwrap()
578578
});
579579

@@ -747,7 +747,7 @@ fn test_update_email_notifications_not_owned() {
747747
crate_owners::table
748748
.select(crate_owners::email_notifications)
749749
.filter(crate_owners::crate_id.eq(not_my_crate.id))
750-
.first(&*conn)
750+
.first(conn)
751751
})
752752
.unwrap();
753753

src/worker/readmes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn render_and_upload_readme(
3232
.find(version_id)
3333
.inner_join(crates::table)
3434
.select((crates::name, versions::num))
35-
.first(&*conn)?;
35+
.first(conn)?;
3636
env.uploader
3737
.upload_readme(env.http_client(), &crate_name, &vers, rendered)?;
3838
Ok(())

0 commit comments

Comments
 (0)