Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update clippy lint allow set. #9356

Merged
merged 3 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
//!
//! See https://rust-lang.github.io/cargo/contrib/ for a guide on writing tests.

#![allow(clippy::needless_doctest_main)] // according to @ehuss this lint is fussy
#![allow(clippy::inefficient_to_string)] // this causes suggestions that result in `(*s).to_string()`
#![allow(clippy::all)]
#![warn(clippy::needless_borrow)]
#![warn(clippy::redundant_clone)]

use std::env;
use std::ffi::OsStr;
Expand Down Expand Up @@ -831,8 +832,8 @@ impl Execs {
Some(_) => Err(format!(
"exited with {:?}\n--- stdout\n{}\n--- stderr\n{}",
code,
String::from_utf8_lossy(&stdout),
String::from_utf8_lossy(&stderr)
String::from_utf8_lossy(stdout),
String::from_utf8_lossy(stderr)
)),
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-test-support/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl RegistryBuilder {
alt_dl_url(),
self.alt_api_url
.as_ref()
.map_or_else(alt_api_url, |url| Url::parse(&url).expect("valid url")),
.map_or_else(alt_api_url, |url| Url::parse(url).expect("valid url")),
alt_api_path(),
);
}
Expand Down
3 changes: 1 addition & 2 deletions crates/crates-io/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(unknown_lints)]
#![allow(clippy::identity_op)] // used for vertical alignment
#![allow(clippy::all)]

use std::collections::BTreeMap;
use std::fmt;
Expand Down
3 changes: 1 addition & 2 deletions crates/resolver-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(clippy::many_single_char_names)]
#![allow(clippy::needless_range_loop)] // false positives
#![allow(clippy::all)]

use std::cell::RefCell;
use std::cmp::PartialEq;
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(rust_2018_idioms)] // while we're getting used to 2018
#![allow(clippy::redundant_closure)] // there's a false positive
#![allow(clippy::all)]
#![warn(clippy::needless_borrow)]
#![warn(clippy::redundant_clone)]

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

use crate::core::shell::Verbosity::Verbose;
use crate::core::Shell;
Expand Down
3 changes: 3 additions & 0 deletions tests/internal.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//! Tests for internal code checks.

#![allow(clippy::all)]

use std::fs;

#[test]
Expand Down
11 changes: 4 additions & 7 deletions tests/testsuite/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#![warn(rust_2018_idioms)] // while we're getting used to 2018
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![allow(clippy::blacklisted_name)]
#![allow(clippy::explicit_iter_loop)]
#![allow(clippy::redundant_closure)]
#![allow(clippy::blocks_in_if_conditions)] // clippy doesn't agree with rustfmt 😂
#![allow(clippy::inefficient_to_string)] // this causes suggestions that result in `(*s).to_string()`
// See src/cargo/lib.rs for notes on these lint settings.
#![warn(rust_2018_idioms)]
#![allow(clippy::all)]
#![warn(clippy::needless_borrow)]
#![warn(clippy::redundant_clone)]
#![cfg_attr(feature = "deny-warnings", deny(warnings))]

#[macro_use]
extern crate cargo_test_macro;
Expand Down