diff --git a/src/background_jobs.rs b/src/background_jobs.rs index 25af3c661b2..732e914a826 100644 --- a/src/background_jobs.rs +++ b/src/background_jobs.rs @@ -44,7 +44,7 @@ impl Environment { .map(|(u, p)| (u.as_str(), p.as_str())) } - pub fn connection(&self) -> CargoResult { + pub fn connection(&self) -> CargoResult> { self.connection_pool.0.get().map_err(Into::into) } diff --git a/src/bin/background-worker.rs b/src/bin/background-worker.rs index 99b93481a19..fd22def7f42 100644 --- a/src/bin/background-worker.rs +++ b/src/bin/background-worker.rs @@ -7,7 +7,7 @@ // Usage: // cargo run --bin background-worker -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] use cargo_registry::git::Repository; use cargo_registry::{background_jobs::*, db}; diff --git a/src/bin/delete-crate.rs b/src/bin/delete-crate.rs index 952c429bebc..07a6b29f6bd 100644 --- a/src/bin/delete-crate.rs +++ b/src/bin/delete-crate.rs @@ -5,7 +5,7 @@ // Usage: // cargo run --bin delete-crate crate-name -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] use cargo_registry::{db, models::Crate, schema::crates}; use std::{ diff --git a/src/bin/delete-version.rs b/src/bin/delete-version.rs index 07f0ee4cde4..d612b3129fb 100644 --- a/src/bin/delete-version.rs +++ b/src/bin/delete-version.rs @@ -5,7 +5,7 @@ // Usage: // cargo run --bin delete-version crate-name version-number -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] use cargo_registry::{ db, diff --git a/src/bin/monitor.rs b/src/bin/monitor.rs index fc2025ea9ee..bd97e7c20f5 100644 --- a/src/bin/monitor.rs +++ b/src/bin/monitor.rs @@ -4,7 +4,7 @@ //! Usage: //! cargo run --bin monitor -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] mod on_call; diff --git a/src/bin/populate.rs b/src/bin/populate.rs index 0240d4a9c97..f45776cc575 100644 --- a/src/bin/populate.rs +++ b/src/bin/populate.rs @@ -4,7 +4,7 @@ // Usage: // cargo run --bin populate version_id1 version_id2 ... -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] use cargo_registry::{db, schema::version_downloads}; use std::env; diff --git a/src/bin/render-readmes.rs b/src/bin/render-readmes.rs index 10387512ea7..0388b8c4050 100644 --- a/src/bin/render-readmes.rs +++ b/src/bin/render-readmes.rs @@ -3,7 +3,7 @@ // // Warning: this can take a lot of time. -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] #[macro_use] extern crate serde; diff --git a/src/bin/server.rs b/src/bin/server.rs index 954625be6dc..f74adb5b615 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -1,4 +1,4 @@ -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] use cargo_registry::{boot, App, Env}; use jemalloc_ctl; diff --git a/src/bin/test-pagerduty.rs b/src/bin/test-pagerduty.rs index a2baffc342c..12055fbe126 100644 --- a/src/bin/test-pagerduty.rs +++ b/src/bin/test-pagerduty.rs @@ -5,7 +5,7 @@ //! //! Event type can be trigger, acknowledge, or resolve -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] mod on_call; diff --git a/src/bin/transfer-crates.rs b/src/bin/transfer-crates.rs index 369317c0ddf..76fd187c03c 100644 --- a/src/bin/transfer-crates.rs +++ b/src/bin/transfer-crates.rs @@ -3,7 +3,7 @@ // Usage: // cargo run --bin transfer-crates from-user to-user -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] use cargo_registry::{ db, diff --git a/src/bin/update-downloads.rs b/src/bin/update-downloads.rs index e450bfdcc9a..0f16cb60855 100644 --- a/src/bin/update-downloads.rs +++ b/src/bin/update-downloads.rs @@ -1,4 +1,4 @@ -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] #[macro_use] extern crate diesel; diff --git a/src/db.rs b/src/db.rs index a7ec931ed58..d0548ff6f5a 100644 --- a/src/db.rs +++ b/src/db.rs @@ -18,7 +18,7 @@ pub enum DieselPool { } impl DieselPool { - pub fn get(&self) -> CargoResult { + pub fn get(&self) -> CargoResult> { match self { DieselPool::Pool(pool) => Ok(DieselPooledConn::Pool(pool.get()?)), DieselPool::Test(conn) => Ok(DieselPooledConn::Test(conn.lock())), @@ -89,11 +89,11 @@ pub trait RequestTransaction { /// /// The connection will live for the lifetime of the request. // FIXME: This description does not match the implementation below. - fn db_conn(&self) -> CargoResult; + fn db_conn(&self) -> CargoResult>; } impl RequestTransaction for T { - fn db_conn(&self) -> CargoResult { + fn db_conn(&self) -> CargoResult> { self.app().diesel_database.get().map_err(Into::into) } } diff --git a/src/lib.rs b/src/lib.rs index a720e9c18a6..fca561e4cb0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ //! All implemented routes are defined in the [middleware](fn.middleware.html) function and //! implemented in the [category](category/index.html), [keyword](keyword/index.html), //! [krate](krate/index.html), [user](user/index.html) and [version](version/index.html) modules. -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] #![deny(missing_debug_implementations, missing_copy_implementations)] #![deny(bare_trait_objects)] #![recursion_limit = "256"] diff --git a/src/s3/lib.rs b/src/s3/lib.rs index cc913f56bbc..4992d0266e8 100644 --- a/src/s3/lib.rs +++ b/src/s3/lib.rs @@ -1,4 +1,4 @@ -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] extern crate base64; extern crate chrono; diff --git a/src/tests/all.rs b/src/tests/all.rs index 24e5344f151..5d92560f24c 100644 --- a/src/tests/all.rs +++ b/src/tests/all.rs @@ -1,4 +1,10 @@ -#![deny(warnings)] +#![deny(warnings, clippy::all, rust_2018_idioms)] +// TODO: Remove after we can bump to Rust 1.35 stable in `RustConfig` +#![allow( + renamed_and_removed_lints, + clippy::cyclomatic_complexity, + clippy::unknown_clippy_lints +)] #[macro_use] extern crate diesel; diff --git a/src/tests/category.rs b/src/tests/category.rs index 99f4ad0f57c..ad8067f7e58 100644 --- a/src/tests/category.rs +++ b/src/tests/category.rs @@ -74,7 +74,7 @@ fn show() { } #[test] -#[allow(clippy::cyclomatic_complexity)] +#[allow(clippy::cognitive_complexity)] fn update_crate() { let (_b, app, middle) = app(); let mut req = req(Method::Get, "/api/v1/categories/foo"); diff --git a/src/tests/krate.rs b/src/tests/krate.rs index a14621fe554..554e2410a3c 100644 --- a/src/tests/krate.rs +++ b/src/tests/krate.rs @@ -95,7 +95,7 @@ fn index() { } #[test] -#[allow(clippy::cyclomatic_complexity)] +#[allow(clippy::cognitive_complexity)] fn index_queries() { let (app, anon, user) = TestApp::init().with_user(); let user = user.as_model(); @@ -316,7 +316,7 @@ fn index_sorting() { } #[test] -#[allow(clippy::cyclomatic_complexity)] +#[allow(clippy::cognitive_complexity)] fn exact_match_on_queries_with_sort() { let (app, anon, user) = TestApp::init().with_user(); let user = user.as_model(); @@ -1459,7 +1459,7 @@ fn yank_not_owner() { } #[test] -#[allow(clippy::cyclomatic_complexity)] +#[allow(clippy::cognitive_complexity)] fn yank_max_version() { let (_, anon, _, token) = TestApp::with_proxy().with_token();