Skip to content

Commit 65d0104

Browse files
authored
Merge pull request #1302 from jtgeibel/bump-clippy
Bump clippy and address new findings
2 parents d15aa91 + 9177404 commit 65d0104

27 files changed

+94
-103
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ matrix:
4949
allow_failures:
5050
- rust: nightly
5151
include:
52-
- rust: nightly-2018-02-13
52+
- rust: nightly-2018-03-31
5353
script:
54-
- cargo install --force clippy --vers 0.0.186
54+
- cargo install --force clippy --vers 0.0.191
5555
- cargo clippy
5656
- rust: stable
5757
script:

src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl App {
8282

8383
App {
8484
diesel_database: db::diesel_pool(&config.db_url, diesel_db_config),
85-
github: github,
85+
github,
8686
session_key: config.session_key.clone(),
8787
git_repo: Mutex::new(repo),
8888
git_repo_checkout: config.git_repo_checkout.clone(),

src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl Default for Config {
125125
}
126126
};
127127
Config {
128-
uploader: uploader,
128+
uploader,
129129
session_key: env("SESSION_KEY"),
130130
git_repo_checkout: checkout,
131131
gh_client_id: env("GH_CLIENT_ID"),
@@ -134,8 +134,8 @@ impl Default for Config {
134134
env: cargo_env,
135135
max_upload_size: 10 * 1024 * 1024, // 10 MB default file upload size limit
136136
max_unpack_size: 512 * 1024 * 1024, // 512 MB max when decompressed
137-
mirror: mirror,
138-
api_protocol: api_protocol,
137+
mirror,
138+
api_protocol,
139139
}
140140
}
141141
}

src/controllers/category.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ pub fn index(req: &mut Request) -> CargoResult<Response> {
2828
}
2929

3030
Ok(req.json(&R {
31-
categories: categories,
32-
meta: Meta { total: total },
31+
categories,
32+
meta: Meta { total },
3333
}))
3434
}
3535

src/controllers/keyword.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn index(req: &mut Request) -> CargoResult<Response> {
4141

4242
Ok(req.json(&R {
4343
keywords: kws,
44-
meta: Meta { total: total },
44+
meta: Meta { total },
4545
}))
4646
}
4747

src/controllers/krate/downloads.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ pub fn downloads(req: &mut Request) -> CargoResult<Response> {
6363
};
6464
Ok(req.json(&R {
6565
version_downloads: downloads,
66-
meta: meta,
66+
meta,
6767
}))
6868
}

src/controllers/krate/follow.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn follow_target(req: &mut Request) -> CargoResult<Follow> {
1414
let crate_id = Crate::by_name(crate_name).select(crates::id).first(&*conn)?;
1515
Ok(Follow {
1616
user_id: user.id,
17-
crate_id: crate_id,
17+
crate_id,
1818
})
1919
}
2020

@@ -51,7 +51,5 @@ pub fn following(req: &mut Request) -> CargoResult<Response> {
5151
struct R {
5252
following: bool,
5353
}
54-
Ok(req.json(&R {
55-
following: following,
56-
}))
54+
Ok(req.json(&R { following }))
5755
}

src/controllers/krate/metadata.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ pub fn summary(req: &mut Request) -> CargoResult<Response> {
9292
popular_categories: Vec<EncodableCategory>,
9393
}
9494
Ok(req.json(&R {
95-
num_downloads: num_downloads,
96-
num_crates: num_crates,
95+
num_downloads,
96+
num_crates,
9797
new_crates: encode_crates(new_crates)?,
9898
most_downloaded: encode_crates(most_downloaded)?,
9999
most_recently_downloaded: encode_crates(most_recently_downloaded)?,
100100
just_updated: encode_crates(just_updated)?,
101-
popular_keywords: popular_keywords,
102-
popular_categories: popular_categories,
101+
popular_keywords,
102+
popular_categories,
103103
}))
104104
}
105105

