Skip to content

Commit 74338a3

Browse files
committed
Auto merge of #1735 - jtgeibel:clippy-cleanups, r=jtgeibel
Clippy cleanups This series first addresses a warning now produced on nightly. Then `clippy::all` and `rust_2018_idioms` are explicitly denied for all lib, bin, and test artifacts. By denying `clippy::all`, the RLS will automatically show clippy warnings in an IDE. This only affects the RLS and `cargo clippy --all-targets` should still used in a command line workflow.
2 parents ae04832 + ffe2ff6 commit 74338a3

17 files changed

+27
-21
lines changed

src/background_jobs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl Environment {
4444
.map(|(u, p)| (u.as_str(), p.as_str()))
4545
}
4646

47-
pub fn connection(&self) -> CargoResult<DieselPooledConn> {
47+
pub fn connection(&self) -> CargoResult<DieselPooledConn<'_>> {
4848
self.connection_pool.0.get().map_err(Into::into)
4949
}
5050

src/bin/background-worker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Usage:
88
// cargo run --bin background-worker
99

10-
#![deny(warnings)]
10+
#![deny(warnings, clippy::all, rust_2018_idioms)]
1111

1212
use cargo_registry::git::Repository;
1313
use cargo_registry::{background_jobs::*, db};

src/bin/delete-crate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Usage:
66
// cargo run --bin delete-crate crate-name
77

8-
#![deny(warnings)]
8+
#![deny(warnings, clippy::all, rust_2018_idioms)]
99

1010
use cargo_registry::{db, models::Crate, schema::crates};
1111
use std::{

src/bin/delete-version.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Usage:
66
// cargo run --bin delete-version crate-name version-number
77

8-
#![deny(warnings)]
8+
#![deny(warnings, clippy::all, rust_2018_idioms)]
99

1010
use cargo_registry::{
1111
db,

src/bin/monitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! Usage:
55
//! cargo run --bin monitor
66
7-
#![deny(warnings)]
7+
#![deny(warnings, clippy::all, rust_2018_idioms)]
88

99
mod on_call;
1010

src/bin/populate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Usage:
55
// cargo run --bin populate version_id1 version_id2 ...
66

7-
#![deny(warnings)]
7+
#![deny(warnings, clippy::all, rust_2018_idioms)]
88

99
use cargo_registry::{db, schema::version_downloads};
1010
use std::env;

src/bin/render-readmes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44
// Warning: this can take a lot of time.
55

6-
#![deny(warnings)]
6+
#![deny(warnings, clippy::all, rust_2018_idioms)]
77

88
#[macro_use]
99
extern crate serde;

src/bin/server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![deny(warnings)]
1+
#![deny(warnings, clippy::all, rust_2018_idioms)]
22

33
use cargo_registry::{boot, App, Env};
44
use jemalloc_ctl;

src/bin/test-pagerduty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//!
66
//! Event type can be trigger, acknowledge, or resolve
77
8-
#![deny(warnings)]
8+
#![deny(warnings, clippy::all, rust_2018_idioms)]
99

1010
mod on_call;
1111

src/bin/transfer-crates.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Usage:
44
// cargo run --bin transfer-crates from-user to-user
55

6-
#![deny(warnings)]
6+
#![deny(warnings, clippy::all, rust_2018_idioms)]
77

88
use cargo_registry::{
99
db,

src/bin/update-downloads.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![deny(warnings)]
1+
#![deny(warnings, clippy::all, rust_2018_idioms)]
22

33
#[macro_use]
44
extern crate diesel;

src/db.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub enum DieselPool {
1818
}
1919

2020
impl DieselPool {
21-
pub fn get(&self) -> CargoResult<DieselPooledConn> {
21+
pub fn get(&self) -> CargoResult<DieselPooledConn<'_>> {
2222
match self {
2323
DieselPool::Pool(pool) => Ok(DieselPooledConn::Pool(pool.get()?)),
2424
DieselPool::Test(conn) => Ok(DieselPooledConn::Test(conn.lock())),
@@ -89,11 +89,11 @@ pub trait RequestTransaction {
8989
///
9090
/// The connection will live for the lifetime of the request.
9191
// FIXME: This description does not match the implementation below.
92-
fn db_conn(&self) -> CargoResult<DieselPooledConn>;
92+
fn db_conn(&self) -> CargoResult<DieselPooledConn<'_>>;
9393
}
9494

9595
impl<T: Request + ?Sized> RequestTransaction for T {
96-
fn db_conn(&self) -> CargoResult<DieselPooledConn> {
96+
fn db_conn(&self) -> CargoResult<DieselPooledConn<'_>> {
9797
self.app().diesel_database.get().map_err(Into::into)
9898
}
9999
}

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! All implemented routes are defined in the [middleware](fn.middleware.html) function and
44
//! implemented in the [category](category/index.html), [keyword](keyword/index.html),
55
//! [krate](krate/index.html), [user](user/index.html) and [version](version/index.html) modules.
6-
#![deny(warnings)]
6+
#![deny(warnings, clippy::all, rust_2018_idioms)]
77
#![deny(missing_debug_implementations, missing_copy_implementations)]
88
#![deny(bare_trait_objects)]
99
#![recursion_limit = "256"]

src/s3/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![deny(warnings)]
1+
#![deny(warnings, clippy::all, rust_2018_idioms)]
22

33
extern crate base64;
44
extern crate chrono;

src/tests/all.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
#![deny(warnings)]
1+
#![deny(warnings, clippy::all, rust_2018_idioms)]
2+
// TODO: Remove after we can bump to Rust 1.35 stable in `RustConfig`
3+
#![allow(
4+
renamed_and_removed_lints,
5+
clippy::cyclomatic_complexity,
6+
clippy::unknown_clippy_lints
7+
)]
28

39
#[macro_use]
410
extern crate diesel;

src/tests/category.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn show() {
7474
}
7575

7676
#[test]
77-
#[allow(clippy::cyclomatic_complexity)]
77+
#[allow(clippy::cognitive_complexity)]
7878
fn update_crate() {
7979
let (_b, app, middle) = app();
8080
let mut req = req(Method::Get, "/api/v1/categories/foo");

src/tests/krate.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fn index() {
9595
}
9696

9797
#[test]
98-
#[allow(clippy::cyclomatic_complexity)]
98+
#[allow(clippy::cognitive_complexity)]
9999
fn index_queries() {
100100
let (app, anon, user) = TestApp::init().with_user();
101101
let user = user.as_model();
@@ -316,7 +316,7 @@ fn index_sorting() {
316316
}
317317

318318
#[test]
319-
#[allow(clippy::cyclomatic_complexity)]
319+
#[allow(clippy::cognitive_complexity)]
320320
fn exact_match_on_queries_with_sort() {
321321
let (app, anon, user) = TestApp::init().with_user();
322322
let user = user.as_model();
@@ -1459,7 +1459,7 @@ fn yank_not_owner() {
14591459
}
14601460

14611461
#[test]
1462-
#[allow(clippy::cyclomatic_complexity)]
1462+
#[allow(clippy::cognitive_complexity)]
14631463
fn yank_max_version() {
14641464
let (_, anon, _, token) = TestApp::with_proxy().with_token();
14651465

0 commit comments

Comments
 (0)