Skip to content

Commit e870eac

Browse files
committed
Auto merge of #9356 - ehuss:clippy-allow, r=Eh2406
Update clippy lint allow set. This updates the clippy lints to default allow. We would prefer not to take clippy lint PRs at this time as there are a number of false positives and subjective style changes that we would rather not review. I left a couple lints as `warn` that I have found useful when refactoring.
2 parents 57c512b + 376619d commit e870eac

File tree

8 files changed

+23
-46
lines changed

8 files changed

+23
-46
lines changed

crates/cargo-test-support/src/lib.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
//!
33
//! See https://rust-lang.github.io/cargo/contrib/ for a guide on writing tests.
44
5-
#![allow(clippy::needless_doctest_main)] // according to @ehuss this lint is fussy
6-
#![allow(clippy::inefficient_to_string)] // this causes suggestions that result in `(*s).to_string()`
5+
#![allow(clippy::all)]
6+
#![warn(clippy::needless_borrow)]
7+
#![warn(clippy::redundant_clone)]
78

89
use std::env;
910
use std::ffi::OsStr;
@@ -831,8 +832,8 @@ impl Execs {
831832
Some(_) => Err(format!(
832833
"exited with {:?}\n--- stdout\n{}\n--- stderr\n{}",
833834
code,
834-
String::from_utf8_lossy(&stdout),
835-
String::from_utf8_lossy(&stderr)
835+
String::from_utf8_lossy(stdout),
836+
String::from_utf8_lossy(stderr)
836837
)),
837838
}
838839
}

crates/cargo-test-support/src/registry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl RegistryBuilder {
192192
alt_dl_url(),
193193
self.alt_api_url
194194
.as_ref()
195-
.map_or_else(alt_api_url, |url| Url::parse(&url).expect("valid url")),
195+
.map_or_else(alt_api_url, |url| Url::parse(url).expect("valid url")),
196196
alt_api_path(),
197197
);
198198
}

crates/crates-io/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![allow(unknown_lints)]
2-
#![allow(clippy::identity_op)] // used for vertical alignment
1+
#![allow(clippy::all)]
32

43
use std::collections::BTreeMap;
54
use std::fmt;

crates/resolver-tests/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![allow(clippy::many_single_char_names)]
2-
#![allow(clippy::needless_range_loop)] // false positives
1+
#![allow(clippy::all)]
32

43
use std::cell::RefCell;
54
use std::cmp::PartialEq;

src/bin/cargo/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(rust_2018_idioms)] // while we're getting used to 2018
2-
#![allow(clippy::redundant_closure)] // there's a false positive
2+
#![allow(clippy::all)]
33
#![warn(clippy::needless_borrow)]
44
#![warn(clippy::redundant_clone)]
55

src/cargo/lib.rs

+7-29
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,12 @@
1-
#![cfg_attr(test, deny(warnings))]
2-
// While we're getting used to 2018:
1+
// For various reasons, some idioms are still allow'ed, but we would like to
2+
// test and enforce them.
33
#![warn(rust_2018_idioms)]
4-
// Clippy isn't enforced by CI (@alexcrichton isn't a fan).
5-
#![allow(clippy::blacklisted_name)] // frequently used in tests
6-
#![allow(clippy::cognitive_complexity)] // large project
7-
#![allow(clippy::derive_hash_xor_eq)] // there's an intentional incoherence
8-
#![allow(clippy::explicit_into_iter_loop)] // explicit loops are clearer
9-
#![allow(clippy::explicit_iter_loop)] // explicit loops are clearer
10-
#![allow(clippy::identity_op)] // used for vertical alignment
11-
#![allow(clippy::implicit_hasher)] // large project
12-
#![allow(clippy::large_enum_variant)] // large project
13-
#![allow(clippy::new_without_default)] // explicit is maybe clearer
14-
#![allow(clippy::redundant_closure)] // closures can be less verbose
15-
#![allow(clippy::redundant_closure_call)] // closures over try catch blocks
16-
#![allow(clippy::too_many_arguments)] // large project
17-
#![allow(clippy::type_complexity)] // there's an exceptionally complex type
18-
#![allow(clippy::wrong_self_convention)] // perhaps `Rc` should be special-cased in Clippy?
19-
#![allow(clippy::write_with_newline)] // too pedantic
20-
#![allow(clippy::inefficient_to_string)] // this causes suggestions that result in `(*s).to_string()`
21-
#![allow(clippy::collapsible_if)] // too pedantic
4+
#![cfg_attr(test, deny(warnings))]
5+
// Due to some of the default clippy lints being somewhat subjective and not
6+
// necessarily an improvement, we prefer to not use them at this time.
7+
#![allow(clippy::all)]
228
#![warn(clippy::needless_borrow)]
23-
// Unit is now interned, and would probably be better as pass-by-copy, but
24-
// doing so causes a lot of & and * shenanigans that makes the code arguably
25-
// less clear and harder to read.
26-
#![allow(clippy::trivially_copy_pass_by_ref)]
27-
// exhaustively destructuring ensures future fields are handled
28-
#![allow(clippy::unneeded_field_pattern)]
29-
// false positives in target-specific code, for details see
30-
// https://github.com/rust-lang/cargo/pull/7251#pullrequestreview-274914270
31-
#![allow(clippy::useless_conversion)]
9+
#![warn(clippy::redundant_clone)]
3210

3311
use crate::core::shell::Verbosity::Verbose;
3412
use crate::core::Shell;

tests/internal.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//! Tests for internal code checks.
2+
3+
#![allow(clippy::all)]
4+
25
use std::fs;
36

47
#[test]

tests/testsuite/main.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
#![warn(rust_2018_idioms)] // while we're getting used to 2018
2-
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
3-
#![allow(clippy::blacklisted_name)]
4-
#![allow(clippy::explicit_iter_loop)]
5-
#![allow(clippy::redundant_closure)]
6-
#![allow(clippy::blocks_in_if_conditions)] // clippy doesn't agree with rustfmt 😂
7-
#![allow(clippy::inefficient_to_string)] // this causes suggestions that result in `(*s).to_string()`
1+
// See src/cargo/lib.rs for notes on these lint settings.
2+
#![warn(rust_2018_idioms)]
3+
#![allow(clippy::all)]
84
#![warn(clippy::needless_borrow)]
95
#![warn(clippy::redundant_clone)]
6+
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
107

118
#[macro_use]
129
extern crate cargo_test_macro;

0 commit comments

Comments
 (0)