@@ -200,7 +200,7 @@ pub fn versions(req: &mut Request) -> CargoResult<Response> {
200200
struct R {
201201
versions: Vec<EncodableVersion>,
202202
}
203-
Ok(req.json(&R { versions: versions }))
203+
Ok(req.json(&R { versions }))
204204
}
205205

206206
/// Handles the `GET /crates/:crate_id/reverse_dependencies` route.
@@ -241,6 +241,6 @@ pub fn reverse_dependencies(req: &mut Request) -> CargoResult<Response> {
241241
Ok(req.json(&R {
242242
dependencies: rev_deps,
243243
versions,
244-
meta: Meta { total: total },
244+
meta: Meta { total },
245245
}))
246246
}

src/controllers/krate/publish.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub fn publish(req: &mut Request) -> CargoResult<Response> {
5757
conn.transaction(|| {
5858
// Persist the new crate, if it doesn't already exist
5959
let persist = NewCrate {
60-
name: name,
60+
name,
6161
description: new_crate.description.as_ref().map(|s| &**s),
6262
homepage: new_crate.homepage.as_ref().map(|s| &**s),
6363
documentation: new_crate.documentation.as_ref().map(|s| &**s),
@@ -148,7 +148,7 @@ pub fn publish(req: &mut Request) -> CargoResult<Response> {
148148
name: name.to_string(),
149149
vers: vers.to_string(),
150150
cksum: hex_cksum,
151-
features: features,
151+
features,
152152
deps: git_deps,
153153
yanked: Some(false),
154154
links,
@@ -182,7 +182,7 @@ pub fn publish(req: &mut Request) -> CargoResult<Response> {
182182
}
183183
Ok(req.json(&R {
184184
krate: krate.minimal_encodable(&max_version, None, false, None),
185-
warnings: warnings,
185+
warnings,
186186
}))
187187
})
188188
}

src/controllers/krate/search.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ pub fn search(req: &mut Request) -> CargoResult<Response> {
212212
}
213213

214214
Ok(req.json(&R {
215-
crates: crates,
216-
meta: Meta { total: total },
215+
crates,
216+
meta: Meta { total },
217217
}))
218218
}

src/controllers/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ mod prelude {
4141
headers.insert("Location".to_string(), vec![url.to_string()]);
4242
Response {
4343
status: (302, "Found"),
44-
headers: headers,
44+
headers,
4545
body: Box::new(io::empty()),
4646
}
4747
}

src/controllers/site_metadata.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@ pub fn show_deployed_sha(req: &mut Request) -> CargoResult<Response> {
1212
struct R {
1313
deployed_sha: String,
1414
}
15-
Ok(req.json(&R {
16-
deployed_sha: deployed_sha,
17-
}))
15+
Ok(req.json(&R { deployed_sha }))
1816
}

src/controllers/user/me.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ pub fn me(req: &mut Request) -> CargoResult<Response> {
3939

4040
let verified = verified.unwrap_or(false);
4141
let verification_sent = verified || verification_sent;
42-
let user = User {
43-
email: email,
44-
..user
45-
};
42+
let user = User { email, ..user };
4643

4744
#[derive(Serialize)]
4845
struct R {
@@ -88,8 +85,8 @@ pub fn updates(req: &mut Request) -> CargoResult<Response> {
8885
more: bool,
8986
}
9087
Ok(req.json(&R {
91-
versions: versions,
92-
meta: Meta { more: more },
88+
versions,
89+
meta: Meta { more },
9390
}))
9491
}
9592

src/controllers/user/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub fn github_authorize(req: &mut Request) -> CargoResult<Response> {
3636
}
3737
Ok(req.json(&R {
3838
url: url.to_string(),
39-
state: state,
39+
state,
4040
}))
4141
}
4242

src/controllers/version/deprecated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn index(req: &mut Request) -> CargoResult<Response> {
3939
struct R {
4040
versions: Vec<EncodableVersion>,
4141
}
42-
Ok(req.json(&R { versions: versions }))
42+
Ok(req.json(&R { versions }))
4343
}
4444

4545
/// Handles the `GET /versions/:version_id` and

src/controllers/version/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ pub fn authors(req: &mut Request) -> CargoResult<Response> {
5757
}
5858
Ok(req.json(&R {
5959
users: vec![],
60-
meta: Meta { names: names },
60+
meta: Meta { names },
6161
}))
6262
}

