Skip to content

Commit af85271

Browse files
committed
remove clippy::double_neg
1 parent 25aaac4 commit af85271

File tree

11 files changed

+77
-129
lines changed

11 files changed

+77
-129
lines changed

src/tools/clippy/.github/driver.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ unset CARGO_MANIFEST_DIR
4747

4848
# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
4949
# FIXME: How to match the clippy invocation in compile-test.rs?
50-
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/double_neg.rs 2>double_neg.stderr && exit 1
51-
sed -e "/= help: for/d" double_neg.stderr > normalized.stderr
52-
diff -u normalized.stderr tests/ui/double_neg.stderr
50+
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/box_default.rs 2>box_default.stderr && exit 1
51+
sed -e "/= help: for/d" box_default.stderr > normalized.stderr
52+
diff -u normalized.stderr tests/ui/box_default.stderr
5353

5454
# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same
5555
SYSROOT=$(rustc --print sysroot)

src/tools/clippy/book/src/usage.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ You can configure lint levels on the command line by adding
3333
`-A/W/D clippy::lint_name` like this:
3434

3535
```bash
36-
cargo clippy -- -Aclippy::style -Wclippy::double_neg -Dclippy::perf
36+
cargo clippy -- -Aclippy::style -Wclippy::box_default -Dclippy::perf
3737
```
3838

3939
For [CI] all warnings can be elevated to errors which will inturn fail
@@ -101,11 +101,10 @@ You can configure lint levels in source code the same way you can configure
101101
```rust,ignore
102102
#![allow(clippy::style)]
103103
104-
#[warn(clippy::double_neg)]
104+
#[warn(clippy::box_default)]
105105
fn main() {
106-
let x = 1;
107-
let y = --x;
108-
// ^^ warning: double negation
106+
let _ = Box::<String>::new(Default::default());
107+
// ^ warning: `Box::new(_)` of default value
109108
}
110109
```
111110

src/tools/clippy/clippy_lints/src/declared_lints.rs

-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
486486
crate::misc::TOPLEVEL_REF_ARG_INFO,
487487
crate::misc::USED_UNDERSCORE_BINDING_INFO,
488488
crate::misc_early::BUILTIN_TYPE_SHADOW_INFO,
489-
crate::misc_early::DOUBLE_NEG_INFO,
490489
crate::misc_early::DUPLICATE_UNDERSCORE_ARGUMENT_INFO,
491490
crate::misc_early::MIXED_CASE_HEX_LITERALS_INFO,
492491
crate::misc_early::REDUNDANT_AT_REST_PATTERN_INFO,

src/tools/clippy/clippy_lints/src/misc_early/double_neg.rs

-18
This file was deleted.

src/tools/clippy/clippy_lints/src/misc_early/mod.rs

-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
mod builtin_type_shadow;
2-
mod double_neg;
32
mod literal_suffix;
43
mod mixed_case_hex_literals;
54
mod redundant_at_rest_pattern;
@@ -85,25 +84,6 @@ declare_clippy_lint! {
8584
"function arguments having names which only differ by an underscore"
8685
}
8786

88-
declare_clippy_lint! {
89-
/// ### What it does
90-
/// Detects expressions of the form `--x`.
91-
///
92-
/// ### Why is this bad?
93-
/// It can mislead C/C++ programmers to think `x` was
94-
/// decremented.
95-
///
96-
/// ### Example
97-
/// ```no_run
98-
/// let mut x = 3;
99-
/// --x;
100-
/// ```
101-
#[clippy::version = "pre 1.29.0"]
102-
pub DOUBLE_NEG,
103-
style,
104-
"`--x`, which is a double negation of `x` and not a pre-decrement as in C/C++"
105-
}
106-
10787
declare_clippy_lint! {
10888
/// ### What it does
10989
/// Warns on hexadecimal literals with mixed-case letter
@@ -352,7 +332,6 @@ declare_clippy_lint! {
352332
declare_lint_pass!(MiscEarlyLints => [
353333
UNNEEDED_FIELD_PATTERN,
354334
DUPLICATE_UNDERSCORE_ARGUMENT,
355-
DOUBLE_NEG,
356335
MIXED_CASE_HEX_LITERALS,
357336
UNSEPARATED_LITERAL_SUFFIX,
358337
SEPARATED_LITERAL_SUFFIX,
@@ -415,7 +394,6 @@ impl EarlyLintPass for MiscEarlyLints {
415394
if let ExprKind::Lit(lit) = expr.kind {
416395
MiscEarlyLints::check_lit(cx, lit, expr.span);
417396
}
418-
double_neg::check(cx, expr);
419397
}
420398
}
421399

src/tools/clippy/clippy_lints/src/renamed_lints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
3838
("clippy::cast_ref_to_mut", "invalid_reference_casting"),
3939
("clippy::clone_double_ref", "suspicious_double_ref_op"),
4040
("clippy::cmp_nan", "invalid_nan_comparisons"),
41+
("clippy::double_neg", "double_negation"),
4142
("clippy::drop_bounds", "drop_bounds"),
4243
("clippy::drop_copy", "dropping_copy_types"),
4344
("clippy::drop_ref", "dropping_references"),

src/tools/clippy/tests/ui/double_neg.rs

-10
This file was deleted.

src/tools/clippy/tests/ui/double_neg.stderr

-11
This file was deleted.

src/tools/clippy/tests/ui/rename.fixed

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#![allow(invalid_reference_casting)]
3434
#![allow(suspicious_double_ref_op)]
3535
#![allow(invalid_nan_comparisons)]
36+
#![allow(double_negation)]
3637
#![allow(drop_bounds)]
3738
#![allow(dropping_copy_types)]
3839
#![allow(dropping_references)]
@@ -89,6 +90,7 @@
8990
#![warn(invalid_reference_casting)]
9091
#![warn(suspicious_double_ref_op)]
9192
#![warn(invalid_nan_comparisons)]
93+
#![warn(double_negation)]
9294
#![warn(drop_bounds)]
9395
#![warn(dropping_copy_types)]
9496
#![warn(dropping_references)]

src/tools/clippy/tests/ui/rename.rs

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#![allow(invalid_reference_casting)]
3434
#![allow(suspicious_double_ref_op)]
3535
#![allow(invalid_nan_comparisons)]
36+
#![allow(double_negation)]
3637
#![allow(drop_bounds)]
3738
#![allow(dropping_copy_types)]
3839
#![allow(dropping_references)]
@@ -89,6 +90,7 @@
8990
#![warn(clippy::cast_ref_to_mut)]
9091
#![warn(clippy::clone_double_ref)]
9192
#![warn(clippy::cmp_nan)]
93+
#![warn(clippy::double_neg)]
9294
#![warn(clippy::drop_bounds)]
9395
#![warn(clippy::drop_copy)]
9496
#![warn(clippy::drop_ref)]

0 commit comments

Comments
 (0)