Skip to content

Commit 1de1bf7

Browse files
Merge #1493
1493: Ensure clippy is run for all targets and switch to clippy-preview on stable r=carols10cents a=jtgeibel `--all-targets` is now passed to clippy on CI. Temporarily, `-- -A renamed_and_removed_lints` is passed as well. This can be removed once the clippy::* attribute syntax is available in stable. Additionally, clippy-preview is now installed and run on stable. We were previously running clippy on an old nightly from late June and no new warnings (except the one noted above) are raised on nightly so switching to the -preview component on stable shouldn't introduce churn. Also, unlike with rustfmt, we can fix and merge any clippy recommendations before they hit the stable channel, so we don't have to sync with new releases. Co-authored-by: Justin Geibel <[email protected]>
2 parents f17e2e6 + f6e34a1 commit 1de1bf7

File tree

5 files changed

+23
-27
lines changed

5 files changed

+23
-27
lines changed

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,15 @@ matrix:
4747
allow_failures:
4848
- rust: nightly
4949
include:
50-
- rust: nightly-2018-06-26
51-
script:
52-
- cargo install --force clippy --vers 0.0.210
53-
- cargo clippy
5450
- rust: stable
5551
before_install:
5652
- nvm install 10
5753
- rustup component add rustfmt-preview
54+
- rustup component add clippy-preview
5855
script:
5956
- cargo fmt -- --check
57+
# TODO: Once clippy:: lint syntax is stable, remove everything after the -- below
58+
- cargo clippy --all-targets -- -A renamed_and_removed_lints
6059
- cargo build
6160
- cargo test
6261
- npm install

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![deny(missing_debug_implementations, missing_copy_implementations)]
88
#![deny(bare_trait_objects)]
99
#![recursion_limit = "256"]
10-
#![allow(unknown_lints, proc_macro_derive_resolution_fallback)] // This can be removed after diesel-1.4
10+
#![allow(unknown_lints, proc_macro_derive_resolution_fallback)] // TODO: This can be removed after diesel-1.4
1111

1212
extern crate ammonia;
1313
extern crate chrono;

src/tests/all.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#![deny(warnings)]
2-
#![allow(unknown_lints, proc_macro_derive_resolution_fallback)] // This can be removed after diesel-1.4
2+
#![allow(unknown_lints, proc_macro_derive_resolution_fallback)] // TODO: This can be removed after diesel-1.4
3+
4+
// Several test methods trip this clippy lint
5+
#![cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))]
36

47
extern crate cargo_registry;
58
extern crate chrono;
@@ -162,7 +165,7 @@ fn app() -> (
162165
};
163166

164167
let config = cargo_registry::Config {
165-
uploader: uploader,
168+
uploader,
166169
session_key: "test this has to be over 32 bytes long".to_string(),
167170
git_repo_checkout: git::checkout(),
168171
gh_client_id: env::var("GH_CLIENT_ID").unwrap_or_default(),
@@ -172,7 +175,7 @@ fn app() -> (
172175
max_upload_size: 3000,
173176
max_unpack_size: 2000,
174177
mirror: Replica::Primary,
175-
api_protocol: api_protocol,
178+
api_protocol,
176179
};
177180
let app = App::new(&config);
178181
t!(t!(app.diesel_database.get()).begin_test_transaction());
@@ -251,7 +254,7 @@ fn user(login: &str) -> User {
251254
fn new_team(login: &str) -> NewTeam<'_> {
252255
NewTeam {
253256
github_id: NEXT_ID.fetch_add(1, Ordering::SeqCst) as i32,
254-
login: login,
257+
login,
255258
name: None,
256259
avatar: None,
257260
}
@@ -379,9 +382,9 @@ struct CrateBuilder<'a> {
379382
impl<'a> CrateBuilder<'a> {
380383
fn new(name: &str, owner_id: i32) -> CrateBuilder<'_> {
381384
CrateBuilder {
382-
owner_id: owner_id,
385+
owner_id,
383386
krate: NewCrate {
384-
name: name,
387+
name,
385388
..NewCrate::default()
386389
},
387390
downloads: None,
@@ -702,7 +705,7 @@ fn new_req_body(
702705
name: u::CrateName(krate.name),
703706
vers: u::CrateVersion(semver::Version::parse(version).unwrap()),
704707
features: HashMap::new(),
705-
deps: deps,
708+
deps,
706709
authors: vec!["foo".to_string()],
707710
description: Some("description".to_string()),
708711
homepage: krate.homepage,

src/tests/badge.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,22 @@ fn set_up() -> (Arc<App>, Crate, BadgeRef) {
113113
);
114114

115115
let badges = BadgeRef {
116-
appveyor: appveyor,
116+
appveyor,
117117
appveyor_attributes: badge_attributes_appveyor,
118-
travis_ci: travis_ci,
118+
travis_ci,
119119
travis_ci_attributes: badge_attributes_travis_ci,
120-
gitlab: gitlab,
120+
gitlab,
121121
gitlab_attributes: badge_attributes_gitlab,
122-
isitmaintained_issue_resolution: isitmaintained_issue_resolution,
122+
isitmaintained_issue_resolution,
123123
isitmaintained_issue_resolution_attributes:
124124
badge_attributes_isitmaintained_issue_resolution,
125-
isitmaintained_open_issues: isitmaintained_open_issues,
125+
isitmaintained_open_issues,
126126
isitmaintained_open_issues_attributes: badge_attributes_isitmaintained_open_issues,
127-
codecov: codecov,
127+
codecov,
128128
codecov_attributes: badge_attributes_codecov,
129-
coveralls: coveralls,
129+
coveralls,
130130
coveralls_attributes: badge_attributes_coveralls,
131-
circle_ci: circle_ci,
131+
circle_ci,
132132
circle_ci_attributes: badge_attributes_circle_ci,
133133
maintenance,
134134
maintenance_attributes,

src/tests/record.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,7 @@ fn record_http(
265265
hyper_response.status(status);
266266
let mut hyper_response = hyper_response.body(body.into()).unwrap();
267267
*hyper_response.headers_mut() = headers;
268-
(
269-
hyper_response,
270-
Exchange {
271-
response: response,
272-
request: request,
273-
},
274-
)
268+
(hyper_response, Exchange { response, request })
275269
})
276270
}))
277271
}

0 commit comments

Comments
 (0)