src/middleware/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub struct AppMiddleware {
1212

1313
impl AppMiddleware {
1414
pub fn new(app: Arc<App>) -> AppMiddleware {
15-
AppMiddleware { app: app }
15+
AppMiddleware { app }
1616
}
1717
}
1818

src/models/category.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl Category {
4040
id: slug.clone(),
4141
slug: slug.clone(),
4242
description: description.clone(),
43-
created_at: created_at,
44-
crates_cnt: crates_cnt,
45-
category: category,
43+
created_at,
44+
crates_cnt,
45+
category,
4646
}
4747
}
4848

src/models/keyword.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ impl Keyword {
6969
} = self;
7070
EncodableKeyword {
7171
id: keyword.clone(),
72-
created_at: created_at,
73-
crates_cnt: crates_cnt,
74-
keyword: keyword,
72+
created_at,
73+
crates_cnt,
74+
keyword,
7575
}
7676
}
7777

src/models/krate.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -324,20 +324,20 @@ impl Crate {
324324
EncodableCrate {
325325
id: name.clone(),
326326
name: name.clone(),
327-
updated_at: updated_at,
328-
created_at: created_at,
329-
downloads: downloads,
330-
recent_downloads: recent_downloads,
331-
versions: versions,
327+
updated_at,
328+
created_at,
329+
downloads,
330+
recent_downloads,
331+
versions,
332332
keywords: keyword_ids,
333333
categories: category_ids,
334-
badges: badges,
334+
badges,
335335
max_version: max_version.to_string(),
336-
documentation: documentation,
337-
homepage: homepage,
338-
exact_match: exact_match,
339-
description: description,
340-
repository: repository,
336+
documentation,
337+
homepage,
338+
exact_match,
339+
description,
340+
repository,
341341
links: EncodableCrateLinks {
342342
version_downloads: format!("/api/v1/crates/{}/downloads", name),
343343
versions: versions_link,

src/models/owner.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ impl Owner {
9696
}) => {
9797
let url = format!("https://github.com/{}", gh_login);
9898
EncodableOwner {
99-
id: id,
99+
id,
100100
login: gh_login,
101101
avatar: gh_avatar,
102102
url: Some(url),
103-
name: name,
103+
name,
104104
kind: String::from("user"),
105105
}
106106
}
@@ -113,11 +113,11 @@ impl Owner {
113113
}) => {
114114
let url = github::team_url(&login);
115115
EncodableOwner {
116-
id: id,
117-
login: login,
116+
id,
117+
login,
118118
url: Some(url),
119-
avatar: avatar,
120-
name: name,
119+
avatar,
120+
name,
121121
kind: String::from("team"),
122122
}
123123
}

src/models/team.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ impl<'a> NewTeam<'a> {
4444
avatar: Option<String>,
4545
) -> Self {
4646
NewTeam {
47-
login: login,
48-
github_id: github_id,
49-
name: name,
50-
avatar: avatar,
47+
login,
48+
github_id,
49+
name,
50+
avatar,
5151
}
5252
}
5353

@@ -205,10 +205,10 @@ impl Team {
205205
let url = github::team_url(&login);
206206

207207
EncodableTeam {
208-
id: id,
209-
login: login,
210-
name: name,
211-
avatar: avatar,
208+
id,
209+
login,
210+
name,
211+
avatar,
212212
url: Some(url),
213213
}
214214
}

0 commit comments

Comments
 (0)