Skip to content

Commit

Permalink
remove clippy::double_neg
Browse files Browse the repository at this point in the history
  • Loading branch information
kadiwa4 committed Sep 1, 2024
1 parent b34811b commit 326405f
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 154 deletions.
6 changes: 3 additions & 3 deletions src/tools/clippy/.github/driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ unset CARGO_MANIFEST_DIR

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

# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same
SYSROOT=$(rustc --print sysroot)
Expand Down
9 changes: 4 additions & 5 deletions src/tools/clippy/book/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You can configure lint levels on the command line by adding
`-A/W/D clippy::lint_name` like this:

```bash
cargo clippy -- -Aclippy::style -Wclippy::double_neg -Dclippy::perf
cargo clippy -- -Aclippy::style -Wclippy::box_default -Dclippy::perf
```

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

Expand Down
1 change: 0 additions & 1 deletion src/tools/clippy/clippy_lints/src/declared_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ pub static LINTS: &[&crate::LintInfo] = &[
crate::misc::TOPLEVEL_REF_ARG_INFO,
crate::misc::USED_UNDERSCORE_BINDING_INFO,
crate::misc_early::BUILTIN_TYPE_SHADOW_INFO,
crate::misc_early::DOUBLE_NEG_INFO,
crate::misc_early::DUPLICATE_UNDERSCORE_ARGUMENT_INFO,
crate::misc_early::MIXED_CASE_HEX_LITERALS_INFO,
crate::misc_early::REDUNDANT_AT_REST_PATTERN_INFO,
Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/clippy_lints/src/deprecated_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ declare_with_version! { RENAMED(RENAMED_VERSION): &[(&str, &str)] = &[
("clippy::clone_double_ref", "suspicious_double_ref_op"),
#[clippy::version = ""]
("clippy::cmp_nan", "invalid_nan_comparisons"),
#[clippy::version = "1.83.0"]
("clippy::double_neg", "double_negations"),
#[clippy::version = ""]
("clippy::drop_bounds", "drop_bounds"),
#[clippy::version = ""]
Expand Down
18 changes: 0 additions & 18 deletions src/tools/clippy/clippy_lints/src/misc_early/double_neg.rs

This file was deleted.

22 changes: 0 additions & 22 deletions src/tools/clippy/clippy_lints/src/misc_early/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod builtin_type_shadow;
mod double_neg;
mod literal_suffix;
mod mixed_case_hex_literals;
mod redundant_at_rest_pattern;
Expand Down Expand Up @@ -85,25 +84,6 @@ declare_clippy_lint! {
"function arguments having names which only differ by an underscore"
}

declare_clippy_lint! {
/// ### What it does
/// Detects expressions of the form `--x`.
///
/// ### Why is this bad?
/// It can mislead C/C++ programmers to think `x` was
/// decremented.
///
/// ### Example
/// ```no_run
/// let mut x = 3;
/// --x;
/// ```
#[clippy::version = "pre 1.29.0"]
pub DOUBLE_NEG,
style,
"`--x`, which is a double negation of `x` and not a pre-decrement as in C/C++"
}

declare_clippy_lint! {
/// ### What it does
/// Warns on hexadecimal literals with mixed-case letter
Expand Down Expand Up @@ -352,7 +332,6 @@ declare_clippy_lint! {
declare_lint_pass!(MiscEarlyLints => [
UNNEEDED_FIELD_PATTERN,
DUPLICATE_UNDERSCORE_ARGUMENT,
DOUBLE_NEG,
MIXED_CASE_HEX_LITERALS,
UNSEPARATED_LITERAL_SUFFIX,
SEPARATED_LITERAL_SUFFIX,
Expand Down Expand Up @@ -415,7 +394,6 @@ impl EarlyLintPass for MiscEarlyLints {
if let ExprKind::Lit(lit) = expr.kind {
MiscEarlyLints::check_lit(cx, lit, expr.span);
}
double_neg::check(cx, expr);
}
}

Expand Down
10 changes: 0 additions & 10 deletions src/tools/clippy/tests/ui/double_neg.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/tools/clippy/tests/ui/double_neg.stderr

This file was deleted.

10 changes: 6 additions & 4 deletions src/tools/clippy/tests/ui/rename.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#![allow(clippy::disallowed_methods)]
#![allow(clippy::disallowed_types)]
#![allow(clippy::mixed_read_write_in_expression)]
#![allow(clippy::manual_find_map)]
#![allow(clippy::manual_filter_map)]
#![allow(clippy::manual_find_map)]
#![allow(clippy::useless_conversion)]
#![allow(clippy::redundant_pattern_matching)]
#![allow(clippy::match_result_ok)]
Expand All @@ -29,6 +29,7 @@
#![allow(clippy::unwrap_used)]
#![allow(clippy::panicking_overflow_checks)]
#![allow(clippy::needless_borrow)]
#![allow(clippy::reversed_empty_ranges)]
#![allow(clippy::single_char_add_str)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::missing_const_for_thread_local)]
Expand All @@ -38,6 +39,7 @@
#![allow(invalid_reference_casting)]
#![allow(suspicious_double_ref_op)]
#![allow(invalid_nan_comparisons)]
#![allow(double_negations)]
#![allow(drop_bounds)]
#![allow(dropping_copy_types)]
#![allow(dropping_references)]
Expand All @@ -59,7 +61,6 @@
#![allow(unknown_lints)]
#![allow(unused_labels)]
#![allow(ambiguous_wide_pointer_comparisons)]
#![allow(clippy::reversed_empty_ranges)]
#![warn(clippy::almost_complete_range)] //~ ERROR: lint `clippy::almost_complete_letter_range`
#![warn(clippy::disallowed_names)] //~ ERROR: lint `clippy::blacklisted_name`
#![warn(clippy::blocks_in_conditions)] //~ ERROR: lint `clippy::block_in_if_condition_expr`
Expand All @@ -72,8 +73,8 @@
#![warn(clippy::disallowed_methods)] //~ ERROR: lint `clippy::disallowed_method`
#![warn(clippy::disallowed_types)] //~ ERROR: lint `clippy::disallowed_type`
#![warn(clippy::mixed_read_write_in_expression)] //~ ERROR: lint `clippy::eval_order_dependence`
#![warn(clippy::manual_find_map)] //~ ERROR: lint `clippy::find_map`
#![warn(clippy::manual_filter_map)] //~ ERROR: lint `clippy::filter_map`
#![warn(clippy::manual_find_map)] //~ ERROR: lint `clippy::find_map`
#![warn(clippy::useless_conversion)] //~ ERROR: lint `clippy::identity_conversion`
#![warn(clippy::redundant_pattern_matching)] //~ ERROR: lint `clippy::if_let_redundant_pattern_matching`
#![warn(clippy::match_result_ok)] //~ ERROR: lint `clippy::if_let_some_result`
Expand All @@ -92,6 +93,7 @@
#![warn(clippy::expect_used)] //~ ERROR: lint `clippy::result_expect_used`
#![warn(clippy::map_unwrap_or)] //~ ERROR: lint `clippy::result_map_unwrap_or_else`
#![warn(clippy::unwrap_used)] //~ ERROR: lint `clippy::result_unwrap_used`
#![warn(clippy::reversed_empty_ranges)] //~ ERROR: lint `clippy::reverse_range_loop`
#![warn(clippy::single_char_add_str)] //~ ERROR: lint `clippy::single_char_push_str`
#![warn(clippy::module_name_repetitions)] //~ ERROR: lint `clippy::stutter`
#![warn(clippy::missing_const_for_thread_local)] //~ ERROR: lint `clippy::thread_local_initializer_can_be_made_const`
Expand All @@ -101,6 +103,7 @@
#![warn(invalid_reference_casting)] //~ ERROR: lint `clippy::cast_ref_to_mut`
#![warn(suspicious_double_ref_op)] //~ ERROR: lint `clippy::clone_double_ref`
#![warn(invalid_nan_comparisons)] //~ ERROR: lint `clippy::cmp_nan`
#![warn(double_negations)] //~ ERROR: lint `clippy::double_neg`
#![warn(drop_bounds)] //~ ERROR: lint `clippy::drop_bounds`
#![warn(dropping_copy_types)] //~ ERROR: lint `clippy::drop_copy`
#![warn(dropping_references)] //~ ERROR: lint `clippy::drop_ref`
Expand All @@ -125,6 +128,5 @@
#![warn(unknown_lints)] //~ ERROR: lint `clippy::unknown_clippy_lints`
#![warn(unused_labels)] //~ ERROR: lint `clippy::unused_label`
#![warn(ambiguous_wide_pointer_comparisons)] //~ ERROR: lint `clippy::vtable_address_comparisons`
#![warn(clippy::reversed_empty_ranges)] //~ ERROR: lint `clippy::reverse_range_loop`

fn main() {}
10 changes: 6 additions & 4 deletions src/tools/clippy/tests/ui/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#![allow(clippy::disallowed_methods)]
#![allow(clippy::disallowed_types)]
#![allow(clippy::mixed_read_write_in_expression)]
#![allow(clippy::manual_find_map)]
#![allow(clippy::manual_filter_map)]
#![allow(clippy::manual_find_map)]
#![allow(clippy::useless_conversion)]
#![allow(clippy::redundant_pattern_matching)]
#![allow(clippy::match_result_ok)]
Expand All @@ -29,6 +29,7 @@
#![allow(clippy::unwrap_used)]
#![allow(clippy::panicking_overflow_checks)]
#![allow(clippy::needless_borrow)]
#![allow(clippy::reversed_empty_ranges)]
#![allow(clippy::single_char_add_str)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::missing_const_for_thread_local)]
Expand All @@ -38,6 +39,7 @@
#![allow(invalid_reference_casting)]
#![allow(suspicious_double_ref_op)]
#![allow(invalid_nan_comparisons)]
#![allow(double_negations)]
#![allow(drop_bounds)]
#![allow(dropping_copy_types)]
#![allow(dropping_references)]
Expand All @@ -59,7 +61,6 @@
#![allow(unknown_lints)]
#![allow(unused_labels)]
#![allow(ambiguous_wide_pointer_comparisons)]
#![allow(clippy::reversed_empty_ranges)]
#![warn(clippy::almost_complete_letter_range)] //~ ERROR: lint `clippy::almost_complete_letter_range`
#![warn(clippy::blacklisted_name)] //~ ERROR: lint `clippy::blacklisted_name`
#![warn(clippy::block_in_if_condition_expr)] //~ ERROR: lint `clippy::block_in_if_condition_expr`
Expand All @@ -72,8 +73,8 @@
#![warn(clippy::disallowed_method)] //~ ERROR: lint `clippy::disallowed_method`
#![warn(clippy::disallowed_type)] //~ ERROR: lint `clippy::disallowed_type`
#![warn(clippy::eval_order_dependence)] //~ ERROR: lint `clippy::eval_order_dependence`
#![warn(clippy::find_map)] //~ ERROR: lint `clippy::find_map`
#![warn(clippy::filter_map)] //~ ERROR: lint `clippy::filter_map`
#![warn(clippy::find_map)] //~ ERROR: lint `clippy::find_map`
#![warn(clippy::identity_conversion)] //~ ERROR: lint `clippy::identity_conversion`
#![warn(clippy::if_let_redundant_pattern_matching)] //~ ERROR: lint `clippy::if_let_redundant_pattern_matching`
#![warn(clippy::if_let_some_result)] //~ ERROR: lint `clippy::if_let_some_result`
Expand All @@ -92,6 +93,7 @@
#![warn(clippy::result_expect_used)] //~ ERROR: lint `clippy::result_expect_used`
#![warn(clippy::result_map_unwrap_or_else)] //~ ERROR: lint `clippy::result_map_unwrap_or_else`
#![warn(clippy::result_unwrap_used)] //~ ERROR: lint `clippy::result_unwrap_used`
#![warn(clippy::reverse_range_loop)] //~ ERROR: lint `clippy::reverse_range_loop`
#![warn(clippy::single_char_push_str)] //~ ERROR: lint `clippy::single_char_push_str`
#![warn(clippy::stutter)] //~ ERROR: lint `clippy::stutter`
#![warn(clippy::thread_local_initializer_can_be_made_const)] //~ ERROR: lint `clippy::thread_local_initializer_can_be_made_const`
Expand All @@ -101,6 +103,7 @@
#![warn(clippy::cast_ref_to_mut)] //~ ERROR: lint `clippy::cast_ref_to_mut`
#![warn(clippy::clone_double_ref)] //~ ERROR: lint `clippy::clone_double_ref`
#![warn(clippy::cmp_nan)] //~ ERROR: lint `clippy::cmp_nan`
#![warn(clippy::double_neg)] //~ ERROR: lint `clippy::double_neg`
#![warn(clippy::drop_bounds)] //~ ERROR: lint `clippy::drop_bounds`
#![warn(clippy::drop_copy)] //~ ERROR: lint `clippy::drop_copy`
#![warn(clippy::drop_ref)] //~ ERROR: lint `clippy::drop_ref`
Expand All @@ -125,6 +128,5 @@
#![warn(clippy::unknown_clippy_lints)] //~ ERROR: lint `clippy::unknown_clippy_lints`
#![warn(clippy::unused_label)] //~ ERROR: lint `clippy::unused_label`
#![warn(clippy::vtable_address_comparisons)] //~ ERROR: lint `clippy::vtable_address_comparisons`
#![warn(clippy::reverse_range_loop)] //~ ERROR: lint `clippy::reverse_range_loop`

fn main() {}
Loading

0 comments on commit 326405f

Please sign in to comment.