Skip to content

Commit 0807730

Browse files
committed
Move all clippy config to target top files
1 parent e55ecf9 commit 0807730

File tree

11 files changed

+17
-35
lines changed

11 files changed

+17
-35
lines changed

src/bin/cargo/main.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// we have lots of arguments, cleaning this up would be a large project
2-
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
1+
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))] // large project
2+
#![cfg_attr(feature = "cargo-clippy", allow(redundant_closure))] // there's a false positive
33

44
extern crate cargo;
55
extern crate clap;
@@ -135,7 +135,6 @@ fn find_closest(config: &Config, cmd: &str) -> Option<String> {
135135

136136
fn execute_external_subcommand(config: &Config, cmd: &str, args: &[&str]) -> CliResult {
137137
let command_exe = format!("cargo-{}{}", cmd, env::consts::EXE_SUFFIX);
138-
#[cfg_attr(feature = "cargo-clippy", allow(redundant_closure))] // false positive
139138
let path = search_directories(config)
140139
.iter()
141140
.map(|dir| dir.join(&command_exe))

src/cargo/core/compiler/job.rs

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ trait FnBox<A, R> {
1919
}
2020

2121
impl<A, R, F: FnOnce(A) -> R> FnBox<A, R> for F {
22-
// False positive: https://github.com/rust-lang-nursery/rust-clippy/issues/1123
23-
#[cfg_attr(feature = "cargo-clippy", allow(boxed_local))]
2422
fn call_box(self: Box<F>, a: A) -> R {
2523
(*self)(a)
2624
}

src/cargo/core/manifest.rs

-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ use util::errors::*;
1717
use util::toml::TomlManifest;
1818
use util::Config;
1919

20-
// While unfortunate, resolving the size difference with Box would be a large project
21-
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
2220
pub enum EitherManifest {
2321
Real(Manifest),
2422
Virtual(VirtualManifest),
@@ -207,7 +205,6 @@ struct NonHashedPathBuf {
207205
path: PathBuf,
208206
}
209207

210-
#[cfg_attr(feature = "cargo-clippy", allow(derive_hash_xor_eq))] // current intentional incoherence
211208
impl Hash for NonHashedPathBuf {
212209
fn hash<H: Hasher>(&self, _: &mut H) {
213210
// ...

src/cargo/core/profiles.rs

-2
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,6 @@ impl Profile {
495495
/// Compare all fields except `name`, which doesn't affect compilation.
496496
/// This is necessary for `Unit` deduplication for things like "test" and
497497
/// "dev" which are essentially the same.
498-
// The complexity of the result type is exempted because it's limited in scope.
499-
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
500498
fn comparable(
501499
&self,
502500
) -> (

src/cargo/core/resolver/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ mod types;
106106
///
107107
/// * `print_warnings` - whether or not to print backwards-compatibility
108108
/// warnings and such
109-
// While unfortunate, generalising this over different hashers would be a large project
110-
#[cfg_attr(feature = "cargo-clippy", allow(implicit_hasher))]
111109
pub fn resolve(
112110
summaries: &[(Summary, Method)],
113111
replacements: &[(PackageIdSpec, Dependency)],

src/cargo/core/workspace.rs

-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ struct Packages<'cfg> {
8787
}
8888

8989
#[derive(Debug)]
90-
// While unfortunate, resolving the size difference with Box would be a large project
91-
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
9290
enum MaybePackage {
9391
Package(Package),
9492
Virtual(VirtualManifest),

src/cargo/lib.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#![cfg_attr(test, deny(warnings))]
2-
// Currently, Cargo does not use clippy for its source code.
3-
// But if someone runs it they should know that
4-
// @alexcrichton disagree with clippy on some style things
5-
#![cfg_attr(feature = "cargo-clippy", allow(explicit_iter_loop))]
6-
#![cfg_attr(feature = "cargo-clippy", allow(explicit_into_iter_loop))]
7-
// also we use closures as an alternative to try catch blocks
8-
#![cfg_attr(feature = "cargo-clippy", allow(redundant_closure_call))]
9-
10-
// we have lots of arguments, cleaning this up would be a large project
11-
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
12-
13-
// we have some complicated functions, cleaning this up would be a large project
14-
#![cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))]
2+
3+
// Clippy isn't enforced by CI, and know that @alexcrichton isn't a fan :)
4+
#![cfg_attr(feature = "cargo-clippy", allow(boxed_local))] // bug rust-lang-nursery/rust-clippy#1123
5+
#![cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))] // large project
6+
#![cfg_attr(feature = "cargo-clippy", allow(derive_hash_xor_eq))] // there's an intentional incoherence
7+
#![cfg_attr(feature = "cargo-clippy", allow(explicit_into_iter_loop))] // (unclear why)
8+
#![cfg_attr(feature = "cargo-clippy", allow(explicit_iter_loop))] // (unclear why)
9+
#![cfg_attr(feature = "cargo-clippy", allow(identity_op))] // used for vertical alignment
10+
#![cfg_attr(feature = "cargo-clippy", allow(implicit_hasher))] // large project
11+
#![cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))] // large project
12+
#![cfg_attr(feature = "cargo-clippy", allow(redundant_closure_call))] // closures over try catch blocks
13+
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))] // large project
14+
#![cfg_attr(feature = "cargo-clippy", allow(type_complexity))] // there's an exceptionally complex type
15+
#![cfg_attr(feature = "cargo-clippy", allow(wrong_self_convention))] // perhaps Rc should be special cased in Clippy?
1516

1617
extern crate atty;
1718
extern crate clap;

src/cargo/ops/resolve.rs

-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ fn resolve_with_registry<'cfg>(
133133
///
134134
/// The previous resolve normally comes from a lockfile. This function does not
135135
/// read or write lockfiles from the filesystem.
136-
// While unfortunate, generalising this over different hashers would be a large project
137-
#[cfg_attr(feature = "cargo-clippy", allow(implicit_hasher))]
138136
pub fn resolve_with_previous<'a, 'cfg>(
139137
registry: &mut PackageRegistry<'cfg>,
140138
ws: &Workspace<'cfg>,

src/cargo/util/hex.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use hex;
44
use std::hash::{Hash, Hasher, SipHasher};
55

66
pub fn to_hex(num: u64) -> String {
7-
#[cfg_attr(feature = "cargo-clippy", allow(identity_op))] // don't hate on vertical alignment, clippy
87
hex::encode(&[
98
(num >> 0) as u8,
109
(num >> 8) as u8,

src/cargo/util/toml/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ type TomlBenchTarget = TomlTarget;
151151

152152
#[derive(Debug, Serialize)]
153153
#[serde(untagged)]
154-
// While unfortunate, resolving the size difference with Box would be a large project
155-
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
156154
pub enum TomlDependency {
157155
Simple(String),
158156
Detailed(DetailedTomlDependency),
@@ -741,7 +739,6 @@ impl TomlManifest {
741739
}
742740
}
743741

744-
#[cfg_attr(feature = "cargo-clippy", allow(wrong_self_convention))] // perhaps Rc should be special cased in Clippy?
745742
fn to_real_manifest(
746743
me: &Rc<TomlManifest>,
747744
source_id: &SourceId,
@@ -997,7 +994,6 @@ impl TomlManifest {
997994
Ok((manifest, nested_paths))
998995
}
999996

1000-
#[cfg_attr(feature = "cargo-clippy", allow(wrong_self_convention))] // perhaps Rc should be special cased in Clippy?
1001997
fn to_virtual_manifest(
1002998
me: &Rc<TomlManifest>,
1003999
source_id: &SourceId,

src/crates-io/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(unknown_lints)]
2+
#![cfg_attr(feature = "cargo-clippy", allow(identity_op))] // used for vertical alignment
23

34
extern crate curl;
45
#[macro_use]
@@ -159,7 +160,6 @@ impl Registry {
159160
// <le u32 of tarball>
160161
// <source tarball>
161162
let stat = tarball.metadata()?;
162-
#[cfg_attr(feature = "cargo-clippy", allow(identity_op))] // don't hate on vertical alignment, clippy
163163
let header = {
164164
let mut w = Vec::new();
165165
w.extend(

0 commit comments

Comments
 (0)