rust-clippy/clippy_lints/src
bors e1842b0cac Auto merge of #5583 - ebroto:reversed_empty_ranges, r=yaahc,flip1995
Reversed empty ranges

This lint checks range expressions with inverted limits which result in empty ranges. This includes also the ranges used to index slices.

The lint reverse_range_loop was covering iteration of reversed ranges in a for loop, which is a subset of what this new lint covers, so it has been removed. I'm not sure if that's the best choice. It would be doable to check in the new lint that we are not in the arguments of a for loop; I went for removing it because the logic was too similar to keep them separated.

changelog: Added reversed_empty_ranges lint that checks for ranges where the limits have been inverted, resulting in empty ranges. Removed reverse_range_loop which was covering a subset of the new lint.

Closes #4192
Closes #96
2020-05-14 12:59:24 +00:00
..
methods Fixed incorrect suggestion of clone_double_ref lint 2020-04-29 22:40:57 +03:00
utils Run cargo dev fmt 2020-05-11 21:31:01 +02:00
approx_const.rs clean up a few lint docs 2020-03-18 02:50:39 +01:00
arithmetic.rs Disallow bit-shifting in integer_arithmetic lint 2020-04-13 13:23:59 +10:00
as_conversions.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
assertions_on_constants.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
assign_ops.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
atomic_ordering.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
attrs.rs mismatched_target_os: link to respective section in rust reference 2020-05-01 01:21:24 +02:00
await_holding_lock.rs span_lint_and_note now takes an Option<Span> for the note_span instead of just a span 2020-04-21 21:28:23 -07:00
bit_mask.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
blacklisted_name.rs Fix fallout 2020-02-21 11:14:18 +01:00
block_in_if_condition.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
booleans.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
bytecount.rs Run cargo dev fmt 2020-05-11 21:31:01 +02:00
cargo_common_metadata.rs Only run cargo lints, when they are warn/deny/forbid 2020-04-22 20:32:37 +02:00
checked_conversions.rs Use int assoc consts in checked_conversions lint 2020-04-08 00:43:27 +02:00
cognitive_complexity.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
collapsible_if.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
comparison_chain.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
consts.rs Removed unnecessary code, added support for vector references 2020-04-25 00:52:02 +03:00
copies.rs Change note_span argument for span_lint_and_note. 2020-04-18 18:29:36 +08:00
copy_iterator.rs Change note_span argument for span_lint_and_note. 2020-04-18 18:29:36 +08:00
dbg_macro.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
default_trait_access.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
deprecated_lints.rs Deprecate REPLACE_CONSTS lint 2020-03-29 12:59:35 +07:00
dereference.rs Better precedence case management + more tests 2020-04-15 17:18:12 +02:00
derive.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
doc.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
double_comparison.rs Fix fallout 2020-02-21 11:14:18 +01:00
double_parens.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
drop_bounds.rs Fix fallout 2020-02-21 11:14:18 +01:00
drop_forget_ref.rs Change note_span argument for span_lint_and_note. 2020-04-18 18:29:36 +08:00
duration_subsec.rs Fix fallout 2020-02-21 11:14:18 +01:00
else_if_without_else.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
empty_enum.rs Formatting and naming 2020-04-19 20:38:07 +02:00
entry.rs More diagnostic items 2020-04-26 13:44:08 +02:00
enum_clike.rs rustup https://github.com/rust-lang/rust/pull/70986 2020-04-11 10:01:23 +02:00
enum_variants.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
eq_op.rs cargo dev fmt 2020-04-17 08:09:09 +02:00
erasing_op.rs Fix fallout 2020-02-21 11:14:18 +01:00
escape.rs rustup https://github.com/rust-lang/rust/pull/71292/ 2020-04-28 15:05:56 +02:00
eta_reduction.rs Fixes internal lint warning in code base. 2020-04-18 18:20:46 +08:00
eval_order_dependence.rs Change note_span argument for span_lint_and_note. 2020-04-18 18:29:36 +08:00
excessive_bools.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
exit.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
explicit_write.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
fallible_impl_from.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
float_literal.rs Don't import primitive type modules 2020-04-08 00:43:27 +02:00
floating_point_arithmetic.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
format.rs cargo dev fmt 2020-04-26 13:44:08 +02:00
formatting.rs Change note_span argument for span_lint_and_note. 2020-04-18 18:29:36 +08:00
functions.rs rustup https://github.com/rust-lang/rust/pull/71292/ 2020-04-28 15:05:56 +02:00
future_not_send.rs Cleanup: future_not_send: use return_ty method 2020-04-19 14:00:03 +02:00
get_last_with_len.rs Cleanup: Use our sym! macro more 2020-04-13 08:57:34 +02:00
identity_conversion.rs Fixes internal lint warning in code base. 2020-04-18 18:20:46 +08:00
identity_op.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
if_let_mutex.rs More diagnostic items 2020-04-26 13:44:08 +02:00
if_let_some_result.rs Make use of Option/Result diagnostic items 2020-04-12 15:23:07 +02:00
if_not_else.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
implicit_return.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
implicit_saturating_sub.rs Added final lint and tests 2020-04-18 12:02:13 +05:30
indexing_slicing.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
infinite_iter.rs Fix fallout 2020-02-21 11:14:18 +01:00
inherent_impl.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
inherent_to_string.rs cargo dev fmt 2020-04-26 13:44:08 +02:00
inline_fn_without_body.rs Fix clippy. 2020-05-11 21:26:39 +02:00
int_plus_one.rs Fixes internal lint warning in code base. 2020-04-18 18:20:46 +08:00
integer_division.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
items_after_statements.rs Remove dependency on matches crate 2020-03-25 07:50:08 +01:00
large_const_arrays.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
large_enum_variant.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
large_stack_arrays.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
len_zero.rs Fix clippy. 2020-05-11 21:26:39 +02:00
let_if_seq.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
let_underscore.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
lib.rs Remove reverse_range_loop lint 2020-05-13 20:33:32 +02:00
lifetimes.rs don't emit lifetime lints for code inside macros. 2020-03-30 23:22:50 +02:00
literal_representation.rs Allow UUID style formatting for inconsistent_digit_grouping lint 2020-04-12 01:24:37 +01:00
loops.rs Remove reverse_range_loop lint 2020-05-13 20:33:32 +02:00
macro_use.rs Rename macro_use_import -> macro_use_imports 2020-03-05 19:22:17 +01:00
main_recursion.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
manual_async_fn.rs Apply suggestions from PR review 2020-05-07 22:40:28 +02:00
manual_non_exhaustive.rs Use the only variant left instead of a wildcard 2020-05-01 23:04:58 +02:00
map_clone.rs Run cargo dev fmt 2020-05-11 21:31:01 +02:00
map_unit_fn.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
match_on_vec_items.rs Changed RANGE_FULL constant in utils 2020-05-02 17:37:03 +03:00
matches.rs Downgrade match_bool to pedantic 2020-04-23 16:30:06 -07:00
mem_discriminant.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
mem_forget.rs Rustup to rust-lang/rust#68045 2020-01-13 21:55:57 +09:00
mem_replace.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
minmax.rs Fix fallout 2020-02-21 11:14:18 +01:00
misc.rs used_underscore_binding: do not lint on await desugaring 2020-04-27 21:20:08 +02:00
misc_early.rs Extend example for the unneeded_field_pattern lint 2020-04-28 12:08:38 +03:00
missing_const_for_fn.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
missing_doc.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
missing_inline.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
modulo_arithmetic.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
multiple_crate_versions.rs Only run cargo lints, when they are warn/deny/forbid 2020-04-22 20:32:37 +02:00
mut_key.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
mut_mut.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
mut_reference.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
mutable_debug_assertion.rs Move cognitive_complexity to nursery 2020-04-08 08:37:20 -07:00
mutex_atomic.rs More diagnostic items 2020-04-26 13:44:08 +02:00
needless_bool.rs Update clippy_lints/src/needless_bool.rs 2020-03-30 12:19:30 -07:00
needless_borrow.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
needless_borrowed_ref.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
needless_continue.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
needless_pass_by_value.rs rustup https://github.com/rust-lang/rust/pull/71292/ 2020-04-28 15:05:56 +02:00
needless_update.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
neg_cmp_op_on_partial_ord.rs Use integer assoc consts in more lint example code 2020-04-08 00:43:27 +02:00
neg_multiply.rs Fix fallout 2020-02-21 11:14:18 +01:00
new_without_default.rs rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
no_effect.rs Make use of or_patterns feature 2020-03-16 07:25:09 +01:00
non_copy_const.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
non_expressive_names.rs Fix clippy. 2020-05-11 21:26:39 +02:00
open_options.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
option_env_unwrap.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
overflow_check_conditional.rs Fix fallout 2020-02-21 11:14:18 +01:00
panic_unimplemented.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
partialeq_ne_impl.rs Fix fallout 2020-02-21 11:14:18 +01:00
path_buf_push_overwrite.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
precedence.rs Integrate more idiomatic rust changes. 2020-04-17 10:12:30 +02:00
ptr.rs More diagnostic items 2020-04-26 13:44:08 +02:00
ptr_offset_with_cast.rs Clean up imports 2020-02-18 22:37:45 +09:00
question_mark.rs question_mark: don't add as_ref() for a call expression 2020-04-17 13:09:02 +09:00
ranges.rs Avoid running doctest that is expected to panic 2020-05-13 21:07:13 +02:00
redundant_clone.rs Update to rustc changes 2020-05-04 15:13:07 +02:00
redundant_field_names.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
redundant_pattern_matching.rs fix redundant_pattern_matching lint 2020-04-25 23:51:30 +03:00
redundant_pub_crate.rs rustup to https://github.com/rust-lang/rust/pull/70043 2020-04-26 10:12:14 +02:00
redundant_static_lifetimes.rs cargo dev fmt 2020-04-17 08:09:09 +02:00
reference.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
regex.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
returns.rs Formatting and naming 2020-04-19 20:38:07 +02:00
serde_api.rs Fix fallout 2020-02-21 11:14:18 +01:00
shadow.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
single_component_path_imports.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
slow_vector_initialization.rs Cleanup: Rename 'db' variable to 'diag' 2020-04-17 08:08:00 +02:00
strings.rs More diagnostic items 2020-04-26 13:44:08 +02:00
suspicious_trait_impl.rs Include OpAssign in suspicious_op_assign_impl 2020-04-05 22:25:51 +02:00
swap.rs cargo dev fmt 2020-04-26 13:44:08 +02:00
tabs_in_doc_comments.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
temporary_assignment.rs Clean up imports 2020-02-18 22:37:45 +09:00
to_digit_is_some.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
trait_bounds.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
transmute.rs Fixes internal lint warning in code base. 2020-04-18 18:20:46 +08:00
transmuting_null.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
trivially_copy_pass_by_ref.rs Downgrade trivially_copy_pass_by_ref to pedantic 2020-04-02 18:56:10 -07:00
try_err.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
types.rs Fix cargo crash 2020-04-26 14:11:58 +02:00
unicode.rs Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
unnamed_address.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
unsafe_removed_from_name.rs Fix clippy. 2020-05-11 21:26:39 +02:00
unused_io_amount.rs Auto merge of #5027 - sinkuu:vectored_io, r=phansch 2020-01-24 06:44:09 +00:00
unused_self.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
unwrap.rs Fix ICE caused in unwrap module 2020-05-13 20:35:52 +02:00
use_self.rs rustup https://github.com/rust-lang/rust/pull/70643 2020-04-14 12:25:45 +02:00
vec.rs rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
verbose_file_reads.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
wildcard_dependencies.rs Only run cargo lints, when they are warn/deny/forbid 2020-04-22 20:32:37 +02:00
wildcard_imports.rs Move is_test_module check to top of function 2020-05-09 11:10:16 -07:00
write.rs rustup https://github.com/rust-lang/rust/pull/69838 2020-03-17 10:18:22 +01:00
zero_div_zero.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00