From e9c025ea70f9297836d62e0f0c959b9359a8035a Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 6 Oct 2018 09:18:06 -0700 Subject: [PATCH] Add license header to Rust files --- build.rs | 10 + clippy_dev/src/lib.rs | 10 + clippy_dev/src/main.rs | 10 + clippy_dummy/build.rs | 10 + clippy_dummy/src/main.rs | 10 + clippy_lints/src/approx_const.rs | 10 + clippy_lints/src/arithmetic.rs | 10 + clippy_lints/src/assign_ops.rs | 10 + clippy_lints/src/attrs.rs | 10 + clippy_lints/src/bit_mask.rs | 10 + clippy_lints/src/blacklisted_name.rs | 10 + clippy_lints/src/block_in_if_condition.rs | 10 + clippy_lints/src/booleans.rs | 10 + clippy_lints/src/bytecount.rs | 10 + clippy_lints/src/collapsible_if.rs | 10 + clippy_lints/src/const_static_lifetime.rs | 10 + clippy_lints/src/consts.rs | 10 + clippy_lints/src/copies.rs | 10 + clippy_lints/src/copy_iterator.rs | 10 + clippy_lints/src/cyclomatic_complexity.rs | 10 + clippy_lints/src/default_trait_access.rs | 10 + clippy_lints/src/deprecated_lints.rs | 10 + clippy_lints/src/derive.rs | 10 + clippy_lints/src/doc.rs | 10 + clippy_lints/src/double_comparison.rs | 10 + clippy_lints/src/double_parens.rs | 10 + clippy_lints/src/drop_forget_ref.rs | 10 + clippy_lints/src/duration_subsec.rs | 10 + clippy_lints/src/else_if_without_else.rs | 10 + clippy_lints/src/empty_enum.rs | 10 + clippy_lints/src/entry.rs | 10 + clippy_lints/src/enum_clike.rs | 10 + clippy_lints/src/enum_glob_use.rs | 10 + clippy_lints/src/enum_variants.rs | 10 + clippy_lints/src/eq_op.rs | 10 + clippy_lints/src/erasing_op.rs | 10 + clippy_lints/src/escape.rs | 10 + clippy_lints/src/eta_reduction.rs | 10 + clippy_lints/src/eval_order_dependence.rs | 10 + clippy_lints/src/excessive_precision.rs | 10 + clippy_lints/src/explicit_write.rs | 10 + clippy_lints/src/fallible_impl_from.rs | 10 + clippy_lints/src/format.rs | 10 + clippy_lints/src/formatting.rs | 10 + clippy_lints/src/functions.rs | 10 + clippy_lints/src/identity_conversion.rs | 10 + clippy_lints/src/identity_op.rs | 10 + .../src/if_let_redundant_pattern_matching.rs | 10 + clippy_lints/src/if_not_else.rs | 10 + clippy_lints/src/indexing_slicing.rs | 10 + .../src/infallible_destructuring_match.rs | 10 + clippy_lints/src/infinite_iter.rs | 10 + clippy_lints/src/inherent_impl.rs | 10 + clippy_lints/src/inline_fn_without_body.rs | 10 + clippy_lints/src/int_plus_one.rs | 10 + clippy_lints/src/invalid_ref.rs | 10 + clippy_lints/src/items_after_statements.rs | 10 + clippy_lints/src/large_enum_variant.rs | 10 + clippy_lints/src/len_zero.rs | 10 + clippy_lints/src/let_if_seq.rs | 10 + clippy_lints/src/lib.rs | 10 + clippy_lints/src/lifetimes.rs | 10 + clippy_lints/src/literal_representation.rs | 10 + clippy_lints/src/loops.rs | 10 + clippy_lints/src/map_clone.rs | 10 + clippy_lints/src/map_unit_fn.rs | 10 + clippy_lints/src/matches.rs | 10 + clippy_lints/src/mem_forget.rs | 10 + clippy_lints/src/mem_replace.rs | 10 + clippy_lints/src/methods/mod.rs | 10 + .../src/methods/unnecessary_filter_map.rs | 10 + clippy_lints/src/minmax.rs | 10 + clippy_lints/src/misc.rs | 10 + clippy_lints/src/misc_early.rs | 10 + clippy_lints/src/missing_doc.rs | 10 + clippy_lints/src/missing_inline.rs | 10 + clippy_lints/src/multiple_crate_versions.rs | 10 + clippy_lints/src/mut_mut.rs | 10 + clippy_lints/src/mut_reference.rs | 10 + clippy_lints/src/mutex_atomic.rs | 10 + clippy_lints/src/needless_bool.rs | 10 + clippy_lints/src/needless_borrow.rs | 10 + clippy_lints/src/needless_borrowed_ref.rs | 10 + clippy_lints/src/needless_continue.rs | 10 + clippy_lints/src/needless_pass_by_value.rs | 10 + clippy_lints/src/needless_update.rs | 10 + clippy_lints/src/neg_cmp_op_on_partial_ord.rs | 10 + clippy_lints/src/neg_multiply.rs | 10 + clippy_lints/src/new_without_default.rs | 10 + clippy_lints/src/no_effect.rs | 10 + clippy_lints/src/non_copy_const.rs | 10 + clippy_lints/src/non_expressive_names.rs | 10 + clippy_lints/src/ok_if_let.rs | 10 + clippy_lints/src/open_options.rs | 10 + .../src/overflow_check_conditional.rs | 10 + clippy_lints/src/panic_unimplemented.rs | 10 + clippy_lints/src/partialeq_ne_impl.rs | 10 + clippy_lints/src/precedence.rs | 10 + clippy_lints/src/ptr.rs | 10 + clippy_lints/src/ptr_offset_with_cast.rs | 10 + clippy_lints/src/question_mark.rs | 10 + clippy_lints/src/ranges.rs | 10 + clippy_lints/src/redundant_field_names.rs | 10 + clippy_lints/src/reference.rs | 10 + clippy_lints/src/regex.rs | 10 + clippy_lints/src/replace_consts.rs | 10 + clippy_lints/src/returns.rs | 10 + clippy_lints/src/serde_api.rs | 10 + clippy_lints/src/shadow.rs | 10 + clippy_lints/src/strings.rs | 10 + clippy_lints/src/suspicious_trait_impl.rs | 10 + clippy_lints/src/swap.rs | 10 + clippy_lints/src/temporary_assignment.rs | 10 + clippy_lints/src/transmute.rs | 10 + .../src/trivially_copy_pass_by_ref.rs | 10 + clippy_lints/src/types.rs | 10 + clippy_lints/src/unicode.rs | 10 + clippy_lints/src/unsafe_removed_from_name.rs | 10 + clippy_lints/src/unused_io_amount.rs | 10 + clippy_lints/src/unused_label.rs | 10 + clippy_lints/src/unwrap.rs | 10 + clippy_lints/src/use_self.rs | 10 + clippy_lints/src/utils/author.rs | 10 + clippy_lints/src/utils/camel_case.rs | 10 + clippy_lints/src/utils/comparisons.rs | 10 + clippy_lints/src/utils/conf.rs | 10 + clippy_lints/src/utils/constants.rs | 10 + clippy_lints/src/utils/higher.rs | 10 + clippy_lints/src/utils/hir_utils.rs | 10 + clippy_lints/src/utils/inspector.rs | 10 + clippy_lints/src/utils/internal_lints.rs | 10 + clippy_lints/src/utils/mod.rs | 10 + clippy_lints/src/utils/paths.rs | 10 + clippy_lints/src/utils/ptr.rs | 10 + clippy_lints/src/utils/sugg.rs | 10 + clippy_lints/src/utils/usage.rs | 10 + clippy_lints/src/vec.rs | 10 + clippy_lints/src/write.rs | 10 + clippy_lints/src/zero_div_zero.rs | 10 + clippy_workspace_tests/src/main.rs | 10 + clippy_workspace_tests/subcrate/src/lib.rs | 10 + mini-macro/src/lib.rs | 10 + rustc_tools_util/src/lib.rs | 10 + src/driver.rs | 10 + src/lib.rs | 10 + src/main.rs | 10 + tests/auxiliary/test_macro.rs | 10 + tests/compile-test.rs | 10 + tests/dogfood.rs | 10 + tests/matches.rs | 10 + tests/needless_continue_helpers.rs | 10 + tests/run-pass/associated-constant-ice.rs | 10 + tests/run-pass/cc_seme.rs | 10 + tests/run-pass/enum-glob-import-crate.rs | 10 + tests/run-pass/ice-1588.rs | 10 + tests/run-pass/ice-1782.rs | 10 + tests/run-pass/ice-1969.rs | 10 + tests/run-pass/ice-2499.rs | 10 + tests/run-pass/ice-2594.rs | 10 + tests/run-pass/ice-2727.rs | 10 + tests/run-pass/ice-2760.rs | 10 + tests/run-pass/ice-2774.rs | 10 + tests/run-pass/ice-2865.rs | 10 + tests/run-pass/ice-3151.rs | 10 + tests/run-pass/ice-700.rs | 10 + tests/run-pass/ice_exacte_size.rs | 10 + tests/run-pass/if_same_then_else.rs | 10 + tests/run-pass/issue-2862.rs | 10 + tests/run-pass/issue-825.rs | 10 + tests/run-pass/issues_loop_mut_cond.rs | 10 + tests/run-pass/match_same_arms_const.rs | 10 + tests/run-pass/mut_mut_macro.rs | 10 + tests/run-pass/needless_borrow_fp.rs | 10 + .../run-pass/needless_lifetimes_impl_trait.rs | 10 + tests/run-pass/procedural_macro.rs | 10 + tests/run-pass/regressions.rs | 10 + tests/run-pass/returns.rs | 10 + tests/run-pass/single-match-else.rs | 10 + .../run-pass/used_underscore_binding_macro.rs | 10 + tests/run-pass/whitelist/conf_whitelisted.rs | 10 + tests/ui-toml/bad_toml/conf_bad_toml.rs | 10 + tests/ui-toml/bad_toml_type/conf_bad_type.rs | 10 + .../conf_french_blacklisted_name.rs | 10 + .../conf_french_blacklisted_name.stderr | 36 +- tests/ui-toml/toml_trivially_copy/test.rs | 10 + tests/ui-toml/toml_trivially_copy/test.stderr | 8 +- .../toml_unknown_key/conf_unknown_key.rs | 10 + tests/ui/absurd-extreme-comparisons.rs | 10 + tests/ui/absurd-extreme-comparisons.stderr | 72 +-- tests/ui/approx_const.rs | 10 + tests/ui/approx_const.stderr | 88 ++-- tests/ui/arithmetic.rs | 10 + tests/ui/arithmetic.stderr | 66 +-- tests/ui/assign_ops.rs | 10 + tests/ui/assign_ops.stderr | 84 ++-- tests/ui/assign_ops2.rs | 10 + tests/ui/assign_ops2.stderr | 222 ++++----- tests/ui/attrs.rs | 10 + tests/ui/attrs.stderr | 20 +- tests/ui/author.rs | 10 + tests/ui/author/call.rs | 10 + tests/ui/author/for_loop.rs | 10 + tests/ui/author/matches.rs | 10 + tests/ui/author/matches.stderr | 20 +- tests/ui/bit_masks.rs | 10 + tests/ui/bit_masks.stderr | 68 +-- tests/ui/blacklisted_name.rs | 10 + tests/ui/blacklisted_name.stderr | 64 +-- tests/ui/block_in_if_condition.rs | 10 + tests/ui/block_in_if_condition.stderr | 26 +- tests/ui/bool_comparison.rs | 10 + tests/ui/bool_comparison.stderr | 44 +- tests/ui/booleans.rs | 10 + tests/ui/booleans.stderr | 192 ++++---- tests/ui/borrow_box.rs | 10 + tests/ui/borrow_box.stderr | 30 +- tests/ui/box_vec.rs | 10 + tests/ui/box_vec.stderr | 4 +- tests/ui/builtin-type-shadow.rs | 10 + tests/ui/builtin-type-shadow.stderr | 30 +- tests/ui/bytecount.rs | 10 + tests/ui/bytecount.stderr | 26 +- tests/ui/cast.rs | 10 + tests/ui/cast.stderr | 124 ++--- tests/ui/cast_alignment.rs | 10 + tests/ui/cast_alignment.stderr | 8 +- tests/ui/cast_lossless_float.rs | 10 + tests/ui/cast_lossless_float.stderr | 56 +-- tests/ui/cast_lossless_integer.rs | 10 + tests/ui/cast_lossless_integer.stderr | 92 ++-- tests/ui/cast_size.rs | 10 + tests/ui/cast_size.stderr | 96 ++-- tests/ui/char_lit_as_u8.rs | 10 + tests/ui/char_lit_as_u8.stderr | 16 +- tests/ui/checked_unwrap.rs | 10 + tests/ui/checked_unwrap.stderr | 452 +++++++++--------- tests/ui/clone_on_copy_impl.rs | 10 + tests/ui/clone_on_copy_mut.rs | 10 + tests/ui/cmp_nan.rs | 10 + tests/ui/cmp_nan.stderr | 114 ++--- tests/ui/cmp_null.rs | 10 + tests/ui/cmp_null.stderr | 8 +- tests/ui/cmp_owned.rs | 10 + tests/ui/cmp_owned.stderr | 32 +- tests/ui/collapsible_if.rs | 10 + tests/ui/collapsible_if.stderr | 292 +++++------ tests/ui/complex_types.rs | 10 + tests/ui/complex_types.stderr | 68 +-- tests/ui/const_static_lifetime.rs | 10 + tests/ui/const_static_lifetime.stderr | 102 ++-- tests/ui/copies.rs | 10 + tests/ui/copies.stderr | 358 +++++++------- tests/ui/copy_iterator.rs | 10 + tests/ui/copy_iterator.stderr | 14 +- tests/ui/cstring.rs | 10 + tests/ui/cstring.stderr | 22 +- tests/ui/cyclomatic_complexity.rs | 10 + tests/ui/cyclomatic_complexity.stderr | 292 +++++------ tests/ui/cyclomatic_complexity_attr_used.rs | 10 + .../ui/cyclomatic_complexity_attr_used.stderr | 16 +- tests/ui/decimal_literal_representation.rs | 10 + .../ui/decimal_literal_representation.stderr | 20 +- tests/ui/default_trait_access.rs | 10 + tests/ui/default_trait_access.stderr | 32 +- tests/ui/deprecated.rs | 10 + tests/ui/deprecated.stderr | 36 +- tests/ui/derive.rs | 10 + tests/ui/derive.stderr | 92 ++-- tests/ui/diverging_sub_expression.rs | 10 + tests/ui/diverging_sub_expression.stderr | 24 +- tests/ui/dlist.rs | 10 + tests/ui/dlist.stderr | 24 +- tests/ui/doc.rs | 10 + tests/ui/doc.stderr | 128 ++--- tests/ui/double_comparison.rs | 10 + tests/ui/double_comparison.stderr | 52 +- tests/ui/double_neg.rs | 10 + tests/ui/double_neg.stderr | 12 +- tests/ui/double_parens.rs | 10 + tests/ui/double_parens.stderr | 24 +- tests/ui/drop_forget_copy.rs | 10 + tests/ui/drop_forget_copy.stderr | 48 +- tests/ui/drop_forget_ref.rs | 10 + tests/ui/drop_forget_ref.stderr | 264 +++++----- tests/ui/duplicate_underscore_argument.rs | 10 + tests/ui/duplicate_underscore_argument.stderr | 12 +- tests/ui/duration_subsec.rs | 10 + tests/ui/duration_subsec.stderr | 20 +- tests/ui/else_if_without_else.rs | 10 + tests/ui/else_if_without_else.stderr | 16 +- tests/ui/empty_enum.rs | 10 + tests/ui/empty_enum.stderr | 20 +- tests/ui/empty_line_after_outer_attribute.rs | 10 + .../empty_line_after_outer_attribute.stderr | 60 +-- tests/ui/entry.rs | 10 + tests/ui/entry.stderr | 28 +- tests/ui/enum_glob_use.rs | 10 + tests/ui/enum_glob_use.stderr | 16 +- tests/ui/enum_variants.rs | 10 + tests/ui/enum_variants.stderr | 116 ++--- tests/ui/enums_clike.rs | 10 + tests/ui/enums_clike.stderr | 58 +-- tests/ui/eq_op.rs | 10 + tests/ui/eq_op.stderr | 170 +++---- tests/ui/erasing_op.rs | 10 + tests/ui/erasing_op.stderr | 20 +- tests/ui/escape_analysis.rs | 10 + tests/ui/eta.rs | 10 + tests/ui/eta.stderr | 36 +- tests/ui/eval_order_dependence.rs | 10 + tests/ui/eval_order_dependence.stderr | 44 +- tests/ui/excessive_precision.rs | 10 + tests/ui/excessive_precision.stderr | 72 +-- tests/ui/explicit_write.rs | 10 + tests/ui/explicit_write.stderr | 24 +- tests/ui/fallible_impl_from.rs | 10 + tests/ui/fallible_impl_from.stderr | 84 ++-- tests/ui/filter_methods.rs | 10 + tests/ui/filter_methods.stderr | 48 +- tests/ui/float_cmp.rs | 10 + tests/ui/float_cmp.stderr | 24 +- tests/ui/float_cmp_const.rs | 10 + tests/ui/float_cmp_const.stderr | 56 +-- tests/ui/fn_to_numeric_cast.rs | 10 + tests/ui/fn_to_numeric_cast.stderr | 100 ++-- tests/ui/for_loop.rs | 10 + tests/ui/for_loop.stderr | 330 ++++++------- tests/ui/format.rs | 10 + tests/ui/format.stderr | 70 +-- tests/ui/formatting.rs | 10 + tests/ui/formatting.stderr | 46 +- tests/ui/functions.rs | 10 + tests/ui/functions.stderr | 50 +- tests/ui/fxhash.rs | 10 + tests/ui/fxhash.stderr | 36 +- tests/ui/get_unwrap.rs | 10 + tests/ui/get_unwrap.stderr | 48 +- tests/ui/identity_conversion.rs | 10 + tests/ui/identity_conversion.stderr | 64 +-- tests/ui/identity_op.rs | 10 + tests/ui/identity_op.stderr | 54 +-- tests/ui/if_let_redundant_pattern_matching.rs | 10 + .../if_let_redundant_pattern_matching.stderr | 24 +- tests/ui/if_not_else.rs | 10 + tests/ui/if_not_else.stderr | 24 +- tests/ui/impl.rs | 10 + tests/ui/impl.stderr | 32 +- tests/ui/implicit_hasher.rs | 10 + tests/ui/implicit_hasher.stderr | 118 ++--- tests/ui/inconsistent_digit_grouping.rs | 10 + tests/ui/inconsistent_digit_grouping.stderr | 44 +- tests/ui/indexing_slicing.rs | 10 + tests/ui/indexing_slicing.stderr | 214 ++++----- tests/ui/infallible_destructuring_match.rs | 10 + .../ui/infallible_destructuring_match.stderr | 24 +- tests/ui/infinite_iter.rs | 10 + tests/ui/infinite_iter.stderr | 64 +-- tests/ui/infinite_loop.rs | 10 + tests/ui/infinite_loop.stderr | 44 +- tests/ui/inline_fn_without_body.rs | 10 + tests/ui/inline_fn_without_body.stderr | 26 +- tests/ui/int_plus_one.rs | 10 + tests/ui/int_plus_one.stderr | 24 +- tests/ui/invalid_ref.rs | 10 + tests/ui/invalid_ref.stderr | 24 +- tests/ui/invalid_upcast_comparisons.rs | 10 + tests/ui/invalid_upcast_comparisons.stderr | 234 ++++----- tests/ui/issue-3145.rs | 10 + tests/ui/issue-3145.stderr | 8 +- tests/ui/issue_2356.rs | 10 + tests/ui/issue_2356.stderr | 8 +- tests/ui/item_after_statement.rs | 10 + tests/ui/item_after_statement.stderr | 8 +- tests/ui/large_digit_groups.rs | 10 + tests/ui/large_digit_groups.stderr | 52 +- tests/ui/large_enum_variant.rs | 10 + tests/ui/large_enum_variant.stderr | 42 +- tests/ui/len_zero.rs | 10 + tests/ui/len_zero.stderr | 118 ++--- tests/ui/let_if_seq.rs | 10 + tests/ui/let_if_seq.stderr | 48 +- tests/ui/let_return.rs | 10 + tests/ui/let_return.stderr | 16 +- tests/ui/let_unit.rs | 10 + tests/ui/let_unit.stderr | 8 +- tests/ui/lifetimes.rs | 10 + tests/ui/lifetimes.stderr | 82 ++-- tests/ui/literals.rs | 10 + tests/ui/literals.stderr | 108 ++--- tests/ui/map_clone.rs | 10 + tests/ui/map_clone.stderr | 28 +- tests/ui/map_flatten.rs | 10 + tests/ui/map_flatten.stderr | 12 +- tests/ui/match_bool.rs | 10 + tests/ui/match_bool.stderr | 88 ++-- tests/ui/matches.rs | 10 + tests/ui/matches.stderr | 282 +++++------ tests/ui/mem_forget.rs | 10 + tests/ui/mem_forget.stderr | 12 +- tests/ui/mem_replace.rs | 10 + tests/ui/mem_replace.stderr | 16 +- tests/ui/methods.rs | 10 + tests/ui/methods.stderr | 326 ++++++------- tests/ui/min_max.rs | 10 + tests/ui/min_max.stderr | 28 +- tests/ui/missing-doc.rs | 10 + tests/ui/missing-doc.stderr | 238 ++++----- tests/ui/missing_inline.rs | 10 + tests/ui/missing_inline.stderr | 30 +- tests/ui/module_inception.rs | 10 + tests/ui/module_inception.stderr | 24 +- tests/ui/modulo_one.rs | 10 + tests/ui/modulo_one.stderr | 12 +- tests/ui/mut_from_ref.rs | 10 + tests/ui/mut_from_ref.stderr | 52 +- tests/ui/mut_mut.rs | 10 + tests/ui/mut_mut.stderr | 38 +- tests/ui/mut_range_bound.rs | 10 + tests/ui/mut_range_bound.stderr | 20 +- tests/ui/mut_reference.rs | 10 + tests/ui/mut_reference.stderr | 12 +- tests/ui/mutex_atomic.rs | 10 + tests/ui/mutex_atomic.stderr | 36 +- tests/ui/needless_bool.rs | 10 + tests/ui/needless_bool.stderr | 66 +-- tests/ui/needless_borrow.rs | 10 + tests/ui/needless_borrow.stderr | 24 +- tests/ui/needless_borrowed_ref.rs | 10 + tests/ui/needless_borrowed_ref.stderr | 24 +- tests/ui/needless_collect.rs | 10 + tests/ui/needless_collect.stderr | 24 +- tests/ui/needless_continue.rs | 10 + tests/ui/needless_continue.stderr | 22 +- tests/ui/needless_pass_by_value.rs | 10 + tests/ui/needless_pass_by_value.stderr | 140 +++--- tests/ui/needless_pass_by_value_proc_macro.rs | 10 + tests/ui/needless_range_loop.rs | 10 + tests/ui/needless_range_loop.stderr | 30 +- tests/ui/needless_return.rs | 10 + tests/ui/needless_return.stderr | 32 +- tests/ui/needless_update.rs | 10 + tests/ui/needless_update.stderr | 4 +- tests/ui/neg_cmp_op_on_partial_ord.rs | 10 + tests/ui/neg_cmp_op_on_partial_ord.stderr | 16 +- tests/ui/neg_multiply.rs | 10 + tests/ui/neg_multiply.stderr | 8 +- tests/ui/never_loop.rs | 10 + tests/ui/never_loop.stderr | 110 ++--- tests/ui/new_without_default.rs | 10 + tests/ui/new_without_default.stderr | 26 +- tests/ui/no_effect.rs | 10 + tests/ui/no_effect.stderr | 338 ++++++------- tests/ui/non_copy_const.rs | 10 + tests/ui/non_copy_const.stderr | 204 ++++---- tests/ui/non_expressive_names.rs | 10 + tests/ui/non_expressive_names.stderr | 112 ++--- tests/ui/ok_expect.rs | 10 + tests/ui/ok_expect.stderr | 20 +- tests/ui/ok_if_let.rs | 10 + tests/ui/ok_if_let.stderr | 12 +- tests/ui/op_ref.rs | 10 + tests/ui/op_ref.stderr | 10 +- tests/ui/open_options.rs | 10 + tests/ui/open_options.stderr | 40 +- tests/ui/option_map_unit_fn.rs | 10 + tests/ui/option_map_unit_fn.stderr | 138 +++--- tests/ui/option_option.rs | 10 + tests/ui/option_option.stderr | 64 +-- tests/ui/overflow_check_conditional.rs | 10 + tests/ui/overflow_check_conditional.stderr | 32 +- tests/ui/panic_unimplemented.rs | 10 + tests/ui/panic_unimplemented.stderr | 28 +- tests/ui/partialeq_ne_impl.rs | 10 + tests/ui/partialeq_ne_impl.stderr | 4 +- tests/ui/patterns.rs | 10 + tests/ui/patterns.stderr | 4 +- tests/ui/precedence.rs | 10 + tests/ui/precedence.stderr | 36 +- tests/ui/print.rs | 10 + tests/ui/print.stderr | 36 +- tests/ui/print_literal.rs | 10 + tests/ui/print_literal.stderr | 56 +-- tests/ui/print_with_newline.rs | 10 + tests/ui/print_with_newline.stderr | 44 +- tests/ui/println_empty_string.rs | 10 + tests/ui/println_empty_string.stderr | 20 +- tests/ui/ptr_arg.rs | 10 + tests/ui/ptr_arg.stderr | 56 +-- tests/ui/ptr_offset_with_cast.rs | 10 + tests/ui/ptr_offset_with_cast.stderr | 8 +- tests/ui/question_mark.rs | 10 + tests/ui/question_mark.stderr | 26 +- tests/ui/range.rs | 10 + tests/ui/range.stderr | 24 +- tests/ui/range_plus_minus_one.rs | 10 + tests/ui/range_plus_minus_one.stderr | 32 +- tests/ui/redundant_closure_call.rs | 10 + tests/ui/redundant_closure_call.stderr | 24 +- tests/ui/redundant_field_names.rs | 10 + tests/ui/redundant_field_names.stderr | 28 +- tests/ui/reference.rs | 10 + tests/ui/reference.stderr | 74 +-- tests/ui/regex.rs | 10 + tests/ui/regex.stderr | 92 ++-- tests/ui/replace_consts.rs | 10 + tests/ui/replace_consts.stderr | 248 +++++----- tests/ui/result_map_unit_fn.rs | 10 + tests/ui/result_map_unit_fn.stderr | 120 ++--- tests/ui/serde.rs | 10 + tests/ui/serde.stderr | 12 +- tests/ui/shadow.rs | 10 + tests/ui/shadow.stderr | 92 ++-- tests/ui/short_circuit_statement.rs | 10 + tests/ui/short_circuit_statement.stderr | 28 +- tests/ui/single_char_pattern.rs | 10 + tests/ui/single_char_pattern.stderr | 88 ++-- tests/ui/single_match.rs | 10 + tests/ui/single_match.stderr | 50 +- tests/ui/starts_ends_with.rs | 10 + tests/ui/starts_ends_with.stderr | 56 +-- tests/ui/string_extend.rs | 10 + tests/ui/string_extend.stderr | 12 +- tests/ui/strings.rs | 10 + tests/ui/strings.stderr | 44 +- tests/ui/stutter.rs | 10 + tests/ui/stutter.stderr | 44 +- tests/ui/suspicious_arithmetic_impl.rs | 10 + tests/ui/suspicious_arithmetic_impl.stderr | 8 +- tests/ui/swap.rs | 10 + tests/ui/swap.stderr | 52 +- tests/ui/temporary_assignment.rs | 10 + tests/ui/temporary_assignment.stderr | 8 +- tests/ui/toplevel_ref_arg.rs | 10 + tests/ui/toplevel_ref_arg.stderr | 28 +- tests/ui/trailing_zeros.rs | 10 + tests/ui/trailing_zeros.stderr | 20 +- tests/ui/transmute.rs | 10 + tests/ui/transmute.stderr | 160 +++---- tests/ui/transmute_32bit.rs | 10 + tests/ui/transmute_64bit.rs | 10 + tests/ui/transmute_64bit.stderr | 8 +- tests/ui/trivially_copy_pass_by_ref.rs | 10 + tests/ui/trivially_copy_pass_by_ref.stderr | 52 +- tests/ui/ty_fn_sig.rs | 10 + tests/ui/types.rs | 10 + tests/ui/types.stderr | 12 +- tests/ui/unicode.rs | 10 + tests/ui/unicode.stderr | 24 +- tests/ui/unit_arg.rs | 10 + tests/ui/unit_arg.stderr | 42 +- tests/ui/unit_cmp.rs | 10 + tests/ui/unit_cmp.stderr | 8 +- tests/ui/unnecessary_clone.rs | 10 + tests/ui/unnecessary_clone.stderr | 48 +- tests/ui/unnecessary_filter_map.rs | 10 + tests/ui/unnecessary_filter_map.stderr | 44 +- tests/ui/unnecessary_fold.rs | 10 + tests/ui/unnecessary_fold.stderr | 48 +- tests/ui/unnecessary_ref.rs | 10 + tests/ui/unnecessary_ref.stderr | 8 +- tests/ui/unneeded_field_pattern.rs | 10 + tests/ui/unneeded_field_pattern.stderr | 8 +- tests/ui/unreadable_literal.rs | 10 + tests/ui/unreadable_literal.stderr | 44 +- tests/ui/unsafe_removed_from_name.rs | 10 + tests/ui/unsafe_removed_from_name.stderr | 24 +- tests/ui/unused_io_amount.rs | 10 + tests/ui/unused_io_amount.stderr | 24 +- tests/ui/unused_labels.rs | 10 + tests/ui/unused_labels.stderr | 20 +- tests/ui/unused_lt.rs | 10 + tests/ui/unused_lt.stderr | 12 +- tests/ui/unwrap_or.rs | 10 + tests/ui/unwrap_or.stderr | 16 +- tests/ui/use_self.rs | 10 + tests/ui/use_self.stderr | 130 ++--- tests/ui/used_underscore_binding.rs | 10 + tests/ui/used_underscore_binding.stderr | 20 +- tests/ui/useless_asref.rs | 10 + tests/ui/useless_asref.stderr | 48 +- tests/ui/useless_attribute.rs | 10 + tests/ui/useless_attribute.stderr | 20 +- tests/ui/vec.rs | 10 + tests/ui/vec.stderr | 24 +- tests/ui/while_loop.rs | 10 + tests/ui/while_loop.stderr | 112 ++--- tests/ui/write_literal.rs | 10 + tests/ui/write_literal.stderr | 56 +-- tests/ui/write_with_newline.rs | 10 + tests/ui/write_with_newline.stderr | 16 +- tests/ui/writeln_empty_string.rs | 10 + tests/ui/writeln_empty_string.stderr | 8 +- tests/ui/wrong_self_convention.rs | 10 + tests/ui/wrong_self_convention.stderr | 48 +- tests/ui/zero_div_zero.rs | 10 + tests/ui/zero_div_zero.stderr | 98 ++-- tests/ui/zero_ptr.rs | 10 + tests/ui/zero_ptr.stderr | 20 +- tests/versioncheck.rs | 10 + 599 files changed, 10254 insertions(+), 6294 deletions(-) mode change 100755 => 100644 tests/ui/author/call.rs diff --git a/build.rs b/build.rs index 146a8dae7..336f0295b 100644 --- a/build.rs +++ b/build.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { // Forward the profile to the main compilation println!("cargo:rustc-env=PROFILE={}", std::env::var("PROFILE").unwrap()); diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs index 2f91c987c..2087a4b07 100644 --- a/clippy_dev/src/lib.rs +++ b/clippy_dev/src/lib.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::default_hash_types)] diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs index f45c52e22..28f831a9b 100644 --- a/clippy_dev/src/main.rs +++ b/clippy_dev/src/main.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + extern crate clap; extern crate clippy_dev; extern crate regex; diff --git a/clippy_dummy/build.rs b/clippy_dummy/build.rs index 97902feff..b4ea0772e 100644 --- a/clippy_dummy/build.rs +++ b/clippy_dummy/build.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + extern crate term; fn main() { diff --git a/clippy_dummy/src/main.rs b/clippy_dummy/src/main.rs index a118834f1..878993d5c 100644 --- a/clippy_dummy/src/main.rs +++ b/clippy_dummy/src/main.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { panic!("This shouldn't even compile") } diff --git a/clippy_lints/src/approx_const.rs b/clippy_lints/src/approx_const.rs index 4d921daea..01cb03730 100644 --- a/clippy_lints/src/approx_const.rs +++ b/clippy_lints/src/approx_const.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::utils::span_lint; use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/arithmetic.rs b/clippy_lints/src/arithmetic.rs index bdf8d237c..4d7e92156 100644 --- a/clippy_lints/src/arithmetic.rs +++ b/clippy_lints/src/arithmetic.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::utils::span_lint; use crate::rustc::hir; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/assign_ops.rs b/clippy_lints/src/assign_ops.rs index a05a4d550..3fbac7bc1 100644 --- a/clippy_lints/src/assign_ops.rs +++ b/clippy_lints/src/assign_ops.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, SpanlessEq}; use crate::utils::{higher, sugg}; use crate::rustc::hir; diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index e192c3f20..f463ce5fa 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! checks for attributes use crate::reexport::*; diff --git a/clippy_lints/src/bit_mask.rs b/clippy_lints/src/bit_mask.rs index 7151e8db9..6ba6a1829 100644 --- a/clippy_lints/src/bit_mask.rs +++ b/clippy_lints/src/bit_mask.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/blacklisted_name.rs b/clippy_lints/src/blacklisted_name.rs index 9d6005cd6..ecc9957b8 100644 --- a/clippy_lints/src/blacklisted_name.rs +++ b/clippy_lints/src/blacklisted_name.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir::*; diff --git a/clippy_lints/src/block_in_if_condition.rs b/clippy_lints/src/block_in_if_condition.rs index c1b4b4575..129b8fe9e 100644 --- a/clippy_lints/src/block_in_if_condition.rs +++ b/clippy_lints/src/block_in_if_condition.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use matches::matches; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index 1201b4a0c..f12859d90 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir::*; diff --git a/clippy_lints/src/bytecount.rs b/clippy_lints/src/bytecount.rs index 7ec556b5d..a61e823f9 100644 --- a/clippy_lints/src/bytecount.rs +++ b/clippy_lints/src/bytecount.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/collapsible_if.rs b/clippy_lints/src/collapsible_if.rs index b0fb05811..85fdca1d4 100644 --- a/clippy_lints/src/collapsible_if.rs +++ b/clippy_lints/src/collapsible_if.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Checks for if expressions that contain only an if expression. //! //! For example, the lint would catch: diff --git a/clippy_lints/src/const_static_lifetime.rs b/clippy_lints/src/const_static_lifetime.rs index bb9829ad3..4c49aee28 100644 --- a/clippy_lints/src/const_static_lifetime.rs +++ b/clippy_lints/src/const_static_lifetime.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::syntax::ast::*; use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index 4e09e0391..584060aec 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![allow(clippy::float_cmp)] use crate::rustc::lint::LateContext; diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index 26669d8c4..ac73dc1f5 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::ty::Ty; diff --git a/clippy_lints/src/copy_iterator.rs b/clippy_lints/src/copy_iterator.rs index 17f32c7bb..f4d29433c 100644 --- a/clippy_lints/src/copy_iterator.rs +++ b/clippy_lints/src/copy_iterator.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::utils::{is_copy, match_path, paths, span_note_and_lint}; use crate::rustc::hir::{Item, ItemKind}; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/cyclomatic_complexity.rs b/clippy_lints/src/cyclomatic_complexity.rs index db85a3f3f..7971d20d8 100644 --- a/clippy_lints/src/cyclomatic_complexity.rs +++ b/clippy_lints/src/cyclomatic_complexity.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! calculate cyclomatic complexity and warn about overly complex functions use crate::rustc::cfg::CFG; diff --git a/clippy_lints/src/default_trait_access.rs b/clippy_lints/src/default_trait_access.rs index 5f2b1a29d..66d94e00d 100644 --- a/clippy_lints/src/default_trait_access.rs +++ b/clippy_lints/src/default_trait_access.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/deprecated_lints.rs b/clippy_lints/src/deprecated_lints.rs index 983f347c5..0067629bb 100644 --- a/clippy_lints/src/deprecated_lints.rs +++ b/clippy_lints/src/deprecated_lints.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + macro_rules! declare_deprecated_lint { (pub $name: ident, $_reason: expr) => { declare_lint!(pub $name, Allow, "deprecated lint") diff --git a/clippy_lints/src/derive.rs b/clippy_lints/src/derive.rs index 21365f605..792699fc0 100644 --- a/clippy_lints/src/derive.rs +++ b/clippy_lints/src/derive.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index 19f2916cc..9c25e79aa 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use itertools::Itertools; use pulldown_cmark; use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/double_comparison.rs b/clippy_lints/src/double_comparison.rs index c692bffaf..e151918c1 100644 --- a/clippy_lints/src/double_comparison.rs +++ b/clippy_lints/src/double_comparison.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Lint on unnecessary double comparisons. Some examples: use crate::rustc::hir::*; diff --git a/clippy_lints/src/double_parens.rs b/clippy_lints/src/double_parens.rs index 3b2ef4e8b..ffaf93bd7 100644 --- a/clippy_lints/src/double_parens.rs +++ b/clippy_lints/src/double_parens.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::syntax::ast::*; use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/drop_forget_ref.rs b/clippy_lints/src/drop_forget_ref.rs index 1dbca5ed9..cac5d0da7 100644 --- a/clippy_lints/src/drop_forget_ref.rs +++ b/clippy_lints/src/drop_forget_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/duration_subsec.rs b/clippy_lints/src/duration_subsec.rs index 709cbd277..a679a97c2 100644 --- a/clippy_lints/src/duration_subsec.rs +++ b/clippy_lints/src/duration_subsec.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/else_if_without_else.rs b/clippy_lints/src/else_if_without_else.rs index da6e860e2..26ffef9eb 100644 --- a/clippy_lints/src/else_if_without_else.rs +++ b/clippy_lints/src/else_if_without_else.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint on if expressions with an else if, but without a final else branch use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; diff --git a/clippy_lints/src/empty_enum.rs b/clippy_lints/src/empty_enum.rs index 48c96a0ff..7ac33fd45 100644 --- a/clippy_lints/src/empty_enum.rs +++ b/clippy_lints/src/empty_enum.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint when there is an enum with no variants use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index 965d425b4..75c437452 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/enum_clike.rs b/clippy_lints/src/enum_clike.rs index b49322dca..8fba45de8 100644 --- a/clippy_lints/src/enum_clike.rs +++ b/clippy_lints/src/enum_clike.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint on C-like enums that are `repr(isize/usize)` and have values that //! don't fit into an `i32` diff --git a/clippy_lints/src/enum_glob_use.rs b/clippy_lints/src/enum_glob_use.rs index d594406de..ebd28ee27 100644 --- a/clippy_lints/src/enum_glob_use.rs +++ b/clippy_lints/src/enum_glob_use.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint on `use`ing all variants of an enum use crate::rustc::hir::*; diff --git a/clippy_lints/src/enum_variants.rs b/clippy_lints/src/enum_variants.rs index c68439d16..8d708f017 100644 --- a/clippy_lints/src/enum_variants.rs +++ b/clippy_lints/src/enum_variants.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint on enum variants that are prefixed or suffixed by the same characters use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, Lint}; diff --git a/clippy_lints/src/eq_op.rs b/clippy_lints/src/eq_op.rs index 7b9f2568d..a454ea836 100644 --- a/clippy_lints/src/eq_op.rs +++ b/clippy_lints/src/eq_op.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/erasing_op.rs b/clippy_lints/src/erasing_op.rs index 7e313daff..7bfc2ef31 100644 --- a/clippy_lints/src/erasing_op.rs +++ b/clippy_lints/src/erasing_op.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::consts::{constant_simple, Constant}; use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs index 8af232420..0491cde4f 100644 --- a/clippy_lints/src/escape.rs +++ b/clippy_lints/src/escape.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::hir::intravisit as visit; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index 556f76af3..59c7f8a36 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::ty; diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index 068d6fb13..31fae2d19 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use crate::rustc::hir::*; use crate::rustc::ty; diff --git a/clippy_lints/src/excessive_precision.rs b/clippy_lints/src/excessive_precision.rs index 0ae228d1d..9f8224cd2 100644 --- a/clippy_lints/src/excessive_precision.rs +++ b/clippy_lints/src/excessive_precision.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/explicit_write.rs b/clippy_lints/src/explicit_write.rs index 888dca979..b5a5d7e49 100644 --- a/clippy_lints/src/explicit_write.rs +++ b/clippy_lints/src/explicit_write.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/fallible_impl_from.rs b/clippy_lints/src/fallible_impl_from.rs index 146e23665..07674ef27 100644 --- a/clippy_lints/src/fallible_impl_from.rs +++ b/clippy_lints/src/fallible_impl_from.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index 7e2e355c2..41046a98a 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/formatting.rs b/clippy_lints/src/formatting.rs index 92950706d..7f5715ef6 100644 --- a/clippy_lints/src/formatting.rs +++ b/clippy_lints/src/formatting.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::syntax::ast; diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index d73c0710b..d087452d1 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use matches::matches; use crate::rustc::hir::intravisit; use crate::rustc::hir; diff --git a/clippy_lints/src/identity_conversion.rs b/clippy_lints/src/identity_conversion.rs index 5b1bd0ada..e97616166 100644 --- a/clippy_lints/src/identity_conversion.rs +++ b/clippy_lints/src/identity_conversion.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir::*; diff --git a/clippy_lints/src/identity_op.rs b/clippy_lints/src/identity_op.rs index 836e4fafb..3f05f21e8 100644 --- a/clippy_lints/src/identity_op.rs +++ b/clippy_lints/src/identity_op.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::consts::{constant_simple, Constant}; use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/if_let_redundant_pattern_matching.rs b/clippy_lints/src/if_let_redundant_pattern_matching.rs index c9fbf1b07..4ee8d9f0c 100644 --- a/clippy_lints/src/if_let_redundant_pattern_matching.rs +++ b/clippy_lints/src/if_let_redundant_pattern_matching.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir::*; diff --git a/clippy_lints/src/if_not_else.rs b/clippy_lints/src/if_not_else.rs index 954f8543a..e005eb401 100644 --- a/clippy_lints/src/if_not_else.rs +++ b/clippy_lints/src/if_not_else.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint on if branches that could be swapped so no `!` operation is necessary //! on the condition diff --git a/clippy_lints/src/indexing_slicing.rs b/clippy_lints/src/indexing_slicing.rs index 1010b53e0..984d72589 100644 --- a/clippy_lints/src/indexing_slicing.rs +++ b/clippy_lints/src/indexing_slicing.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint on indexing and slicing operations use crate::consts::{constant, Constant}; diff --git a/clippy_lints/src/infallible_destructuring_match.rs b/clippy_lints/src/infallible_destructuring_match.rs index dabc167f3..7bbbe72f9 100644 --- a/clippy_lints/src/infallible_destructuring_match.rs +++ b/clippy_lints/src/infallible_destructuring_match.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use super::utils::{get_arg_name, match_var, remove_blocks, snippet, span_lint_and_sugg}; use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/infinite_iter.rs b/clippy_lints/src/infinite_iter.rs index a15ec8c14..9c727dccd 100644 --- a/clippy_lints/src/infinite_iter.rs +++ b/clippy_lints/src/infinite_iter.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/inherent_impl.rs b/clippy_lints/src/inherent_impl.rs index 167259b73..3fa442a35 100644 --- a/clippy_lints/src/inherent_impl.rs +++ b/clippy_lints/src/inherent_impl.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint on inherent implementations use crate::rustc::hir::*; diff --git a/clippy_lints/src/inline_fn_without_body.rs b/clippy_lints/src/inline_fn_without_body.rs index 881bebc2f..bbd16eaea 100644 --- a/clippy_lints/src/inline_fn_without_body.rs +++ b/clippy_lints/src/inline_fn_without_body.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! checks for `#[inline]` on trait methods without bodies use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/int_plus_one.rs b/clippy_lints/src/int_plus_one.rs index 69a19e2fb..4349b15f1 100644 --- a/clippy_lints/src/int_plus_one.rs +++ b/clippy_lints/src/int_plus_one.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint on blocks unnecessarily using >= with a + 1 or - 1 use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/invalid_ref.rs b/clippy_lints/src/invalid_ref.rs index 55de89983..fe5991920 100644 --- a/clippy_lints/src/invalid_ref.rs +++ b/clippy_lints/src/invalid_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/items_after_statements.rs b/clippy_lints/src/items_after_statements.rs index a12c9c400..57124e5d0 100644 --- a/clippy_lints/src/items_after_statements.rs +++ b/clippy_lints/src/items_after_statements.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint when items are used after statements use matches::matches; diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index e8982d92b..79ff0c84b 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint when there is a large size difference between variants on an enum use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index b126b8dbb..defb5892e 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::def_id::DefId; use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/let_if_seq.rs b/clippy_lints/src/let_if_seq.rs index 53d13407b..4cee4f34a 100644 --- a/clippy_lints/src/let_if_seq.rs +++ b/clippy_lints/src/let_if_seq.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 3779b09ec..e4ad9fe9c 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // error-pattern:cargo-clippy #![feature(box_syntax)] diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index dbd433bc9..d1cf0da87 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::reexport::*; use matches::matches; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; diff --git a/clippy_lints/src/literal_representation.rs b/clippy_lints/src/literal_representation.rs index 188ca1574..a123415cc 100644 --- a/clippy_lints/src/literal_representation.rs +++ b/clippy_lints/src/literal_representation.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Lints concerned with the grouping of digits with underscores in integral or //! floating-point literal expressions. diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 2c05d9a19..b807e4fb9 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use itertools::Itertools; use crate::reexport::*; use crate::rustc::hir::*; diff --git a/clippy_lints/src/map_clone.rs b/clippy_lints/src/map_clone.rs index e16a8af76..c2bfcf182 100644 --- a/clippy_lints/src/map_clone.rs +++ b/clippy_lints/src/map_clone.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/map_unit_fn.rs b/clippy_lints/src/map_unit_fn.rs index 40b81e6fd..e620a1815 100644 --- a/clippy_lints/src/map_unit_fn.rs +++ b/clippy_lints/src/map_unit_fn.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index c1a65e756..e46615f4d 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/mem_forget.rs b/clippy_lints/src/mem_forget.rs index 7a07ecbf0..dd2a1ca50 100644 --- a/clippy_lints/src/mem_forget.rs +++ b/clippy_lints/src/mem_forget.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir::{Expr, ExprKind}; diff --git a/clippy_lints/src/mem_replace.rs b/clippy_lints/src/mem_replace.rs index fd22e3afe..ff57571a9 100644 --- a/clippy_lints/src/mem_replace.rs +++ b/clippy_lints/src/mem_replace.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::{Expr, ExprKind, MutMutable, QPath}; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index e0d858bd2..30c82e396 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir; use crate::rustc::hir::def::Def; use crate::rustc::lint::{in_external_macro, LateContext, LateLintPass, Lint, LintArray, LintContext, LintPass}; diff --git a/clippy_lints/src/methods/unnecessary_filter_map.rs b/clippy_lints/src/methods/unnecessary_filter_map.rs index 0a3486df8..86889c4c7 100644 --- a/clippy_lints/src/methods/unnecessary_filter_map.rs +++ b/clippy_lints/src/methods/unnecessary_filter_map.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir; use crate::rustc::hir::def::Def; use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; diff --git a/clippy_lints/src/minmax.rs b/clippy_lints/src/minmax.rs index 293d301eb..222247307 100644 --- a/clippy_lints/src/minmax.rs +++ b/clippy_lints/src/minmax.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::consts::{constant_simple, Constant}; use crate::utils::{match_def_path, opt_def_id, paths, span_lint}; use crate::rustc::hir::*; diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index 0fa05de28..a83fa75de 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::reexport::*; use matches::matches; use crate::rustc::hir::*; diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index d3e1ca937..a2fd48707 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, LintContext, in_external_macro}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc_data_structures::fx::FxHashMap; diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index 685f701ef..20da0e7a6 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // This file incorporates work covered by the following copyright and // permission notice: // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT diff --git a/clippy_lints/src/missing_inline.rs b/clippy_lints/src/missing_inline.rs index dea3a81e5..2f3819a2d 100644 --- a/clippy_lints/src/missing_inline.rs +++ b/clippy_lints/src/missing_inline.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/clippy_lints/src/multiple_crate_versions.rs b/clippy_lints/src/multiple_crate_versions.rs index 9c10a929d..dbf8cbe16 100644 --- a/clippy_lints/src/multiple_crate_versions.rs +++ b/clippy_lints/src/multiple_crate_versions.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! lint on multiple versions of a crate being used use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/mut_mut.rs b/clippy_lints/src/mut_mut.rs index b3607d623..737d8bfd9 100644 --- a/clippy_lints/src/mut_mut.rs +++ b/clippy_lints/src/mut_mut.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir; use crate::rustc::hir::intravisit; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; diff --git a/clippy_lints/src/mut_reference.rs b/clippy_lints/src/mut_reference.rs index 1bf06b9e2..bdf8bf80c 100644 --- a/clippy_lints/src/mut_reference.rs +++ b/clippy_lints/src/mut_reference.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::ty::{self, Ty}; diff --git a/clippy_lints/src/mutex_atomic.rs b/clippy_lints/src/mutex_atomic.rs index f6caddab4..8ddaf692b 100644 --- a/clippy_lints/src/mutex_atomic.rs +++ b/clippy_lints/src/mutex_atomic.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Checks for uses of mutex where an atomic value could be used //! //! This lint is **warn** by default diff --git a/clippy_lints/src/needless_bool.rs b/clippy_lints/src/needless_bool.rs index 74b664755..f102b49d7 100644 --- a/clippy_lints/src/needless_bool.rs +++ b/clippy_lints/src/needless_bool.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Checks for needless boolean results of if-else expressions //! //! This lint is **warn** by default diff --git a/clippy_lints/src/needless_borrow.rs b/clippy_lints/src/needless_borrow.rs index 8a676be99..639358a7c 100644 --- a/clippy_lints/src/needless_borrow.rs +++ b/clippy_lints/src/needless_borrow.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Checks for needless address of operations (`&`) //! //! This lint is **warn** by default diff --git a/clippy_lints/src/needless_borrowed_ref.rs b/clippy_lints/src/needless_borrowed_ref.rs index 057a097f4..f40fbef6d 100644 --- a/clippy_lints/src/needless_borrowed_ref.rs +++ b/clippy_lints/src/needless_borrowed_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Checks for useless borrowed references. //! //! This lint is **warn** by default diff --git a/clippy_lints/src/needless_continue.rs b/clippy_lints/src/needless_continue.rs index 0f7ea34f1..6a39595f6 100644 --- a/clippy_lints/src/needless_continue.rs +++ b/clippy_lints/src/needless_continue.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Checks for continue statements in loops that are redundant. //! //! For example, the lint would catch diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index 73d59d7a3..39f519ac5 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use matches::matches; use crate::rustc::hir::*; use crate::rustc::hir::intravisit::FnKind; diff --git a/clippy_lints/src/needless_update.rs b/clippy_lints/src/needless_update.rs index 7c452bed0..3388c92e0 100644 --- a/clippy_lints/src/needless_update.rs +++ b/clippy_lints/src/needless_update.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::ty; diff --git a/clippy_lints/src/neg_cmp_op_on_partial_ord.rs b/clippy_lints/src/neg_cmp_op_on_partial_ord.rs index 08ad4dd43..7cd14b9a2 100644 --- a/clippy_lints/src/neg_cmp_op_on_partial_ord.rs +++ b/clippy_lints/src/neg_cmp_op_on_partial_ord.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/neg_multiply.rs b/clippy_lints/src/neg_multiply.rs index f39cfc8d1..d3b72372c 100644 --- a/clippy_lints/src/neg_multiply.rs +++ b/clippy_lints/src/neg_multiply.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index e0b54620f..9f2d29a1b 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::def_id::DefId; use crate::rustc::hir; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; diff --git a/clippy_lints/src/no_effect.rs b/clippy_lints/src/no_effect.rs index 5ff097967..289b5591e 100644 --- a/clippy_lints/src/no_effect.rs +++ b/clippy_lints/src/no_effect.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir::def::Def; diff --git a/clippy_lints/src/non_copy_const.rs b/clippy_lints/src/non_copy_const.rs index 3b97e9d4a..61b57db51 100644 --- a/clippy_lints/src/non_copy_const.rs +++ b/clippy_lints/src/non_copy_const.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Checks for uses of const which the type is not Freeze (Cell-free). //! //! This lint is **deny** by default. diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index 77642b472..ad4f52a52 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LintArray, LintPass, EarlyContext, EarlyLintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::syntax::source_map::Span; diff --git a/clippy_lints/src/ok_if_let.rs b/clippy_lints/src/ok_if_let.rs index cd97e4853..9a23b05b8 100644 --- a/clippy_lints/src/ok_if_let.rs +++ b/clippy_lints/src/ok_if_let.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/open_options.rs b/clippy_lints/src/open_options.rs index 913319254..4f647d053 100644 --- a/clippy_lints/src/open_options.rs +++ b/clippy_lints/src/open_options.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::{Expr, ExprKind}; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/overflow_check_conditional.rs b/clippy_lints/src/overflow_check_conditional.rs index bdd87ad3a..d0805896f 100644 --- a/clippy_lints/src/overflow_check_conditional.rs +++ b/clippy_lints/src/overflow_check_conditional.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/panic_unimplemented.rs b/clippy_lints/src/panic_unimplemented.rs index 404f43312..003c9bdf0 100644 --- a/clippy_lints/src/panic_unimplemented.rs +++ b/clippy_lints/src/panic_unimplemented.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/partialeq_ne_impl.rs b/clippy_lints/src/partialeq_ne_impl.rs index 7eb0c0897..d38e02d63 100644 --- a/clippy_lints/src/partialeq_ne_impl.rs +++ b/clippy_lints/src/partialeq_ne_impl.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/precedence.rs b/clippy_lints/src/precedence.rs index e77a49266..1c5e8fcb9 100644 --- a/clippy_lints/src/precedence.rs +++ b/clippy_lints/src/precedence.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::syntax::ast::*; diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 86cb89f2d..187d89cdd 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Checks for usage of `&Vec[_]` and `&String`. use std::borrow::Cow; diff --git a/clippy_lints/src/ptr_offset_with_cast.rs b/clippy_lints/src/ptr_offset_with_cast.rs index 261e5cccb..38a9bbf6d 100644 --- a/clippy_lints/src/ptr_offset_with_cast.rs +++ b/clippy_lints/src/ptr_offset_with_cast.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::{declare_tool_lint, hir, lint, lint_array}; use crate::utils; use std::fmt; diff --git a/clippy_lints/src/question_mark.rs b/clippy_lints/src/question_mark.rs index ced0fe3ef..0ec57e0be 100644 --- a/clippy_lints/src/question_mark.rs +++ b/clippy_lints/src/question_mark.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index c60ed3842..bc3125253 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/redundant_field_names.rs b/clippy_lints/src/redundant_field_names.rs index 38cb4578d..526232f78 100644 --- a/clippy_lints/src/redundant_field_names.rs +++ b/clippy_lints/src/redundant_field_names.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::syntax::ast::*; diff --git a/clippy_lints/src/reference.rs b/clippy_lints/src/reference.rs index 1faacc79d..79d30612c 100644 --- a/clippy_lints/src/reference.rs +++ b/clippy_lints/src/reference.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::syntax::ast::{Expr, ExprKind, UnOp}; use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs index 41ff8a4bc..7a818c41f 100644 --- a/clippy_lints/src/regex.rs +++ b/clippy_lints/src/regex.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use regex_syntax; use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/replace_consts.rs b/clippy_lints/src/replace_consts.rs index 05cca2ac3..ca17a0325 100644 --- a/clippy_lints/src/replace_consts.rs +++ b/clippy_lints/src/replace_consts.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index 9ab6b50ad..f43608024 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/serde_api.rs b/clippy_lints/src/serde_api.rs index f2cfdf82d..5f8789016 100644 --- a/clippy_lints/src/serde_api.rs +++ b/clippy_lints/src/serde_api.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir::*; diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index 4a9893536..16567535c 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::reexport::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index 54fced124..f47988422 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/suspicious_trait_impl.rs b/clippy_lints/src/suspicious_trait_impl.rs index 78a2c2ade..af7ff8d93 100644 --- a/clippy_lints/src/suspicious_trait_impl.rs +++ b/clippy_lints/src/suspicious_trait_impl.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index 5de2f0e54..77a33e9ee 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use matches::matches; use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/temporary_assignment.rs b/clippy_lints/src/temporary_assignment.rs index 7cde4eb48..292bf9fb6 100644 --- a/clippy_lints/src/temporary_assignment.rs +++ b/clippy_lints/src/temporary_assignment.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir::{Expr, ExprKind}; diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index 69422056d..0d49f5de2 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs index baa9a8c39..61a2a9ded 100644 --- a/clippy_lints/src/trivially_copy_pass_by_ref.rs +++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use std::cmp; use matches::matches; diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 2e6600883..24b895b23 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![allow(clippy::default_hash_types)] use crate::reexport::*; diff --git a/clippy_lints/src/unicode.rs b/clippy_lints/src/unicode.rs index 83f9713b5..a140b567f 100644 --- a/clippy_lints/src/unicode.rs +++ b/clippy_lints/src/unicode.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir::*; diff --git a/clippy_lints/src/unsafe_removed_from_name.rs b/clippy_lints/src/unsafe_removed_from_name.rs index e6472eb50..cd9d649ed 100644 --- a/clippy_lints/src/unsafe_removed_from_name.rs +++ b/clippy_lints/src/unsafe_removed_from_name.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::syntax::ast::*; diff --git a/clippy_lints/src/unused_io_amount.rs b/clippy_lints/src/unused_io_amount.rs index 82430a794..1bb819a74 100644 --- a/clippy_lints/src/unused_io_amount.rs +++ b/clippy_lints/src/unused_io_amount.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir; diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs index a67164bec..0b2237ac2 100644 --- a/clippy_lints/src/unused_label.rs +++ b/clippy_lints/src/unused_label.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::hir; diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs index f8fe1b3bd..f7a2d0805 100644 --- a/clippy_lints/src/unwrap.rs +++ b/clippy_lints/src/unwrap.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index 3b2659a61..d770ea120 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::utils::{in_macro, span_lint_and_sugg}; use if_chain::if_chain; use crate::rustc::hir::intravisit::{walk_path, walk_ty, NestedVisitorMap, Visitor}; diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index 8e8d40e28..6650dd67b 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! A group of attributes that can be attached to Rust code in order //! to generate a clippy lint detecting said code automatically. diff --git a/clippy_lints/src/utils/camel_case.rs b/clippy_lints/src/utils/camel_case.rs index e8a8d510f..2b60e2c32 100644 --- a/clippy_lints/src/utils/camel_case.rs +++ b/clippy_lints/src/utils/camel_case.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + /// Return the index of the character after the first camel-case component of /// `s`. pub fn camel_case_until(s: &str) -> usize { diff --git a/clippy_lints/src/utils/comparisons.rs b/clippy_lints/src/utils/comparisons.rs index bd90fe1bc..986802107 100644 --- a/clippy_lints/src/utils/comparisons.rs +++ b/clippy_lints/src/utils/comparisons.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Utility functions about comparison operators. #![deny(clippy::missing_docs_in_private_items)] diff --git a/clippy_lints/src/utils/conf.rs b/clippy_lints/src/utils/conf.rs index d79a7743e..faf4e2702 100644 --- a/clippy_lints/src/utils/conf.rs +++ b/clippy_lints/src/utils/conf.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Read configurations files. #![deny(clippy::missing_docs_in_private_items)] diff --git a/clippy_lints/src/utils/constants.rs b/clippy_lints/src/utils/constants.rs index b63be9b86..42da95a12 100644 --- a/clippy_lints/src/utils/constants.rs +++ b/clippy_lints/src/utils/constants.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! This module contains some useful constants. #![deny(clippy::missing_docs_in_private_items)] diff --git a/clippy_lints/src/utils/higher.rs b/clippy_lints/src/utils/higher.rs index cfedad49f..584a6df1c 100644 --- a/clippy_lints/src/utils/higher.rs +++ b/clippy_lints/src/utils/higher.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! This module contains functions for retrieve the original AST from lowered //! `hir`. diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index 2257fbf77..bc55c2297 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::consts::{constant_simple, constant_context}; use crate::rustc::lint::LateContext; use crate::rustc::hir::*; diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index 413c71ab2..841aaaabd 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![allow(clippy::print_stdout, clippy::use_debug)] //! checks for attributes diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index 058f7ee2f..3a0d056bb 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::utils::{ match_qpath, match_type, paths, span_help_and_lint, span_lint, span_lint_and_sugg, walk_ptrs_ty, }; diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 6c963cf20..7282e5064 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::reexport::*; use matches::matches; use if_chain::if_chain; diff --git a/clippy_lints/src/utils/paths.rs b/clippy_lints/src/utils/paths.rs index f2f1a4db3..12ef2f51d 100644 --- a/clippy_lints/src/utils/paths.rs +++ b/clippy_lints/src/utils/paths.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! This module contains paths to types and functions Clippy needs to know //! about. diff --git a/clippy_lints/src/utils/ptr.rs b/clippy_lints/src/utils/ptr.rs index a28e1c7fe..43ab0f064 100644 --- a/clippy_lints/src/utils/ptr.rs +++ b/clippy_lints/src/utils/ptr.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use std::borrow::Cow; use crate::rustc::hir::*; use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index 076907e49..fecfc0c07 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //! Contains utility functions to generate suggestions. #![deny(clippy::missing_docs_in_private_items)] diff --git a/clippy_lints/src/utils/usage.rs b/clippy_lints/src/utils/usage.rs index 826ca78e6..d26ffc715 100644 --- a/clippy_lints/src/utils/usage.rs +++ b/clippy_lints/src/utils/usage.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::lint::LateContext; use crate::rustc::hir::def::Def; diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs index 4c6060192..21a33bd14 100644 --- a/clippy_lints/src/vec.rs +++ b/clippy_lints/src/vec.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::rustc::hir::*; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index a367a04b2..05ddbfe6f 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::utils::{snippet, span_lint, span_lint_and_sugg}; use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_lints/src/zero_div_zero.rs b/clippy_lints/src/zero_div_zero.rs index 5ceff6d4a..779a6a59e 100644 --- a/clippy_lints/src/zero_div_zero.rs +++ b/clippy_lints/src/zero_div_zero.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use crate::consts::{constant_simple, Constant}; use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; diff --git a/clippy_workspace_tests/src/main.rs b/clippy_workspace_tests/src/main.rs index f79c691f0..7af28f80b 100644 --- a/clippy_workspace_tests/src/main.rs +++ b/clippy_workspace_tests/src/main.rs @@ -1,2 +1,12 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { } diff --git a/clippy_workspace_tests/subcrate/src/lib.rs b/clippy_workspace_tests/subcrate/src/lib.rs index e69de29bb..fd694f68c 100644 --- a/clippy_workspace_tests/subcrate/src/lib.rs +++ b/clippy_workspace_tests/subcrate/src/lib.rs @@ -0,0 +1,10 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + diff --git a/mini-macro/src/lib.rs b/mini-macro/src/lib.rs index 01cdc70c7..d326dd7e6 100644 --- a/mini-macro/src/lib.rs +++ b/mini-macro/src/lib.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(proc_macro_quote, proc_macro_hygiene)] extern crate proc_macro; diff --git a/rustc_tools_util/src/lib.rs b/rustc_tools_util/src/lib.rs index 09d80072d..0951a0dee 100644 --- a/rustc_tools_util/src/lib.rs +++ b/rustc_tools_util/src/lib.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use std::env; #[macro_export] diff --git a/src/driver.rs b/src/driver.rs index 6c442e42d..d2ed3cb1c 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // error-pattern:yummy #![feature(box_syntax)] #![feature(rustc_private)] diff --git a/src/lib.rs b/src/lib.rs index bfa44d087..58158f92e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // error-pattern:cargo-clippy #![feature(plugin_registrar)] #![feature(rustc_private)] diff --git a/src/main.rs b/src/main.rs index cf2654977..11c259b4d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // error-pattern:yummy #![feature(box_syntax)] #![feature(rustc_private)] diff --git a/tests/auxiliary/test_macro.rs b/tests/auxiliary/test_macro.rs index 624ca892a..497fedff1 100644 --- a/tests/auxiliary/test_macro.rs +++ b/tests/auxiliary/test_macro.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + pub trait A {} macro_rules! __implicit_hasher_test_macro { diff --git a/tests/compile-test.rs b/tests/compile-test.rs index da5c5bd32..c9d4f6589 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(test)] extern crate compiletest_rs as compiletest; diff --git a/tests/dogfood.rs b/tests/dogfood.rs index ff7452c7c..0815b1466 100644 --- a/tests/dogfood.rs +++ b/tests/dogfood.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #[test] fn dogfood() { if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) { diff --git a/tests/matches.rs b/tests/matches.rs index 3b4910315..99b05e50c 100644 --- a/tests/matches.rs +++ b/tests/matches.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(rustc_private)] extern crate clippy_lints; diff --git a/tests/needless_continue_helpers.rs b/tests/needless_continue_helpers.rs index 2f6f5c0a8..662ae1108 100644 --- a/tests/needless_continue_helpers.rs +++ b/tests/needless_continue_helpers.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // Tests for the various helper functions used by the needless_continue diff --git a/tests/run-pass/associated-constant-ice.rs b/tests/run-pass/associated-constant-ice.rs index 2c5c90683..bc9a0b3b6 100644 --- a/tests/run-pass/associated-constant-ice.rs +++ b/tests/run-pass/associated-constant-ice.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + pub trait Trait { const CONSTANT: u8; } diff --git a/tests/run-pass/cc_seme.rs b/tests/run-pass/cc_seme.rs index 1539d3c61..215b4096b 100644 --- a/tests/run-pass/cc_seme.rs +++ b/tests/run-pass/cc_seme.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #[allow(dead_code)] enum Baz { One, diff --git a/tests/run-pass/enum-glob-import-crate.rs b/tests/run-pass/enum-glob-import-crate.rs index 6014558a1..c1e1d9645 100644 --- a/tests/run-pass/enum-glob-import-crate.rs +++ b/tests/run-pass/enum-glob-import-crate.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::all)] diff --git a/tests/run-pass/ice-1588.rs b/tests/run-pass/ice-1588.rs index fcda3814e..db5a6629a 100644 --- a/tests/run-pass/ice-1588.rs +++ b/tests/run-pass/ice-1588.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::all)] diff --git a/tests/run-pass/ice-1782.rs b/tests/run-pass/ice-1782.rs index fcd3e7cf5..2101b4d30 100644 --- a/tests/run-pass/ice-1782.rs +++ b/tests/run-pass/ice-1782.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![allow(dead_code, unused_variables)] /// Should not trigger an ICE in `SpanlessEq` / `consts::constant` diff --git a/tests/run-pass/ice-1969.rs b/tests/run-pass/ice-1969.rs index 43d6bd8bf..0b4a0f4df 100644 --- a/tests/run-pass/ice-1969.rs +++ b/tests/run-pass/ice-1969.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::all)] diff --git a/tests/run-pass/ice-2499.rs b/tests/run-pass/ice-2499.rs index c6793a785..9716e5500 100644 --- a/tests/run-pass/ice-2499.rs +++ b/tests/run-pass/ice-2499.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(dead_code, clippy::char_lit_as_u8, clippy::needless_bool)] diff --git a/tests/run-pass/ice-2594.rs b/tests/run-pass/ice-2594.rs index 7cd30b6d9..8bd77e3d6 100644 --- a/tests/run-pass/ice-2594.rs +++ b/tests/run-pass/ice-2594.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![allow(dead_code, unused_variables)] /// Should not trigger an ICE in `SpanlessHash` / `consts::constant` diff --git a/tests/run-pass/ice-2727.rs b/tests/run-pass/ice-2727.rs index 79c6f1c55..420be4c71 100644 --- a/tests/run-pass/ice-2727.rs +++ b/tests/run-pass/ice-2727.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + pub fn f(new: fn()) { new(); } diff --git a/tests/run-pass/ice-2760.rs b/tests/run-pass/ice-2760.rs index 2e9c6d527..ad517b84c 100644 --- a/tests/run-pass/ice-2760.rs +++ b/tests/run-pass/ice-2760.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused_variables, clippy::blacklisted_name, diff --git a/tests/run-pass/ice-2774.rs b/tests/run-pass/ice-2774.rs index 6b14a2b5e..6ed09a4a0 100644 --- a/tests/run-pass/ice-2774.rs +++ b/tests/run-pass/ice-2774.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] use std::collections::HashSet; diff --git a/tests/run-pass/ice-2865.rs b/tests/run-pass/ice-2865.rs index 430de25a2..171391574 100644 --- a/tests/run-pass/ice-2865.rs +++ b/tests/run-pass/ice-2865.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #[allow(dead_code)] struct Ice { size: String diff --git a/tests/run-pass/ice-3151.rs b/tests/run-pass/ice-3151.rs index 5ee83dac7..8e1b7b9a1 100644 --- a/tests/run-pass/ice-3151.rs +++ b/tests/run-pass/ice-3151.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #[derive(Clone)] pub struct HashMap { hash_builder: S, diff --git a/tests/run-pass/ice-700.rs b/tests/run-pass/ice-700.rs index 3992af2c2..3252381e1 100644 --- a/tests/run-pass/ice-700.rs +++ b/tests/run-pass/ice-700.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::all)] diff --git a/tests/run-pass/ice_exacte_size.rs b/tests/run-pass/ice_exacte_size.rs index 3d25aa504..8a905a401 100644 --- a/tests/run-pass/ice_exacte_size.rs +++ b/tests/run-pass/ice_exacte_size.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::all)] diff --git a/tests/run-pass/if_same_then_else.rs b/tests/run-pass/if_same_then_else.rs index b7536e250..4f0f58106 100644 --- a/tests/run-pass/if_same_then_else.rs +++ b/tests/run-pass/if_same_then_else.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::if_same_then_else)] diff --git a/tests/run-pass/issue-2862.rs b/tests/run-pass/issue-2862.rs index b35df667f..298ce088c 100644 --- a/tests/run-pass/issue-2862.rs +++ b/tests/run-pass/issue-2862.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + pub trait FooMap { fn map B>(&self, f: F) -> B; } diff --git a/tests/run-pass/issue-825.rs b/tests/run-pass/issue-825.rs index 79df259ea..576d53757 100644 --- a/tests/run-pass/issue-825.rs +++ b/tests/run-pass/issue-825.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![allow(warnings)] // this should compile in a reasonable amount of time diff --git a/tests/run-pass/issues_loop_mut_cond.rs b/tests/run-pass/issues_loop_mut_cond.rs index 6ecd40b99..c3deae9ba 100644 --- a/tests/run-pass/issues_loop_mut_cond.rs +++ b/tests/run-pass/issues_loop_mut_cond.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![allow(dead_code)] /// Issue: https://github.com/rust-lang-nursery/rust-clippy/issues/2596 diff --git a/tests/run-pass/match_same_arms_const.rs b/tests/run-pass/match_same_arms_const.rs index 59b939f3e..1e36baf05 100644 --- a/tests/run-pass/match_same_arms_const.rs +++ b/tests/run-pass/match_same_arms_const.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::match_same_arms)] diff --git a/tests/run-pass/mut_mut_macro.rs b/tests/run-pass/mut_mut_macro.rs index bfb9cfc71..afc3c9eda 100644 --- a/tests/run-pass/mut_mut_macro.rs +++ b/tests/run-pass/mut_mut_macro.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::mut_mut, clippy::zero_ptr, clippy::cmp_nan)] diff --git a/tests/run-pass/needless_borrow_fp.rs b/tests/run-pass/needless_borrow_fp.rs index 204968e48..6a70849d9 100644 --- a/tests/run-pass/needless_borrow_fp.rs +++ b/tests/run-pass/needless_borrow_fp.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #[deny(clippy::all)] diff --git a/tests/run-pass/needless_lifetimes_impl_trait.rs b/tests/run-pass/needless_lifetimes_impl_trait.rs index f727b2547..b27bb284e 100644 --- a/tests/run-pass/needless_lifetimes_impl_trait.rs +++ b/tests/run-pass/needless_lifetimes_impl_trait.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::needless_lifetimes)] diff --git a/tests/run-pass/procedural_macro.rs b/tests/run-pass/procedural_macro.rs index 2b7ff123e..a9c9dd06b 100644 --- a/tests/run-pass/procedural_macro.rs +++ b/tests/run-pass/procedural_macro.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #[macro_use] extern crate clippy_mini_macro_test; diff --git a/tests/run-pass/regressions.rs b/tests/run-pass/regressions.rs index aa4e16d39..a58992221 100644 --- a/tests/run-pass/regressions.rs +++ b/tests/run-pass/regressions.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::blacklisted_name)] diff --git a/tests/run-pass/returns.rs b/tests/run-pass/returns.rs index 882d3aa7f..cc7678d60 100644 --- a/tests/run-pass/returns.rs +++ b/tests/run-pass/returns.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #[deny(warnings)] fn cfg_return() -> i32 { #[cfg(unix)] return 1; diff --git a/tests/run-pass/single-match-else.rs b/tests/run-pass/single-match-else.rs index 379a98fc3..54c282451 100644 --- a/tests/run-pass/single-match-else.rs +++ b/tests/run-pass/single-match-else.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::single_match_else)] diff --git a/tests/run-pass/used_underscore_binding_macro.rs b/tests/run-pass/used_underscore_binding_macro.rs index 73f48a96e..b700ab90a 100644 --- a/tests/run-pass/used_underscore_binding_macro.rs +++ b/tests/run-pass/used_underscore_binding_macro.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::useless_attribute)] //issue #2910 diff --git a/tests/run-pass/whitelist/conf_whitelisted.rs b/tests/run-pass/whitelist/conf_whitelisted.rs index f328e4d9d..168f09a09 100644 --- a/tests/run-pass/whitelist/conf_whitelisted.rs +++ b/tests/run-pass/whitelist/conf_whitelisted.rs @@ -1 +1,11 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() {} diff --git a/tests/ui-toml/bad_toml/conf_bad_toml.rs b/tests/ui-toml/bad_toml/conf_bad_toml.rs index 325688ac7..10c0f0004 100644 --- a/tests/ui-toml/bad_toml/conf_bad_toml.rs +++ b/tests/ui-toml/bad_toml/conf_bad_toml.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // error-pattern: error reading Clippy's configuration file diff --git a/tests/ui-toml/bad_toml_type/conf_bad_type.rs b/tests/ui-toml/bad_toml_type/conf_bad_type.rs index f97f5802b..021a839d9 100644 --- a/tests/ui-toml/bad_toml_type/conf_bad_type.rs +++ b/tests/ui-toml/bad_toml_type/conf_bad_type.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // error-pattern: error reading Clippy's configuration file: `blacklisted-names` is expected to be a `Vec < String >` but is a `integer` diff --git a/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs b/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs index fe533f521..4f0cd1659 100644 --- a/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs +++ b/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr b/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr index 4229b711b..dd414657c 100644 --- a/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr +++ b/tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr @@ -1,45 +1,45 @@ error: use of a blacklisted/placeholder name `toto` - --> $DIR/conf_french_blacklisted_name.rs:9:9 - | -9 | fn test(toto: ()) {} - | ^^^^ - | - = note: `-D clippy::blacklisted-name` implied by `-D warnings` + --> $DIR/conf_french_blacklisted_name.rs:19:9 + | +19 | fn test(toto: ()) {} + | ^^^^ + | + = note: `-D clippy::blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `toto` - --> $DIR/conf_french_blacklisted_name.rs:12:9 + --> $DIR/conf_french_blacklisted_name.rs:22:9 | -12 | let toto = 42; +22 | let toto = 42; | ^^^^ error: use of a blacklisted/placeholder name `tata` - --> $DIR/conf_french_blacklisted_name.rs:13:9 + --> $DIR/conf_french_blacklisted_name.rs:23:9 | -13 | let tata = 42; +23 | let tata = 42; | ^^^^ error: use of a blacklisted/placeholder name `titi` - --> $DIR/conf_french_blacklisted_name.rs:14:9 + --> $DIR/conf_french_blacklisted_name.rs:24:9 | -14 | let titi = 42; +24 | let titi = 42; | ^^^^ error: use of a blacklisted/placeholder name `toto` - --> $DIR/conf_french_blacklisted_name.rs:20:10 + --> $DIR/conf_french_blacklisted_name.rs:30:10 | -20 | (toto, Some(tata), titi @ Some(_)) => (), +30 | (toto, Some(tata), titi @ Some(_)) => (), | ^^^^ error: use of a blacklisted/placeholder name `tata` - --> $DIR/conf_french_blacklisted_name.rs:20:21 + --> $DIR/conf_french_blacklisted_name.rs:30:21 | -20 | (toto, Some(tata), titi @ Some(_)) => (), +30 | (toto, Some(tata), titi @ Some(_)) => (), | ^^^^ error: use of a blacklisted/placeholder name `titi` - --> $DIR/conf_french_blacklisted_name.rs:20:28 + --> $DIR/conf_french_blacklisted_name.rs:30:28 | -20 | (toto, Some(tata), titi @ Some(_)) => (), +30 | (toto, Some(tata), titi @ Some(_)) => (), | ^^^^ error: aborting due to 7 previous errors diff --git a/tests/ui-toml/toml_trivially_copy/test.rs b/tests/ui-toml/toml_trivially_copy/test.rs index 074ca064a..081dbf9b0 100644 --- a/tests/ui-toml/toml_trivially_copy/test.rs +++ b/tests/ui-toml/toml_trivially_copy/test.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::many_single_char_names)] diff --git a/tests/ui-toml/toml_trivially_copy/test.stderr b/tests/ui-toml/toml_trivially_copy/test.stderr index cf2f15a68..ad3ca831f 100644 --- a/tests/ui-toml/toml_trivially_copy/test.stderr +++ b/tests/ui-toml/toml_trivially_copy/test.stderr @@ -1,15 +1,15 @@ error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/test.rs:13:11 + --> $DIR/test.rs:23:11 | -13 | fn bad(x: &u16, y: &Foo) { +23 | fn bad(x: &u16, y: &Foo) { | ^^^^ help: consider passing by value instead: `u16` | = note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/test.rs:13:20 + --> $DIR/test.rs:23:20 | -13 | fn bad(x: &u16, y: &Foo) { +23 | fn bad(x: &u16, y: &Foo) { | ^^^^ help: consider passing by value instead: `Foo` error: aborting due to 2 previous errors diff --git a/tests/ui-toml/toml_unknown_key/conf_unknown_key.rs b/tests/ui-toml/toml_unknown_key/conf_unknown_key.rs index bfa804558..60e8e4fc2 100644 --- a/tests/ui-toml/toml_unknown_key/conf_unknown_key.rs +++ b/tests/ui-toml/toml_unknown_key/conf_unknown_key.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // error-pattern: error reading Clippy's configuration file: unknown key `foobar` diff --git a/tests/ui/absurd-extreme-comparisons.rs b/tests/ui/absurd-extreme-comparisons.rs index d08c8008e..a88e57a5c 100644 --- a/tests/ui/absurd-extreme-comparisons.rs +++ b/tests/ui/absurd-extreme-comparisons.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/absurd-extreme-comparisons.stderr b/tests/ui/absurd-extreme-comparisons.stderr index 2e5ebec75..6c32b309a 100644 --- a/tests/ui/absurd-extreme-comparisons.stderr +++ b/tests/ui/absurd-extreme-comparisons.stderr @@ -1,144 +1,144 @@ error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:10:5 + --> $DIR/absurd-extreme-comparisons.rs:20:5 | -10 | u <= 0; +20 | u <= 0; | ^^^^^^ | = note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings` = help: because 0 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 0 instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:11:5 + --> $DIR/absurd-extreme-comparisons.rs:21:5 | -11 | u <= Z; +21 | u <= Z; | ^^^^^^ | = help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == Z instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:12:5 + --> $DIR/absurd-extreme-comparisons.rs:22:5 | -12 | u < Z; +22 | u < Z; | ^^^^^ | = help: because Z is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:13:5 + --> $DIR/absurd-extreme-comparisons.rs:23:5 | -13 | Z >= u; +23 | Z >= u; | ^^^^^^ | = help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using Z == u instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:14:5 + --> $DIR/absurd-extreme-comparisons.rs:24:5 | -14 | Z > u; +24 | Z > u; | ^^^^^ | = help: because Z is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:15:5 + --> $DIR/absurd-extreme-comparisons.rs:25:5 | -15 | u > std::u32::MAX; +25 | u > std::u32::MAX; | ^^^^^^^^^^^^^^^^^ | = help: because std::u32::MAX is the maximum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:16:5 + --> $DIR/absurd-extreme-comparisons.rs:26:5 | -16 | u >= std::u32::MAX; +26 | u >= std::u32::MAX; | ^^^^^^^^^^^^^^^^^^ | = help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == std::u32::MAX instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:17:5 + --> $DIR/absurd-extreme-comparisons.rs:27:5 | -17 | std::u32::MAX < u; +27 | std::u32::MAX < u; | ^^^^^^^^^^^^^^^^^ | = help: because std::u32::MAX is the maximum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:18:5 + --> $DIR/absurd-extreme-comparisons.rs:28:5 | -18 | std::u32::MAX <= u; +28 | std::u32::MAX <= u; | ^^^^^^^^^^^^^^^^^^ | = help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using std::u32::MAX == u instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:19:5 + --> $DIR/absurd-extreme-comparisons.rs:29:5 | -19 | 1-1 > u; +29 | 1-1 > u; | ^^^^^^^ | = help: because 1-1 is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:20:5 + --> $DIR/absurd-extreme-comparisons.rs:30:5 | -20 | u >= !0; +30 | u >= !0; | ^^^^^^^ | = help: because !0 is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == !0 instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:21:5 + --> $DIR/absurd-extreme-comparisons.rs:31:5 | -21 | u <= 12 - 2*6; +31 | u <= 12 - 2*6; | ^^^^^^^^^^^^^ | = help: because 12 - 2*6 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 12 - 2*6 instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:23:5 + --> $DIR/absurd-extreme-comparisons.rs:33:5 | -23 | i < -127 - 1; +33 | i < -127 - 1; | ^^^^^^^^^^^^ | = help: because -127 - 1 is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:24:5 + --> $DIR/absurd-extreme-comparisons.rs:34:5 | -24 | std::i8::MAX >= i; +34 | std::i8::MAX >= i; | ^^^^^^^^^^^^^^^^^ | = help: because std::i8::MAX is the maximum value for this type, this comparison is always true error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:25:5 + --> $DIR/absurd-extreme-comparisons.rs:35:5 | -25 | 3-7 < std::i32::MIN; +35 | 3-7 < std::i32::MIN; | ^^^^^^^^^^^^^^^^^^^ | = help: because std::i32::MIN is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:27:5 + --> $DIR/absurd-extreme-comparisons.rs:37:5 | -27 | b >= true; +37 | b >= true; | ^^^^^^^^^ | = help: because true is the maximum value for this type, the case where the two sides are not equal never occurs, consider using b == true instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:28:5 + --> $DIR/absurd-extreme-comparisons.rs:38:5 | -28 | false > b; +38 | false > b; | ^^^^^^^^^ | = help: because false is the minimum value for this type, this comparison is always false error: <-comparison of unit values detected. This will always be false - --> $DIR/absurd-extreme-comparisons.rs:31:5 + --> $DIR/absurd-extreme-comparisons.rs:41:5 | -31 | () < {}; +41 | () < {}; | ^^^^^^^ | = note: #[deny(clippy::unit_cmp)] on by default diff --git a/tests/ui/approx_const.rs b/tests/ui/approx_const.rs index 46ca2fbfb..ea023b8a7 100644 --- a/tests/ui/approx_const.rs +++ b/tests/ui/approx_const.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/approx_const.stderr b/tests/ui/approx_const.stderr index 3ff016b9c..a765ffb64 100644 --- a/tests/ui/approx_const.stderr +++ b/tests/ui/approx_const.stderr @@ -1,117 +1,117 @@ error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly - --> $DIR/approx_const.rs:7:16 - | -7 | let my_e = 2.7182; - | ^^^^^^ - | - = note: `-D clippy::approx-constant` implied by `-D warnings` + --> $DIR/approx_const.rs:17:16 + | +17 | let my_e = 2.7182; + | ^^^^^^ + | + = note: `-D clippy::approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly - --> $DIR/approx_const.rs:8:20 - | -8 | let almost_e = 2.718; - | ^^^^^ + --> $DIR/approx_const.rs:18:20 + | +18 | let almost_e = 2.718; + | ^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_1_PI` found. Consider using it directly - --> $DIR/approx_const.rs:11:24 + --> $DIR/approx_const.rs:21:24 | -11 | let my_1_frac_pi = 0.3183; +21 | let my_1_frac_pi = 0.3183; | ^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly - --> $DIR/approx_const.rs:14:28 + --> $DIR/approx_const.rs:24:28 | -14 | let my_frac_1_sqrt_2 = 0.70710678; +24 | let my_frac_1_sqrt_2 = 0.70710678; | ^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly - --> $DIR/approx_const.rs:15:32 + --> $DIR/approx_const.rs:25:32 | -15 | let almost_frac_1_sqrt_2 = 0.70711; +25 | let almost_frac_1_sqrt_2 = 0.70711; | ^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_2_PI` found. Consider using it directly - --> $DIR/approx_const.rs:18:24 + --> $DIR/approx_const.rs:28:24 | -18 | let my_frac_2_pi = 0.63661977; +28 | let my_frac_2_pi = 0.63661977; | ^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_2_SQRT_PI` found. Consider using it directly - --> $DIR/approx_const.rs:21:27 + --> $DIR/approx_const.rs:31:27 | -21 | let my_frac_2_sq_pi = 1.128379; +31 | let my_frac_2_sq_pi = 1.128379; | ^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_2` found. Consider using it directly - --> $DIR/approx_const.rs:24:24 + --> $DIR/approx_const.rs:34:24 | -24 | let my_frac_pi_2 = 1.57079632679; +34 | let my_frac_pi_2 = 1.57079632679; | ^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_3` found. Consider using it directly - --> $DIR/approx_const.rs:27:24 + --> $DIR/approx_const.rs:37:24 | -27 | let my_frac_pi_3 = 1.04719755119; +37 | let my_frac_pi_3 = 1.04719755119; | ^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_4` found. Consider using it directly - --> $DIR/approx_const.rs:30:24 + --> $DIR/approx_const.rs:40:24 | -30 | let my_frac_pi_4 = 0.785398163397; +40 | let my_frac_pi_4 = 0.785398163397; | ^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_6` found. Consider using it directly - --> $DIR/approx_const.rs:33:24 + --> $DIR/approx_const.rs:43:24 | -33 | let my_frac_pi_6 = 0.523598775598; +43 | let my_frac_pi_6 = 0.523598775598; | ^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::FRAC_PI_8` found. Consider using it directly - --> $DIR/approx_const.rs:36:24 + --> $DIR/approx_const.rs:46:24 | -36 | let my_frac_pi_8 = 0.3926990816987; +46 | let my_frac_pi_8 = 0.3926990816987; | ^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::LN_10` found. Consider using it directly - --> $DIR/approx_const.rs:39:20 + --> $DIR/approx_const.rs:49:20 | -39 | let my_ln_10 = 2.302585092994046; +49 | let my_ln_10 = 2.302585092994046; | ^^^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::LN_2` found. Consider using it directly - --> $DIR/approx_const.rs:42:19 + --> $DIR/approx_const.rs:52:19 | -42 | let my_ln_2 = 0.6931471805599453; +52 | let my_ln_2 = 0.6931471805599453; | ^^^^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::LOG10_E` found. Consider using it directly - --> $DIR/approx_const.rs:45:22 + --> $DIR/approx_const.rs:55:22 | -45 | let my_log10_e = 0.4342944819032518; +55 | let my_log10_e = 0.4342944819032518; | ^^^^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::LOG2_E` found. Consider using it directly - --> $DIR/approx_const.rs:48:21 + --> $DIR/approx_const.rs:58:21 | -48 | let my_log2_e = 1.4426950408889634; +58 | let my_log2_e = 1.4426950408889634; | ^^^^^^^^^^^^^^^^^^ error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly - --> $DIR/approx_const.rs:51:17 + --> $DIR/approx_const.rs:61:17 | -51 | let my_pi = 3.1415; +61 | let my_pi = 3.1415; | ^^^^^^ error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly - --> $DIR/approx_const.rs:52:21 + --> $DIR/approx_const.rs:62:21 | -52 | let almost_pi = 3.14; +62 | let almost_pi = 3.14; | ^^^^ error: approximate value of `f{32, 64}::consts::SQRT_2` found. Consider using it directly - --> $DIR/approx_const.rs:55:18 + --> $DIR/approx_const.rs:65:18 | -55 | let my_sq2 = 1.4142; +65 | let my_sq2 = 1.4142; | ^^^^^^ error: aborting due to 19 previous errors diff --git a/tests/ui/arithmetic.rs b/tests/ui/arithmetic.rs index e7aa9a18b..a5bf8c928 100644 --- a/tests/ui/arithmetic.rs +++ b/tests/ui/arithmetic.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/arithmetic.stderr b/tests/ui/arithmetic.stderr index ee7a594fa..5e6021403 100644 --- a/tests/ui/arithmetic.stderr +++ b/tests/ui/arithmetic.stderr @@ -1,72 +1,72 @@ error: integer arithmetic detected - --> $DIR/arithmetic.rs:8:5 - | -8 | 1 + i; - | ^^^^^ - | - = note: `-D clippy::integer-arithmetic` implied by `-D warnings` - -error: integer arithmetic detected - --> $DIR/arithmetic.rs:9:5 - | -9 | i * 2; - | ^^^^^ - -error: integer arithmetic detected - --> $DIR/arithmetic.rs:10:5 + --> $DIR/arithmetic.rs:18:5 | -10 | / 1 % -11 | | i / 2; // no error, this is part of the expression in the preceding line +18 | 1 + i; + | ^^^^^ + | + = note: `-D clippy::integer-arithmetic` implied by `-D warnings` + +error: integer arithmetic detected + --> $DIR/arithmetic.rs:19:5 + | +19 | i * 2; + | ^^^^^ + +error: integer arithmetic detected + --> $DIR/arithmetic.rs:20:5 + | +20 | / 1 % +21 | | i / 2; // no error, this is part of the expression in the preceding line | |_________^ error: integer arithmetic detected - --> $DIR/arithmetic.rs:12:5 + --> $DIR/arithmetic.rs:22:5 | -12 | i - 2 + 2 - i; +22 | i - 2 + 2 - i; | ^^^^^^^^^^^^^ error: integer arithmetic detected - --> $DIR/arithmetic.rs:13:5 + --> $DIR/arithmetic.rs:23:5 | -13 | -i; +23 | -i; | ^^ error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:23:5 + --> $DIR/arithmetic.rs:33:5 | -23 | f * 2.0; +33 | f * 2.0; | ^^^^^^^ | = note: `-D clippy::float-arithmetic` implied by `-D warnings` error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:25:5 + --> $DIR/arithmetic.rs:35:5 | -25 | 1.0 + f; +35 | 1.0 + f; | ^^^^^^^ error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:26:5 + --> $DIR/arithmetic.rs:36:5 | -26 | f * 2.0; +36 | f * 2.0; | ^^^^^^^ error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:27:5 + --> $DIR/arithmetic.rs:37:5 | -27 | f / 2.0; +37 | f / 2.0; | ^^^^^^^ error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:28:5 + --> $DIR/arithmetic.rs:38:5 | -28 | f - 2.0 * 4.2; +38 | f - 2.0 * 4.2; | ^^^^^^^^^^^^^ error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:29:5 + --> $DIR/arithmetic.rs:39:5 | -29 | -f; +39 | -f; | ^^ error: aborting due to 11 previous errors diff --git a/tests/ui/assign_ops.rs b/tests/ui/assign_ops.rs index 765dbb679..5d791ba8f 100644 --- a/tests/ui/assign_ops.rs +++ b/tests/ui/assign_ops.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #[allow(dead_code, unused_assignments)] diff --git a/tests/ui/assign_ops.stderr b/tests/ui/assign_ops.stderr index fe7ccff78..20ed51334 100644 --- a/tests/ui/assign_ops.stderr +++ b/tests/ui/assign_ops.stderr @@ -1,57 +1,57 @@ error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:7:5 - | -7 | a = a + 1; - | ^^^^^^^^^ help: replace it with: `a += 1` - | - = note: `-D clippy::assign-op-pattern` implied by `-D warnings` - -error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:8:5 - | -8 | a = 1 + a; - | ^^^^^^^^^ help: replace it with: `a += 1` - -error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:9:5 - | -9 | a = a - 1; - | ^^^^^^^^^ help: replace it with: `a -= 1` - -error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:10:5 + --> $DIR/assign_ops.rs:17:5 | -10 | a = a * 99; - | ^^^^^^^^^^ help: replace it with: `a *= 99` +17 | a = a + 1; + | ^^^^^^^^^ help: replace it with: `a += 1` + | + = note: `-D clippy::assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:11:5 + --> $DIR/assign_ops.rs:18:5 | -11 | a = 42 * a; - | ^^^^^^^^^^ help: replace it with: `a *= 42` +18 | a = 1 + a; + | ^^^^^^^^^ help: replace it with: `a += 1` error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:12:5 + --> $DIR/assign_ops.rs:19:5 | -12 | a = a / 2; - | ^^^^^^^^^ help: replace it with: `a /= 2` - -error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:13:5 - | -13 | a = a % 5; - | ^^^^^^^^^ help: replace it with: `a %= 5` - -error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:14:5 - | -14 | a = a & 1; - | ^^^^^^^^^ help: replace it with: `a &= 1` +19 | a = a - 1; + | ^^^^^^^^^ help: replace it with: `a -= 1` error: manual implementation of an assign operation --> $DIR/assign_ops.rs:20:5 | -20 | s = s + "bla"; +20 | a = a * 99; + | ^^^^^^^^^^ help: replace it with: `a *= 99` + +error: manual implementation of an assign operation + --> $DIR/assign_ops.rs:21:5 + | +21 | a = 42 * a; + | ^^^^^^^^^^ help: replace it with: `a *= 42` + +error: manual implementation of an assign operation + --> $DIR/assign_ops.rs:22:5 + | +22 | a = a / 2; + | ^^^^^^^^^ help: replace it with: `a /= 2` + +error: manual implementation of an assign operation + --> $DIR/assign_ops.rs:23:5 + | +23 | a = a % 5; + | ^^^^^^^^^ help: replace it with: `a %= 5` + +error: manual implementation of an assign operation + --> $DIR/assign_ops.rs:24:5 + | +24 | a = a & 1; + | ^^^^^^^^^ help: replace it with: `a &= 1` + +error: manual implementation of an assign operation + --> $DIR/assign_ops.rs:30:5 + | +30 | s = s + "bla"; | ^^^^^^^^^^^^^ help: replace it with: `s += "bla"` error: aborting due to 9 previous errors diff --git a/tests/ui/assign_ops2.rs b/tests/ui/assign_ops2.rs index c3f5083bb..9eef898c9 100644 --- a/tests/ui/assign_ops2.rs +++ b/tests/ui/assign_ops2.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/assign_ops2.stderr b/tests/ui/assign_ops2.stderr index 93528e505..8e44fc13b 100644 --- a/tests/ui/assign_ops2.stderr +++ b/tests/ui/assign_ops2.stderr @@ -1,129 +1,129 @@ error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:8:5 - | -8 | a += a + 1; - | ^^^^^^^^^^ - | - = note: `-D clippy::misrefactored-assign-op` implied by `-D warnings` + --> $DIR/assign_ops2.rs:18:5 + | +18 | a += a + 1; + | ^^^^^^^^^^ + | + = note: `-D clippy::misrefactored-assign-op` implied by `-D warnings` help: Did you mean a = a + 1 or a = a + a + 1? Consider replacing it with - | -8 | a += 1; - | ^^^^^^ -help: or - | -8 | a = a + a + 1; - | ^^^^^^^^^^^^^ - -error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:9:5 - | -9 | a += 1 + a; - | ^^^^^^^^^^ -help: Did you mean a = a + 1 or a = a + 1 + a? Consider replacing it with - | -9 | a += 1; - | ^^^^^^ -help: or - | -9 | a = a + 1 + a; - | ^^^^^^^^^^^^^ - -error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:10:5 | -10 | a -= a - 1; - | ^^^^^^^^^^ -help: Did you mean a = a - 1 or a = a - (a - 1)? Consider replacing it with - | -10 | a -= 1; +18 | a += 1; | ^^^^^^ help: or | -10 | a = a - (a - 1); - | ^^^^^^^^^^^^^^^ - -error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:11:5 - | -11 | a *= a * 99; - | ^^^^^^^^^^^ -help: Did you mean a = a * 99 or a = a * a * 99? Consider replacing it with - | -11 | a *= 99; - | ^^^^^^^ -help: or - | -11 | a = a * a * 99; - | ^^^^^^^^^^^^^^ - -error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:12:5 - | -12 | a *= 42 * a; - | ^^^^^^^^^^^ -help: Did you mean a = a * 42 or a = a * 42 * a? Consider replacing it with - | -12 | a *= 42; - | ^^^^^^^ -help: or - | -12 | a = a * 42 * a; - | ^^^^^^^^^^^^^^ - -error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:13:5 - | -13 | a /= a / 2; - | ^^^^^^^^^^ -help: Did you mean a = a / 2 or a = a / (a / 2)? Consider replacing it with - | -13 | a /= 2; - | ^^^^^^ -help: or - | -13 | a = a / (a / 2); - | ^^^^^^^^^^^^^^^ - -error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:14:5 - | -14 | a %= a % 5; - | ^^^^^^^^^^ -help: Did you mean a = a % 5 or a = a % (a % 5)? Consider replacing it with - | -14 | a %= 5; - | ^^^^^^ -help: or - | -14 | a = a % (a % 5); - | ^^^^^^^^^^^^^^^ - -error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:15:5 - | -15 | a &= a & 1; - | ^^^^^^^^^^ -help: Did you mean a = a & 1 or a = a & a & 1? Consider replacing it with - | -15 | a &= 1; - | ^^^^^^ -help: or - | -15 | a = a & a & 1; +18 | a = a + a + 1; | ^^^^^^^^^^^^^ error: variable appears on both sides of an assignment operation - --> $DIR/assign_ops2.rs:16:5 + --> $DIR/assign_ops2.rs:19:5 | -16 | a *= a * a; +19 | a += 1 + a; | ^^^^^^^^^^ -help: Did you mean a = a * a or a = a * a * a? Consider replacing it with +help: Did you mean a = a + 1 or a = a + 1 + a? Consider replacing it with | -16 | a *= a; +19 | a += 1; | ^^^^^^ help: or | -16 | a = a * a * a; +19 | a = a + 1 + a; + | ^^^^^^^^^^^^^ + +error: variable appears on both sides of an assignment operation + --> $DIR/assign_ops2.rs:20:5 + | +20 | a -= a - 1; + | ^^^^^^^^^^ +help: Did you mean a = a - 1 or a = a - (a - 1)? Consider replacing it with + | +20 | a -= 1; + | ^^^^^^ +help: or + | +20 | a = a - (a - 1); + | ^^^^^^^^^^^^^^^ + +error: variable appears on both sides of an assignment operation + --> $DIR/assign_ops2.rs:21:5 + | +21 | a *= a * 99; + | ^^^^^^^^^^^ +help: Did you mean a = a * 99 or a = a * a * 99? Consider replacing it with + | +21 | a *= 99; + | ^^^^^^^ +help: or + | +21 | a = a * a * 99; + | ^^^^^^^^^^^^^^ + +error: variable appears on both sides of an assignment operation + --> $DIR/assign_ops2.rs:22:5 + | +22 | a *= 42 * a; + | ^^^^^^^^^^^ +help: Did you mean a = a * 42 or a = a * 42 * a? Consider replacing it with + | +22 | a *= 42; + | ^^^^^^^ +help: or + | +22 | a = a * 42 * a; + | ^^^^^^^^^^^^^^ + +error: variable appears on both sides of an assignment operation + --> $DIR/assign_ops2.rs:23:5 + | +23 | a /= a / 2; + | ^^^^^^^^^^ +help: Did you mean a = a / 2 or a = a / (a / 2)? Consider replacing it with + | +23 | a /= 2; + | ^^^^^^ +help: or + | +23 | a = a / (a / 2); + | ^^^^^^^^^^^^^^^ + +error: variable appears on both sides of an assignment operation + --> $DIR/assign_ops2.rs:24:5 + | +24 | a %= a % 5; + | ^^^^^^^^^^ +help: Did you mean a = a % 5 or a = a % (a % 5)? Consider replacing it with + | +24 | a %= 5; + | ^^^^^^ +help: or + | +24 | a = a % (a % 5); + | ^^^^^^^^^^^^^^^ + +error: variable appears on both sides of an assignment operation + --> $DIR/assign_ops2.rs:25:5 + | +25 | a &= a & 1; + | ^^^^^^^^^^ +help: Did you mean a = a & 1 or a = a & a & 1? Consider replacing it with + | +25 | a &= 1; + | ^^^^^^ +help: or + | +25 | a = a & a & 1; + | ^^^^^^^^^^^^^ + +error: variable appears on both sides of an assignment operation + --> $DIR/assign_ops2.rs:26:5 + | +26 | a *= a * a; + | ^^^^^^^^^^ +help: Did you mean a = a * a or a = a * a * a? Consider replacing it with + | +26 | a *= a; + | ^^^^^^ +help: or + | +26 | a = a * a * a; | ^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/tests/ui/attrs.rs b/tests/ui/attrs.rs index b1f0ca640..9af9c0e61 100644 --- a/tests/ui/attrs.rs +++ b/tests/ui/attrs.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/attrs.stderr b/tests/ui/attrs.stderr index 6b6ecd675..a361d0968 100644 --- a/tests/ui/attrs.stderr +++ b/tests/ui/attrs.stderr @@ -1,23 +1,23 @@ error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a bad idea - --> $DIR/attrs.rs:6:1 - | -6 | #[inline(always)] - | ^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::inline-always` implied by `-D warnings` + --> $DIR/attrs.rs:16:1 + | +16 | #[inline(always)] + | ^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::inline-always` implied by `-D warnings` error: the since field must contain a semver-compliant version - --> $DIR/attrs.rs:27:14 + --> $DIR/attrs.rs:37:14 | -27 | #[deprecated(since = "forever")] +37 | #[deprecated(since = "forever")] | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::deprecated-semver` implied by `-D warnings` error: the since field must contain a semver-compliant version - --> $DIR/attrs.rs:30:14 + --> $DIR/attrs.rs:40:14 | -30 | #[deprecated(since = "1")] +40 | #[deprecated(since = "1")] | ^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/author.rs b/tests/ui/author.rs index e8a04bb7b..f151d50f2 100644 --- a/tests/ui/author.rs +++ b/tests/ui/author.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { diff --git a/tests/ui/author/call.rs b/tests/ui/author/call.rs old mode 100755 new mode 100644 index c3e9846e2..3dcf8da5c --- a/tests/ui/author/call.rs +++ b/tests/ui/author/call.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { diff --git a/tests/ui/author/for_loop.rs b/tests/ui/author/for_loop.rs index b3dec8765..a27322b32 100644 --- a/tests/ui/author/for_loop.rs +++ b/tests/ui/author/for_loop.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(stmt_expr_attributes)] fn main() { diff --git a/tests/ui/author/matches.rs b/tests/ui/author/matches.rs index e6bf22910..956404f34 100644 --- a/tests/ui/author/matches.rs +++ b/tests/ui/author/matches.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_attributes)] fn main() { diff --git a/tests/ui/author/matches.stderr b/tests/ui/author/matches.stderr index 46618fe40..d78a17331 100644 --- a/tests/ui/author/matches.stderr +++ b/tests/ui/author/matches.stderr @@ -1,15 +1,15 @@ error: returning the result of a let binding from a block. Consider returning the expression directly. - --> $DIR/matches.rs:9:13 - | -9 | x - | ^ - | - = note: `-D clippy::let-and-return` implied by `-D warnings` + --> $DIR/matches.rs:19:13 + | +19 | x + | ^ + | + = note: `-D clippy::let-and-return` implied by `-D warnings` note: this expression can be directly returned - --> $DIR/matches.rs:8:21 - | -8 | let x = 3; - | ^ + --> $DIR/matches.rs:18:21 + | +18 | let x = 3; + | ^ error: aborting due to previous error diff --git a/tests/ui/bit_masks.rs b/tests/ui/bit_masks.rs index 4111f344b..4110f6ced 100644 --- a/tests/ui/bit_masks.rs +++ b/tests/ui/bit_masks.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/bit_masks.stderr b/tests/ui/bit_masks.stderr index dcf3f241b..f0f450fc1 100644 --- a/tests/ui/bit_masks.stderr +++ b/tests/ui/bit_masks.stderr @@ -1,109 +1,109 @@ error: &-masking with zero - --> $DIR/bit_masks.rs:12:5 + --> $DIR/bit_masks.rs:22:5 | -12 | x & 0 == 0; +22 | x & 0 == 0; | ^^^^^^^^^^ | = note: `-D clippy::bad-bit-mask` implied by `-D warnings` error: this operation will always return zero. This is likely not the intended outcome - --> $DIR/bit_masks.rs:12:5 + --> $DIR/bit_masks.rs:22:5 | -12 | x & 0 == 0; +22 | x & 0 == 0; | ^^^^^ | = note: #[deny(clippy::erasing_op)] on by default error: incompatible bit mask: `_ & 2` can never be equal to `1` - --> $DIR/bit_masks.rs:15:5 + --> $DIR/bit_masks.rs:25:5 | -15 | x & 2 == 1; +25 | x & 2 == 1; | ^^^^^^^^^^ error: incompatible bit mask: `_ | 3` can never be equal to `2` - --> $DIR/bit_masks.rs:19:5 + --> $DIR/bit_masks.rs:29:5 | -19 | x | 3 == 2; +29 | x | 3 == 2; | ^^^^^^^^^^ error: incompatible bit mask: `_ & 1` will never be higher than `1` - --> $DIR/bit_masks.rs:21:5 + --> $DIR/bit_masks.rs:31:5 | -21 | x & 1 > 1; +31 | x & 1 > 1; | ^^^^^^^^^ error: incompatible bit mask: `_ | 2` will always be higher than `1` - --> $DIR/bit_masks.rs:25:5 + --> $DIR/bit_masks.rs:35:5 | -25 | x | 2 > 1; +35 | x | 2 > 1; | ^^^^^^^^^ error: incompatible bit mask: `_ & 7` can never be equal to `8` - --> $DIR/bit_masks.rs:32:5 + --> $DIR/bit_masks.rs:42:5 | -32 | x & THREE_BITS == 8; +42 | x & THREE_BITS == 8; | ^^^^^^^^^^^^^^^^^^^ error: incompatible bit mask: `_ | 7` will never be lower than `7` - --> $DIR/bit_masks.rs:33:5 + --> $DIR/bit_masks.rs:43:5 | -33 | x | EVEN_MORE_REDIRECTION < 7; +43 | x | EVEN_MORE_REDIRECTION < 7; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: &-masking with zero - --> $DIR/bit_masks.rs:35:5 + --> $DIR/bit_masks.rs:45:5 | -35 | 0 & x == 0; +45 | 0 & x == 0; | ^^^^^^^^^^ error: this operation will always return zero. This is likely not the intended outcome - --> $DIR/bit_masks.rs:35:5 + --> $DIR/bit_masks.rs:45:5 | -35 | 0 & x == 0; +45 | 0 & x == 0; | ^^^^^ error: incompatible bit mask: `_ | 2` will always be higher than `1` - --> $DIR/bit_masks.rs:39:5 + --> $DIR/bit_masks.rs:49:5 | -39 | 1 < 2 | x; +49 | 1 < 2 | x; | ^^^^^^^^^ error: incompatible bit mask: `_ | 3` can never be equal to `2` - --> $DIR/bit_masks.rs:40:5 + --> $DIR/bit_masks.rs:50:5 | -40 | 2 == 3 | x; +50 | 2 == 3 | x; | ^^^^^^^^^^ error: incompatible bit mask: `_ & 2` can never be equal to `1` - --> $DIR/bit_masks.rs:41:5 + --> $DIR/bit_masks.rs:51:5 | -41 | 1 == x & 2; +51 | 1 == x & 2; | ^^^^^^^^^^ error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly - --> $DIR/bit_masks.rs:52:5 + --> $DIR/bit_masks.rs:62:5 | -52 | x | 1 > 3; +62 | x | 1 > 3; | ^^^^^^^^^ | = note: `-D clippy::ineffective-bit-mask` implied by `-D warnings` error: ineffective bit mask: `x | 1` compared to `4`, is the same as x compared directly - --> $DIR/bit_masks.rs:53:5 + --> $DIR/bit_masks.rs:63:5 | -53 | x | 1 < 4; +63 | x | 1 < 4; | ^^^^^^^^^ error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly - --> $DIR/bit_masks.rs:54:5 + --> $DIR/bit_masks.rs:64:5 | -54 | x | 1 <= 3; +64 | x | 1 <= 3; | ^^^^^^^^^^ error: ineffective bit mask: `x | 1` compared to `8`, is the same as x compared directly - --> $DIR/bit_masks.rs:55:5 + --> $DIR/bit_masks.rs:65:5 | -55 | x | 1 >= 8; +65 | x | 1 >= 8; | ^^^^^^^^^^ error: aborting due to 17 previous errors diff --git a/tests/ui/blacklisted_name.rs b/tests/ui/blacklisted_name.rs index 4e2e5388c..be58a8fb6 100644 --- a/tests/ui/blacklisted_name.rs +++ b/tests/ui/blacklisted_name.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/blacklisted_name.stderr b/tests/ui/blacklisted_name.stderr index 472401d5e..1e253eba1 100644 --- a/tests/ui/blacklisted_name.stderr +++ b/tests/ui/blacklisted_name.stderr @@ -1,87 +1,87 @@ error: use of a blacklisted/placeholder name `foo` - --> $DIR/blacklisted_name.rs:7:9 - | -7 | fn test(foo: ()) {} - | ^^^ - | - = note: `-D clippy::blacklisted-name` implied by `-D warnings` + --> $DIR/blacklisted_name.rs:17:9 + | +17 | fn test(foo: ()) {} + | ^^^ + | + = note: `-D clippy::blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `foo` - --> $DIR/blacklisted_name.rs:10:9 + --> $DIR/blacklisted_name.rs:20:9 | -10 | let foo = 42; +20 | let foo = 42; | ^^^ error: use of a blacklisted/placeholder name `bar` - --> $DIR/blacklisted_name.rs:11:9 + --> $DIR/blacklisted_name.rs:21:9 | -11 | let bar = 42; +21 | let bar = 42; | ^^^ error: use of a blacklisted/placeholder name `baz` - --> $DIR/blacklisted_name.rs:12:9 + --> $DIR/blacklisted_name.rs:22:9 | -12 | let baz = 42; +22 | let baz = 42; | ^^^ error: use of a blacklisted/placeholder name `foo` - --> $DIR/blacklisted_name.rs:18:10 + --> $DIR/blacklisted_name.rs:28:10 | -18 | (foo, Some(bar), baz @ Some(_)) => (), +28 | (foo, Some(bar), baz @ Some(_)) => (), | ^^^ error: use of a blacklisted/placeholder name `bar` - --> $DIR/blacklisted_name.rs:18:20 + --> $DIR/blacklisted_name.rs:28:20 | -18 | (foo, Some(bar), baz @ Some(_)) => (), +28 | (foo, Some(bar), baz @ Some(_)) => (), | ^^^ error: use of a blacklisted/placeholder name `baz` - --> $DIR/blacklisted_name.rs:18:26 + --> $DIR/blacklisted_name.rs:28:26 | -18 | (foo, Some(bar), baz @ Some(_)) => (), +28 | (foo, Some(bar), baz @ Some(_)) => (), | ^^^ error: use of a blacklisted/placeholder name `foo` - --> $DIR/blacklisted_name.rs:23:19 + --> $DIR/blacklisted_name.rs:33:19 | -23 | fn issue_1647(mut foo: u8) { +33 | fn issue_1647(mut foo: u8) { | ^^^ error: use of a blacklisted/placeholder name `bar` - --> $DIR/blacklisted_name.rs:24:13 + --> $DIR/blacklisted_name.rs:34:13 | -24 | let mut bar = 0; +34 | let mut bar = 0; | ^^^ error: use of a blacklisted/placeholder name `baz` - --> $DIR/blacklisted_name.rs:25:21 + --> $DIR/blacklisted_name.rs:35:21 | -25 | if let Some(mut baz) = Some(42) {} +35 | if let Some(mut baz) = Some(42) {} | ^^^ error: use of a blacklisted/placeholder name `bar` - --> $DIR/blacklisted_name.rs:29:13 + --> $DIR/blacklisted_name.rs:39:13 | -29 | let ref bar = 0; +39 | let ref bar = 0; | ^^^ error: use of a blacklisted/placeholder name `baz` - --> $DIR/blacklisted_name.rs:30:21 + --> $DIR/blacklisted_name.rs:40:21 | -30 | if let Some(ref baz) = Some(42) {} +40 | if let Some(ref baz) = Some(42) {} | ^^^ error: use of a blacklisted/placeholder name `bar` - --> $DIR/blacklisted_name.rs:34:17 + --> $DIR/blacklisted_name.rs:44:17 | -34 | let ref mut bar = 0; +44 | let ref mut bar = 0; | ^^^ error: use of a blacklisted/placeholder name `baz` - --> $DIR/blacklisted_name.rs:35:25 + --> $DIR/blacklisted_name.rs:45:25 | -35 | if let Some(ref mut baz) = Some(42) {} +45 | if let Some(ref mut baz) = Some(42) {} | ^^^ error: aborting due to 14 previous errors diff --git a/tests/ui/block_in_if_condition.rs b/tests/ui/block_in_if_condition.rs index dd0e55034..67bd778ac 100644 --- a/tests/ui/block_in_if_condition.rs +++ b/tests/ui/block_in_if_condition.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/block_in_if_condition.stderr b/tests/ui/block_in_if_condition.stderr index 41f1e9c16..b0036d1ee 100644 --- a/tests/ui/block_in_if_condition.stderr +++ b/tests/ui/block_in_if_condition.stderr @@ -1,11 +1,11 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let' - --> $DIR/block_in_if_condition.rs:30:8 + --> $DIR/block_in_if_condition.rs:40:8 | -30 | if { +40 | if { | ________^ -31 | | let x = 3; -32 | | x == 3 -33 | | } { +41 | | let x = 3; +42 | | x == 3 +43 | | } { | |_____^ | = note: `-D clippy::block-in-if-condition-stmt` implied by `-D warnings` @@ -19,9 +19,9 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste } ... error: omit braces around single expression condition - --> $DIR/block_in_if_condition.rs:41:8 + --> $DIR/block_in_if_condition.rs:51:8 | -41 | if { true } { +51 | if { true } { | ^^^^^^^^ | = note: `-D clippy::block-in-if-condition-expr` implied by `-D warnings` @@ -31,21 +31,21 @@ error: omit braces around single expression condition } ... error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let' - --> $DIR/block_in_if_condition.rs:58:49 + --> $DIR/block_in_if_condition.rs:68:49 | -58 | if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) { +68 | if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let' - --> $DIR/block_in_if_condition.rs:61:22 + --> $DIR/block_in_if_condition.rs:71:22 | -61 | if predicate(|x| { let target = 3; x == target }, v) { +71 | if predicate(|x| { let target = 3; x == target }, v) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this boolean expression can be simplified - --> $DIR/block_in_if_condition.rs:67:8 + --> $DIR/block_in_if_condition.rs:77:8 | -67 | if true && x == 3 { +77 | if true && x == 3 { | ^^^^^^^^^^^^^^ help: try: `x == 3` | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` diff --git a/tests/ui/bool_comparison.rs b/tests/ui/bool_comparison.rs index 144f9f4c6..1d9756bc3 100644 --- a/tests/ui/bool_comparison.rs +++ b/tests/ui/bool_comparison.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/bool_comparison.stderr b/tests/ui/bool_comparison.stderr index 2fcde9436..f1bb50fae 100644 --- a/tests/ui/bool_comparison.stderr +++ b/tests/ui/bool_comparison.stderr @@ -1,27 +1,27 @@ error: equality checks against true are unnecessary - --> $DIR/bool_comparison.rs:7:8 - | -7 | if x == true { "yes" } else { "no" }; - | ^^^^^^^^^ help: try simplifying it as shown: `x` - | - = note: `-D clippy::bool-comparison` implied by `-D warnings` - -error: equality checks against false can be replaced by a negation - --> $DIR/bool_comparison.rs:8:8 - | -8 | if x == false { "yes" } else { "no" }; - | ^^^^^^^^^^ help: try simplifying it as shown: `!x` - -error: equality checks against true are unnecessary - --> $DIR/bool_comparison.rs:9:8 - | -9 | if true == x { "yes" } else { "no" }; - | ^^^^^^^^^ help: try simplifying it as shown: `x` - -error: equality checks against false can be replaced by a negation - --> $DIR/bool_comparison.rs:10:8 + --> $DIR/bool_comparison.rs:17:8 | -10 | if false == x { "yes" } else { "no" }; +17 | if x == true { "yes" } else { "no" }; + | ^^^^^^^^^ help: try simplifying it as shown: `x` + | + = note: `-D clippy::bool-comparison` implied by `-D warnings` + +error: equality checks against false can be replaced by a negation + --> $DIR/bool_comparison.rs:18:8 + | +18 | if x == false { "yes" } else { "no" }; + | ^^^^^^^^^^ help: try simplifying it as shown: `!x` + +error: equality checks against true are unnecessary + --> $DIR/bool_comparison.rs:19:8 + | +19 | if true == x { "yes" } else { "no" }; + | ^^^^^^^^^ help: try simplifying it as shown: `x` + +error: equality checks against false can be replaced by a negation + --> $DIR/bool_comparison.rs:20:8 + | +20 | if false == x { "yes" } else { "no" }; | ^^^^^^^^^^ help: try simplifying it as shown: `!x` error: aborting due to 4 previous errors diff --git a/tests/ui/booleans.rs b/tests/ui/booleans.rs index eaa686c9a..556344c77 100644 --- a/tests/ui/booleans.rs +++ b/tests/ui/booleans.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::nonminimal_bool, clippy::logic_bug)] diff --git a/tests/ui/booleans.stderr b/tests/ui/booleans.stderr index 45e371025..01f821f51 100644 --- a/tests/ui/booleans.stderr +++ b/tests/ui/booleans.stderr @@ -1,202 +1,202 @@ error: this boolean expression contains a logic bug - --> $DIR/booleans.rs:12:13 + --> $DIR/booleans.rs:22:13 | -12 | let _ = a && b || a; +22 | let _ = a && b || a; | ^^^^^^^^^^^ help: it would look like the following: `a` | = note: `-D clippy::logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/booleans.rs:12:18 + --> $DIR/booleans.rs:22:18 | -12 | let _ = a && b || a; +22 | let _ = a && b || a; | ^ error: this boolean expression can be simplified - --> $DIR/booleans.rs:14:13 + --> $DIR/booleans.rs:24:13 | -14 | let _ = !true; +24 | let _ = !true; | ^^^^^ help: try: `false` | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> $DIR/booleans.rs:15:13 + --> $DIR/booleans.rs:25:13 | -15 | let _ = !false; +25 | let _ = !false; | ^^^^^^ help: try: `true` error: this boolean expression can be simplified - --> $DIR/booleans.rs:16:13 + --> $DIR/booleans.rs:26:13 | -16 | let _ = !!a; +26 | let _ = !!a; | ^^^ help: try: `a` error: this boolean expression contains a logic bug - --> $DIR/booleans.rs:17:13 + --> $DIR/booleans.rs:27:13 | -17 | let _ = false && a; +27 | let _ = false && a; | ^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/booleans.rs:17:22 + --> $DIR/booleans.rs:27:22 | -17 | let _ = false && a; +27 | let _ = false && a; | ^ error: this boolean expression can be simplified - --> $DIR/booleans.rs:18:13 + --> $DIR/booleans.rs:28:13 | -18 | let _ = false || a; +28 | let _ = false || a; | ^^^^^^^^^^ help: try: `a` error: this boolean expression can be simplified - --> $DIR/booleans.rs:23:13 + --> $DIR/booleans.rs:33:13 | -23 | let _ = !(!a && b); +33 | let _ = !(!a && b); | ^^^^^^^^^^ help: try: `!b || a` error: this boolean expression contains a logic bug - --> $DIR/booleans.rs:33:13 + --> $DIR/booleans.rs:43:13 | -33 | let _ = a == b && a != b; +43 | let _ = a == b && a != b; | ^^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/booleans.rs:33:13 + --> $DIR/booleans.rs:43:13 | -33 | let _ = a == b && a != b; +43 | let _ = a == b && a != b; | ^^^^^^ error: this boolean expression can be simplified - --> $DIR/booleans.rs:34:13 + --> $DIR/booleans.rs:44:13 | -34 | let _ = a == b && c == 5 && a == b; +44 | let _ = a == b && c == 5 && a == b; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try | -34 | let _ = a == b && c == 5; +44 | let _ = a == b && c == 5; | ^^^^^^^^^^^^^^^^ -34 | let _ = !(c != 5 || a != b); +44 | let _ = !(c != 5 || a != b); | ^^^^^^^^^^^^^^^^^^^ error: this boolean expression can be simplified - --> $DIR/booleans.rs:35:13 + --> $DIR/booleans.rs:45:13 | -35 | let _ = a == b && c == 5 && b == a; +45 | let _ = a == b && c == 5 && b == a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try | -35 | let _ = a == b && c == 5; +45 | let _ = a == b && c == 5; | ^^^^^^^^^^^^^^^^ -35 | let _ = !(c != 5 || a != b); +45 | let _ = !(c != 5 || a != b); | ^^^^^^^^^^^^^^^^^^^ error: this boolean expression contains a logic bug - --> $DIR/booleans.rs:36:13 + --> $DIR/booleans.rs:46:13 | -36 | let _ = a < b && a >= b; +46 | let _ = a < b && a >= b; | ^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/booleans.rs:36:13 + --> $DIR/booleans.rs:46:13 | -36 | let _ = a < b && a >= b; +46 | let _ = a < b && a >= b; | ^^^^^ error: this boolean expression contains a logic bug - --> $DIR/booleans.rs:37:13 - | -37 | let _ = a > b && a <= b; - | ^^^^^^^^^^^^^^^ help: it would look like the following: `false` - | -help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/booleans.rs:37:13 - | -37 | let _ = a > b && a <= b; - | ^^^^^ - -error: this boolean expression can be simplified - --> $DIR/booleans.rs:39:13 - | -39 | let _ = a != b || !(a != b || c == d); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: try - | -39 | let _ = c != d || a != b; - | ^^^^^^^^^^^^^^^^ -39 | let _ = !(a == b && c == d); - | ^^^^^^^^^^^^^^^^^^^ - -error: this boolean expression can be simplified --> $DIR/booleans.rs:47:13 | -47 | let _ = !a.is_some(); - | ^^^^^^^^^^^^ help: try: `a.is_none()` +47 | let _ = a > b && a <= b; + | ^^^^^^^^^^^^^^^ help: it would look like the following: `false` + | +help: this expression can be optimized out by applying boolean operations to the outer expression + --> $DIR/booleans.rs:47:13 + | +47 | let _ = a > b && a <= b; + | ^^^^^ error: this boolean expression can be simplified --> $DIR/booleans.rs:49:13 | -49 | let _ = !a.is_none(); - | ^^^^^^^^^^^^ help: try: `a.is_some()` - -error: this boolean expression can be simplified - --> $DIR/booleans.rs:51:13 +49 | let _ = a != b || !(a != b || c == d); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try | -51 | let _ = !b.is_err(); - | ^^^^^^^^^^^ help: try: `b.is_ok()` - -error: this boolean expression can be simplified - --> $DIR/booleans.rs:53:13 - | -53 | let _ = !b.is_ok(); - | ^^^^^^^^^^ help: try: `b.is_err()` - -error: this boolean expression can be simplified - --> $DIR/booleans.rs:55:13 - | -55 | let _ = !(a.is_some() && !c); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()` - -error: this boolean expression can be simplified - --> $DIR/booleans.rs:56:13 - | -56 | let _ = !(!c ^ c) || !a.is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!(!c ^ c) || a.is_none()` +49 | let _ = c != d || a != b; + | ^^^^^^^^^^^^^^^^ +49 | let _ = !(a == b && c == d); + | ^^^^^^^^^^^^^^^^^^^ error: this boolean expression can be simplified --> $DIR/booleans.rs:57:13 | -57 | let _ = (!c ^ c) || !a.is_some(); +57 | let _ = !a.is_some(); + | ^^^^^^^^^^^^ help: try: `a.is_none()` + +error: this boolean expression can be simplified + --> $DIR/booleans.rs:59:13 + | +59 | let _ = !a.is_none(); + | ^^^^^^^^^^^^ help: try: `a.is_some()` + +error: this boolean expression can be simplified + --> $DIR/booleans.rs:61:13 + | +61 | let _ = !b.is_err(); + | ^^^^^^^^^^^ help: try: `b.is_ok()` + +error: this boolean expression can be simplified + --> $DIR/booleans.rs:63:13 + | +63 | let _ = !b.is_ok(); + | ^^^^^^^^^^ help: try: `b.is_err()` + +error: this boolean expression can be simplified + --> $DIR/booleans.rs:65:13 + | +65 | let _ = !(a.is_some() && !c); + | ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()` + +error: this boolean expression can be simplified + --> $DIR/booleans.rs:66:13 + | +66 | let _ = !(!c ^ c) || !a.is_some(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!(!c ^ c) || a.is_none()` + +error: this boolean expression can be simplified + --> $DIR/booleans.rs:67:13 + | +67 | let _ = (!c ^ c) || !a.is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(!c ^ c) || a.is_none()` error: this boolean expression can be simplified - --> $DIR/booleans.rs:58:13 + --> $DIR/booleans.rs:68:13 | -58 | let _ = !c ^ c || !a.is_some(); +68 | let _ = !c ^ c || !a.is_some(); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `!c ^ c || a.is_none()` error: this boolean expression can be simplified - --> $DIR/booleans.rs:110:8 + --> $DIR/booleans.rs:120:8 | -110 | if !res.is_ok() { } +120 | if !res.is_ok() { } | ^^^^^^^^^^^^ help: try: `res.is_err()` error: this boolean expression can be simplified - --> $DIR/booleans.rs:111:8 + --> $DIR/booleans.rs:121:8 | -111 | if !res.is_err() { } +121 | if !res.is_err() { } | ^^^^^^^^^^^^^ help: try: `res.is_ok()` error: this boolean expression can be simplified - --> $DIR/booleans.rs:114:8 + --> $DIR/booleans.rs:124:8 | -114 | if !res.is_some() { } +124 | if !res.is_some() { } | ^^^^^^^^^^^^^^ help: try: `res.is_none()` error: this boolean expression can be simplified - --> $DIR/booleans.rs:115:8 + --> $DIR/booleans.rs:125:8 | -115 | if !res.is_none() { } +125 | if !res.is_none() { } | ^^^^^^^^^^^^^^ help: try: `res.is_some()` error: aborting due to 25 previous errors diff --git a/tests/ui/borrow_box.rs b/tests/ui/borrow_box.rs index 216dbebda..7c668c33c 100644 --- a/tests/ui/borrow_box.rs +++ b/tests/ui/borrow_box.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/borrow_box.stderr b/tests/ui/borrow_box.stderr index 1098c7785..7cc8eb8da 100644 --- a/tests/ui/borrow_box.stderr +++ b/tests/ui/borrow_box.stderr @@ -1,31 +1,31 @@ error: you seem to be trying to use `&Box`. Consider using just `&T` - --> $DIR/borrow_box.rs:9:19 - | -9 | pub fn test1(foo: &mut Box) { - | ^^^^^^^^^^^^^^ help: try: `&mut bool` - | + --> $DIR/borrow_box.rs:19:19 + | +19 | pub fn test1(foo: &mut Box) { + | ^^^^^^^^^^^^^^ help: try: `&mut bool` + | note: lint level defined here - --> $DIR/borrow_box.rs:4:9 - | -4 | #![deny(clippy::borrowed_box)] - | ^^^^^^^^^^^^^^^^^^^^ + --> $DIR/borrow_box.rs:14:9 + | +14 | #![deny(clippy::borrowed_box)] + | ^^^^^^^^^^^^^^^^^^^^ error: you seem to be trying to use `&Box`. Consider using just `&T` - --> $DIR/borrow_box.rs:14:14 + --> $DIR/borrow_box.rs:24:14 | -14 | let foo: &Box; +24 | let foo: &Box; | ^^^^^^^^^^ help: try: `&bool` error: you seem to be trying to use `&Box`. Consider using just `&T` - --> $DIR/borrow_box.rs:18:10 + --> $DIR/borrow_box.rs:28:10 | -18 | foo: &'a Box +28 | foo: &'a Box | ^^^^^^^^^^^^^ help: try: `&'a bool` error: you seem to be trying to use `&Box`. Consider using just `&T` - --> $DIR/borrow_box.rs:22:17 + --> $DIR/borrow_box.rs:32:17 | -22 | fn test4(a: &Box); +32 | fn test4(a: &Box); | ^^^^^^^^^^ help: try: `&bool` error: aborting due to 4 previous errors diff --git a/tests/ui/box_vec.rs b/tests/ui/box_vec.rs index bc5e8361d..78174d2cd 100644 --- a/tests/ui/box_vec.rs +++ b/tests/ui/box_vec.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/box_vec.stderr b/tests/ui/box_vec.stderr index b90bb5e2a..34be890b5 100644 --- a/tests/ui/box_vec.stderr +++ b/tests/ui/box_vec.stderr @@ -1,7 +1,7 @@ error: you seem to be trying to use `Box>`. Consider using just `Vec` - --> $DIR/box_vec.rs:17:18 + --> $DIR/box_vec.rs:27:18 | -17 | pub fn test(foo: Box>) { +27 | pub fn test(foo: Box>) { | ^^^^^^^^^^^^^^ | = note: `-D clippy::box-vec` implied by `-D warnings` diff --git a/tests/ui/builtin-type-shadow.rs b/tests/ui/builtin-type-shadow.rs index 56892fc94..a6d0f82a7 100644 --- a/tests/ui/builtin-type-shadow.rs +++ b/tests/ui/builtin-type-shadow.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::builtin_type_shadow)] diff --git a/tests/ui/builtin-type-shadow.stderr b/tests/ui/builtin-type-shadow.stderr index 78924ebf9..112537157 100644 --- a/tests/ui/builtin-type-shadow.stderr +++ b/tests/ui/builtin-type-shadow.stderr @@ -1,21 +1,21 @@ error: This generic shadows the built-in type `u32` - --> $DIR/builtin-type-shadow.rs:5:8 - | -5 | fn foo(a: u32) -> u32 { - | ^^^ - | - = note: `-D clippy::builtin-type-shadow` implied by `-D warnings` + --> $DIR/builtin-type-shadow.rs:15:8 + | +15 | fn foo(a: u32) -> u32 { + | ^^^ + | + = note: `-D clippy::builtin-type-shadow` implied by `-D warnings` error[E0308]: mismatched types - --> $DIR/builtin-type-shadow.rs:6:5 - | -5 | fn foo(a: u32) -> u32 { - | --- expected `u32` because of return type -6 | 42 - | ^^ expected type parameter, found integral variable - | - = note: expected type `u32` - found type `{integer}` + --> $DIR/builtin-type-shadow.rs:16:5 + | +15 | fn foo(a: u32) -> u32 { + | --- expected `u32` because of return type +16 | 42 + | ^^ expected type parameter, found integral variable + | + = note: expected type `u32` + found type `{integer}` error: aborting due to 2 previous errors diff --git a/tests/ui/bytecount.rs b/tests/ui/bytecount.rs index 7211284e4..71a6e0121 100644 --- a/tests/ui/bytecount.rs +++ b/tests/ui/bytecount.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/bytecount.stderr b/tests/ui/bytecount.stderr index 0564d6a0b..c5c0ec7ed 100644 --- a/tests/ui/bytecount.stderr +++ b/tests/ui/bytecount.stderr @@ -1,25 +1,25 @@ error: You appear to be counting bytes the naive way - --> $DIR/bytecount.rs:8:13 - | -8 | let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, 0)` - | + --> $DIR/bytecount.rs:18:13 + | +18 | let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, 0)` + | note: lint level defined here - --> $DIR/bytecount.rs:4:8 - | -4 | #[deny(clippy::naive_bytecount)] - | ^^^^^^^^^^^^^^^^^^^^^^^ + --> $DIR/bytecount.rs:14:8 + | +14 | #[deny(clippy::naive_bytecount)] + | ^^^^^^^^^^^^^^^^^^^^^^^ error: You appear to be counting bytes the naive way - --> $DIR/bytecount.rs:10:13 + --> $DIR/bytecount.rs:20:13 | -10 | let _ = (&x[..]).iter().filter(|&a| *a == 0).count(); // naive byte count +20 | let _ = (&x[..]).iter().filter(|&a| *a == 0).count(); // naive byte count | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count((&x[..]), 0)` error: You appear to be counting bytes the naive way - --> $DIR/bytecount.rs:22:13 + --> $DIR/bytecount.rs:32:13 | -22 | let _ = x.iter().filter(|a| b + 1 == **a).count(); // naive byte count +32 | let _ = x.iter().filter(|a| b + 1 == **a).count(); // naive byte count | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, b + 1)` error: aborting due to 3 previous errors diff --git a/tests/ui/cast.rs b/tests/ui/cast.rs index 0668b16ff..2fb865b12 100644 --- a/tests/ui/cast.rs +++ b/tests/ui/cast.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/cast.stderr b/tests/ui/cast.stderr index 2578c4989..1f9ab5712 100644 --- a/tests/ui/cast.stderr +++ b/tests/ui/cast.stderr @@ -1,181 +1,181 @@ error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f32's mantissa is only 23 bits wide) - --> $DIR/cast.rs:8:5 - | -8 | 1i32 as f32; - | ^^^^^^^^^^^ - | - = note: `-D clippy::cast-precision-loss` implied by `-D warnings` + --> $DIR/cast.rs:18:5 + | +18 | 1i32 as f32; + | ^^^^^^^^^^^ + | + = note: `-D clippy::cast-precision-loss` implied by `-D warnings` error: casting i64 to f32 causes a loss of precision (i64 is 64 bits wide, but f32's mantissa is only 23 bits wide) - --> $DIR/cast.rs:9:5 - | -9 | 1i64 as f32; - | ^^^^^^^^^^^ + --> $DIR/cast.rs:19:5 + | +19 | 1i64 as f32; + | ^^^^^^^^^^^ error: casting i64 to f64 causes a loss of precision (i64 is 64 bits wide, but f64's mantissa is only 52 bits wide) - --> $DIR/cast.rs:10:5 + --> $DIR/cast.rs:20:5 | -10 | 1i64 as f64; +20 | 1i64 as f64; | ^^^^^^^^^^^ error: casting u32 to f32 causes a loss of precision (u32 is 32 bits wide, but f32's mantissa is only 23 bits wide) - --> $DIR/cast.rs:11:5 + --> $DIR/cast.rs:21:5 | -11 | 1u32 as f32; +21 | 1u32 as f32; | ^^^^^^^^^^^ error: casting u64 to f32 causes a loss of precision (u64 is 64 bits wide, but f32's mantissa is only 23 bits wide) - --> $DIR/cast.rs:12:5 + --> $DIR/cast.rs:22:5 | -12 | 1u64 as f32; +22 | 1u64 as f32; | ^^^^^^^^^^^ error: casting u64 to f64 causes a loss of precision (u64 is 64 bits wide, but f64's mantissa is only 52 bits wide) - --> $DIR/cast.rs:13:5 + --> $DIR/cast.rs:23:5 | -13 | 1u64 as f64; +23 | 1u64 as f64; | ^^^^^^^^^^^ error: casting f32 to i32 may truncate the value - --> $DIR/cast.rs:15:5 + --> $DIR/cast.rs:25:5 | -15 | 1f32 as i32; +25 | 1f32 as i32; | ^^^^^^^^^^^ | = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` error: casting f32 to u32 may truncate the value - --> $DIR/cast.rs:16:5 + --> $DIR/cast.rs:26:5 | -16 | 1f32 as u32; +26 | 1f32 as u32; | ^^^^^^^^^^^ error: casting f32 to u32 may lose the sign of the value - --> $DIR/cast.rs:16:5 + --> $DIR/cast.rs:26:5 | -16 | 1f32 as u32; +26 | 1f32 as u32; | ^^^^^^^^^^^ | = note: `-D clippy::cast-sign-loss` implied by `-D warnings` error: casting f64 to f32 may truncate the value - --> $DIR/cast.rs:17:5 + --> $DIR/cast.rs:27:5 | -17 | 1f64 as f32; +27 | 1f64 as f32; | ^^^^^^^^^^^ error: casting i32 to i8 may truncate the value - --> $DIR/cast.rs:18:5 + --> $DIR/cast.rs:28:5 | -18 | 1i32 as i8; +28 | 1i32 as i8; | ^^^^^^^^^^ error: casting i32 to u8 may lose the sign of the value - --> $DIR/cast.rs:19:5 + --> $DIR/cast.rs:29:5 | -19 | 1i32 as u8; +29 | 1i32 as u8; | ^^^^^^^^^^ error: casting i32 to u8 may truncate the value - --> $DIR/cast.rs:19:5 + --> $DIR/cast.rs:29:5 | -19 | 1i32 as u8; +29 | 1i32 as u8; | ^^^^^^^^^^ error: casting f64 to isize may truncate the value - --> $DIR/cast.rs:20:5 + --> $DIR/cast.rs:30:5 | -20 | 1f64 as isize; +30 | 1f64 as isize; | ^^^^^^^^^^^^^ error: casting f64 to usize may truncate the value - --> $DIR/cast.rs:21:5 + --> $DIR/cast.rs:31:5 | -21 | 1f64 as usize; +31 | 1f64 as usize; | ^^^^^^^^^^^^^ error: casting f64 to usize may lose the sign of the value - --> $DIR/cast.rs:21:5 + --> $DIR/cast.rs:31:5 | -21 | 1f64 as usize; +31 | 1f64 as usize; | ^^^^^^^^^^^^^ error: casting u8 to i8 may wrap around the value - --> $DIR/cast.rs:23:5 + --> $DIR/cast.rs:33:5 | -23 | 1u8 as i8; +33 | 1u8 as i8; | ^^^^^^^^^ | = note: `-D clippy::cast-possible-wrap` implied by `-D warnings` error: casting u16 to i16 may wrap around the value - --> $DIR/cast.rs:24:5 + --> $DIR/cast.rs:34:5 | -24 | 1u16 as i16; +34 | 1u16 as i16; | ^^^^^^^^^^^ error: casting u32 to i32 may wrap around the value - --> $DIR/cast.rs:25:5 + --> $DIR/cast.rs:35:5 | -25 | 1u32 as i32; +35 | 1u32 as i32; | ^^^^^^^^^^^ error: casting u64 to i64 may wrap around the value - --> $DIR/cast.rs:26:5 + --> $DIR/cast.rs:36:5 | -26 | 1u64 as i64; +36 | 1u64 as i64; | ^^^^^^^^^^^ error: casting usize to isize may wrap around the value - --> $DIR/cast.rs:27:5 + --> $DIR/cast.rs:37:5 | -27 | 1usize as isize; +37 | 1usize as isize; | ^^^^^^^^^^^^^^^ error: casting f32 to f64 may become silently lossy if types change - --> $DIR/cast.rs:29:5 + --> $DIR/cast.rs:39:5 | -29 | 1.0f32 as f64; +39 | 1.0f32 as f64; | ^^^^^^^^^^^^^ help: try: `f64::from(1.0f32)` | = note: `-D clippy::cast-lossless` implied by `-D warnings` error: casting u8 to u16 may become silently lossy if types change - --> $DIR/cast.rs:31:5 + --> $DIR/cast.rs:41:5 | -31 | (1u8 + 1u8) as u16; +41 | (1u8 + 1u8) as u16; | ^^^^^^^^^^^^^^^^^^ help: try: `u16::from(1u8 + 1u8)` error: casting i32 to u32 may lose the sign of the value - --> $DIR/cast.rs:33:5 + --> $DIR/cast.rs:43:5 | -33 | 1i32 as u32; +43 | 1i32 as u32; | ^^^^^^^^^^^ error: casting isize to usize may lose the sign of the value - --> $DIR/cast.rs:34:5 + --> $DIR/cast.rs:44:5 | -34 | 1isize as usize; +44 | 1isize as usize; | ^^^^^^^^^^^^^^^ error: casting to the same type is unnecessary (`i32` -> `i32`) - --> $DIR/cast.rs:37:5 + --> $DIR/cast.rs:47:5 | -37 | 1i32 as i32; +47 | 1i32 as i32; | ^^^^^^^^^^^ | = note: `-D clippy::unnecessary-cast` implied by `-D warnings` error: casting to the same type is unnecessary (`f32` -> `f32`) - --> $DIR/cast.rs:38:5 + --> $DIR/cast.rs:48:5 | -38 | 1f32 as f32; +48 | 1f32 as f32; | ^^^^^^^^^^^ error: casting to the same type is unnecessary (`bool` -> `bool`) - --> $DIR/cast.rs:39:5 + --> $DIR/cast.rs:49:5 | -39 | false as bool; +49 | false as bool; | ^^^^^^^^^^^^^ error: aborting due to 28 previous errors diff --git a/tests/ui/cast_alignment.rs b/tests/ui/cast_alignment.rs index 1f7606de6..b6e01d212 100644 --- a/tests/ui/cast_alignment.rs +++ b/tests/ui/cast_alignment.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] //! Test casts for alignment issues diff --git a/tests/ui/cast_alignment.stderr b/tests/ui/cast_alignment.stderr index d03d727a8..a4dd6038c 100644 --- a/tests/ui/cast_alignment.stderr +++ b/tests/ui/cast_alignment.stderr @@ -1,15 +1,15 @@ error: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`) - --> $DIR/cast_alignment.rs:15:5 + --> $DIR/cast_alignment.rs:25:5 | -15 | (&1u8 as *const u8) as *const u16; +25 | (&1u8 as *const u8) as *const u16; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::cast-ptr-alignment` implied by `-D warnings` error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`) - --> $DIR/cast_alignment.rs:16:5 + --> $DIR/cast_alignment.rs:26:5 | -16 | (&mut 1u8 as *mut u8) as *mut u16; +26 | (&mut 1u8 as *mut u8) as *mut u16; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/cast_lossless_float.rs b/tests/ui/cast_lossless_float.rs index 437c4b671..aa78a62f8 100644 --- a/tests/ui/cast_lossless_float.rs +++ b/tests/ui/cast_lossless_float.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #[warn(clippy::cast_lossless)] diff --git a/tests/ui/cast_lossless_float.stderr b/tests/ui/cast_lossless_float.stderr index 9025633a1..95b9bfb02 100644 --- a/tests/ui/cast_lossless_float.stderr +++ b/tests/ui/cast_lossless_float.stderr @@ -1,63 +1,63 @@ error: casting i8 to f32 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:7:5 - | -7 | 1i8 as f32; - | ^^^^^^^^^^ help: try: `f32::from(1i8)` - | - = note: `-D clippy::cast-lossless` implied by `-D warnings` + --> $DIR/cast_lossless_float.rs:17:5 + | +17 | 1i8 as f32; + | ^^^^^^^^^^ help: try: `f32::from(1i8)` + | + = note: `-D clippy::cast-lossless` implied by `-D warnings` error: casting i8 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:8:5 - | -8 | 1i8 as f64; - | ^^^^^^^^^^ help: try: `f64::from(1i8)` + --> $DIR/cast_lossless_float.rs:18:5 + | +18 | 1i8 as f64; + | ^^^^^^^^^^ help: try: `f64::from(1i8)` error: casting u8 to f32 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:9:5 - | -9 | 1u8 as f32; - | ^^^^^^^^^^ help: try: `f32::from(1u8)` + --> $DIR/cast_lossless_float.rs:19:5 + | +19 | 1u8 as f32; + | ^^^^^^^^^^ help: try: `f32::from(1u8)` error: casting u8 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:10:5 + --> $DIR/cast_lossless_float.rs:20:5 | -10 | 1u8 as f64; +20 | 1u8 as f64; | ^^^^^^^^^^ help: try: `f64::from(1u8)` error: casting i16 to f32 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:11:5 + --> $DIR/cast_lossless_float.rs:21:5 | -11 | 1i16 as f32; +21 | 1i16 as f32; | ^^^^^^^^^^^ help: try: `f32::from(1i16)` error: casting i16 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:12:5 + --> $DIR/cast_lossless_float.rs:22:5 | -12 | 1i16 as f64; +22 | 1i16 as f64; | ^^^^^^^^^^^ help: try: `f64::from(1i16)` error: casting u16 to f32 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:13:5 + --> $DIR/cast_lossless_float.rs:23:5 | -13 | 1u16 as f32; +23 | 1u16 as f32; | ^^^^^^^^^^^ help: try: `f32::from(1u16)` error: casting u16 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:14:5 + --> $DIR/cast_lossless_float.rs:24:5 | -14 | 1u16 as f64; +24 | 1u16 as f64; | ^^^^^^^^^^^ help: try: `f64::from(1u16)` error: casting i32 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:15:5 + --> $DIR/cast_lossless_float.rs:25:5 | -15 | 1i32 as f64; +25 | 1i32 as f64; | ^^^^^^^^^^^ help: try: `f64::from(1i32)` error: casting u32 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:16:5 + --> $DIR/cast_lossless_float.rs:26:5 | -16 | 1u32 as f64; +26 | 1u32 as f64; | ^^^^^^^^^^^ help: try: `f64::from(1u32)` error: aborting due to 10 previous errors diff --git a/tests/ui/cast_lossless_integer.rs b/tests/ui/cast_lossless_integer.rs index e06e653c6..ef430d57e 100644 --- a/tests/ui/cast_lossless_integer.rs +++ b/tests/ui/cast_lossless_integer.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #[warn(clippy::cast_lossless)] #[allow(clippy::no_effect, clippy::unnecessary_operation)] diff --git a/tests/ui/cast_lossless_integer.stderr b/tests/ui/cast_lossless_integer.stderr index 9640e1e18..5f9c70879 100644 --- a/tests/ui/cast_lossless_integer.stderr +++ b/tests/ui/cast_lossless_integer.stderr @@ -1,111 +1,111 @@ error: casting i8 to i16 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:6:5 - | -6 | 1i8 as i16; - | ^^^^^^^^^^ help: try: `i16::from(1i8)` - | - = note: `-D clippy::cast-lossless` implied by `-D warnings` + --> $DIR/cast_lossless_integer.rs:16:5 + | +16 | 1i8 as i16; + | ^^^^^^^^^^ help: try: `i16::from(1i8)` + | + = note: `-D clippy::cast-lossless` implied by `-D warnings` error: casting i8 to i32 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:7:5 - | -7 | 1i8 as i32; - | ^^^^^^^^^^ help: try: `i32::from(1i8)` + --> $DIR/cast_lossless_integer.rs:17:5 + | +17 | 1i8 as i32; + | ^^^^^^^^^^ help: try: `i32::from(1i8)` error: casting i8 to i64 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:8:5 - | -8 | 1i8 as i64; - | ^^^^^^^^^^ help: try: `i64::from(1i8)` + --> $DIR/cast_lossless_integer.rs:18:5 + | +18 | 1i8 as i64; + | ^^^^^^^^^^ help: try: `i64::from(1i8)` error: casting u8 to i16 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:9:5 - | -9 | 1u8 as i16; - | ^^^^^^^^^^ help: try: `i16::from(1u8)` + --> $DIR/cast_lossless_integer.rs:19:5 + | +19 | 1u8 as i16; + | ^^^^^^^^^^ help: try: `i16::from(1u8)` error: casting u8 to i32 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:10:5 + --> $DIR/cast_lossless_integer.rs:20:5 | -10 | 1u8 as i32; +20 | 1u8 as i32; | ^^^^^^^^^^ help: try: `i32::from(1u8)` error: casting u8 to i64 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:11:5 + --> $DIR/cast_lossless_integer.rs:21:5 | -11 | 1u8 as i64; +21 | 1u8 as i64; | ^^^^^^^^^^ help: try: `i64::from(1u8)` error: casting u8 to u16 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:12:5 + --> $DIR/cast_lossless_integer.rs:22:5 | -12 | 1u8 as u16; +22 | 1u8 as u16; | ^^^^^^^^^^ help: try: `u16::from(1u8)` error: casting u8 to u32 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:13:5 + --> $DIR/cast_lossless_integer.rs:23:5 | -13 | 1u8 as u32; +23 | 1u8 as u32; | ^^^^^^^^^^ help: try: `u32::from(1u8)` error: casting u8 to u64 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:14:5 + --> $DIR/cast_lossless_integer.rs:24:5 | -14 | 1u8 as u64; +24 | 1u8 as u64; | ^^^^^^^^^^ help: try: `u64::from(1u8)` error: casting i16 to i32 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:15:5 + --> $DIR/cast_lossless_integer.rs:25:5 | -15 | 1i16 as i32; +25 | 1i16 as i32; | ^^^^^^^^^^^ help: try: `i32::from(1i16)` error: casting i16 to i64 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:16:5 + --> $DIR/cast_lossless_integer.rs:26:5 | -16 | 1i16 as i64; +26 | 1i16 as i64; | ^^^^^^^^^^^ help: try: `i64::from(1i16)` error: casting u16 to i32 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:17:5 + --> $DIR/cast_lossless_integer.rs:27:5 | -17 | 1u16 as i32; +27 | 1u16 as i32; | ^^^^^^^^^^^ help: try: `i32::from(1u16)` error: casting u16 to i64 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:18:5 + --> $DIR/cast_lossless_integer.rs:28:5 | -18 | 1u16 as i64; +28 | 1u16 as i64; | ^^^^^^^^^^^ help: try: `i64::from(1u16)` error: casting u16 to u32 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:19:5 + --> $DIR/cast_lossless_integer.rs:29:5 | -19 | 1u16 as u32; +29 | 1u16 as u32; | ^^^^^^^^^^^ help: try: `u32::from(1u16)` error: casting u16 to u64 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:20:5 + --> $DIR/cast_lossless_integer.rs:30:5 | -20 | 1u16 as u64; +30 | 1u16 as u64; | ^^^^^^^^^^^ help: try: `u64::from(1u16)` error: casting i32 to i64 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:21:5 + --> $DIR/cast_lossless_integer.rs:31:5 | -21 | 1i32 as i64; +31 | 1i32 as i64; | ^^^^^^^^^^^ help: try: `i64::from(1i32)` error: casting u32 to i64 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:22:5 + --> $DIR/cast_lossless_integer.rs:32:5 | -22 | 1u32 as i64; +32 | 1u32 as i64; | ^^^^^^^^^^^ help: try: `i64::from(1u32)` error: casting u32 to u64 may become silently lossy if types change - --> $DIR/cast_lossless_integer.rs:23:5 + --> $DIR/cast_lossless_integer.rs:33:5 | -23 | 1u32 as u64; +33 | 1u32 as u64; | ^^^^^^^^^^^ help: try: `u64::from(1u32)` error: aborting due to 18 previous errors diff --git a/tests/ui/cast_size.rs b/tests/ui/cast_size.rs index 4c72f5716..e8b0f4a5b 100644 --- a/tests/ui/cast_size.rs +++ b/tests/ui/cast_size.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #[warn(clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_possible_wrap, clippy::cast_lossless)] diff --git a/tests/ui/cast_size.stderr b/tests/ui/cast_size.stderr index 1797e2e36..c5f569db1 100644 --- a/tests/ui/cast_size.stderr +++ b/tests/ui/cast_size.stderr @@ -1,123 +1,123 @@ error: casting isize to i8 may truncate the value - --> $DIR/cast_size.rs:7:5 - | -7 | 1isize as i8; - | ^^^^^^^^^^^^ - | - = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` + --> $DIR/cast_size.rs:17:5 + | +17 | 1isize as i8; + | ^^^^^^^^^^^^ + | + = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` error: casting isize to f64 causes a loss of precision on targets with 64-bit wide pointers (isize is 64 bits wide, but f64's mantissa is only 52 bits wide) - --> $DIR/cast_size.rs:8:5 - | -8 | 1isize as f64; - | ^^^^^^^^^^^^^ - | - = note: `-D clippy::cast-precision-loss` implied by `-D warnings` + --> $DIR/cast_size.rs:18:5 + | +18 | 1isize as f64; + | ^^^^^^^^^^^^^ + | + = note: `-D clippy::cast-precision-loss` implied by `-D warnings` error: casting usize to f64 causes a loss of precision on targets with 64-bit wide pointers (usize is 64 bits wide, but f64's mantissa is only 52 bits wide) - --> $DIR/cast_size.rs:9:5 - | -9 | 1usize as f64; - | ^^^^^^^^^^^^^ + --> $DIR/cast_size.rs:19:5 + | +19 | 1usize as f64; + | ^^^^^^^^^^^^^ error: casting isize to f32 causes a loss of precision (isize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide) - --> $DIR/cast_size.rs:10:5 + --> $DIR/cast_size.rs:20:5 | -10 | 1isize as f32; +20 | 1isize as f32; | ^^^^^^^^^^^^^ error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide) - --> $DIR/cast_size.rs:11:5 + --> $DIR/cast_size.rs:21:5 | -11 | 1usize as f32; +21 | 1usize as f32; | ^^^^^^^^^^^^^ error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers - --> $DIR/cast_size.rs:12:5 + --> $DIR/cast_size.rs:22:5 | -12 | 1isize as i32; +22 | 1isize as i32; | ^^^^^^^^^^^^^ error: casting isize to u32 may lose the sign of the value - --> $DIR/cast_size.rs:13:5 + --> $DIR/cast_size.rs:23:5 | -13 | 1isize as u32; +23 | 1isize as u32; | ^^^^^^^^^^^^^ | = note: `-D clippy::cast-sign-loss` implied by `-D warnings` error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers - --> $DIR/cast_size.rs:13:5 + --> $DIR/cast_size.rs:23:5 | -13 | 1isize as u32; +23 | 1isize as u32; | ^^^^^^^^^^^^^ error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers - --> $DIR/cast_size.rs:14:5 + --> $DIR/cast_size.rs:24:5 | -14 | 1usize as u32; +24 | 1usize as u32; | ^^^^^^^^^^^^^ error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers - --> $DIR/cast_size.rs:15:5 + --> $DIR/cast_size.rs:25:5 | -15 | 1usize as i32; +25 | 1usize as i32; | ^^^^^^^^^^^^^ error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:15:5 + --> $DIR/cast_size.rs:25:5 | -15 | 1usize as i32; +25 | 1usize as i32; | ^^^^^^^^^^^^^ | = note: `-D clippy::cast-possible-wrap` implied by `-D warnings` error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:17:5 + --> $DIR/cast_size.rs:27:5 | -17 | 1i64 as isize; +27 | 1i64 as isize; | ^^^^^^^^^^^^^ error: casting i64 to usize may lose the sign of the value - --> $DIR/cast_size.rs:18:5 + --> $DIR/cast_size.rs:28:5 | -18 | 1i64 as usize; +28 | 1i64 as usize; | ^^^^^^^^^^^^^ error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:18:5 + --> $DIR/cast_size.rs:28:5 | -18 | 1i64 as usize; +28 | 1i64 as usize; | ^^^^^^^^^^^^^ error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:19:5 + --> $DIR/cast_size.rs:29:5 | -19 | 1u64 as isize; +29 | 1u64 as isize; | ^^^^^^^^^^^^^ error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers - --> $DIR/cast_size.rs:19:5 + --> $DIR/cast_size.rs:29:5 | -19 | 1u64 as isize; +29 | 1u64 as isize; | ^^^^^^^^^^^^^ error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:20:5 + --> $DIR/cast_size.rs:30:5 | -20 | 1u64 as usize; +30 | 1u64 as usize; | ^^^^^^^^^^^^^ error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:21:5 + --> $DIR/cast_size.rs:31:5 | -21 | 1u32 as isize; +31 | 1u32 as isize; | ^^^^^^^^^^^^^ error: casting i32 to usize may lose the sign of the value - --> $DIR/cast_size.rs:24:5 + --> $DIR/cast_size.rs:34:5 | -24 | 1i32 as usize; +34 | 1i32 as usize; | ^^^^^^^^^^^^^ error: aborting due to 19 previous errors diff --git a/tests/ui/char_lit_as_u8.rs b/tests/ui/char_lit_as_u8.rs index f9937ede3..8fda473e3 100644 --- a/tests/ui/char_lit_as_u8.rs +++ b/tests/ui/char_lit_as_u8.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/char_lit_as_u8.stderr b/tests/ui/char_lit_as_u8.stderr index f6ea10d57..38a469bfe 100644 --- a/tests/ui/char_lit_as_u8.stderr +++ b/tests/ui/char_lit_as_u8.stderr @@ -1,12 +1,12 @@ error: casting character literal to u8. `char`s are 4 bytes wide in rust, so casting to u8 truncates them - --> $DIR/char_lit_as_u8.rs:7:13 - | -7 | let c = 'a' as u8; - | ^^^^^^^^^ - | - = note: `-D clippy::char-lit-as-u8` implied by `-D warnings` - = help: Consider using a byte literal instead: - b'a' + --> $DIR/char_lit_as_u8.rs:17:13 + | +17 | let c = 'a' as u8; + | ^^^^^^^^^ + | + = note: `-D clippy::char-lit-as-u8` implied by `-D warnings` + = help: Consider using a byte literal instead: + b'a' error: aborting due to previous error diff --git a/tests/ui/checked_unwrap.rs b/tests/ui/checked_unwrap.rs index b3979245d..ed9651b18 100644 --- a/tests/ui/checked_unwrap.rs +++ b/tests/ui/checked_unwrap.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] diff --git a/tests/ui/checked_unwrap.stderr b/tests/ui/checked_unwrap.stderr index 4508ce442..f7f493603 100644 --- a/tests/ui/checked_unwrap.stderr +++ b/tests/ui/checked_unwrap.stderr @@ -1,312 +1,312 @@ error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:9:9 - | -8 | if x.is_some() { - | ----------- the check is happening here -9 | x.unwrap(); // unnecessary - | ^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/checked_unwrap.rs:3:35 - | -3 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:11:9 + --> $DIR/checked_unwrap.rs:19:9 | -8 | if x.is_some() { - | ----------- because of this check -... -11 | x.unwrap(); // will panic +18 | if x.is_some() { + | ----------- the check is happening here +19 | x.unwrap(); // unnecessary | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/checked_unwrap.rs:3:9 + --> $DIR/checked_unwrap.rs:13:35 | -3 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] +13 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:21:9 + | +18 | if x.is_some() { + | ----------- because of this check +... +21 | x.unwrap(); // will panic + | ^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/checked_unwrap.rs:13:9 + | +13 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:14:9 - | -13 | if x.is_none() { - | ----------- because of this check -14 | x.unwrap(); // will panic - | ^^^^^^^^^^ - -error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:16:9 - | -13 | if x.is_none() { - | ----------- the check is happening here -... -16 | x.unwrap(); // unnecessary - | ^^^^^^^^^^ - -error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:20:9 - | -19 | if x.is_ok() { - | --------- the check is happening here -20 | x.unwrap(); // unnecessary - | ^^^^^^^^^^ - -error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:21:9 - | -19 | if x.is_ok() { - | --------- because of this check -20 | x.unwrap(); // unnecessary -21 | x.unwrap_err(); // will panic - | ^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:23:9 - | -19 | if x.is_ok() { - | --------- because of this check -... -23 | x.unwrap(); // will panic - | ^^^^^^^^^^ - -error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. --> $DIR/checked_unwrap.rs:24:9 | -19 | if x.is_ok() { - | --------- the check is happening here -... -24 | x.unwrap_err(); // unnecessary - | ^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:27:9 - | -26 | if x.is_err() { - | ---------- because of this check -27 | x.unwrap(); // will panic +23 | if x.is_none() { + | ----------- because of this check +24 | x.unwrap(); // will panic | ^^^^^^^^^^ -error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:28:9 +error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:26:9 | -26 | if x.is_err() { - | ---------- the check is happening here -27 | x.unwrap(); // will panic -28 | x.unwrap_err(); // unnecessary - | ^^^^^^^^^^^^^^ +23 | if x.is_none() { + | ----------- the check is happening here +... +26 | x.unwrap(); // unnecessary + | ^^^^^^^^^^ error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. --> $DIR/checked_unwrap.rs:30:9 | -26 | if x.is_err() { - | ---------- the check is happening here -... +29 | if x.is_ok() { + | --------- the check is happening here 30 | x.unwrap(); // unnecessary | ^^^^^^^^^^ error: This call to `unwrap_err()` will always panic. --> $DIR/checked_unwrap.rs:31:9 | -26 | if x.is_err() { - | ---------- because of this check -... +29 | if x.is_ok() { + | --------- because of this check +30 | x.unwrap(); // unnecessary 31 | x.unwrap_err(); // will panic | ^^^^^^^^^^^^^^ -error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:48:9 +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:33:9 | -47 | if x.is_ok() && y.is_err() { - | --------- the check is happening here -48 | x.unwrap(); // unnecessary +29 | if x.is_ok() { + | --------- because of this check +... +33 | x.unwrap(); // will panic | ^^^^^^^^^^ -error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:49:9 +error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:34:9 | -47 | if x.is_ok() && y.is_err() { - | --------- because of this check -48 | x.unwrap(); // unnecessary -49 | x.unwrap_err(); // will panic +29 | if x.is_ok() { + | --------- the check is happening here +... +34 | x.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:50:9 + --> $DIR/checked_unwrap.rs:37:9 | -47 | if x.is_ok() && y.is_err() { +36 | if x.is_err() { + | ---------- because of this check +37 | x.unwrap(); // will panic + | ^^^^^^^^^^ + +error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:38:9 + | +36 | if x.is_err() { + | ---------- the check is happening here +37 | x.unwrap(); // will panic +38 | x.unwrap_err(); // unnecessary + | ^^^^^^^^^^^^^^ + +error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:40:9 + | +36 | if x.is_err() { + | ---------- the check is happening here +... +40 | x.unwrap(); // unnecessary + | ^^^^^^^^^^ + +error: This call to `unwrap_err()` will always panic. + --> $DIR/checked_unwrap.rs:41:9 + | +36 | if x.is_err() { + | ---------- because of this check +... +41 | x.unwrap_err(); // will panic + | ^^^^^^^^^^^^^^ + +error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:58:9 + | +57 | if x.is_ok() && y.is_err() { + | --------- the check is happening here +58 | x.unwrap(); // unnecessary + | ^^^^^^^^^^ + +error: This call to `unwrap_err()` will always panic. + --> $DIR/checked_unwrap.rs:59:9 + | +57 | if x.is_ok() && y.is_err() { + | --------- because of this check +58 | x.unwrap(); // unnecessary +59 | x.unwrap_err(); // will panic + | ^^^^^^^^^^^^^^ + +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:60:9 + | +57 | if x.is_ok() && y.is_err() { | ---------- because of this check ... -50 | y.unwrap(); // will panic +60 | y.unwrap(); // will panic | ^^^^^^^^^^ error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:51:9 + --> $DIR/checked_unwrap.rs:61:9 | -47 | if x.is_ok() && y.is_err() { +57 | if x.is_ok() && y.is_err() { | ---------- the check is happening here ... -51 | y.unwrap_err(); // unnecessary +61 | y.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:65:9 - | -60 | if x.is_ok() || y.is_ok() { - | --------- because of this check -... -65 | x.unwrap(); // will panic - | ^^^^^^^^^^ - -error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:66:9 - | -60 | if x.is_ok() || y.is_ok() { - | --------- the check is happening here -... -66 | x.unwrap_err(); // unnecessary - | ^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:67:9 - | -60 | if x.is_ok() || y.is_ok() { - | --------- because of this check -... -67 | y.unwrap(); // will panic - | ^^^^^^^^^^ - -error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:68:9 - | -60 | if x.is_ok() || y.is_ok() { - | --------- the check is happening here -... -68 | y.unwrap_err(); // unnecessary - | ^^^^^^^^^^^^^^ - -error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:72:9 - | -71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | --------- the check is happening here -72 | x.unwrap(); // unnecessary - | ^^^^^^^^^^ - -error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:73:9 - | -71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | --------- because of this check -72 | x.unwrap(); // unnecessary -73 | x.unwrap_err(); // will panic - | ^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:74:9 - | -71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | --------- because of this check -... -74 | y.unwrap(); // will panic - | ^^^^^^^^^^ - -error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. --> $DIR/checked_unwrap.rs:75:9 | -71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | --------- the check is happening here -... -75 | y.unwrap_err(); // unnecessary - | ^^^^^^^^^^^^^^ - -error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:76:9 - | -71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | ---------- the check is happening here -... -76 | z.unwrap(); // unnecessary - | ^^^^^^^^^^ - -error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:77:9 - | -71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | ---------- because of this check -... -77 | z.unwrap_err(); // will panic - | ^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:85:9 - | -79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { +70 | if x.is_ok() || y.is_ok() { | --------- because of this check ... -85 | x.unwrap(); // will panic +75 | x.unwrap(); // will panic | ^^^^^^^^^^ error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:86:9 + --> $DIR/checked_unwrap.rs:76:9 | -79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { +70 | if x.is_ok() || y.is_ok() { | --------- the check is happening here ... -86 | x.unwrap_err(); // unnecessary +76 | x.unwrap_err(); // unnecessary + | ^^^^^^^^^^^^^^ + +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:77:9 + | +70 | if x.is_ok() || y.is_ok() { + | --------- because of this check +... +77 | y.unwrap(); // will panic + | ^^^^^^^^^^ + +error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:78:9 + | +70 | if x.is_ok() || y.is_ok() { + | --------- the check is happening here +... +78 | y.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:87:9 + --> $DIR/checked_unwrap.rs:82:9 | -79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { - | --------- the check is happening here -... -87 | y.unwrap(); // unnecessary +81 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | --------- the check is happening here +82 | x.unwrap(); // unnecessary | ^^^^^^^^^^ error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:88:9 + --> $DIR/checked_unwrap.rs:83:9 | -79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { - | --------- because of this check -... -88 | y.unwrap_err(); // will panic +81 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | --------- because of this check +82 | x.unwrap(); // unnecessary +83 | x.unwrap_err(); // will panic | ^^^^^^^^^^^^^^ error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:89:9 + --> $DIR/checked_unwrap.rs:84:9 | -79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { - | ---------- because of this check +81 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | --------- because of this check ... -89 | z.unwrap(); // will panic +84 | y.unwrap(); // will panic | ^^^^^^^^^^ error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:90:9 + --> $DIR/checked_unwrap.rs:85:9 | -79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { - | ---------- the check is happening here +81 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | --------- the check is happening here ... -90 | z.unwrap_err(); // unnecessary +85 | y.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:98:13 + --> $DIR/checked_unwrap.rs:86:9 | -97 | if x.is_some() { - | ----------- the check is happening here -98 | x.unwrap(); // unnecessary - | ^^^^^^^^^^ +81 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | ---------- the check is happening here +... +86 | z.unwrap(); // unnecessary + | ^^^^^^^^^^ + +error: This call to `unwrap_err()` will always panic. + --> $DIR/checked_unwrap.rs:87:9 + | +81 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | ---------- because of this check +... +87 | z.unwrap_err(); // will panic + | ^^^^^^^^^^^^^^ error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:100:13 + --> $DIR/checked_unwrap.rs:95:9 + | +89 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | --------- because of this check +... +95 | x.unwrap(); // will panic + | ^^^^^^^^^^ + +error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:96:9 + | +89 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | --------- the check is happening here +... +96 | x.unwrap_err(); // unnecessary + | ^^^^^^^^^^^^^^ + +error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:97:9 + | +89 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | --------- the check is happening here +... +97 | y.unwrap(); // unnecessary + | ^^^^^^^^^^ + +error: This call to `unwrap_err()` will always panic. + --> $DIR/checked_unwrap.rs:98:9 + | +89 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | --------- because of this check +... +98 | y.unwrap_err(); // will panic + | ^^^^^^^^^^^^^^ + +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:99:9 + | +89 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | ---------- because of this check +... +99 | z.unwrap(); // will panic + | ^^^^^^^^^^ + +error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:100:9 | -97 | if x.is_some() { +89 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | ---------- the check is happening here +... +100 | z.unwrap_err(); // unnecessary + | ^^^^^^^^^^^^^^ + +error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:108:13 + | +107 | if x.is_some() { + | ----------- the check is happening here +108 | x.unwrap(); // unnecessary + | ^^^^^^^^^^ + +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:110:13 + | +107 | if x.is_some() { | ----------- because of this check ... -100 | x.unwrap(); // will panic +110 | x.unwrap(); // will panic | ^^^^^^^^^^ error: aborting due to 34 previous errors diff --git a/tests/ui/clone_on_copy_impl.rs b/tests/ui/clone_on_copy_impl.rs index e21441640..a1353abd9 100644 --- a/tests/ui/clone_on_copy_impl.rs +++ b/tests/ui/clone_on_copy_impl.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use std::marker::PhantomData; use std::fmt; diff --git a/tests/ui/clone_on_copy_mut.rs b/tests/ui/clone_on_copy_mut.rs index 77dffc676..ad37d45d3 100644 --- a/tests/ui/clone_on_copy_mut.rs +++ b/tests/ui/clone_on_copy_mut.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] pub fn dec_read_dec(i: &mut i32) -> i32 { diff --git a/tests/ui/cmp_nan.rs b/tests/ui/cmp_nan.rs index fdebb7da1..a2506f444 100644 --- a/tests/ui/cmp_nan.rs +++ b/tests/ui/cmp_nan.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/cmp_nan.stderr b/tests/ui/cmp_nan.stderr index 7f636e6b5..b880b821f 100644 --- a/tests/ui/cmp_nan.stderr +++ b/tests/ui/cmp_nan.stderr @@ -1,75 +1,75 @@ -error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> $DIR/cmp_nan.rs:8:5 - | -8 | x == std::f32::NAN; - | ^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::cmp-nan` implied by `-D warnings` - -error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> $DIR/cmp_nan.rs:9:5 - | -9 | x != std::f32::NAN; - | ^^^^^^^^^^^^^^^^^^ - -error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> $DIR/cmp_nan.rs:10:5 - | -10 | x < std::f32::NAN; - | ^^^^^^^^^^^^^^^^^ - -error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> $DIR/cmp_nan.rs:11:5 - | -11 | x > std::f32::NAN; - | ^^^^^^^^^^^^^^^^^ - -error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> $DIR/cmp_nan.rs:12:5 - | -12 | x <= std::f32::NAN; - | ^^^^^^^^^^^^^^^^^^ - -error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> $DIR/cmp_nan.rs:13:5 - | -13 | x >= std::f32::NAN; - | ^^^^^^^^^^^^^^^^^^ - -error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> $DIR/cmp_nan.rs:16:5 - | -16 | y == std::f64::NAN; - | ^^^^^^^^^^^^^^^^^^ - -error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> $DIR/cmp_nan.rs:17:5 - | -17 | y != std::f64::NAN; - | ^^^^^^^^^^^^^^^^^^ - error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead --> $DIR/cmp_nan.rs:18:5 | -18 | y < std::f64::NAN; - | ^^^^^^^^^^^^^^^^^ +18 | x == std::f32::NAN; + | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead --> $DIR/cmp_nan.rs:19:5 | -19 | y > std::f64::NAN; - | ^^^^^^^^^^^^^^^^^ +19 | x != std::f32::NAN; + | ^^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead --> $DIR/cmp_nan.rs:20:5 | -20 | y <= std::f64::NAN; - | ^^^^^^^^^^^^^^^^^^ +20 | x < std::f32::NAN; + | ^^^^^^^^^^^^^^^^^ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead --> $DIR/cmp_nan.rs:21:5 | -21 | y >= std::f64::NAN; +21 | x > std::f32::NAN; + | ^^^^^^^^^^^^^^^^^ + +error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead + --> $DIR/cmp_nan.rs:22:5 + | +22 | x <= std::f32::NAN; + | ^^^^^^^^^^^^^^^^^^ + +error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead + --> $DIR/cmp_nan.rs:23:5 + | +23 | x >= std::f32::NAN; + | ^^^^^^^^^^^^^^^^^^ + +error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead + --> $DIR/cmp_nan.rs:26:5 + | +26 | y == std::f64::NAN; + | ^^^^^^^^^^^^^^^^^^ + +error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead + --> $DIR/cmp_nan.rs:27:5 + | +27 | y != std::f64::NAN; + | ^^^^^^^^^^^^^^^^^^ + +error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead + --> $DIR/cmp_nan.rs:28:5 + | +28 | y < std::f64::NAN; + | ^^^^^^^^^^^^^^^^^ + +error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead + --> $DIR/cmp_nan.rs:29:5 + | +29 | y > std::f64::NAN; + | ^^^^^^^^^^^^^^^^^ + +error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead + --> $DIR/cmp_nan.rs:30:5 + | +30 | y <= std::f64::NAN; + | ^^^^^^^^^^^^^^^^^^ + +error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead + --> $DIR/cmp_nan.rs:31:5 + | +31 | y >= std::f64::NAN; | ^^^^^^^^^^^^^^^^^^ error: aborting due to 12 previous errors diff --git a/tests/ui/cmp_null.rs b/tests/ui/cmp_null.rs index e10b3e104..d8214876a 100644 --- a/tests/ui/cmp_null.rs +++ b/tests/ui/cmp_null.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::cmp_null)] diff --git a/tests/ui/cmp_null.stderr b/tests/ui/cmp_null.stderr index 55050d2a3..1f1fdf328 100644 --- a/tests/ui/cmp_null.stderr +++ b/tests/ui/cmp_null.stderr @@ -1,15 +1,15 @@ error: Comparing with null is better expressed by the .is_null() method - --> $DIR/cmp_null.rs:11:8 + --> $DIR/cmp_null.rs:21:8 | -11 | if p == ptr::null() { +21 | if p == ptr::null() { | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::cmp-null` implied by `-D warnings` error: Comparing with null is better expressed by the .is_null() method - --> $DIR/cmp_null.rs:16:8 + --> $DIR/cmp_null.rs:26:8 | -16 | if m == ptr::null_mut() { +26 | if m == ptr::null_mut() { | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/cmp_owned.rs b/tests/ui/cmp_owned.rs index 713975c44..e937afc1a 100644 --- a/tests/ui/cmp_owned.rs +++ b/tests/ui/cmp_owned.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/cmp_owned.stderr b/tests/ui/cmp_owned.stderr index 2691c12ea..020ffe805 100644 --- a/tests/ui/cmp_owned.stderr +++ b/tests/ui/cmp_owned.stderr @@ -1,39 +1,39 @@ error: this creates an owned instance just for comparison - --> $DIR/cmp_owned.rs:8:14 - | -8 | x != "foo".to_string(); - | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` - | - = note: `-D clippy::cmp-owned` implied by `-D warnings` + --> $DIR/cmp_owned.rs:18:14 + | +18 | x != "foo".to_string(); + | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` + | + = note: `-D clippy::cmp-owned` implied by `-D warnings` error: this creates an owned instance just for comparison - --> $DIR/cmp_owned.rs:10:9 + --> $DIR/cmp_owned.rs:20:9 | -10 | "foo".to_string() != x; +20 | "foo".to_string() != x; | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` error: this creates an owned instance just for comparison - --> $DIR/cmp_owned.rs:17:10 + --> $DIR/cmp_owned.rs:27:10 | -17 | x != "foo".to_owned(); +27 | x != "foo".to_owned(); | ^^^^^^^^^^^^^^^^ help: try: `"foo"` error: this creates an owned instance just for comparison - --> $DIR/cmp_owned.rs:19:10 + --> $DIR/cmp_owned.rs:29:10 | -19 | x != String::from("foo"); +29 | x != String::from("foo"); | ^^^^^^^^^^^^^^^^^^^ help: try: `"foo"` error: this creates an owned instance just for comparison - --> $DIR/cmp_owned.rs:23:5 + --> $DIR/cmp_owned.rs:33:5 | -23 | Foo.to_owned() == Foo; +33 | Foo.to_owned() == Foo; | ^^^^^^^^^^^^^^ help: try: `Foo` error: this creates an owned instance just for comparison - --> $DIR/cmp_owned.rs:30:9 + --> $DIR/cmp_owned.rs:40:9 | -30 | self.to_owned() == *other +40 | self.to_owned() == *other | ^^^^^^^^^^^^^^^ try calling implementing the comparison without allocating error: aborting due to 6 previous errors diff --git a/tests/ui/collapsible_if.rs b/tests/ui/collapsible_if.rs index d40be6319..fa80b27f5 100644 --- a/tests/ui/collapsible_if.rs +++ b/tests/ui/collapsible_if.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/collapsible_if.stderr b/tests/ui/collapsible_if.stderr index a447fab7b..87c279cd7 100644 --- a/tests/ui/collapsible_if.stderr +++ b/tests/ui/collapsible_if.stderr @@ -1,243 +1,243 @@ error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:8:5 + --> $DIR/collapsible_if.rs:18:5 | -8 | / if x == "hello" { -9 | | if y == "world" { -10 | | println!("Hello world!"); -11 | | } -12 | | } +18 | / if x == "hello" { +19 | | if y == "world" { +20 | | println!("Hello world!"); +21 | | } +22 | | } | |_____^ | = note: `-D clippy::collapsible-if` implied by `-D warnings` help: try | -8 | if x == "hello" && y == "world" { -9 | println!("Hello world!"); -10 | } +18 | if x == "hello" && y == "world" { +19 | println!("Hello world!"); +20 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:14:5 + --> $DIR/collapsible_if.rs:24:5 | -14 | / if x == "hello" || x == "world" { -15 | | if y == "world" || y == "hello" { -16 | | println!("Hello world!"); -17 | | } -18 | | } +24 | / if x == "hello" || x == "world" { +25 | | if y == "world" || y == "hello" { +26 | | println!("Hello world!"); +27 | | } +28 | | } | |_____^ help: try | -14 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") { -15 | println!("Hello world!"); -16 | } +24 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") { +25 | println!("Hello world!"); +26 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:20:5 + --> $DIR/collapsible_if.rs:30:5 | -20 | / if x == "hello" && x == "world" { -21 | | if y == "world" || y == "hello" { -22 | | println!("Hello world!"); -23 | | } -24 | | } +30 | / if x == "hello" && x == "world" { +31 | | if y == "world" || y == "hello" { +32 | | println!("Hello world!"); +33 | | } +34 | | } | |_____^ help: try | -20 | if x == "hello" && x == "world" && (y == "world" || y == "hello") { -21 | println!("Hello world!"); -22 | } +30 | if x == "hello" && x == "world" && (y == "world" || y == "hello") { +31 | println!("Hello world!"); +32 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:26:5 + --> $DIR/collapsible_if.rs:36:5 | -26 | / if x == "hello" || x == "world" { -27 | | if y == "world" && y == "hello" { -28 | | println!("Hello world!"); -29 | | } -30 | | } +36 | / if x == "hello" || x == "world" { +37 | | if y == "world" && y == "hello" { +38 | | println!("Hello world!"); +39 | | } +40 | | } | |_____^ help: try | -26 | if (x == "hello" || x == "world") && y == "world" && y == "hello" { -27 | println!("Hello world!"); -28 | } +36 | if (x == "hello" || x == "world") && y == "world" && y == "hello" { +37 | println!("Hello world!"); +38 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:32:5 + --> $DIR/collapsible_if.rs:42:5 | -32 | / if x == "hello" && x == "world" { -33 | | if y == "world" && y == "hello" { -34 | | println!("Hello world!"); -35 | | } -36 | | } +42 | / if x == "hello" && x == "world" { +43 | | if y == "world" && y == "hello" { +44 | | println!("Hello world!"); +45 | | } +46 | | } | |_____^ help: try | -32 | if x == "hello" && x == "world" && y == "world" && y == "hello" { -33 | println!("Hello world!"); -34 | } +42 | if x == "hello" && x == "world" && y == "world" && y == "hello" { +43 | println!("Hello world!"); +44 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:38:5 + --> $DIR/collapsible_if.rs:48:5 | -38 | / if 42 == 1337 { -39 | | if 'a' != 'A' { -40 | | println!("world!") -41 | | } -42 | | } +48 | / if 42 == 1337 { +49 | | if 'a' != 'A' { +50 | | println!("world!") +51 | | } +52 | | } | |_____^ help: try | -38 | if 42 == 1337 && 'a' != 'A' { -39 | println!("world!") -40 | } +48 | if 42 == 1337 && 'a' != 'A' { +49 | println!("world!") +50 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:47:12 + --> $DIR/collapsible_if.rs:57:12 | -47 | } else { +57 | } else { | ____________^ -48 | | if y == "world" { -49 | | println!("world!") -50 | | } -51 | | } +58 | | if y == "world" { +59 | | println!("world!") +60 | | } +61 | | } | |_____^ help: try | -47 | } else if y == "world" { -48 | println!("world!") -49 | } +57 | } else if y == "world" { +58 | println!("world!") +59 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:55:12 + --> $DIR/collapsible_if.rs:65:12 | -55 | } else { +65 | } else { | ____________^ -56 | | if let Some(42) = Some(42) { -57 | | println!("world!") -58 | | } -59 | | } +66 | | if let Some(42) = Some(42) { +67 | | println!("world!") +68 | | } +69 | | } | |_____^ help: try | -55 | } else if let Some(42) = Some(42) { -56 | println!("world!") -57 | } +65 | } else if let Some(42) = Some(42) { +66 | println!("world!") +67 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:63:12 + --> $DIR/collapsible_if.rs:73:12 | -63 | } else { +73 | } else { | ____________^ -64 | | if y == "world" { -65 | | println!("world") -66 | | } +74 | | if y == "world" { +75 | | println!("world") +76 | | } ... | -69 | | } -70 | | } +79 | | } +80 | | } | |_____^ help: try | -63 | } else if y == "world" { -64 | println!("world") -65 | } -66 | else { -67 | println!("!") -68 | } +73 | } else if y == "world" { +74 | println!("world") +75 | } +76 | else { +77 | println!("!") +78 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:74:12 + --> $DIR/collapsible_if.rs:84:12 | -74 | } else { +84 | } else { | ____________^ -75 | | if let Some(42) = Some(42) { -76 | | println!("world") -77 | | } +85 | | if let Some(42) = Some(42) { +86 | | println!("world") +87 | | } ... | -80 | | } -81 | | } +90 | | } +91 | | } | |_____^ help: try | -74 | } else if let Some(42) = Some(42) { -75 | println!("world") -76 | } -77 | else { -78 | println!("!") -79 | } +84 | } else if let Some(42) = Some(42) { +85 | println!("world") +86 | } +87 | else { +88 | println!("!") +89 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:85:12 - | -85 | } else { - | ____________^ -86 | | if let Some(42) = Some(42) { -87 | | println!("world") -88 | | } -... | -91 | | } -92 | | } - | |_____^ -help: try - | -85 | } else if let Some(42) = Some(42) { -86 | println!("world") -87 | } -88 | else { -89 | println!("!") -90 | } - | - -error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:96:12 + --> $DIR/collapsible_if.rs:95:12 | -96 | } else { +95 | } else { | ____________^ -97 | | if x == "hello" { -98 | | println!("world") -99 | | } +96 | | if let Some(42) = Some(42) { +97 | | println!("world") +98 | | } ... | -102 | | } -103 | | } +101 | | } +102 | | } | |_____^ help: try | -96 | } else if x == "hello" { -97 | println!("world") -98 | } -99 | else { -100 | println!("!") -101 | } +95 | } else if let Some(42) = Some(42) { +96 | println!("world") +97 | } +98 | else { +99 | println!("!") +100 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:107:12 + --> $DIR/collapsible_if.rs:106:12 | -107 | } else { +106 | } else { | ____________^ -108 | | if let Some(42) = Some(42) { -109 | | println!("world") -110 | | } +107 | | if x == "hello" { +108 | | println!("world") +109 | | } ... | -113 | | } -114 | | } +112 | | } +113 | | } | |_____^ help: try | -107 | } else if let Some(42) = Some(42) { -108 | println!("world") -109 | } -110 | else { -111 | println!("!") -112 | } +106 | } else if x == "hello" { +107 | println!("world") +108 | } +109 | else { +110 | println!("!") +111 | } + | + +error: this `else { if .. }` block can be collapsed + --> $DIR/collapsible_if.rs:117:12 + | +117 | } else { + | ____________^ +118 | | if let Some(42) = Some(42) { +119 | | println!("world") +120 | | } +... | +123 | | } +124 | | } + | |_____^ +help: try + | +117 | } else if let Some(42) = Some(42) { +118 | println!("world") +119 | } +120 | else { +121 | println!("!") +122 | } | error: aborting due to 13 previous errors diff --git a/tests/ui/complex_types.rs b/tests/ui/complex_types.rs index eac2c07c1..5779c9da4 100644 --- a/tests/ui/complex_types.rs +++ b/tests/ui/complex_types.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all)] diff --git a/tests/ui/complex_types.stderr b/tests/ui/complex_types.stderr index 1c9106c0c..f373f0995 100644 --- a/tests/ui/complex_types.stderr +++ b/tests/ui/complex_types.stderr @@ -1,93 +1,93 @@ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:9:12 - | -9 | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::type-complexity` implied by `-D warnings` + --> $DIR/complex_types.rs:19:12 + | +19 | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:10:12 + --> $DIR/complex_types.rs:20:12 | -10 | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); +20 | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:13:8 + --> $DIR/complex_types.rs:23:8 | -13 | f: Vec>>, +23 | f: Vec>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:16:11 + --> $DIR/complex_types.rs:26:11 | -16 | struct TS(Vec>>); +26 | struct TS(Vec>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:19:11 + --> $DIR/complex_types.rs:29:11 | -19 | Tuple(Vec>>), +29 | Tuple(Vec>>), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:20:17 + --> $DIR/complex_types.rs:30:17 | -20 | Struct { f: Vec>> }, +30 | Struct { f: Vec>> }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:24:14 + --> $DIR/complex_types.rs:34:14 | -24 | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); +34 | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:25:30 + --> $DIR/complex_types.rs:35:30 | -25 | fn impl_method(&self, p: Vec>>) { } +35 | fn impl_method(&self, p: Vec>>) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:29:14 + --> $DIR/complex_types.rs:39:14 | -29 | const A: Vec>>; +39 | const A: Vec>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:30:14 + --> $DIR/complex_types.rs:40:14 | -30 | type B = Vec>>; +40 | type B = Vec>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:31:25 + --> $DIR/complex_types.rs:41:25 | -31 | fn method(&self, p: Vec>>); +41 | fn method(&self, p: Vec>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:32:29 + --> $DIR/complex_types.rs:42:29 | -32 | fn def_method(&self, p: Vec>>) { } +42 | fn def_method(&self, p: Vec>>) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:35:15 + --> $DIR/complex_types.rs:45:15 | -35 | fn test1() -> Vec>> { vec![] } +45 | fn test1() -> Vec>> { vec![] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:37:14 + --> $DIR/complex_types.rs:47:14 | -37 | fn test2(_x: Vec>>) { } +47 | fn test2(_x: Vec>>) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: very complex type used. Consider factoring parts into `type` definitions - --> $DIR/complex_types.rs:40:13 + --> $DIR/complex_types.rs:50:13 | -40 | let _y: Vec>> = vec![]; +50 | let _y: Vec>> = vec![]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 15 previous errors diff --git a/tests/ui/const_static_lifetime.rs b/tests/ui/const_static_lifetime.rs index 745821a15..2b6a5dc24 100644 --- a/tests/ui/const_static_lifetime.rs +++ b/tests/ui/const_static_lifetime.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #[derive(Debug)] struct Foo {} diff --git a/tests/ui/const_static_lifetime.stderr b/tests/ui/const_static_lifetime.stderr index db6c4d944..908a68158 100644 --- a/tests/ui/const_static_lifetime.stderr +++ b/tests/ui/const_static_lifetime.stderr @@ -1,81 +1,81 @@ -error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:4:17 - | -4 | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static. - | -^^^^^^^---- help: consider removing `'static`: `&str` - | - = note: `-D clippy::const-static-lifetime` implied by `-D warnings` - -error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:8:21 - | -8 | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` - -error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:10:32 - | -10 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` - -error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:10:47 - | -10 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` - -error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:12:18 - | -12 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static - | -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]` - -error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:12:30 - | -12 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` - error: Constants have by default a `'static` lifetime --> $DIR/const_static_lifetime.rs:14:17 | -14 | const VAR_SIX: &'static u8 = &5; +14 | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static. + | -^^^^^^^---- help: consider removing `'static`: `&str` + | + = note: `-D clippy::const-static-lifetime` implied by `-D warnings` + +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:18:21 + | +18 | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static + | -^^^^^^^---- help: consider removing `'static`: `&str` + +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:20:32 + | +20 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static + | -^^^^^^^---- help: consider removing `'static`: `&str` + +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:20:47 + | +20 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static + | -^^^^^^^---- help: consider removing `'static`: `&str` + +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:22:18 + | +22 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static + | -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]` + +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:22:30 + | +22 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static + | -^^^^^^^---- help: consider removing `'static`: `&str` + +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:24:17 + | +24 | const VAR_SIX: &'static u8 = &5; | -^^^^^^^--- help: consider removing `'static`: `&u8` error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:16:29 + --> $DIR/const_static_lifetime.rs:26:29 | -16 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])]; +26 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])]; | -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]` error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:16:39 + --> $DIR/const_static_lifetime.rs:26:39 | -16 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])]; +26 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])]; | -^^^^^^^---- help: consider removing `'static`: `&str` error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:18:20 + --> $DIR/const_static_lifetime.rs:28:20 | -18 | const VAR_HEIGHT: &'static Foo = &Foo {}; +28 | const VAR_HEIGHT: &'static Foo = &Foo {}; | -^^^^^^^---- help: consider removing `'static`: `&Foo` error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:20:19 + --> $DIR/const_static_lifetime.rs:30:19 | -20 | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static. +30 | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static. | -^^^^^^^----- help: consider removing `'static`: `&[u8]` error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:22:19 + --> $DIR/const_static_lifetime.rs:32:19 | -22 | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static. +32 | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static. | -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)` error: Constants have by default a `'static` lifetime - --> $DIR/const_static_lifetime.rs:24:19 + --> $DIR/const_static_lifetime.rs:34:19 | -24 | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static. +34 | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static. | -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]` error: aborting due to 13 previous errors diff --git a/tests/ui/copies.rs b/tests/ui/copies.rs index 064c7fc1c..2b29e76c4 100644 --- a/tests/ui/copies.rs +++ b/tests/ui/copies.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::blacklisted_name, clippy::collapsible_if, clippy::cyclomatic_complexity, clippy::eq_op, clippy::needless_continue, diff --git a/tests/ui/copies.stderr b/tests/ui/copies.stderr index febd34603..e5f808218 100644 --- a/tests/ui/copies.stderr +++ b/tests/ui/copies.stderr @@ -1,109 +1,122 @@ error: this `if` has identical blocks - --> $DIR/copies.rs:31:10 + --> $DIR/copies.rs:41:10 | -31 | else { //~ ERROR same body as `if` block +41 | else { //~ ERROR same body as `if` block | __________^ -32 | | Foo { bar: 42 }; -33 | | 0..10; -34 | | ..; +42 | | Foo { bar: 42 }; +43 | | 0..10; +44 | | ..; ... | -38 | | foo(); -39 | | } +48 | | foo(); +49 | | } | |_____^ | = note: `-D clippy::if-same-then-else` implied by `-D warnings` note: same as this - --> $DIR/copies.rs:22:13 + --> $DIR/copies.rs:32:13 | -22 | if true { +32 | if true { | _____________^ -23 | | Foo { bar: 42 }; -24 | | 0..10; -25 | | ..; +33 | | Foo { bar: 42 }; +34 | | 0..10; +35 | | ..; ... | -29 | | foo(); -30 | | } +39 | | foo(); +40 | | } | |_____^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:80:14 + --> $DIR/copies.rs:90:14 | -80 | _ => { //~ ERROR match arms have same body +90 | _ => { //~ ERROR match arms have same body | ______________^ -81 | | foo(); -82 | | let mut a = 42 + [23].len() as i32; -83 | | if true { +91 | | foo(); +92 | | let mut a = 42 + [23].len() as i32; +93 | | if true { ... | -87 | | a -88 | | } +97 | | a +98 | | } | |_________^ | = note: `-D clippy::match-same-arms` implied by `-D warnings` note: same as this - --> $DIR/copies.rs:71:15 + --> $DIR/copies.rs:81:15 | -71 | 42 => { +81 | 42 => { | _______________^ -72 | | foo(); -73 | | let mut a = 42 + [23].len() as i32; -74 | | if true { +82 | | foo(); +83 | | let mut a = 42 + [23].len() as i32; +84 | | if true { ... | -78 | | a -79 | | } +88 | | a +89 | | } | |_________^ note: `42` has the same arm body as the `_` wildcard, consider removing it` - --> $DIR/copies.rs:71:15 + --> $DIR/copies.rs:81:15 | -71 | 42 => { +81 | 42 => { | _______________^ -72 | | foo(); -73 | | let mut a = 42 + [23].len() as i32; -74 | | if true { +82 | | foo(); +83 | | let mut a = 42 + [23].len() as i32; +84 | | if true { ... | -78 | | a -79 | | } +88 | | a +89 | | } | |_________^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:94:14 - | -94 | _ => 0, //~ ERROR match arms have same body - | ^ - | + --> $DIR/copies.rs:104:14 + | +104 | _ => 0, //~ ERROR match arms have same body + | ^ + | note: same as this - --> $DIR/copies.rs:92:19 - | -92 | Abc::A => 0, - | ^ + --> $DIR/copies.rs:102:19 + | +102 | Abc::A => 0, + | ^ note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it` - --> $DIR/copies.rs:92:19 - | -92 | Abc::A => 0, - | ^ + --> $DIR/copies.rs:102:19 + | +102 | Abc::A => 0, + | ^ error: this `if` has identical blocks - --> $DIR/copies.rs:104:10 + --> $DIR/copies.rs:114:10 | -104 | else { //~ ERROR same body as `if` block +114 | else { //~ ERROR same body as `if` block | __________^ -105 | | 42 -106 | | }; +115 | | 42 +116 | | }; | |_____^ | note: same as this - --> $DIR/copies.rs:101:21 + --> $DIR/copies.rs:111:21 | -101 | let _ = if true { +111 | let _ = if true { | _____________________^ -102 | | 42 -103 | | } +112 | | 42 +113 | | } | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:118:10 + --> $DIR/copies.rs:128:10 | -118 | else { //~ ERROR same body as `if` block +128 | else { //~ ERROR same body as `if` block | __________^ +129 | | for _ in &[42] { +130 | | let foo: &Option<_> = &Some::(42); +131 | | if true { +... | +136 | | } +137 | | } + | |_____^ + | +note: same as this + --> $DIR/copies.rs:118:13 + | +118 | if true { + | _____________^ 119 | | for _ in &[42] { 120 | | let foo: &Option<_> = &Some::(42); 121 | | if true { @@ -111,274 +124,261 @@ error: this `if` has identical blocks 126 | | } 127 | | } | |_____^ - | -note: same as this - --> $DIR/copies.rs:108:13 - | -108 | if true { - | _____________^ -109 | | for _ in &[42] { -110 | | let foo: &Option<_> = &Some::(42); -111 | | if true { -... | -116 | | } -117 | | } - | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:140:10 + --> $DIR/copies.rs:150:10 | -140 | else { //~ ERROR same body as `if` block +150 | else { //~ ERROR same body as `if` block | __________^ -141 | | let bar = if true { -142 | | 42 -143 | | } +151 | | let bar = if true { +152 | | 42 +153 | | } ... | -149 | | bar + 1; -150 | | } +159 | | bar + 1; +160 | | } | |_____^ | note: same as this - --> $DIR/copies.rs:129:13 + --> $DIR/copies.rs:139:13 | -129 | if true { +139 | if true { | _____________^ -130 | | let bar = if true { -131 | | 42 -132 | | } +140 | | let bar = if true { +141 | | 42 +142 | | } ... | -138 | | bar + 1; -139 | | } +148 | | bar + 1; +149 | | } | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:175:10 + --> $DIR/copies.rs:185:10 | -175 | else { //~ ERROR same body as `if` block +185 | else { //~ ERROR same body as `if` block | __________^ -176 | | if let Some(a) = Some(42) {} -177 | | } +186 | | if let Some(a) = Some(42) {} +187 | | } | |_____^ | note: same as this - --> $DIR/copies.rs:172:13 + --> $DIR/copies.rs:182:13 | -172 | if true { +182 | if true { | _____________^ -173 | | if let Some(a) = Some(42) {} -174 | | } - | |_____^ - -error: this `if` has identical blocks - --> $DIR/copies.rs:182:10 - | -182 | else { //~ ERROR same body as `if` block - | __________^ -183 | | if let (1, .., 3) = (1, 2, 3) {} +183 | | if let Some(a) = Some(42) {} 184 | | } | |_____^ + +error: this `if` has identical blocks + --> $DIR/copies.rs:192:10 + | +192 | else { //~ ERROR same body as `if` block + | __________^ +193 | | if let (1, .., 3) = (1, 2, 3) {} +194 | | } + | |_____^ | note: same as this - --> $DIR/copies.rs:179:13 + --> $DIR/copies.rs:189:13 | -179 | if true { +189 | if true { | _____________^ -180 | | if let (1, .., 3) = (1, 2, 3) {} -181 | | } +190 | | if let (1, .., 3) = (1, 2, 3) {} +191 | | } | |_____^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:237:15 + --> $DIR/copies.rs:247:15 | -237 | 51 => foo(), //~ ERROR match arms have same body +247 | 51 => foo(), //~ ERROR match arms have same body | ^^^^^ | note: same as this - --> $DIR/copies.rs:236:15 + --> $DIR/copies.rs:246:15 | -236 | 42 => foo(), +246 | 42 => foo(), | ^^^^^ note: consider refactoring into `42 | 51` - --> $DIR/copies.rs:236:15 + --> $DIR/copies.rs:246:15 | -236 | 42 => foo(), +246 | 42 => foo(), | ^^^^^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:243:17 + --> $DIR/copies.rs:253:17 | -243 | None => 24, //~ ERROR match arms have same body +253 | None => 24, //~ ERROR match arms have same body | ^^ | note: same as this - --> $DIR/copies.rs:242:20 + --> $DIR/copies.rs:252:20 | -242 | Some(_) => 24, +252 | Some(_) => 24, | ^^ note: consider refactoring into `Some(_) | None` - --> $DIR/copies.rs:242:20 + --> $DIR/copies.rs:252:20 | -242 | Some(_) => 24, +252 | Some(_) => 24, | ^^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:265:28 + --> $DIR/copies.rs:275:28 | -265 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body +275 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body | ^^^^^^ | note: same as this - --> $DIR/copies.rs:264:28 + --> $DIR/copies.rs:274:28 | -264 | (Some(a), None) => bar(a), +274 | (Some(a), None) => bar(a), | ^^^^^^ note: consider refactoring into `(Some(a), None) | (None, Some(a))` - --> $DIR/copies.rs:264:28 + --> $DIR/copies.rs:274:28 | -264 | (Some(a), None) => bar(a), +274 | (Some(a), None) => bar(a), | ^^^^^^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:271:26 + --> $DIR/copies.rs:281:26 | -271 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body +281 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body | ^^^^^^ | note: same as this - --> $DIR/copies.rs:270:26 + --> $DIR/copies.rs:280:26 | -270 | (Some(a), ..) => bar(a), +280 | (Some(a), ..) => bar(a), | ^^^^^^ note: consider refactoring into `(Some(a), ..) | (.., Some(a))` - --> $DIR/copies.rs:270:26 + --> $DIR/copies.rs:280:26 | -270 | (Some(a), ..) => bar(a), +280 | (Some(a), ..) => bar(a), | ^^^^^^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:277:20 + --> $DIR/copies.rs:287:20 | -277 | (.., 3) => 42, //~ ERROR match arms have same body +287 | (.., 3) => 42, //~ ERROR match arms have same body | ^^ | note: same as this - --> $DIR/copies.rs:276:23 + --> $DIR/copies.rs:286:23 | -276 | (1, .., 3) => 42, +286 | (1, .., 3) => 42, | ^^ note: consider refactoring into `(1, .., 3) | (.., 3)` - --> $DIR/copies.rs:276:23 + --> $DIR/copies.rs:286:23 | -276 | (1, .., 3) => 42, +286 | (1, .., 3) => 42, | ^^ error: this `if` has identical blocks - --> $DIR/copies.rs:283:12 + --> $DIR/copies.rs:293:12 | -283 | } else { //~ ERROR same body as `if` block +293 | } else { //~ ERROR same body as `if` block | ____________^ -284 | | 0.0 -285 | | }; +294 | | 0.0 +295 | | }; | |_____^ | note: same as this - --> $DIR/copies.rs:281:21 + --> $DIR/copies.rs:291:21 | -281 | let _ = if true { +291 | let _ = if true { | _____________________^ -282 | | 0.0 -283 | | } else { //~ ERROR same body as `if` block +292 | | 0.0 +293 | | } else { //~ ERROR same body as `if` block | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:289:12 + --> $DIR/copies.rs:299:12 | -289 | } else { //~ ERROR same body as `if` block +299 | } else { //~ ERROR same body as `if` block | ____________^ -290 | | -0.0 -291 | | }; +300 | | -0.0 +301 | | }; | |_____^ | note: same as this - --> $DIR/copies.rs:287:21 + --> $DIR/copies.rs:297:21 | -287 | let _ = if true { +297 | let _ = if true { | _____________________^ -288 | | -0.0 -289 | | } else { //~ ERROR same body as `if` block +298 | | -0.0 +299 | | } else { //~ ERROR same body as `if` block | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:309:12 + --> $DIR/copies.rs:319:12 | -309 | } else { //~ ERROR same body as `if` block +319 | } else { //~ ERROR same body as `if` block | ____________^ -310 | | std::f32::NAN -311 | | }; +320 | | std::f32::NAN +321 | | }; | |_____^ | note: same as this - --> $DIR/copies.rs:307:21 + --> $DIR/copies.rs:317:21 | -307 | let _ = if true { +317 | let _ = if true { | _____________________^ -308 | | std::f32::NAN -309 | | } else { //~ ERROR same body as `if` block +318 | | std::f32::NAN +319 | | } else { //~ ERROR same body as `if` block | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:327:10 + --> $DIR/copies.rs:337:10 | -327 | else { //~ ERROR same body as `if` block +337 | else { //~ ERROR same body as `if` block | __________^ -328 | | try!(Ok("foo")); -329 | | } +338 | | try!(Ok("foo")); +339 | | } | |_____^ | note: same as this - --> $DIR/copies.rs:324:13 + --> $DIR/copies.rs:334:13 | -324 | if true { +334 | if true { | _____________^ -325 | | try!(Ok("foo")); -326 | | } +335 | | try!(Ok("foo")); +336 | | } | |_____^ error: this `if` has the same condition as a previous if - --> $DIR/copies.rs:353:13 + --> $DIR/copies.rs:363:13 | -353 | else if b { //~ ERROR ifs same condition +363 | else if b { //~ ERROR ifs same condition | ^ | = note: `-D clippy::ifs-same-cond` implied by `-D warnings` note: same as this - --> $DIR/copies.rs:351:8 + --> $DIR/copies.rs:361:8 | -351 | if b { +361 | if b { | ^ error: this `if` has the same condition as a previous if - --> $DIR/copies.rs:358:13 + --> $DIR/copies.rs:368:13 | -358 | else if a == 1 { //~ ERROR ifs same condition +368 | else if a == 1 { //~ ERROR ifs same condition | ^^^^^^ | note: same as this - --> $DIR/copies.rs:356:8 + --> $DIR/copies.rs:366:8 | -356 | if a == 1 { +366 | if a == 1 { | ^^^^^^ error: this `if` has the same condition as a previous if - --> $DIR/copies.rs:365:13 + --> $DIR/copies.rs:375:13 | -365 | else if 2*a == 1 { //~ ERROR ifs same condition +375 | else if 2*a == 1 { //~ ERROR ifs same condition | ^^^^^^^^ | note: same as this - --> $DIR/copies.rs:361:8 + --> $DIR/copies.rs:371:8 | -361 | if 2*a == 1 { +371 | if 2*a == 1 { | ^^^^^^^^ error: aborting due to 20 previous errors diff --git a/tests/ui/copy_iterator.rs b/tests/ui/copy_iterator.rs index 5ccb9910c..6984b612f 100644 --- a/tests/ui/copy_iterator.rs +++ b/tests/ui/copy_iterator.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::copy_iterator)] diff --git a/tests/ui/copy_iterator.stderr b/tests/ui/copy_iterator.stderr index 9a06a52d4..4620958f4 100644 --- a/tests/ui/copy_iterator.stderr +++ b/tests/ui/copy_iterator.stderr @@ -1,13 +1,13 @@ error: you are implementing `Iterator` on a `Copy` type - --> $DIR/copy_iterator.rs:8:1 + --> $DIR/copy_iterator.rs:18:1 | -8 | / impl Iterator for Countdown { -9 | | type Item = u8; -10 | | -11 | | fn next(&mut self) -> Option { +18 | / impl Iterator for Countdown { +19 | | type Item = u8; +20 | | +21 | | fn next(&mut self) -> Option { ... | -16 | | } -17 | | } +26 | | } +27 | | } | |_^ | = note: `-D clippy::copy-iterator` implied by `-D warnings` diff --git a/tests/ui/cstring.rs b/tests/ui/cstring.rs index e68874d54..fd5d00059 100644 --- a/tests/ui/cstring.rs +++ b/tests/ui/cstring.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] fn main() {} diff --git a/tests/ui/cstring.stderr b/tests/ui/cstring.stderr index 2b2b51de6..74d6e864d 100644 --- a/tests/ui/cstring.stderr +++ b/tests/ui/cstring.stderr @@ -1,16 +1,16 @@ error: you are getting the inner pointer of a temporary `CString` - --> $DIR/cstring.rs:9:5 - | -9 | CString::new("foo").unwrap().as_ptr(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[deny(clippy::temporary_cstring_as_ptr)] on by default - = note: that pointer will be invalid outside this expression + --> $DIR/cstring.rs:19:5 + | +19 | CString::new("foo").unwrap().as_ptr(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[deny(clippy::temporary_cstring_as_ptr)] on by default + = note: that pointer will be invalid outside this expression help: assign the `CString` to a variable to extend its lifetime - --> $DIR/cstring.rs:9:5 - | -9 | CString::new("foo").unwrap().as_ptr(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $DIR/cstring.rs:19:5 + | +19 | CString::new("foo").unwrap().as_ptr(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/cyclomatic_complexity.rs b/tests/ui/cyclomatic_complexity.rs index 84e2a1b65..3c8ab8694 100644 --- a/tests/ui/cyclomatic_complexity.rs +++ b/tests/ui/cyclomatic_complexity.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::all)] diff --git a/tests/ui/cyclomatic_complexity.stderr b/tests/ui/cyclomatic_complexity.stderr index ff93f21e3..ddc2f5b15 100644 --- a/tests/ui/cyclomatic_complexity.stderr +++ b/tests/ui/cyclomatic_complexity.stderr @@ -1,129 +1,115 @@ error: the function has a cyclomatic complexity of 28 - --> $DIR/cyclomatic_complexity.rs:7:1 + --> $DIR/cyclomatic_complexity.rs:17:1 | -7 | / fn main() { -8 | | if true { -9 | | println!("a"); -10 | | } +17 | / fn main() { +18 | | if true { +19 | | println!("a"); +20 | | } ... | -88 | | } -89 | | } +98 | | } +99 | | } | |_^ | = note: `-D clippy::cyclomatic-complexity` implied by `-D warnings` = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 7 - --> $DIR/cyclomatic_complexity.rs:92:1 + --> $DIR/cyclomatic_complexity.rs:102:1 | -92 | / fn kaboom() { -93 | | let n = 0; -94 | | 'a: for i in 0..20 { -95 | | 'b: for j in i..20 { +102 | / fn kaboom() { +103 | | let n = 0; +104 | | 'a: for i in 0..20 { +105 | | 'b: for j in i..20 { ... | -110 | | } -111 | | } +120 | | } +121 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:138:1 - | -138 | / fn lots_of_short_circuits() -> bool { -139 | | true && false && true && false && true && false && true -140 | | } - | |_^ - | - = help: you could split it up into multiple smaller functions - -error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:143:1 - | -143 | / fn lots_of_short_circuits2() -> bool { -144 | | true || false || true || false || true || false || true -145 | | } - | |_^ - | - = help: you could split it up into multiple smaller functions - -error: the function has a cyclomatic complexity of 2 --> $DIR/cyclomatic_complexity.rs:148:1 | -148 | / fn baa() { -149 | | let x = || match 99 { -150 | | 0 => 0, -151 | | 1 => 1, -... | -162 | | } -163 | | } +148 | / fn lots_of_short_circuits() -> bool { +149 | | true && false && true && false && true && false && true +150 | | } + | |_^ + | + = help: you could split it up into multiple smaller functions + +error: the function has a cyclomatic complexity of 1 + --> $DIR/cyclomatic_complexity.rs:153:1 + | +153 | / fn lots_of_short_circuits2() -> bool { +154 | | true || false || true || false || true || false || true +155 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:149:13 + --> $DIR/cyclomatic_complexity.rs:158:1 | -149 | let x = || match 99 { - | _____________^ -150 | | 0 => 0, -151 | | 1 => 1, -152 | | 2 => 2, +158 | / fn baa() { +159 | | let x = || match 99 { +160 | | 0 => 0, +161 | | 1 => 1, ... | -156 | | _ => 42, -157 | | }; +172 | | } +173 | | } + | |_^ + | + = help: you could split it up into multiple smaller functions + +error: the function has a cyclomatic complexity of 2 + --> $DIR/cyclomatic_complexity.rs:159:13 + | +159 | let x = || match 99 { + | _____________^ +160 | | 0 => 0, +161 | | 1 => 1, +162 | | 2 => 2, +... | +166 | | _ => 42, +167 | | }; | |_____^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:166:1 + --> $DIR/cyclomatic_complexity.rs:176:1 | -166 | / fn bar() { -167 | | match 99 { -168 | | 0 => println!("hi"), -169 | | _ => println!("bye"), -170 | | } -171 | | } +176 | / fn bar() { +177 | | match 99 { +178 | | 0 => println!("hi"), +179 | | _ => println!("bye"), +180 | | } +181 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:185:1 + --> $DIR/cyclomatic_complexity.rs:195:1 | -185 | / fn barr() { -186 | | match 99 { -187 | | 0 => println!("hi"), -188 | | 1 => println!("bla"), +195 | / fn barr() { +196 | | match 99 { +197 | | 0 => println!("hi"), +198 | | 1 => println!("bla"), ... | -191 | | } -192 | | } +201 | | } +202 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> $DIR/cyclomatic_complexity.rs:195:1 + --> $DIR/cyclomatic_complexity.rs:205:1 | -195 | / fn barr2() { -196 | | match 99 { -197 | | 0 => println!("hi"), -198 | | 1 => println!("bla"), -... | -207 | | } -208 | | } - | |_^ - | - = help: you could split it up into multiple smaller functions - -error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:211:1 - | -211 | / fn barrr() { -212 | | match 99 { -213 | | 0 => println!("hi"), -214 | | 1 => panic!("bla"), +205 | / fn barr2() { +206 | | match 99 { +207 | | 0 => println!("hi"), +208 | | 1 => println!("bla"), ... | 217 | | } 218 | | } @@ -131,27 +117,27 @@ error: the function has a cyclomatic complexity of 2 | = help: you could split it up into multiple smaller functions -error: the function has a cyclomatic complexity of 3 +error: the function has a cyclomatic complexity of 2 --> $DIR/cyclomatic_complexity.rs:221:1 | -221 | / fn barrr2() { +221 | / fn barrr() { 222 | | match 99 { 223 | | 0 => println!("hi"), 224 | | 1 => panic!("bla"), ... | -233 | | } -234 | | } +227 | | } +228 | | } | |_^ | = help: you could split it up into multiple smaller functions -error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:237:1 +error: the function has a cyclomatic complexity of 3 + --> $DIR/cyclomatic_complexity.rs:231:1 | -237 | / fn barrrr() { -238 | | match 99 { -239 | | 0 => println!("hi"), -240 | | 1 => println!("bla"), +231 | / fn barrr2() { +232 | | match 99 { +233 | | 0 => println!("hi"), +234 | | 1 => panic!("bla"), ... | 243 | | } 244 | | } @@ -159,55 +145,56 @@ error: the function has a cyclomatic complexity of 2 | = help: you could split it up into multiple smaller functions -error: the function has a cyclomatic complexity of 3 +error: the function has a cyclomatic complexity of 2 --> $DIR/cyclomatic_complexity.rs:247:1 | -247 | / fn barrrr2() { +247 | / fn barrrr() { 248 | | match 99 { 249 | | 0 => println!("hi"), 250 | | 1 => println!("bla"), ... | -259 | | } -260 | | } +253 | | } +254 | | } | |_^ | = help: you could split it up into multiple smaller functions -error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:263:1 +error: the function has a cyclomatic complexity of 3 + --> $DIR/cyclomatic_complexity.rs:257:1 | -263 | / fn cake() { -264 | | if 4 == 5 { -265 | | println!("yea"); -266 | | } else { +257 | / fn barrrr2() { +258 | | match 99 { +259 | | 0 => println!("hi"), +260 | | 1 => println!("bla"), ... | -269 | | println!("whee"); +269 | | } 270 | | } | |_^ | = help: you could split it up into multiple smaller functions -error: the function has a cyclomatic complexity of 4 - --> $DIR/cyclomatic_complexity.rs:274:1 +error: the function has a cyclomatic complexity of 2 + --> $DIR/cyclomatic_complexity.rs:273:1 | -274 | / pub fn read_file(input_path: &str) -> String { -275 | | use std::fs::File; -276 | | use std::io::{Read, Write}; -277 | | use std::path::Path; +273 | / fn cake() { +274 | | if 4 == 5 { +275 | | println!("yea"); +276 | | } else { ... | -299 | | } -300 | | } +279 | | println!("whee"); +280 | | } | |_^ | = help: you could split it up into multiple smaller functions -error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:305:1 +error: the function has a cyclomatic complexity of 4 + --> $DIR/cyclomatic_complexity.rs:284:1 | -305 | / fn void(void: Void) { -306 | | if true { -307 | | match void { -308 | | } +284 | / pub fn read_file(input_path: &str) -> String { +285 | | use std::fs::File; +286 | | use std::io::{Read, Write}; +287 | | use std::path::Path; +... | 309 | | } 310 | | } | |_^ @@ -215,56 +202,69 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:319:1 + --> $DIR/cyclomatic_complexity.rs:315:1 | -319 | / fn try() -> Result { -320 | | match 5 { -321 | | 5 => Ok(5), -322 | | _ => return Err("bla"), -323 | | } -324 | | } +315 | / fn void(void: Void) { +316 | | if true { +317 | | match void { +318 | | } +319 | | } +320 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:327:1 + --> $DIR/cyclomatic_complexity.rs:329:1 | -327 | / fn try_again() -> Result { -328 | | let _ = try!(Ok(42)); -329 | | let _ = try!(Ok(43)); -330 | | let _ = try!(Ok(44)); -... | -339 | | } -340 | | } +329 | / fn try() -> Result { +330 | | match 5 { +331 | | 5 => Ok(5), +332 | | _ => return Err("bla"), +333 | | } +334 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:343:1 + --> $DIR/cyclomatic_complexity.rs:337:1 | -343 | / fn early() -> Result { -344 | | return Ok(5); -345 | | return Ok(5); -346 | | return Ok(5); +337 | / fn try_again() -> Result { +338 | | let _ = try!(Ok(42)); +339 | | let _ = try!(Ok(43)); +340 | | let _ = try!(Ok(44)); ... | -352 | | return Ok(5); -353 | | } +349 | | } +350 | | } + | |_^ + | + = help: you could split it up into multiple smaller functions + +error: the function has a cyclomatic complexity of 1 + --> $DIR/cyclomatic_complexity.rs:353:1 + | +353 | / fn early() -> Result { +354 | | return Ok(5); +355 | | return Ok(5); +356 | | return Ok(5); +... | +362 | | return Ok(5); +363 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 8 - --> $DIR/cyclomatic_complexity.rs:356:1 + --> $DIR/cyclomatic_complexity.rs:366:1 | -356 | / fn early_ret() -> i32 { -357 | | let a = if true { 42 } else { return 0; }; -358 | | let a = if a < 99 { 42 } else { return 0; }; -359 | | let a = if a < 99 { 42 } else { return 0; }; +366 | / fn early_ret() -> i32 { +367 | | let a = if true { 42 } else { return 0; }; +368 | | let a = if a < 99 { 42 } else { return 0; }; +369 | | let a = if a < 99 { 42 } else { return 0; }; ... | -372 | | } -373 | | } +382 | | } +383 | | } | |_^ | = help: you could split it up into multiple smaller functions diff --git a/tests/ui/cyclomatic_complexity_attr_used.rs b/tests/ui/cyclomatic_complexity_attr_used.rs index fd8be25e6..1699601aa 100644 --- a/tests/ui/cyclomatic_complexity_attr_used.rs +++ b/tests/ui/cyclomatic_complexity_attr_used.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::cyclomatic_complexity)] diff --git a/tests/ui/cyclomatic_complexity_attr_used.stderr b/tests/ui/cyclomatic_complexity_attr_used.stderr index f8342f0d9..f066e29ce 100644 --- a/tests/ui/cyclomatic_complexity_attr_used.stderr +++ b/tests/ui/cyclomatic_complexity_attr_used.stderr @@ -1,13 +1,13 @@ error: the function has a cyclomatic complexity of 3 - --> $DIR/cyclomatic_complexity_attr_used.rs:11:1 + --> $DIR/cyclomatic_complexity_attr_used.rs:21:1 | -11 | / fn kaboom() { -12 | | if 42 == 43 { -13 | | panic!(); -14 | | } else if "cake" == "lie" { -15 | | println!("what?"); -16 | | } -17 | | } +21 | / fn kaboom() { +22 | | if 42 == 43 { +23 | | panic!(); +24 | | } else if "cake" == "lie" { +25 | | println!("what?"); +26 | | } +27 | | } | |_^ | = note: `-D clippy::cyclomatic-complexity` implied by `-D warnings` diff --git a/tests/ui/decimal_literal_representation.rs b/tests/ui/decimal_literal_representation.rs index 472ea6185..f85ccd847 100644 --- a/tests/ui/decimal_literal_representation.rs +++ b/tests/ui/decimal_literal_representation.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/decimal_literal_representation.stderr b/tests/ui/decimal_literal_representation.stderr index 343936bb7..d944c4906 100644 --- a/tests/ui/decimal_literal_representation.stderr +++ b/tests/ui/decimal_literal_representation.stderr @@ -1,33 +1,33 @@ error: integer literal has a better hexadecimal representation - --> $DIR/decimal_literal_representation.rs:18:9 + --> $DIR/decimal_literal_representation.rs:28:9 | -18 | 32_773, // 0x8005 +28 | 32_773, // 0x8005 | ^^^^^^ help: consider: `0x8005` | = note: `-D clippy::decimal-literal-representation` implied by `-D warnings` error: integer literal has a better hexadecimal representation - --> $DIR/decimal_literal_representation.rs:19:9 + --> $DIR/decimal_literal_representation.rs:29:9 | -19 | 65_280, // 0xFF00 +29 | 65_280, // 0xFF00 | ^^^^^^ help: consider: `0xFF00` error: integer literal has a better hexadecimal representation - --> $DIR/decimal_literal_representation.rs:20:9 + --> $DIR/decimal_literal_representation.rs:30:9 | -20 | 2_131_750_927, // 0x7F0F_F00F +30 | 2_131_750_927, // 0x7F0F_F00F | ^^^^^^^^^^^^^ help: consider: `0x7F0F_F00F` error: integer literal has a better hexadecimal representation - --> $DIR/decimal_literal_representation.rs:21:9 + --> $DIR/decimal_literal_representation.rs:31:9 | -21 | 2_147_483_647, // 0x7FFF_FFFF +31 | 2_147_483_647, // 0x7FFF_FFFF | ^^^^^^^^^^^^^ help: consider: `0x7FFF_FFFF` error: integer literal has a better hexadecimal representation - --> $DIR/decimal_literal_representation.rs:22:9 + --> $DIR/decimal_literal_representation.rs:32:9 | -22 | 4_042_322_160, // 0xF0F0_F0F0 +32 | 4_042_322_160, // 0xF0F0_F0F0 | ^^^^^^^^^^^^^ help: consider: `0xF0F0_F0F0` error: aborting due to 5 previous errors diff --git a/tests/ui/default_trait_access.rs b/tests/ui/default_trait_access.rs index 248b4ec00..d268746d7 100644 --- a/tests/ui/default_trait_access.rs +++ b/tests/ui/default_trait_access.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::default_trait_access)] diff --git a/tests/ui/default_trait_access.stderr b/tests/ui/default_trait_access.stderr index e3c263e77..d6ae00214 100644 --- a/tests/ui/default_trait_access.stderr +++ b/tests/ui/default_trait_access.stderr @@ -1,51 +1,51 @@ error: Calling std::string::String::default() is more clear than this expression - --> $DIR/default_trait_access.rs:10:22 + --> $DIR/default_trait_access.rs:20:22 | -10 | let s1: String = Default::default(); +20 | let s1: String = Default::default(); | ^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()` | = note: `-D clippy::default-trait-access` implied by `-D warnings` error: Calling std::string::String::default() is more clear than this expression - --> $DIR/default_trait_access.rs:14:22 + --> $DIR/default_trait_access.rs:24:22 | -14 | let s3: String = D2::default(); +24 | let s3: String = D2::default(); | ^^^^^^^^^^^^^ help: try: `std::string::String::default()` error: Calling std::string::String::default() is more clear than this expression - --> $DIR/default_trait_access.rs:16:22 + --> $DIR/default_trait_access.rs:26:22 | -16 | let s4: String = std::default::Default::default(); +26 | let s4: String = std::default::Default::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()` error: Calling std::string::String::default() is more clear than this expression - --> $DIR/default_trait_access.rs:20:22 + --> $DIR/default_trait_access.rs:30:22 | -20 | let s6: String = default::Default::default(); +30 | let s6: String = default::Default::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()` error: Calling GenericDerivedDefault::default() is more clear than this expression - --> $DIR/default_trait_access.rs:30:46 + --> $DIR/default_trait_access.rs:40:46 | -30 | let s11: GenericDerivedDefault = Default::default(); +40 | let s11: GenericDerivedDefault = Default::default(); | ^^^^^^^^^^^^^^^^^^ help: try: `GenericDerivedDefault::default()` error: Calling TupleDerivedDefault::default() is more clear than this expression - --> $DIR/default_trait_access.rs:36:36 + --> $DIR/default_trait_access.rs:46:36 | -36 | let s14: TupleDerivedDefault = Default::default(); +46 | let s14: TupleDerivedDefault = Default::default(); | ^^^^^^^^^^^^^^^^^^ help: try: `TupleDerivedDefault::default()` error: Calling ArrayDerivedDefault::default() is more clear than this expression - --> $DIR/default_trait_access.rs:38:36 + --> $DIR/default_trait_access.rs:48:36 | -38 | let s15: ArrayDerivedDefault = Default::default(); +48 | let s15: ArrayDerivedDefault = Default::default(); | ^^^^^^^^^^^^^^^^^^ help: try: `ArrayDerivedDefault::default()` error: Calling TupleStructDerivedDefault::default() is more clear than this expression - --> $DIR/default_trait_access.rs:42:42 + --> $DIR/default_trait_access.rs:52:42 | -42 | let s17: TupleStructDerivedDefault = Default::default(); +52 | let s17: TupleStructDerivedDefault = Default::default(); | ^^^^^^^^^^^^^^^^^^ help: try: `TupleStructDerivedDefault::default()` error: aborting due to 8 previous errors diff --git a/tests/ui/deprecated.rs b/tests/ui/deprecated.rs index f456c4172..a7e95ad5d 100644 --- a/tests/ui/deprecated.rs +++ b/tests/ui/deprecated.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + diff --git a/tests/ui/deprecated.stderr b/tests/ui/deprecated.stderr index 6bbc0aebf..d44528ab2 100644 --- a/tests/ui/deprecated.stderr +++ b/tests/ui/deprecated.stderr @@ -1,33 +1,33 @@ error: lint `str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon` - --> $DIR/deprecated.rs:4:8 - | -4 | #[warn(str_to_string)] - | ^^^^^^^^^^^^^ - | - = note: `-D renamed-and-removed-lints` implied by `-D warnings` + --> $DIR/deprecated.rs:14:8 + | +14 | #[warn(str_to_string)] + | ^^^^^^^^^^^^^ + | + = note: `-D renamed-and-removed-lints` implied by `-D warnings` error: lint `string_to_string` has been removed: `using `string::to_string` is common even today and specialization will likely happen soon` - --> $DIR/deprecated.rs:6:8 - | -6 | #[warn(string_to_string)] - | ^^^^^^^^^^^^^^^^ + --> $DIR/deprecated.rs:16:8 + | +16 | #[warn(string_to_string)] + | ^^^^^^^^^^^^^^^^ error: lint `unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7` - --> $DIR/deprecated.rs:8:8 - | -8 | #[warn(unstable_as_slice)] - | ^^^^^^^^^^^^^^^^^ + --> $DIR/deprecated.rs:18:8 + | +18 | #[warn(unstable_as_slice)] + | ^^^^^^^^^^^^^^^^^ error: lint `unstable_as_mut_slice` has been removed: ``Vec::as_mut_slice` has been stabilized in 1.7` - --> $DIR/deprecated.rs:10:8 + --> $DIR/deprecated.rs:20:8 | -10 | #[warn(unstable_as_mut_slice)] +20 | #[warn(unstable_as_mut_slice)] | ^^^^^^^^^^^^^^^^^^^^^ error: lint `misaligned_transmute` has been removed: `this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr` - --> $DIR/deprecated.rs:12:8 + --> $DIR/deprecated.rs:22:8 | -12 | #[warn(misaligned_transmute)] +22 | #[warn(misaligned_transmute)] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/derive.rs b/tests/ui/derive.rs index ae54c0290..c5ce42586 100644 --- a/tests/ui/derive.rs +++ b/tests/ui/derive.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(untagged_unions)] diff --git a/tests/ui/derive.stderr b/tests/ui/derive.stderr index fa706f22b..824b5b44c 100644 --- a/tests/ui/derive.stderr +++ b/tests/ui/derive.stderr @@ -1,83 +1,67 @@ error: you are deriving `Hash` but have implemented `PartialEq` explicitly - --> $DIR/derive.rs:17:10 + --> $DIR/derive.rs:27:10 | -17 | #[derive(Hash)] +27 | #[derive(Hash)] | ^^^^ | = note: #[deny(clippy::derive_hash_xor_eq)] on by default note: `PartialEq` implemented here - --> $DIR/derive.rs:20:1 + --> $DIR/derive.rs:30:1 | -20 | / impl PartialEq for Bar { -21 | | fn eq(&self, _: &Bar) -> bool { true } -22 | | } +30 | / impl PartialEq for Bar { +31 | | fn eq(&self, _: &Bar) -> bool { true } +32 | | } | |_^ error: you are deriving `Hash` but have implemented `PartialEq` explicitly - --> $DIR/derive.rs:24:10 + --> $DIR/derive.rs:34:10 | -24 | #[derive(Hash)] +34 | #[derive(Hash)] | ^^^^ | note: `PartialEq` implemented here - --> $DIR/derive.rs:27:1 + --> $DIR/derive.rs:37:1 | -27 | / impl PartialEq for Baz { -28 | | fn eq(&self, _: &Baz) -> bool { true } -29 | | } +37 | / impl PartialEq for Baz { +38 | | fn eq(&self, _: &Baz) -> bool { true } +39 | | } | |_^ error: you are implementing `Hash` explicitly but have derived `PartialEq` - --> $DIR/derive.rs:34:1 + --> $DIR/derive.rs:44:1 | -34 | / impl Hash for Bah { -35 | | fn hash(&self, _: &mut H) {} -36 | | } +44 | / impl Hash for Bah { +45 | | fn hash(&self, _: &mut H) {} +46 | | } | |_^ | note: `PartialEq` implemented here - --> $DIR/derive.rs:31:10 + --> $DIR/derive.rs:41:10 | -31 | #[derive(PartialEq)] +41 | #[derive(PartialEq)] | ^^^^^^^^^ error: you are implementing `Clone` explicitly on a `Copy` type - --> $DIR/derive.rs:41:1 + --> $DIR/derive.rs:51:1 | -41 | / impl Clone for Qux { -42 | | fn clone(&self) -> Self { Qux } -43 | | } +51 | / impl Clone for Qux { +52 | | fn clone(&self) -> Self { Qux } +53 | | } | |_^ | = note: `-D clippy::expl-impl-clone-on-copy` implied by `-D warnings` note: consider deriving `Clone` or removing `Copy` - --> $DIR/derive.rs:41:1 + --> $DIR/derive.rs:51:1 | -41 | / impl Clone for Qux { -42 | | fn clone(&self) -> Self { Qux } -43 | | } - | |_^ - -error: you are implementing `Clone` explicitly on a `Copy` type - --> $DIR/derive.rs:65:1 - | -65 | / impl<'a> Clone for Lt<'a> { -66 | | fn clone(&self) -> Self { unimplemented!() } -67 | | } - | |_^ - | -note: consider deriving `Clone` or removing `Copy` - --> $DIR/derive.rs:65:1 - | -65 | / impl<'a> Clone for Lt<'a> { -66 | | fn clone(&self) -> Self { unimplemented!() } -67 | | } +51 | / impl Clone for Qux { +52 | | fn clone(&self) -> Self { Qux } +53 | | } | |_^ error: you are implementing `Clone` explicitly on a `Copy` type --> $DIR/derive.rs:75:1 | -75 | / impl Clone for BigArray { +75 | / impl<'a> Clone for Lt<'a> { 76 | | fn clone(&self) -> Self { unimplemented!() } 77 | | } | |_^ @@ -85,7 +69,7 @@ error: you are implementing `Clone` explicitly on a `Copy` type note: consider deriving `Clone` or removing `Copy` --> $DIR/derive.rs:75:1 | -75 | / impl Clone for BigArray { +75 | / impl<'a> Clone for Lt<'a> { 76 | | fn clone(&self) -> Self { unimplemented!() } 77 | | } | |_^ @@ -93,7 +77,7 @@ note: consider deriving `Clone` or removing `Copy` error: you are implementing `Clone` explicitly on a `Copy` type --> $DIR/derive.rs:85:1 | -85 | / impl Clone for FnPtr { +85 | / impl Clone for BigArray { 86 | | fn clone(&self) -> Self { unimplemented!() } 87 | | } | |_^ @@ -101,10 +85,26 @@ error: you are implementing `Clone` explicitly on a `Copy` type note: consider deriving `Clone` or removing `Copy` --> $DIR/derive.rs:85:1 | -85 | / impl Clone for FnPtr { +85 | / impl Clone for BigArray { 86 | | fn clone(&self) -> Self { unimplemented!() } 87 | | } | |_^ +error: you are implementing `Clone` explicitly on a `Copy` type + --> $DIR/derive.rs:95:1 + | +95 | / impl Clone for FnPtr { +96 | | fn clone(&self) -> Self { unimplemented!() } +97 | | } + | |_^ + | +note: consider deriving `Clone` or removing `Copy` + --> $DIR/derive.rs:95:1 + | +95 | / impl Clone for FnPtr { +96 | | fn clone(&self) -> Self { unimplemented!() } +97 | | } + | |_^ + error: aborting due to 7 previous errors diff --git a/tests/ui/diverging_sub_expression.rs b/tests/ui/diverging_sub_expression.rs index a8284dca3..9cf6f22fb 100644 --- a/tests/ui/diverging_sub_expression.rs +++ b/tests/ui/diverging_sub_expression.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(never_type)] diff --git a/tests/ui/diverging_sub_expression.stderr b/tests/ui/diverging_sub_expression.stderr index 8e86a7734..fea2bd1aa 100644 --- a/tests/ui/diverging_sub_expression.stderr +++ b/tests/ui/diverging_sub_expression.stderr @@ -1,39 +1,39 @@ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:20:10 + --> $DIR/diverging_sub_expression.rs:30:10 | -20 | b || diverge(); +30 | b || diverge(); | ^^^^^^^^^ | = note: `-D clippy::diverging-sub-expression` implied by `-D warnings` error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:21:10 + --> $DIR/diverging_sub_expression.rs:31:10 | -21 | b || A.foo(); +31 | b || A.foo(); | ^^^^^^^ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:30:26 + --> $DIR/diverging_sub_expression.rs:40:26 | -30 | 6 => true || return, +40 | 6 => true || return, | ^^^^^^ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:31:26 + --> $DIR/diverging_sub_expression.rs:41:26 | -31 | 7 => true || continue, +41 | 7 => true || continue, | ^^^^^^^^ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:34:26 + --> $DIR/diverging_sub_expression.rs:44:26 | -34 | 3 => true || diverge(), +44 | 3 => true || diverge(), | ^^^^^^^^^ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:39:26 + --> $DIR/diverging_sub_expression.rs:49:26 | -39 | _ => true || break, +49 | _ => true || break, | ^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/dlist.rs b/tests/ui/dlist.rs index 395ff2174..dbbac901b 100644 --- a/tests/ui/dlist.rs +++ b/tests/ui/dlist.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(alloc)] diff --git a/tests/ui/dlist.stderr b/tests/ui/dlist.stderr index 532207520..b3dc6095c 100644 --- a/tests/ui/dlist.stderr +++ b/tests/ui/dlist.stderr @@ -1,48 +1,48 @@ error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:14:16 + --> $DIR/dlist.rs:24:16 | -14 | type Baz = LinkedList; +24 | type Baz = LinkedList; | ^^^^^^^^^^^^^^ | = note: `-D clippy::linkedlist` implied by `-D warnings` = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:15:12 + --> $DIR/dlist.rs:25:12 | -15 | fn foo(LinkedList); +25 | fn foo(LinkedList); | ^^^^^^^^^^^^^^ | = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:16:24 + --> $DIR/dlist.rs:26:24 | -16 | const BAR : Option>; +26 | const BAR : Option>; | ^^^^^^^^^^^^^^ | = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:27:15 + --> $DIR/dlist.rs:37:15 | -27 | fn foo(_: LinkedList) {} +37 | fn foo(_: LinkedList) {} | ^^^^^^^^^^^^^^ | = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:30:39 + --> $DIR/dlist.rs:40:39 | -30 | pub fn test(my_favourite_linked_list: LinkedList) { +40 | pub fn test(my_favourite_linked_list: LinkedList) { | ^^^^^^^^^^^^^^ | = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:34:29 + --> $DIR/dlist.rs:44:29 | -34 | pub fn test_ret() -> Option> { +44 | pub fn test_ret() -> Option> { | ^^^^^^^^^^^^^^ | = help: a VecDeque might work diff --git a/tests/ui/doc.rs b/tests/ui/doc.rs index d48007a93..85e688e0f 100644 --- a/tests/ui/doc.rs +++ b/tests/ui/doc.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] //! This file tests for the DOC_MARKDOWN lint diff --git a/tests/ui/doc.stderr b/tests/ui/doc.stderr index c781f36db..69fa4e32c 100644 --- a/tests/ui/doc.stderr +++ b/tests/ui/doc.stderr @@ -1,183 +1,183 @@ error: you should put `DOC_MARKDOWN` between ticks in the documentation - --> $DIR/doc.rs:3:29 - | -3 | //! This file tests for the DOC_MARKDOWN lint - | ^^^^^^^^^^^^ - | - = note: `-D clippy::doc-markdown` implied by `-D warnings` + --> $DIR/doc.rs:13:29 + | +13 | //! This file tests for the DOC_MARKDOWN lint + | ^^^^^^^^^^^^ + | + = note: `-D clippy::doc-markdown` implied by `-D warnings` error: you should put `foo_bar` between ticks in the documentation - --> $DIR/doc.rs:10:9 + --> $DIR/doc.rs:20:9 | -10 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) +20 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) | ^^^^^^^ error: you should put `foo::bar` between ticks in the documentation - --> $DIR/doc.rs:10:51 + --> $DIR/doc.rs:20:51 | -10 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) +20 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) | ^^^^^^^^ error: you should put `Foo::some_fun` between ticks in the documentation - --> $DIR/doc.rs:11:84 + --> $DIR/doc.rs:21:84 | -11 | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun +21 | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun | ^^^^^^^^^^^^^ error: you should put `a::global:path` between ticks in the documentation - --> $DIR/doc.rs:13:15 + --> $DIR/doc.rs:23:15 | -13 | /// Here be ::a::global:path. +23 | /// Here be ::a::global:path. | ^^^^^^^^^^^^^^ error: you should put `NotInCodeBlock` between ticks in the documentation - --> $DIR/doc.rs:14:22 + --> $DIR/doc.rs:24:22 | -14 | /// That's not code ~NotInCodeBlock~. +24 | /// That's not code ~NotInCodeBlock~. | ^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:15:5 + --> $DIR/doc.rs:25:5 | -15 | /// be_sure_we_got_to_the_end_of_it +25 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:29:5 + --> $DIR/doc.rs:39:5 | -29 | /// be_sure_we_got_to_the_end_of_it +39 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:36:5 + --> $DIR/doc.rs:46:5 | -36 | /// be_sure_we_got_to_the_end_of_it +46 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:50:5 + --> $DIR/doc.rs:60:5 | -50 | /// be_sure_we_got_to_the_end_of_it +60 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `link_with_underscores` between ticks in the documentation - --> $DIR/doc.rs:54:22 + --> $DIR/doc.rs:64:22 | -54 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823. +64 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823. | ^^^^^^^^^^^^^^^^^^^^^ error: you should put `inline_link2` between ticks in the documentation - --> $DIR/doc.rs:57:21 + --> $DIR/doc.rs:67:21 | -57 | /// It can also be [inline_link2]. +67 | /// It can also be [inline_link2]. | ^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:67:5 + --> $DIR/doc.rs:77:5 | -67 | /// be_sure_we_got_to_the_end_of_it +77 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> $DIR/doc.rs:75:8 + --> $DIR/doc.rs:85:8 | -75 | /// ## CamelCaseThing +85 | /// ## CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> $DIR/doc.rs:78:7 + --> $DIR/doc.rs:88:7 | -78 | /// # CamelCaseThing +88 | /// # CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> $DIR/doc.rs:80:22 + --> $DIR/doc.rs:90:22 | -80 | /// Not a title #897 CamelCaseThing +90 | /// Not a title #897 CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:81:5 + --> $DIR/doc.rs:91:5 | -81 | /// be_sure_we_got_to_the_end_of_it +91 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:88:5 + --> $DIR/doc.rs:98:5 | -88 | /// be_sure_we_got_to_the_end_of_it +98 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:101:5 + --> $DIR/doc.rs:111:5 | -101 | /// be_sure_we_got_to_the_end_of_it +111 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `FooBar` between ticks in the documentation - --> $DIR/doc.rs:112:42 + --> $DIR/doc.rs:122:42 | -112 | /** E.g. serialization of an empty list: FooBar +122 | /** E.g. serialization of an empty list: FooBar | ^^^^^^ error: you should put `BarQuz` between ticks in the documentation - --> $DIR/doc.rs:117:5 + --> $DIR/doc.rs:127:5 | -117 | And BarQuz too. +127 | And BarQuz too. | ^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:118:1 + --> $DIR/doc.rs:128:1 | -118 | be_sure_we_got_to_the_end_of_it +128 | be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `FooBar` between ticks in the documentation - --> $DIR/doc.rs:123:42 + --> $DIR/doc.rs:133:42 | -123 | /** E.g. serialization of an empty list: FooBar +133 | /** E.g. serialization of an empty list: FooBar | ^^^^^^ error: you should put `BarQuz` between ticks in the documentation - --> $DIR/doc.rs:128:5 + --> $DIR/doc.rs:138:5 | -128 | And BarQuz too. +138 | And BarQuz too. | ^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:129:1 + --> $DIR/doc.rs:139:1 | -129 | be_sure_we_got_to_the_end_of_it +139 | be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:140:5 + --> $DIR/doc.rs:150:5 | -140 | /// be_sure_we_got_to_the_end_of_it +150 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:167:13 + --> $DIR/doc.rs:177:13 | -167 | /// Not ok: http://www.unicode.org +177 | /// Not ok: http://www.unicode.org | ^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:168:13 + --> $DIR/doc.rs:178:13 | -168 | /// Not ok: https://www.unicode.org +178 | /// Not ok: https://www.unicode.org | ^^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:169:13 + --> $DIR/doc.rs:179:13 | -169 | /// Not ok: http://www.unicode.org/ +179 | /// Not ok: http://www.unicode.org/ | ^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:170:13 + --> $DIR/doc.rs:180:13 | -170 | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels +180 | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 30 previous errors diff --git a/tests/ui/double_comparison.rs b/tests/ui/double_comparison.rs index 2c8f11628..555f35884 100644 --- a/tests/ui/double_comparison.rs +++ b/tests/ui/double_comparison.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { let x = 1; let y = 2; diff --git a/tests/ui/double_comparison.stderr b/tests/ui/double_comparison.stderr index e6a0e9764..646b6f13f 100644 --- a/tests/ui/double_comparison.stderr +++ b/tests/ui/double_comparison.stderr @@ -1,51 +1,51 @@ error: This binary expression can be simplified - --> $DIR/double_comparison.rs:4:8 - | -4 | if x == y || x < y { - | ^^^^^^^^^^^^^^^ help: try: `x <= y` - | - = note: `-D clippy::double-comparisons` implied by `-D warnings` - -error: This binary expression can be simplified - --> $DIR/double_comparison.rs:7:8 - | -7 | if x < y || x == y { - | ^^^^^^^^^^^^^^^ help: try: `x <= y` - -error: This binary expression can be simplified - --> $DIR/double_comparison.rs:10:8 + --> $DIR/double_comparison.rs:14:8 | -10 | if x == y || x > y { +14 | if x == y || x < y { + | ^^^^^^^^^^^^^^^ help: try: `x <= y` + | + = note: `-D clippy::double-comparisons` implied by `-D warnings` + +error: This binary expression can be simplified + --> $DIR/double_comparison.rs:17:8 + | +17 | if x < y || x == y { + | ^^^^^^^^^^^^^^^ help: try: `x <= y` + +error: This binary expression can be simplified + --> $DIR/double_comparison.rs:20:8 + | +20 | if x == y || x > y { | ^^^^^^^^^^^^^^^ help: try: `x >= y` error: This binary expression can be simplified - --> $DIR/double_comparison.rs:13:8 + --> $DIR/double_comparison.rs:23:8 | -13 | if x > y || x == y { +23 | if x > y || x == y { | ^^^^^^^^^^^^^^^ help: try: `x >= y` error: This binary expression can be simplified - --> $DIR/double_comparison.rs:16:8 + --> $DIR/double_comparison.rs:26:8 | -16 | if x < y || x > y { +26 | if x < y || x > y { | ^^^^^^^^^^^^^^ help: try: `x != y` error: This binary expression can be simplified - --> $DIR/double_comparison.rs:19:8 + --> $DIR/double_comparison.rs:29:8 | -19 | if x > y || x < y { +29 | if x > y || x < y { | ^^^^^^^^^^^^^^ help: try: `x != y` error: This binary expression can be simplified - --> $DIR/double_comparison.rs:22:8 + --> $DIR/double_comparison.rs:32:8 | -22 | if x <= y && x >= y { +32 | if x <= y && x >= y { | ^^^^^^^^^^^^^^^^ help: try: `x == y` error: This binary expression can be simplified - --> $DIR/double_comparison.rs:25:8 + --> $DIR/double_comparison.rs:35:8 | -25 | if x >= y && x <= y { +35 | if x >= y && x <= y { | ^^^^^^^^^^^^^^^^ help: try: `x == y` error: aborting due to 8 previous errors diff --git a/tests/ui/double_neg.rs b/tests/ui/double_neg.rs index 0ec13900f..31e7a508f 100644 --- a/tests/ui/double_neg.rs +++ b/tests/ui/double_neg.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/double_neg.stderr b/tests/ui/double_neg.stderr index 02202dbd6..cf0292f7a 100644 --- a/tests/ui/double_neg.stderr +++ b/tests/ui/double_neg.stderr @@ -1,10 +1,10 @@ error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op - --> $DIR/double_neg.rs:9:5 - | -9 | --x; - | ^^^ - | - = note: `-D clippy::double-neg` implied by `-D warnings` + --> $DIR/double_neg.rs:19:5 + | +19 | --x; + | ^^^ + | + = note: `-D clippy::double-neg` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/double_parens.rs b/tests/ui/double_parens.rs index c217972fa..18ff140c3 100644 --- a/tests/ui/double_parens.rs +++ b/tests/ui/double_parens.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/double_parens.stderr b/tests/ui/double_parens.stderr index 3e38db730..727b2c4ef 100644 --- a/tests/ui/double_parens.stderr +++ b/tests/ui/double_parens.stderr @@ -1,39 +1,39 @@ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:16:5 + --> $DIR/double_parens.rs:26:5 | -16 | ((0)) +26 | ((0)) | ^^^^^ | = note: `-D clippy::double-parens` implied by `-D warnings` error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:20:14 + --> $DIR/double_parens.rs:30:14 | -20 | dummy_fn((0)); +30 | dummy_fn((0)); | ^^^ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:24:20 + --> $DIR/double_parens.rs:34:20 | -24 | x.dummy_method((0)); +34 | x.dummy_method((0)); | ^^^ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:28:5 + --> $DIR/double_parens.rs:38:5 | -28 | ((1, 2)) +38 | ((1, 2)) | ^^^^^^^^ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:32:5 + --> $DIR/double_parens.rs:42:5 | -32 | (()) +42 | (()) | ^^^^ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:54:16 + --> $DIR/double_parens.rs:64:16 | -54 | assert_eq!(((1, 2)), (1, 2), "Error"); +64 | assert_eq!(((1, 2)), (1, 2), "Error"); | ^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/drop_forget_copy.rs b/tests/ui/drop_forget_copy.rs index aa70490f8..8b2b96a14 100644 --- a/tests/ui/drop_forget_copy.rs +++ b/tests/ui/drop_forget_copy.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/drop_forget_copy.stderr b/tests/ui/drop_forget_copy.stderr index 043067fe8..ef337ae66 100644 --- a/tests/ui/drop_forget_copy.stderr +++ b/tests/ui/drop_forget_copy.stderr @@ -1,75 +1,75 @@ error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact. - --> $DIR/drop_forget_copy.rs:33:5 + --> $DIR/drop_forget_copy.rs:43:5 | -33 | drop(s1); +43 | drop(s1); | ^^^^^^^^ | = note: `-D clippy::drop-copy` implied by `-D warnings` note: argument has type SomeStruct - --> $DIR/drop_forget_copy.rs:33:10 + --> $DIR/drop_forget_copy.rs:43:10 | -33 | drop(s1); +43 | drop(s1); | ^^ error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact. - --> $DIR/drop_forget_copy.rs:34:5 + --> $DIR/drop_forget_copy.rs:44:5 | -34 | drop(s2); +44 | drop(s2); | ^^^^^^^^ | note: argument has type SomeStruct - --> $DIR/drop_forget_copy.rs:34:10 + --> $DIR/drop_forget_copy.rs:44:10 | -34 | drop(s2); +44 | drop(s2); | ^^ error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact. - --> $DIR/drop_forget_copy.rs:36:5 + --> $DIR/drop_forget_copy.rs:46:5 | -36 | drop(s4); +46 | drop(s4); | ^^^^^^^^ | note: argument has type SomeStruct - --> $DIR/drop_forget_copy.rs:36:10 + --> $DIR/drop_forget_copy.rs:46:10 | -36 | drop(s4); +46 | drop(s4); | ^^ error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact. - --> $DIR/drop_forget_copy.rs:39:5 + --> $DIR/drop_forget_copy.rs:49:5 | -39 | forget(s1); +49 | forget(s1); | ^^^^^^^^^^ | = note: `-D clippy::forget-copy` implied by `-D warnings` note: argument has type SomeStruct - --> $DIR/drop_forget_copy.rs:39:12 + --> $DIR/drop_forget_copy.rs:49:12 | -39 | forget(s1); +49 | forget(s1); | ^^ error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact. - --> $DIR/drop_forget_copy.rs:40:5 + --> $DIR/drop_forget_copy.rs:50:5 | -40 | forget(s2); +50 | forget(s2); | ^^^^^^^^^^ | note: argument has type SomeStruct - --> $DIR/drop_forget_copy.rs:40:12 + --> $DIR/drop_forget_copy.rs:50:12 | -40 | forget(s2); +50 | forget(s2); | ^^ error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact. - --> $DIR/drop_forget_copy.rs:42:5 + --> $DIR/drop_forget_copy.rs:52:5 | -42 | forget(s4); +52 | forget(s4); | ^^^^^^^^^^ | note: argument has type SomeStruct - --> $DIR/drop_forget_copy.rs:42:12 + --> $DIR/drop_forget_copy.rs:52:12 | -42 | forget(s4); +52 | forget(s4); | ^^ error: aborting due to 6 previous errors diff --git a/tests/ui/drop_forget_ref.rs b/tests/ui/drop_forget_ref.rs index bb4781db7..0f36b823e 100644 --- a/tests/ui/drop_forget_ref.rs +++ b/tests/ui/drop_forget_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/drop_forget_ref.stderr b/tests/ui/drop_forget_ref.stderr index 227918f59..15661ef1d 100644 --- a/tests/ui/drop_forget_ref.stderr +++ b/tests/ui/drop_forget_ref.stderr @@ -1,219 +1,219 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> $DIR/drop_forget_ref.rs:12:5 + --> $DIR/drop_forget_ref.rs:22:5 | -12 | drop(&SomeStruct); +22 | drop(&SomeStruct); | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::drop-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> $DIR/drop_forget_ref.rs:12:10 + --> $DIR/drop_forget_ref.rs:22:10 | -12 | drop(&SomeStruct); +22 | drop(&SomeStruct); | ^^^^^^^^^^^ -error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> $DIR/drop_forget_ref.rs:13:5 - | -13 | forget(&SomeStruct); - | ^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::forget-ref` implied by `-D warnings` -note: argument has type &SomeStruct - --> $DIR/drop_forget_ref.rs:13:12 - | -13 | forget(&SomeStruct); - | ^^^^^^^^^^^ - -error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> $DIR/drop_forget_ref.rs:16:5 - | -16 | drop(&owned1); - | ^^^^^^^^^^^^^ - | -note: argument has type &SomeStruct - --> $DIR/drop_forget_ref.rs:16:10 - | -16 | drop(&owned1); - | ^^^^^^^ - -error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> $DIR/drop_forget_ref.rs:17:5 - | -17 | drop(&&owned1); - | ^^^^^^^^^^^^^^ - | -note: argument has type &&SomeStruct - --> $DIR/drop_forget_ref.rs:17:10 - | -17 | drop(&&owned1); - | ^^^^^^^^ - -error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> $DIR/drop_forget_ref.rs:18:5 - | -18 | drop(&mut owned1); - | ^^^^^^^^^^^^^^^^^ - | -note: argument has type &mut SomeStruct - --> $DIR/drop_forget_ref.rs:18:10 - | -18 | drop(&mut owned1); - | ^^^^^^^^^^^ - -error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> $DIR/drop_forget_ref.rs:21:5 - | -21 | forget(&owned2); - | ^^^^^^^^^^^^^^^ - | -note: argument has type &SomeStruct - --> $DIR/drop_forget_ref.rs:21:12 - | -21 | forget(&owned2); - | ^^^^^^^ - -error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> $DIR/drop_forget_ref.rs:22:5 - | -22 | forget(&&owned2); - | ^^^^^^^^^^^^^^^^ - | -note: argument has type &&SomeStruct - --> $DIR/drop_forget_ref.rs:22:12 - | -22 | forget(&&owned2); - | ^^^^^^^^ - error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. --> $DIR/drop_forget_ref.rs:23:5 | -23 | forget(&mut owned2); +23 | forget(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^ | -note: argument has type &mut SomeStruct + = note: `-D clippy::forget-ref` implied by `-D warnings` +note: argument has type &SomeStruct --> $DIR/drop_forget_ref.rs:23:12 | -23 | forget(&mut owned2); +23 | forget(&SomeStruct); | ^^^^^^^^^^^ +error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. + --> $DIR/drop_forget_ref.rs:26:5 + | +26 | drop(&owned1); + | ^^^^^^^^^^^^^ + | +note: argument has type &SomeStruct + --> $DIR/drop_forget_ref.rs:26:10 + | +26 | drop(&owned1); + | ^^^^^^^ + error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. --> $DIR/drop_forget_ref.rs:27:5 | -27 | drop(reference1); - | ^^^^^^^^^^^^^^^^ +27 | drop(&&owned1); + | ^^^^^^^^^^^^^^ | -note: argument has type &SomeStruct +note: argument has type &&SomeStruct --> $DIR/drop_forget_ref.rs:27:10 | -27 | drop(reference1); - | ^^^^^^^^^^ - -error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> $DIR/drop_forget_ref.rs:28:5 - | -28 | forget(&*reference1); - | ^^^^^^^^^^^^^^^^^^^^ - | -note: argument has type &SomeStruct - --> $DIR/drop_forget_ref.rs:28:12 - | -28 | forget(&*reference1); - | ^^^^^^^^^^^^ +27 | drop(&&owned1); + | ^^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> $DIR/drop_forget_ref.rs:31:5 + --> $DIR/drop_forget_ref.rs:28:5 | -31 | drop(reference2); - | ^^^^^^^^^^^^^^^^ +28 | drop(&mut owned1); + | ^^^^^^^^^^^^^^^^^ | note: argument has type &mut SomeStruct - --> $DIR/drop_forget_ref.rs:31:10 + --> $DIR/drop_forget_ref.rs:28:10 | -31 | drop(reference2); - | ^^^^^^^^^^ +28 | drop(&mut owned1); + | ^^^^^^^^^^^ + +error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. + --> $DIR/drop_forget_ref.rs:31:5 + | +31 | forget(&owned2); + | ^^^^^^^^^^^^^^^ + | +note: argument has type &SomeStruct + --> $DIR/drop_forget_ref.rs:31:12 + | +31 | forget(&owned2); + | ^^^^^^^ + +error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. + --> $DIR/drop_forget_ref.rs:32:5 + | +32 | forget(&&owned2); + | ^^^^^^^^^^^^^^^^ + | +note: argument has type &&SomeStruct + --> $DIR/drop_forget_ref.rs:32:12 + | +32 | forget(&&owned2); + | ^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. --> $DIR/drop_forget_ref.rs:33:5 | -33 | forget(reference3); - | ^^^^^^^^^^^^^^^^^^ +33 | forget(&mut owned2); + | ^^^^^^^^^^^^^^^^^^^ | note: argument has type &mut SomeStruct --> $DIR/drop_forget_ref.rs:33:12 | -33 | forget(reference3); - | ^^^^^^^^^^ +33 | forget(&mut owned2); + | ^^^^^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> $DIR/drop_forget_ref.rs:36:5 + --> $DIR/drop_forget_ref.rs:37:5 | -36 | drop(reference4); +37 | drop(reference1); | ^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> $DIR/drop_forget_ref.rs:36:10 + --> $DIR/drop_forget_ref.rs:37:10 | -36 | drop(reference4); +37 | drop(reference1); | ^^^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> $DIR/drop_forget_ref.rs:37:5 + --> $DIR/drop_forget_ref.rs:38:5 | -37 | forget(reference4); - | ^^^^^^^^^^^^^^^^^^ +38 | forget(&*reference1); + | ^^^^^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> $DIR/drop_forget_ref.rs:37:12 + --> $DIR/drop_forget_ref.rs:38:12 | -37 | forget(reference4); +38 | forget(&*reference1); + | ^^^^^^^^^^^^ + +error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. + --> $DIR/drop_forget_ref.rs:41:5 + | +41 | drop(reference2); + | ^^^^^^^^^^^^^^^^ + | +note: argument has type &mut SomeStruct + --> $DIR/drop_forget_ref.rs:41:10 + | +41 | drop(reference2); + | ^^^^^^^^^^ + +error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. + --> $DIR/drop_forget_ref.rs:43:5 + | +43 | forget(reference3); + | ^^^^^^^^^^^^^^^^^^ + | +note: argument has type &mut SomeStruct + --> $DIR/drop_forget_ref.rs:43:12 + | +43 | forget(reference3); | ^^^^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> $DIR/drop_forget_ref.rs:42:5 + --> $DIR/drop_forget_ref.rs:46:5 | -42 | drop(&val); +46 | drop(reference4); + | ^^^^^^^^^^^^^^^^ + | +note: argument has type &SomeStruct + --> $DIR/drop_forget_ref.rs:46:10 + | +46 | drop(reference4); + | ^^^^^^^^^^ + +error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. + --> $DIR/drop_forget_ref.rs:47:5 + | +47 | forget(reference4); + | ^^^^^^^^^^^^^^^^^^ + | +note: argument has type &SomeStruct + --> $DIR/drop_forget_ref.rs:47:12 + | +47 | forget(reference4); + | ^^^^^^^^^^ + +error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. + --> $DIR/drop_forget_ref.rs:52:5 + | +52 | drop(&val); | ^^^^^^^^^^ | note: argument has type &T - --> $DIR/drop_forget_ref.rs:42:10 + --> $DIR/drop_forget_ref.rs:52:10 | -42 | drop(&val); +52 | drop(&val); | ^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> $DIR/drop_forget_ref.rs:48:5 + --> $DIR/drop_forget_ref.rs:58:5 | -48 | forget(&val); +58 | forget(&val); | ^^^^^^^^^^^^ | note: argument has type &T - --> $DIR/drop_forget_ref.rs:48:12 + --> $DIR/drop_forget_ref.rs:58:12 | -48 | forget(&val); +58 | forget(&val); | ^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> $DIR/drop_forget_ref.rs:56:5 + --> $DIR/drop_forget_ref.rs:66:5 | -56 | std::mem::drop(&SomeStruct); +66 | std::mem::drop(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> $DIR/drop_forget_ref.rs:56:20 + --> $DIR/drop_forget_ref.rs:66:20 | -56 | std::mem::drop(&SomeStruct); +66 | std::mem::drop(&SomeStruct); | ^^^^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> $DIR/drop_forget_ref.rs:59:5 + --> $DIR/drop_forget_ref.rs:69:5 | -59 | std::mem::forget(&SomeStruct); +69 | std::mem::forget(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: argument has type &SomeStruct - --> $DIR/drop_forget_ref.rs:59:22 + --> $DIR/drop_forget_ref.rs:69:22 | -59 | std::mem::forget(&SomeStruct); +69 | std::mem::forget(&SomeStruct); | ^^^^^^^^^^^ error: aborting due to 18 previous errors diff --git a/tests/ui/duplicate_underscore_argument.rs b/tests/ui/duplicate_underscore_argument.rs index e54920c1b..25b2a0ba8 100644 --- a/tests/ui/duplicate_underscore_argument.rs +++ b/tests/ui/duplicate_underscore_argument.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/duplicate_underscore_argument.stderr b/tests/ui/duplicate_underscore_argument.stderr index 707145346..87b5c5e19 100644 --- a/tests/ui/duplicate_underscore_argument.stderr +++ b/tests/ui/duplicate_underscore_argument.stderr @@ -1,10 +1,10 @@ error: `darth` already exists, having another argument having almost the same name makes code comprehension and documentation more difficult - --> $DIR/duplicate_underscore_argument.rs:7:23 - | -7 | fn join_the_dark_side(darth: i32, _darth: i32) {} - | ^^^^^ - | - = note: `-D clippy::duplicate-underscore-argument` implied by `-D warnings` + --> $DIR/duplicate_underscore_argument.rs:17:23 + | +17 | fn join_the_dark_side(darth: i32, _darth: i32) {} + | ^^^^^ + | + = note: `-D clippy::duplicate-underscore-argument` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/duration_subsec.rs b/tests/ui/duration_subsec.rs index d732a0228..75352ad18 100644 --- a/tests/ui/duration_subsec.rs +++ b/tests/ui/duration_subsec.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::duration_subsec)] diff --git a/tests/ui/duration_subsec.stderr b/tests/ui/duration_subsec.stderr index c23b041a8..854af9dcb 100644 --- a/tests/ui/duration_subsec.stderr +++ b/tests/ui/duration_subsec.stderr @@ -1,33 +1,33 @@ error: Calling `subsec_millis()` is more concise than this calculation - --> $DIR/duration_subsec.rs:10:24 + --> $DIR/duration_subsec.rs:20:24 | -10 | let bad_millis_1 = dur.subsec_micros() / 1_000; +20 | let bad_millis_1 = dur.subsec_micros() / 1_000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()` | = note: `-D clippy::duration-subsec` implied by `-D warnings` error: Calling `subsec_millis()` is more concise than this calculation - --> $DIR/duration_subsec.rs:11:24 + --> $DIR/duration_subsec.rs:21:24 | -11 | let bad_millis_2 = dur.subsec_nanos() / 1_000_000; +21 | let bad_millis_2 = dur.subsec_nanos() / 1_000_000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()` error: Calling `subsec_micros()` is more concise than this calculation - --> $DIR/duration_subsec.rs:16:22 + --> $DIR/duration_subsec.rs:26:22 | -16 | let bad_micros = dur.subsec_nanos() / 1_000; +26 | let bad_micros = dur.subsec_nanos() / 1_000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()` error: Calling `subsec_micros()` is more concise than this calculation - --> $DIR/duration_subsec.rs:21:13 + --> $DIR/duration_subsec.rs:31:13 | -21 | let _ = (&dur).subsec_nanos() / 1_000; +31 | let _ = (&dur).subsec_nanos() / 1_000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&dur).subsec_micros()` error: Calling `subsec_micros()` is more concise than this calculation - --> $DIR/duration_subsec.rs:25:13 + --> $DIR/duration_subsec.rs:35:13 | -25 | let _ = dur.subsec_nanos() / NANOS_IN_MICRO; +35 | let _ = dur.subsec_nanos() / NANOS_IN_MICRO; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()` error: aborting due to 5 previous errors diff --git a/tests/ui/else_if_without_else.rs b/tests/ui/else_if_without_else.rs index 3776aecf5..56987d0d6 100644 --- a/tests/ui/else_if_without_else.rs +++ b/tests/ui/else_if_without_else.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all)] diff --git a/tests/ui/else_if_without_else.stderr b/tests/ui/else_if_without_else.stderr index a352546ce..9eddd4ab3 100644 --- a/tests/ui/else_if_without_else.stderr +++ b/tests/ui/else_if_without_else.stderr @@ -1,21 +1,21 @@ error: if expression with an `else if`, but without a final `else` - --> $DIR/else_if_without_else.rs:41:12 + --> $DIR/else_if_without_else.rs:51:12 | -41 | } else if bla2() { //~ ERROR else if without else +51 | } else if bla2() { //~ ERROR else if without else | ____________^ -42 | | println!("else if"); -43 | | } +52 | | println!("else if"); +53 | | } | |_____^ help: add an `else` block here | = note: `-D clippy::else-if-without-else` implied by `-D warnings` error: if expression with an `else if`, but without a final `else` - --> $DIR/else_if_without_else.rs:49:12 + --> $DIR/else_if_without_else.rs:59:12 | -49 | } else if bla3() { //~ ERROR else if without else +59 | } else if bla3() { //~ ERROR else if without else | ____________^ -50 | | println!("else if 2"); -51 | | } +60 | | println!("else if 2"); +61 | | } | |_____^ help: add an `else` block here error: aborting due to 2 previous errors diff --git a/tests/ui/empty_enum.rs b/tests/ui/empty_enum.rs index 3398b71ee..cd63acb9e 100644 --- a/tests/ui/empty_enum.rs +++ b/tests/ui/empty_enum.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/empty_enum.stderr b/tests/ui/empty_enum.stderr index f198793fe..9d6691c97 100644 --- a/tests/ui/empty_enum.stderr +++ b/tests/ui/empty_enum.stderr @@ -1,15 +1,15 @@ error: enum with no variants - --> $DIR/empty_enum.rs:7:1 - | -7 | enum Empty {} - | ^^^^^^^^^^^^^ - | - = note: `-D clippy::empty-enum` implied by `-D warnings` + --> $DIR/empty_enum.rs:17:1 + | +17 | enum Empty {} + | ^^^^^^^^^^^^^ + | + = note: `-D clippy::empty-enum` implied by `-D warnings` help: consider using the uninhabited type `!` or a wrapper around it - --> $DIR/empty_enum.rs:7:1 - | -7 | enum Empty {} - | ^^^^^^^^^^^^^ + --> $DIR/empty_enum.rs:17:1 + | +17 | enum Empty {} + | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/empty_line_after_outer_attribute.rs b/tests/ui/empty_line_after_outer_attribute.rs index c46a0496a..8aa2e8a1f 100644 --- a/tests/ui/empty_line_after_outer_attribute.rs +++ b/tests/ui/empty_line_after_outer_attribute.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::empty_line_after_outer_attr)] diff --git a/tests/ui/empty_line_after_outer_attribute.stderr b/tests/ui/empty_line_after_outer_attribute.stderr index 7bcec54a6..e742c0b66 100644 --- a/tests/ui/empty_line_after_outer_attribute.stderr +++ b/tests/ui/empty_line_after_outer_attribute.stderr @@ -1,53 +1,53 @@ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:5:1 - | -5 | / #[crate_type = "lib"] -6 | | -7 | | /// some comment -8 | | fn with_one_newline_and_comment() { assert!(true) } - | |_ - | - = note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings` + --> $DIR/empty_line_after_outer_attribute.rs:15:1 + | +15 | / #[crate_type = "lib"] +16 | | +17 | | /// some comment +18 | | fn with_one_newline_and_comment() { assert!(true) } + | |_ + | + = note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings` error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:17:1 + --> $DIR/empty_line_after_outer_attribute.rs:27:1 | -17 | / #[crate_type = "lib"] -18 | | -19 | | fn with_one_newline() { assert!(true) } +27 | / #[crate_type = "lib"] +28 | | +29 | | fn with_one_newline() { assert!(true) } | |_ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:22:1 + --> $DIR/empty_line_after_outer_attribute.rs:32:1 | -22 | / #[crate_type = "lib"] -23 | | -24 | | -25 | | fn with_two_newlines() { assert!(true) } +32 | / #[crate_type = "lib"] +33 | | +34 | | +35 | | fn with_two_newlines() { assert!(true) } | |_ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:29:1 + --> $DIR/empty_line_after_outer_attribute.rs:39:1 | -29 | / #[crate_type = "lib"] -30 | | -31 | | enum Baz { +39 | / #[crate_type = "lib"] +40 | | +41 | | enum Baz { | |_ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:37:1 + --> $DIR/empty_line_after_outer_attribute.rs:47:1 | -37 | / #[crate_type = "lib"] -38 | | -39 | | struct Foo { +47 | / #[crate_type = "lib"] +48 | | +49 | | struct Foo { | |_ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:45:1 + --> $DIR/empty_line_after_outer_attribute.rs:55:1 | -45 | / #[crate_type = "lib"] -46 | | -47 | | mod foo { +55 | / #[crate_type = "lib"] +56 | | +57 | | mod foo { | |_ error: aborting due to 6 previous errors diff --git a/tests/ui/entry.rs b/tests/ui/entry.rs index 955b0a6e9..0bab6bf33 100644 --- a/tests/ui/entry.rs +++ b/tests/ui/entry.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused, clippy::needless_pass_by_value)] diff --git a/tests/ui/entry.stderr b/tests/ui/entry.stderr index cffe8b232..60e5ae893 100644 --- a/tests/ui/entry.stderr +++ b/tests/ui/entry.stderr @@ -1,45 +1,45 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` - --> $DIR/entry.rs:13:5 + --> $DIR/entry.rs:23:5 | -13 | if !m.contains_key(&k) { m.insert(k, v); } +23 | if !m.contains_key(&k) { m.insert(k, v); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k).or_insert(v)` | = note: `-D clippy::map-entry` implied by `-D warnings` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> $DIR/entry.rs:17:5 + --> $DIR/entry.rs:27:5 | -17 | if !m.contains_key(&k) { foo(); m.insert(k, v); } +27 | if !m.contains_key(&k) { foo(); m.insert(k, v); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> $DIR/entry.rs:21:5 + --> $DIR/entry.rs:31:5 | -21 | if !m.contains_key(&k) { m.insert(k, v) } else { None }; +31 | if !m.contains_key(&k) { m.insert(k, v) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> $DIR/entry.rs:25:5 + --> $DIR/entry.rs:35:5 | -25 | if m.contains_key(&k) { None } else { m.insert(k, v) }; +35 | if m.contains_key(&k) { None } else { m.insert(k, v) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> $DIR/entry.rs:29:5 + --> $DIR/entry.rs:39:5 | -29 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; +39 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> $DIR/entry.rs:33:5 + --> $DIR/entry.rs:43:5 | -33 | if m.contains_key(&k) { None } else { foo(); m.insert(k, v) }; +43 | if m.contains_key(&k) { None } else { foo(); m.insert(k, v) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `BTreeMap` - --> $DIR/entry.rs:37:5 + --> $DIR/entry.rs:47:5 | -37 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; +47 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: aborting due to 7 previous errors diff --git a/tests/ui/enum_glob_use.rs b/tests/ui/enum_glob_use.rs index 47082f8f3..e24e2fd8e 100644 --- a/tests/ui/enum_glob_use.rs +++ b/tests/ui/enum_glob_use.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all, clippy::pedantic)] diff --git a/tests/ui/enum_glob_use.stderr b/tests/ui/enum_glob_use.stderr index bb1d19e41..2dac4a2b1 100644 --- a/tests/ui/enum_glob_use.stderr +++ b/tests/ui/enum_glob_use.stderr @@ -1,15 +1,15 @@ error: don't use glob imports for enum variants - --> $DIR/enum_glob_use.rs:6:1 - | -6 | use std::cmp::Ordering::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::enum-glob-use` implied by `-D warnings` + --> $DIR/enum_glob_use.rs:16:1 + | +16 | use std::cmp::Ordering::*; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::enum-glob-use` implied by `-D warnings` error: don't use glob imports for enum variants - --> $DIR/enum_glob_use.rs:12:1 + --> $DIR/enum_glob_use.rs:22:1 | -12 | use self::Enum::*; +22 | use self::Enum::*; | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/enum_variants.rs b/tests/ui/enum_variants.rs index 4ddb7207a..8a51e2f58 100644 --- a/tests/ui/enum_variants.rs +++ b/tests/ui/enum_variants.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(non_ascii_idents)] diff --git a/tests/ui/enum_variants.stderr b/tests/ui/enum_variants.stderr index bd083e7e0..7b63fab3a 100644 --- a/tests/ui/enum_variants.stderr +++ b/tests/ui/enum_variants.stderr @@ -1,101 +1,101 @@ error: Variant name ends with the enum's name - --> $DIR/enum_variants.rs:16:5 + --> $DIR/enum_variants.rs:26:5 | -16 | cFoo, +26 | cFoo, | ^^^^ | = note: `-D clippy::enum-variant-names` implied by `-D warnings` error: Variant name starts with the enum's name - --> $DIR/enum_variants.rs:27:5 + --> $DIR/enum_variants.rs:37:5 | -27 | FoodGood, +37 | FoodGood, | ^^^^^^^^ error: Variant name starts with the enum's name - --> $DIR/enum_variants.rs:28:5 + --> $DIR/enum_variants.rs:38:5 | -28 | FoodMiddle, +38 | FoodMiddle, | ^^^^^^^^^^ error: Variant name starts with the enum's name - --> $DIR/enum_variants.rs:29:5 + --> $DIR/enum_variants.rs:39:5 | -29 | FoodBad, +39 | FoodBad, | ^^^^^^^ error: All variants have the same prefix: `Food` - --> $DIR/enum_variants.rs:26:1 - | -26 | / enum Food { -27 | | FoodGood, -28 | | FoodMiddle, -29 | | FoodBad, -30 | | } - | |_^ - | - = help: remove the prefixes and use full paths to the variants instead of glob imports - -error: All variants have the same prefix: `CallType` --> $DIR/enum_variants.rs:36:1 | -36 | / enum BadCallType { -37 | | CallTypeCall, -38 | | CallTypeCreate, -39 | | CallTypeDestroy, +36 | / enum Food { +37 | | FoodGood, +38 | | FoodMiddle, +39 | | FoodBad, 40 | | } | |_^ | = help: remove the prefixes and use full paths to the variants instead of glob imports -error: All variants have the same prefix: `Constant` - --> $DIR/enum_variants.rs:47:1 +error: All variants have the same prefix: `CallType` + --> $DIR/enum_variants.rs:46:1 | -47 | / enum Consts { -48 | | ConstantInt, -49 | | ConstantCake, -50 | | ConstantLie, -51 | | } +46 | / enum BadCallType { +47 | | CallTypeCall, +48 | | CallTypeCreate, +49 | | CallTypeDestroy, +50 | | } + | |_^ + | + = help: remove the prefixes and use full paths to the variants instead of glob imports + +error: All variants have the same prefix: `Constant` + --> $DIR/enum_variants.rs:57:1 + | +57 | / enum Consts { +58 | | ConstantInt, +59 | | ConstantCake, +60 | | ConstantLie, +61 | | } | |_^ | = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `With` - --> $DIR/enum_variants.rs:80:1 + --> $DIR/enum_variants.rs:90:1 | -80 | / enum Seallll { -81 | | WithOutCake, -82 | | WithOutTea, -83 | | WithOut, -84 | | } +90 | / enum Seallll { +91 | | WithOutCake, +92 | | WithOutTea, +93 | | WithOut, +94 | | } | |_^ | = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `Prefix` - --> $DIR/enum_variants.rs:86:1 - | -86 | / enum NonCaps { -87 | | Prefix的, -88 | | PrefixTea, -89 | | PrefixCake, -90 | | } - | |_^ - | - = help: remove the prefixes and use full paths to the variants instead of glob imports + --> $DIR/enum_variants.rs:96:1 + | +96 | / enum NonCaps { +97 | | Prefix的, +98 | | PrefixTea, +99 | | PrefixCake, +100 | | } + | |_^ + | + = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `With` - --> $DIR/enum_variants.rs:92:1 - | -92 | / pub enum PubSeall { -93 | | WithOutCake, -94 | | WithOutTea, -95 | | WithOut, -96 | | } - | |_^ - | - = note: `-D clippy::pub-enum-variant-names` implied by `-D warnings` - = help: remove the prefixes and use full paths to the variants instead of glob imports + --> $DIR/enum_variants.rs:102:1 + | +102 | / pub enum PubSeall { +103 | | WithOutCake, +104 | | WithOutTea, +105 | | WithOut, +106 | | } + | |_^ + | + = note: `-D clippy::pub-enum-variant-names` implied by `-D warnings` + = help: remove the prefixes and use full paths to the variants instead of glob imports error: aborting due to 10 previous errors diff --git a/tests/ui/enums_clike.rs b/tests/ui/enums_clike.rs index 8212f12b3..179832550 100644 --- a/tests/ui/enums_clike.rs +++ b/tests/ui/enums_clike.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] // ignore-x86 diff --git a/tests/ui/enums_clike.stderr b/tests/ui/enums_clike.stderr index cccf4ed03..27b184ea3 100644 --- a/tests/ui/enums_clike.stderr +++ b/tests/ui/enums_clike.stderr @@ -1,51 +1,51 @@ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:12:5 + --> $DIR/enums_clike.rs:22:5 | -12 | X = 0x1_0000_0000, +22 | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::enum-clike-unportable-variant` implied by `-D warnings` -error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:19:5 - | -19 | X = 0x1_0000_0000, - | ^^^^^^^^^^^^^^^^^ - -error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:22:5 - | -22 | A = 0xFFFF_FFFF, - | ^^^^^^^^^^^^^^^ - error: Clike enum variant discriminant is not portable to 32-bit targets --> $DIR/enums_clike.rs:29:5 | -29 | Z = 0xFFFF_FFFF, - | ^^^^^^^^^^^^^^^ - -error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:30:5 - | -30 | A = 0x1_0000_0000, +29 | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets --> $DIR/enums_clike.rs:32:5 | -32 | C = (std::i32::MIN as isize) - 1, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:38:5 - | -38 | Z = 0xFFFF_FFFF, +32 | A = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets --> $DIR/enums_clike.rs:39:5 | -39 | A = 0x1_0000_0000, +39 | Z = 0xFFFF_FFFF, + | ^^^^^^^^^^^^^^^ + +error: Clike enum variant discriminant is not portable to 32-bit targets + --> $DIR/enums_clike.rs:40:5 + | +40 | A = 0x1_0000_0000, + | ^^^^^^^^^^^^^^^^^ + +error: Clike enum variant discriminant is not portable to 32-bit targets + --> $DIR/enums_clike.rs:42:5 + | +42 | C = (std::i32::MIN as isize) - 1, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: Clike enum variant discriminant is not portable to 32-bit targets + --> $DIR/enums_clike.rs:48:5 + | +48 | Z = 0xFFFF_FFFF, + | ^^^^^^^^^^^^^^^ + +error: Clike enum variant discriminant is not portable to 32-bit targets + --> $DIR/enums_clike.rs:49:5 + | +49 | A = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/tests/ui/eq_op.rs b/tests/ui/eq_op.rs index a88866436..c96cd8b9a 100644 --- a/tests/ui/eq_op.rs +++ b/tests/ui/eq_op.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/eq_op.stderr b/tests/ui/eq_op.stderr index ad0c8d8ec..21487884d 100644 --- a/tests/ui/eq_op.stderr +++ b/tests/ui/eq_op.stderr @@ -1,203 +1,203 @@ error: this boolean expression can be simplified - --> $DIR/eq_op.rs:37:5 + --> $DIR/eq_op.rs:47:5 | -37 | true && true; +47 | true && true; | ^^^^^^^^^^^^ help: try: `true` | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> $DIR/eq_op.rs:39:5 + --> $DIR/eq_op.rs:49:5 | -39 | true || true; +49 | true || true; | ^^^^^^^^^^^^ help: try: `true` error: this boolean expression can be simplified - --> $DIR/eq_op.rs:45:5 + --> $DIR/eq_op.rs:55:5 | -45 | a == b && b == a; +55 | a == b && b == a; | ^^^^^^^^^^^^^^^^ help: try: `a == b` error: this boolean expression can be simplified - --> $DIR/eq_op.rs:46:5 + --> $DIR/eq_op.rs:56:5 | -46 | a != b && b != a; +56 | a != b && b != a; | ^^^^^^^^^^^^^^^^ help: try: `a != b` error: this boolean expression can be simplified - --> $DIR/eq_op.rs:47:5 + --> $DIR/eq_op.rs:57:5 | -47 | a < b && b > a; +57 | a < b && b > a; | ^^^^^^^^^^^^^^ help: try: `a < b` error: this boolean expression can be simplified - --> $DIR/eq_op.rs:48:5 + --> $DIR/eq_op.rs:58:5 | -48 | a <= b && b >= a; +58 | a <= b && b >= a; | ^^^^^^^^^^^^^^^^ help: try: `a <= b` error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:10:5 + --> $DIR/eq_op.rs:20:5 | -10 | 1 == 1; +20 | 1 == 1; | ^^^^^^ | = note: `-D clippy::eq-op` implied by `-D warnings` error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:11:5 + --> $DIR/eq_op.rs:21:5 | -11 | "no" == "no"; +21 | "no" == "no"; | ^^^^^^^^^^^^ error: equal expressions as operands to `!=` - --> $DIR/eq_op.rs:13:5 + --> $DIR/eq_op.rs:23:5 | -13 | false != false; +23 | false != false; | ^^^^^^^^^^^^^^ error: equal expressions as operands to `<` - --> $DIR/eq_op.rs:14:5 + --> $DIR/eq_op.rs:24:5 | -14 | 1.5 < 1.5; +24 | 1.5 < 1.5; | ^^^^^^^^^ error: equal expressions as operands to `>=` - --> $DIR/eq_op.rs:15:5 + --> $DIR/eq_op.rs:25:5 | -15 | 1u64 >= 1u64; +25 | 1u64 >= 1u64; | ^^^^^^^^^^^^ error: equal expressions as operands to `&` - --> $DIR/eq_op.rs:18:5 + --> $DIR/eq_op.rs:28:5 | -18 | (1 as u64) & (1 as u64); +28 | (1 as u64) & (1 as u64); | ^^^^^^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `^` - --> $DIR/eq_op.rs:19:5 + --> $DIR/eq_op.rs:29:5 | -19 | 1 ^ ((((((1)))))); +29 | 1 ^ ((((((1)))))); | ^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `<` - --> $DIR/eq_op.rs:22:5 + --> $DIR/eq_op.rs:32:5 | -22 | (-(2) < -(2)); +32 | (-(2) < -(2)); | ^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:23:5 + --> $DIR/eq_op.rs:33:5 | -23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); +33 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `&` - --> $DIR/eq_op.rs:23:6 + --> $DIR/eq_op.rs:33:6 | -23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); +33 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `&` - --> $DIR/eq_op.rs:23:27 + --> $DIR/eq_op.rs:33:27 | -23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); +33 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:24:5 + --> $DIR/eq_op.rs:34:5 | -24 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4; +34 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `!=` - --> $DIR/eq_op.rs:27:5 + --> $DIR/eq_op.rs:37:5 | -27 | ([1] != [1]); +37 | ([1] != [1]); | ^^^^^^^^^^^^ error: equal expressions as operands to `!=` - --> $DIR/eq_op.rs:28:5 + --> $DIR/eq_op.rs:38:5 | -28 | ((1, 2) != (1, 2)); +38 | ((1, 2) != (1, 2)); | ^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:32:5 + --> $DIR/eq_op.rs:42:5 | -32 | 1 + 1 == 2; +42 | 1 + 1 == 2; | ^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:33:5 + --> $DIR/eq_op.rs:43:5 | -33 | 1 - 1 == 0; +43 | 1 - 1 == 0; | ^^^^^^^^^^ error: equal expressions as operands to `-` - --> $DIR/eq_op.rs:33:5 + --> $DIR/eq_op.rs:43:5 | -33 | 1 - 1 == 0; +43 | 1 - 1 == 0; | ^^^^^ error: equal expressions as operands to `-` - --> $DIR/eq_op.rs:35:5 + --> $DIR/eq_op.rs:45:5 | -35 | 1 - 1; +45 | 1 - 1; | ^^^^^ error: equal expressions as operands to `/` - --> $DIR/eq_op.rs:36:5 - | -36 | 1 / 1; - | ^^^^^ - -error: equal expressions as operands to `&&` - --> $DIR/eq_op.rs:37:5 - | -37 | true && true; - | ^^^^^^^^^^^^ - -error: equal expressions as operands to `||` - --> $DIR/eq_op.rs:39:5 - | -39 | true || true; - | ^^^^^^^^^^^^ - -error: equal expressions as operands to `&&` - --> $DIR/eq_op.rs:45:5 - | -45 | a == b && b == a; - | ^^^^^^^^^^^^^^^^ - -error: equal expressions as operands to `&&` --> $DIR/eq_op.rs:46:5 | -46 | a != b && b != a; - | ^^^^^^^^^^^^^^^^ +46 | 1 / 1; + | ^^^^^ error: equal expressions as operands to `&&` --> $DIR/eq_op.rs:47:5 | -47 | a < b && b > a; +47 | true && true; + | ^^^^^^^^^^^^ + +error: equal expressions as operands to `||` + --> $DIR/eq_op.rs:49:5 + | +49 | true || true; + | ^^^^^^^^^^^^ + +error: equal expressions as operands to `&&` + --> $DIR/eq_op.rs:55:5 + | +55 | a == b && b == a; + | ^^^^^^^^^^^^^^^^ + +error: equal expressions as operands to `&&` + --> $DIR/eq_op.rs:56:5 + | +56 | a != b && b != a; + | ^^^^^^^^^^^^^^^^ + +error: equal expressions as operands to `&&` + --> $DIR/eq_op.rs:57:5 + | +57 | a < b && b > a; | ^^^^^^^^^^^^^^ error: equal expressions as operands to `&&` - --> $DIR/eq_op.rs:48:5 + --> $DIR/eq_op.rs:58:5 | -48 | a <= b && b >= a; +58 | a <= b && b >= a; | ^^^^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:51:5 + --> $DIR/eq_op.rs:61:5 | -51 | a == a; +61 | a == a; | ^^^^^^ error: taken reference of right operand - --> $DIR/eq_op.rs:89:13 + --> $DIR/eq_op.rs:99:13 | -89 | let z = x & &y; +99 | let z = x & &y; | ^^^^-- | | | help: use the right value directly: `y` @@ -205,10 +205,10 @@ error: taken reference of right operand = note: `-D clippy::op-ref` implied by `-D warnings` error: equal expressions as operands to `/` - --> $DIR/eq_op.rs:97:20 - | -97 | const D: u32 = A / A; - | ^^^^^ + --> $DIR/eq_op.rs:107:20 + | +107 | const D: u32 = A / A; + | ^^^^^ error: aborting due to 34 previous errors diff --git a/tests/ui/erasing_op.rs b/tests/ui/erasing_op.rs index 02745ac5d..1c572b555 100644 --- a/tests/ui/erasing_op.rs +++ b/tests/ui/erasing_op.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/erasing_op.stderr b/tests/ui/erasing_op.stderr index 18486ab47..2cc3db7c2 100644 --- a/tests/ui/erasing_op.stderr +++ b/tests/ui/erasing_op.stderr @@ -1,21 +1,21 @@ error: this operation will always return zero. This is likely not the intended outcome - --> $DIR/erasing_op.rs:9:5 - | -9 | x * 0; - | ^^^^^ - | - = note: `-D clippy::erasing-op` implied by `-D warnings` + --> $DIR/erasing_op.rs:19:5 + | +19 | x * 0; + | ^^^^^ + | + = note: `-D clippy::erasing-op` implied by `-D warnings` error: this operation will always return zero. This is likely not the intended outcome - --> $DIR/erasing_op.rs:10:5 + --> $DIR/erasing_op.rs:20:5 | -10 | 0 & x; +20 | 0 & x; | ^^^^^ error: this operation will always return zero. This is likely not the intended outcome - --> $DIR/erasing_op.rs:11:5 + --> $DIR/erasing_op.rs:21:5 | -11 | 0 / x; +21 | 0 / x; | ^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/escape_analysis.rs b/tests/ui/escape_analysis.rs index 7a888f019..1f2f46b03 100644 --- a/tests/ui/escape_analysis.rs +++ b/tests/ui/escape_analysis.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(box_syntax)] #![allow(warnings, clippy)] diff --git a/tests/ui/eta.rs b/tests/ui/eta.rs index 4dd46f20e..a580ce083 100644 --- a/tests/ui/eta.rs +++ b/tests/ui/eta.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unknown_lints, unused, clippy::no_effect, clippy::redundant_closure_call, clippy::many_single_char_names, clippy::needless_pass_by_value, clippy::option_map_unit_fn, clippy::trivially_copy_pass_by_ref)] diff --git a/tests/ui/eta.stderr b/tests/ui/eta.stderr index 89543d6af..dcdf0699f 100644 --- a/tests/ui/eta.stderr +++ b/tests/ui/eta.stderr @@ -1,35 +1,35 @@ error: redundant closure found - --> $DIR/eta.rs:7:27 - | -7 | let a = Some(1u8).map(|a| foo(a)); - | ^^^^^^^^^^ help: remove closure as shown: `foo` - | - = note: `-D clippy::redundant-closure` implied by `-D warnings` + --> $DIR/eta.rs:17:27 + | +17 | let a = Some(1u8).map(|a| foo(a)); + | ^^^^^^^^^^ help: remove closure as shown: `foo` + | + = note: `-D clippy::redundant-closure` implied by `-D warnings` error: redundant closure found - --> $DIR/eta.rs:8:10 - | -8 | meta(|a| foo(a)); - | ^^^^^^^^^^ help: remove closure as shown: `foo` + --> $DIR/eta.rs:18:10 + | +18 | meta(|a| foo(a)); + | ^^^^^^^^^^ help: remove closure as shown: `foo` error: redundant closure found - --> $DIR/eta.rs:9:27 - | -9 | let c = Some(1u8).map(|a| {1+2; foo}(a)); - | ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `{1+2; foo}` + --> $DIR/eta.rs:19:27 + | +19 | let c = Some(1u8).map(|a| {1+2; foo}(a)); + | ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `{1+2; foo}` error: this expression borrows a reference that is immediately dereferenced by the compiler - --> $DIR/eta.rs:11:21 + --> $DIR/eta.rs:21:21 | -11 | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted +21 | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted | ^^^ help: change this to: `&2` | = note: `-D clippy::needless-borrow` implied by `-D warnings` error: redundant closure found - --> $DIR/eta.rs:18:27 + --> $DIR/eta.rs:28:27 | -18 | let e = Some(1u8).map(|a| generic(a)); +28 | let e = Some(1u8).map(|a| generic(a)); | ^^^^^^^^^^^^^^ help: remove closure as shown: `generic` error: aborting due to 5 previous errors diff --git a/tests/ui/eval_order_dependence.rs b/tests/ui/eval_order_dependence.rs index b240dde06..4e525b9b2 100644 --- a/tests/ui/eval_order_dependence.rs +++ b/tests/ui/eval_order_dependence.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/eval_order_dependence.stderr b/tests/ui/eval_order_dependence.stderr index 3caba829b..d5be92e99 100644 --- a/tests/ui/eval_order_dependence.stderr +++ b/tests/ui/eval_order_dependence.stderr @@ -1,50 +1,50 @@ error: unsequenced read of a variable - --> $DIR/eval_order_dependence.rs:8:28 - | -8 | let a = { x = 1; 1 } + x; - | ^ - | - = note: `-D clippy::eval-order-dependence` implied by `-D warnings` + --> $DIR/eval_order_dependence.rs:18:28 + | +18 | let a = { x = 1; 1 } + x; + | ^ + | + = note: `-D clippy::eval-order-dependence` implied by `-D warnings` note: whether read occurs before this write depends on evaluation order - --> $DIR/eval_order_dependence.rs:8:15 - | -8 | let a = { x = 1; 1 } + x; - | ^^^^^ + --> $DIR/eval_order_dependence.rs:18:15 + | +18 | let a = { x = 1; 1 } + x; + | ^^^^^ error: unsequenced read of a variable - --> $DIR/eval_order_dependence.rs:11:5 + --> $DIR/eval_order_dependence.rs:21:5 | -11 | x += { x = 20; 2 }; +21 | x += { x = 20; 2 }; | ^ | note: whether read occurs before this write depends on evaluation order - --> $DIR/eval_order_dependence.rs:11:12 + --> $DIR/eval_order_dependence.rs:21:12 | -11 | x += { x = 20; 2 }; +21 | x += { x = 20; 2 }; | ^^^^^^ error: unsequenced read of a variable - --> $DIR/eval_order_dependence.rs:17:24 + --> $DIR/eval_order_dependence.rs:27:24 | -17 | let foo = Foo { a: x, .. { x = 6; base } }; +27 | let foo = Foo { a: x, .. { x = 6; base } }; | ^ | note: whether read occurs before this write depends on evaluation order - --> $DIR/eval_order_dependence.rs:17:32 + --> $DIR/eval_order_dependence.rs:27:32 | -17 | let foo = Foo { a: x, .. { x = 6; base } }; +27 | let foo = Foo { a: x, .. { x = 6; base } }; | ^^^^^ error: unsequenced read of a variable - --> $DIR/eval_order_dependence.rs:21:9 + --> $DIR/eval_order_dependence.rs:31:9 | -21 | x += { x = 20; 2 }; +31 | x += { x = 20; 2 }; | ^ | note: whether read occurs before this write depends on evaluation order - --> $DIR/eval_order_dependence.rs:21:16 + --> $DIR/eval_order_dependence.rs:31:16 | -21 | x += { x = 20; 2 }; +31 | x += { x = 20; 2 }; | ^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/excessive_precision.rs b/tests/ui/excessive_precision.rs index 1b3412166..ab0412a16 100644 --- a/tests/ui/excessive_precision.rs +++ b/tests/ui/excessive_precision.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::excessive_precision)] #![allow(clippy::print_literal)] diff --git a/tests/ui/excessive_precision.stderr b/tests/ui/excessive_precision.stderr index bb0546cdc..783e41f2b 100644 --- a/tests/ui/excessive_precision.stderr +++ b/tests/ui/excessive_precision.stderr @@ -1,111 +1,111 @@ error: float has excessive precision - --> $DIR/excessive_precision.rs:15:26 + --> $DIR/excessive_precision.rs:25:26 | -15 | const BAD32_1: f32 = 0.123_456_789_f32; +25 | const BAD32_1: f32 = 0.123_456_789_f32; | ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79` | = note: `-D clippy::excessive-precision` implied by `-D warnings` error: float has excessive precision - --> $DIR/excessive_precision.rs:16:26 + --> $DIR/excessive_precision.rs:26:26 | -16 | const BAD32_2: f32 = 0.123_456_789; +26 | const BAD32_2: f32 = 0.123_456_789; | ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79` error: float has excessive precision - --> $DIR/excessive_precision.rs:17:26 + --> $DIR/excessive_precision.rs:27:26 | -17 | const BAD32_3: f32 = 0.100_000_000_000_1; +27 | const BAD32_3: f32 = 0.100_000_000_000_1; | ^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.1` error: float has excessive precision - --> $DIR/excessive_precision.rs:18:29 + --> $DIR/excessive_precision.rs:28:29 | -18 | const BAD32_EDGE: f32 = 1.000_000_9; +28 | const BAD32_EDGE: f32 = 1.000_000_9; | ^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.000_001` error: float has excessive precision - --> $DIR/excessive_precision.rs:20:26 + --> $DIR/excessive_precision.rs:30:26 | -20 | const BAD64_1: f64 = 0.123_456_789_012_345_67f64; +30 | const BAD64_1: f64 = 0.123_456_789_012_345_67f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66` error: float has excessive precision - --> $DIR/excessive_precision.rs:21:26 + --> $DIR/excessive_precision.rs:31:26 | -21 | const BAD64_2: f64 = 0.123_456_789_012_345_67; +31 | const BAD64_2: f64 = 0.123_456_789_012_345_67; | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66` error: float has excessive precision - --> $DIR/excessive_precision.rs:22:26 + --> $DIR/excessive_precision.rs:32:26 | -22 | const BAD64_3: f64 = 0.100_000_000_000_000_000_1; +32 | const BAD64_3: f64 = 0.100_000_000_000_000_000_1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.1` error: float has excessive precision - --> $DIR/excessive_precision.rs:25:22 + --> $DIR/excessive_precision.rs:35:22 | -25 | println!("{:?}", 8.888_888_888_888_888_888_888); +35 | println!("{:?}", 8.888_888_888_888_888_888_888); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `8.888_888_888_888_89` error: float has excessive precision - --> $DIR/excessive_precision.rs:36:22 + --> $DIR/excessive_precision.rs:46:22 | -36 | let bad32: f32 = 1.123_456_789; +46 | let bad32: f32 = 1.123_456_789; | ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8` error: float has excessive precision - --> $DIR/excessive_precision.rs:37:26 + --> $DIR/excessive_precision.rs:47:26 | -37 | let bad32_suf: f32 = 1.123_456_789_f32; +47 | let bad32_suf: f32 = 1.123_456_789_f32; | ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8` error: float has excessive precision - --> $DIR/excessive_precision.rs:38:21 + --> $DIR/excessive_precision.rs:48:21 | -38 | let bad32_inf = 1.123_456_789_f32; +48 | let bad32_inf = 1.123_456_789_f32; | ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8` error: float has excessive precision - --> $DIR/excessive_precision.rs:40:22 + --> $DIR/excessive_precision.rs:50:22 | -40 | let bad64: f64 = 0.123_456_789_012_345_67; +50 | let bad64: f64 = 0.123_456_789_012_345_67; | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66` error: float has excessive precision - --> $DIR/excessive_precision.rs:41:26 + --> $DIR/excessive_precision.rs:51:26 | -41 | let bad64_suf: f64 = 0.123_456_789_012_345_67f64; +51 | let bad64_suf: f64 = 0.123_456_789_012_345_67f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66` error: float has excessive precision - --> $DIR/excessive_precision.rs:42:21 + --> $DIR/excessive_precision.rs:52:21 | -42 | let bad64_inf = 0.123_456_789_012_345_67; +52 | let bad64_inf = 0.123_456_789_012_345_67; | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66` error: float has excessive precision - --> $DIR/excessive_precision.rs:48:36 + --> $DIR/excessive_precision.rs:58:36 | -48 | let bad_vec32: Vec = vec![0.123_456_789]; +58 | let bad_vec32: Vec = vec![0.123_456_789]; | ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79` error: float has excessive precision - --> $DIR/excessive_precision.rs:49:36 + --> $DIR/excessive_precision.rs:59:36 | -49 | let bad_vec64: Vec = vec![0.123_456_789_123_456_789]; +59 | let bad_vec64: Vec = vec![0.123_456_789_123_456_789]; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_123_456_78` error: float has excessive precision - --> $DIR/excessive_precision.rs:53:24 + --> $DIR/excessive_precision.rs:63:24 | -53 | let bad_e32: f32 = 1.123_456_788_888e-10; +63 | let bad_e32: f32 = 1.123_456_788_888e-10; | ^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8e-10` error: float has excessive precision - --> $DIR/excessive_precision.rs:56:27 + --> $DIR/excessive_precision.rs:66:27 | -56 | let bad_bige32: f32 = 1.123_456_788_888E-10; +66 | let bad_bige32: f32 = 1.123_456_788_888E-10; | ^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8E-10` error: aborting due to 18 previous errors diff --git a/tests/ui/explicit_write.rs b/tests/ui/explicit_write.rs index 9d6d13c84..2a748d257 100644 --- a/tests/ui/explicit_write.rs +++ b/tests/ui/explicit_write.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::explicit_write)] diff --git a/tests/ui/explicit_write.stderr b/tests/ui/explicit_write.stderr index fb14120b1..fadc12c75 100644 --- a/tests/ui/explicit_write.stderr +++ b/tests/ui/explicit_write.stderr @@ -1,39 +1,39 @@ error: use of `write!(stdout(), ...).unwrap()`. Consider using `print!` instead - --> $DIR/explicit_write.rs:18:9 + --> $DIR/explicit_write.rs:28:9 | -18 | write!(std::io::stdout(), "test").unwrap(); +28 | write!(std::io::stdout(), "test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::explicit-write` implied by `-D warnings` error: use of `write!(stderr(), ...).unwrap()`. Consider using `eprint!` instead - --> $DIR/explicit_write.rs:19:9 + --> $DIR/explicit_write.rs:29:9 | -19 | write!(std::io::stderr(), "test").unwrap(); +29 | write!(std::io::stderr(), "test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `writeln!(stdout(), ...).unwrap()`. Consider using `println!` instead - --> $DIR/explicit_write.rs:20:9 + --> $DIR/explicit_write.rs:30:9 | -20 | writeln!(std::io::stdout(), "test").unwrap(); +30 | writeln!(std::io::stdout(), "test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `writeln!(stderr(), ...).unwrap()`. Consider using `eprintln!` instead - --> $DIR/explicit_write.rs:21:9 + --> $DIR/explicit_write.rs:31:9 | -21 | writeln!(std::io::stderr(), "test").unwrap(); +31 | writeln!(std::io::stderr(), "test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `stdout().write_fmt(...).unwrap()`. Consider using `print!` instead - --> $DIR/explicit_write.rs:22:9 + --> $DIR/explicit_write.rs:32:9 | -22 | std::io::stdout().write_fmt(format_args!("test")).unwrap(); +32 | std::io::stdout().write_fmt(format_args!("test")).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `stderr().write_fmt(...).unwrap()`. Consider using `eprint!` instead - --> $DIR/explicit_write.rs:23:9 + --> $DIR/explicit_write.rs:33:9 | -23 | std::io::stderr().write_fmt(format_args!("test")).unwrap(); +33 | std::io::stderr().write_fmt(format_args!("test")).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/fallible_impl_from.rs b/tests/ui/fallible_impl_from.rs index 5e33cca59..1e1e24ee9 100644 --- a/tests/ui/fallible_impl_from.rs +++ b/tests/ui/fallible_impl_from.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::fallible_impl_from)] diff --git a/tests/ui/fallible_impl_from.stderr b/tests/ui/fallible_impl_from.stderr index 4dbc7879d..97ece9314 100644 --- a/tests/ui/fallible_impl_from.stderr +++ b/tests/ui/fallible_impl_from.stderr @@ -1,91 +1,91 @@ error: consider implementing `TryFrom` instead - --> $DIR/fallible_impl_from.rs:7:1 + --> $DIR/fallible_impl_from.rs:17:1 | -7 | / impl From for Foo { -8 | | fn from(s: String) -> Self { -9 | | Foo(s.parse().unwrap()) -10 | | } -11 | | } +17 | / impl From for Foo { +18 | | fn from(s: String) -> Self { +19 | | Foo(s.parse().unwrap()) +20 | | } +21 | | } | |_^ | note: lint level defined here - --> $DIR/fallible_impl_from.rs:3:9 + --> $DIR/fallible_impl_from.rs:13:9 | -3 | #![deny(clippy::fallible_impl_from)] +13 | #![deny(clippy::fallible_impl_from)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail. note: potential failure(s) - --> $DIR/fallible_impl_from.rs:9:13 + --> $DIR/fallible_impl_from.rs:19:13 | -9 | Foo(s.parse().unwrap()) +19 | Foo(s.parse().unwrap()) | ^^^^^^^^^^^^^^^^^^ error: consider implementing `TryFrom` instead - --> $DIR/fallible_impl_from.rs:30:1 + --> $DIR/fallible_impl_from.rs:40:1 | -30 | / impl From for Invalid { -31 | | fn from(i: usize) -> Invalid { -32 | | if i != 42 { -33 | | panic!(); +40 | / impl From for Invalid { +41 | | fn from(i: usize) -> Invalid { +42 | | if i != 42 { +43 | | panic!(); ... | -36 | | } -37 | | } +46 | | } +47 | | } | |_^ | = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail. note: potential failure(s) - --> $DIR/fallible_impl_from.rs:33:13 + --> $DIR/fallible_impl_from.rs:43:13 | -33 | panic!(); +43 | panic!(); | ^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: consider implementing `TryFrom` instead - --> $DIR/fallible_impl_from.rs:39:1 + --> $DIR/fallible_impl_from.rs:49:1 | -39 | / impl From> for Invalid { -40 | | fn from(s: Option) -> Invalid { -41 | | let s = s.unwrap(); -42 | | if !s.is_empty() { +49 | / impl From> for Invalid { +50 | | fn from(s: Option) -> Invalid { +51 | | let s = s.unwrap(); +52 | | if !s.is_empty() { ... | -48 | | } -49 | | } +58 | | } +59 | | } | |_^ | = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail. note: potential failure(s) - --> $DIR/fallible_impl_from.rs:41:17 + --> $DIR/fallible_impl_from.rs:51:17 | -41 | let s = s.unwrap(); +51 | let s = s.unwrap(); | ^^^^^^^^^^ -42 | if !s.is_empty() { -43 | panic!(42); +52 | if !s.is_empty() { +53 | panic!(42); | ^^^^^^^^^^^ -44 | } else if s.parse::().unwrap() != 42 { +54 | } else if s.parse::().unwrap() != 42 { | ^^^^^^^^^^^^^^^^^^^^^^^^^ -45 | panic!("{:?}", s); +55 | panic!("{:?}", s); | ^^^^^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: consider implementing `TryFrom` instead - --> $DIR/fallible_impl_from.rs:57:1 + --> $DIR/fallible_impl_from.rs:67:1 | -57 | / impl<'a> From<&'a mut as ProjStrTrait>::ProjString> for Invalid { -58 | | fn from(s: &'a mut as ProjStrTrait>::ProjString) -> Invalid { -59 | | if s.parse::().ok().unwrap() != 42 { -60 | | panic!("{:?}", s); +67 | / impl<'a> From<&'a mut as ProjStrTrait>::ProjString> for Invalid { +68 | | fn from(s: &'a mut as ProjStrTrait>::ProjString) -> Invalid { +69 | | if s.parse::().ok().unwrap() != 42 { +70 | | panic!("{:?}", s); ... | -63 | | } -64 | | } +73 | | } +74 | | } | |_^ | = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail. note: potential failure(s) - --> $DIR/fallible_impl_from.rs:59:12 + --> $DIR/fallible_impl_from.rs:69:12 | -59 | if s.parse::().ok().unwrap() != 42 { +69 | if s.parse::().ok().unwrap() != 42 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -60 | panic!("{:?}", s); +70 | panic!("{:?}", s); | ^^^^^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/tests/ui/filter_methods.rs b/tests/ui/filter_methods.rs index d7a50a588..1bfc03356 100644 --- a/tests/ui/filter_methods.rs +++ b/tests/ui/filter_methods.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/filter_methods.stderr b/tests/ui/filter_methods.stderr index 1fde70601..6adbec44c 100644 --- a/tests/ui/filter_methods.stderr +++ b/tests/ui/filter_methods.stderr @@ -1,39 +1,39 @@ error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead. - --> $DIR/filter_methods.rs:8:21 + --> $DIR/filter_methods.rs:18:21 | -8 | let _: Vec<_> = vec![5; 6].into_iter() +18 | let _: Vec<_> = vec![5; 6].into_iter() | _____________________^ -9 | | .filter(|&x| x == 0) -10 | | .map(|x| x * 2) +19 | | .filter(|&x| x == 0) +20 | | .map(|x| x * 2) | |_____________________________________________^ | = note: `-D clippy::filter-map` implied by `-D warnings` error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator. - --> $DIR/filter_methods.rs:13:21 - | -13 | let _: Vec<_> = vec![5_i8; 6].into_iter() - | _____________________^ -14 | | .filter(|&x| x == 0) -15 | | .flat_map(|x| x.checked_mul(2)) - | |_______________________________________________________________^ - -error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator. - --> $DIR/filter_methods.rs:18:21 - | -18 | let _: Vec<_> = vec![5_i8; 6].into_iter() - | _____________________^ -19 | | .filter_map(|x| x.checked_mul(2)) -20 | | .flat_map(|x| x.checked_mul(2)) - | |_______________________________________________________________^ - -error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead. --> $DIR/filter_methods.rs:23:21 | 23 | let _: Vec<_> = vec![5_i8; 6].into_iter() | _____________________^ -24 | | .filter_map(|x| x.checked_mul(2)) -25 | | .map(|x| x.checked_mul(2)) +24 | | .filter(|&x| x == 0) +25 | | .flat_map(|x| x.checked_mul(2)) + | |_______________________________________________________________^ + +error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator. + --> $DIR/filter_methods.rs:28:21 + | +28 | let _: Vec<_> = vec![5_i8; 6].into_iter() + | _____________________^ +29 | | .filter_map(|x| x.checked_mul(2)) +30 | | .flat_map(|x| x.checked_mul(2)) + | |_______________________________________________________________^ + +error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead. + --> $DIR/filter_methods.rs:33:21 + | +33 | let _: Vec<_> = vec![5_i8; 6].into_iter() + | _____________________^ +34 | | .filter_map(|x| x.checked_mul(2)) +35 | | .map(|x| x.checked_mul(2)) | |__________________________________________________________^ error: aborting due to 4 previous errors diff --git a/tests/ui/float_cmp.rs b/tests/ui/float_cmp.rs index d5b02fb70..cb8b7a98e 100644 --- a/tests/ui/float_cmp.rs +++ b/tests/ui/float_cmp.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/float_cmp.stderr b/tests/ui/float_cmp.stderr index 598ebf336..52ec0e3ed 100644 --- a/tests/ui/float_cmp.stderr +++ b/tests/ui/float_cmp.stderr @@ -1,38 +1,38 @@ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:49:5 + --> $DIR/float_cmp.rs:59:5 | -49 | ONE as f64 != 2.0; +59 | ONE as f64 != 2.0; | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() < error` | = note: `-D clippy::float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp.rs:49:5 + --> $DIR/float_cmp.rs:59:5 | -49 | ONE as f64 != 2.0; +59 | ONE as f64 != 2.0; | ^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:54:5 + --> $DIR/float_cmp.rs:64:5 | -54 | x == 1.0; +64 | x == 1.0; | ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp.rs:54:5 + --> $DIR/float_cmp.rs:64:5 | -54 | x == 1.0; +64 | x == 1.0; | ^^^^^^^^ error: strict comparison of f32 or f64 - --> $DIR/float_cmp.rs:57:5 + --> $DIR/float_cmp.rs:67:5 | -57 | twice(x) != twice(ONE as f64); +67 | twice(x) != twice(ONE as f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(x) - twice(ONE as f64)).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp.rs:57:5 + --> $DIR/float_cmp.rs:67:5 | -57 | twice(x) != twice(ONE as f64); +67 | twice(x) != twice(ONE as f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/float_cmp_const.rs b/tests/ui/float_cmp_const.rs index 279400604..27d829ed1 100644 --- a/tests/ui/float_cmp_const.rs +++ b/tests/ui/float_cmp_const.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/float_cmp_const.stderr b/tests/ui/float_cmp_const.stderr index 140839795..d9b1d2685 100644 --- a/tests/ui/float_cmp_const.stderr +++ b/tests/ui/float_cmp_const.stderr @@ -1,86 +1,86 @@ error: strict comparison of f32 or f64 constant - --> $DIR/float_cmp_const.rs:17:5 + --> $DIR/float_cmp_const.rs:27:5 | -17 | 1f32 == ONE; +27 | 1f32 == ONE; | ^^^^^^^^^^^ help: consider comparing them within some error: `(1f32 - ONE).abs() < error` | = note: `-D clippy::float-cmp-const` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp_const.rs:17:5 + --> $DIR/float_cmp_const.rs:27:5 | -17 | 1f32 == ONE; +27 | 1f32 == ONE; | ^^^^^^^^^^^ error: strict comparison of f32 or f64 constant - --> $DIR/float_cmp_const.rs:18:5 + --> $DIR/float_cmp_const.rs:28:5 | -18 | TWO == ONE; +28 | TWO == ONE; | ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp_const.rs:18:5 + --> $DIR/float_cmp_const.rs:28:5 | -18 | TWO == ONE; +28 | TWO == ONE; | ^^^^^^^^^^ error: strict comparison of f32 or f64 constant - --> $DIR/float_cmp_const.rs:19:5 + --> $DIR/float_cmp_const.rs:29:5 | -19 | TWO != ONE; +29 | TWO != ONE; | ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp_const.rs:19:5 + --> $DIR/float_cmp_const.rs:29:5 | -19 | TWO != ONE; +29 | TWO != ONE; | ^^^^^^^^^^ error: strict comparison of f32 or f64 constant - --> $DIR/float_cmp_const.rs:20:5 + --> $DIR/float_cmp_const.rs:30:5 | -20 | ONE + ONE == TWO; +30 | ONE + ONE == TWO; | ^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE + ONE - TWO).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp_const.rs:20:5 + --> $DIR/float_cmp_const.rs:30:5 | -20 | ONE + ONE == TWO; +30 | ONE + ONE == TWO; | ^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 constant - --> $DIR/float_cmp_const.rs:21:5 + --> $DIR/float_cmp_const.rs:31:5 | -21 | 1 as f32 == ONE; +31 | 1 as f32 == ONE; | ^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(1 as f32 - ONE).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp_const.rs:21:5 + --> $DIR/float_cmp_const.rs:31:5 | -21 | 1 as f32 == ONE; +31 | 1 as f32 == ONE; | ^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 constant - --> $DIR/float_cmp_const.rs:24:5 + --> $DIR/float_cmp_const.rs:34:5 | -24 | v == ONE; +34 | v == ONE; | ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp_const.rs:24:5 + --> $DIR/float_cmp_const.rs:34:5 | -24 | v == ONE; +34 | v == ONE; | ^^^^^^^^ error: strict comparison of f32 or f64 constant - --> $DIR/float_cmp_const.rs:25:5 + --> $DIR/float_cmp_const.rs:35:5 | -25 | v != ONE; +35 | v != ONE; | ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. - --> $DIR/float_cmp_const.rs:25:5 + --> $DIR/float_cmp_const.rs:35:5 | -25 | v != ONE; +35 | v != ONE; | ^^^^^^^^ error: aborting due to 7 previous errors diff --git a/tests/ui/fn_to_numeric_cast.rs b/tests/ui/fn_to_numeric_cast.rs index fc8aa19dc..0066b9a35 100644 --- a/tests/ui/fn_to_numeric_cast.rs +++ b/tests/ui/fn_to_numeric_cast.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // only-64bit #![feature(tool_lints)] diff --git a/tests/ui/fn_to_numeric_cast.stderr b/tests/ui/fn_to_numeric_cast.stderr index 29320f0d8..2e186145e 100644 --- a/tests/ui/fn_to_numeric_cast.stderr +++ b/tests/ui/fn_to_numeric_cast.stderr @@ -1,143 +1,143 @@ error: casting function pointer `foo` to `i8`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:9:13 - | -9 | let _ = foo as i8; - | ^^^^^^^^^ help: try: `foo as usize` - | - = note: `-D clippy::fn-to-numeric-cast-with-truncation` implied by `-D warnings` + --> $DIR/fn_to_numeric_cast.rs:19:13 + | +19 | let _ = foo as i8; + | ^^^^^^^^^ help: try: `foo as usize` + | + = note: `-D clippy::fn-to-numeric-cast-with-truncation` implied by `-D warnings` error: casting function pointer `foo` to `i16`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:10:13 + --> $DIR/fn_to_numeric_cast.rs:20:13 | -10 | let _ = foo as i16; +20 | let _ = foo as i16; | ^^^^^^^^^^ help: try: `foo as usize` error: casting function pointer `foo` to `i32`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:11:13 + --> $DIR/fn_to_numeric_cast.rs:21:13 | -11 | let _ = foo as i32; +21 | let _ = foo as i32; | ^^^^^^^^^^ help: try: `foo as usize` error: casting function pointer `foo` to `i64` - --> $DIR/fn_to_numeric_cast.rs:12:13 + --> $DIR/fn_to_numeric_cast.rs:22:13 | -12 | let _ = foo as i64; +22 | let _ = foo as i64; | ^^^^^^^^^^ help: try: `foo as usize` | = note: `-D clippy::fn-to-numeric-cast` implied by `-D warnings` error: casting function pointer `foo` to `i128` - --> $DIR/fn_to_numeric_cast.rs:13:13 + --> $DIR/fn_to_numeric_cast.rs:23:13 | -13 | let _ = foo as i128; +23 | let _ = foo as i128; | ^^^^^^^^^^^ help: try: `foo as usize` error: casting function pointer `foo` to `isize` - --> $DIR/fn_to_numeric_cast.rs:14:13 + --> $DIR/fn_to_numeric_cast.rs:24:13 | -14 | let _ = foo as isize; +24 | let _ = foo as isize; | ^^^^^^^^^^^^ help: try: `foo as usize` error: casting function pointer `foo` to `u8`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:16:13 + --> $DIR/fn_to_numeric_cast.rs:26:13 | -16 | let _ = foo as u8; +26 | let _ = foo as u8; | ^^^^^^^^^ help: try: `foo as usize` error: casting function pointer `foo` to `u16`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:17:13 + --> $DIR/fn_to_numeric_cast.rs:27:13 | -17 | let _ = foo as u16; +27 | let _ = foo as u16; | ^^^^^^^^^^ help: try: `foo as usize` error: casting function pointer `foo` to `u32`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:18:13 + --> $DIR/fn_to_numeric_cast.rs:28:13 | -18 | let _ = foo as u32; +28 | let _ = foo as u32; | ^^^^^^^^^^ help: try: `foo as usize` error: casting function pointer `foo` to `u64` - --> $DIR/fn_to_numeric_cast.rs:19:13 + --> $DIR/fn_to_numeric_cast.rs:29:13 | -19 | let _ = foo as u64; +29 | let _ = foo as u64; | ^^^^^^^^^^ help: try: `foo as usize` error: casting function pointer `foo` to `u128` - --> $DIR/fn_to_numeric_cast.rs:20:13 + --> $DIR/fn_to_numeric_cast.rs:30:13 | -20 | let _ = foo as u128; +30 | let _ = foo as u128; | ^^^^^^^^^^^ help: try: `foo as usize` error: casting function pointer `abc` to `i8`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:29:13 + --> $DIR/fn_to_numeric_cast.rs:39:13 | -29 | let _ = abc as i8; +39 | let _ = abc as i8; | ^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `i16`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:30:13 + --> $DIR/fn_to_numeric_cast.rs:40:13 | -30 | let _ = abc as i16; +40 | let _ = abc as i16; | ^^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `i32`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:31:13 + --> $DIR/fn_to_numeric_cast.rs:41:13 | -31 | let _ = abc as i32; +41 | let _ = abc as i32; | ^^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `i64` - --> $DIR/fn_to_numeric_cast.rs:32:13 + --> $DIR/fn_to_numeric_cast.rs:42:13 | -32 | let _ = abc as i64; +42 | let _ = abc as i64; | ^^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `i128` - --> $DIR/fn_to_numeric_cast.rs:33:13 + --> $DIR/fn_to_numeric_cast.rs:43:13 | -33 | let _ = abc as i128; +43 | let _ = abc as i128; | ^^^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `isize` - --> $DIR/fn_to_numeric_cast.rs:34:13 + --> $DIR/fn_to_numeric_cast.rs:44:13 | -34 | let _ = abc as isize; +44 | let _ = abc as isize; | ^^^^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `u8`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:36:13 + --> $DIR/fn_to_numeric_cast.rs:46:13 | -36 | let _ = abc as u8; +46 | let _ = abc as u8; | ^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `u16`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:37:13 + --> $DIR/fn_to_numeric_cast.rs:47:13 | -37 | let _ = abc as u16; +47 | let _ = abc as u16; | ^^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `u32`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:38:13 + --> $DIR/fn_to_numeric_cast.rs:48:13 | -38 | let _ = abc as u32; +48 | let _ = abc as u32; | ^^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `u64` - --> $DIR/fn_to_numeric_cast.rs:39:13 + --> $DIR/fn_to_numeric_cast.rs:49:13 | -39 | let _ = abc as u64; +49 | let _ = abc as u64; | ^^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `abc` to `u128` - --> $DIR/fn_to_numeric_cast.rs:40:13 + --> $DIR/fn_to_numeric_cast.rs:50:13 | -40 | let _ = abc as u128; +50 | let _ = abc as u128; | ^^^^^^^^^^^ help: try: `abc as usize` error: casting function pointer `f` to `i32`, which truncates the value - --> $DIR/fn_to_numeric_cast.rs:47:5 + --> $DIR/fn_to_numeric_cast.rs:57:5 | -47 | f as i32 +57 | f as i32 | ^^^^^^^^ help: try: `f as usize` error: aborting due to 23 previous errors diff --git a/tests/ui/for_loop.rs b/tests/ui/for_loop.rs index 55060b076..cff707554 100644 --- a/tests/ui/for_loop.rs +++ b/tests/ui/for_loop.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/for_loop.stderr b/tests/ui/for_loop.stderr index d82914754..472fa1486 100644 --- a/tests/ui/for_loop.stderr +++ b/tests/ui/for_loop.stderr @@ -1,502 +1,502 @@ error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement. - --> $DIR/for_loop.rs:17:14 + --> $DIR/for_loop.rs:27:14 | -17 | for x in option { +27 | for x in option { | ^^^^^^ | = note: `-D clippy::for-loop-over-option` implied by `-D warnings` = help: consider replacing `for x in option` with `if let Some(x) = option` error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement. - --> $DIR/for_loop.rs:22:14 + --> $DIR/for_loop.rs:32:14 | -22 | for x in result { +32 | for x in result { | ^^^^^^ | = note: `-D clippy::for-loop-over-result` implied by `-D warnings` = help: consider replacing `for x in result` with `if let Ok(x) = result` error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement. - --> $DIR/for_loop.rs:26:14 + --> $DIR/for_loop.rs:36:14 | -26 | for x in option.ok_or("x not found") { +36 | for x in option.ok_or("x not found") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")` error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want - --> $DIR/for_loop.rs:32:14 + --> $DIR/for_loop.rs:42:14 | -32 | for x in v.iter().next() { +42 | for x in v.iter().next() { | ^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-next-loop` implied by `-D warnings` error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement. - --> $DIR/for_loop.rs:37:14 + --> $DIR/for_loop.rs:47:14 | -37 | for x in v.iter().next().and(Some(0)) { +47 | for x in v.iter().next().and(Some(0)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))` error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement. - --> $DIR/for_loop.rs:41:14 + --> $DIR/for_loop.rs:51:14 | -41 | for x in v.iter().next().ok_or("x not found") { +51 | for x in v.iter().next().ok_or("x not found") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")` error: this loop never actually loops - --> $DIR/for_loop.rs:53:5 + --> $DIR/for_loop.rs:63:5 | -53 | / while let Some(x) = option { -54 | | println!("{}", x); -55 | | break; -56 | | } +63 | / while let Some(x) = option { +64 | | println!("{}", x); +65 | | break; +66 | | } | |_____^ | = note: `-D clippy::never-loop` implied by `-D warnings` error: this loop never actually loops - --> $DIR/for_loop.rs:59:5 + --> $DIR/for_loop.rs:69:5 | -59 | / while let Ok(x) = result { -60 | | println!("{}", x); -61 | | break; -62 | | } +69 | / while let Ok(x) = result { +70 | | println!("{}", x); +71 | | break; +72 | | } | |_____^ error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:86:14 + --> $DIR/for_loop.rs:96:14 | -86 | for i in 0..vec.len() { +96 | for i in 0..vec.len() { | ^^^^^^^^^^^^ | = note: `-D clippy::needless-range-loop` implied by `-D warnings` help: consider using an iterator | -86 | for in &vec { +96 | for in &vec { | ^^^^^^ ^^^^ error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:95:14 - | -95 | for i in 0..vec.len() { - | ^^^^^^^^^^^^ + --> $DIR/for_loop.rs:105:14 + | +105 | for i in 0..vec.len() { + | ^^^^^^^^^^^^ help: consider using an iterator - | -95 | for in &vec { - | ^^^^^^ ^^^^ + | +105 | for in &vec { + | ^^^^^^ ^^^^ error: the loop variable `j` is only used to index `STATIC`. - --> $DIR/for_loop.rs:100:14 + --> $DIR/for_loop.rs:110:14 | -100 | for j in 0..4 { +110 | for j in 0..4 { | ^^^^ help: consider using an iterator | -100 | for in STATIC.iter().take(4) { +110 | for in STATIC.iter().take(4) { | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ error: the loop variable `j` is only used to index `CONST`. - --> $DIR/for_loop.rs:104:14 + --> $DIR/for_loop.rs:114:14 | -104 | for j in 0..4 { +114 | for j in 0..4 { | ^^^^ help: consider using an iterator | -104 | for in CONST.iter().take(4) { +114 | for in CONST.iter().take(4) { | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is used to index `vec` - --> $DIR/for_loop.rs:108:14 + --> $DIR/for_loop.rs:118:14 | -108 | for i in 0..vec.len() { +118 | for i in 0..vec.len() { | ^^^^^^^^^^^^ help: consider using an iterator | -108 | for (i, ) in vec.iter().enumerate() { +118 | for (i, ) in vec.iter().enumerate() { | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is only used to index `vec2`. - --> $DIR/for_loop.rs:116:14 + --> $DIR/for_loop.rs:126:14 | -116 | for i in 0..vec.len() { +126 | for i in 0..vec.len() { | ^^^^^^^^^^^^ help: consider using an iterator | -116 | for in vec2.iter().take(vec.len()) { +126 | for in vec2.iter().take(vec.len()) { | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:120:14 + --> $DIR/for_loop.rs:130:14 | -120 | for i in 5..vec.len() { +130 | for i in 5..vec.len() { | ^^^^^^^^^^^^ help: consider using an iterator | -120 | for in vec.iter().skip(5) { +130 | for in vec.iter().skip(5) { | ^^^^^^ ^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:124:14 + --> $DIR/for_loop.rs:134:14 | -124 | for i in 0..MAX_LEN { +134 | for i in 0..MAX_LEN { | ^^^^^^^^^^ help: consider using an iterator | -124 | for in vec.iter().take(MAX_LEN) { +134 | for in vec.iter().take(MAX_LEN) { | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:128:14 + --> $DIR/for_loop.rs:138:14 | -128 | for i in 0..=MAX_LEN { +138 | for i in 0..=MAX_LEN { | ^^^^^^^^^^^ help: consider using an iterator | -128 | for in vec.iter().take(MAX_LEN + 1) { +138 | for in vec.iter().take(MAX_LEN + 1) { | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:132:14 + --> $DIR/for_loop.rs:142:14 | -132 | for i in 5..10 { +142 | for i in 5..10 { | ^^^^^ help: consider using an iterator | -132 | for in vec.iter().take(10).skip(5) { +142 | for in vec.iter().take(10).skip(5) { | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is only used to index `vec`. - --> $DIR/for_loop.rs:136:14 + --> $DIR/for_loop.rs:146:14 | -136 | for i in 5..=10 { +146 | for i in 5..=10 { | ^^^^^^ help: consider using an iterator | -136 | for in vec.iter().take(10 + 1).skip(5) { +146 | for in vec.iter().take(10 + 1).skip(5) { | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is used to index `vec` - --> $DIR/for_loop.rs:140:14 + --> $DIR/for_loop.rs:150:14 | -140 | for i in 5..vec.len() { +150 | for i in 5..vec.len() { | ^^^^^^^^^^^^ help: consider using an iterator | -140 | for (i, ) in vec.iter().enumerate().skip(5) { +150 | for (i, ) in vec.iter().enumerate().skip(5) { | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is used to index `vec` - --> $DIR/for_loop.rs:144:14 + --> $DIR/for_loop.rs:154:14 | -144 | for i in 5..10 { +154 | for i in 5..10 { | ^^^^^ help: consider using an iterator | -144 | for (i, ) in vec.iter().enumerate().take(10).skip(5) { +154 | for (i, ) in vec.iter().enumerate().take(10).skip(5) { | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> $DIR/for_loop.rs:148:14 + --> $DIR/for_loop.rs:158:14 | -148 | for i in 10..0 { +158 | for i in 10..0 { | ^^^^^ | = note: `-D clippy::reverse-range-loop` implied by `-D warnings` help: consider using the following if you are attempting to iterate over this range in reverse | -148 | for i in (0..10).rev() { +158 | for i in (0..10).rev() { | ^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> $DIR/for_loop.rs:152:14 + --> $DIR/for_loop.rs:162:14 | -152 | for i in 10..=0 { +162 | for i in 10..=0 { | ^^^^^^ help: consider using the following if you are attempting to iterate over this range in reverse | -152 | for i in (0...10).rev() { +162 | for i in (0...10).rev() { | ^^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> $DIR/for_loop.rs:156:14 + --> $DIR/for_loop.rs:166:14 | -156 | for i in MAX_LEN..0 { +166 | for i in MAX_LEN..0 { | ^^^^^^^^^^ help: consider using the following if you are attempting to iterate over this range in reverse | -156 | for i in (0..MAX_LEN).rev() { +166 | for i in (0..MAX_LEN).rev() { | ^^^^^^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> $DIR/for_loop.rs:160:14 + --> $DIR/for_loop.rs:170:14 | -160 | for i in 5..5 { +170 | for i in 5..5 { | ^^^^ error: this range is empty so this for loop will never run - --> $DIR/for_loop.rs:185:14 + --> $DIR/for_loop.rs:195:14 | -185 | for i in 10..5 + 4 { +195 | for i in 10..5 + 4 { | ^^^^^^^^^ help: consider using the following if you are attempting to iterate over this range in reverse | -185 | for i in (5 + 4..10).rev() { +195 | for i in (5 + 4..10).rev() { | ^^^^^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> $DIR/for_loop.rs:189:14 + --> $DIR/for_loop.rs:199:14 | -189 | for i in (5 + 2)..(3 - 1) { +199 | for i in (5 + 2)..(3 - 1) { | ^^^^^^^^^^^^^^^^ help: consider using the following if you are attempting to iterate over this range in reverse | -189 | for i in ((3 - 1)..(5 + 2)).rev() { +199 | for i in ((3 - 1)..(5 + 2)).rev() { | ^^^^^^^^^^^^^^^^^^^^^^^^ error: this range is empty so this for loop will never run - --> $DIR/for_loop.rs:193:14 + --> $DIR/for_loop.rs:203:14 | -193 | for i in (5 + 2)..(8 - 1) { +203 | for i in (5 + 2)..(8 - 1) { | ^^^^^^^^^^^^^^^^ error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:215:15 + --> $DIR/for_loop.rs:225:15 | -215 | for _v in vec.iter() {} +225 | for _v in vec.iter() {} | ^^^^^^^^^^ help: to write this more concisely, try: `&vec` | = note: `-D clippy::explicit-iter-loop` implied by `-D warnings` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:217:15 + --> $DIR/for_loop.rs:227:15 | -217 | for _v in vec.iter_mut() {} +227 | for _v in vec.iter_mut() {} | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec` error: it is more concise to loop over containers instead of using explicit iteration methods` - --> $DIR/for_loop.rs:220:15 + --> $DIR/for_loop.rs:230:15 | -220 | for _v in out_vec.into_iter() {} +230 | for _v in out_vec.into_iter() {} | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec` | = note: `-D clippy::explicit-into-iter-loop` implied by `-D warnings` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:223:15 + --> $DIR/for_loop.rs:233:15 | -223 | for _v in array.into_iter() {} +233 | for _v in array.into_iter() {} | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&array` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:228:15 + --> $DIR/for_loop.rs:238:15 | -228 | for _v in [1, 2, 3].iter() {} +238 | for _v in [1, 2, 3].iter() {} | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:232:15 + --> $DIR/for_loop.rs:242:15 | -232 | for _v in [0; 32].iter() {} +242 | for _v in [0; 32].iter() {} | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:237:15 + --> $DIR/for_loop.rs:247:15 | -237 | for _v in ll.iter() {} +247 | for _v in ll.iter() {} | ^^^^^^^^^ help: to write this more concisely, try: `&ll` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:240:15 + --> $DIR/for_loop.rs:250:15 | -240 | for _v in vd.iter() {} +250 | for _v in vd.iter() {} | ^^^^^^^^^ help: to write this more concisely, try: `&vd` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:243:15 + --> $DIR/for_loop.rs:253:15 | -243 | for _v in bh.iter() {} +253 | for _v in bh.iter() {} | ^^^^^^^^^ help: to write this more concisely, try: `&bh` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:246:15 + --> $DIR/for_loop.rs:256:15 | -246 | for _v in hm.iter() {} +256 | for _v in hm.iter() {} | ^^^^^^^^^ help: to write this more concisely, try: `&hm` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:249:15 + --> $DIR/for_loop.rs:259:15 | -249 | for _v in bt.iter() {} +259 | for _v in bt.iter() {} | ^^^^^^^^^ help: to write this more concisely, try: `&bt` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:252:15 + --> $DIR/for_loop.rs:262:15 | -252 | for _v in hs.iter() {} +262 | for _v in hs.iter() {} | ^^^^^^^^^ help: to write this more concisely, try: `&hs` error: it is more concise to loop over references to containers instead of using explicit iteration methods - --> $DIR/for_loop.rs:255:15 + --> $DIR/for_loop.rs:265:15 | -255 | for _v in bs.iter() {} +265 | for _v in bs.iter() {} | ^^^^^^^^^ help: to write this more concisely, try: `&bs` error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want - --> $DIR/for_loop.rs:257:15 + --> $DIR/for_loop.rs:267:15 | -257 | for _v in vec.iter().next() {} +267 | for _v in vec.iter().next() {} | ^^^^^^^^^^^^^^^^^ error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator - --> $DIR/for_loop.rs:264:5 + --> $DIR/for_loop.rs:274:5 | -264 | vec.iter().cloned().map(|x| out.push(x)).collect::>(); +274 | vec.iter().cloned().map(|x| out.push(x)).collect::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unused-collect` implied by `-D warnings` error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators - --> $DIR/for_loop.rs:269:15 + --> $DIR/for_loop.rs:279:15 | -269 | for _v in &vec { +279 | for _v in &vec { | ^^^^ | = note: `-D clippy::explicit-counter-loop` implied by `-D warnings` error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators - --> $DIR/for_loop.rs:275:15 + --> $DIR/for_loop.rs:285:15 | -275 | for _v in &vec { +285 | for _v in &vec { | ^^^^ error: you seem to want to iterate on a map's values - --> $DIR/for_loop.rs:385:19 + --> $DIR/for_loop.rs:395:19 | -385 | for (_, v) in &m { +395 | for (_, v) in &m { | ^^ | = note: `-D clippy::for-kv-map` implied by `-D warnings` help: use the corresponding method | -385 | for v in m.values() { +395 | for v in m.values() { | ^ ^^^^^^^^^^ error: you seem to want to iterate on a map's values - --> $DIR/for_loop.rs:390:19 + --> $DIR/for_loop.rs:400:19 | -390 | for (_, v) in &*m { +400 | for (_, v) in &*m { | ^^^ help: use the corresponding method | -390 | for v in (*m).values() { +400 | for v in (*m).values() { | ^ ^^^^^^^^^^^^^ error: you seem to want to iterate on a map's values - --> $DIR/for_loop.rs:398:19 + --> $DIR/for_loop.rs:408:19 | -398 | for (_, v) in &mut m { +408 | for (_, v) in &mut m { | ^^^^^^ help: use the corresponding method | -398 | for v in m.values_mut() { +408 | for v in m.values_mut() { | ^ ^^^^^^^^^^^^^^ error: you seem to want to iterate on a map's values - --> $DIR/for_loop.rs:403:19 + --> $DIR/for_loop.rs:413:19 | -403 | for (_, v) in &mut *m { +413 | for (_, v) in &mut *m { | ^^^^^^^ help: use the corresponding method | -403 | for v in (*m).values_mut() { +413 | for v in (*m).values_mut() { | ^ ^^^^^^^^^^^^^^^^^ error: you seem to want to iterate on a map's keys - --> $DIR/for_loop.rs:409:24 + --> $DIR/for_loop.rs:419:24 | -409 | for (k, _value) in rm { +419 | for (k, _value) in rm { | ^^ help: use the corresponding method | -409 | for k in rm.keys() { +419 | for k in rm.keys() { | ^ ^^^^^^^^^ -error: it looks like you're manually copying between slices - --> $DIR/for_loop.rs:462:14 - | -462 | for i in 0..src.len() { - | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])` - | - = note: `-D clippy::manual-memcpy` implied by `-D warnings` - -error: it looks like you're manually copying between slices - --> $DIR/for_loop.rs:467:14 - | -467 | for i in 0..src.len() { - | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[10..(src.len() + 10)].clone_from_slice(&src[..])` - error: it looks like you're manually copying between slices --> $DIR/for_loop.rs:472:14 | 472 | for i in 0..src.len() { - | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[10..])` + | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])` + | + = note: `-D clippy::manual-memcpy` implied by `-D warnings` error: it looks like you're manually copying between slices --> $DIR/for_loop.rs:477:14 | -477 | for i in 11..src.len() { - | ^^^^^^^^^^^^^ help: try replacing the loop by: `dst[11..src.len()].clone_from_slice(&src[(11 - 10)..(src.len() - 10)])` +477 | for i in 0..src.len() { + | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[10..(src.len() + 10)].clone_from_slice(&src[..])` error: it looks like you're manually copying between slices --> $DIR/for_loop.rs:482:14 | -482 | for i in 0..dst.len() { +482 | for i in 0..src.len() { + | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[10..])` + +error: it looks like you're manually copying between slices + --> $DIR/for_loop.rs:487:14 + | +487 | for i in 11..src.len() { + | ^^^^^^^^^^^^^ help: try replacing the loop by: `dst[11..src.len()].clone_from_slice(&src[(11 - 10)..(src.len() - 10)])` + +error: it looks like you're manually copying between slices + --> $DIR/for_loop.rs:492:14 + | +492 | for i in 0..dst.len() { | ^^^^^^^^^^^^ help: try replacing the loop by: `dst.clone_from_slice(&src[..dst.len()])` error: it looks like you're manually copying between slices - --> $DIR/for_loop.rs:495:14 + --> $DIR/for_loop.rs:505:14 | -495 | for i in 10..256 { +505 | for i in 10..256 { | ^^^^^^^ help: try replacing the loop by | -495 | for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)]) -496 | dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256]) { +505 | for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)]) +506 | dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256]) { | error: it looks like you're manually copying between slices - --> $DIR/for_loop.rs:507:14 + --> $DIR/for_loop.rs:517:14 | -507 | for i in 10..LOOP_OFFSET { +517 | for i in 10..LOOP_OFFSET { | ^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[(10 + LOOP_OFFSET)..(LOOP_OFFSET + LOOP_OFFSET)].clone_from_slice(&src[(10 - some_var)..(LOOP_OFFSET - some_var)])` error: it looks like you're manually copying between slices - --> $DIR/for_loop.rs:520:14 + --> $DIR/for_loop.rs:530:14 | -520 | for i in 0..src_vec.len() { +530 | for i in 0..src_vec.len() { | ^^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst_vec[..src_vec.len()].clone_from_slice(&src_vec[..])` error: it looks like you're manually copying between slices - --> $DIR/for_loop.rs:547:14 + --> $DIR/for_loop.rs:557:14 | -547 | for i in 0..src.len() { +557 | for i in 0..src.len() { | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])` error: the variable `count` is used as a loop counter. Consider using `for (count, item) in text.chars().enumerate()` or similar iterators - --> $DIR/for_loop.rs:608:19 + --> $DIR/for_loop.rs:618:19 | -608 | for ch in text.chars() { +618 | for ch in text.chars() { | ^^^^^^^^^^^^ error: the variable `count` is used as a loop counter. Consider using `for (count, item) in text.chars().enumerate()` or similar iterators - --> $DIR/for_loop.rs:619:19 + --> $DIR/for_loop.rs:629:19 | -619 | for ch in text.chars() { +629 | for ch in text.chars() { | ^^^^^^^^^^^^ error: aborting due to 61 previous errors diff --git a/tests/ui/format.rs b/tests/ui/format.rs index 858c9fc8d..5679a5575 100644 --- a/tests/ui/format.rs +++ b/tests/ui/format.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::print_literal)] #![warn(clippy::useless_format)] diff --git a/tests/ui/format.stderr b/tests/ui/format.stderr index 520c1b794..c4ecd1dcc 100644 --- a/tests/ui/format.stderr +++ b/tests/ui/format.stderr @@ -1,71 +1,71 @@ error: useless use of `format!` - --> $DIR/format.rs:12:5 + --> $DIR/format.rs:22:5 | -12 | format!("foo"); +22 | format!("foo"); | ^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` | = note: `-D clippy::useless-format` implied by `-D warnings` -error: useless use of `format!` - --> $DIR/format.rs:14:5 - | -14 | format!("{}", "foo"); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` - | - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: useless use of `format!` - --> $DIR/format.rs:18:5 - | -18 | format!("{:+}", "foo"); // warn when the format makes no difference - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` - | - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: useless use of `format!` - --> $DIR/format.rs:19:5 - | -19 | format!("{:<}", "foo"); // warn when the format makes no difference - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` - | - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - error: useless use of `format!` --> $DIR/format.rs:24:5 | -24 | format!("{}", arg); - | ^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string()` +24 | format!("{}", "foo"); + | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: useless use of `format!` --> $DIR/format.rs:28:5 | -28 | format!("{:+}", arg); // warn when the format makes no difference - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string()` +28 | format!("{:+}", "foo"); // warn when the format makes no difference + | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: useless use of `format!` --> $DIR/format.rs:29:5 | -29 | format!("{:<}", arg); // warn when the format makes no difference +29 | format!("{:<}", "foo"); // warn when the format makes no difference + | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: useless use of `format!` + --> $DIR/format.rs:34:5 + | +34 | format!("{}", arg); + | ^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string()` + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: useless use of `format!` + --> $DIR/format.rs:38:5 + | +38 | format!("{:+}", arg); // warn when the format makes no difference | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: useless use of `format!` - --> $DIR/format.rs:56:5 + --> $DIR/format.rs:39:5 | -56 | format!("{}", 42.to_string()); +39 | format!("{:<}", arg); // warn when the format makes no difference + | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string()` + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: useless use of `format!` + --> $DIR/format.rs:66:5 + | +66 | format!("{}", 42.to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `to_string()` is enough: `42.to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: useless use of `format!` - --> $DIR/format.rs:58:5 + --> $DIR/format.rs:68:5 | -58 | format!("{}", x.display().to_string()); +68 | format!("{}", x.display().to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `to_string()` is enough: `x.display().to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/tests/ui/formatting.rs b/tests/ui/formatting.rs index 74d42f08f..15aff5a3b 100644 --- a/tests/ui/formatting.rs +++ b/tests/ui/formatting.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/formatting.stderr b/tests/ui/formatting.stderr index d9fee7366..e1620b221 100644 --- a/tests/ui/formatting.stderr +++ b/tests/ui/formatting.stderr @@ -1,87 +1,87 @@ error: this looks like an `else if` but the `else` is missing - --> $DIR/formatting.rs:15:6 + --> $DIR/formatting.rs:25:6 | -15 | } if foo() { +25 | } if foo() { | ^ | = note: `-D clippy::suspicious-else-formatting` implied by `-D warnings` = note: to remove this lint, add the missing `else` or add a new line before the second `if` error: this looks like an `else if` but the `else` is missing - --> $DIR/formatting.rs:22:10 + --> $DIR/formatting.rs:32:10 | -22 | } if foo() { +32 | } if foo() { | ^ | = note: to remove this lint, add the missing `else` or add a new line before the second `if` error: this looks like an `else if` but the `else` is missing - --> $DIR/formatting.rs:30:10 + --> $DIR/formatting.rs:40:10 | -30 | } if foo() { +40 | } if foo() { | ^ | = note: to remove this lint, add the missing `else` or add a new line before the second `if` error: this is an `else if` but the formatting might hide it - --> $DIR/formatting.rs:39:6 + --> $DIR/formatting.rs:49:6 | -39 | } else +49 | } else | ______^ -40 | | if foo() { // the span of the above error should continue here +50 | | if foo() { // the span of the above error should continue here | |____^ | = note: to remove this lint, remove the `else` or remove the new line between `else` and `if` error: this is an `else if` but the formatting might hide it - --> $DIR/formatting.rs:44:6 + --> $DIR/formatting.rs:54:6 | -44 | } +54 | } | ______^ -45 | | else -46 | | if foo() { // the span of the above error should continue here +55 | | else +56 | | if foo() { // the span of the above error should continue here | |____^ | = note: to remove this lint, remove the `else` or remove the new line between `else` and `if` error: this looks like you are trying to use `.. -= ..`, but you really are doing `.. = (- ..)` - --> $DIR/formatting.rs:71:6 + --> $DIR/formatting.rs:81:6 | -71 | a =- 35; +81 | a =- 35; | ^^^^ | = note: `-D clippy::suspicious-assignment-formatting` implied by `-D warnings` = note: to remove this lint, use either `-=` or `= -` error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)` - --> $DIR/formatting.rs:72:6 + --> $DIR/formatting.rs:82:6 | -72 | a =* &191; +82 | a =* &191; | ^^^^ | = note: to remove this lint, use either `*=` or `= *` error: this looks like you are trying to use `.. != ..`, but you really are doing `.. = (! ..)` - --> $DIR/formatting.rs:75:6 + --> $DIR/formatting.rs:85:6 | -75 | b =! false; +85 | b =! false; | ^^^^ | = note: to remove this lint, use either `!=` or `= !` error: possibly missing a comma here - --> $DIR/formatting.rs:84:19 + --> $DIR/formatting.rs:94:19 | -84 | -1, -2, -3 // <= no comma here +94 | -1, -2, -3 // <= no comma here | ^ | = note: `-D clippy::possible-missing-comma` implied by `-D warnings` = note: to remove this lint, add a comma or write the expr in a single line error: possibly missing a comma here - --> $DIR/formatting.rs:88:19 + --> $DIR/formatting.rs:98:19 | -88 | -1, -2, -3 // <= no comma here +98 | -1, -2, -3 // <= no comma here | ^ | = note: to remove this lint, add a comma or write the expr in a single line diff --git a/tests/ui/functions.rs b/tests/ui/functions.rs index ab5ce5b06..136adef82 100644 --- a/tests/ui/functions.rs +++ b/tests/ui/functions.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/functions.stderr b/tests/ui/functions.stderr index c2f7b76aa..9c45eb033 100644 --- a/tests/ui/functions.stderr +++ b/tests/ui/functions.stderr @@ -1,78 +1,78 @@ error: this function has too many arguments (8/7) - --> $DIR/functions.rs:11:1 + --> $DIR/functions.rs:21:1 | -11 | / fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) { -12 | | } +21 | / fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) { +22 | | } | |_^ | = note: `-D clippy::too-many-arguments` implied by `-D warnings` error: this function has too many arguments (8/7) - --> $DIR/functions.rs:19:5 + --> $DIR/functions.rs:29:5 | -19 | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()); +29 | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this function has too many arguments (8/7) - --> $DIR/functions.rs:28:5 + --> $DIR/functions.rs:38:5 | -28 | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} +38 | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:37:34 + --> $DIR/functions.rs:47:34 | -37 | println!("{}", unsafe { *p }); +47 | println!("{}", unsafe { *p }); | ^ | = note: `-D clippy::not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:38:35 + --> $DIR/functions.rs:48:35 | -38 | println!("{:?}", unsafe { p.as_ref() }); +48 | println!("{:?}", unsafe { p.as_ref() }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:39:33 + --> $DIR/functions.rs:49:33 | -39 | unsafe { std::ptr::read(p) }; +49 | unsafe { std::ptr::read(p) }; | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:50:30 + --> $DIR/functions.rs:60:30 | -50 | println!("{}", unsafe { *p }); +60 | println!("{}", unsafe { *p }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:51:31 + --> $DIR/functions.rs:61:31 | -51 | println!("{:?}", unsafe { p.as_ref() }); +61 | println!("{:?}", unsafe { p.as_ref() }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:52:29 + --> $DIR/functions.rs:62:29 | -52 | unsafe { std::ptr::read(p) }; +62 | unsafe { std::ptr::read(p) }; | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:61:34 + --> $DIR/functions.rs:71:34 | -61 | println!("{}", unsafe { *p }); +71 | println!("{}", unsafe { *p }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:62:35 + --> $DIR/functions.rs:72:35 | -62 | println!("{:?}", unsafe { p.as_ref() }); +72 | println!("{:?}", unsafe { p.as_ref() }); | ^ error: this public function dereferences a raw pointer but is not marked `unsafe` - --> $DIR/functions.rs:63:33 + --> $DIR/functions.rs:73:33 | -63 | unsafe { std::ptr::read(p) }; +73 | unsafe { std::ptr::read(p) }; | ^ error: aborting due to 12 previous errors diff --git a/tests/ui/fxhash.rs b/tests/ui/fxhash.rs index 1376b9442..e91cfcb9e 100644 --- a/tests/ui/fxhash.rs +++ b/tests/ui/fxhash.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::default_hash_types)] diff --git a/tests/ui/fxhash.stderr b/tests/ui/fxhash.stderr index 869a315c9..f5f8ae7e8 100644 --- a/tests/ui/fxhash.stderr +++ b/tests/ui/fxhash.stderr @@ -1,39 +1,39 @@ error: Prefer FxHashMap over HashMap, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:8:24 - | -8 | use std::collections::{HashMap, HashSet}; - | ^^^^^^^ help: use: `FxHashMap` - | - = note: `-D clippy::default-hash-types` implied by `-D warnings` + --> $DIR/fxhash.rs:18:24 + | +18 | use std::collections::{HashMap, HashSet}; + | ^^^^^^^ help: use: `FxHashMap` + | + = note: `-D clippy::default-hash-types` implied by `-D warnings` error: Prefer FxHashSet over HashSet, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:8:33 - | -8 | use std::collections::{HashMap, HashSet}; - | ^^^^^^^ help: use: `FxHashSet` + --> $DIR/fxhash.rs:18:33 + | +18 | use std::collections::{HashMap, HashSet}; + | ^^^^^^^ help: use: `FxHashSet` error: Prefer FxHashMap over HashMap, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:12:15 + --> $DIR/fxhash.rs:22:15 | -12 | let _map: HashMap = HashMap::default(); +22 | let _map: HashMap = HashMap::default(); | ^^^^^^^ help: use: `FxHashMap` error: Prefer FxHashMap over HashMap, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:12:41 + --> $DIR/fxhash.rs:22:41 | -12 | let _map: HashMap = HashMap::default(); +22 | let _map: HashMap = HashMap::default(); | ^^^^^^^ help: use: `FxHashMap` error: Prefer FxHashSet over HashSet, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:13:15 + --> $DIR/fxhash.rs:23:15 | -13 | let _set: HashSet = HashSet::default(); +23 | let _set: HashSet = HashSet::default(); | ^^^^^^^ help: use: `FxHashSet` error: Prefer FxHashSet over HashSet, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:13:33 + --> $DIR/fxhash.rs:23:33 | -13 | let _set: HashSet = HashSet::default(); +23 | let _set: HashSet = HashSet::default(); | ^^^^^^^ help: use: `FxHashSet` error: aborting due to 6 previous errors diff --git a/tests/ui/get_unwrap.rs b/tests/ui/get_unwrap.rs index 141233e0d..7b672c074 100644 --- a/tests/ui/get_unwrap.rs +++ b/tests/ui/get_unwrap.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![allow(unused_mut)] use std::collections::BTreeMap; diff --git a/tests/ui/get_unwrap.stderr b/tests/ui/get_unwrap.stderr index 669903da1..90b46e960 100644 --- a/tests/ui/get_unwrap.stderr +++ b/tests/ui/get_unwrap.stderr @@ -1,75 +1,75 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:27:17 + --> $DIR/get_unwrap.rs:37:17 | -27 | let _ = boxed_slice.get(1).unwrap(); +37 | let _ = boxed_slice.get(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]` | = note: `-D clippy::get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:28:17 + --> $DIR/get_unwrap.rs:38:17 | -28 | let _ = some_slice.get(0).unwrap(); +38 | let _ = some_slice.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_slice[0]` error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:29:17 + --> $DIR/get_unwrap.rs:39:17 | -29 | let _ = some_vec.get(0).unwrap(); +39 | let _ = some_vec.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vec[0]` error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:30:17 + --> $DIR/get_unwrap.rs:40:17 | -30 | let _ = some_vecdeque.get(0).unwrap(); +40 | let _ = some_vecdeque.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vecdeque[0]` error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:31:17 + --> $DIR/get_unwrap.rs:41:17 | -31 | let _ = some_hashmap.get(&1).unwrap(); +41 | let _ = some_hashmap.get(&1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_hashmap[&1]` error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:32:17 + --> $DIR/get_unwrap.rs:42:17 | -32 | let _ = some_btreemap.get(&1).unwrap(); +42 | let _ = some_btreemap.get(&1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_btreemap[&1]` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:37:10 + --> $DIR/get_unwrap.rs:47:10 | -37 | *boxed_slice.get_mut(0).unwrap() = 1; +47 | *boxed_slice.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut boxed_slice[0]` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:38:10 + --> $DIR/get_unwrap.rs:48:10 | -38 | *some_slice.get_mut(0).unwrap() = 1; +48 | *some_slice.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_slice[0]` error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:39:10 + --> $DIR/get_unwrap.rs:49:10 | -39 | *some_vec.get_mut(0).unwrap() = 1; +49 | *some_vec.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vec[0]` error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:40:10 + --> $DIR/get_unwrap.rs:50:10 | -40 | *some_vecdeque.get_mut(0).unwrap() = 1; +50 | *some_vecdeque.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vecdeque[0]` error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:48:17 + --> $DIR/get_unwrap.rs:58:17 | -48 | let _ = some_vec.get(0..1).unwrap().to_vec(); +58 | let _ = some_vec.get(0..1).unwrap().to_vec(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]` error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> $DIR/get_unwrap.rs:49:17 + --> $DIR/get_unwrap.rs:59:17 | -49 | let _ = some_vec.get_mut(0..1).unwrap().to_vec(); +59 | let _ = some_vec.get_mut(0..1).unwrap().to_vec(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]` error: aborting due to 12 previous errors diff --git a/tests/ui/identity_conversion.rs b/tests/ui/identity_conversion.rs index b9ad8d06a..a4f5babec 100644 --- a/tests/ui/identity_conversion.rs +++ b/tests/ui/identity_conversion.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::identity_conversion)] diff --git a/tests/ui/identity_conversion.stderr b/tests/ui/identity_conversion.stderr index ffcd3649a..2ac741919 100644 --- a/tests/ui/identity_conversion.stderr +++ b/tests/ui/identity_conversion.stderr @@ -1,61 +1,61 @@ error: identical conversion - --> $DIR/identity_conversion.rs:6:13 - | -6 | let _ = T::from(val); - | ^^^^^^^^^^^^ help: consider removing `T::from()`: `val` - | -note: lint level defined here - --> $DIR/identity_conversion.rs:3:9 - | -3 | #![deny(clippy::identity_conversion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: identical conversion - --> $DIR/identity_conversion.rs:7:5 - | -7 | val.into() - | ^^^^^^^^^^ help: consider removing `.into()`: `val` - -error: identical conversion - --> $DIR/identity_conversion.rs:19:22 + --> $DIR/identity_conversion.rs:16:13 | -19 | let _: i32 = 0i32.into(); +16 | let _ = T::from(val); + | ^^^^^^^^^^^^ help: consider removing `T::from()`: `val` + | +note: lint level defined here + --> $DIR/identity_conversion.rs:13:9 + | +13 | #![deny(clippy::identity_conversion)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: identical conversion + --> $DIR/identity_conversion.rs:17:5 + | +17 | val.into() + | ^^^^^^^^^^ help: consider removing `.into()`: `val` + +error: identical conversion + --> $DIR/identity_conversion.rs:29:22 + | +29 | let _: i32 = 0i32.into(); | ^^^^^^^^^^^ help: consider removing `.into()`: `0i32` error: identical conversion - --> $DIR/identity_conversion.rs:40:21 + --> $DIR/identity_conversion.rs:50:21 | -40 | let _: String = "foo".to_string().into(); +50 | let _: String = "foo".to_string().into(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()` error: identical conversion - --> $DIR/identity_conversion.rs:41:21 + --> $DIR/identity_conversion.rs:51:21 | -41 | let _: String = From::from("foo".to_string()); +51 | let _: String = From::from("foo".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()` error: identical conversion - --> $DIR/identity_conversion.rs:42:13 + --> $DIR/identity_conversion.rs:52:13 | -42 | let _ = String::from("foo".to_string()); +52 | let _ = String::from("foo".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()` error: identical conversion - --> $DIR/identity_conversion.rs:43:13 + --> $DIR/identity_conversion.rs:53:13 | -43 | let _ = String::from(format!("A: {:04}", 123)); +53 | let _ = String::from(format!("A: {:04}", 123)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)` error: identical conversion - --> $DIR/identity_conversion.rs:44:13 + --> $DIR/identity_conversion.rs:54:13 | -44 | let _ = "".lines().into_iter(); +54 | let _ = "".lines().into_iter(); | ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()` error: identical conversion - --> $DIR/identity_conversion.rs:45:13 + --> $DIR/identity_conversion.rs:55:13 | -45 | let _ = vec![1, 2, 3].into_iter().into_iter(); +55 | let _ = vec![1, 2, 3].into_iter().into_iter(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()` error: aborting due to 9 previous errors diff --git a/tests/ui/identity_op.rs b/tests/ui/identity_op.rs index ae8c66faa..35afb8510 100644 --- a/tests/ui/identity_op.rs +++ b/tests/ui/identity_op.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/identity_op.stderr b/tests/ui/identity_op.stderr index e494250c0..332350fd1 100644 --- a/tests/ui/identity_op.stderr +++ b/tests/ui/identity_op.stderr @@ -1,51 +1,51 @@ error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:13:5 + --> $DIR/identity_op.rs:23:5 | -13 | x + 0; +23 | x + 0; | ^^^^^ | = note: `-D clippy::identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:14:5 + --> $DIR/identity_op.rs:24:5 | -14 | x + (1 - 1); +24 | x + (1 - 1); | ^^^^^^^^^^^ error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:16:5 + --> $DIR/identity_op.rs:26:5 | -16 | 0 + x; - | ^^^^^ - -error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:19:5 - | -19 | x | (0); - | ^^^^^^^ - -error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:22:5 - | -22 | x * 1; - | ^^^^^ - -error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:23:5 - | -23 | 1 * x; +26 | 0 + x; | ^^^^^ error: the operation is ineffective. Consider reducing it to `x` --> $DIR/identity_op.rs:29:5 | -29 | -1 & x; +29 | x | (0); + | ^^^^^^^ + +error: the operation is ineffective. Consider reducing it to `x` + --> $DIR/identity_op.rs:32:5 + | +32 | x * 1; + | ^^^^^ + +error: the operation is ineffective. Consider reducing it to `x` + --> $DIR/identity_op.rs:33:5 + | +33 | 1 * x; + | ^^^^^ + +error: the operation is ineffective. Consider reducing it to `x` + --> $DIR/identity_op.rs:39:5 + | +39 | -1 & x; | ^^^^^^ error: the operation is ineffective. Consider reducing it to `u` - --> $DIR/identity_op.rs:32:5 + --> $DIR/identity_op.rs:42:5 | -32 | u & 255; +42 | u & 255; | ^^^^^^^ error: aborting due to 8 previous errors diff --git a/tests/ui/if_let_redundant_pattern_matching.rs b/tests/ui/if_let_redundant_pattern_matching.rs index 90265853f..84f4b711f 100644 --- a/tests/ui/if_let_redundant_pattern_matching.rs +++ b/tests/ui/if_let_redundant_pattern_matching.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/if_let_redundant_pattern_matching.stderr b/tests/ui/if_let_redundant_pattern_matching.stderr index 904662585..00eb78855 100644 --- a/tests/ui/if_let_redundant_pattern_matching.stderr +++ b/tests/ui/if_let_redundant_pattern_matching.stderr @@ -1,27 +1,27 @@ error: redundant pattern matching, consider using `is_ok()` - --> $DIR/if_let_redundant_pattern_matching.rs:9:12 - | -9 | if let Ok(_) = Ok::(42) {} - | -------^^^^^--------------------- help: try this: `if Ok::(42).is_ok()` - | - = note: `-D clippy::if-let-redundant-pattern-matching` implied by `-D warnings` + --> $DIR/if_let_redundant_pattern_matching.rs:19:12 + | +19 | if let Ok(_) = Ok::(42) {} + | -------^^^^^--------------------- help: try this: `if Ok::(42).is_ok()` + | + = note: `-D clippy::if-let-redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_err()` - --> $DIR/if_let_redundant_pattern_matching.rs:11:12 + --> $DIR/if_let_redundant_pattern_matching.rs:21:12 | -11 | if let Err(_) = Err::(42) { +21 | if let Err(_) = Err::(42) { | -------^^^^^^---------------------- help: try this: `if Err::(42).is_err()` error: redundant pattern matching, consider using `is_none()` - --> $DIR/if_let_redundant_pattern_matching.rs:14:12 + --> $DIR/if_let_redundant_pattern_matching.rs:24:12 | -14 | if let None = None::<()> { +24 | if let None = None::<()> { | -------^^^^------------- help: try this: `if None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/if_let_redundant_pattern_matching.rs:17:12 + --> $DIR/if_let_redundant_pattern_matching.rs:27:12 | -17 | if let Some(_) = Some(42) { +27 | if let Some(_) = Some(42) { | -------^^^^^^^----------- help: try this: `if Some(42).is_some()` error: aborting due to 4 previous errors diff --git a/tests/ui/if_not_else.rs b/tests/ui/if_not_else.rs index bb16e1670..b0744d8c6 100644 --- a/tests/ui/if_not_else.rs +++ b/tests/ui/if_not_else.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all)] diff --git a/tests/ui/if_not_else.stderr b/tests/ui/if_not_else.stderr index 9682f6dc1..a054ac622 100644 --- a/tests/ui/if_not_else.stderr +++ b/tests/ui/if_not_else.stderr @@ -1,24 +1,24 @@ error: Unnecessary boolean `not` operation - --> $DIR/if_not_else.rs:9:5 + --> $DIR/if_not_else.rs:19:5 | -9 | / if !bla() { -10 | | println!("Bugs"); -11 | | } else { -12 | | println!("Bunny"); -13 | | } +19 | / if !bla() { +20 | | println!("Bugs"); +21 | | } else { +22 | | println!("Bunny"); +23 | | } | |_____^ | = note: `-D clippy::if-not-else` implied by `-D warnings` = help: remove the `!` and swap the blocks of the if/else error: Unnecessary `!=` operation - --> $DIR/if_not_else.rs:14:5 + --> $DIR/if_not_else.rs:24:5 | -14 | / if 4 != 5 { -15 | | println!("Bugs"); -16 | | } else { -17 | | println!("Bunny"); -18 | | } +24 | / if 4 != 5 { +25 | | println!("Bugs"); +26 | | } else { +27 | | println!("Bunny"); +28 | | } | |_____^ | = help: change to `==` and swap the blocks of the if/else diff --git a/tests/ui/impl.rs b/tests/ui/impl.rs index 7da0e04e5..6c2152220 100644 --- a/tests/ui/impl.rs +++ b/tests/ui/impl.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(dead_code)] diff --git a/tests/ui/impl.stderr b/tests/ui/impl.stderr index 13d4a7655..c24a96e8a 100644 --- a/tests/ui/impl.stderr +++ b/tests/ui/impl.stderr @@ -1,34 +1,34 @@ error: Multiple implementations of this structure - --> $DIR/impl.rs:12:1 + --> $DIR/impl.rs:22:1 | -12 | / impl MyStruct { -13 | | fn second() {} -14 | | } +22 | / impl MyStruct { +23 | | fn second() {} +24 | | } | |_^ | = note: `-D clippy::multiple-inherent-impl` implied by `-D warnings` note: First implementation here - --> $DIR/impl.rs:8:1 + --> $DIR/impl.rs:18:1 | -8 | / impl MyStruct { -9 | | fn first() {} -10 | | } +18 | / impl MyStruct { +19 | | fn first() {} +20 | | } | |_^ error: Multiple implementations of this structure - --> $DIR/impl.rs:26:5 + --> $DIR/impl.rs:36:5 | -26 | / impl super::MyStruct { -27 | | fn third() {} -28 | | } +36 | / impl super::MyStruct { +37 | | fn third() {} +38 | | } | |_____^ | note: First implementation here - --> $DIR/impl.rs:8:1 + --> $DIR/impl.rs:18:1 | -8 | / impl MyStruct { -9 | | fn first() {} -10 | | } +18 | / impl MyStruct { +19 | | fn first() {} +20 | | } | |_^ error: aborting due to 2 previous errors diff --git a/tests/ui/implicit_hasher.rs b/tests/ui/implicit_hasher.rs index 49df39ca7..a6be909c0 100644 --- a/tests/ui/implicit_hasher.rs +++ b/tests/ui/implicit_hasher.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![allow(unused)] use std::collections::{HashMap, HashSet}; diff --git a/tests/ui/implicit_hasher.stderr b/tests/ui/implicit_hasher.stderr index 5bb6f11b2..c561e0a3d 100644 --- a/tests/ui/implicit_hasher.stderr +++ b/tests/ui/implicit_hasher.stderr @@ -1,136 +1,136 @@ error: impl for `HashMap` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:11:35 + --> $DIR/implicit_hasher.rs:21:35 | -11 | impl Foo for HashMap { +21 | impl Foo for HashMap { | ^^^^^^^^^^^^^ | = note: `-D clippy::implicit-hasher` implied by `-D warnings` help: consider adding a type parameter | -11 | impl Foo for HashMap { +21 | impl Foo for HashMap { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ help: ...and use generic constructor | -17 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default())) - | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: impl for `HashMap` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:20:36 - | -20 | impl Foo for (HashMap,) { - | ^^^^^^^^^^^^^ -help: consider adding a type parameter - | -20 | impl Foo for (HashMap,) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ -help: ...and use generic constructor - | -22 | ((HashMap::default(),), (HashMap::with_capacity_and_hasher(10, Default::default()),)) - | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: impl for `HashMap` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:25:19 - | -25 | impl Foo for HashMap { - | ^^^^^^^^^^^^^^^^^^^^^^^ -help: consider adding a type parameter - | -25 | impl Foo for HashMap { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: ...and use generic constructor - | 27 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default())) | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: impl for `HashSet` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:43:32 +error: impl for `HashMap` should be generalized over different hashers + --> $DIR/implicit_hasher.rs:30:36 | -43 | impl Foo for HashSet { +30 | impl Foo for (HashMap,) { + | ^^^^^^^^^^^^^ +help: consider adding a type parameter + | +30 | impl Foo for (HashMap,) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ +help: ...and use generic constructor + | +32 | ((HashMap::default(),), (HashMap::with_capacity_and_hasher(10, Default::default()),)) + | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: impl for `HashMap` should be generalized over different hashers + --> $DIR/implicit_hasher.rs:35:19 + | +35 | impl Foo for HashMap { + | ^^^^^^^^^^^^^^^^^^^^^^^ +help: consider adding a type parameter + | +35 | impl Foo for HashMap { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: ...and use generic constructor + | +37 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default())) + | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: impl for `HashSet` should be generalized over different hashers + --> $DIR/implicit_hasher.rs:53:32 + | +53 | impl Foo for HashSet { | ^^^^^^^^^^ help: consider adding a type parameter | -43 | impl Foo for HashSet { +53 | impl Foo for HashSet { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ help: ...and use generic constructor | -45 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default())) +55 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default())) | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: impl for `HashSet` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:48:19 + --> $DIR/implicit_hasher.rs:58:19 | -48 | impl Foo for HashSet { +58 | impl Foo for HashSet { | ^^^^^^^^^^^^^^^ help: consider adding a type parameter | -48 | impl Foo for HashSet { +58 | impl Foo for HashSet { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ help: ...and use generic constructor | -50 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default())) +60 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default())) | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: parameter of type `HashMap` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:65:23 + --> $DIR/implicit_hasher.rs:75:23 | -65 | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) { +75 | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) { | ^^^^^^^^^^^^^^^^^ help: consider adding a type parameter | -65 | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) { +75 | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ error: parameter of type `HashSet` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:65:53 + --> $DIR/implicit_hasher.rs:75:53 | -65 | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) { +75 | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) { | ^^^^^^^^^^^^ help: consider adding a type parameter | -65 | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) { +75 | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ error: impl for `HashMap` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:70:43 + --> $DIR/implicit_hasher.rs:80:43 | -70 | impl Foo for HashMap { +80 | impl Foo for HashMap { | ^^^^^^^^^^^^^ ... -83 | gen!(impl); +93 | gen!(impl); | ----------- in this macro invocation help: consider adding a type parameter | -70 | impl Foo for HashMap { +80 | impl Foo for HashMap { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ help: ...and use generic constructor | -72 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default())) +82 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default())) | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: parameter of type `HashMap` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:78:33 + --> $DIR/implicit_hasher.rs:88:33 | -78 | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) { +88 | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) { | ^^^^^^^^^^^^^^^^^ ... -84 | gen!(fn bar); +94 | gen!(fn bar); | ------------- in this macro invocation help: consider adding a type parameter | -78 | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) { +88 | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ error: parameter of type `HashSet` should be generalized over different hashers - --> $DIR/implicit_hasher.rs:78:63 + --> $DIR/implicit_hasher.rs:88:63 | -78 | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) { +88 | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) { | ^^^^^^^^^^^^ ... -84 | gen!(fn bar); +94 | gen!(fn bar); | ------------- in this macro invocation help: consider adding a type parameter | -78 | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) { +88 | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ error: aborting due to 10 previous errors diff --git a/tests/ui/inconsistent_digit_grouping.rs b/tests/ui/inconsistent_digit_grouping.rs index 056d87611..dc73952ca 100644 --- a/tests/ui/inconsistent_digit_grouping.rs +++ b/tests/ui/inconsistent_digit_grouping.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #[warn(clippy::inconsistent_digit_grouping)] diff --git a/tests/ui/inconsistent_digit_grouping.stderr b/tests/ui/inconsistent_digit_grouping.stderr index 51eeca2b8..a41739462 100644 --- a/tests/ui/inconsistent_digit_grouping.stderr +++ b/tests/ui/inconsistent_digit_grouping.stderr @@ -1,34 +1,34 @@ error: digits grouped inconsistently by underscores - --> $DIR/inconsistent_digit_grouping.rs:7:16 - | -7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); - | ^^^^^^^^ help: consider: `123_456` - | - = note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings` + --> $DIR/inconsistent_digit_grouping.rs:17:16 + | +17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); + | ^^^^^^^^ help: consider: `123_456` + | + = note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings` error: digits grouped inconsistently by underscores - --> $DIR/inconsistent_digit_grouping.rs:7:26 - | -7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); - | ^^^^^^^^^^ help: consider: `12_345_678` + --> $DIR/inconsistent_digit_grouping.rs:17:26 + | +17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); + | ^^^^^^^^^^ help: consider: `12_345_678` error: digits grouped inconsistently by underscores - --> $DIR/inconsistent_digit_grouping.rs:7:38 - | -7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); - | ^^^^^^^^ help: consider: `1_234_567` + --> $DIR/inconsistent_digit_grouping.rs:17:38 + | +17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); + | ^^^^^^^^ help: consider: `1_234_567` error: digits grouped inconsistently by underscores - --> $DIR/inconsistent_digit_grouping.rs:7:48 - | -7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); - | ^^^^^^^^^^^^^^ help: consider: `1_234.567_8_f32` + --> $DIR/inconsistent_digit_grouping.rs:17:48 + | +17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); + | ^^^^^^^^^^^^^^ help: consider: `1_234.567_8_f32` error: digits grouped inconsistently by underscores - --> $DIR/inconsistent_digit_grouping.rs:7:64 - | -7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); - | ^^^^^^^^^^^^^^ help: consider: `1.234_567_8_f32` + --> $DIR/inconsistent_digit_grouping.rs:17:64 + | +17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); + | ^^^^^^^^^^^^^^ help: consider: `1.234_567_8_f32` error: aborting due to 5 previous errors diff --git a/tests/ui/indexing_slicing.rs b/tests/ui/indexing_slicing.rs index b9f1c4a4a..8d3f3cee9 100644 --- a/tests/ui/indexing_slicing.rs +++ b/tests/ui/indexing_slicing.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(plugin)] diff --git a/tests/ui/indexing_slicing.stderr b/tests/ui/indexing_slicing.stderr index 3f09a6516..7d847c7a6 100644 --- a/tests/ui/indexing_slicing.stderr +++ b/tests/ui/indexing_slicing.stderr @@ -1,268 +1,268 @@ error: indexing may panic. - --> $DIR/indexing_slicing.rs:13:5 + --> $DIR/indexing_slicing.rs:23:5 | -13 | x[index]; +23 | x[index]; | ^^^^^^^^ | = note: `-D clippy::indexing-slicing` implied by `-D warnings` = help: Consider using `.get(n)` or `.get_mut(n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:14:6 + --> $DIR/indexing_slicing.rs:24:6 | -14 | &x[index..]; +24 | &x[index..]; | ^^^^^^^^^^ | = help: Consider using `.get(n..)` or .get_mut(n..)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:15:6 + --> $DIR/indexing_slicing.rs:25:6 | -15 | &x[..index]; +25 | &x[..index]; | ^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:16:6 + --> $DIR/indexing_slicing.rs:26:6 | -16 | &x[index_from..index_to]; +26 | &x[index_from..index_to]; | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:17:6 + --> $DIR/indexing_slicing.rs:27:6 | -17 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to]. +27 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to]. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:17:6 + --> $DIR/indexing_slicing.rs:27:6 | -17 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to]. +27 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to]. | ^^^^^^^^^^^^^^^ | = help: Consider using `.get(n..)` or .get_mut(n..)` instead error: range is out of bounds - --> $DIR/indexing_slicing.rs:20:6 + --> $DIR/indexing_slicing.rs:30:6 | -20 | &x[..=4]; +30 | &x[..=4]; | ^^^^^^^ | = note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> $DIR/indexing_slicing.rs:21:6 + --> $DIR/indexing_slicing.rs:31:6 | -21 | &x[1..5]; +31 | &x[1..5]; | ^^^^^^^ error: slicing may panic. - --> $DIR/indexing_slicing.rs:22:6 + --> $DIR/indexing_slicing.rs:32:6 | -22 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10]. +32 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10]. | ^^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: range is out of bounds - --> $DIR/indexing_slicing.rs:22:6 + --> $DIR/indexing_slicing.rs:32:6 | -22 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10]. +32 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10]. | ^^^^^^ error: range is out of bounds - --> $DIR/indexing_slicing.rs:23:6 + --> $DIR/indexing_slicing.rs:33:6 | -23 | &x[5..]; +33 | &x[5..]; | ^^^^^^ error: range is out of bounds - --> $DIR/indexing_slicing.rs:24:6 + --> $DIR/indexing_slicing.rs:34:6 | -24 | &x[..5]; +34 | &x[..5]; | ^^^^^^ error: range is out of bounds - --> $DIR/indexing_slicing.rs:25:6 + --> $DIR/indexing_slicing.rs:35:6 | -25 | &x[5..].iter().map(|x| 2 * x).collect::>(); +35 | &x[5..].iter().map(|x| 2 * x).collect::>(); | ^^^^^^ error: range is out of bounds - --> $DIR/indexing_slicing.rs:26:6 + --> $DIR/indexing_slicing.rs:36:6 | -26 | &x[0..=4]; +36 | &x[0..=4]; | ^^^^^^^^ error: slicing may panic. - --> $DIR/indexing_slicing.rs:27:6 + --> $DIR/indexing_slicing.rs:37:6 | -27 | &x[0..][..3]; +37 | &x[0..][..3]; | ^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:28:6 + --> $DIR/indexing_slicing.rs:38:6 | -28 | &x[1..][..5]; +38 | &x[1..][..5]; | ^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:41:5 + --> $DIR/indexing_slicing.rs:51:5 | -41 | y[0]; +51 | y[0]; | ^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:42:6 - | -42 | &y[1..2]; - | ^^^^^^^ - | - = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead - -error: slicing may panic. - --> $DIR/indexing_slicing.rs:43:6 - | -43 | &y[0..=4]; - | ^^^^^^^^ - | - = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead - -error: slicing may panic. - --> $DIR/indexing_slicing.rs:44:6 - | -44 | &y[..=4]; - | ^^^^^^^ - | - = help: Consider using `.get(..n)`or `.get_mut(..n)` instead - -error: range is out of bounds - --> $DIR/indexing_slicing.rs:50:6 - | -50 | &empty[1..5]; - | ^^^^^^^^^^^ - -error: range is out of bounds - --> $DIR/indexing_slicing.rs:51:6 - | -51 | &empty[0..=4]; - | ^^^^^^^^^^^^ - -error: range is out of bounds --> $DIR/indexing_slicing.rs:52:6 | -52 | &empty[..=4]; +52 | &y[1..2]; + | ^^^^^^^ + | + = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead + +error: slicing may panic. + --> $DIR/indexing_slicing.rs:53:6 + | +53 | &y[0..=4]; + | ^^^^^^^^ + | + = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead + +error: slicing may panic. + --> $DIR/indexing_slicing.rs:54:6 + | +54 | &y[..=4]; + | ^^^^^^^ + | + = help: Consider using `.get(..n)`or `.get_mut(..n)` instead + +error: range is out of bounds + --> $DIR/indexing_slicing.rs:60:6 + | +60 | &empty[1..5]; | ^^^^^^^^^^^ error: range is out of bounds - --> $DIR/indexing_slicing.rs:53:6 + --> $DIR/indexing_slicing.rs:61:6 | -53 | &empty[1..]; - | ^^^^^^^^^^ - -error: range is out of bounds - --> $DIR/indexing_slicing.rs:54:6 - | -54 | &empty[..4]; - | ^^^^^^^^^^ - -error: range is out of bounds - --> $DIR/indexing_slicing.rs:55:6 - | -55 | &empty[0..=0]; +61 | &empty[0..=4]; | ^^^^^^^^^^^^ error: range is out of bounds - --> $DIR/indexing_slicing.rs:56:6 + --> $DIR/indexing_slicing.rs:62:6 | -56 | &empty[..=0]; +62 | &empty[..=4]; + | ^^^^^^^^^^^ + +error: range is out of bounds + --> $DIR/indexing_slicing.rs:63:6 + | +63 | &empty[1..]; + | ^^^^^^^^^^ + +error: range is out of bounds + --> $DIR/indexing_slicing.rs:64:6 + | +64 | &empty[..4]; + | ^^^^^^^^^^ + +error: range is out of bounds + --> $DIR/indexing_slicing.rs:65:6 + | +65 | &empty[0..=0]; + | ^^^^^^^^^^^^ + +error: range is out of bounds + --> $DIR/indexing_slicing.rs:66:6 + | +66 | &empty[..=0]; | ^^^^^^^^^^^ error: indexing may panic. - --> $DIR/indexing_slicing.rs:64:5 + --> $DIR/indexing_slicing.rs:74:5 | -64 | v[0]; +74 | v[0]; | ^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:65:5 + --> $DIR/indexing_slicing.rs:75:5 | -65 | v[10]; +75 | v[10]; | ^^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:66:5 + --> $DIR/indexing_slicing.rs:76:5 | -66 | v[1 << 3]; +76 | v[1 << 3]; | ^^^^^^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:67:6 + --> $DIR/indexing_slicing.rs:77:6 | -67 | &v[10..100]; +77 | &v[10..100]; | ^^^^^^^^^^ | = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:68:6 + --> $DIR/indexing_slicing.rs:78:6 | -68 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100]. +78 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100]. | ^^^^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: range is out of bounds - --> $DIR/indexing_slicing.rs:68:6 + --> $DIR/indexing_slicing.rs:78:6 | -68 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100]. +78 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100]. | ^^^^^^^ error: slicing may panic. - --> $DIR/indexing_slicing.rs:69:6 + --> $DIR/indexing_slicing.rs:79:6 | -69 | &v[10..]; +79 | &v[10..]; | ^^^^^^^ | = help: Consider using `.get(n..)` or .get_mut(n..)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:70:6 + --> $DIR/indexing_slicing.rs:80:6 | -70 | &v[..100]; +80 | &v[..100]; | ^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:82:5 + --> $DIR/indexing_slicing.rs:92:5 | -82 | v[N]; +92 | v[N]; | ^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:83:5 + --> $DIR/indexing_slicing.rs:93:5 | -83 | v[M]; +93 | v[M]; | ^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead diff --git a/tests/ui/infallible_destructuring_match.rs b/tests/ui/infallible_destructuring_match.rs index b3e2835d7..bd4e4b49a 100644 --- a/tests/ui/infallible_destructuring_match.rs +++ b/tests/ui/infallible_destructuring_match.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(exhaustive_patterns, never_type)] diff --git a/tests/ui/infallible_destructuring_match.stderr b/tests/ui/infallible_destructuring_match.stderr index 6e26741fc..bce83b912 100644 --- a/tests/ui/infallible_destructuring_match.stderr +++ b/tests/ui/infallible_destructuring_match.stderr @@ -1,27 +1,27 @@ error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let` - --> $DIR/infallible_destructuring_match.rs:18:5 + --> $DIR/infallible_destructuring_match.rs:28:5 | -18 | / let data = match wrapper { -19 | | SingleVariantEnum::Variant(i) => i, -20 | | }; +28 | / let data = match wrapper { +29 | | SingleVariantEnum::Variant(i) => i, +30 | | }; | |______^ help: try this: `let SingleVariantEnum::Variant(data) = wrapper;` | = note: `-D clippy::infallible-destructuring-match` implied by `-D warnings` error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let` - --> $DIR/infallible_destructuring_match.rs:39:5 + --> $DIR/infallible_destructuring_match.rs:49:5 | -39 | / let data = match wrapper { -40 | | TupleStruct(i) => i, -41 | | }; +49 | / let data = match wrapper { +50 | | TupleStruct(i) => i, +51 | | }; | |______^ help: try this: `let TupleStruct(data) = wrapper;` error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let` - --> $DIR/infallible_destructuring_match.rs:60:5 + --> $DIR/infallible_destructuring_match.rs:70:5 | -60 | / let data = match wrapper { -61 | | Ok(i) => i, -62 | | }; +70 | / let data = match wrapper { +71 | | Ok(i) => i, +72 | | }; | |______^ help: try this: `let Ok(data) = wrapper;` error: aborting due to 3 previous errors diff --git a/tests/ui/infinite_iter.rs b/tests/ui/infinite_iter.rs index 44fa934aa..cf30a2e35 100644 --- a/tests/ui/infinite_iter.rs +++ b/tests/ui/infinite_iter.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] use std::iter::repeat; diff --git a/tests/ui/infinite_iter.stderr b/tests/ui/infinite_iter.stderr index c3d67bdfd..5b783c2b8 100644 --- a/tests/ui/infinite_iter.stderr +++ b/tests/ui/infinite_iter.stderr @@ -1,99 +1,99 @@ error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator - --> $DIR/infinite_iter.rs:10:5 + --> $DIR/infinite_iter.rs:20:5 | -10 | repeat(0_u8).collect::>(); // infinite iter +20 | repeat(0_u8).collect::>(); // infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unused-collect` implied by `-D warnings` error: infinite iteration detected - --> $DIR/infinite_iter.rs:10:5 + --> $DIR/infinite_iter.rs:20:5 | -10 | repeat(0_u8).collect::>(); // infinite iter +20 | repeat(0_u8).collect::>(); // infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/infinite_iter.rs:8:8 + --> $DIR/infinite_iter.rs:18:8 | -8 | #[deny(clippy::infinite_iter)] +18 | #[deny(clippy::infinite_iter)] | ^^^^^^^^^^^^^^^^^^^^^ error: infinite iteration detected - --> $DIR/infinite_iter.rs:11:5 + --> $DIR/infinite_iter.rs:21:5 | -11 | (0..8_u32).take_while(square_is_lower_64).cycle().count(); // infinite iter +21 | (0..8_u32).take_while(square_is_lower_64).cycle().count(); // infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: infinite iteration detected - --> $DIR/infinite_iter.rs:12:5 + --> $DIR/infinite_iter.rs:22:5 | -12 | (0..8_u64).chain(0..).max(); // infinite iter +22 | (0..8_u64).chain(0..).max(); // infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: infinite iteration detected - --> $DIR/infinite_iter.rs:14:5 + --> $DIR/infinite_iter.rs:24:5 | -14 | (0..8_u32).rev().cycle().map(|x| x + 1_u32).for_each(|x| println!("{}", x)); // infinite iter +24 | (0..8_u32).rev().cycle().map(|x| x + 1_u32).for_each(|x| println!("{}", x)); // infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: infinite iteration detected - --> $DIR/infinite_iter.rs:16:5 + --> $DIR/infinite_iter.rs:26:5 | -16 | (0_usize..).flat_map(|x| 0..x).product::(); // infinite iter +26 | (0_usize..).flat_map(|x| 0..x).product::(); // infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: infinite iteration detected - --> $DIR/infinite_iter.rs:17:5 + --> $DIR/infinite_iter.rs:27:5 | -17 | (0_u64..).filter(|x| x % 2 == 0).last(); // infinite iter +27 | (0_u64..).filter(|x| x % 2 == 0).last(); // infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: possible infinite iteration detected - --> $DIR/infinite_iter.rs:24:5 + --> $DIR/infinite_iter.rs:34:5 | -24 | (0..).zip((0..).take_while(square_is_lower_64)).count(); // maybe infinite iter +34 | (0..).zip((0..).take_while(square_is_lower_64)).count(); // maybe infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/infinite_iter.rs:22:8 + --> $DIR/infinite_iter.rs:32:8 | -22 | #[deny(clippy::maybe_infinite_iter)] +32 | #[deny(clippy::maybe_infinite_iter)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: possible infinite iteration detected - --> $DIR/infinite_iter.rs:25:5 + --> $DIR/infinite_iter.rs:35:5 | -25 | repeat(42).take_while(|x| *x == 42).chain(0..42).max(); // maybe infinite iter +35 | repeat(42).take_while(|x| *x == 42).chain(0..42).max(); // maybe infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: possible infinite iteration detected - --> $DIR/infinite_iter.rs:26:5 + --> $DIR/infinite_iter.rs:36:5 | -26 | (1..).scan(0, |state, x| { *state += x; Some(*state) }).min(); // maybe infinite iter +36 | (1..).scan(0, |state, x| { *state += x; Some(*state) }).min(); // maybe infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: possible infinite iteration detected - --> $DIR/infinite_iter.rs:27:5 + --> $DIR/infinite_iter.rs:37:5 | -27 | (0..).find(|x| *x == 24); // maybe infinite iter +37 | (0..).find(|x| *x == 24); // maybe infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^ error: possible infinite iteration detected - --> $DIR/infinite_iter.rs:28:5 + --> $DIR/infinite_iter.rs:38:5 | -28 | (0..).position(|x| x == 24); // maybe infinite iter +38 | (0..).position(|x| x == 24); // maybe infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: possible infinite iteration detected - --> $DIR/infinite_iter.rs:29:5 + --> $DIR/infinite_iter.rs:39:5 | -29 | (0..).any(|x| x == 24); // maybe infinite iter +39 | (0..).any(|x| x == 24); // maybe infinite iter | ^^^^^^^^^^^^^^^^^^^^^^ error: possible infinite iteration detected - --> $DIR/infinite_iter.rs:30:5 + --> $DIR/infinite_iter.rs:40:5 | -30 | (0..).all(|x| x == 24); // maybe infinite iter +40 | (0..).all(|x| x == 24); // maybe infinite iter | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 14 previous errors diff --git a/tests/ui/infinite_loop.rs b/tests/ui/infinite_loop.rs index 9449a295e..e837e563f 100644 --- a/tests/ui/infinite_loop.rs +++ b/tests/ui/infinite_loop.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::trivially_copy_pass_by_ref)] diff --git a/tests/ui/infinite_loop.stderr b/tests/ui/infinite_loop.stderr index edbe49374..fdbdd13fd 100644 --- a/tests/ui/infinite_loop.stderr +++ b/tests/ui/infinite_loop.stderr @@ -1,57 +1,57 @@ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:16:11 + --> $DIR/infinite_loop.rs:26:11 | -16 | while y < 10 { +26 | while y < 10 { | ^^^^^^ | = note: #[deny(clippy::while_immutable_condition)] on by default error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:21:11 + --> $DIR/infinite_loop.rs:31:11 | -21 | while y < 10 && x < 3 { +31 | while y < 10 && x < 3 { | ^^^^^^^^^^^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:28:11 + --> $DIR/infinite_loop.rs:38:11 | -28 | while !cond { +38 | while !cond { | ^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:72:11 + --> $DIR/infinite_loop.rs:82:11 | -72 | while i < 3 { +82 | while i < 3 { | ^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:77:11 + --> $DIR/infinite_loop.rs:87:11 | -77 | while i < 3 && j > 0 { +87 | while i < 3 && j > 0 { | ^^^^^^^^^^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:81:11 + --> $DIR/infinite_loop.rs:91:11 | -81 | while i < 3 { +91 | while i < 3 { | ^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:96:11 - | -96 | while i < 3 { - | ^^^^^ - -error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:101:11 + --> $DIR/infinite_loop.rs:106:11 | -101 | while i < 3 { +106 | while i < 3 { | ^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:164:15 + --> $DIR/infinite_loop.rs:111:11 | -164 | while self.count < n { +111 | while i < 3 { + | ^^^^^ + +error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. + --> $DIR/infinite_loop.rs:174:15 + | +174 | while self.count < n { | ^^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/tests/ui/inline_fn_without_body.rs b/tests/ui/inline_fn_without_body.rs index 830da6d11..93dff0d35 100644 --- a/tests/ui/inline_fn_without_body.rs +++ b/tests/ui/inline_fn_without_body.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/inline_fn_without_body.stderr b/tests/ui/inline_fn_without_body.stderr index a9a52b190..112fad812 100644 --- a/tests/ui/inline_fn_without_body.stderr +++ b/tests/ui/inline_fn_without_body.stderr @@ -1,25 +1,25 @@ error: use of `#[inline]` on trait method `default_inline` which has no body - --> $DIR/inline_fn_without_body.rs:8:5 - | -8 | #[inline] - | _____-^^^^^^^^ -9 | | fn default_inline(); - | |____- help: remove - | - = note: `-D clippy::inline-fn-without-body` implied by `-D warnings` + --> $DIR/inline_fn_without_body.rs:18:5 + | +18 | #[inline] + | _____-^^^^^^^^ +19 | | fn default_inline(); + | |____- help: remove + | + = note: `-D clippy::inline-fn-without-body` implied by `-D warnings` error: use of `#[inline]` on trait method `always_inline` which has no body - --> $DIR/inline_fn_without_body.rs:11:5 + --> $DIR/inline_fn_without_body.rs:21:5 | -11 | #[inline(always)]fn always_inline(); +21 | #[inline(always)]fn always_inline(); | ^^^^^^^^^^^^^^^^^ help: remove error: use of `#[inline]` on trait method `never_inline` which has no body - --> $DIR/inline_fn_without_body.rs:13:5 + --> $DIR/inline_fn_without_body.rs:23:5 | -13 | #[inline(never)] +23 | #[inline(never)] | _____-^^^^^^^^^^^^^^^ -14 | | fn never_inline(); +24 | | fn never_inline(); | |____- help: remove error: aborting due to 3 previous errors diff --git a/tests/ui/int_plus_one.rs b/tests/ui/int_plus_one.rs index 1eb0e4929..df16a3938 100644 --- a/tests/ui/int_plus_one.rs +++ b/tests/ui/int_plus_one.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/int_plus_one.stderr b/tests/ui/int_plus_one.stderr index 12d7000dc..5612b2032 100644 --- a/tests/ui/int_plus_one.stderr +++ b/tests/ui/int_plus_one.stderr @@ -1,43 +1,43 @@ error: Unnecessary `>= y + 1` or `x - 1 >=` - --> $DIR/int_plus_one.rs:10:5 + --> $DIR/int_plus_one.rs:20:5 | -10 | x >= y + 1; +20 | x >= y + 1; | ^^^^^^^^^^ | = note: `-D clippy::int-plus-one` implied by `-D warnings` help: change `>= y + 1` to `> y` as shown | -10 | x > y; +20 | x > y; | ^^^^^ error: Unnecessary `>= y + 1` or `x - 1 >=` - --> $DIR/int_plus_one.rs:11:5 + --> $DIR/int_plus_one.rs:21:5 | -11 | y + 1 <= x; +21 | y + 1 <= x; | ^^^^^^^^^^ help: change `>= y + 1` to `> y` as shown | -11 | y < x; +21 | y < x; | ^^^^^ error: Unnecessary `>= y + 1` or `x - 1 >=` - --> $DIR/int_plus_one.rs:13:5 + --> $DIR/int_plus_one.rs:23:5 | -13 | x - 1 >= y; +23 | x - 1 >= y; | ^^^^^^^^^^ help: change `>= y + 1` to `> y` as shown | -13 | x > y; +23 | x > y; | ^^^^^ error: Unnecessary `>= y + 1` or `x - 1 >=` - --> $DIR/int_plus_one.rs:14:5 + --> $DIR/int_plus_one.rs:24:5 | -14 | y <= x - 1; +24 | y <= x - 1; | ^^^^^^^^^^ help: change `>= y + 1` to `> y` as shown | -14 | y < x; +24 | y < x; | ^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/invalid_ref.rs b/tests/ui/invalid_ref.rs index ce2596c0c..9fb6c7fd4 100644 --- a/tests/ui/invalid_ref.rs +++ b/tests/ui/invalid_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + diff --git a/tests/ui/invalid_ref.stderr b/tests/ui/invalid_ref.stderr index 1ca825dd9..52868e908 100644 --- a/tests/ui/invalid_ref.stderr +++ b/tests/ui/invalid_ref.stderr @@ -1,48 +1,48 @@ error: reference to zeroed memory - --> $DIR/invalid_ref.rs:27:24 + --> $DIR/invalid_ref.rs:37:24 | -27 | let ref_zero: &T = std::mem::zeroed(); // warning +37 | let ref_zero: &T = std::mem::zeroed(); // warning | ^^^^^^^^^^^^^^^^^^ | = note: #[deny(clippy::invalid_ref)] on by default = help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html error: reference to zeroed memory - --> $DIR/invalid_ref.rs:31:24 + --> $DIR/invalid_ref.rs:41:24 | -31 | let ref_zero: &T = core::mem::zeroed(); // warning +41 | let ref_zero: &T = core::mem::zeroed(); // warning | ^^^^^^^^^^^^^^^^^^^ | = help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html error: reference to zeroed memory - --> $DIR/invalid_ref.rs:35:24 + --> $DIR/invalid_ref.rs:45:24 | -35 | let ref_zero: &T = std::intrinsics::init(); // warning +45 | let ref_zero: &T = std::intrinsics::init(); // warning | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html error: reference to uninitialized memory - --> $DIR/invalid_ref.rs:39:26 + --> $DIR/invalid_ref.rs:49:26 | -39 | let ref_uninit: &T = std::mem::uninitialized(); // warning +49 | let ref_uninit: &T = std::mem::uninitialized(); // warning | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html error: reference to uninitialized memory - --> $DIR/invalid_ref.rs:43:26 + --> $DIR/invalid_ref.rs:53:26 | -43 | let ref_uninit: &T = core::mem::uninitialized(); // warning +53 | let ref_uninit: &T = core::mem::uninitialized(); // warning | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html error: reference to uninitialized memory - --> $DIR/invalid_ref.rs:47:26 + --> $DIR/invalid_ref.rs:57:26 | -47 | let ref_uninit: &T = std::intrinsics::uninit(); // warning +57 | let ref_uninit: &T = std::intrinsics::uninit(); // warning | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html diff --git a/tests/ui/invalid_upcast_comparisons.rs b/tests/ui/invalid_upcast_comparisons.rs index 0a700518f..5c17970d3 100644 --- a/tests/ui/invalid_upcast_comparisons.rs +++ b/tests/ui/invalid_upcast_comparisons.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/invalid_upcast_comparisons.stderr b/tests/ui/invalid_upcast_comparisons.stderr index ce6d1dfa1..e41132dfc 100644 --- a/tests/ui/invalid_upcast_comparisons.stderr +++ b/tests/ui/invalid_upcast_comparisons.stderr @@ -1,165 +1,165 @@ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:16:5 + --> $DIR/invalid_upcast_comparisons.rs:26:5 | -16 | (u8 as u32) > 300; +26 | (u8 as u32) > 300; | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:17:5 - | -17 | (u8 as i32) > 300; - | ^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:18:5 - | -18 | (u8 as u32) == 300; - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:19:5 - | -19 | (u8 as i32) == 300; - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:20:5 - | -20 | 300 < (u8 as u32); - | ^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:21:5 - | -21 | 300 < (u8 as i32); - | ^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:22:5 - | -22 | 300 == (u8 as u32); - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:23:5 - | -23 | 300 == (u8 as i32); - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:25:5 - | -25 | (u8 as u32) <= 300; - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:26:5 - | -26 | (u8 as i32) <= 300; - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always true --> $DIR/invalid_upcast_comparisons.rs:27:5 | -27 | (u8 as u32) != 300; - | ^^^^^^^^^^^^^^^^^^ +27 | (u8 as i32) > 300; + | ^^^^^^^^^^^^^^^^^ -error: because of the numeric bounds on `u8` prior to casting, this expression is always true +error: because of the numeric bounds on `u8` prior to casting, this expression is always false --> $DIR/invalid_upcast_comparisons.rs:28:5 | -28 | (u8 as i32) != 300; - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:29:5 - | -29 | 300 >= (u8 as u32); - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:30:5 - | -30 | 300 >= (u8 as i32); - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:31:5 - | -31 | 300 != (u8 as u32); - | ^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:32:5 - | -32 | 300 != (u8 as i32); +28 | (u8 as u32) == 300; | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false + --> $DIR/invalid_upcast_comparisons.rs:29:5 + | +29 | (u8 as i32) == 300; + | ^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always false + --> $DIR/invalid_upcast_comparisons.rs:30:5 + | +30 | 300 < (u8 as u32); + | ^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always false + --> $DIR/invalid_upcast_comparisons.rs:31:5 + | +31 | 300 < (u8 as i32); + | ^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always false + --> $DIR/invalid_upcast_comparisons.rs:32:5 + | +32 | 300 == (u8 as u32); + | ^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always false + --> $DIR/invalid_upcast_comparisons.rs:33:5 + | +33 | 300 == (u8 as i32); + | ^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always true --> $DIR/invalid_upcast_comparisons.rs:35:5 | -35 | (u8 as i32) < 0; - | ^^^^^^^^^^^^^^^ +35 | (u8 as u32) <= 300; + | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true --> $DIR/invalid_upcast_comparisons.rs:36:5 | -36 | -5 != (u8 as i32); - | ^^^^^^^^^^^^^^^^^ +36 | (u8 as i32) <= 300; + | ^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always true + --> $DIR/invalid_upcast_comparisons.rs:37:5 + | +37 | (u8 as u32) != 300; + | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true --> $DIR/invalid_upcast_comparisons.rs:38:5 | -38 | (u8 as i32) >= 0; - | ^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:39:5 - | -39 | -5 == (u8 as i32); - | ^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:42:5 - | -42 | 1337 == (u8 as i32); - | ^^^^^^^^^^^^^^^^^^^ - -error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:43:5 - | -43 | 1337 == (u8 as u32); - | ^^^^^^^^^^^^^^^^^^^ +38 | (u8 as i32) != 300; + | ^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true + --> $DIR/invalid_upcast_comparisons.rs:39:5 + | +39 | 300 >= (u8 as u32); + | ^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always true + --> $DIR/invalid_upcast_comparisons.rs:40:5 + | +40 | 300 >= (u8 as i32); + | ^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always true + --> $DIR/invalid_upcast_comparisons.rs:41:5 + | +41 | 300 != (u8 as u32); + | ^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always true + --> $DIR/invalid_upcast_comparisons.rs:42:5 + | +42 | 300 != (u8 as i32); + | ^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always false --> $DIR/invalid_upcast_comparisons.rs:45:5 | -45 | 1337 != (u8 as i32); - | ^^^^^^^^^^^^^^^^^^^ +45 | (u8 as i32) < 0; + | ^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true --> $DIR/invalid_upcast_comparisons.rs:46:5 | -46 | 1337 != (u8 as u32); +46 | -5 != (u8 as i32); + | ^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always true + --> $DIR/invalid_upcast_comparisons.rs:48:5 + | +48 | (u8 as i32) >= 0; + | ^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always false + --> $DIR/invalid_upcast_comparisons.rs:49:5 + | +49 | -5 == (u8 as i32); + | ^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always false + --> $DIR/invalid_upcast_comparisons.rs:52:5 + | +52 | 1337 == (u8 as i32); + | ^^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always false + --> $DIR/invalid_upcast_comparisons.rs:53:5 + | +53 | 1337 == (u8 as u32); | ^^^^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> $DIR/invalid_upcast_comparisons.rs:61:5 + --> $DIR/invalid_upcast_comparisons.rs:55:5 | -61 | (u8 as i32) > -1; +55 | 1337 != (u8 as i32); + | ^^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always true + --> $DIR/invalid_upcast_comparisons.rs:56:5 + | +56 | 1337 != (u8 as u32); + | ^^^^^^^^^^^^^^^^^^^ + +error: because of the numeric bounds on `u8` prior to casting, this expression is always true + --> $DIR/invalid_upcast_comparisons.rs:71:5 + | +71 | (u8 as i32) > -1; | ^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:62:5 + --> $DIR/invalid_upcast_comparisons.rs:72:5 | -62 | (u8 as i32) < -1; +72 | (u8 as i32) < -1; | ^^^^^^^^^^^^^^^^ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> $DIR/invalid_upcast_comparisons.rs:78:5 + --> $DIR/invalid_upcast_comparisons.rs:88:5 | -78 | -5 >= (u8 as i32); +88 | -5 >= (u8 as i32); | ^^^^^^^^^^^^^^^^^ error: aborting due to 27 previous errors diff --git a/tests/ui/issue-3145.rs b/tests/ui/issue-3145.rs index f497d5550..74a11925a 100644 --- a/tests/ui/issue-3145.rs +++ b/tests/ui/issue-3145.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { println!("{}" a); //~ERROR expected token: `,` } diff --git a/tests/ui/issue-3145.stderr b/tests/ui/issue-3145.stderr index e289df043..2086f1146 100644 --- a/tests/ui/issue-3145.stderr +++ b/tests/ui/issue-3145.stderr @@ -1,8 +1,8 @@ error: expected token: `,` - --> $DIR/issue-3145.rs:2:19 - | -2 | println!("{}" a); //~ERROR expected token: `,` - | ^ + --> $DIR/issue-3145.rs:12:19 + | +12 | println!("{}" a); //~ERROR expected token: `,` + | ^ error: aborting due to previous error diff --git a/tests/ui/issue_2356.rs b/tests/ui/issue_2356.rs index 398e0d1d1..d251d51f3 100644 --- a/tests/ui/issue_2356.rs +++ b/tests/ui/issue_2356.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::while_let_on_iterator)] diff --git a/tests/ui/issue_2356.stderr b/tests/ui/issue_2356.stderr index fe2d9d45b..291e64bec 100644 --- a/tests/ui/issue_2356.stderr +++ b/tests/ui/issue_2356.stderr @@ -1,13 +1,13 @@ error: this loop could be written as a `for` loop - --> $DIR/issue_2356.rs:17:29 + --> $DIR/issue_2356.rs:27:29 | -17 | while let Some(e) = it.next() { +27 | while let Some(e) = it.next() { | ^^^^^^^^^ help: try: `for e in it { .. }` | note: lint level defined here - --> $DIR/issue_2356.rs:3:9 + --> $DIR/issue_2356.rs:13:9 | -3 | #![deny(clippy::while_let_on_iterator)] +13 | #![deny(clippy::while_let_on_iterator)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/item_after_statement.rs b/tests/ui/item_after_statement.rs index 9626a59ed..d765adae3 100644 --- a/tests/ui/item_after_statement.rs +++ b/tests/ui/item_after_statement.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::items_after_statements)] diff --git a/tests/ui/item_after_statement.stderr b/tests/ui/item_after_statement.stderr index 6d20899b5..15c0cc3af 100644 --- a/tests/ui/item_after_statement.stderr +++ b/tests/ui/item_after_statement.stderr @@ -1,15 +1,15 @@ error: adding items after statements is confusing, since items exist from the start of the scope - --> $DIR/item_after_statement.rs:12:5 + --> $DIR/item_after_statement.rs:22:5 | -12 | fn foo() { println!("foo"); } +22 | fn foo() { println!("foo"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::items-after-statements` implied by `-D warnings` error: adding items after statements is confusing, since items exist from the start of the scope - --> $DIR/item_after_statement.rs:17:5 + --> $DIR/item_after_statement.rs:27:5 | -17 | fn foo() { println!("foo"); } +27 | fn foo() { println!("foo"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/large_digit_groups.rs b/tests/ui/large_digit_groups.rs index af569ea75..7cc1f9c88 100644 --- a/tests/ui/large_digit_groups.rs +++ b/tests/ui/large_digit_groups.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #[warn(clippy::large_digit_groups)] diff --git a/tests/ui/large_digit_groups.stderr b/tests/ui/large_digit_groups.stderr index b322ded9c..c38abb888 100644 --- a/tests/ui/large_digit_groups.stderr +++ b/tests/ui/large_digit_groups.stderr @@ -1,40 +1,40 @@ error: digit groups should be smaller - --> $DIR/large_digit_groups.rs:7:16 - | -7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); - | ^^^^^^^^^^^^^ help: consider: `0b11_0110_i64` - | - = note: `-D clippy::large-digit-groups` implied by `-D warnings` + --> $DIR/large_digit_groups.rs:17:16 + | +17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); + | ^^^^^^^^^^^^^ help: consider: `0b11_0110_i64` + | + = note: `-D clippy::large-digit-groups` implied by `-D warnings` error: digit groups should be smaller - --> $DIR/large_digit_groups.rs:7:31 - | -7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider: `0x0123_4567_8901_usize` + --> $DIR/large_digit_groups.rs:17:31 + | +17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); + | ^^^^^^^^^^^^^^^^^^^^^ help: consider: `0x0123_4567_8901_usize` error: digit groups should be smaller - --> $DIR/large_digit_groups.rs:7:54 - | -7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); - | ^^^^^^^^^^^ help: consider: `123_456_f32` + --> $DIR/large_digit_groups.rs:17:54 + | +17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); + | ^^^^^^^^^^^ help: consider: `123_456_f32` error: digit groups should be smaller - --> $DIR/large_digit_groups.rs:7:67 - | -7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); - | ^^^^^^^^^^^^^^ help: consider: `123_456.12_f32` + --> $DIR/large_digit_groups.rs:17:67 + | +17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); + | ^^^^^^^^^^^^^^ help: consider: `123_456.12_f32` error: digit groups should be smaller - --> $DIR/large_digit_groups.rs:7:83 - | -7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); - | ^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_45_f32` + --> $DIR/large_digit_groups.rs:17:83 + | +17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); + | ^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_45_f32` error: digit groups should be smaller - --> $DIR/large_digit_groups.rs:7:102 - | -7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); - | ^^^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_456_f32` + --> $DIR/large_digit_groups.rs:17:102 + | +17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); + | ^^^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_456_f32` error: aborting due to 6 previous errors diff --git a/tests/ui/large_enum_variant.rs b/tests/ui/large_enum_variant.rs index cd1772ad1..729cc8940 100644 --- a/tests/ui/large_enum_variant.rs +++ b/tests/ui/large_enum_variant.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/large_enum_variant.stderr b/tests/ui/large_enum_variant.stderr index af42f9054..4bb25dd85 100644 --- a/tests/ui/large_enum_variant.stderr +++ b/tests/ui/large_enum_variant.stderr @@ -1,69 +1,69 @@ error: large size difference between variants - --> $DIR/large_enum_variant.rs:10:5 + --> $DIR/large_enum_variant.rs:20:5 | -10 | B([i32; 8000]), +20 | B([i32; 8000]), | ^^^^^^^^^^^^^^ | = note: `-D clippy::large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum | -10 | B(Box<[i32; 8000]>), +20 | B(Box<[i32; 8000]>), | ^^^^^^^^^^^^^^^^ error: large size difference between variants - --> $DIR/large_enum_variant.rs:21:5 + --> $DIR/large_enum_variant.rs:31:5 | -21 | C(T, [i32; 8000]), +31 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum - --> $DIR/large_enum_variant.rs:21:5 + --> $DIR/large_enum_variant.rs:31:5 | -21 | C(T, [i32; 8000]), +31 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> $DIR/large_enum_variant.rs:34:5 + --> $DIR/large_enum_variant.rs:44:5 | -34 | ContainingLargeEnum(LargeEnum), +44 | ContainingLargeEnum(LargeEnum), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider boxing the large fields to reduce the total size of the enum | -34 | ContainingLargeEnum(Box), +44 | ContainingLargeEnum(Box), | ^^^^^^^^^^^^^^ error: large size difference between variants - --> $DIR/large_enum_variant.rs:37:5 + --> $DIR/large_enum_variant.rs:47:5 | -37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), +47 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum - --> $DIR/large_enum_variant.rs:37:5 + --> $DIR/large_enum_variant.rs:47:5 | -37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), +47 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> $DIR/large_enum_variant.rs:44:5 + --> $DIR/large_enum_variant.rs:54:5 | -44 | StructLikeLarge { x: [i32; 8000], y: i32 }, +54 | StructLikeLarge { x: [i32; 8000], y: i32 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum - --> $DIR/large_enum_variant.rs:44:5 + --> $DIR/large_enum_variant.rs:54:5 | -44 | StructLikeLarge { x: [i32; 8000], y: i32 }, +54 | StructLikeLarge { x: [i32; 8000], y: i32 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> $DIR/large_enum_variant.rs:49:5 + --> $DIR/large_enum_variant.rs:59:5 | -49 | StructLikeLarge2 { x: [i32; 8000] }, +59 | StructLikeLarge2 { x: [i32; 8000] }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider boxing the large fields to reduce the total size of the enum | -49 | StructLikeLarge2 { x: Box<[i32; 8000]> }, +59 | StructLikeLarge2 { x: Box<[i32; 8000]> }, | ^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/len_zero.rs b/tests/ui/len_zero.rs index b188db518..a8f1e2836 100644 --- a/tests/ui/len_zero.rs +++ b/tests/ui/len_zero.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::len_without_is_empty, clippy::len_zero)] diff --git a/tests/ui/len_zero.stderr b/tests/ui/len_zero.stderr index 49e365e6c..ffba33a65 100644 --- a/tests/ui/len_zero.stderr +++ b/tests/ui/len_zero.stderr @@ -1,139 +1,139 @@ error: item `PubOne` has a public `len` method but no corresponding `is_empty` method - --> $DIR/len_zero.rs:8:1 + --> $DIR/len_zero.rs:18:1 | -8 | / impl PubOne { -9 | | pub fn len(self: &Self) -> isize { -10 | | 1 -11 | | } -12 | | } +18 | / impl PubOne { +19 | | pub fn len(self: &Self) -> isize { +20 | | 1 +21 | | } +22 | | } | |_^ | = note: `-D clippy::len-without-is-empty` implied by `-D warnings` error: trait `PubTraitsToo` has a `len` method but no (possibly inherited) `is_empty` method - --> $DIR/len_zero.rs:57:1 + --> $DIR/len_zero.rs:67:1 | -57 | / pub trait PubTraitsToo { -58 | | fn len(self: &Self) -> isize; -59 | | } +67 | / pub trait PubTraitsToo { +68 | | fn len(self: &Self) -> isize; +69 | | } | |_^ error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method - --> $DIR/len_zero.rs:91:1 - | -91 | / impl HasIsEmpty { -92 | | pub fn len(self: &Self) -> isize { -93 | | 1 -94 | | } -... | -98 | | } -99 | | } - | |_^ + --> $DIR/len_zero.rs:101:1 + | +101 | / impl HasIsEmpty { +102 | | pub fn len(self: &Self) -> isize { +103 | | 1 +104 | | } +... | +108 | | } +109 | | } + | |_^ error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is_empty` method - --> $DIR/len_zero.rs:120:1 + --> $DIR/len_zero.rs:130:1 | -120 | / impl HasWrongIsEmpty { -121 | | pub fn len(self: &Self) -> isize { -122 | | 1 -123 | | } +130 | / impl HasWrongIsEmpty { +131 | | pub fn len(self: &Self) -> isize { +132 | | 1 +133 | | } ... | -127 | | } -128 | | } +137 | | } +138 | | } | |_^ error: length comparison to zero - --> $DIR/len_zero.rs:141:8 + --> $DIR/len_zero.rs:151:8 | -141 | if x.len() == 0 { +151 | if x.len() == 0 { | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `x.is_empty()` | = note: `-D clippy::len-zero` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:145:8 + --> $DIR/len_zero.rs:155:8 | -145 | if "".len() == 0 {} +155 | if "".len() == 0 {} | ^^^^^^^^^^^^^ help: using `is_empty` is more concise: `"".is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:160:8 + --> $DIR/len_zero.rs:170:8 | -160 | if has_is_empty.len() == 0 { +170 | if has_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:163:8 + --> $DIR/len_zero.rs:173:8 | -163 | if has_is_empty.len() != 0 { +173 | if has_is_empty.len() != 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:166:8 + --> $DIR/len_zero.rs:176:8 | -166 | if has_is_empty.len() > 0 { +176 | if has_is_empty.len() > 0 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:169:8 + --> $DIR/len_zero.rs:179:8 | -169 | if has_is_empty.len() < 1 { +179 | if has_is_empty.len() < 1 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:172:8 + --> $DIR/len_zero.rs:182:8 | -172 | if has_is_empty.len() >= 1 { +182 | if has_is_empty.len() >= 1 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:183:8 + --> $DIR/len_zero.rs:193:8 | -183 | if 0 == has_is_empty.len() { +193 | if 0 == has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:186:8 + --> $DIR/len_zero.rs:196:8 | -186 | if 0 != has_is_empty.len() { +196 | if 0 != has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:189:8 + --> $DIR/len_zero.rs:199:8 | -189 | if 0 < has_is_empty.len() { +199 | if 0 < has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:192:8 + --> $DIR/len_zero.rs:202:8 | -192 | if 1 <= has_is_empty.len() { +202 | if 1 <= has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:195:8 + --> $DIR/len_zero.rs:205:8 | -195 | if 1 > has_is_empty.len() { +205 | if 1 > has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:209:8 + --> $DIR/len_zero.rs:219:8 | -209 | if with_is_empty.len() == 0 { +219 | if with_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `with_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:222:8 + --> $DIR/len_zero.rs:232:8 | -222 | if b.len() != 0 {} +232 | if b.len() != 0 {} | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `!b.is_empty()` error: trait `DependsOnFoo` has a `len` method but no (possibly inherited) `is_empty` method - --> $DIR/len_zero.rs:228:1 + --> $DIR/len_zero.rs:238:1 | -228 | / pub trait DependsOnFoo: Foo { -229 | | fn len(&mut self) -> usize; -230 | | } +238 | / pub trait DependsOnFoo: Foo { +239 | | fn len(&mut self) -> usize; +240 | | } | |_^ error: aborting due to 19 previous errors diff --git a/tests/ui/let_if_seq.rs b/tests/ui/let_if_seq.rs index 102b72f3e..5fca759a4 100644 --- a/tests/ui/let_if_seq.rs +++ b/tests/ui/let_if_seq.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/let_if_seq.stderr b/tests/ui/let_if_seq.stderr index 7b4c78003..6e2ec6d4a 100644 --- a/tests/ui/let_if_seq.stderr +++ b/tests/ui/let_if_seq.stderr @@ -1,47 +1,47 @@ error: `if _ { .. } else { .. }` is an expression - --> $DIR/let_if_seq.rs:57:5 + --> $DIR/let_if_seq.rs:67:5 | -57 | / let mut foo = 0; -58 | | if f() { -59 | | foo = 42; -60 | | } +67 | / let mut foo = 0; +68 | | if f() { +69 | | foo = 42; +70 | | } | |_____^ help: it is more idiomatic to write: `let foo = if f() { 42 } else { 0 };` | = note: `-D clippy::useless-let-if-seq` implied by `-D warnings` = note: you might not need `mut` at all error: `if _ { .. } else { .. }` is an expression - --> $DIR/let_if_seq.rs:62:5 + --> $DIR/let_if_seq.rs:72:5 | -62 | / let mut bar = 0; -63 | | if f() { -64 | | f(); -65 | | bar = 42; +72 | / let mut bar = 0; +73 | | if f() { +74 | | f(); +75 | | bar = 42; ... | -68 | | f(); -69 | | } +78 | | f(); +79 | | } | |_____^ help: it is more idiomatic to write: `let bar = if f() { ..; 42 } else { ..; 0 };` | = note: you might not need `mut` at all error: `if _ { .. } else { .. }` is an expression - --> $DIR/let_if_seq.rs:71:5 + --> $DIR/let_if_seq.rs:81:5 | -71 | / let quz; -72 | | if f() { -73 | | quz = 42; -74 | | } else { -75 | | quz = 0; -76 | | } +81 | / let quz; +82 | | if f() { +83 | | quz = 42; +84 | | } else { +85 | | quz = 0; +86 | | } | |_____^ help: it is more idiomatic to write: `let quz = if f() { 42 } else { 0 };` error: `if _ { .. } else { .. }` is an expression - --> $DIR/let_if_seq.rs:100:5 + --> $DIR/let_if_seq.rs:110:5 | -100 | / let mut baz = 0; -101 | | if f() { -102 | | baz = 42; -103 | | } +110 | / let mut baz = 0; +111 | | if f() { +112 | | baz = 42; +113 | | } | |_____^ help: it is more idiomatic to write: `let baz = if f() { 42 } else { 0 };` | = note: you might not need `mut` at all diff --git a/tests/ui/let_return.rs b/tests/ui/let_return.rs index 9b584d6e2..380f77568 100644 --- a/tests/ui/let_return.rs +++ b/tests/ui/let_return.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused)] diff --git a/tests/ui/let_return.stderr b/tests/ui/let_return.stderr index dad628bc9..cdd4b6bd5 100644 --- a/tests/ui/let_return.stderr +++ b/tests/ui/let_return.stderr @@ -1,26 +1,26 @@ error: returning the result of a let binding from a block. Consider returning the expression directly. - --> $DIR/let_return.rs:10:5 + --> $DIR/let_return.rs:20:5 | -10 | x +20 | x | ^ | = note: `-D clippy::let-and-return` implied by `-D warnings` note: this expression can be directly returned - --> $DIR/let_return.rs:9:13 + --> $DIR/let_return.rs:19:13 | -9 | let x = 5; +19 | let x = 5; | ^ error: returning the result of a let binding from a block. Consider returning the expression directly. - --> $DIR/let_return.rs:16:9 + --> $DIR/let_return.rs:26:9 | -16 | x +26 | x | ^ | note: this expression can be directly returned - --> $DIR/let_return.rs:15:17 + --> $DIR/let_return.rs:25:17 | -15 | let x = 5; +25 | let x = 5; | ^ error: aborting due to 2 previous errors diff --git a/tests/ui/let_unit.rs b/tests/ui/let_unit.rs index 187ff9d13..578fcb2dd 100644 --- a/tests/ui/let_unit.rs +++ b/tests/ui/let_unit.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/let_unit.stderr b/tests/ui/let_unit.stderr index f6f5d3f7d..e8c7bb37e 100644 --- a/tests/ui/let_unit.stderr +++ b/tests/ui/let_unit.stderr @@ -1,15 +1,15 @@ error: this let-binding has unit value. Consider omitting `let _x =` - --> $DIR/let_unit.rs:14:5 + --> $DIR/let_unit.rs:24:5 | -14 | let _x = println!("x"); +24 | let _x = println!("x"); | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::let-unit-value` implied by `-D warnings` error: this let-binding has unit value. Consider omitting `let _a =` - --> $DIR/let_unit.rs:18:9 + --> $DIR/let_unit.rs:28:9 | -18 | let _a = (); +28 | let _a = (); | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/lifetimes.rs b/tests/ui/lifetimes.rs index aa5640f4e..cae184987 100644 --- a/tests/ui/lifetimes.rs +++ b/tests/ui/lifetimes.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/lifetimes.stderr b/tests/ui/lifetimes.stderr index 42fb01b75..9e4fac1e4 100644 --- a/tests/ui/lifetimes.stderr +++ b/tests/ui/lifetimes.stderr @@ -1,89 +1,89 @@ -error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:7:1 - | -7 | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::needless-lifetimes` implied by `-D warnings` - -error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:9:1 - | -9 | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: explicit lifetimes given in parameter types where they could be elided --> $DIR/lifetimes.rs:17:1 | -17 | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { x } +17 | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::needless-lifetimes` implied by `-D warnings` + +error: explicit lifetimes given in parameter types where they could be elided + --> $DIR/lifetimes.rs:19:1 + | +19 | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: explicit lifetimes given in parameter types where they could be elided + --> $DIR/lifetimes.rs:27:1 + | +27 | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:29:1 + --> $DIR/lifetimes.rs:39:1 | -29 | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { Ok(x) } +39 | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { Ok(x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:32:1 + --> $DIR/lifetimes.rs:42:1 | -32 | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> where T: Copy { Ok(x) } +42 | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> where T: Copy { Ok(x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:38:1 + --> $DIR/lifetimes.rs:48:1 | -38 | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) { } +48 | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:52:1 + --> $DIR/lifetimes.rs:62:1 | -52 | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I> -53 | | where for<'x> F: Fn(Lt<'x, I>) -> Lt<'x, I> -54 | | { unreachable!() } +62 | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I> +63 | | where for<'x> F: Fn(Lt<'x, I>) -> Lt<'x, I> +64 | | { unreachable!() } | |__________________^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:77:5 + --> $DIR/lifetimes.rs:87:5 | -77 | fn self_and_out<'s>(&'s self) -> &'s u8 { &self.x } +87 | fn self_and_out<'s>(&'s self) -> &'s u8 { &self.x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:81:5 + --> $DIR/lifetimes.rs:91:5 | -81 | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) { } +91 | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:97:1 - | -97 | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str { unimplemented!() } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $DIR/lifetimes.rs:107:1 + | +107 | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str { unimplemented!() } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:117:1 + --> $DIR/lifetimes.rs:127:1 | -117 | fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { unimplemented!() } +127 | fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:121:1 + --> $DIR/lifetimes.rs:131:1 | -121 | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str { unimplemented!() } +131 | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:132:1 + --> $DIR/lifetimes.rs:142:1 | -132 | fn named_input_elided_output<'a>(_arg: &'a str) -> &str { unimplemented!() } +142 | fn named_input_elided_output<'a>(_arg: &'a str) -> &str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:136:1 + --> $DIR/lifetimes.rs:146:1 | -136 | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { unimplemented!() } +146 | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 14 previous errors diff --git a/tests/ui/literals.rs b/tests/ui/literals.rs index 7a9efaeec..3c1dcf09a 100644 --- a/tests/ui/literals.rs +++ b/tests/ui/literals.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::mixed_case_hex_literals)] diff --git a/tests/ui/literals.stderr b/tests/ui/literals.stderr index bd2d1f818..4e26b9dd3 100644 --- a/tests/ui/literals.stderr +++ b/tests/ui/literals.stderr @@ -1,181 +1,181 @@ error: inconsistent casing in hexadecimal literal - --> $DIR/literals.rs:14:17 + --> $DIR/literals.rs:24:17 | -14 | let fail1 = 0xabCD; +24 | let fail1 = 0xabCD; | ^^^^^^ | = note: `-D clippy::mixed-case-hex-literals` implied by `-D warnings` error: inconsistent casing in hexadecimal literal - --> $DIR/literals.rs:15:17 + --> $DIR/literals.rs:25:17 | -15 | let fail2 = 0xabCD_u32; +25 | let fail2 = 0xabCD_u32; | ^^^^^^^^^^ error: inconsistent casing in hexadecimal literal - --> $DIR/literals.rs:16:17 + --> $DIR/literals.rs:26:17 | -16 | let fail2 = 0xabCD_isize; +26 | let fail2 = 0xabCD_isize; | ^^^^^^^^^^^^ error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:17:27 + --> $DIR/literals.rs:27:27 | -17 | let fail_multi_zero = 000_123usize; +27 | let fail_multi_zero = 000_123usize; | ^^^^^^^^^^^^ | = note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings` error: this is a decimal constant - --> $DIR/literals.rs:17:27 + --> $DIR/literals.rs:27:27 | -17 | let fail_multi_zero = 000_123usize; +27 | let fail_multi_zero = 000_123usize; | ^^^^^^^^^^^^ | = note: `-D clippy::zero-prefixed-literal` implied by `-D warnings` help: if you mean to use a decimal constant, remove the `0` to remove confusion | -17 | let fail_multi_zero = 123usize; +27 | let fail_multi_zero = 123usize; | ^^^^^^^^ help: if you mean to use an octal constant, use `0o` | -17 | let fail_multi_zero = 0o123usize; +27 | let fail_multi_zero = 0o123usize; | ^^^^^^^^^^ error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:22:17 + --> $DIR/literals.rs:32:17 | -22 | let fail3 = 1234i32; +32 | let fail3 = 1234i32; | ^^^^^^^ error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:23:17 + --> $DIR/literals.rs:33:17 | -23 | let fail4 = 1234u32; +33 | let fail4 = 1234u32; | ^^^^^^^ error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:24:17 + --> $DIR/literals.rs:34:17 | -24 | let fail5 = 1234isize; +34 | let fail5 = 1234isize; | ^^^^^^^^^ error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:25:17 + --> $DIR/literals.rs:35:17 | -25 | let fail6 = 1234usize; +35 | let fail6 = 1234usize; | ^^^^^^^^^ error: float type suffix should be separated by an underscore - --> $DIR/literals.rs:26:17 + --> $DIR/literals.rs:36:17 | -26 | let fail7 = 1.5f32; +36 | let fail7 = 1.5f32; | ^^^^^^ error: this is a decimal constant - --> $DIR/literals.rs:30:17 + --> $DIR/literals.rs:40:17 | -30 | let fail8 = 0123; +40 | let fail8 = 0123; | ^^^^ help: if you mean to use a decimal constant, remove the `0` to remove confusion | -30 | let fail8 = 123; +40 | let fail8 = 123; | ^^^ help: if you mean to use an octal constant, use `0o` | -30 | let fail8 = 0o123; +40 | let fail8 = 0o123; | ^^^^^ error: long literal lacking separators - --> $DIR/literals.rs:41:17 + --> $DIR/literals.rs:51:17 | -41 | let fail9 = 0xabcdef; +51 | let fail9 = 0xabcdef; | ^^^^^^^^ help: consider: `0x00ab_cdef` | = note: `-D clippy::unreadable-literal` implied by `-D warnings` error: long literal lacking separators - --> $DIR/literals.rs:42:18 + --> $DIR/literals.rs:52:18 | -42 | let fail10 = 0xBAFEBAFE; +52 | let fail10 = 0xBAFEBAFE; | ^^^^^^^^^^ help: consider: `0xBAFE_BAFE` error: long literal lacking separators - --> $DIR/literals.rs:43:18 + --> $DIR/literals.rs:53:18 | -43 | let fail11 = 0xabcdeff; +53 | let fail11 = 0xabcdeff; | ^^^^^^^^^ help: consider: `0x0abc_deff` error: long literal lacking separators - --> $DIR/literals.rs:44:18 + --> $DIR/literals.rs:54:18 | -44 | let fail12 = 0xabcabcabcabcabcabc; +54 | let fail12 = 0xabcabcabcabcabcabc; | ^^^^^^^^^^^^^^^^^^^^ help: consider: `0x00ab_cabc_abca_bcab_cabc` error: digit groups should be smaller - --> $DIR/literals.rs:45:18 + --> $DIR/literals.rs:55:18 | -45 | let fail13 = 0x1_23456_78901_usize; +55 | let fail13 = 0x1_23456_78901_usize; | ^^^^^^^^^^^^^^^^^^^^^ help: consider: `0x0123_4567_8901_usize` | = note: `-D clippy::large-digit-groups` implied by `-D warnings` error: mistyped literal suffix - --> $DIR/literals.rs:47:18 + --> $DIR/literals.rs:57:18 | -47 | let fail14 = 2_32; +57 | let fail14 = 2_32; | ^^^^ help: did you mean to write: `2_i32` | = note: #[deny(clippy::mistyped_literal_suffixes)] on by default error: mistyped literal suffix - --> $DIR/literals.rs:48:18 + --> $DIR/literals.rs:58:18 | -48 | let fail15 = 4_64; +58 | let fail15 = 4_64; | ^^^^ help: did you mean to write: `4_i64` error: mistyped literal suffix - --> $DIR/literals.rs:49:18 + --> $DIR/literals.rs:59:18 | -49 | let fail16 = 7_8; +59 | let fail16 = 7_8; | ^^^ help: did you mean to write: `7_i8` error: mistyped literal suffix - --> $DIR/literals.rs:50:18 + --> $DIR/literals.rs:60:18 | -50 | let fail17 = 23_16; +60 | let fail17 = 23_16; | ^^^^^ help: did you mean to write: `23_i16` error: digits grouped inconsistently by underscores - --> $DIR/literals.rs:52:18 + --> $DIR/literals.rs:62:18 | -52 | let fail19 = 12_3456_21; +62 | let fail19 = 12_3456_21; | ^^^^^^^^^^ help: consider: `12_345_621` | = note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings` error: mistyped literal suffix - --> $DIR/literals.rs:53:18 + --> $DIR/literals.rs:63:18 | -53 | let fail20 = 2__8; +63 | let fail20 = 2__8; | ^^^^ help: did you mean to write: `2_i8` error: mistyped literal suffix - --> $DIR/literals.rs:54:18 + --> $DIR/literals.rs:64:18 | -54 | let fail21 = 4___16; +64 | let fail21 = 4___16; | ^^^^^^ help: did you mean to write: `4_i16` error: digits grouped inconsistently by underscores - --> $DIR/literals.rs:55:18 + --> $DIR/literals.rs:65:18 | -55 | let fail22 = 3__4___23; +65 | let fail22 = 3__4___23; | ^^^^^^^^^ help: consider: `3_423` error: digits grouped inconsistently by underscores - --> $DIR/literals.rs:56:18 + --> $DIR/literals.rs:66:18 | -56 | let fail23 = 3__16___23; +66 | let fail23 = 3__16___23; | ^^^^^^^^^^ help: consider: `31_623` error: aborting due to 25 previous errors diff --git a/tests/ui/map_clone.rs b/tests/ui/map_clone.rs index 11a5316a3..8a410737f 100644 --- a/tests/ui/map_clone.rs +++ b/tests/ui/map_clone.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all, clippy::pedantic)] #![allow(clippy::missing_docs_in_private_items)] diff --git a/tests/ui/map_clone.stderr b/tests/ui/map_clone.stderr index e80983cdb..50856f6a9 100644 --- a/tests/ui/map_clone.stderr +++ b/tests/ui/map_clone.stderr @@ -1,22 +1,22 @@ error: You are using an explicit closure for cloning elements - --> $DIR/map_clone.rs:6:22 - | -6 | let _: Vec = vec![5_i8; 6].iter().map(|x| *x).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![5_i8; 6].iter().cloned()` - | - = note: `-D clippy::map-clone` implied by `-D warnings` + --> $DIR/map_clone.rs:16:22 + | +16 | let _: Vec = vec![5_i8; 6].iter().map(|x| *x).collect(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![5_i8; 6].iter().cloned()` + | + = note: `-D clippy::map-clone` implied by `-D warnings` error: You are using an explicit closure for cloning elements - --> $DIR/map_clone.rs:7:26 - | -7 | let _: Vec = vec![String::new()].iter().map(|x| x.clone()).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()` + --> $DIR/map_clone.rs:17:26 + | +17 | let _: Vec = vec![String::new()].iter().map(|x| x.clone()).collect(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()` error: You are using an explicit closure for cloning elements - --> $DIR/map_clone.rs:8:23 - | -8 | let _: Vec = vec![42, 43].iter().map(|&x| x).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![42, 43].iter().cloned()` + --> $DIR/map_clone.rs:18:23 + | +18 | let _: Vec = vec![42, 43].iter().map(|&x| x).collect(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![42, 43].iter().cloned()` error: aborting due to 3 previous errors diff --git a/tests/ui/map_flatten.rs b/tests/ui/map_flatten.rs index c5cf24d9b..b3f86d81e 100644 --- a/tests/ui/map_flatten.rs +++ b/tests/ui/map_flatten.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all, clippy::pedantic)] #![allow(clippy::missing_docs_in_private_items)] diff --git a/tests/ui/map_flatten.stderr b/tests/ui/map_flatten.stderr index d4ce44490..d41e62977 100644 --- a/tests/ui/map_flatten.stderr +++ b/tests/ui/map_flatten.stderr @@ -1,10 +1,10 @@ error: called `map(..).flatten()` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` - --> $DIR/map_flatten.rs:6:21 - | -6 | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using flat_map instead: `vec![5_i8; 6].into_iter().flat_map(|x| 0..x)` - | - = note: `-D clippy::map-flatten` implied by `-D warnings` + --> $DIR/map_flatten.rs:16:21 + | +16 | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using flat_map instead: `vec![5_i8; 6].into_iter().flat_map(|x| 0..x)` + | + = note: `-D clippy::map-flatten` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/match_bool.rs b/tests/ui/match_bool.rs index 07efe2c68..7548b8376 100644 --- a/tests/ui/match_bool.rs +++ b/tests/ui/match_bool.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn match_bool() { let test: bool = true; diff --git a/tests/ui/match_bool.stderr b/tests/ui/match_bool.stderr index 7ef6f714f..9bef0d823 100644 --- a/tests/ui/match_bool.stderr +++ b/tests/ui/match_bool.stderr @@ -1,73 +1,73 @@ error: this boolean expression can be simplified - --> $DIR/match_bool.rs:25:11 + --> $DIR/match_bool.rs:35:11 | -25 | match test && test { +35 | match test && test { | ^^^^^^^^^^^^ help: try: `test` | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> $DIR/match_bool.rs:4:5 - | -4 | / match test { -5 | | true => 0, -6 | | false => 42, -7 | | }; - | |_____^ help: consider using an if/else expression: `if test { 0 } else { 42 }` - | - = note: `-D clippy::match-bool` implied by `-D warnings` - -error: you seem to be trying to match on a boolean expression - --> $DIR/match_bool.rs:10:5 + --> $DIR/match_bool.rs:14:5 | -10 | / match option == 1 { -11 | | true => 1, -12 | | false => 0, -13 | | }; - | |_____^ help: consider using an if/else expression: `if option == 1 { 1 } else { 0 }` - -error: you seem to be trying to match on a boolean expression - --> $DIR/match_bool.rs:15:5 +14 | / match test { +15 | | true => 0, +16 | | false => 42, +17 | | }; + | |_____^ help: consider using an if/else expression: `if test { 0 } else { 42 }` | -15 | / match test { -16 | | true => (), -17 | | false => { println!("Noooo!"); } -18 | | }; - | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }` + = note: `-D clippy::match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression --> $DIR/match_bool.rs:20:5 | -20 | / match test { -21 | | false => { println!("Noooo!"); } -22 | | _ => (), +20 | / match option == 1 { +21 | | true => 1, +22 | | false => 0, 23 | | }; - | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }` + | |_____^ help: consider using an if/else expression: `if option == 1 { 1 } else { 0 }` error: you seem to be trying to match on a boolean expression --> $DIR/match_bool.rs:25:5 | -25 | / match test && test { -26 | | false => { println!("Noooo!"); } -27 | | _ => (), +25 | / match test { +26 | | true => (), +27 | | false => { println!("Noooo!"); } 28 | | }; - | |_____^ help: consider using an if/else expression: `if !(test && test) { println!("Noooo!"); }` - -error: equal expressions as operands to `&&` - --> $DIR/match_bool.rs:25:11 - | -25 | match test && test { - | ^^^^^^^^^^^^ - | - = note: #[deny(clippy::eq_op)] on by default + | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }` error: you seem to be trying to match on a boolean expression --> $DIR/match_bool.rs:30:5 | 30 | / match test { 31 | | false => { println!("Noooo!"); } -32 | | true => { println!("Yes!"); } +32 | | _ => (), 33 | | }; + | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }` + +error: you seem to be trying to match on a boolean expression + --> $DIR/match_bool.rs:35:5 + | +35 | / match test && test { +36 | | false => { println!("Noooo!"); } +37 | | _ => (), +38 | | }; + | |_____^ help: consider using an if/else expression: `if !(test && test) { println!("Noooo!"); }` + +error: equal expressions as operands to `&&` + --> $DIR/match_bool.rs:35:11 + | +35 | match test && test { + | ^^^^^^^^^^^^ + | + = note: #[deny(clippy::eq_op)] on by default + +error: you seem to be trying to match on a boolean expression + --> $DIR/match_bool.rs:40:5 + | +40 | / match test { +41 | | false => { println!("Noooo!"); } +42 | | true => { println!("Yes!"); } +43 | | }; | |_____^ help: consider using an if/else expression: `if test { println!("Yes!"); } else { println!("Noooo!"); }` error: aborting due to 8 previous errors diff --git a/tests/ui/matches.rs b/tests/ui/matches.rs index 92befb25a..e6e4154e4 100644 --- a/tests/ui/matches.rs +++ b/tests/ui/matches.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(exclusive_range_pattern)] diff --git a/tests/ui/matches.stderr b/tests/ui/matches.stderr index 6f1a06738..bed903faf 100644 --- a/tests/ui/matches.stderr +++ b/tests/ui/matches.stderr @@ -1,362 +1,362 @@ error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/matches.rs:21:5 + --> $DIR/matches.rs:31:5 | -21 | / match ExprNode::Butterflies { -22 | | ExprNode::ExprAddrOf => Some(&NODE), -23 | | _ => { let x = 5; None }, -24 | | } +31 | / match ExprNode::Butterflies { +32 | | ExprNode::ExprAddrOf => Some(&NODE), +33 | | _ => { let x = 5; None }, +34 | | } | |_____^ help: try this: `if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }` | = note: `-D clippy::single-match-else` implied by `-D warnings` error: you don't need to add `&` to all patterns - --> $DIR/matches.rs:30:9 + --> $DIR/matches.rs:40:9 | -30 | / match v { -31 | | &Some(v) => println!("{:?}", v), -32 | | &None => println!("none"), -33 | | } +40 | / match v { +41 | | &Some(v) => println!("{:?}", v), +42 | | &None => println!("none"), +43 | | } | |_________^ | = note: `-D clippy::match-ref-pats` implied by `-D warnings` help: instead of prefixing all patterns with `&`, you can dereference the expression | -30 | match *v { -31 | Some(v) => println!("{:?}", v), -32 | None => println!("none"), +40 | match *v { +41 | Some(v) => println!("{:?}", v), +42 | None => println!("none"), | error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/matches.rs:40:5 + --> $DIR/matches.rs:50:5 | -40 | / match tup { -41 | | &(v, 1) => println!("{}", v), -42 | | _ => println!("none"), -43 | | } +50 | / match tup { +51 | | &(v, 1) => println!("{}", v), +52 | | _ => println!("none"), +53 | | } | |_____^ help: try this: `if let &(v, 1) = tup { $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ; } else { $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ; }` error: you don't need to add `&` to all patterns - --> $DIR/matches.rs:40:5 + --> $DIR/matches.rs:50:5 | -40 | / match tup { -41 | | &(v, 1) => println!("{}", v), -42 | | _ => println!("none"), -43 | | } +50 | / match tup { +51 | | &(v, 1) => println!("{}", v), +52 | | _ => println!("none"), +53 | | } | |_____^ help: instead of prefixing all patterns with `&`, you can dereference the expression | -40 | match *tup { -41 | (v, 1) => println!("{}", v), +50 | match *tup { +51 | (v, 1) => println!("{}", v), | error: you don't need to add `&` to both the expression and the patterns - --> $DIR/matches.rs:46:5 + --> $DIR/matches.rs:56:5 | -46 | / match &w { -47 | | &Some(v) => println!("{:?}", v), -48 | | &None => println!("none"), -49 | | } +56 | / match &w { +57 | | &Some(v) => println!("{:?}", v), +58 | | &None => println!("none"), +59 | | } | |_____^ help: try | -46 | match w { -47 | Some(v) => println!("{:?}", v), -48 | None => println!("none"), +56 | match w { +57 | Some(v) => println!("{:?}", v), +58 | None => println!("none"), | error: you don't need to add `&` to all patterns - --> $DIR/matches.rs:57:5 + --> $DIR/matches.rs:67:5 | -57 | / if let &None = a { -58 | | println!("none"); -59 | | } +67 | / if let &None = a { +68 | | println!("none"); +69 | | } | |_____^ help: instead of prefixing all patterns with `&`, you can dereference the expression | -57 | if let None = *a { +67 | if let None = *a { | ^^^^ ^^ error: you don't need to add `&` to both the expression and the patterns - --> $DIR/matches.rs:62:5 + --> $DIR/matches.rs:72:5 | -62 | / if let &None = &b { -63 | | println!("none"); -64 | | } +72 | / if let &None = &b { +73 | | println!("none"); +74 | | } | |_____^ help: try | -62 | if let None = b { +72 | if let None = b { | ^^^^ ^ error: some ranges overlap - --> $DIR/matches.rs:71:9 + --> $DIR/matches.rs:81:9 | -71 | 0 ... 10 => println!("0 ... 10"), +81 | 0 ... 10 => println!("0 ... 10"), | ^^^^^^^^ | = note: `-D clippy::match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> $DIR/matches.rs:72:9 + --> $DIR/matches.rs:82:9 | -72 | 0 ... 11 => println!("0 ... 11"), +82 | 0 ... 11 => println!("0 ... 11"), | ^^^^^^^^ error: some ranges overlap - --> $DIR/matches.rs:77:9 + --> $DIR/matches.rs:87:9 | -77 | 0 ... 5 => println!("0 ... 5"), +87 | 0 ... 5 => println!("0 ... 5"), | ^^^^^^^ | note: overlaps with this - --> $DIR/matches.rs:79:9 + --> $DIR/matches.rs:89:9 | -79 | FOO ... 11 => println!("0 ... 11"), +89 | FOO ... 11 => println!("0 ... 11"), | ^^^^^^^^^^ error: some ranges overlap - --> $DIR/matches.rs:85:9 + --> $DIR/matches.rs:95:9 | -85 | 0 ... 5 => println!("0 ... 5"), +95 | 0 ... 5 => println!("0 ... 5"), | ^^^^^^^ | note: overlaps with this - --> $DIR/matches.rs:84:9 + --> $DIR/matches.rs:94:9 | -84 | 2 => println!("2"), +94 | 2 => println!("2"), | ^ error: some ranges overlap - --> $DIR/matches.rs:91:9 - | -91 | 0 ... 2 => println!("0 ... 2"), - | ^^^^^^^ - | -note: overlaps with this - --> $DIR/matches.rs:90:9 - | -90 | 2 => println!("2"), - | ^ - -error: some ranges overlap - --> $DIR/matches.rs:114:9 + --> $DIR/matches.rs:101:9 | -114 | 0 .. 11 => println!("0 .. 11"), +101 | 0 ... 2 => println!("0 ... 2"), | ^^^^^^^ | note: overlaps with this - --> $DIR/matches.rs:115:9 + --> $DIR/matches.rs:100:9 | -115 | 0 ... 11 => println!("0 ... 11"), +100 | 2 => println!("2"), + | ^ + +error: some ranges overlap + --> $DIR/matches.rs:124:9 + | +124 | 0 .. 11 => println!("0 .. 11"), + | ^^^^^^^ + | +note: overlaps with this + --> $DIR/matches.rs:125:9 + | +125 | 0 ... 11 => println!("0 ... 11"), | ^^^^^^^^ error: Err(_) will match all errors, maybe not a good idea - --> $DIR/matches.rs:132:9 + --> $DIR/matches.rs:142:9 | -132 | Err(_) => panic!("err") +142 | Err(_) => panic!("err") | ^^^^^^ | = note: `-D clippy::match-wild-err-arm` implied by `-D warnings` = note: to remove this warning, match each error separately or use unreachable macro error: this `match` has identical arm bodies - --> $DIR/matches.rs:131:18 + --> $DIR/matches.rs:141:18 | -131 | Ok(_) => println!("ok"), +141 | Ok(_) => println!("ok"), | ^^^^^^^^^^^^^^ | = note: `-D clippy::match-same-arms` implied by `-D warnings` note: same as this - --> $DIR/matches.rs:130:18 + --> $DIR/matches.rs:140:18 | -130 | Ok(3) => println!("ok"), +140 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ note: consider refactoring into `Ok(3) | Ok(_)` - --> $DIR/matches.rs:130:18 + --> $DIR/matches.rs:140:18 | -130 | Ok(3) => println!("ok"), +140 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: Err(_) will match all errors, maybe not a good idea - --> $DIR/matches.rs:138:9 + --> $DIR/matches.rs:148:9 | -138 | Err(_) => {panic!()} +148 | Err(_) => {panic!()} | ^^^^^^ | = note: to remove this warning, match each error separately or use unreachable macro error: this `match` has identical arm bodies - --> $DIR/matches.rs:137:18 + --> $DIR/matches.rs:147:18 | -137 | Ok(_) => println!("ok"), +147 | Ok(_) => println!("ok"), | ^^^^^^^^^^^^^^ | note: same as this - --> $DIR/matches.rs:136:18 + --> $DIR/matches.rs:146:18 | -136 | Ok(3) => println!("ok"), +146 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ note: consider refactoring into `Ok(3) | Ok(_)` - --> $DIR/matches.rs:136:18 + --> $DIR/matches.rs:146:18 | -136 | Ok(3) => println!("ok"), +146 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: Err(_) will match all errors, maybe not a good idea - --> $DIR/matches.rs:144:9 + --> $DIR/matches.rs:154:9 | -144 | Err(_) => {panic!();} +154 | Err(_) => {panic!();} | ^^^^^^ | = note: to remove this warning, match each error separately or use unreachable macro error: this `match` has identical arm bodies - --> $DIR/matches.rs:143:18 + --> $DIR/matches.rs:153:18 | -143 | Ok(_) => println!("ok"), +153 | Ok(_) => println!("ok"), | ^^^^^^^^^^^^^^ | note: same as this - --> $DIR/matches.rs:142:18 + --> $DIR/matches.rs:152:18 | -142 | Ok(3) => println!("ok"), +152 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ note: consider refactoring into `Ok(3) | Ok(_)` - --> $DIR/matches.rs:142:18 + --> $DIR/matches.rs:152:18 | -142 | Ok(3) => println!("ok"), +152 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies - --> $DIR/matches.rs:150:18 + --> $DIR/matches.rs:160:18 | -150 | Ok(_) => println!("ok"), +160 | Ok(_) => println!("ok"), | ^^^^^^^^^^^^^^ | note: same as this - --> $DIR/matches.rs:149:18 + --> $DIR/matches.rs:159:18 | -149 | Ok(3) => println!("ok"), +159 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ note: consider refactoring into `Ok(3) | Ok(_)` - --> $DIR/matches.rs:149:18 + --> $DIR/matches.rs:159:18 | -149 | Ok(3) => println!("ok"), +159 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies - --> $DIR/matches.rs:157:18 + --> $DIR/matches.rs:167:18 | -157 | Ok(_) => println!("ok"), +167 | Ok(_) => println!("ok"), | ^^^^^^^^^^^^^^ | note: same as this - --> $DIR/matches.rs:156:18 + --> $DIR/matches.rs:166:18 | -156 | Ok(3) => println!("ok"), +166 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ note: consider refactoring into `Ok(3) | Ok(_)` - --> $DIR/matches.rs:156:18 + --> $DIR/matches.rs:166:18 | -156 | Ok(3) => println!("ok"), +166 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies - --> $DIR/matches.rs:163:18 + --> $DIR/matches.rs:173:18 | -163 | Ok(_) => println!("ok"), +173 | Ok(_) => println!("ok"), | ^^^^^^^^^^^^^^ | note: same as this - --> $DIR/matches.rs:162:18 + --> $DIR/matches.rs:172:18 | -162 | Ok(3) => println!("ok"), +172 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ note: consider refactoring into `Ok(3) | Ok(_)` - --> $DIR/matches.rs:162:18 + --> $DIR/matches.rs:172:18 | -162 | Ok(3) => println!("ok"), +172 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies - --> $DIR/matches.rs:169:18 + --> $DIR/matches.rs:179:18 | -169 | Ok(_) => println!("ok"), +179 | Ok(_) => println!("ok"), | ^^^^^^^^^^^^^^ | note: same as this - --> $DIR/matches.rs:168:18 + --> $DIR/matches.rs:178:18 | -168 | Ok(3) => println!("ok"), +178 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ note: consider refactoring into `Ok(3) | Ok(_)` - --> $DIR/matches.rs:168:18 + --> $DIR/matches.rs:178:18 | -168 | Ok(3) => println!("ok"), +178 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies - --> $DIR/matches.rs:190:29 + --> $DIR/matches.rs:200:29 | -190 | (Ok(_), Some(x)) => println!("ok {}", x), +200 | (Ok(_), Some(x)) => println!("ok {}", x), | ^^^^^^^^^^^^^^^^^^^^ | note: same as this - --> $DIR/matches.rs:189:29 + --> $DIR/matches.rs:199:29 | -189 | (Ok(x), Some(_)) => println!("ok {}", x), +199 | (Ok(x), Some(_)) => println!("ok {}", x), | ^^^^^^^^^^^^^^^^^^^^ note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))` - --> $DIR/matches.rs:189:29 + --> $DIR/matches.rs:199:29 | -189 | (Ok(x), Some(_)) => println!("ok {}", x), +199 | (Ok(x), Some(_)) => println!("ok {}", x), | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies - --> $DIR/matches.rs:205:18 + --> $DIR/matches.rs:215:18 | -205 | Ok(_) => println!("ok"), +215 | Ok(_) => println!("ok"), | ^^^^^^^^^^^^^^ | note: same as this - --> $DIR/matches.rs:204:18 + --> $DIR/matches.rs:214:18 | -204 | Ok(3) => println!("ok"), +214 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ note: consider refactoring into `Ok(3) | Ok(_)` - --> $DIR/matches.rs:204:18 + --> $DIR/matches.rs:214:18 | -204 | Ok(3) => println!("ok"), +214 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: use as_ref() instead - --> $DIR/matches.rs:212:33 + --> $DIR/matches.rs:222:33 | -212 | let borrowed: Option<&()> = match owned { +222 | let borrowed: Option<&()> = match owned { | _________________________________^ -213 | | None => None, -214 | | Some(ref v) => Some(v), -215 | | }; +223 | | None => None, +224 | | Some(ref v) => Some(v), +225 | | }; | |_____^ help: try this: `owned.as_ref()` | = note: `-D clippy::match-as-ref` implied by `-D warnings` error: use as_mut() instead - --> $DIR/matches.rs:218:39 + --> $DIR/matches.rs:228:39 | -218 | let borrow_mut: Option<&mut ()> = match mut_owned { +228 | let borrow_mut: Option<&mut ()> = match mut_owned { | _______________________________________^ -219 | | None => None, -220 | | Some(ref mut v) => Some(v), -221 | | }; +229 | | None => None, +230 | | Some(ref mut v) => Some(v), +231 | | }; | |_____^ help: try this: `mut_owned.as_mut()` error: aborting due to 26 previous errors diff --git a/tests/ui/mem_forget.rs b/tests/ui/mem_forget.rs index 96d333a71..0e7cfbffa 100644 --- a/tests/ui/mem_forget.rs +++ b/tests/ui/mem_forget.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/mem_forget.stderr b/tests/ui/mem_forget.stderr index 1f43d9f36..06ac6a367 100644 --- a/tests/ui/mem_forget.stderr +++ b/tests/ui/mem_forget.stderr @@ -1,21 +1,21 @@ error: usage of mem::forget on Drop type - --> $DIR/mem_forget.rs:18:5 + --> $DIR/mem_forget.rs:28:5 | -18 | memstuff::forget(six); +28 | memstuff::forget(six); | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::mem-forget` implied by `-D warnings` error: usage of mem::forget on Drop type - --> $DIR/mem_forget.rs:21:5 + --> $DIR/mem_forget.rs:31:5 | -21 | std::mem::forget(seven); +31 | std::mem::forget(seven); | ^^^^^^^^^^^^^^^^^^^^^^^ error: usage of mem::forget on Drop type - --> $DIR/mem_forget.rs:24:5 + --> $DIR/mem_forget.rs:34:5 | -24 | forgetSomething(eight); +34 | forgetSomething(eight); | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/mem_replace.rs b/tests/ui/mem_replace.rs index 62df42ef2..69e3ae96b 100644 --- a/tests/ui/mem_replace.rs +++ b/tests/ui/mem_replace.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all, clippy::style, clippy::mem_replace_option_with_none)] diff --git a/tests/ui/mem_replace.stderr b/tests/ui/mem_replace.stderr index 8385fa3cb..64a169015 100644 --- a/tests/ui/mem_replace.stderr +++ b/tests/ui/mem_replace.stderr @@ -1,15 +1,15 @@ error: replacing an `Option` with `None` - --> $DIR/mem_replace.rs:8:13 - | -8 | let _ = mem::replace(&mut an_option, None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()` - | - = note: `-D clippy::mem-replace-option-with-none` implied by `-D warnings` + --> $DIR/mem_replace.rs:18:13 + | +18 | let _ = mem::replace(&mut an_option, None); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()` + | + = note: `-D clippy::mem-replace-option-with-none` implied by `-D warnings` error: replacing an `Option` with `None` - --> $DIR/mem_replace.rs:10:13 + --> $DIR/mem_replace.rs:20:13 | -10 | let _ = mem::replace(an_option, None); +20 | let _ = mem::replace(an_option, None); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()` error: aborting due to 2 previous errors diff --git a/tests/ui/methods.rs b/tests/ui/methods.rs index 7faa45b98..5bf52c740 100644 --- a/tests/ui/methods.rs +++ b/tests/ui/methods.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/methods.stderr b/tests/ui/methods.stderr index 3189f3756..4b8c04037 100644 --- a/tests/ui/methods.stderr +++ b/tests/ui/methods.stderr @@ -1,454 +1,454 @@ error: defining a method called `add` on this type; consider implementing the `std::ops::Add` trait or choosing a less ambiguous name - --> $DIR/methods.rs:21:5 + --> $DIR/methods.rs:31:5 | -21 | pub fn add(self, other: T) -> T { self } +31 | pub fn add(self, other: T) -> T { self } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::should-implement-trait` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> $DIR/methods.rs:32:17 + --> $DIR/methods.rs:42:17 | -32 | fn into_u16(&self) -> u16 { 0 } +42 | fn into_u16(&self) -> u16 { 0 } | ^^^^^ | = note: `-D clippy::wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> $DIR/methods.rs:34:21 + --> $DIR/methods.rs:44:21 | -34 | fn to_something(self) -> u32 { 0 } +44 | fn to_something(self) -> u32 { 0 } | ^^^^ error: methods called `new` usually take no self; consider choosing a less ambiguous name - --> $DIR/methods.rs:36:12 + --> $DIR/methods.rs:46:12 | -36 | fn new(self) {} +46 | fn new(self) {} | ^^^^ error: methods called `new` usually return `Self` - --> $DIR/methods.rs:36:5 + --> $DIR/methods.rs:46:5 | -36 | fn new(self) {} +46 | fn new(self) {} | ^^^^^^^^^^^^^^^ | = note: `-D clippy::new-ret-no-self` implied by `-D warnings` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:104:13 + --> $DIR/methods.rs:114:13 | -104 | let _ = opt.map(|x| x + 1) +114 | let _ = opt.map(|x| x + 1) | _____________^ -105 | | -106 | | .unwrap_or(0); // should lint even though this call is on a separate line +115 | | +116 | | .unwrap_or(0); // should lint even though this call is on a separate line | |____________________________^ | = note: `-D clippy::option-map-unwrap-or` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:108:13 + --> $DIR/methods.rs:118:13 | -108 | let _ = opt.map(|x| { +118 | let _ = opt.map(|x| { | _____________^ -109 | | x + 1 -110 | | } -111 | | ).unwrap_or(0); +119 | | x + 1 +120 | | } +121 | | ).unwrap_or(0); | |____________________________^ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:112:13 + --> $DIR/methods.rs:122:13 | -112 | let _ = opt.map(|x| x + 1) +122 | let _ = opt.map(|x| x + 1) | _____________^ -113 | | .unwrap_or({ -114 | | 0 -115 | | }); +123 | | .unwrap_or({ +124 | | 0 +125 | | }); | |__________________^ error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:117:13 + --> $DIR/methods.rs:127:13 | -117 | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None); +127 | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))` error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:119:13 + --> $DIR/methods.rs:129:13 | -119 | let _ = opt.map(|x| { +129 | let _ = opt.map(|x| { | _____________^ -120 | | Some(x + 1) -121 | | } -122 | | ).unwrap_or(None); +130 | | Some(x + 1) +131 | | } +132 | | ).unwrap_or(None); | |_____________________^ error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:123:13 + --> $DIR/methods.rs:133:13 | -123 | let _ = opt +133 | let _ = opt | _____________^ -124 | | .map(|x| Some(x + 1)) -125 | | .unwrap_or(None); +134 | | .map(|x| Some(x + 1)) +135 | | .unwrap_or(None); | |________________________^ | = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:131:13 + --> $DIR/methods.rs:141:13 | -131 | let _ = opt.map(|x| x + 1) +141 | let _ = opt.map(|x| x + 1) | _____________^ -132 | | -133 | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line +142 | | +143 | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line | |____________________________________^ | = note: `-D clippy::option-map-unwrap-or-else` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:135:13 + --> $DIR/methods.rs:145:13 | -135 | let _ = opt.map(|x| { +145 | let _ = opt.map(|x| { | _____________^ -136 | | x + 1 -137 | | } -138 | | ).unwrap_or_else(|| 0); +146 | | x + 1 +147 | | } +148 | | ).unwrap_or_else(|| 0); | |____________________________________^ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:139:13 + --> $DIR/methods.rs:149:13 | -139 | let _ = opt.map(|x| x + 1) +149 | let _ = opt.map(|x| x + 1) | _____________^ -140 | | .unwrap_or_else(|| -141 | | 0 -142 | | ); +150 | | .unwrap_or_else(|| +151 | | 0 +152 | | ); | |_________________^ error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:148:13 + --> $DIR/methods.rs:158:13 | -148 | let _ = opt.map_or(None, |x| Some(x + 1)); +158 | let _ = opt.map_or(None, |x| Some(x + 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))` | = note: `-D clippy::option-map-or-none` implied by `-D warnings` error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:150:13 + --> $DIR/methods.rs:160:13 | -150 | let _ = opt.map_or(None, |x| { +160 | let _ = opt.map_or(None, |x| { | _____________^ -151 | | Some(x + 1) -152 | | } -153 | | ); +161 | | Some(x + 1) +162 | | } +163 | | ); | |_________________^ help: try using and_then instead | -150 | let _ = opt.and_then(|x| { -151 | Some(x + 1) -152 | }); +160 | let _ = opt.and_then(|x| { +161 | Some(x + 1) +162 | }); | error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead - --> $DIR/methods.rs:163:13 + --> $DIR/methods.rs:173:13 | -163 | let _ = res.map(|x| x + 1) +173 | let _ = res.map(|x| x + 1) | _____________^ -164 | | -165 | | .unwrap_or_else(|e| 0); // should lint even though this call is on a separate line +174 | | +175 | | .unwrap_or_else(|e| 0); // should lint even though this call is on a separate line | |_____________________________________^ | = note: `-D clippy::result-map-unwrap-or-else` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `ok().map_or_else(|e| 0, |x| x + 1)` error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead - --> $DIR/methods.rs:167:13 + --> $DIR/methods.rs:177:13 | -167 | let _ = res.map(|x| { +177 | let _ = res.map(|x| { | _____________^ -168 | | x + 1 -169 | | } -170 | | ).unwrap_or_else(|e| 0); +178 | | x + 1 +179 | | } +180 | | ).unwrap_or_else(|e| 0); | |_____________________________________^ error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead - --> $DIR/methods.rs:171:13 + --> $DIR/methods.rs:181:13 | -171 | let _ = res.map(|x| x + 1) +181 | let _ = res.map(|x| x + 1) | _____________^ -172 | | .unwrap_or_else(|e| -173 | | 0 -174 | | ); +182 | | .unwrap_or_else(|e| +183 | | 0 +184 | | ); | |_________________^ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> $DIR/methods.rs:234:13 + --> $DIR/methods.rs:244:13 | -234 | let _ = v.iter().filter(|&x| *x < 0).next(); +244 | let _ = v.iter().filter(|&x| *x < 0).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::filter-next` implied by `-D warnings` = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)` error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> $DIR/methods.rs:237:13 + --> $DIR/methods.rs:247:13 | -237 | let _ = v.iter().filter(|&x| { +247 | let _ = v.iter().filter(|&x| { | _____________^ -238 | | *x < 0 -239 | | } -240 | | ).next(); +248 | | *x < 0 +249 | | } +250 | | ).next(); | |___________________________^ error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:252:13 + --> $DIR/methods.rs:262:13 | -252 | let _ = v.iter().find(|&x| *x < 0).is_some(); +262 | let _ = v.iter().find(|&x| *x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::search-is-some` implied by `-D warnings` = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)` error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:255:13 + --> $DIR/methods.rs:265:13 | -255 | let _ = v.iter().find(|&x| { +265 | let _ = v.iter().find(|&x| { | _____________^ -256 | | *x < 0 -257 | | } -258 | | ).is_some(); +266 | | *x < 0 +267 | | } +268 | | ).is_some(); | |______________________________^ error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:261:13 + --> $DIR/methods.rs:271:13 | -261 | let _ = v.iter().position(|&x| x < 0).is_some(); +271 | let _ = v.iter().position(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:264:13 + --> $DIR/methods.rs:274:13 | -264 | let _ = v.iter().position(|&x| { +274 | let _ = v.iter().position(|&x| { | _____________^ -265 | | x < 0 -266 | | } -267 | | ).is_some(); +275 | | x < 0 +276 | | } +277 | | ).is_some(); | |______________________________^ error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:270:13 + --> $DIR/methods.rs:280:13 | -270 | let _ = v.iter().rposition(|&x| x < 0).is_some(); +280 | let _ = v.iter().rposition(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:273:13 + --> $DIR/methods.rs:283:13 | -273 | let _ = v.iter().rposition(|&x| { +283 | let _ = v.iter().rposition(|&x| { | _____________^ -274 | | x < 0 -275 | | } -276 | | ).is_some(); +284 | | x < 0 +285 | | } +286 | | ).is_some(); | |______________________________^ error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:308:22 + --> $DIR/methods.rs:318:22 | -308 | with_constructor.unwrap_or(make()); +318 | with_constructor.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)` | = note: `-D clippy::or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `new` - --> $DIR/methods.rs:311:5 + --> $DIR/methods.rs:321:5 | -311 | with_new.unwrap_or(Vec::new()); +321 | with_new.unwrap_or(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:314:21 + --> $DIR/methods.rs:324:21 | -314 | with_const_args.unwrap_or(Vec::with_capacity(12)); +324 | with_const_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:317:14 + --> $DIR/methods.rs:327:14 | -317 | with_err.unwrap_or(make()); +327 | with_err.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:320:19 + --> $DIR/methods.rs:330:19 | -320 | with_err_args.unwrap_or(Vec::with_capacity(12)); +330 | with_err_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))` error: use of `unwrap_or` followed by a call to `default` - --> $DIR/methods.rs:323:5 + --> $DIR/methods.rs:333:5 | -323 | with_default_trait.unwrap_or(Default::default()); +333 | with_default_trait.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()` error: use of `unwrap_or` followed by a call to `default` - --> $DIR/methods.rs:326:5 + --> $DIR/methods.rs:336:5 | -326 | with_default_type.unwrap_or(u64::default()); +336 | with_default_type.unwrap_or(u64::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:329:14 + --> $DIR/methods.rs:339:14 | -329 | with_vec.unwrap_or(vec![]); +339 | with_vec.unwrap_or(vec![]); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:334:21 + --> $DIR/methods.rs:344:21 | -334 | without_default.unwrap_or(Foo::new()); +344 | without_default.unwrap_or(Foo::new()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)` error: use of `or_insert` followed by a function call - --> $DIR/methods.rs:337:19 + --> $DIR/methods.rs:347:19 | -337 | map.entry(42).or_insert(String::new()); +347 | map.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)` error: use of `or_insert` followed by a function call - --> $DIR/methods.rs:340:21 + --> $DIR/methods.rs:350:21 | -340 | btree.entry(42).or_insert(String::new()); +350 | btree.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:343:21 + --> $DIR/methods.rs:353:21 | -343 | let _ = stringy.unwrap_or("".to_owned()); +353 | let _ = stringy.unwrap_or("".to_owned()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())` error: `error_code` is shadowed by `123_i32` - --> $DIR/methods.rs:377:9 + --> $DIR/methods.rs:387:9 | -377 | let error_code = 123_i32; +387 | let error_code = 123_i32; | ^^^^^^^^^^ | = note: `-D clippy::shadow-unrelated` implied by `-D warnings` note: initialization happens here - --> $DIR/methods.rs:377:22 + --> $DIR/methods.rs:387:22 | -377 | let error_code = 123_i32; +387 | let error_code = 123_i32; | ^^^^^^^ note: previous binding is here - --> $DIR/methods.rs:364:9 + --> $DIR/methods.rs:374:9 | -364 | let error_code = 123_i32; +374 | let error_code = 123_i32; | ^^^^^^^^^^ error: use of `expect` followed by a function call - --> $DIR/methods.rs:366:26 + --> $DIR/methods.rs:376:26 | -366 | with_none_and_format.expect(&format!("Error {}: fake error", error_code)); +376 | with_none_and_format.expect(&format!("Error {}: fake error", error_code)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))` | = note: `-D clippy::expect-fun-call` implied by `-D warnings` error: use of `expect` followed by a function call - --> $DIR/methods.rs:369:26 + --> $DIR/methods.rs:379:26 | -369 | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str()); +379 | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!(format!("Error {}: fake error", error_code).as_str()))` error: use of `expect` followed by a function call - --> $DIR/methods.rs:379:25 + --> $DIR/methods.rs:389:25 | -379 | with_err_and_format.expect(&format!("Error {}: fake error", error_code)); +389 | with_err_and_format.expect(&format!("Error {}: fake error", error_code)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))` error: use of `expect` followed by a function call - --> $DIR/methods.rs:382:25 + --> $DIR/methods.rs:392:25 | -382 | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str()); +392 | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!(format!("Error {}: fake error", error_code).as_str()))` error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:406:23 + --> $DIR/methods.rs:416:23 | -406 | let bad_vec = some_vec.iter().nth(3); +416 | let bad_vec = some_vec.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:407:26 + --> $DIR/methods.rs:417:26 | -407 | let bad_slice = &some_vec[..].iter().nth(3); +417 | let bad_slice = &some_vec[..].iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:408:31 + --> $DIR/methods.rs:418:31 | -408 | let bad_boxed_slice = boxed_slice.iter().nth(3); +418 | let bad_boxed_slice = boxed_slice.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:409:29 + --> $DIR/methods.rs:419:29 | -409 | let bad_vec_deque = some_vec_deque.iter().nth(3); +419 | let bad_vec_deque = some_vec_deque.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:414:23 + --> $DIR/methods.rs:424:23 | -414 | let bad_vec = some_vec.iter_mut().nth(3); +424 | let bad_vec = some_vec.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:417:26 + --> $DIR/methods.rs:427:26 | -417 | let bad_slice = &some_vec[..].iter_mut().nth(3); +427 | let bad_slice = &some_vec[..].iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:420:29 + --> $DIR/methods.rs:430:29 | -420 | let bad_vec_deque = some_vec_deque.iter_mut().nth(3); +430 | let bad_vec_deque = some_vec_deque.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:432:13 + --> $DIR/methods.rs:442:13 | -432 | let _ = some_vec.iter().skip(42).next(); +442 | let _ = some_vec.iter().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-skip-next` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:433:13 + --> $DIR/methods.rs:443:13 | -433 | let _ = some_vec.iter().cycle().skip(42).next(); +443 | let _ = some_vec.iter().cycle().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:434:13 + --> $DIR/methods.rs:444:13 | -434 | let _ = (1..10).skip(10).next(); +444 | let _ = (1..10).skip(10).next(); | ^^^^^^^^^^^^^^^^^^^^^^^ error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:435:14 + --> $DIR/methods.rs:445:14 | -435 | let _ = &some_vec[..].iter().skip(3).next(); +445 | let _ = &some_vec[..].iter().skip(3).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used unwrap() on an Option value. If you don't want to handle the None case gracefully, consider using expect() to provide a better panic message - --> $DIR/methods.rs:444:13 + --> $DIR/methods.rs:454:13 | -444 | let _ = opt.unwrap(); +454 | let _ = opt.unwrap(); | ^^^^^^^^^^^^ | = note: `-D clippy::option-unwrap-used` implied by `-D warnings` diff --git a/tests/ui/min_max.rs b/tests/ui/min_max.rs index 9866933f9..32e3863ad 100644 --- a/tests/ui/min_max.rs +++ b/tests/ui/min_max.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/min_max.stderr b/tests/ui/min_max.stderr index e89542a2d..3ed67ad25 100644 --- a/tests/ui/min_max.stderr +++ b/tests/ui/min_max.stderr @@ -1,45 +1,45 @@ error: this min/max combination leads to constant result - --> $DIR/min_max.rs:15:5 + --> $DIR/min_max.rs:25:5 | -15 | min(1, max(3, x)); +25 | min(1, max(3, x)); | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> $DIR/min_max.rs:16:5 + --> $DIR/min_max.rs:26:5 | -16 | min(max(3, x), 1); +26 | min(max(3, x), 1); | ^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> $DIR/min_max.rs:17:5 + --> $DIR/min_max.rs:27:5 | -17 | max(min(x, 1), 3); +27 | max(min(x, 1), 3); | ^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> $DIR/min_max.rs:18:5 + --> $DIR/min_max.rs:28:5 | -18 | max(3, min(x, 1)); +28 | max(3, min(x, 1)); | ^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> $DIR/min_max.rs:20:5 + --> $DIR/min_max.rs:30:5 | -20 | my_max(3, my_min(x, 1)); +30 | my_max(3, my_min(x, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> $DIR/min_max.rs:32:5 + --> $DIR/min_max.rs:42:5 | -32 | min("Apple", max("Zoo", s)); +42 | min("Apple", max("Zoo", s)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this min/max combination leads to constant result - --> $DIR/min_max.rs:33:5 + --> $DIR/min_max.rs:43:5 | -33 | max(min(s, "Apple"), "Zoo"); +43 | max(min(s, "Apple"), "Zoo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/tests/ui/missing-doc.rs b/tests/ui/missing-doc.rs index 6968adb31..43dad8398 100644 --- a/tests/ui/missing-doc.rs +++ b/tests/ui/missing-doc.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] /* This file incorporates work covered by the following copyright and diff --git a/tests/ui/missing-doc.stderr b/tests/ui/missing-doc.stderr index ebc4c5aca..67f50152c 100644 --- a/tests/ui/missing-doc.stderr +++ b/tests/ui/missing-doc.stderr @@ -1,267 +1,267 @@ error: missing documentation for a type alias - --> $DIR/missing-doc.rs:28:1 + --> $DIR/missing-doc.rs:38:1 | -28 | type Typedef = String; +38 | type Typedef = String; | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a type alias - --> $DIR/missing-doc.rs:29:1 + --> $DIR/missing-doc.rs:39:1 | -29 | pub type PubTypedef = String; +39 | pub type PubTypedef = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a struct - --> $DIR/missing-doc.rs:31:1 + --> $DIR/missing-doc.rs:41:1 | -31 | / struct Foo { -32 | | a: isize, -33 | | b: isize, -34 | | } +41 | / struct Foo { +42 | | a: isize, +43 | | b: isize, +44 | | } | |_^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:32:5 + --> $DIR/missing-doc.rs:42:5 | -32 | a: isize, +42 | a: isize, | ^^^^^^^^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:33:5 + --> $DIR/missing-doc.rs:43:5 | -33 | b: isize, +43 | b: isize, | ^^^^^^^^ error: missing documentation for a struct - --> $DIR/missing-doc.rs:36:1 + --> $DIR/missing-doc.rs:46:1 | -36 | / pub struct PubFoo { -37 | | pub a: isize, -38 | | b: isize, -39 | | } +46 | / pub struct PubFoo { +47 | | pub a: isize, +48 | | b: isize, +49 | | } | |_^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:37:5 + --> $DIR/missing-doc.rs:47:5 | -37 | pub a: isize, +47 | pub a: isize, | ^^^^^^^^^^^^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:38:5 + --> $DIR/missing-doc.rs:48:5 | -38 | b: isize, +48 | b: isize, | ^^^^^^^^ error: missing documentation for a module - --> $DIR/missing-doc.rs:47:1 + --> $DIR/missing-doc.rs:57:1 | -47 | mod module_no_dox {} +57 | mod module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a module - --> $DIR/missing-doc.rs:48:1 + --> $DIR/missing-doc.rs:58:1 | -48 | pub mod pub_module_no_dox {} +58 | pub mod pub_module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:52:1 + --> $DIR/missing-doc.rs:62:1 | -52 | pub fn foo2() {} +62 | pub fn foo2() {} | ^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:53:1 + --> $DIR/missing-doc.rs:63:1 | -53 | fn foo3() {} +63 | fn foo3() {} | ^^^^^^^^^^^^ error: missing documentation for a trait - --> $DIR/missing-doc.rs:70:1 + --> $DIR/missing-doc.rs:80:1 | -70 | / pub trait C { -71 | | fn foo(&self); -72 | | fn foo_with_impl(&self) {} -73 | | } +80 | / pub trait C { +81 | | fn foo(&self); +82 | | fn foo_with_impl(&self) {} +83 | | } | |_^ error: missing documentation for a trait method - --> $DIR/missing-doc.rs:71:5 + --> $DIR/missing-doc.rs:81:5 | -71 | fn foo(&self); +81 | fn foo(&self); | ^^^^^^^^^^^^^^ error: missing documentation for a trait method - --> $DIR/missing-doc.rs:72:5 + --> $DIR/missing-doc.rs:82:5 | -72 | fn foo_with_impl(&self) {} +82 | fn foo_with_impl(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type - --> $DIR/missing-doc.rs:82:5 + --> $DIR/missing-doc.rs:92:5 | -82 | type AssociatedType; +92 | type AssociatedType; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type - --> $DIR/missing-doc.rs:83:5 + --> $DIR/missing-doc.rs:93:5 | -83 | type AssociatedTypeDef = Self; +93 | type AssociatedTypeDef = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a method - --> $DIR/missing-doc.rs:94:5 - | -94 | pub fn foo() {} - | ^^^^^^^^^^^^^^^ - -error: missing documentation for a method - --> $DIR/missing-doc.rs:95:5 - | -95 | fn bar() {} - | ^^^^^^^^^^^ - -error: missing documentation for a method - --> $DIR/missing-doc.rs:99:5 - | -99 | pub fn foo() {} - | ^^^^^^^^^^^^^^^ - -error: missing documentation for a method - --> $DIR/missing-doc.rs:102:5 + --> $DIR/missing-doc.rs:104:5 | -102 | fn foo2() {} +104 | pub fn foo() {} + | ^^^^^^^^^^^^^^^ + +error: missing documentation for a method + --> $DIR/missing-doc.rs:105:5 + | +105 | fn bar() {} + | ^^^^^^^^^^^ + +error: missing documentation for a method + --> $DIR/missing-doc.rs:109:5 + | +109 | pub fn foo() {} + | ^^^^^^^^^^^^^^^ + +error: missing documentation for a method + --> $DIR/missing-doc.rs:112:5 + | +112 | fn foo2() {} | ^^^^^^^^^^^^ error: missing documentation for an enum - --> $DIR/missing-doc.rs:128:1 + --> $DIR/missing-doc.rs:138:1 | -128 | / enum Baz { -129 | | BazA { -130 | | a: isize, -131 | | b: isize -132 | | }, -133 | | BarB -134 | | } +138 | / enum Baz { +139 | | BazA { +140 | | a: isize, +141 | | b: isize +142 | | }, +143 | | BarB +144 | | } | |_^ error: missing documentation for a variant - --> $DIR/missing-doc.rs:129:5 + --> $DIR/missing-doc.rs:139:5 | -129 | / BazA { -130 | | a: isize, -131 | | b: isize -132 | | }, +139 | / BazA { +140 | | a: isize, +141 | | b: isize +142 | | }, | |_____^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:130:9 + --> $DIR/missing-doc.rs:140:9 | -130 | a: isize, +140 | a: isize, | ^^^^^^^^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:131:9 + --> $DIR/missing-doc.rs:141:9 | -131 | b: isize +141 | b: isize | ^^^^^^^^ error: missing documentation for a variant - --> $DIR/missing-doc.rs:133:5 + --> $DIR/missing-doc.rs:143:5 | -133 | BarB +143 | BarB | ^^^^ error: missing documentation for an enum - --> $DIR/missing-doc.rs:136:1 + --> $DIR/missing-doc.rs:146:1 | -136 | / pub enum PubBaz { -137 | | PubBazA { -138 | | a: isize, -139 | | }, -140 | | } +146 | / pub enum PubBaz { +147 | | PubBazA { +148 | | a: isize, +149 | | }, +150 | | } | |_^ error: missing documentation for a variant - --> $DIR/missing-doc.rs:137:5 + --> $DIR/missing-doc.rs:147:5 | -137 | / PubBazA { -138 | | a: isize, -139 | | }, +147 | / PubBazA { +148 | | a: isize, +149 | | }, | |_____^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:138:9 + --> $DIR/missing-doc.rs:148:9 | -138 | a: isize, +148 | a: isize, | ^^^^^^^^ error: missing documentation for a constant - --> $DIR/missing-doc.rs:162:1 + --> $DIR/missing-doc.rs:172:1 | -162 | const FOO: u32 = 0; +172 | const FOO: u32 = 0; | ^^^^^^^^^^^^^^^^^^^ error: missing documentation for a constant - --> $DIR/missing-doc.rs:169:1 + --> $DIR/missing-doc.rs:179:1 | -169 | pub const FOO4: u32 = 0; +179 | pub const FOO4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> $DIR/missing-doc.rs:172:1 + --> $DIR/missing-doc.rs:182:1 | -172 | static BAR: u32 = 0; +182 | static BAR: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> $DIR/missing-doc.rs:179:1 + --> $DIR/missing-doc.rs:189:1 | -179 | pub static BAR4: u32 = 0; +189 | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a module - --> $DIR/missing-doc.rs:182:1 + --> $DIR/missing-doc.rs:192:1 | -182 | / mod internal_impl { -183 | | /// dox -184 | | pub fn documented() {} -185 | | pub fn undocumented1() {} +192 | / mod internal_impl { +193 | | /// dox +194 | | pub fn documented() {} +195 | | pub fn undocumented1() {} ... | -194 | | } -195 | | } +204 | | } +205 | | } | |_^ error: missing documentation for a function - --> $DIR/missing-doc.rs:185:5 + --> $DIR/missing-doc.rs:195:5 | -185 | pub fn undocumented1() {} +195 | pub fn undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:186:5 + --> $DIR/missing-doc.rs:196:5 | -186 | pub fn undocumented2() {} +196 | pub fn undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:187:5 + --> $DIR/missing-doc.rs:197:5 | -187 | fn undocumented3() {} +197 | fn undocumented3() {} | ^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:192:9 + --> $DIR/missing-doc.rs:202:9 | -192 | pub fn also_undocumented1() {} +202 | pub fn also_undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:193:9 + --> $DIR/missing-doc.rs:203:9 | -193 | fn also_undocumented2() {} +203 | fn also_undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 39 previous errors diff --git a/tests/ui/missing_inline.rs b/tests/ui/missing_inline.rs index 7fbb01c6d..593774da1 100644 --- a/tests/ui/missing_inline.rs +++ b/tests/ui/missing_inline.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] /* This file incorporates work covered by the following copyright and diff --git a/tests/ui/missing_inline.stderr b/tests/ui/missing_inline.stderr index 3609c9101..fc617ef54 100644 --- a/tests/ui/missing_inline.stderr +++ b/tests/ui/missing_inline.stderr @@ -1,39 +1,39 @@ error: missing `#[inline]` for a function - --> $DIR/missing_inline.rs:33:1 + --> $DIR/missing_inline.rs:43:1 | -33 | pub fn pub_foo() {} // missing #[inline] +43 | pub fn pub_foo() {} // missing #[inline] | ^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::missing-inline-in-public-items` implied by `-D warnings` error: missing `#[inline]` for a default trait method - --> $DIR/missing_inline.rs:48:5 + --> $DIR/missing_inline.rs:58:5 | -48 | fn PubBar_b() {} // missing #[inline] +58 | fn PubBar_b() {} // missing #[inline] | ^^^^^^^^^^^^^^^^ error: missing `#[inline]` for a method - --> $DIR/missing_inline.rs:61:5 + --> $DIR/missing_inline.rs:71:5 | -61 | fn PubBar_a() {} // missing #[inline] +71 | fn PubBar_a() {} // missing #[inline] | ^^^^^^^^^^^^^^^^ error: missing `#[inline]` for a method - --> $DIR/missing_inline.rs:62:5 + --> $DIR/missing_inline.rs:72:5 | -62 | fn PubBar_b() {} // missing #[inline] - | ^^^^^^^^^^^^^^^^ - -error: missing `#[inline]` for a method - --> $DIR/missing_inline.rs:63:5 - | -63 | fn PubBar_c() {} // missing #[inline] +72 | fn PubBar_b() {} // missing #[inline] | ^^^^^^^^^^^^^^^^ error: missing `#[inline]` for a method --> $DIR/missing_inline.rs:73:5 | -73 | pub fn PubFooImpl() {} // missing #[inline] +73 | fn PubBar_c() {} // missing #[inline] + | ^^^^^^^^^^^^^^^^ + +error: missing `#[inline]` for a method + --> $DIR/missing_inline.rs:83:5 + | +83 | pub fn PubFooImpl() {} // missing #[inline] | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/module_inception.rs b/tests/ui/module_inception.rs index b6917020e..1dfc06f38 100644 --- a/tests/ui/module_inception.rs +++ b/tests/ui/module_inception.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::module_inception)] diff --git a/tests/ui/module_inception.stderr b/tests/ui/module_inception.stderr index 43f9666f7..c1e6d0a6e 100644 --- a/tests/ui/module_inception.stderr +++ b/tests/ui/module_inception.stderr @@ -1,19 +1,19 @@ error: module has the same name as its containing module - --> $DIR/module_inception.rs:7:9 - | -7 | / mod bar { -8 | | mod foo {} -9 | | } - | |_________^ - | - = note: `-D clippy::module-inception` implied by `-D warnings` + --> $DIR/module_inception.rs:17:9 + | +17 | / mod bar { +18 | | mod foo {} +19 | | } + | |_________^ + | + = note: `-D clippy::module-inception` implied by `-D warnings` error: module has the same name as its containing module - --> $DIR/module_inception.rs:12:5 + --> $DIR/module_inception.rs:22:5 | -12 | / mod foo { -13 | | mod bar {} -14 | | } +22 | / mod foo { +23 | | mod bar {} +24 | | } | |_____^ error: aborting due to 2 previous errors diff --git a/tests/ui/modulo_one.rs b/tests/ui/modulo_one.rs index 7dcec04ba..6e0cbc581 100644 --- a/tests/ui/modulo_one.rs +++ b/tests/ui/modulo_one.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::modulo_one)] diff --git a/tests/ui/modulo_one.stderr b/tests/ui/modulo_one.stderr index 5d42c3e0a..57e2c59ee 100644 --- a/tests/ui/modulo_one.stderr +++ b/tests/ui/modulo_one.stderr @@ -1,10 +1,10 @@ error: any number modulo 1 will be 0 - --> $DIR/modulo_one.rs:7:5 - | -7 | 10 % 1; - | ^^^^^^ - | - = note: `-D clippy::modulo-one` implied by `-D warnings` + --> $DIR/modulo_one.rs:17:5 + | +17 | 10 % 1; + | ^^^^^^ + | + = note: `-D clippy::modulo-one` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/mut_from_ref.rs b/tests/ui/mut_from_ref.rs index b75fa92f0..37256efb8 100644 --- a/tests/ui/mut_from_ref.rs +++ b/tests/ui/mut_from_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused, clippy::trivially_copy_pass_by_ref)] diff --git a/tests/ui/mut_from_ref.stderr b/tests/ui/mut_from_ref.stderr index 0f5baa2d2..48b5abf5a 100644 --- a/tests/ui/mut_from_ref.stderr +++ b/tests/ui/mut_from_ref.stderr @@ -1,62 +1,62 @@ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:9:39 - | -9 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { - | ^^^^^^^^ - | - = note: `-D clippy::mut-from-ref` implied by `-D warnings` + --> $DIR/mut_from_ref.rs:19:39 + | +19 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { + | ^^^^^^^^ + | + = note: `-D clippy::mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> $DIR/mut_from_ref.rs:9:29 - | -9 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { - | ^^^^^ + --> $DIR/mut_from_ref.rs:19:29 + | +19 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { + | ^^^^^ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:15:25 + --> $DIR/mut_from_ref.rs:25:25 | -15 | fn ouch(x: &Foo) -> &mut Foo; +25 | fn ouch(x: &Foo) -> &mut Foo; | ^^^^^^^^ | note: immutable borrow here - --> $DIR/mut_from_ref.rs:15:16 + --> $DIR/mut_from_ref.rs:25:16 | -15 | fn ouch(x: &Foo) -> &mut Foo; +25 | fn ouch(x: &Foo) -> &mut Foo; | ^^^^ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:24:21 + --> $DIR/mut_from_ref.rs:34:21 | -24 | fn fail(x: &u32) -> &mut u16 { +34 | fn fail(x: &u32) -> &mut u16 { | ^^^^^^^^ | note: immutable borrow here - --> $DIR/mut_from_ref.rs:24:12 + --> $DIR/mut_from_ref.rs:34:12 | -24 | fn fail(x: &u32) -> &mut u16 { +34 | fn fail(x: &u32) -> &mut u16 { | ^^^^ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:28:50 + --> $DIR/mut_from_ref.rs:38:50 | -28 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { +38 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { | ^^^^^^^^^^^ | note: immutable borrow here - --> $DIR/mut_from_ref.rs:28:25 + --> $DIR/mut_from_ref.rs:38:25 | -28 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { +38 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { | ^^^^^^^ error: mutable borrow from immutable input(s) - --> $DIR/mut_from_ref.rs:32:67 + --> $DIR/mut_from_ref.rs:42:67 | -32 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { +42 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { | ^^^^^^^^^^^ | note: immutable borrow here - --> $DIR/mut_from_ref.rs:32:27 + --> $DIR/mut_from_ref.rs:42:27 | -32 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { +42 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { | ^^^^^^^ ^^^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/mut_mut.rs b/tests/ui/mut_mut.rs index 4656d2764..81c945bea 100644 --- a/tests/ui/mut_mut.rs +++ b/tests/ui/mut_mut.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/mut_mut.stderr b/tests/ui/mut_mut.stderr index 88bd2f729..c05c02157 100644 --- a/tests/ui/mut_mut.stderr +++ b/tests/ui/mut_mut.stderr @@ -1,60 +1,60 @@ error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:10:12 + --> $DIR/mut_mut.rs:20:12 | -10 | fn fun(x : &mut &mut u32) -> bool { +20 | fn fun(x : &mut &mut u32) -> bool { | ^^^^^^^^^^^^^ | = note: `-D clippy::mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:24:17 + --> $DIR/mut_mut.rs:34:17 | -24 | let mut x = &mut &mut 1u32; +34 | let mut x = &mut &mut 1u32; | ^^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:19:20 + --> $DIR/mut_mut.rs:29:20 | -19 | ($p:expr) => { &mut $p } +29 | ($p:expr) => { &mut $p } | ^^^^^^^ ... -39 | let mut z = mut_ptr!(&mut 3u32); +49 | let mut z = mut_ptr!(&mut 3u32); | ------------------- in this macro invocation error: this expression mutably borrows a mutable reference. Consider reborrowing - --> $DIR/mut_mut.rs:26:21 + --> $DIR/mut_mut.rs:36:21 | -26 | let mut y = &mut x; +36 | let mut y = &mut x; | ^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:30:33 + --> $DIR/mut_mut.rs:40:33 | -30 | let y : &mut &mut u32 = &mut &mut 2; +40 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:30:17 + --> $DIR/mut_mut.rs:40:17 | -30 | let y : &mut &mut u32 = &mut &mut 2; +40 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:38 + --> $DIR/mut_mut.rs:45:38 | -35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; +45 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:17 + --> $DIR/mut_mut.rs:45:17 | -35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; +45 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^^^ error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:22 + --> $DIR/mut_mut.rs:45:22 | -35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; +45 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/tests/ui/mut_range_bound.rs b/tests/ui/mut_range_bound.rs index 0e397c7ae..edc86b5d6 100644 --- a/tests/ui/mut_range_bound.rs +++ b/tests/ui/mut_range_bound.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + diff --git a/tests/ui/mut_range_bound.stderr b/tests/ui/mut_range_bound.stderr index fece96106..a476ad5d1 100644 --- a/tests/ui/mut_range_bound.stderr +++ b/tests/ui/mut_range_bound.stderr @@ -1,33 +1,33 @@ error: attempt to mutate range bound within loop; note that the range of the loop is unchanged - --> $DIR/mut_range_bound.rs:18:21 + --> $DIR/mut_range_bound.rs:28:21 | -18 | for i in 0..m { m = 5; } // warning +28 | for i in 0..m { m = 5; } // warning | ^^^^^ | = note: `-D clippy::mut-range-bound` implied by `-D warnings` error: attempt to mutate range bound within loop; note that the range of the loop is unchanged - --> $DIR/mut_range_bound.rs:23:22 + --> $DIR/mut_range_bound.rs:33:22 | -23 | for i in m..10 { m *= 2; } // warning +33 | for i in m..10 { m *= 2; } // warning | ^^^^^^ error: attempt to mutate range bound within loop; note that the range of the loop is unchanged - --> $DIR/mut_range_bound.rs:29:21 + --> $DIR/mut_range_bound.rs:39:21 | -29 | for i in m..n { m = 5; n = 7; } // warning (1 for each mutated bound) +39 | for i in m..n { m = 5; n = 7; } // warning (1 for each mutated bound) | ^^^^^ error: attempt to mutate range bound within loop; note that the range of the loop is unchanged - --> $DIR/mut_range_bound.rs:29:28 + --> $DIR/mut_range_bound.rs:39:28 | -29 | for i in m..n { m = 5; n = 7; } // warning (1 for each mutated bound) +39 | for i in m..n { m = 5; n = 7; } // warning (1 for each mutated bound) | ^^^^^ error: attempt to mutate range bound within loop; note that the range of the loop is unchanged - --> $DIR/mut_range_bound.rs:40:22 + --> $DIR/mut_range_bound.rs:50:22 | -40 | let n = &mut m; // warning +50 | let n = &mut m; // warning | ^ error: aborting due to 5 previous errors diff --git a/tests/ui/mut_reference.rs b/tests/ui/mut_reference.rs index 38b0e25e0..f42d48f0d 100644 --- a/tests/ui/mut_reference.rs +++ b/tests/ui/mut_reference.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/mut_reference.stderr b/tests/ui/mut_reference.stderr index ee62e2647..07b07580d 100644 --- a/tests/ui/mut_reference.stderr +++ b/tests/ui/mut_reference.stderr @@ -1,21 +1,21 @@ error: The function/method `takes_an_immutable_reference` doesn't need a mutable reference - --> $DIR/mut_reference.rs:22:34 + --> $DIR/mut_reference.rs:32:34 | -22 | takes_an_immutable_reference(&mut 42); +32 | takes_an_immutable_reference(&mut 42); | ^^^^^^^ | = note: `-D clippy::unnecessary-mut-passed` implied by `-D warnings` error: The function/method `as_ptr` doesn't need a mutable reference - --> $DIR/mut_reference.rs:24:12 + --> $DIR/mut_reference.rs:34:12 | -24 | as_ptr(&mut 42); +34 | as_ptr(&mut 42); | ^^^^^^^ error: The function/method `takes_an_immutable_reference` doesn't need a mutable reference - --> $DIR/mut_reference.rs:28:44 + --> $DIR/mut_reference.rs:38:44 | -28 | my_struct.takes_an_immutable_reference(&mut 42); +38 | my_struct.takes_an_immutable_reference(&mut 42); | ^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/mutex_atomic.rs b/tests/ui/mutex_atomic.rs index 3eefbb97a..e0ce93bf6 100644 --- a/tests/ui/mutex_atomic.rs +++ b/tests/ui/mutex_atomic.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/mutex_atomic.stderr b/tests/ui/mutex_atomic.stderr index 2df58889a..a317e8a6c 100644 --- a/tests/ui/mutex_atomic.stderr +++ b/tests/ui/mutex_atomic.stderr @@ -1,47 +1,47 @@ error: Consider using an AtomicBool instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:9:5 - | -9 | Mutex::new(true); - | ^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::mutex-atomic` implied by `-D warnings` + --> $DIR/mutex_atomic.rs:19:5 + | +19 | Mutex::new(true); + | ^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::mutex-atomic` implied by `-D warnings` error: Consider using an AtomicUsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:10:5 + --> $DIR/mutex_atomic.rs:20:5 | -10 | Mutex::new(5usize); +20 | Mutex::new(5usize); | ^^^^^^^^^^^^^^^^^^ error: Consider using an AtomicIsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:11:5 + --> $DIR/mutex_atomic.rs:21:5 | -11 | Mutex::new(9isize); +21 | Mutex::new(9isize); | ^^^^^^^^^^^^^^^^^^ error: Consider using an AtomicPtr instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:13:5 + --> $DIR/mutex_atomic.rs:23:5 | -13 | Mutex::new(&x as *const u32); +23 | Mutex::new(&x as *const u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Consider using an AtomicPtr instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:14:5 + --> $DIR/mutex_atomic.rs:24:5 | -14 | Mutex::new(&mut x as *mut u32); +24 | Mutex::new(&mut x as *mut u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Consider using an AtomicUsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:15:5 + --> $DIR/mutex_atomic.rs:25:5 | -15 | Mutex::new(0u32); +25 | Mutex::new(0u32); | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::mutex-integer` implied by `-D warnings` error: Consider using an AtomicIsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> $DIR/mutex_atomic.rs:16:5 + --> $DIR/mutex_atomic.rs:26:5 | -16 | Mutex::new(0i32); +26 | Mutex::new(0i32); | ^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/tests/ui/needless_bool.rs b/tests/ui/needless_bool.rs index 4e6f65ed0..0e8e250c9 100644 --- a/tests/ui/needless_bool.rs +++ b/tests/ui/needless_bool.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::needless_bool)] diff --git a/tests/ui/needless_bool.stderr b/tests/ui/needless_bool.stderr index dd132bc67..13af6fc35 100644 --- a/tests/ui/needless_bool.stderr +++ b/tests/ui/needless_bool.stderr @@ -1,69 +1,69 @@ error: this if-then-else expression will always return true - --> $DIR/needless_bool.rs:9:5 - | -9 | if x { true } else { true }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::needless-bool` implied by `-D warnings` + --> $DIR/needless_bool.rs:19:5 + | +19 | if x { true } else { true }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::needless-bool` implied by `-D warnings` error: this if-then-else expression will always return false - --> $DIR/needless_bool.rs:10:5 + --> $DIR/needless_bool.rs:20:5 | -10 | if x { false } else { false }; +20 | if x { false } else { false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:11:5 + --> $DIR/needless_bool.rs:21:5 | -11 | if x { true } else { false }; +21 | if x { true } else { false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `x` error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:12:5 + --> $DIR/needless_bool.rs:22:5 | -12 | if x { false } else { true }; +22 | if x { false } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!x` error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:13:5 + --> $DIR/needless_bool.rs:23:5 | -13 | if x && y { false } else { true }; +23 | if x && y { false } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!(x && y)` error: this if-then-else expression will always return true - --> $DIR/needless_bool.rs:25:5 + --> $DIR/needless_bool.rs:35:5 | -25 | if x { return true } else { return true }; +35 | if x { return true } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this if-then-else expression will always return false - --> $DIR/needless_bool.rs:30:5 - | -30 | if x { return false } else { return false }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: this if-then-else expression returns a bool literal - --> $DIR/needless_bool.rs:35:5 - | -35 | if x { return true } else { return false }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x` - -error: this if-then-else expression returns a bool literal --> $DIR/needless_bool.rs:40:5 | -40 | if x && y { return true } else { return false }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x && y` +40 | if x { return false } else { return false }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this if-then-else expression returns a bool literal --> $DIR/needless_bool.rs:45:5 | -45 | if x { return false } else { return true }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !x` +45 | if x { return true } else { return false }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x` error: this if-then-else expression returns a bool literal --> $DIR/needless_bool.rs:50:5 | -50 | if x && y { return false } else { return true }; +50 | if x && y { return true } else { return false }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x && y` + +error: this if-then-else expression returns a bool literal + --> $DIR/needless_bool.rs:55:5 + | +55 | if x { return false } else { return true }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !x` + +error: this if-then-else expression returns a bool literal + --> $DIR/needless_bool.rs:60:5 + | +60 | if x && y { return false } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !(x && y)` error: aborting due to 11 previous errors diff --git a/tests/ui/needless_borrow.rs b/tests/ui/needless_borrow.rs index 61384c43f..1cf7b4066 100644 --- a/tests/ui/needless_borrow.rs +++ b/tests/ui/needless_borrow.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] use std::borrow::Cow; diff --git a/tests/ui/needless_borrow.stderr b/tests/ui/needless_borrow.stderr index c720dff5d..93ba61784 100644 --- a/tests/ui/needless_borrow.stderr +++ b/tests/ui/needless_borrow.stderr @@ -1,41 +1,41 @@ error: this expression borrows a reference that is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:15:15 + --> $DIR/needless_borrow.rs:25:15 | -15 | let c = x(&&a); +25 | let c = x(&&a); | ^^^ help: change this to: `&a` | = note: `-D clippy::needless-borrow` implied by `-D warnings` error: this pattern creates a reference to a reference - --> $DIR/needless_borrow.rs:22:17 + --> $DIR/needless_borrow.rs:32:17 | -22 | if let Some(ref cake) = Some(&5) {} +32 | if let Some(ref cake) = Some(&5) {} | ^^^^^^^^ help: change this to: `cake` error: this expression borrows a reference that is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:29:15 + --> $DIR/needless_borrow.rs:39:15 | -29 | 46 => &&a, +39 | 46 => &&a, | ^^^ help: change this to: `&a` error: this pattern takes a reference on something that is being de-referenced - --> $DIR/needless_borrow.rs:51:34 + --> $DIR/needless_borrow.rs:61:34 | -51 | let _ = v.iter_mut().filter(|&ref a| a.is_empty()); +61 | let _ = v.iter_mut().filter(|&ref a| a.is_empty()); | ^^^^^^ help: try removing the `&ref` part and just keep: `a` | = note: `-D clippy::needless-borrowed-reference` implied by `-D warnings` error: this pattern takes a reference on something that is being de-referenced - --> $DIR/needless_borrow.rs:52:30 + --> $DIR/needless_borrow.rs:62:30 | -52 | let _ = v.iter().filter(|&ref a| a.is_empty()); +62 | let _ = v.iter().filter(|&ref a| a.is_empty()); | ^^^^^^ help: try removing the `&ref` part and just keep: `a` error: this pattern creates a reference to a reference - --> $DIR/needless_borrow.rs:52:31 + --> $DIR/needless_borrow.rs:62:31 | -52 | let _ = v.iter().filter(|&ref a| a.is_empty()); +62 | let _ = v.iter().filter(|&ref a| a.is_empty()); | ^^^^^ help: change this to: `a` error: aborting due to 6 previous errors diff --git a/tests/ui/needless_borrowed_ref.rs b/tests/ui/needless_borrowed_ref.rs index 000ecd32d..650b57b58 100644 --- a/tests/ui/needless_borrowed_ref.rs +++ b/tests/ui/needless_borrowed_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/needless_borrowed_ref.stderr b/tests/ui/needless_borrowed_ref.stderr index 3113b887b..ef80473a9 100644 --- a/tests/ui/needless_borrowed_ref.stderr +++ b/tests/ui/needless_borrowed_ref.stderr @@ -1,27 +1,27 @@ error: this pattern takes a reference on something that is being de-referenced - --> $DIR/needless_borrowed_ref.rs:8:34 - | -8 | let _ = v.iter_mut().filter(|&ref a| a.is_empty()); - | ^^^^^^ help: try removing the `&ref` part and just keep: `a` - | - = note: `-D clippy::needless-borrowed-reference` implied by `-D warnings` + --> $DIR/needless_borrowed_ref.rs:18:34 + | +18 | let _ = v.iter_mut().filter(|&ref a| a.is_empty()); + | ^^^^^^ help: try removing the `&ref` part and just keep: `a` + | + = note: `-D clippy::needless-borrowed-reference` implied by `-D warnings` error: this pattern takes a reference on something that is being de-referenced - --> $DIR/needless_borrowed_ref.rs:13:17 + --> $DIR/needless_borrowed_ref.rs:23:17 | -13 | if let Some(&ref v) = thingy { +23 | if let Some(&ref v) = thingy { | ^^^^^^ help: try removing the `&ref` part and just keep: `v` error: this pattern takes a reference on something that is being de-referenced - --> $DIR/needless_borrowed_ref.rs:42:27 + --> $DIR/needless_borrowed_ref.rs:52:27 | -42 | (&Animal::Cat(v), &ref k) | (&ref k, &Animal::Cat(v)) => (), // lifetime mismatch error if there is no '&ref' +52 | (&Animal::Cat(v), &ref k) | (&ref k, &Animal::Cat(v)) => (), // lifetime mismatch error if there is no '&ref' | ^^^^^^ help: try removing the `&ref` part and just keep: `k` error: this pattern takes a reference on something that is being de-referenced - --> $DIR/needless_borrowed_ref.rs:42:38 + --> $DIR/needless_borrowed_ref.rs:52:38 | -42 | (&Animal::Cat(v), &ref k) | (&ref k, &Animal::Cat(v)) => (), // lifetime mismatch error if there is no '&ref' +52 | (&Animal::Cat(v), &ref k) | (&ref k, &Animal::Cat(v)) => (), // lifetime mismatch error if there is no '&ref' | ^^^^^^ help: try removing the `&ref` part and just keep: `k` error: aborting due to 4 previous errors diff --git a/tests/ui/needless_collect.rs b/tests/ui/needless_collect.rs index b001f20d5..45622b333 100644 --- a/tests/ui/needless_collect.rs +++ b/tests/ui/needless_collect.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] use std::collections::{HashMap, HashSet, BTreeSet}; diff --git a/tests/ui/needless_collect.stderr b/tests/ui/needless_collect.stderr index 0124db3b9..ee41a9d8d 100644 --- a/tests/ui/needless_collect.stderr +++ b/tests/ui/needless_collect.stderr @@ -1,27 +1,27 @@ error: avoid using `collect()` when not needed - --> $DIR/needless_collect.rs:9:28 - | -9 | let len = sample.iter().collect::>().len(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `.count()` - | - = note: `-D clippy::needless-collect` implied by `-D warnings` + --> $DIR/needless_collect.rs:19:28 + | +19 | let len = sample.iter().collect::>().len(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `.count()` + | + = note: `-D clippy::needless-collect` implied by `-D warnings` error: avoid using `collect()` when not needed - --> $DIR/needless_collect.rs:10:21 + --> $DIR/needless_collect.rs:20:21 | -10 | if sample.iter().collect::>().is_empty() { +20 | if sample.iter().collect::>().is_empty() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `.next().is_none()` error: avoid using `collect()` when not needed - --> $DIR/needless_collect.rs:13:27 + --> $DIR/needless_collect.rs:23:27 | -13 | sample.iter().cloned().collect::>().contains(&1); +23 | sample.iter().cloned().collect::>().contains(&1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `.any(|&x| x == 1)` error: avoid using `collect()` when not needed - --> $DIR/needless_collect.rs:14:34 + --> $DIR/needless_collect.rs:24:34 | -14 | sample.iter().map(|x| (x, x)).collect::>().len(); +24 | sample.iter().map(|x| (x, x)).collect::>().len(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `.count()` error: aborting due to 4 previous errors diff --git a/tests/ui/needless_continue.rs b/tests/ui/needless_continue.rs index 4fe523e48..4a15987ba 100644 --- a/tests/ui/needless_continue.rs +++ b/tests/ui/needless_continue.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/needless_continue.stderr b/tests/ui/needless_continue.stderr index 7cfaf89d6..10e7062f2 100644 --- a/tests/ui/needless_continue.stderr +++ b/tests/ui/needless_continue.stderr @@ -1,11 +1,11 @@ error: This else block is redundant. - --> $DIR/needless_continue.rs:26:16 + --> $DIR/needless_continue.rs:36:16 | -26 | } else { +36 | } else { | ________________^ -27 | | continue; -28 | | } +37 | | continue; +38 | | } | |_________^ | = note: `-D clippy::needless-continue` implied by `-D warnings` @@ -37,14 +37,14 @@ error: This else block is redundant. error: There is no need for an explicit `else` block for this `if` expression - --> $DIR/needless_continue.rs:41:9 + --> $DIR/needless_continue.rs:51:9 | -41 | / if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 { -42 | | continue; -43 | | } else { -44 | | println!("Blabber"); -45 | | println!("Jabber"); -46 | | } +51 | / if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 { +52 | | continue; +53 | | } else { +54 | | println!("Blabber"); +55 | | println!("Jabber"); +56 | | } | |_________^ | = help: Consider dropping the else clause, and moving out the code in the else block, like so: diff --git a/tests/ui/needless_pass_by_value.rs b/tests/ui/needless_pass_by_value.rs index 31ad96942..3e029de47 100644 --- a/tests/ui/needless_pass_by_value.rs +++ b/tests/ui/needless_pass_by_value.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::needless_pass_by_value)] diff --git a/tests/ui/needless_pass_by_value.stderr b/tests/ui/needless_pass_by_value.stderr index 0d4a35363..3685f0e96 100644 --- a/tests/ui/needless_pass_by_value.stderr +++ b/tests/ui/needless_pass_by_value.stderr @@ -1,199 +1,199 @@ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:11:23 + --> $DIR/needless_pass_by_value.rs:21:23 | -11 | fn foo(v: Vec, w: Vec, mut x: Vec, y: Vec) -> Vec { +21 | fn foo(v: Vec, w: Vec, mut x: Vec, y: Vec) -> Vec { | ^^^^^^ help: consider changing the type to: `&[T]` | = note: `-D clippy::needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:25:11 + --> $DIR/needless_pass_by_value.rs:35:11 | -25 | fn bar(x: String, y: Wrapper) { +35 | fn bar(x: String, y: Wrapper) { | ^^^^^^ help: consider changing the type to: `&str` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:25:22 + --> $DIR/needless_pass_by_value.rs:35:22 | -25 | fn bar(x: String, y: Wrapper) { +35 | fn bar(x: String, y: Wrapper) { | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:31:71 + --> $DIR/needless_pass_by_value.rs:41:71 | -31 | fn test_borrow_trait, U: AsRef, V>(t: T, u: U, v: V) { +41 | fn test_borrow_trait, U: AsRef, V>(t: T, u: U, v: V) { | ^ help: consider taking a reference instead: `&V` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:43:18 + --> $DIR/needless_pass_by_value.rs:53:18 | -43 | fn test_match(x: Option>, y: Option>) { +53 | fn test_match(x: Option>, y: Option>) { | ^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead | -43 | fn test_match(x: &Option>, y: Option>) { -44 | match *x { +53 | fn test_match(x: &Option>, y: Option>) { +54 | match *x { | error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:56:24 + --> $DIR/needless_pass_by_value.rs:66:24 | -56 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { +66 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:56:36 + --> $DIR/needless_pass_by_value.rs:66:36 | -56 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { +66 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ help: consider taking a reference instead | -56 | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) { -57 | let Wrapper(s) = z; // moved -58 | let Wrapper(ref t) = *y; // not moved -59 | let Wrapper(_) = *y; // still not moved +66 | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) { +67 | let Wrapper(s) = z; // moved +68 | let Wrapper(ref t) = *y; // not moved +69 | let Wrapper(_) = *y; // still not moved | error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:72:49 + --> $DIR/needless_pass_by_value.rs:82:49 | -72 | fn test_blanket_ref(_foo: T, _serializable: S) {} +82 | fn test_blanket_ref(_foo: T, _serializable: S) {} | ^ help: consider taking a reference instead: `&T` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:74:18 + --> $DIR/needless_pass_by_value.rs:84:18 | -74 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { +84 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^ help: consider taking a reference instead: `&String` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:74:29 + --> $DIR/needless_pass_by_value.rs:84:29 | -74 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { +84 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^ help: consider changing the type to | -74 | fn issue_2114(s: String, t: &str, u: Vec, v: Vec) { +84 | fn issue_2114(s: String, t: &str, u: Vec, v: Vec) { | ^^^^ help: change `t.clone()` to | -76 | let _ = t.to_string(); +86 | let _ = t.to_string(); | ^^^^^^^^^^^^^ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:74:40 + --> $DIR/needless_pass_by_value.rs:84:40 | -74 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { +84 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^^^ help: consider taking a reference instead: `&Vec` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:74:53 + --> $DIR/needless_pass_by_value.rs:84:53 | -74 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { +84 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^^^ help: consider changing the type to | -74 | fn issue_2114(s: String, t: String, u: Vec, v: &[i32]) { +84 | fn issue_2114(s: String, t: String, u: Vec, v: &[i32]) { | ^^^^^^ help: change `v.clone()` to | -78 | let _ = v.to_owned(); +88 | let _ = v.to_owned(); | ^^^^^^^^^^^^ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:86:12 + --> $DIR/needless_pass_by_value.rs:96:12 | -86 | s: String, +96 | s: String, | ^^^^^^ help: consider changing the type to: `&str` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:87:12 + --> $DIR/needless_pass_by_value.rs:97:12 | -87 | t: String, +97 | t: String, | ^^^^^^ help: consider taking a reference instead: `&String` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:99:13 - | -99 | _u: U, - | ^ help: consider taking a reference instead: `&U` + --> $DIR/needless_pass_by_value.rs:109:13 + | +109 | _u: U, + | ^ help: consider taking a reference instead: `&U` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:100:13 + --> $DIR/needless_pass_by_value.rs:110:13 | -100 | _s: Self, +110 | _s: Self, | ^^^^ help: consider taking a reference instead: `&Self` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:122:24 + --> $DIR/needless_pass_by_value.rs:132:24 | -122 | fn bar_copy(x: u32, y: CopyWrapper) { +132 | fn bar_copy(x: u32, y: CopyWrapper) { | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | help: consider marking this type as Copy - --> $DIR/needless_pass_by_value.rs:120:1 + --> $DIR/needless_pass_by_value.rs:130:1 | -120 | struct CopyWrapper(u32); +130 | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:128:29 + --> $DIR/needless_pass_by_value.rs:138:29 | -128 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { +138 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | help: consider marking this type as Copy - --> $DIR/needless_pass_by_value.rs:120:1 + --> $DIR/needless_pass_by_value.rs:130:1 | -120 | struct CopyWrapper(u32); +130 | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:128:45 + --> $DIR/needless_pass_by_value.rs:138:45 | -128 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { +138 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | ^^^^^^^^^^^ | help: consider marking this type as Copy - --> $DIR/needless_pass_by_value.rs:120:1 + --> $DIR/needless_pass_by_value.rs:130:1 | -120 | struct CopyWrapper(u32); +130 | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead | -128 | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) { -129 | let CopyWrapper(s) = z; // moved -130 | let CopyWrapper(ref t) = *y; // not moved -131 | let CopyWrapper(_) = *y; // still not moved +138 | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) { +139 | let CopyWrapper(s) = z; // moved +140 | let CopyWrapper(ref t) = *y; // not moved +141 | let CopyWrapper(_) = *y; // still not moved | error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:128:61 + --> $DIR/needless_pass_by_value.rs:138:61 | -128 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { +138 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | ^^^^^^^^^^^ | help: consider marking this type as Copy - --> $DIR/needless_pass_by_value.rs:120:1 + --> $DIR/needless_pass_by_value.rs:130:1 | -120 | struct CopyWrapper(u32); +130 | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead | -128 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) { -129 | let CopyWrapper(s) = *z; // moved +138 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) { +139 | let CopyWrapper(s) = *z; // moved | error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:140:40 + --> $DIR/needless_pass_by_value.rs:150:40 | -140 | fn some_fun<'b, S: Bar<'b, ()>>(_item: S) {} +150 | fn some_fun<'b, S: Bar<'b, ()>>(_item: S) {} | ^ help: consider taking a reference instead: `&S` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:145:20 + --> $DIR/needless_pass_by_value.rs:155:20 | -145 | fn more_fun(_item: impl Club<'static, i32>) {} +155 | fn more_fun(_item: impl Club<'static, i32>) {} | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&impl Club<'static, i32>` error: aborting due to 22 previous errors diff --git a/tests/ui/needless_pass_by_value_proc_macro.rs b/tests/ui/needless_pass_by_value_proc_macro.rs index 6b1305fa2..b1ca6d75c 100644 --- a/tests/ui/needless_pass_by_value_proc_macro.rs +++ b/tests/ui/needless_pass_by_value_proc_macro.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![crate_type = "proc-macro"] diff --git a/tests/ui/needless_range_loop.rs b/tests/ui/needless_range_loop.rs index 30613f98f..445155028 100644 --- a/tests/ui/needless_range_loop.rs +++ b/tests/ui/needless_range_loop.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn calc_idx(i: usize) -> usize { (i + i + 20) % 4 } diff --git a/tests/ui/needless_range_loop.stderr b/tests/ui/needless_range_loop.stderr index 1954a8240..64b1f3c08 100644 --- a/tests/ui/needless_range_loop.stderr +++ b/tests/ui/needless_range_loop.stderr @@ -1,33 +1,33 @@ error: the loop variable `i` is only used to index `ns`. - --> $DIR/needless_range_loop.rs:8:14 - | -8 | for i in 3..10 { - | ^^^^^ - | - = note: `-D clippy::needless-range-loop` implied by `-D warnings` + --> $DIR/needless_range_loop.rs:18:14 + | +18 | for i in 3..10 { + | ^^^^^ + | + = note: `-D clippy::needless-range-loop` implied by `-D warnings` help: consider using an iterator - | -8 | for in ns.iter().take(10).skip(3) { - | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +18 | for in ns.iter().take(10).skip(3) { + | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the loop variable `i` is only used to index `ms`. - --> $DIR/needless_range_loop.rs:29:14 + --> $DIR/needless_range_loop.rs:39:14 | -29 | for i in 0..ms.len() { +39 | for i in 0..ms.len() { | ^^^^^^^^^^^ help: consider using an iterator | -29 | for in &mut ms { +39 | for in &mut ms { | ^^^^^^ ^^^^^^^ error: the loop variable `i` is only used to index `ms`. - --> $DIR/needless_range_loop.rs:35:14 + --> $DIR/needless_range_loop.rs:45:14 | -35 | for i in 0..ms.len() { +45 | for i in 0..ms.len() { | ^^^^^^^^^^^ help: consider using an iterator | -35 | for in &mut ms { +45 | for in &mut ms { | ^^^^^^ ^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/needless_return.rs b/tests/ui/needless_return.rs index a834563ec..bfe86573a 100644 --- a/tests/ui/needless_return.rs +++ b/tests/ui/needless_return.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/needless_return.stderr b/tests/ui/needless_return.stderr index 094fe3642..742ef8d37 100644 --- a/tests/ui/needless_return.stderr +++ b/tests/ui/needless_return.stderr @@ -1,51 +1,51 @@ error: unneeded return statement - --> $DIR/needless_return.rs:11:5 + --> $DIR/needless_return.rs:21:5 | -11 | return true; +21 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` | = note: `-D clippy::needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:15:5 + --> $DIR/needless_return.rs:25:5 | -15 | return true +25 | return true | ^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:20:9 + --> $DIR/needless_return.rs:30:9 | -20 | return true; +30 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:22:9 + --> $DIR/needless_return.rs:32:9 | -22 | return false; +32 | return false; | ^^^^^^^^^^^^^ help: remove `return` as shown: `false` error: unneeded return statement - --> $DIR/needless_return.rs:28:17 + --> $DIR/needless_return.rs:38:17 | -28 | true => return false, +38 | true => return false, | ^^^^^^^^^^^^ help: remove `return` as shown: `false` error: unneeded return statement - --> $DIR/needless_return.rs:30:13 + --> $DIR/needless_return.rs:40:13 | -30 | return true; +40 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:37:9 + --> $DIR/needless_return.rs:47:9 | -37 | return true; +47 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:39:16 + --> $DIR/needless_return.rs:49:16 | -39 | let _ = || return true; +49 | let _ = || return true; | ^^^^^^^^^^^ help: remove `return` as shown: `true` error: aborting due to 8 previous errors diff --git a/tests/ui/needless_update.rs b/tests/ui/needless_update.rs index 675c60e24..70fe7236c 100644 --- a/tests/ui/needless_update.rs +++ b/tests/ui/needless_update.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/needless_update.stderr b/tests/ui/needless_update.stderr index acc511984..512cec847 100644 --- a/tests/ui/needless_update.stderr +++ b/tests/ui/needless_update.stderr @@ -1,7 +1,7 @@ error: struct update has no effect, all the fields in the struct have already been specified - --> $DIR/needless_update.rs:16:23 + --> $DIR/needless_update.rs:26:23 | -16 | S { a: 1, b: 1, ..base }; +26 | S { a: 1, b: 1, ..base }; | ^^^^ | = note: `-D clippy::needless-update` implied by `-D warnings` diff --git a/tests/ui/neg_cmp_op_on_partial_ord.rs b/tests/ui/neg_cmp_op_on_partial_ord.rs index 3a472bf69..c8edba322 100644 --- a/tests/ui/neg_cmp_op_on_partial_ord.rs +++ b/tests/ui/neg_cmp_op_on_partial_ord.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] //! This test case utilizes `f64` an easy example for `PartialOrd` only types diff --git a/tests/ui/neg_cmp_op_on_partial_ord.stderr b/tests/ui/neg_cmp_op_on_partial_ord.stderr index 5fd4ab9ba..1bd292818 100644 --- a/tests/ui/neg_cmp_op_on_partial_ord.stderr +++ b/tests/ui/neg_cmp_op_on_partial_ord.stderr @@ -1,27 +1,27 @@ error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable. - --> $DIR/neg_cmp_op_on_partial_ord.rs:19:21 + --> $DIR/neg_cmp_op_on_partial_ord.rs:29:21 | -19 | let _not_less = !(a_value < another_value); +29 | let _not_less = !(a_value < another_value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::neg-cmp-op-on-partial-ord` implied by `-D warnings` error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable. - --> $DIR/neg_cmp_op_on_partial_ord.rs:22:30 + --> $DIR/neg_cmp_op_on_partial_ord.rs:32:30 | -22 | let _not_less_or_equal = !(a_value <= another_value); +32 | let _not_less_or_equal = !(a_value <= another_value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable. - --> $DIR/neg_cmp_op_on_partial_ord.rs:25:24 + --> $DIR/neg_cmp_op_on_partial_ord.rs:35:24 | -25 | let _not_greater = !(a_value > another_value); +35 | let _not_greater = !(a_value > another_value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable. - --> $DIR/neg_cmp_op_on_partial_ord.rs:28:33 + --> $DIR/neg_cmp_op_on_partial_ord.rs:38:33 | -28 | let _not_greater_or_equal = !(a_value >= another_value); +38 | let _not_greater_or_equal = !(a_value >= another_value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/neg_multiply.rs b/tests/ui/neg_multiply.rs index b1a1879a3..2589f3b85 100644 --- a/tests/ui/neg_multiply.rs +++ b/tests/ui/neg_multiply.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/neg_multiply.stderr b/tests/ui/neg_multiply.stderr index ba59fdb89..ed96dd519 100644 --- a/tests/ui/neg_multiply.stderr +++ b/tests/ui/neg_multiply.stderr @@ -1,15 +1,15 @@ error: Negation by multiplying with -1 - --> $DIR/neg_multiply.rs:30:5 + --> $DIR/neg_multiply.rs:40:5 | -30 | x * -1; +40 | x * -1; | ^^^^^^ | = note: `-D clippy::neg-multiply` implied by `-D warnings` error: Negation by multiplying with -1 - --> $DIR/neg_multiply.rs:32:5 + --> $DIR/neg_multiply.rs:42:5 | -32 | -1 * x; +42 | -1 * x; | ^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/never_loop.rs b/tests/ui/never_loop.rs index bb6d76b06..901a98559 100644 --- a/tests/ui/never_loop.rs +++ b/tests/ui/never_loop.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::single_match, unused_assignments, unused_variables, clippy::while_immutable_condition)] diff --git a/tests/ui/never_loop.stderr b/tests/ui/never_loop.stderr index 3d1235964..e4daa6e43 100644 --- a/tests/ui/never_loop.stderr +++ b/tests/ui/never_loop.stderr @@ -1,93 +1,93 @@ error: this loop never actually loops - --> $DIR/never_loop.rs:7:5 + --> $DIR/never_loop.rs:17:5 | -7 | / loop { // clippy::never_loop -8 | | x += 1; -9 | | if x == 1 { -10 | | return -11 | | } -12 | | break; -13 | | } +17 | / loop { // clippy::never_loop +18 | | x += 1; +19 | | if x == 1 { +20 | | return +21 | | } +22 | | break; +23 | | } | |_____^ | = note: #[deny(clippy::never_loop)] on by default error: this loop never actually loops - --> $DIR/never_loop.rs:28:5 + --> $DIR/never_loop.rs:38:5 | -28 | / loop { // never loops -29 | | x += 1; -30 | | break -31 | | } +38 | / loop { // never loops +39 | | x += 1; +40 | | break +41 | | } | |_____^ error: this loop never actually loops - --> $DIR/never_loop.rs:47:2 + --> $DIR/never_loop.rs:57:2 | -47 | loop { // never loops +57 | loop { // never loops | _____^ -48 | | while i == 0 { // never loops -49 | | break -50 | | } -51 | | return -52 | | } +58 | | while i == 0 { // never loops +59 | | break +60 | | } +61 | | return +62 | | } | |_____^ error: this loop never actually loops - --> $DIR/never_loop.rs:48:9 + --> $DIR/never_loop.rs:58:9 | -48 | / while i == 0 { // never loops -49 | | break -50 | | } +58 | / while i == 0 { // never loops +59 | | break +60 | | } | |_________^ error: this loop never actually loops - --> $DIR/never_loop.rs:59:3 + --> $DIR/never_loop.rs:69:3 | -59 | loop { // never loops +69 | loop { // never loops | _________^ -60 | | if x == 5 { break } -61 | | continue 'outer -62 | | } +70 | | if x == 5 { break } +71 | | continue 'outer +72 | | } | |_________^ error: this loop never actually loops - --> $DIR/never_loop.rs:92:5 - | -92 | / while let Some(y) = x { // never loops -93 | | return -94 | | } - | |_____^ - -error: this loop never actually loops - --> $DIR/never_loop.rs:98:5 + --> $DIR/never_loop.rs:102:5 | -98 | / for x in 0..10 { // never loops -99 | | match x { -100 | | 1 => break, -101 | | _ => return, -102 | | } -103 | | } +102 | / while let Some(y) = x { // never loops +103 | | return +104 | | } | |_____^ error: this loop never actually loops - --> $DIR/never_loop.rs:144:5 + --> $DIR/never_loop.rs:108:5 | -144 | / 'outer: while a { // never loops -145 | | while a { -146 | | if a { -147 | | a = false; +108 | / for x in 0..10 { // never loops +109 | | match x { +110 | | 1 => break, +111 | | _ => return, +112 | | } +113 | | } + | |_____^ + +error: this loop never actually loops + --> $DIR/never_loop.rs:154:5 + | +154 | / 'outer: while a { // never loops +155 | | while a { +156 | | if a { +157 | | a = false; ... | -151 | | break 'outer; -152 | | } +161 | | break 'outer; +162 | | } | |_____^ error: this loop never actually loops - --> $DIR/never_loop.rs:158:9 + --> $DIR/never_loop.rs:168:9 | -158 | / while false { -159 | | break 'label; -160 | | } +168 | / while false { +169 | | break 'label; +170 | | } | |_________^ error: aborting due to 9 previous errors diff --git a/tests/ui/new_without_default.rs b/tests/ui/new_without_default.rs index bf63e9336..46d2bc45f 100644 --- a/tests/ui/new_without_default.rs +++ b/tests/ui/new_without_default.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(const_fn)] diff --git a/tests/ui/new_without_default.stderr b/tests/ui/new_without_default.stderr index 11ece5e87..534342863 100644 --- a/tests/ui/new_without_default.stderr +++ b/tests/ui/new_without_default.stderr @@ -1,39 +1,39 @@ error: you should consider deriving a `Default` implementation for `Foo` - --> $DIR/new_without_default.rs:12:5 + --> $DIR/new_without_default.rs:22:5 | -12 | pub fn new() -> Foo { Foo } +22 | pub fn new() -> Foo { Foo } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::new-without-default-derive` implied by `-D warnings` help: try this | -9 | #[derive(Default)] +19 | #[derive(Default)] | error: you should consider deriving a `Default` implementation for `Bar` - --> $DIR/new_without_default.rs:18:5 + --> $DIR/new_without_default.rs:28:5 | -18 | pub fn new() -> Self { Bar } +28 | pub fn new() -> Self { Bar } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this | -15 | #[derive(Default)] +25 | #[derive(Default)] | error: you should consider adding a `Default` implementation for `LtKo<'c>` - --> $DIR/new_without_default.rs:66:5 + --> $DIR/new_without_default.rs:76:5 | -66 | pub fn new() -> LtKo<'c> { unimplemented!() } +76 | pub fn new() -> LtKo<'c> { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::new-without-default` implied by `-D warnings` help: try this | -65 | impl Default for LtKo<'c> { -66 | fn default() -> Self { -67 | Self::new() -68 | } -69 | } +75 | impl Default for LtKo<'c> { +76 | fn default() -> Self { +77 | Self::new() +78 | } +79 | } | error: aborting due to 3 previous errors diff --git a/tests/ui/no_effect.rs b/tests/ui/no_effect.rs index 2913ecdbf..a56327eee 100644 --- a/tests/ui/no_effect.rs +++ b/tests/ui/no_effect.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(box_syntax)] diff --git a/tests/ui/no_effect.stderr b/tests/ui/no_effect.stderr index 2429d934c..eca47d754 100644 --- a/tests/ui/no_effect.stderr +++ b/tests/ui/no_effect.stderr @@ -1,275 +1,275 @@ error: statement with no effect - --> $DIR/no_effect.rs:61:5 + --> $DIR/no_effect.rs:71:5 | -61 | 0; +71 | 0; | ^^ | = note: `-D clippy::no-effect` implied by `-D warnings` -error: statement with no effect - --> $DIR/no_effect.rs:62:5 - | -62 | s2; - | ^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:63:5 - | -63 | Unit; - | ^^^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:64:5 - | -64 | Tuple(0); - | ^^^^^^^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:65:5 - | -65 | Struct { field: 0 }; - | ^^^^^^^^^^^^^^^^^^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:66:5 - | -66 | Struct { ..s }; - | ^^^^^^^^^^^^^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:67:5 - | -67 | Union { a: 0 }; - | ^^^^^^^^^^^^^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:68:5 - | -68 | Enum::Tuple(0); - | ^^^^^^^^^^^^^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:69:5 - | -69 | Enum::Struct { field: 0 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:70:5 - | -70 | 5 + 6; - | ^^^^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:71:5 - | -71 | *&42; - | ^^^^^ - error: statement with no effect --> $DIR/no_effect.rs:72:5 | -72 | &6; +72 | s2; | ^^^ error: statement with no effect --> $DIR/no_effect.rs:73:5 | -73 | (5, 6, 7); - | ^^^^^^^^^^ +73 | Unit; + | ^^^^^ error: statement with no effect --> $DIR/no_effect.rs:74:5 | -74 | box 42; - | ^^^^^^^ +74 | Tuple(0); + | ^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:75:5 | -75 | ..; - | ^^^ +75 | Struct { field: 0 }; + | ^^^^^^^^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:76:5 | -76 | 5..; - | ^^^^ +76 | Struct { ..s }; + | ^^^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:77:5 | -77 | ..5; - | ^^^^ +77 | Union { a: 0 }; + | ^^^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:78:5 | -78 | 5..6; - | ^^^^^ +78 | Enum::Tuple(0); + | ^^^^^^^^^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:79:5 + | +79 | Enum::Struct { field: 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:80:5 | -80 | [42, 55]; - | ^^^^^^^^^ +80 | 5 + 6; + | ^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:81:5 | -81 | [42, 55][1]; - | ^^^^^^^^^^^^ +81 | *&42; + | ^^^^^ error: statement with no effect --> $DIR/no_effect.rs:82:5 | -82 | (42, 55).1; - | ^^^^^^^^^^^ +82 | &6; + | ^^^ error: statement with no effect --> $DIR/no_effect.rs:83:5 | -83 | [42; 55]; - | ^^^^^^^^^ +83 | (5, 6, 7); + | ^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:84:5 | -84 | [42; 55][13]; - | ^^^^^^^^^^^^^ +84 | box 42; + | ^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:85:5 + | +85 | ..; + | ^^^ error: statement with no effect --> $DIR/no_effect.rs:86:5 | -86 | || x += 5; - | ^^^^^^^^^^ +86 | 5..; + | ^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:87:5 + | +87 | ..5; + | ^^^^ error: statement with no effect --> $DIR/no_effect.rs:88:5 | -88 | FooString { s: s }; +88 | 5..6; + | ^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:90:5 + | +90 | [42, 55]; + | ^^^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:91:5 + | +91 | [42, 55][1]; + | ^^^^^^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:92:5 + | +92 | (42, 55).1; + | ^^^^^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:93:5 + | +93 | [42; 55]; + | ^^^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:94:5 + | +94 | [42; 55][13]; + | ^^^^^^^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:96:5 + | +96 | || x += 5; + | ^^^^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:98:5 + | +98 | FooString { s: s }; | ^^^^^^^^^^^^^^^^^^^ -error: statement can be reduced - --> $DIR/no_effect.rs:99:5 - | -99 | Tuple(get_number()); - | ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` - | - = note: `-D clippy::unnecessary-operation` implied by `-D warnings` - -error: statement can be reduced - --> $DIR/no_effect.rs:100:5 - | -100 | Struct { field: get_number() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` - -error: statement can be reduced - --> $DIR/no_effect.rs:101:5 - | -101 | Struct { ..get_struct() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_struct();` - -error: statement can be reduced - --> $DIR/no_effect.rs:102:5 - | -102 | Enum::Tuple(get_number()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` - -error: statement can be reduced - --> $DIR/no_effect.rs:103:5 - | -103 | Enum::Struct { field: get_number() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` - -error: statement can be reduced - --> $DIR/no_effect.rs:104:5 - | -104 | 5 + get_number(); - | ^^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` - -error: statement can be reduced - --> $DIR/no_effect.rs:105:5 - | -105 | *&get_number(); - | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` - -error: statement can be reduced - --> $DIR/no_effect.rs:106:5 - | -106 | &get_number(); - | ^^^^^^^^^^^^^^ help: replace it with: `get_number();` - -error: statement can be reduced - --> $DIR/no_effect.rs:107:5 - | -107 | (5, 6, get_number()); - | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `5;6;get_number();` - -error: statement can be reduced - --> $DIR/no_effect.rs:108:5 - | -108 | box get_number(); - | ^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` - error: statement can be reduced --> $DIR/no_effect.rs:109:5 | -109 | get_number()..; - | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +109 | Tuple(get_number()); + | ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` + | + = note: `-D clippy::unnecessary-operation` implied by `-D warnings` error: statement can be reduced --> $DIR/no_effect.rs:110:5 | -110 | ..get_number(); - | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +110 | Struct { field: get_number() }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:111:5 | -111 | 5..get_number(); - | ^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` +111 | Struct { ..get_struct() }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_struct();` error: statement can be reduced --> $DIR/no_effect.rs:112:5 | -112 | [42, get_number()]; - | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` +112 | Enum::Tuple(get_number()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:113:5 | -113 | [42, 55][get_number() as usize]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42, 55];get_number() as usize;` +113 | Enum::Struct { field: get_number() }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:114:5 | -114 | (42, get_number()).1; - | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` +114 | 5 + get_number(); + | ^^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` error: statement can be reduced --> $DIR/no_effect.rs:115:5 | -115 | [get_number(); 55]; - | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +115 | *&get_number(); + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:116:5 | -116 | [42; 55][get_number() as usize]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42; 55];get_number() as usize;` +116 | &get_number(); + | ^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:117:5 | -117 | {get_number()}; - | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +117 | (5, 6, get_number()); + | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `5;6;get_number();` error: statement can be reduced --> $DIR/no_effect.rs:118:5 | -118 | FooString { s: String::from("blah"), }; +118 | box get_number(); + | ^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` + +error: statement can be reduced + --> $DIR/no_effect.rs:119:5 + | +119 | get_number()..; + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` + +error: statement can be reduced + --> $DIR/no_effect.rs:120:5 + | +120 | ..get_number(); + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` + +error: statement can be reduced + --> $DIR/no_effect.rs:121:5 + | +121 | 5..get_number(); + | ^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` + +error: statement can be reduced + --> $DIR/no_effect.rs:122:5 + | +122 | [42, get_number()]; + | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` + +error: statement can be reduced + --> $DIR/no_effect.rs:123:5 + | +123 | [42, 55][get_number() as usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42, 55];get_number() as usize;` + +error: statement can be reduced + --> $DIR/no_effect.rs:124:5 + | +124 | (42, get_number()).1; + | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` + +error: statement can be reduced + --> $DIR/no_effect.rs:125:5 + | +125 | [get_number(); 55]; + | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` + +error: statement can be reduced + --> $DIR/no_effect.rs:126:5 + | +126 | [42; 55][get_number() as usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42; 55];get_number() as usize;` + +error: statement can be reduced + --> $DIR/no_effect.rs:127:5 + | +127 | {get_number()}; + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` + +error: statement can be reduced + --> $DIR/no_effect.rs:128:5 + | +128 | FooString { s: String::from("blah"), }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `String::from("blah");` error: aborting due to 45 previous errors diff --git a/tests/ui/non_copy_const.rs b/tests/ui/non_copy_const.rs index 4e086333b..6c57a37e2 100644 --- a/tests/ui/non_copy_const.rs +++ b/tests/ui/non_copy_const.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(const_string_new, const_vec_new)] diff --git a/tests/ui/non_copy_const.stderr b/tests/ui/non_copy_const.stderr index 7f164595b..744b54748 100644 --- a/tests/ui/non_copy_const.stderr +++ b/tests/ui/non_copy_const.stderr @@ -1,7 +1,7 @@ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:12:1 + --> $DIR/non_copy_const.rs:22:1 | -12 | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable +22 | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: make this a static item: `static` @@ -9,264 +9,264 @@ error: a const item should never be interior mutable = note: #[deny(clippy::declare_interior_mutable_const)] on by default error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:13:1 + --> $DIR/non_copy_const.rs:23:1 | -13 | const CELL: Cell = Cell::new(6); //~ ERROR interior mutable +23 | const CELL: Cell = Cell::new(6); //~ ERROR interior mutable | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: make this a static item: `static` error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:14:1 + --> $DIR/non_copy_const.rs:24:1 | -14 | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec, u8) = ([ATOMIC], Vec::new(), 7); +24 | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec, u8) = ([ATOMIC], Vec::new(), 7); | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: make this a static item: `static` error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:18:42 + --> $DIR/non_copy_const.rs:28:42 | -18 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; }; +28 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; }; | ^^^^^^^^^^^^^^^^^^^^^^ -19 | } -20 | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable +29 | } +30 | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable | ------------------------------------------ in this macro invocation error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:41:5 + --> $DIR/non_copy_const.rs:51:5 | -41 | const ATOMIC: AtomicUsize; //~ ERROR interior mutable +51 | const ATOMIC: AtomicUsize; //~ ERROR interior mutable | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:45:5 + --> $DIR/non_copy_const.rs:55:5 | -45 | const INPUT: T; +55 | const INPUT: T; | ^^^^^^^^^^^^^^^ | help: consider requiring `T` to be `Copy` - --> $DIR/non_copy_const.rs:45:18 + --> $DIR/non_copy_const.rs:55:18 | -45 | const INPUT: T; +55 | const INPUT: T; | ^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:48:5 + --> $DIR/non_copy_const.rs:58:5 | -48 | const ASSOC: Self::NonCopyType; +58 | const ASSOC: Self::NonCopyType; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider requiring `>::NonCopyType` to be `Copy` - --> $DIR/non_copy_const.rs:48:18 + --> $DIR/non_copy_const.rs:58:18 | -48 | const ASSOC: Self::NonCopyType; +58 | const ASSOC: Self::NonCopyType; | ^^^^^^^^^^^^^^^^^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:52:5 + --> $DIR/non_copy_const.rs:62:5 | -52 | const AN_INPUT: T = Self::INPUT; +62 | const AN_INPUT: T = Self::INPUT; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider requiring `T` to be `Copy` - --> $DIR/non_copy_const.rs:52:21 + --> $DIR/non_copy_const.rs:62:21 | -52 | const AN_INPUT: T = Self::INPUT; +62 | const AN_INPUT: T = Self::INPUT; | ^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:18:42 + --> $DIR/non_copy_const.rs:28:42 | -18 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; }; +28 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; }; | ^^^^^^^^^^^^^^^^^^^^^^ ... -55 | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable +65 | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable | ----------------------------------------------- in this macro invocation error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:61:5 + --> $DIR/non_copy_const.rs:71:5 | -61 | const SELF_2: Self; +71 | const SELF_2: Self; | ^^^^^^^^^^^^^^^^^^^ | help: consider requiring `Self` to be `Copy` - --> $DIR/non_copy_const.rs:61:19 + --> $DIR/non_copy_const.rs:71:19 | -61 | const SELF_2: Self; +71 | const SELF_2: Self; | ^^^^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:82:5 + --> $DIR/non_copy_const.rs:92:5 | -82 | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable +92 | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:85:5 + --> $DIR/non_copy_const.rs:95:5 | -85 | const U_SELF: U = U::SELF_2; +95 | const U_SELF: U = U::SELF_2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider requiring `U` to be `Copy` - --> $DIR/non_copy_const.rs:85:19 + --> $DIR/non_copy_const.rs:95:19 | -85 | const U_SELF: U = U::SELF_2; +95 | const U_SELF: U = U::SELF_2; | ^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:88:5 + --> $DIR/non_copy_const.rs:98:5 | -88 | const T_ASSOC: T::NonCopyType = T::ASSOC; +98 | const T_ASSOC: T::NonCopyType = T::ASSOC; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider requiring `>::NonCopyType` to be `Copy` - --> $DIR/non_copy_const.rs:88:20 + --> $DIR/non_copy_const.rs:98:20 | -88 | const T_ASSOC: T::NonCopyType = T::ASSOC; +98 | const T_ASSOC: T::NonCopyType = T::ASSOC; | ^^^^^^^^^^^^^^ error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:95:5 - | -95 | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability - | ^^^^^^ - | - = note: #[deny(clippy::borrow_interior_mutable_const)] on by default - = help: assign this const to a local or static variable, and use the variable here - -error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:96:16 - | -96 | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability - | ^^^^^^ - | - = help: assign this const to a local or static variable, and use the variable here - -error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:98:5 - | -98 | ATOMIC_USIZE_INIT.store(2, Ordering::SeqCst); //~ ERROR interior mutability - | ^^^^^^^^^^^^^^^^^ - | - = help: assign this const to a local or static variable, and use the variable here - -error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:99:16 - | -99 | assert_eq!(ATOMIC_USIZE_INIT.load(Ordering::SeqCst), 0); //~ ERROR interior mutability - | ^^^^^^^^^^^^^^^^^ - | - = help: assign this const to a local or static variable, and use the variable here - -error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:102:22 + --> $DIR/non_copy_const.rs:105:5 | -102 | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability +105 | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability + | ^^^^^^ + | + = note: #[deny(clippy::borrow_interior_mutable_const)] on by default + = help: assign this const to a local or static variable, and use the variable here + +error: a const item with interior mutability should not be borrowed + --> $DIR/non_copy_const.rs:106:16 + | +106 | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability + | ^^^^^^ + | + = help: assign this const to a local or static variable, and use the variable here + +error: a const item with interior mutability should not be borrowed + --> $DIR/non_copy_const.rs:108:5 + | +108 | ATOMIC_USIZE_INIT.store(2, Ordering::SeqCst); //~ ERROR interior mutability + | ^^^^^^^^^^^^^^^^^ + | + = help: assign this const to a local or static variable, and use the variable here + +error: a const item with interior mutability should not be borrowed + --> $DIR/non_copy_const.rs:109:16 + | +109 | assert_eq!(ATOMIC_USIZE_INIT.load(Ordering::SeqCst), 0); //~ ERROR interior mutability + | ^^^^^^^^^^^^^^^^^ + | + = help: assign this const to a local or static variable, and use the variable here + +error: a const item with interior mutability should not be borrowed + --> $DIR/non_copy_const.rs:112:22 + | +112 | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability | ^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:103:25 + --> $DIR/non_copy_const.rs:113:25 | -103 | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability +113 | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability | ^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:104:27 + --> $DIR/non_copy_const.rs:114:27 | -104 | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability +114 | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability | ^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:105:26 + --> $DIR/non_copy_const.rs:115:26 | -105 | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability +115 | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability | ^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:116:14 + --> $DIR/non_copy_const.rs:126:14 | -116 | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability +126 | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:117:14 + --> $DIR/non_copy_const.rs:127:14 | -117 | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability +127 | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:118:19 + --> $DIR/non_copy_const.rs:128:19 | -118 | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability +128 | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:119:14 + --> $DIR/non_copy_const.rs:129:14 | -119 | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability +129 | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:120:13 + --> $DIR/non_copy_const.rs:130:13 | -120 | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability +130 | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:126:13 + --> $DIR/non_copy_const.rs:136:13 | -126 | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability +136 | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:131:5 + --> $DIR/non_copy_const.rs:141:5 | -131 | CELL.set(2); //~ ERROR interior mutability +141 | CELL.set(2); //~ ERROR interior mutability | ^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:132:16 + --> $DIR/non_copy_const.rs:142:16 | -132 | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability +142 | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability | ^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:145:5 + --> $DIR/non_copy_const.rs:155:5 | -145 | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability +155 | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability | ^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:146:16 + --> $DIR/non_copy_const.rs:156:16 | -146 | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability +156 | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability | ^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here diff --git a/tests/ui/non_expressive_names.rs b/tests/ui/non_expressive_names.rs index e8b0021e3..47e4da61b 100644 --- a/tests/ui/non_expressive_names.rs +++ b/tests/ui/non_expressive_names.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all,clippy::similar_names)] diff --git a/tests/ui/non_expressive_names.stderr b/tests/ui/non_expressive_names.stderr index 53cb36eda..1369cd8a4 100644 --- a/tests/ui/non_expressive_names.stderr +++ b/tests/ui/non_expressive_names.stderr @@ -1,170 +1,170 @@ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:18:9 + --> $DIR/non_expressive_names.rs:28:9 | -18 | let bpple: i32; +28 | let bpple: i32; | ^^^^^ | = note: `-D clippy::similar-names` implied by `-D warnings` note: existing binding defined here - --> $DIR/non_expressive_names.rs:16:9 + --> $DIR/non_expressive_names.rs:26:9 | -16 | let apple: i32; +26 | let apple: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `b_pple` - --> $DIR/non_expressive_names.rs:18:9 + --> $DIR/non_expressive_names.rs:28:9 | -18 | let bpple: i32; +28 | let bpple: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:20:9 + --> $DIR/non_expressive_names.rs:30:9 | -20 | let cpple: i32; +30 | let cpple: i32; | ^^^^^ | note: existing binding defined here - --> $DIR/non_expressive_names.rs:16:9 + --> $DIR/non_expressive_names.rs:26:9 | -16 | let apple: i32; +26 | let apple: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `c_pple` - --> $DIR/non_expressive_names.rs:20:9 + --> $DIR/non_expressive_names.rs:30:9 | -20 | let cpple: i32; +30 | let cpple: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:45:9 + --> $DIR/non_expressive_names.rs:55:9 | -45 | let bluby: i32; +55 | let bluby: i32; | ^^^^^ | note: existing binding defined here - --> $DIR/non_expressive_names.rs:44:9 + --> $DIR/non_expressive_names.rs:54:9 | -44 | let blubx: i32; +54 | let blubx: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `blub_y` - --> $DIR/non_expressive_names.rs:45:9 + --> $DIR/non_expressive_names.rs:55:9 | -45 | let bluby: i32; +55 | let bluby: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:50:9 + --> $DIR/non_expressive_names.rs:60:9 | -50 | let coke: i32; +60 | let coke: i32; | ^^^^ | note: existing binding defined here - --> $DIR/non_expressive_names.rs:48:9 + --> $DIR/non_expressive_names.rs:58:9 | -48 | let cake: i32; +58 | let cake: i32; | ^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:68:9 + --> $DIR/non_expressive_names.rs:78:9 | -68 | let xyzeabc: i32; +78 | let xyzeabc: i32; | ^^^^^^^ | note: existing binding defined here - --> $DIR/non_expressive_names.rs:66:9 + --> $DIR/non_expressive_names.rs:76:9 | -66 | let xyz1abc: i32; +76 | let xyz1abc: i32; | ^^^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:72:9 + --> $DIR/non_expressive_names.rs:82:9 | -72 | let parsee: i32; +82 | let parsee: i32; | ^^^^^^ | note: existing binding defined here - --> $DIR/non_expressive_names.rs:70:9 + --> $DIR/non_expressive_names.rs:80:9 | -70 | let parser: i32; +80 | let parser: i32; | ^^^^^^ help: separate the discriminating character by an underscore like: `parse_e` - --> $DIR/non_expressive_names.rs:72:9 + --> $DIR/non_expressive_names.rs:82:9 | -72 | let parsee: i32; +82 | let parsee: i32; | ^^^^^^ error: binding's name is too similar to existing binding - --> $DIR/non_expressive_names.rs:86:16 + --> $DIR/non_expressive_names.rs:96:16 | -86 | bpple: sprang } = unimplemented!(); +96 | bpple: sprang } = unimplemented!(); | ^^^^^^ | note: existing binding defined here - --> $DIR/non_expressive_names.rs:85:22 + --> $DIR/non_expressive_names.rs:95:22 | -85 | let Foo { apple: spring, +95 | let Foo { apple: spring, | ^^^^^^ error: 5th binding whose name is just one char - --> $DIR/non_expressive_names.rs:120:17 + --> $DIR/non_expressive_names.rs:130:17 | -120 | let e: i32; +130 | let e: i32; | ^ | = note: `-D clippy::many-single-char-names` implied by `-D warnings` error: 5th binding whose name is just one char - --> $DIR/non_expressive_names.rs:123:17 + --> $DIR/non_expressive_names.rs:133:17 | -123 | let e: i32; +133 | let e: i32; | ^ error: 6th binding whose name is just one char - --> $DIR/non_expressive_names.rs:124:17 + --> $DIR/non_expressive_names.rs:134:17 | -124 | let f: i32; +134 | let f: i32; | ^ error: 5th binding whose name is just one char - --> $DIR/non_expressive_names.rs:129:13 + --> $DIR/non_expressive_names.rs:139:13 | -129 | e => panic!(), +139 | e => panic!(), | ^ error: consider choosing a more descriptive name - --> $DIR/non_expressive_names.rs:139:9 + --> $DIR/non_expressive_names.rs:149:9 | -139 | let _1 = 1; //~ERROR Consider a more descriptive name +149 | let _1 = 1; //~ERROR Consider a more descriptive name | ^^ | = note: `-D clippy::just-underscores-and-digits` implied by `-D warnings` error: consider choosing a more descriptive name - --> $DIR/non_expressive_names.rs:140:9 + --> $DIR/non_expressive_names.rs:150:9 | -140 | let ____1 = 1; //~ERROR Consider a more descriptive name +150 | let ____1 = 1; //~ERROR Consider a more descriptive name | ^^^^^ error: consider choosing a more descriptive name - --> $DIR/non_expressive_names.rs:141:9 + --> $DIR/non_expressive_names.rs:151:9 | -141 | let __1___2 = 12; //~ERROR Consider a more descriptive name +151 | let __1___2 = 12; //~ERROR Consider a more descriptive name | ^^^^^^^ error: consider choosing a more descriptive name - --> $DIR/non_expressive_names.rs:161:13 + --> $DIR/non_expressive_names.rs:171:13 | -161 | let _1 = 1; +171 | let _1 = 1; | ^^ error: consider choosing a more descriptive name - --> $DIR/non_expressive_names.rs:162:13 + --> $DIR/non_expressive_names.rs:172:13 | -162 | let ____1 = 1; +172 | let ____1 = 1; | ^^^^^ error: consider choosing a more descriptive name - --> $DIR/non_expressive_names.rs:163:13 + --> $DIR/non_expressive_names.rs:173:13 | -163 | let __1___2 = 12; +173 | let __1___2 = 12; | ^^^^^^^ error: aborting due to 17 previous errors diff --git a/tests/ui/ok_expect.rs b/tests/ui/ok_expect.rs index 4341e8ea7..5d333a72c 100644 --- a/tests/ui/ok_expect.rs +++ b/tests/ui/ok_expect.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + use std::io; struct MyError(()); // doesn't implement Debug diff --git a/tests/ui/ok_expect.stderr b/tests/ui/ok_expect.stderr index 7c158b520..f4c8440a7 100644 --- a/tests/ui/ok_expect.stderr +++ b/tests/ui/ok_expect.stderr @@ -1,33 +1,33 @@ error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/ok_expect.rs:14:5 + --> $DIR/ok_expect.rs:24:5 | -14 | res.ok().expect("disaster!"); +24 | res.ok().expect("disaster!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/ok_expect.rs:20:5 + --> $DIR/ok_expect.rs:30:5 | -20 | res3.ok().expect("whoof"); +30 | res3.ok().expect("whoof"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/ok_expect.rs:22:5 + --> $DIR/ok_expect.rs:32:5 | -22 | res4.ok().expect("argh"); +32 | res4.ok().expect("argh"); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/ok_expect.rs:24:5 + --> $DIR/ok_expect.rs:34:5 | -24 | res5.ok().expect("oops"); +34 | res5.ok().expect("oops"); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> $DIR/ok_expect.rs:26:5 + --> $DIR/ok_expect.rs:36:5 | -26 | res6.ok().expect("meh"); +36 | res6.ok().expect("meh"); | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/ok_if_let.rs b/tests/ui/ok_if_let.rs index 46d85bb9c..71b301cbc 100644 --- a/tests/ui/ok_if_let.rs +++ b/tests/ui/ok_if_let.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/ok_if_let.stderr b/tests/ui/ok_if_let.stderr index eac49032e..27b3ef28f 100644 --- a/tests/ui/ok_if_let.stderr +++ b/tests/ui/ok_if_let.stderr @@ -1,11 +1,11 @@ error: Matching on `Some` with `ok()` is redundant - --> $DIR/ok_if_let.rs:7:5 + --> $DIR/ok_if_let.rs:17:5 | -7 | / if let Some(y) = x.parse().ok() { -8 | | y -9 | | } else { -10 | | 0 -11 | | } +17 | / if let Some(y) = x.parse().ok() { +18 | | y +19 | | } else { +20 | | 0 +21 | | } | |_____^ | = note: `-D clippy::if-let-some-result` implied by `-D warnings` diff --git a/tests/ui/op_ref.rs b/tests/ui/op_ref.rs index a85a2c8bb..96a208ef8 100644 --- a/tests/ui/op_ref.rs +++ b/tests/ui/op_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/op_ref.stderr b/tests/ui/op_ref.stderr index 398e3a6e9..e2b7b7820 100644 --- a/tests/ui/op_ref.stderr +++ b/tests/ui/op_ref.stderr @@ -1,19 +1,19 @@ error: needlessly taken reference of both operands - --> $DIR/op_ref.rs:13:15 + --> $DIR/op_ref.rs:23:15 | -13 | let foo = &5 - &6; +23 | let foo = &5 - &6; | ^^^^^^^ | = note: `-D clippy::op-ref` implied by `-D warnings` help: use the values directly | -13 | let foo = 5 - 6; +23 | let foo = 5 - 6; | ^ ^ error: taken reference of right operand - --> $DIR/op_ref.rs:21:8 + --> $DIR/op_ref.rs:31:8 | -21 | if b < &a { +31 | if b < &a { | ^^^^-- | | | help: use the right value directly: `a` diff --git a/tests/ui/open_options.rs b/tests/ui/open_options.rs index 38b3dd7e4..a01f2b1ce 100644 --- a/tests/ui/open_options.rs +++ b/tests/ui/open_options.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] use std::fs::OpenOptions; diff --git a/tests/ui/open_options.stderr b/tests/ui/open_options.stderr index 64ad667a4..2835eebfb 100644 --- a/tests/ui/open_options.stderr +++ b/tests/ui/open_options.stderr @@ -1,45 +1,45 @@ error: file opened with "truncate" and "read" - --> $DIR/open_options.rs:8:5 - | -8 | OpenOptions::new().read(true).truncate(true).open("foo.txt"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::nonsensical-open-options` implied by `-D warnings` + --> $DIR/open_options.rs:18:5 + | +18 | OpenOptions::new().read(true).truncate(true).open("foo.txt"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::nonsensical-open-options` implied by `-D warnings` error: file opened with "append" and "truncate" - --> $DIR/open_options.rs:9:5 - | -9 | OpenOptions::new().append(true).truncate(true).open("foo.txt"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $DIR/open_options.rs:19:5 + | +19 | OpenOptions::new().append(true).truncate(true).open("foo.txt"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "read" is called more than once - --> $DIR/open_options.rs:11:5 + --> $DIR/open_options.rs:21:5 | -11 | OpenOptions::new().read(true).read(false).open("foo.txt"); +21 | OpenOptions::new().read(true).read(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "create" is called more than once - --> $DIR/open_options.rs:12:5 + --> $DIR/open_options.rs:22:5 | -12 | OpenOptions::new().create(true).create(false).open("foo.txt"); +22 | OpenOptions::new().create(true).create(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "write" is called more than once - --> $DIR/open_options.rs:13:5 + --> $DIR/open_options.rs:23:5 | -13 | OpenOptions::new().write(true).write(false).open("foo.txt"); +23 | OpenOptions::new().write(true).write(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "append" is called more than once - --> $DIR/open_options.rs:14:5 + --> $DIR/open_options.rs:24:5 | -14 | OpenOptions::new().append(true).append(false).open("foo.txt"); +24 | OpenOptions::new().append(true).append(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method "truncate" is called more than once - --> $DIR/open_options.rs:15:5 + --> $DIR/open_options.rs:25:5 | -15 | OpenOptions::new().truncate(true).truncate(false).open("foo.txt"); +25 | OpenOptions::new().truncate(true).truncate(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/tests/ui/option_map_unit_fn.rs b/tests/ui/option_map_unit_fn.rs index e86cc99c5..a69c41ce9 100644 --- a/tests/ui/option_map_unit_fn.rs +++ b/tests/ui/option_map_unit_fn.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::option_map_unit_fn)] diff --git a/tests/ui/option_map_unit_fn.stderr b/tests/ui/option_map_unit_fn.stderr index 77fe24d26..7a2dfd338 100644 --- a/tests/ui/option_map_unit_fn.stderr +++ b/tests/ui/option_map_unit_fn.stderr @@ -1,7 +1,7 @@ error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:34:5 + --> $DIR/option_map_unit_fn.rs:44:5 | -34 | x.field.map(do_nothing); +44 | x.field.map(do_nothing); | ^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(x_field) = x.field { do_nothing(...) }` @@ -9,202 +9,202 @@ error: called `map(f)` on an Option value where `f` is a unit function = note: `-D clippy::option-map-unit-fn` implied by `-D warnings` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:36:5 + --> $DIR/option_map_unit_fn.rs:46:5 | -36 | x.field.map(do_nothing); +46 | x.field.map(do_nothing); | ^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(x_field) = x.field { do_nothing(...) }` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:38:5 + --> $DIR/option_map_unit_fn.rs:48:5 | -38 | x.field.map(diverge); +48 | x.field.map(diverge); | ^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(x_field) = x.field { diverge(...) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:44:5 + --> $DIR/option_map_unit_fn.rs:54:5 | -44 | x.field.map(|value| x.do_option_nothing(value + captured)); +54 | x.field.map(|value| x.do_option_nothing(value + captured)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:46:5 + --> $DIR/option_map_unit_fn.rs:56:5 | -46 | x.field.map(|value| { x.do_option_plus_one(value + captured); }); +56 | x.field.map(|value| { x.do_option_plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:49:5 + --> $DIR/option_map_unit_fn.rs:59:5 | -49 | x.field.map(|value| do_nothing(value + captured)); +59 | x.field.map(|value| do_nothing(value + captured)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:51:5 + --> $DIR/option_map_unit_fn.rs:61:5 | -51 | x.field.map(|value| { do_nothing(value + captured) }); +61 | x.field.map(|value| { do_nothing(value + captured) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:53:5 + --> $DIR/option_map_unit_fn.rs:63:5 | -53 | x.field.map(|value| { do_nothing(value + captured); }); +63 | x.field.map(|value| { do_nothing(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:55:5 + --> $DIR/option_map_unit_fn.rs:65:5 | -55 | x.field.map(|value| { { do_nothing(value + captured); } }); +65 | x.field.map(|value| { { do_nothing(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:58:5 + --> $DIR/option_map_unit_fn.rs:68:5 | -58 | x.field.map(|value| diverge(value + captured)); +68 | x.field.map(|value| diverge(value + captured)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { diverge(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:60:5 + --> $DIR/option_map_unit_fn.rs:70:5 | -60 | x.field.map(|value| { diverge(value + captured) }); +70 | x.field.map(|value| { diverge(value + captured) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { diverge(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:62:5 + --> $DIR/option_map_unit_fn.rs:72:5 | -62 | x.field.map(|value| { diverge(value + captured); }); +72 | x.field.map(|value| { diverge(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { diverge(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:64:5 + --> $DIR/option_map_unit_fn.rs:74:5 | -64 | x.field.map(|value| { { diverge(value + captured); } }); +74 | x.field.map(|value| { { diverge(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { diverge(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:69:5 + --> $DIR/option_map_unit_fn.rs:79:5 | -69 | x.field.map(|value| { let y = plus_one(value + captured); }); +79 | x.field.map(|value| { let y = plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { let y = plus_one(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:71:5 + --> $DIR/option_map_unit_fn.rs:81:5 | -71 | x.field.map(|value| { plus_one(value + captured); }); +81 | x.field.map(|value| { plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { plus_one(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:73:5 + --> $DIR/option_map_unit_fn.rs:83:5 | -73 | x.field.map(|value| { { plus_one(value + captured); } }); +83 | x.field.map(|value| { { plus_one(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { plus_one(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:76:5 + --> $DIR/option_map_unit_fn.rs:86:5 | -76 | x.field.map(|ref value| { do_nothing(value + captured) }); +86 | x.field.map(|ref value| { do_nothing(value + captured) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(ref value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:79:5 + --> $DIR/option_map_unit_fn.rs:89:5 | -79 | x.field.map(|value| { do_nothing(value); do_nothing(value) }); +89 | x.field.map(|value| { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { ... }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:81:5 + --> $DIR/option_map_unit_fn.rs:91:5 | -81 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); +91 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { ... }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:85:5 + --> $DIR/option_map_unit_fn.rs:95:5 | -85 | x.field.map(|value| { +95 | x.field.map(|value| { | _____^ | |_____| | || -86 | || do_nothing(value); -87 | || do_nothing(value) -88 | || }); +96 | || do_nothing(value); +97 | || do_nothing(value) +98 | || }); | ||______^- help: try this: `if let Some(value) = x.field { ... }` | |_______| | error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:89:5 + --> $DIR/option_map_unit_fn.rs:99:5 | -89 | x.field.map(|value| { do_nothing(value); do_nothing(value); }); +99 | x.field.map(|value| { do_nothing(value); do_nothing(value); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { ... }` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:92:5 - | -92 | Some(42).map(diverge); - | ^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Some(_) = Some(42) { diverge(...) }` + --> $DIR/option_map_unit_fn.rs:102:5 + | +102 | Some(42).map(diverge); + | ^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Some(_) = Some(42) { diverge(...) }` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:93:5 - | -93 | "12".parse::().ok().map(diverge); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Some(_) = "12".parse::().ok() { diverge(...) }` + --> $DIR/option_map_unit_fn.rs:103:5 + | +103 | "12".parse::().ok().map(diverge); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Some(_) = "12".parse::().ok() { diverge(...) }` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:94:5 - | -94 | Some(plus_one(1)).map(do_nothing); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Some(_) = Some(plus_one(1)) { do_nothing(...) }` + --> $DIR/option_map_unit_fn.rs:104:5 + | +104 | Some(plus_one(1)).map(do_nothing); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Some(_) = Some(plus_one(1)) { do_nothing(...) }` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:98:5 - | -98 | y.map(do_nothing); - | ^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Some(_y) = y { do_nothing(...) }` + --> $DIR/option_map_unit_fn.rs:108:5 + | +108 | y.map(do_nothing); + | ^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Some(_y) = y { do_nothing(...) }` error: aborting due to 25 previous errors diff --git a/tests/ui/option_option.rs b/tests/ui/option_option.rs index 249745c6a..3cb4fdc27 100644 --- a/tests/ui/option_option.rs +++ b/tests/ui/option_option.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn input(_: Option>) { } diff --git a/tests/ui/option_option.stderr b/tests/ui/option_option.stderr index 4341857cc..8a867fd4f 100644 --- a/tests/ui/option_option.stderr +++ b/tests/ui/option_option.stderr @@ -1,57 +1,57 @@ error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases - --> $DIR/option_option.rs:1:13 - | -1 | fn input(_: Option>) { - | ^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::option-option` implied by `-D warnings` - -error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases - --> $DIR/option_option.rs:4:16 - | -4 | fn output() -> Option> { - | ^^^^^^^^^^^^^^^^^^ - -error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases - --> $DIR/option_option.rs:8:27 - | -8 | fn output_nested() -> Vec>> { - | ^^^^^^^^^^^^^^^^^^ - -error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases - --> $DIR/option_option.rs:13:30 + --> $DIR/option_option.rs:11:13 | -13 | fn output_nested_nested() -> Option>> { +11 | fn input(_: Option>) { + | ^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::option-option` implied by `-D warnings` + +error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases + --> $DIR/option_option.rs:14:16 + | +14 | fn output() -> Option> { + | ^^^^^^^^^^^^^^^^^^ + +error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases + --> $DIR/option_option.rs:18:27 + | +18 | fn output_nested() -> Vec>> { + | ^^^^^^^^^^^^^^^^^^ + +error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases + --> $DIR/option_option.rs:23:30 + | +23 | fn output_nested_nested() -> Option>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases - --> $DIR/option_option.rs:18:8 + --> $DIR/option_option.rs:28:8 | -18 | x: Option>, +28 | x: Option>, | ^^^^^^^^^^^^^^^^^^ error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases - --> $DIR/option_option.rs:22:23 + --> $DIR/option_option.rs:32:23 | -22 | fn struct_fn() -> Option> { +32 | fn struct_fn() -> Option> { | ^^^^^^^^^^^^^^^^^^ error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases - --> $DIR/option_option.rs:28:22 + --> $DIR/option_option.rs:38:22 | -28 | fn trait_fn() -> Option>; +38 | fn trait_fn() -> Option>; | ^^^^^^^^^^^^^^^^^^ error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases - --> $DIR/option_option.rs:32:11 + --> $DIR/option_option.rs:42:11 | -32 | Tuple(Option>), +42 | Tuple(Option>), | ^^^^^^^^^^^^^^^^^^ error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases - --> $DIR/option_option.rs:33:15 + --> $DIR/option_option.rs:43:15 | -33 | Struct{x: Option>}, +43 | Struct{x: Option>}, | ^^^^^^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/tests/ui/overflow_check_conditional.rs b/tests/ui/overflow_check_conditional.rs index 5c3cc5b08..8aba051c6 100644 --- a/tests/ui/overflow_check_conditional.rs +++ b/tests/ui/overflow_check_conditional.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/overflow_check_conditional.stderr b/tests/ui/overflow_check_conditional.stderr index 9659e352a..0bd20210f 100644 --- a/tests/ui/overflow_check_conditional.stderr +++ b/tests/ui/overflow_check_conditional.stderr @@ -1,51 +1,51 @@ error: You are trying to use classic C overflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:11:5 + --> $DIR/overflow_check_conditional.rs:21:5 | -11 | if a + b < a { +21 | if a + b < a { | ^^^^^^^^^ | = note: `-D clippy::overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C overflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:14:5 + --> $DIR/overflow_check_conditional.rs:24:5 | -14 | if a > a + b { +24 | if a > a + b { | ^^^^^^^^^ error: You are trying to use classic C overflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:17:5 + --> $DIR/overflow_check_conditional.rs:27:5 | -17 | if a + b < b { +27 | if a + b < b { | ^^^^^^^^^ error: You are trying to use classic C overflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:20:5 + --> $DIR/overflow_check_conditional.rs:30:5 | -20 | if b > a + b { +30 | if b > a + b { | ^^^^^^^^^ error: You are trying to use classic C underflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:23:5 + --> $DIR/overflow_check_conditional.rs:33:5 | -23 | if a - b > b { +33 | if a - b > b { | ^^^^^^^^^ error: You are trying to use classic C underflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:26:5 + --> $DIR/overflow_check_conditional.rs:36:5 | -26 | if b < a - b { +36 | if b < a - b { | ^^^^^^^^^ error: You are trying to use classic C underflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:29:5 + --> $DIR/overflow_check_conditional.rs:39:5 | -29 | if a - b > a { +39 | if a - b > a { | ^^^^^^^^^ error: You are trying to use classic C underflow conditions that will fail in Rust. - --> $DIR/overflow_check_conditional.rs:32:5 + --> $DIR/overflow_check_conditional.rs:42:5 | -32 | if a < a - b { +42 | if a < a - b { | ^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/tests/ui/panic_unimplemented.rs b/tests/ui/panic_unimplemented.rs index 693dc921b..f292455dc 100644 --- a/tests/ui/panic_unimplemented.rs +++ b/tests/ui/panic_unimplemented.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/panic_unimplemented.stderr b/tests/ui/panic_unimplemented.stderr index c5ce42f4c..75032c117 100644 --- a/tests/ui/panic_unimplemented.stderr +++ b/tests/ui/panic_unimplemented.stderr @@ -1,33 +1,33 @@ error: you probably are missing some parameter in your format string - --> $DIR/panic_unimplemented.rs:8:16 - | -8 | panic!("{}"); - | ^^^^ - | - = note: `-D clippy::panic-params` implied by `-D warnings` + --> $DIR/panic_unimplemented.rs:18:16 + | +18 | panic!("{}"); + | ^^^^ + | + = note: `-D clippy::panic-params` implied by `-D warnings` error: you probably are missing some parameter in your format string - --> $DIR/panic_unimplemented.rs:10:16 + --> $DIR/panic_unimplemented.rs:20:16 | -10 | panic!("{:?}"); +20 | panic!("{:?}"); | ^^^^^^ error: you probably are missing some parameter in your format string - --> $DIR/panic_unimplemented.rs:12:23 + --> $DIR/panic_unimplemented.rs:22:23 | -12 | assert!(true, "here be missing values: {}"); +22 | assert!(true, "here be missing values: {}"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you probably are missing some parameter in your format string - --> $DIR/panic_unimplemented.rs:15:12 + --> $DIR/panic_unimplemented.rs:25:12 | -15 | panic!("{{{this}}}"); +25 | panic!("{{{this}}}"); | ^^^^^^^^^^^^ error: `unimplemented` should not be present in production code - --> $DIR/panic_unimplemented.rs:58:5 + --> $DIR/panic_unimplemented.rs:68:5 | -58 | unimplemented!(); +68 | unimplemented!(); | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unimplemented` implied by `-D warnings` diff --git a/tests/ui/partialeq_ne_impl.rs b/tests/ui/partialeq_ne_impl.rs index 36dd4df8a..45aa0decd 100644 --- a/tests/ui/partialeq_ne_impl.rs +++ b/tests/ui/partialeq_ne_impl.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + diff --git a/tests/ui/partialeq_ne_impl.stderr b/tests/ui/partialeq_ne_impl.stderr index 773bed8fd..0ed2d0789 100644 --- a/tests/ui/partialeq_ne_impl.stderr +++ b/tests/ui/partialeq_ne_impl.stderr @@ -1,7 +1,7 @@ error: re-implementing `PartialEq::ne` is unnecessary - --> $DIR/partialeq_ne_impl.rs:10:5 + --> $DIR/partialeq_ne_impl.rs:20:5 | -10 | fn ne(&self, _: &Foo) -> bool { false } +20 | fn ne(&self, _: &Foo) -> bool { false } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::partialeq-ne-impl` implied by `-D warnings` diff --git a/tests/ui/patterns.rs b/tests/ui/patterns.rs index 70f86afba..2b42aae63 100644 --- a/tests/ui/patterns.rs +++ b/tests/ui/patterns.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused)] diff --git a/tests/ui/patterns.stderr b/tests/ui/patterns.stderr index ce8aab7e6..d236da240 100644 --- a/tests/ui/patterns.stderr +++ b/tests/ui/patterns.stderr @@ -1,7 +1,7 @@ error: the `y @ _` pattern can be written as just `y` - --> $DIR/patterns.rs:10:9 + --> $DIR/patterns.rs:20:9 | -10 | y @ _ => (), +20 | y @ _ => (), | ^^^^^ | = note: `-D clippy::redundant-pattern` implied by `-D warnings` diff --git a/tests/ui/precedence.rs b/tests/ui/precedence.rs index 95476dd4f..ccc08ddc5 100644 --- a/tests/ui/precedence.rs +++ b/tests/ui/precedence.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/precedence.stderr b/tests/ui/precedence.stderr index 5ec1732ee..3d5553ed0 100644 --- a/tests/ui/precedence.stderr +++ b/tests/ui/precedence.stderr @@ -1,57 +1,57 @@ error: operator precedence can trip the unwary - --> $DIR/precedence.rs:18:5 + --> $DIR/precedence.rs:28:5 | -18 | 1 << 2 + 3; +28 | 1 << 2 + 3; | ^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (2 + 3)` | = note: `-D clippy::precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:19:5 + --> $DIR/precedence.rs:29:5 | -19 | 1 + 2 << 3; +29 | 1 + 2 << 3; | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 2) << 3` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:20:5 + --> $DIR/precedence.rs:30:5 | -20 | 4 >> 1 + 1; +30 | 4 >> 1 + 1; | ^^^^^^^^^^ help: consider parenthesizing your expression: `4 >> (1 + 1)` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:21:5 + --> $DIR/precedence.rs:31:5 | -21 | 1 + 3 >> 2; +31 | 1 + 3 >> 2; | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 3) >> 2` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:22:5 + --> $DIR/precedence.rs:32:5 | -22 | 1 ^ 1 - 1; +32 | 1 ^ 1 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression: `1 ^ (1 - 1)` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:23:5 + --> $DIR/precedence.rs:33:5 | -23 | 3 | 2 - 1; +33 | 3 | 2 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression: `3 | (2 - 1)` error: operator precedence can trip the unwary - --> $DIR/precedence.rs:24:5 + --> $DIR/precedence.rs:34:5 | -24 | 3 & 5 - 2; +34 | 3 & 5 - 2; | ^^^^^^^^^ help: consider parenthesizing your expression: `3 & (5 - 2)` error: unary minus has lower precedence than method call - --> $DIR/precedence.rs:25:5 + --> $DIR/precedence.rs:35:5 | -25 | -1i32.abs(); +35 | -1i32.abs(); | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1i32.abs())` error: unary minus has lower precedence than method call - --> $DIR/precedence.rs:26:5 + --> $DIR/precedence.rs:36:5 | -26 | -1f32.abs(); +36 | -1f32.abs(); | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1f32.abs())` error: aborting due to 9 previous errors diff --git a/tests/ui/print.rs b/tests/ui/print.rs index cee3e7000..3bb72fcb1 100644 --- a/tests/ui/print.rs +++ b/tests/ui/print.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::print_literal, clippy::write_literal)] diff --git a/tests/ui/print.stderr b/tests/ui/print.stderr index 92a2f2f96..605e527c2 100644 --- a/tests/ui/print.stderr +++ b/tests/ui/print.stderr @@ -1,59 +1,59 @@ error: use of `Debug`-based formatting - --> $DIR/print.rs:13:19 + --> $DIR/print.rs:23:19 | -13 | write!(f, "{:?}", 43.1415) +23 | write!(f, "{:?}", 43.1415) | ^^^^^^ | = note: `-D clippy::use-debug` implied by `-D warnings` error: use of `Debug`-based formatting - --> $DIR/print.rs:20:19 + --> $DIR/print.rs:30:19 | -20 | write!(f, "{:?}", 42.718) +30 | write!(f, "{:?}", 42.718) | ^^^^^^ error: use of `println!` - --> $DIR/print.rs:25:5 + --> $DIR/print.rs:35:5 | -25 | println!("Hello"); +35 | println!("Hello"); | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::print-stdout` implied by `-D warnings` error: use of `print!` - --> $DIR/print.rs:26:5 + --> $DIR/print.rs:36:5 | -26 | print!("Hello"); +36 | print!("Hello"); | ^^^^^^^^^^^^^^^ error: use of `print!` - --> $DIR/print.rs:28:5 + --> $DIR/print.rs:38:5 | -28 | print!("Hello {}", "World"); +38 | print!("Hello {}", "World"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `print!` - --> $DIR/print.rs:30:5 + --> $DIR/print.rs:40:5 | -30 | print!("Hello {:?}", "World"); +40 | print!("Hello {:?}", "World"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `Debug`-based formatting - --> $DIR/print.rs:30:12 + --> $DIR/print.rs:40:12 | -30 | print!("Hello {:?}", "World"); +40 | print!("Hello {:?}", "World"); | ^^^^^^^^^^^^ error: use of `print!` - --> $DIR/print.rs:32:5 + --> $DIR/print.rs:42:5 | -32 | print!("Hello {:#?}", "#orld"); +42 | print!("Hello {:#?}", "#orld"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `Debug`-based formatting - --> $DIR/print.rs:32:12 + --> $DIR/print.rs:42:12 | -32 | print!("Hello {:#?}", "#orld"); +42 | print!("Hello {:#?}", "#orld"); | ^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/tests/ui/print_literal.rs b/tests/ui/print_literal.rs index 46b91d40f..fd6875182 100644 --- a/tests/ui/print_literal.rs +++ b/tests/ui/print_literal.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::print_literal)] diff --git a/tests/ui/print_literal.stderr b/tests/ui/print_literal.stderr index bd13f5d17..9fe7fe34e 100644 --- a/tests/ui/print_literal.stderr +++ b/tests/ui/print_literal.stderr @@ -1,87 +1,87 @@ error: literal with an empty format string - --> $DIR/print_literal.rs:24:71 + --> $DIR/print_literal.rs:34:71 | -24 | println!("{} of {:b} people know binary, the other half doesn't", 1, 2); +34 | println!("{} of {:b} people know binary, the other half doesn't", 1, 2); | ^ | = note: `-D clippy::print-literal` implied by `-D warnings` error: literal with an empty format string - --> $DIR/print_literal.rs:25:24 + --> $DIR/print_literal.rs:35:24 | -25 | print!("Hello {}", "world"); +35 | print!("Hello {}", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:26:36 + --> $DIR/print_literal.rs:36:36 | -26 | println!("Hello {} {}", world, "world"); +36 | println!("Hello {} {}", world, "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:27:26 + --> $DIR/print_literal.rs:37:26 | -27 | println!("Hello {}", "world"); +37 | println!("Hello {}", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:28:30 + --> $DIR/print_literal.rs:38:30 | -28 | println!("10 / 4 is {}", 2.5); +38 | println!("10 / 4 is {}", 2.5); | ^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:29:28 + --> $DIR/print_literal.rs:39:28 | -29 | println!("2 + 1 = {}", 3); +39 | println!("2 + 1 = {}", 3); | ^ error: literal with an empty format string - --> $DIR/print_literal.rs:34:25 + --> $DIR/print_literal.rs:44:25 | -34 | println!("{0} {1}", "hello", "world"); +44 | println!("{0} {1}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:34:34 + --> $DIR/print_literal.rs:44:34 | -34 | println!("{0} {1}", "hello", "world"); +44 | println!("{0} {1}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:35:25 + --> $DIR/print_literal.rs:45:25 | -35 | println!("{1} {0}", "hello", "world"); +45 | println!("{1} {0}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:35:34 + --> $DIR/print_literal.rs:45:34 | -35 | println!("{1} {0}", "hello", "world"); +45 | println!("{1} {0}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:38:33 + --> $DIR/print_literal.rs:48:33 | -38 | println!("{foo} {bar}", foo="hello", bar="world"); +48 | println!("{foo} {bar}", foo="hello", bar="world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:38:46 + --> $DIR/print_literal.rs:48:46 | -38 | println!("{foo} {bar}", foo="hello", bar="world"); +48 | println!("{foo} {bar}", foo="hello", bar="world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:39:33 + --> $DIR/print_literal.rs:49:33 | -39 | println!("{bar} {foo}", foo="hello", bar="world"); +49 | println!("{bar} {foo}", foo="hello", bar="world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/print_literal.rs:39:46 + --> $DIR/print_literal.rs:49:46 | -39 | println!("{bar} {foo}", foo="hello", bar="world"); +49 | println!("{bar} {foo}", foo="hello", bar="world"); | ^^^^^^^ error: aborting due to 14 previous errors diff --git a/tests/ui/print_with_newline.rs b/tests/ui/print_with_newline.rs index c2c79c726..4fc24080d 100644 --- a/tests/ui/print_with_newline.rs +++ b/tests/ui/print_with_newline.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::print_literal)] diff --git a/tests/ui/print_with_newline.stderr b/tests/ui/print_with_newline.stderr index 12c4ecb2f..4cd7a6685 100644 --- a/tests/ui/print_with_newline.stderr +++ b/tests/ui/print_with_newline.stderr @@ -1,27 +1,27 @@ error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead - --> $DIR/print_with_newline.rs:7:5 - | -7 | print!("Hello/n"); - | ^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::print-with-newline` implied by `-D warnings` - -error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead - --> $DIR/print_with_newline.rs:8:5 - | -8 | print!("Hello {}/n", "world"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead - --> $DIR/print_with_newline.rs:9:5 - | -9 | print!("Hello {} {}/n", "world", "#2"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead - --> $DIR/print_with_newline.rs:10:5 + --> $DIR/print_with_newline.rs:17:5 | -10 | print!("{}/n", 1265); +17 | print!("Hello/n"); + | ^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::print-with-newline` implied by `-D warnings` + +error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead + --> $DIR/print_with_newline.rs:18:5 + | +18 | print!("Hello {}/n", "world"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead + --> $DIR/print_with_newline.rs:19:5 + | +19 | print!("Hello {} {}/n", "world", "#2"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead + --> $DIR/print_with_newline.rs:20:5 + | +20 | print!("{}/n", 1265); | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/println_empty_string.rs b/tests/ui/println_empty_string.rs index 9df348050..afc37b1be 100644 --- a/tests/ui/println_empty_string.rs +++ b/tests/ui/println_empty_string.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { println!(); println!(""); diff --git a/tests/ui/println_empty_string.stderr b/tests/ui/println_empty_string.stderr index 96d158384..e06b403cf 100644 --- a/tests/ui/println_empty_string.stderr +++ b/tests/ui/println_empty_string.stderr @@ -1,16 +1,16 @@ error: using `println!("")` - --> $DIR/println_empty_string.rs:3:5 - | -3 | println!(""); - | ^^^^^^^^^^^^ help: replace it with: `println!()` - | - = note: `-D clippy::println-empty-string` implied by `-D warnings` + --> $DIR/println_empty_string.rs:13:5 + | +13 | println!(""); + | ^^^^^^^^^^^^ help: replace it with: `println!()` + | + = note: `-D clippy::println-empty-string` implied by `-D warnings` error: using `println!("")` - --> $DIR/println_empty_string.rs:6:14 - | -6 | _ => println!(""), - | ^^^^^^^^^^^^ help: replace it with: `println!()` + --> $DIR/println_empty_string.rs:16:14 + | +16 | _ => println!(""), + | ^^^^^^^^^^^^ help: replace it with: `println!()` error: aborting due to 2 previous errors diff --git a/tests/ui/ptr_arg.rs b/tests/ui/ptr_arg.rs index 7cd3c9f9c..4d5f353bb 100644 --- a/tests/ui/ptr_arg.rs +++ b/tests/ui/ptr_arg.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused, clippy::many_single_char_names)] diff --git a/tests/ui/ptr_arg.stderr b/tests/ui/ptr_arg.stderr index 6c16443f5..e7aecf7c2 100644 --- a/tests/ui/ptr_arg.stderr +++ b/tests/ui/ptr_arg.stderr @@ -1,85 +1,85 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. - --> $DIR/ptr_arg.rs:8:14 - | -8 | fn do_vec(x: &Vec) { - | ^^^^^^^^^ help: change this to: `&[i64]` - | - = note: `-D clippy::ptr-arg` implied by `-D warnings` + --> $DIR/ptr_arg.rs:18:14 + | +18 | fn do_vec(x: &Vec) { + | ^^^^^^^^^ help: change this to: `&[i64]` + | + = note: `-D clippy::ptr-arg` implied by `-D warnings` error: writing `&String` instead of `&str` involves a new object where a slice will do. - --> $DIR/ptr_arg.rs:16:14 + --> $DIR/ptr_arg.rs:26:14 | -16 | fn do_str(x: &String) { +26 | fn do_str(x: &String) { | ^^^^^^^ help: change this to: `&str` error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. - --> $DIR/ptr_arg.rs:29:18 + --> $DIR/ptr_arg.rs:39:18 | -29 | fn do_vec(x: &Vec); +39 | fn do_vec(x: &Vec); | ^^^^^^^^^ help: change this to: `&[i64]` error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. - --> $DIR/ptr_arg.rs:42:14 + --> $DIR/ptr_arg.rs:52:14 | -42 | fn cloned(x: &Vec) -> Vec { +52 | fn cloned(x: &Vec) -> Vec { | ^^^^^^^^ help: change this to | -42 | fn cloned(x: &[u8]) -> Vec { +52 | fn cloned(x: &[u8]) -> Vec { | ^^^^^ help: change `x.clone()` to | -43 | let e = x.to_owned(); +53 | let e = x.to_owned(); | ^^^^^^^^^^^^ help: change `x.clone()` to | -48 | x.to_owned() +58 | x.to_owned() | error: writing `&String` instead of `&str` involves a new object where a slice will do. - --> $DIR/ptr_arg.rs:51:18 + --> $DIR/ptr_arg.rs:61:18 | -51 | fn str_cloned(x: &String) -> String { +61 | fn str_cloned(x: &String) -> String { | ^^^^^^^ help: change this to | -51 | fn str_cloned(x: &str) -> String { +61 | fn str_cloned(x: &str) -> String { | ^^^^ help: change `x.clone()` to | -52 | let a = x.to_string(); +62 | let a = x.to_string(); | ^^^^^^^^^^^^^ help: change `x.clone()` to | -53 | let b = x.to_string(); +63 | let b = x.to_string(); | ^^^^^^^^^^^^^ help: change `x.clone()` to | -58 | x.to_string() +68 | x.to_string() | error: writing `&String` instead of `&str` involves a new object where a slice will do. - --> $DIR/ptr_arg.rs:61:44 + --> $DIR/ptr_arg.rs:71:44 | -61 | fn false_positive_capacity(x: &Vec, y: &String) { +71 | fn false_positive_capacity(x: &Vec, y: &String) { | ^^^^^^^ help: change this to | -61 | fn false_positive_capacity(x: &Vec, y: &str) { +71 | fn false_positive_capacity(x: &Vec, y: &str) { | ^^^^ help: change `y.clone()` to | -63 | let b = y.to_string(); +73 | let b = y.to_string(); | ^^^^^^^^^^^^^ help: change `y.as_str()` to | -64 | let c = y; +74 | let c = y; | ^ error: using a reference to `Cow` is not recommended. - --> $DIR/ptr_arg.rs:73:25 + --> $DIR/ptr_arg.rs:83:25 | -73 | fn test_cow_with_ref(c: &Cow<[i32]>) { +83 | fn test_cow_with_ref(c: &Cow<[i32]>) { | ^^^^^^^^^^^ help: change this to: `&[i32]` error: aborting due to 7 previous errors diff --git a/tests/ui/ptr_offset_with_cast.rs b/tests/ui/ptr_offset_with_cast.rs index 4549f960c..a6f86a230 100644 --- a/tests/ui/ptr_offset_with_cast.rs +++ b/tests/ui/ptr_offset_with_cast.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { let vec = vec![b'a', b'b', b'c']; let ptr = vec.as_ptr(); diff --git a/tests/ui/ptr_offset_with_cast.stderr b/tests/ui/ptr_offset_with_cast.stderr index 214a39cdc..b3df0abba 100644 --- a/tests/ui/ptr_offset_with_cast.stderr +++ b/tests/ui/ptr_offset_with_cast.stderr @@ -1,15 +1,15 @@ error: use of `offset` with a `usize` casted to an `isize` - --> $DIR/ptr_offset_with_cast.rs:10:9 + --> $DIR/ptr_offset_with_cast.rs:20:9 | -10 | ptr.offset(offset_usize as isize); +20 | ptr.offset(offset_usize as isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.add(offset_usize)` | = note: `-D clippy::ptr-offset-with-cast` implied by `-D warnings` error: use of `wrapping_offset` with a `usize` casted to an `isize` - --> $DIR/ptr_offset_with_cast.rs:14:9 + --> $DIR/ptr_offset_with_cast.rs:24:9 | -14 | ptr.wrapping_offset(offset_usize as isize); +24 | ptr.wrapping_offset(offset_usize as isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.wrapping_add(offset_usize)` error: aborting due to 2 previous errors diff --git a/tests/ui/question_mark.rs b/tests/ui/question_mark.rs index 369b868a5..a39ea00cb 100644 --- a/tests/ui/question_mark.rs +++ b/tests/ui/question_mark.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn some_func(a: Option) -> Option { if a.is_none() { return None diff --git a/tests/ui/question_mark.stderr b/tests/ui/question_mark.stderr index 68c0e5e38..7ca76e381 100644 --- a/tests/ui/question_mark.stderr +++ b/tests/ui/question_mark.stderr @@ -1,21 +1,21 @@ error: this block may be rewritten with the `?` operator - --> $DIR/question_mark.rs:2:2 - | -2 | if a.is_none() { - | _____^ -3 | | return None -4 | | } - | |_____^ help: replace_it_with: `a?;` - | - = note: `-D clippy::question-mark` implied by `-D warnings` + --> $DIR/question_mark.rs:12:2 + | +12 | if a.is_none() { + | _____^ +13 | | return None +14 | | } + | |_____^ help: replace_it_with: `a?;` + | + = note: `-D clippy::question-mark` implied by `-D warnings` error: this block may be rewritten with the `?` operator - --> $DIR/question_mark.rs:37:3 + --> $DIR/question_mark.rs:47:3 | -37 | if (self.opt).is_none() { +47 | if (self.opt).is_none() { | _________^ -38 | | return None; -39 | | } +48 | | return None; +49 | | } | |_________^ help: replace_it_with: `(self.opt)?;` error: aborting due to 2 previous errors diff --git a/tests/ui/range.rs b/tests/ui/range.rs index df3ce1268..270b71d26 100644 --- a/tests/ui/range.rs +++ b/tests/ui/range.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] struct NotARange; diff --git a/tests/ui/range.stderr b/tests/ui/range.stderr index 651ff266c..2dc81b4f0 100644 --- a/tests/ui/range.stderr +++ b/tests/ui/range.stderr @@ -1,41 +1,41 @@ error: Iterator::step_by(0) will panic at runtime - --> $DIR/range.rs:10:13 + --> $DIR/range.rs:20:13 | -10 | let _ = (0..1).step_by(0); +20 | let _ = (0..1).step_by(0); | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iterator-step-by-zero` implied by `-D warnings` error: Iterator::step_by(0) will panic at runtime - --> $DIR/range.rs:14:13 + --> $DIR/range.rs:24:13 | -14 | let _ = (1..).step_by(0); +24 | let _ = (1..).step_by(0); | ^^^^^^^^^^^^^^^^ error: Iterator::step_by(0) will panic at runtime - --> $DIR/range.rs:15:13 + --> $DIR/range.rs:25:13 | -15 | let _ = (1..=2).step_by(0); +25 | let _ = (1..=2).step_by(0); | ^^^^^^^^^^^^^^^^^^ error: Iterator::step_by(0) will panic at runtime - --> $DIR/range.rs:18:13 + --> $DIR/range.rs:28:13 | -18 | let _ = x.step_by(0); +28 | let _ = x.step_by(0); | ^^^^^^^^^^^^ error: It is more idiomatic to use v1.iter().enumerate() - --> $DIR/range.rs:26:14 + --> $DIR/range.rs:36:14 | -26 | let _x = v1.iter().zip(0..v1.len()); +36 | let _x = v1.iter().zip(0..v1.len()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::range-zip-with-len` implied by `-D warnings` error: Iterator::step_by(0) will panic at runtime - --> $DIR/range.rs:30:13 + --> $DIR/range.rs:40:13 | -30 | let _ = v1.iter().step_by(2/3); +40 | let _ = v1.iter().step_by(2/3); | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/range_plus_minus_one.rs b/tests/ui/range_plus_minus_one.rs index 1ee3637f2..15743828d 100644 --- a/tests/ui/range_plus_minus_one.rs +++ b/tests/ui/range_plus_minus_one.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] fn f() -> usize { diff --git a/tests/ui/range_plus_minus_one.stderr b/tests/ui/range_plus_minus_one.stderr index 3fe4e7ca0..0cac21734 100644 --- a/tests/ui/range_plus_minus_one.stderr +++ b/tests/ui/range_plus_minus_one.stderr @@ -1,53 +1,53 @@ error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:12:14 + --> $DIR/range_plus_minus_one.rs:22:14 | -12 | for _ in 0..3+1 { } +22 | for _ in 0..3+1 { } | ^^^^^^ help: use: `0..=3` | = note: `-D clippy::range-plus-one` implied by `-D warnings` error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:15:14 + --> $DIR/range_plus_minus_one.rs:25:14 | -15 | for _ in 0..1+5 { } +25 | for _ in 0..1+5 { } | ^^^^^^ help: use: `0..=5` error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:18:14 + --> $DIR/range_plus_minus_one.rs:28:14 | -18 | for _ in 1..1+1 { } +28 | for _ in 1..1+1 { } | ^^^^^^ help: use: `1..=1` error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:24:14 + --> $DIR/range_plus_minus_one.rs:34:14 | -24 | for _ in 0..(1+f()) { } +34 | for _ in 0..(1+f()) { } | ^^^^^^^^^^ help: use: `0..=f()` error: an exclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:28:13 + --> $DIR/range_plus_minus_one.rs:38:13 | -28 | let _ = ..=11-1; +38 | let _ = ..=11-1; | ^^^^^^^ help: use: `..11` | = note: `-D clippy::range-minus-one` implied by `-D warnings` error: an exclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:29:13 + --> $DIR/range_plus_minus_one.rs:39:13 | -29 | let _ = ..=(11-1); +39 | let _ = ..=(11-1); | ^^^^^^^^^ help: use: `..11` error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:30:13 + --> $DIR/range_plus_minus_one.rs:40:13 | -30 | let _ = (1..11+1); +40 | let _ = (1..11+1); | ^^^^^^^^^ help: use: `(1..=11)` error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:31:13 + --> $DIR/range_plus_minus_one.rs:41:13 | -31 | let _ = (f()+1)..(f()+1); +41 | let _ = (f()+1)..(f()+1); | ^^^^^^^^^^^^^^^^ help: use: `((f()+1)..=f())` error: aborting due to 8 previous errors diff --git a/tests/ui/redundant_closure_call.rs b/tests/ui/redundant_closure_call.rs index b09ed9a35..bf0cc550b 100644 --- a/tests/ui/redundant_closure_call.rs +++ b/tests/ui/redundant_closure_call.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/redundant_closure_call.stderr b/tests/ui/redundant_closure_call.stderr index e4d490743..1563de3d7 100644 --- a/tests/ui/redundant_closure_call.stderr +++ b/tests/ui/redundant_closure_call.stderr @@ -1,33 +1,33 @@ error: Closure called just once immediately after it was declared - --> $DIR/redundant_closure_call.rs:15:2 + --> $DIR/redundant_closure_call.rs:25:2 | -15 | i = closure(); +25 | i = closure(); | ^^^^^^^^^^^^^ | = note: `-D clippy::redundant-closure-call` implied by `-D warnings` error: Closure called just once immediately after it was declared - --> $DIR/redundant_closure_call.rs:18:2 + --> $DIR/redundant_closure_call.rs:28:2 | -18 | i = closure(3); +28 | i = closure(3); | ^^^^^^^^^^^^^^ error: Try not to call a closure in the expression where it is declared. - --> $DIR/redundant_closure_call.rs:7:10 - | -7 | let a = (|| 42)(); - | ^^^^^^^^^ help: Try doing something like: : `42` + --> $DIR/redundant_closure_call.rs:17:10 + | +17 | let a = (|| 42)(); + | ^^^^^^^^^ help: Try doing something like: : `42` error: Try not to call a closure in the expression where it is declared. - --> $DIR/redundant_closure_call.rs:10:14 + --> $DIR/redundant_closure_call.rs:20:14 | -10 | let mut k = (|m| m+1)(i); +20 | let mut k = (|m| m+1)(i); | ^^^^^^^^^^^^ error: Try not to call a closure in the expression where it is declared. - --> $DIR/redundant_closure_call.rs:12:6 + --> $DIR/redundant_closure_call.rs:22:6 | -12 | k = (|a,b| a*b)(1,5); +22 | k = (|a,b| a*b)(1,5); | ^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/redundant_field_names.rs b/tests/ui/redundant_field_names.rs index b379aa661..ac0d5d105 100644 --- a/tests/ui/redundant_field_names.rs +++ b/tests/ui/redundant_field_names.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::redundant_field_names)] diff --git a/tests/ui/redundant_field_names.stderr b/tests/ui/redundant_field_names.stderr index 457fe7d3c..d81ddf343 100644 --- a/tests/ui/redundant_field_names.stderr +++ b/tests/ui/redundant_field_names.stderr @@ -1,45 +1,45 @@ error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:36:9 + --> $DIR/redundant_field_names.rs:46:9 | -36 | gender: gender, +46 | gender: gender, | ^^^^^^^^^^^^^^ help: replace it with: `gender` | = note: `-D clippy::redundant-field-names` implied by `-D warnings` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:37:9 + --> $DIR/redundant_field_names.rs:47:9 | -37 | age: age, +47 | age: age, | ^^^^^^^^ help: replace it with: `age` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:58:25 + --> $DIR/redundant_field_names.rs:68:25 | -58 | let _ = RangeFrom { start: start }; +68 | let _ = RangeFrom { start: start }; | ^^^^^^^^^^^^ help: replace it with: `start` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:59:23 + --> $DIR/redundant_field_names.rs:69:23 | -59 | let _ = RangeTo { end: end }; +69 | let _ = RangeTo { end: end }; | ^^^^^^^^ help: replace it with: `end` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:60:21 + --> $DIR/redundant_field_names.rs:70:21 | -60 | let _ = Range { start: start, end: end }; +70 | let _ = Range { start: start, end: end }; | ^^^^^^^^^^^^ help: replace it with: `start` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:60:35 + --> $DIR/redundant_field_names.rs:70:35 | -60 | let _ = Range { start: start, end: end }; +70 | let _ = Range { start: start, end: end }; | ^^^^^^^^ help: replace it with: `end` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:62:32 + --> $DIR/redundant_field_names.rs:72:32 | -62 | let _ = RangeToInclusive { end: end }; +72 | let _ = RangeToInclusive { end: end }; | ^^^^^^^^ help: replace it with: `end` error: aborting due to 7 previous errors diff --git a/tests/ui/reference.rs b/tests/ui/reference.rs index 97a0030a9..9298aee2c 100644 --- a/tests/ui/reference.rs +++ b/tests/ui/reference.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/reference.stderr b/tests/ui/reference.stderr index 13e0da987..4187d55cb 100644 --- a/tests/ui/reference.stderr +++ b/tests/ui/reference.stderr @@ -1,69 +1,69 @@ error: immediately dereferencing a reference - --> $DIR/reference.rs:19:13 + --> $DIR/reference.rs:29:13 | -19 | let b = *&a; +29 | let b = *&a; | ^^^ help: try this: `a` | = note: `-D clippy::deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> $DIR/reference.rs:21:13 + --> $DIR/reference.rs:31:13 | -21 | let b = *&get_number(); +31 | let b = *&get_number(); | ^^^^^^^^^^^^^^ help: try this: `get_number()` -error: immediately dereferencing a reference - --> $DIR/reference.rs:26:13 - | -26 | let b = *&bytes[1..2][0]; - | ^^^^^^^^^^^^^^^^ help: try this: `bytes[1..2][0]` - -error: immediately dereferencing a reference - --> $DIR/reference.rs:30:13 - | -30 | let b = *&(a); - | ^^^^^ help: try this: `(a)` - -error: immediately dereferencing a reference - --> $DIR/reference.rs:32:13 - | -32 | let b = *(&a); - | ^^^^^ help: try this: `a` - -error: immediately dereferencing a reference - --> $DIR/reference.rs:34:13 - | -34 | let b = *((&a)); - | ^^^^^^^ help: try this: `a` - error: immediately dereferencing a reference --> $DIR/reference.rs:36:13 | -36 | let b = *&&a; +36 | let b = *&bytes[1..2][0]; + | ^^^^^^^^^^^^^^^^ help: try this: `bytes[1..2][0]` + +error: immediately dereferencing a reference + --> $DIR/reference.rs:40:13 + | +40 | let b = *&(a); + | ^^^^^ help: try this: `(a)` + +error: immediately dereferencing a reference + --> $DIR/reference.rs:42:13 + | +42 | let b = *(&a); + | ^^^^^ help: try this: `a` + +error: immediately dereferencing a reference + --> $DIR/reference.rs:44:13 + | +44 | let b = *((&a)); + | ^^^^^^^ help: try this: `a` + +error: immediately dereferencing a reference + --> $DIR/reference.rs:46:13 + | +46 | let b = *&&a; | ^^^^ help: try this: `&a` error: immediately dereferencing a reference - --> $DIR/reference.rs:38:14 + --> $DIR/reference.rs:48:14 | -38 | let b = **&aref; +48 | let b = **&aref; | ^^^^^^ help: try this: `aref` error: immediately dereferencing a reference - --> $DIR/reference.rs:42:14 + --> $DIR/reference.rs:52:14 | -42 | let b = **&&a; +52 | let b = **&&a; | ^^^^ help: try this: `&a` error: immediately dereferencing a reference - --> $DIR/reference.rs:46:17 + --> $DIR/reference.rs:56:17 | -46 | let y = *&mut x; +56 | let y = *&mut x; | ^^^^^^^ help: try this: `x` error: immediately dereferencing a reference - --> $DIR/reference.rs:53:18 + --> $DIR/reference.rs:63:18 | -53 | let y = **&mut &mut x; +63 | let y = **&mut &mut x; | ^^^^^^^^^^^^ help: try this: `&mut x` error: aborting due to 11 previous errors diff --git a/tests/ui/regex.rs b/tests/ui/regex.rs index e3837e104..6e77c5890 100644 --- a/tests/ui/regex.rs +++ b/tests/ui/regex.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/regex.stderr b/tests/ui/regex.stderr index fd8fecb11..1da859dea 100644 --- a/tests/ui/regex.stderr +++ b/tests/ui/regex.stderr @@ -1,168 +1,168 @@ error: trivial regex - --> $DIR/regex.rs:16:45 + --> $DIR/regex.rs:26:45 | -16 | let pipe_in_wrong_position = Regex::new("|"); +26 | let pipe_in_wrong_position = Regex::new("|"); | ^^^ | = note: `-D clippy::trivial-regex` implied by `-D warnings` = help: the regex is unlikely to be useful as it is error: trivial regex - --> $DIR/regex.rs:17:60 + --> $DIR/regex.rs:27:60 | -17 | let pipe_in_wrong_position_builder = RegexBuilder::new("|"); +27 | let pipe_in_wrong_position_builder = RegexBuilder::new("|"); | ^^^ | = help: the regex is unlikely to be useful as it is error: regex syntax error: invalid character class range, the start must be <= the end - --> $DIR/regex.rs:18:42 + --> $DIR/regex.rs:28:42 | -18 | let wrong_char_ranice = Regex::new("[z-a]"); +28 | let wrong_char_ranice = Regex::new("[z-a]"); | ^^^ | = note: `-D clippy::invalid-regex` implied by `-D warnings` error: regex syntax error: invalid character class range, the start must be <= the end - --> $DIR/regex.rs:19:37 + --> $DIR/regex.rs:29:37 | -19 | let some_unicode = Regex::new("[é-è]"); +29 | let some_unicode = Regex::new("[é-è]"); | ^^^ error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:21:33 + --> $DIR/regex.rs:31:33 | -21 | let some_regex = Regex::new(OPENING_PAREN); +31 | let some_regex = Regex::new(OPENING_PAREN); | ^^^^^^^^^^^^^ error: trivial regex - --> $DIR/regex.rs:23:53 + --> $DIR/regex.rs:33:53 | -23 | let binary_pipe_in_wrong_position = BRegex::new("|"); +33 | let binary_pipe_in_wrong_position = BRegex::new("|"); | ^^^ | = help: the regex is unlikely to be useful as it is error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:24:41 + --> $DIR/regex.rs:34:41 | -24 | let some_binary_regex = BRegex::new(OPENING_PAREN); +34 | let some_binary_regex = BRegex::new(OPENING_PAREN); | ^^^^^^^^^^^^^ error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:25:56 + --> $DIR/regex.rs:35:56 | -25 | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN); +35 | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN); | ^^^^^^^^^^^^^ error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:41:9 + --> $DIR/regex.rs:51:9 | -41 | OPENING_PAREN, +51 | OPENING_PAREN, | ^^^^^^^^^^^^^ error: regex syntax error on position 0: unclosed group - --> $DIR/regex.rs:45:9 + --> $DIR/regex.rs:55:9 | -45 | OPENING_PAREN, +55 | OPENING_PAREN, | ^^^^^^^^^^^^^ error: regex syntax error: unrecognized escape sequence - --> $DIR/regex.rs:49:45 + --> $DIR/regex.rs:59:45 | -49 | let raw_string_error = Regex::new(r"[...//...]"); +59 | let raw_string_error = Regex::new(r"[...//...]"); | ^^ error: regex syntax error: unrecognized escape sequence - --> $DIR/regex.rs:50:46 + --> $DIR/regex.rs:60:46 | -50 | let raw_string_error = Regex::new(r#"[...//...]"#); +60 | let raw_string_error = Regex::new(r#"[...//...]"#); | ^^ error: trivial regex - --> $DIR/regex.rs:54:33 + --> $DIR/regex.rs:64:33 | -54 | let trivial_eq = Regex::new("^foobar$"); +64 | let trivial_eq = Regex::new("^foobar$"); | ^^^^^^^^^^ | = help: consider using `==` on `str`s error: trivial regex - --> $DIR/regex.rs:56:48 + --> $DIR/regex.rs:66:48 | -56 | let trivial_eq_builder = RegexBuilder::new("^foobar$"); +66 | let trivial_eq_builder = RegexBuilder::new("^foobar$"); | ^^^^^^^^^^ | = help: consider using `==` on `str`s error: trivial regex - --> $DIR/regex.rs:58:42 + --> $DIR/regex.rs:68:42 | -58 | let trivial_starts_with = Regex::new("^foobar"); +68 | let trivial_starts_with = Regex::new("^foobar"); | ^^^^^^^^^ | = help: consider using `str::starts_with` error: trivial regex - --> $DIR/regex.rs:60:40 + --> $DIR/regex.rs:70:40 | -60 | let trivial_ends_with = Regex::new("foobar$"); +70 | let trivial_ends_with = Regex::new("foobar$"); | ^^^^^^^^^ | = help: consider using `str::ends_with` error: trivial regex - --> $DIR/regex.rs:62:39 + --> $DIR/regex.rs:72:39 | -62 | let trivial_contains = Regex::new("foobar"); +72 | let trivial_contains = Regex::new("foobar"); | ^^^^^^^^ | = help: consider using `str::contains` error: trivial regex - --> $DIR/regex.rs:64:39 + --> $DIR/regex.rs:74:39 | -64 | let trivial_contains = Regex::new(NOT_A_REAL_REGEX); +74 | let trivial_contains = Regex::new(NOT_A_REAL_REGEX); | ^^^^^^^^^^^^^^^^ | = help: consider using `str::contains` error: trivial regex - --> $DIR/regex.rs:66:40 + --> $DIR/regex.rs:76:40 | -66 | let trivial_backslash = Regex::new("a/.b"); +76 | let trivial_backslash = Regex::new("a/.b"); | ^^^^^^^ | = help: consider using `str::contains` error: trivial regex - --> $DIR/regex.rs:69:36 + --> $DIR/regex.rs:79:36 | -69 | let trivial_empty = Regex::new(""); +79 | let trivial_empty = Regex::new(""); | ^^ | = help: the regex is unlikely to be useful as it is error: trivial regex - --> $DIR/regex.rs:71:36 + --> $DIR/regex.rs:81:36 | -71 | let trivial_empty = Regex::new("^"); +81 | let trivial_empty = Regex::new("^"); | ^^^ | = help: the regex is unlikely to be useful as it is error: trivial regex - --> $DIR/regex.rs:73:36 + --> $DIR/regex.rs:83:36 | -73 | let trivial_empty = Regex::new("^$"); +83 | let trivial_empty = Regex::new("^$"); | ^^^^ | = help: consider using `str::is_empty` error: trivial regex - --> $DIR/regex.rs:75:44 + --> $DIR/regex.rs:85:44 | -75 | let binary_trivial_empty = BRegex::new("^$"); +85 | let binary_trivial_empty = BRegex::new("^$"); | ^^^^ | = help: consider using `str::is_empty` diff --git a/tests/ui/replace_consts.rs b/tests/ui/replace_consts.rs index 8420b368d..2f961e86f 100644 --- a/tests/ui/replace_consts.rs +++ b/tests/ui/replace_consts.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(integer_atomics)] diff --git a/tests/ui/replace_consts.stderr b/tests/ui/replace_consts.stderr index fb9c9414c..02100b419 100644 --- a/tests/ui/replace_consts.stderr +++ b/tests/ui/replace_consts.stderr @@ -1,217 +1,217 @@ error: using `ATOMIC_BOOL_INIT` - --> $DIR/replace_consts.rs:14:17 + --> $DIR/replace_consts.rs:24:17 | -14 | { let foo = ATOMIC_BOOL_INIT; }; +24 | { let foo = ATOMIC_BOOL_INIT; }; | ^^^^^^^^^^^^^^^^ help: try this: `AtomicBool::new(false)` | note: lint level defined here - --> $DIR/replace_consts.rs:5:9 + --> $DIR/replace_consts.rs:15:9 | -5 | #![deny(clippy::replace_consts)] +15 | #![deny(clippy::replace_consts)] | ^^^^^^^^^^^^^^^^^^^^^^ error: using `ATOMIC_ISIZE_INIT` - --> $DIR/replace_consts.rs:15:17 + --> $DIR/replace_consts.rs:25:17 | -15 | { let foo = ATOMIC_ISIZE_INIT; }; +25 | { let foo = ATOMIC_ISIZE_INIT; }; | ^^^^^^^^^^^^^^^^^ help: try this: `AtomicIsize::new(0)` error: using `ATOMIC_I8_INIT` - --> $DIR/replace_consts.rs:16:17 + --> $DIR/replace_consts.rs:26:17 | -16 | { let foo = ATOMIC_I8_INIT; }; +26 | { let foo = ATOMIC_I8_INIT; }; | ^^^^^^^^^^^^^^ help: try this: `AtomicI8::new(0)` error: using `ATOMIC_I16_INIT` - --> $DIR/replace_consts.rs:17:17 + --> $DIR/replace_consts.rs:27:17 | -17 | { let foo = ATOMIC_I16_INIT; }; +27 | { let foo = ATOMIC_I16_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicI16::new(0)` error: using `ATOMIC_I32_INIT` - --> $DIR/replace_consts.rs:18:17 + --> $DIR/replace_consts.rs:28:17 | -18 | { let foo = ATOMIC_I32_INIT; }; +28 | { let foo = ATOMIC_I32_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicI32::new(0)` error: using `ATOMIC_I64_INIT` - --> $DIR/replace_consts.rs:19:17 + --> $DIR/replace_consts.rs:29:17 | -19 | { let foo = ATOMIC_I64_INIT; }; +29 | { let foo = ATOMIC_I64_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicI64::new(0)` error: using `ATOMIC_USIZE_INIT` - --> $DIR/replace_consts.rs:20:17 + --> $DIR/replace_consts.rs:30:17 | -20 | { let foo = ATOMIC_USIZE_INIT; }; +30 | { let foo = ATOMIC_USIZE_INIT; }; | ^^^^^^^^^^^^^^^^^ help: try this: `AtomicUsize::new(0)` error: using `ATOMIC_U8_INIT` - --> $DIR/replace_consts.rs:21:17 + --> $DIR/replace_consts.rs:31:17 | -21 | { let foo = ATOMIC_U8_INIT; }; +31 | { let foo = ATOMIC_U8_INIT; }; | ^^^^^^^^^^^^^^ help: try this: `AtomicU8::new(0)` error: using `ATOMIC_U16_INIT` - --> $DIR/replace_consts.rs:22:17 + --> $DIR/replace_consts.rs:32:17 | -22 | { let foo = ATOMIC_U16_INIT; }; +32 | { let foo = ATOMIC_U16_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicU16::new(0)` error: using `ATOMIC_U32_INIT` - --> $DIR/replace_consts.rs:23:17 + --> $DIR/replace_consts.rs:33:17 | -23 | { let foo = ATOMIC_U32_INIT; }; +33 | { let foo = ATOMIC_U32_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicU32::new(0)` error: using `ATOMIC_U64_INIT` - --> $DIR/replace_consts.rs:24:17 - | -24 | { let foo = ATOMIC_U64_INIT; }; - | ^^^^^^^^^^^^^^^ help: try this: `AtomicU64::new(0)` - -error: using `MIN` - --> $DIR/replace_consts.rs:26:17 - | -26 | { let foo = std::isize::MIN; }; - | ^^^^^^^^^^^^^^^ help: try this: `isize::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:27:17 - | -27 | { let foo = std::i8::MIN; }; - | ^^^^^^^^^^^^ help: try this: `i8::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:28:17 - | -28 | { let foo = std::i16::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `i16::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:29:17 - | -29 | { let foo = std::i32::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `i32::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:30:17 - | -30 | { let foo = std::i64::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `i64::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:31:17 - | -31 | { let foo = std::i128::MIN; }; - | ^^^^^^^^^^^^^^ help: try this: `i128::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:32:17 - | -32 | { let foo = std::usize::MIN; }; - | ^^^^^^^^^^^^^^^ help: try this: `usize::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:33:17 - | -33 | { let foo = std::u8::MIN; }; - | ^^^^^^^^^^^^ help: try this: `u8::min_value()` - -error: using `MIN` --> $DIR/replace_consts.rs:34:17 | -34 | { let foo = std::u16::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `u16::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:35:17 - | -35 | { let foo = std::u32::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `u32::min_value()` +34 | { let foo = ATOMIC_U64_INIT; }; + | ^^^^^^^^^^^^^^^ help: try this: `AtomicU64::new(0)` error: using `MIN` --> $DIR/replace_consts.rs:36:17 | -36 | { let foo = std::u64::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `u64::min_value()` +36 | { let foo = std::isize::MIN; }; + | ^^^^^^^^^^^^^^^ help: try this: `isize::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:37:17 | -37 | { let foo = std::u128::MIN; }; - | ^^^^^^^^^^^^^^ help: try this: `u128::min_value()` +37 | { let foo = std::i8::MIN; }; + | ^^^^^^^^^^^^ help: try this: `i8::min_value()` -error: using `MAX` +error: using `MIN` + --> $DIR/replace_consts.rs:38:17 + | +38 | { let foo = std::i16::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `i16::min_value()` + +error: using `MIN` --> $DIR/replace_consts.rs:39:17 | -39 | { let foo = std::isize::MAX; }; - | ^^^^^^^^^^^^^^^ help: try this: `isize::max_value()` +39 | { let foo = std::i32::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `i32::min_value()` -error: using `MAX` +error: using `MIN` --> $DIR/replace_consts.rs:40:17 | -40 | { let foo = std::i8::MAX; }; - | ^^^^^^^^^^^^ help: try this: `i8::max_value()` +40 | { let foo = std::i64::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `i64::min_value()` -error: using `MAX` +error: using `MIN` --> $DIR/replace_consts.rs:41:17 | -41 | { let foo = std::i16::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `i16::max_value()` +41 | { let foo = std::i128::MIN; }; + | ^^^^^^^^^^^^^^ help: try this: `i128::min_value()` -error: using `MAX` +error: using `MIN` --> $DIR/replace_consts.rs:42:17 | -42 | { let foo = std::i32::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `i32::max_value()` +42 | { let foo = std::usize::MIN; }; + | ^^^^^^^^^^^^^^^ help: try this: `usize::min_value()` -error: using `MAX` +error: using `MIN` --> $DIR/replace_consts.rs:43:17 | -43 | { let foo = std::i64::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `i64::max_value()` +43 | { let foo = std::u8::MIN; }; + | ^^^^^^^^^^^^ help: try this: `u8::min_value()` -error: using `MAX` +error: using `MIN` --> $DIR/replace_consts.rs:44:17 | -44 | { let foo = std::i128::MAX; }; - | ^^^^^^^^^^^^^^ help: try this: `i128::max_value()` +44 | { let foo = std::u16::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `u16::min_value()` -error: using `MAX` +error: using `MIN` --> $DIR/replace_consts.rs:45:17 | -45 | { let foo = std::usize::MAX; }; - | ^^^^^^^^^^^^^^^ help: try this: `usize::max_value()` +45 | { let foo = std::u32::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `u32::min_value()` -error: using `MAX` +error: using `MIN` --> $DIR/replace_consts.rs:46:17 | -46 | { let foo = std::u8::MAX; }; - | ^^^^^^^^^^^^ help: try this: `u8::max_value()` +46 | { let foo = std::u64::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `u64::min_value()` -error: using `MAX` +error: using `MIN` --> $DIR/replace_consts.rs:47:17 | -47 | { let foo = std::u16::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `u16::max_value()` - -error: using `MAX` - --> $DIR/replace_consts.rs:48:17 - | -48 | { let foo = std::u32::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `u32::max_value()` +47 | { let foo = std::u128::MIN; }; + | ^^^^^^^^^^^^^^ help: try this: `u128::min_value()` error: using `MAX` --> $DIR/replace_consts.rs:49:17 | -49 | { let foo = std::u64::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `u64::max_value()` +49 | { let foo = std::isize::MAX; }; + | ^^^^^^^^^^^^^^^ help: try this: `isize::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:50:17 | -50 | { let foo = std::u128::MAX; }; +50 | { let foo = std::i8::MAX; }; + | ^^^^^^^^^^^^ help: try this: `i8::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:51:17 + | +51 | { let foo = std::i16::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `i16::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:52:17 + | +52 | { let foo = std::i32::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `i32::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:53:17 + | +53 | { let foo = std::i64::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `i64::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:54:17 + | +54 | { let foo = std::i128::MAX; }; + | ^^^^^^^^^^^^^^ help: try this: `i128::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:55:17 + | +55 | { let foo = std::usize::MAX; }; + | ^^^^^^^^^^^^^^^ help: try this: `usize::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:56:17 + | +56 | { let foo = std::u8::MAX; }; + | ^^^^^^^^^^^^ help: try this: `u8::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:57:17 + | +57 | { let foo = std::u16::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `u16::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:58:17 + | +58 | { let foo = std::u32::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `u32::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:59:17 + | +59 | { let foo = std::u64::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `u64::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:60:17 + | +60 | { let foo = std::u128::MAX; }; | ^^^^^^^^^^^^^^ help: try this: `u128::max_value()` error: aborting due to 35 previous errors diff --git a/tests/ui/result_map_unit_fn.rs b/tests/ui/result_map_unit_fn.rs index 8cac6a9c8..4edbfdd5b 100644 --- a/tests/ui/result_map_unit_fn.rs +++ b/tests/ui/result_map_unit_fn.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(never_type)] diff --git a/tests/ui/result_map_unit_fn.stderr b/tests/ui/result_map_unit_fn.stderr index 5fba1a0d7..04f105c78 100644 --- a/tests/ui/result_map_unit_fn.stderr +++ b/tests/ui/result_map_unit_fn.stderr @@ -1,7 +1,7 @@ error: called `map(f)` on an Result value where `f` is a unit function - --> $DIR/result_map_unit_fn.rs:35:5 + --> $DIR/result_map_unit_fn.rs:45:5 | -35 | x.field.map(do_nothing); +45 | x.field.map(do_nothing); | ^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }` @@ -9,183 +9,183 @@ error: called `map(f)` on an Result value where `f` is a unit function = note: `-D clippy::result-map-unit-fn` implied by `-D warnings` error: called `map(f)` on an Result value where `f` is a unit function - --> $DIR/result_map_unit_fn.rs:37:5 + --> $DIR/result_map_unit_fn.rs:47:5 | -37 | x.field.map(do_nothing); +47 | x.field.map(do_nothing); | ^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }` error: called `map(f)` on an Result value where `f` is a unit function - --> $DIR/result_map_unit_fn.rs:39:5 + --> $DIR/result_map_unit_fn.rs:49:5 | -39 | x.field.map(diverge); +49 | x.field.map(diverge); | ^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(x_field) = x.field { diverge(...) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:45:5 + --> $DIR/result_map_unit_fn.rs:55:5 | -45 | x.field.map(|value| x.do_result_nothing(value + captured)); +55 | x.field.map(|value| x.do_result_nothing(value + captured)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { x.do_result_nothing(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:47:5 + --> $DIR/result_map_unit_fn.rs:57:5 | -47 | x.field.map(|value| { x.do_result_plus_one(value + captured); }); +57 | x.field.map(|value| { x.do_result_plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { x.do_result_plus_one(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:50:5 + --> $DIR/result_map_unit_fn.rs:60:5 | -50 | x.field.map(|value| do_nothing(value + captured)); +60 | x.field.map(|value| do_nothing(value + captured)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:52:5 + --> $DIR/result_map_unit_fn.rs:62:5 | -52 | x.field.map(|value| { do_nothing(value + captured) }); +62 | x.field.map(|value| { do_nothing(value + captured) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:54:5 + --> $DIR/result_map_unit_fn.rs:64:5 | -54 | x.field.map(|value| { do_nothing(value + captured); }); +64 | x.field.map(|value| { do_nothing(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:56:5 + --> $DIR/result_map_unit_fn.rs:66:5 | -56 | x.field.map(|value| { { do_nothing(value + captured); } }); +66 | x.field.map(|value| { { do_nothing(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:59:5 + --> $DIR/result_map_unit_fn.rs:69:5 | -59 | x.field.map(|value| diverge(value + captured)); +69 | x.field.map(|value| diverge(value + captured)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { diverge(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:61:5 + --> $DIR/result_map_unit_fn.rs:71:5 | -61 | x.field.map(|value| { diverge(value + captured) }); +71 | x.field.map(|value| { diverge(value + captured) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { diverge(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:63:5 + --> $DIR/result_map_unit_fn.rs:73:5 | -63 | x.field.map(|value| { diverge(value + captured); }); +73 | x.field.map(|value| { diverge(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { diverge(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:65:5 + --> $DIR/result_map_unit_fn.rs:75:5 | -65 | x.field.map(|value| { { diverge(value + captured); } }); +75 | x.field.map(|value| { { diverge(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { diverge(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:70:5 + --> $DIR/result_map_unit_fn.rs:80:5 | -70 | x.field.map(|value| { let y = plus_one(value + captured); }); +80 | x.field.map(|value| { let y = plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { let y = plus_one(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:72:5 + --> $DIR/result_map_unit_fn.rs:82:5 | -72 | x.field.map(|value| { plus_one(value + captured); }); +82 | x.field.map(|value| { plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:74:5 + --> $DIR/result_map_unit_fn.rs:84:5 | -74 | x.field.map(|value| { { plus_one(value + captured); } }); +84 | x.field.map(|value| { { plus_one(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:77:5 + --> $DIR/result_map_unit_fn.rs:87:5 | -77 | x.field.map(|ref value| { do_nothing(value + captured) }); +87 | x.field.map(|ref value| { do_nothing(value + captured) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(ref value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:80:5 + --> $DIR/result_map_unit_fn.rs:90:5 | -80 | x.field.map(|value| { do_nothing(value); do_nothing(value) }); +90 | x.field.map(|value| { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { ... }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:82:5 + --> $DIR/result_map_unit_fn.rs:92:5 | -82 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); +92 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { ... }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:86:5 + --> $DIR/result_map_unit_fn.rs:96:5 | -86 | x.field.map(|value| { +96 | x.field.map(|value| { | _____^ | |_____| | || -87 | || do_nothing(value); -88 | || do_nothing(value) -89 | || }); +97 | || do_nothing(value); +98 | || do_nothing(value) +99 | || }); | ||______^- help: try this: `if let Ok(value) = x.field { ... }` | |_______| | error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:90:5 - | -90 | x.field.map(|value| { do_nothing(value); do_nothing(value); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Ok(value) = x.field { ... }` - -error: called `map(f)` on an Result value where `f` is a unit function - --> $DIR/result_map_unit_fn.rs:94:5 - | -94 | "12".parse::().map(diverge); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Ok(_) = "12".parse::() { diverge(...) }` - -error: called `map(f)` on an Result value where `f` is a unit function --> $DIR/result_map_unit_fn.rs:100:5 | -100 | y.map(do_nothing); +100 | x.field.map(|value| { do_nothing(value); do_nothing(value); }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Ok(value) = x.field { ... }` + +error: called `map(f)` on an Result value where `f` is a unit function + --> $DIR/result_map_unit_fn.rs:104:5 + | +104 | "12".parse::().map(diverge); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Ok(_) = "12".parse::() { diverge(...) }` + +error: called `map(f)` on an Result value where `f` is a unit function + --> $DIR/result_map_unit_fn.rs:110:5 + | +110 | y.map(do_nothing); | ^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(_y) = y { do_nothing(...) }` diff --git a/tests/ui/serde.rs b/tests/ui/serde.rs index 65c2c344d..caa954bea 100644 --- a/tests/ui/serde.rs +++ b/tests/ui/serde.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::serde_api_misuse)] diff --git a/tests/ui/serde.stderr b/tests/ui/serde.stderr index cce839a0d..e223430e6 100644 --- a/tests/ui/serde.stderr +++ b/tests/ui/serde.stderr @@ -1,11 +1,11 @@ error: you should not implement `visit_string` without also implementing `visit_str` - --> $DIR/serde.rs:39:5 + --> $DIR/serde.rs:49:5 | -39 | / fn visit_string(self, _v: String) -> Result -40 | | where E: serde::de::Error, -41 | | { -42 | | unimplemented!() -43 | | } +49 | / fn visit_string(self, _v: String) -> Result +50 | | where E: serde::de::Error, +51 | | { +52 | | unimplemented!() +53 | | } | |_____^ | = note: `-D clippy::serde-api-misuse` implied by `-D warnings` diff --git a/tests/ui/shadow.rs b/tests/ui/shadow.rs index c73acf5c5..a607161a9 100644 --- a/tests/ui/shadow.rs +++ b/tests/ui/shadow.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/shadow.stderr b/tests/ui/shadow.stderr index 311177e25..adca299d3 100644 --- a/tests/ui/shadow.stderr +++ b/tests/ui/shadow.stderr @@ -1,137 +1,137 @@ error: `x` is shadowed by itself in `&mut x` - --> $DIR/shadow.rs:13:5 + --> $DIR/shadow.rs:23:5 | -13 | let x = &mut x; +23 | let x = &mut x; | ^^^^^^^^^^^^^^^ | = note: `-D clippy::shadow-same` implied by `-D warnings` note: previous binding is here - --> $DIR/shadow.rs:12:13 + --> $DIR/shadow.rs:22:13 | -12 | let mut x = 1; +22 | let mut x = 1; | ^ error: `x` is shadowed by itself in `{ x }` - --> $DIR/shadow.rs:14:5 + --> $DIR/shadow.rs:24:5 | -14 | let x = { x }; +24 | let x = { x }; | ^^^^^^^^^^^^^^ | note: previous binding is here - --> $DIR/shadow.rs:13:9 + --> $DIR/shadow.rs:23:9 | -13 | let x = &mut x; +23 | let x = &mut x; | ^ error: `x` is shadowed by itself in `(&*x)` - --> $DIR/shadow.rs:15:5 + --> $DIR/shadow.rs:25:5 | -15 | let x = (&*x); +25 | let x = (&*x); | ^^^^^^^^^^^^^^ | note: previous binding is here - --> $DIR/shadow.rs:14:9 + --> $DIR/shadow.rs:24:9 | -14 | let x = { x }; +24 | let x = { x }; | ^ error: `x` is shadowed by `{ *x + 1 }` which reuses the original value - --> $DIR/shadow.rs:16:9 + --> $DIR/shadow.rs:26:9 | -16 | let x = { *x + 1 }; +26 | let x = { *x + 1 }; | ^ | = note: `-D clippy::shadow-reuse` implied by `-D warnings` note: initialization happens here - --> $DIR/shadow.rs:16:13 + --> $DIR/shadow.rs:26:13 | -16 | let x = { *x + 1 }; +26 | let x = { *x + 1 }; | ^^^^^^^^^^ note: previous binding is here - --> $DIR/shadow.rs:15:9 + --> $DIR/shadow.rs:25:9 | -15 | let x = (&*x); +25 | let x = (&*x); | ^ error: `x` is shadowed by `id(x)` which reuses the original value - --> $DIR/shadow.rs:17:9 + --> $DIR/shadow.rs:27:9 | -17 | let x = id(x); +27 | let x = id(x); | ^ | note: initialization happens here - --> $DIR/shadow.rs:17:13 + --> $DIR/shadow.rs:27:13 | -17 | let x = id(x); +27 | let x = id(x); | ^^^^^ note: previous binding is here - --> $DIR/shadow.rs:16:9 + --> $DIR/shadow.rs:26:9 | -16 | let x = { *x + 1 }; +26 | let x = { *x + 1 }; | ^ error: `x` is shadowed by `(1, x)` which reuses the original value - --> $DIR/shadow.rs:18:9 + --> $DIR/shadow.rs:28:9 | -18 | let x = (1, x); +28 | let x = (1, x); | ^ | note: initialization happens here - --> $DIR/shadow.rs:18:13 + --> $DIR/shadow.rs:28:13 | -18 | let x = (1, x); +28 | let x = (1, x); | ^^^^^^ note: previous binding is here - --> $DIR/shadow.rs:17:9 + --> $DIR/shadow.rs:27:9 | -17 | let x = id(x); +27 | let x = id(x); | ^ error: `x` is shadowed by `first(x)` which reuses the original value - --> $DIR/shadow.rs:19:9 + --> $DIR/shadow.rs:29:9 | -19 | let x = first(x); +29 | let x = first(x); | ^ | note: initialization happens here - --> $DIR/shadow.rs:19:13 + --> $DIR/shadow.rs:29:13 | -19 | let x = first(x); +29 | let x = first(x); | ^^^^^^^^ note: previous binding is here - --> $DIR/shadow.rs:18:9 + --> $DIR/shadow.rs:28:9 | -18 | let x = (1, x); +28 | let x = (1, x); | ^ error: `x` is shadowed by `y` - --> $DIR/shadow.rs:21:9 + --> $DIR/shadow.rs:31:9 | -21 | let x = y; +31 | let x = y; | ^ | = note: `-D clippy::shadow-unrelated` implied by `-D warnings` note: initialization happens here - --> $DIR/shadow.rs:21:13 + --> $DIR/shadow.rs:31:13 | -21 | let x = y; +31 | let x = y; | ^ note: previous binding is here - --> $DIR/shadow.rs:19:9 + --> $DIR/shadow.rs:29:9 | -19 | let x = first(x); +29 | let x = first(x); | ^ error: `x` shadows a previous declaration - --> $DIR/shadow.rs:23:5 + --> $DIR/shadow.rs:33:5 | -23 | let x; +33 | let x; | ^^^^^^ | note: previous binding is here - --> $DIR/shadow.rs:21:9 + --> $DIR/shadow.rs:31:9 | -21 | let x = y; +31 | let x = y; | ^ error: aborting due to 9 previous errors diff --git a/tests/ui/short_circuit_statement.rs b/tests/ui/short_circuit_statement.rs index e9cb8e4ad..01511314c 100644 --- a/tests/ui/short_circuit_statement.rs +++ b/tests/ui/short_circuit_statement.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/short_circuit_statement.stderr b/tests/ui/short_circuit_statement.stderr index bef497c33..331bdac31 100644 --- a/tests/ui/short_circuit_statement.stderr +++ b/tests/ui/short_circuit_statement.stderr @@ -1,22 +1,22 @@ error: boolean short circuit operator in statement may be clearer using an explicit test - --> $DIR/short_circuit_statement.rs:7:5 - | -7 | f() && g(); - | ^^^^^^^^^^^ help: replace it with: `if f() { g(); }` - | - = note: `-D clippy::short-circuit-statement` implied by `-D warnings` + --> $DIR/short_circuit_statement.rs:17:5 + | +17 | f() && g(); + | ^^^^^^^^^^^ help: replace it with: `if f() { g(); }` + | + = note: `-D clippy::short-circuit-statement` implied by `-D warnings` error: boolean short circuit operator in statement may be clearer using an explicit test - --> $DIR/short_circuit_statement.rs:8:5 - | -8 | f() || g(); - | ^^^^^^^^^^^ help: replace it with: `if !f() { g(); }` + --> $DIR/short_circuit_statement.rs:18:5 + | +18 | f() || g(); + | ^^^^^^^^^^^ help: replace it with: `if !f() { g(); }` error: boolean short circuit operator in statement may be clearer using an explicit test - --> $DIR/short_circuit_statement.rs:9:5 - | -9 | 1 == 2 || g(); - | ^^^^^^^^^^^^^^ help: replace it with: `if !(1 == 2) { g(); }` + --> $DIR/short_circuit_statement.rs:19:5 + | +19 | 1 == 2 || g(); + | ^^^^^^^^^^^^^^ help: replace it with: `if !(1 == 2) { g(); }` error: aborting due to 3 previous errors diff --git a/tests/ui/single_char_pattern.rs b/tests/ui/single_char_pattern.rs index c4e88e9ee..12aaa69f3 100644 --- a/tests/ui/single_char_pattern.rs +++ b/tests/ui/single_char_pattern.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] use std::collections::HashSet; diff --git a/tests/ui/single_char_pattern.stderr b/tests/ui/single_char_pattern.stderr index 783556127..ff657df1b 100644 --- a/tests/ui/single_char_pattern.stderr +++ b/tests/ui/single_char_pattern.stderr @@ -1,123 +1,123 @@ error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:7:13 - | -7 | x.split("x"); - | ^^^ help: try using a char instead: `'x'` - | - = note: `-D clippy::single-char-pattern` implied by `-D warnings` + --> $DIR/single_char_pattern.rs:17:13 + | +17 | x.split("x"); + | ^^^ help: try using a char instead: `'x'` + | + = note: `-D clippy::single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:24:16 + --> $DIR/single_char_pattern.rs:34:16 | -24 | x.contains("x"); +34 | x.contains("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:25:19 + --> $DIR/single_char_pattern.rs:35:19 | -25 | x.starts_with("x"); +35 | x.starts_with("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:26:17 + --> $DIR/single_char_pattern.rs:36:17 | -26 | x.ends_with("x"); +36 | x.ends_with("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:27:12 + --> $DIR/single_char_pattern.rs:37:12 | -27 | x.find("x"); +37 | x.find("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:28:13 + --> $DIR/single_char_pattern.rs:38:13 | -28 | x.rfind("x"); +38 | x.rfind("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:29:14 + --> $DIR/single_char_pattern.rs:39:14 | -29 | x.rsplit("x"); +39 | x.rsplit("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:30:24 + --> $DIR/single_char_pattern.rs:40:24 | -30 | x.split_terminator("x"); +40 | x.split_terminator("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:31:25 + --> $DIR/single_char_pattern.rs:41:25 | -31 | x.rsplit_terminator("x"); +41 | x.rsplit_terminator("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:32:17 + --> $DIR/single_char_pattern.rs:42:17 | -32 | x.splitn(0, "x"); +42 | x.splitn(0, "x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:33:18 + --> $DIR/single_char_pattern.rs:43:18 | -33 | x.rsplitn(0, "x"); +43 | x.rsplitn(0, "x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:34:15 + --> $DIR/single_char_pattern.rs:44:15 | -34 | x.matches("x"); +44 | x.matches("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:35:16 + --> $DIR/single_char_pattern.rs:45:16 | -35 | x.rmatches("x"); +45 | x.rmatches("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:36:21 + --> $DIR/single_char_pattern.rs:46:21 | -36 | x.match_indices("x"); +46 | x.match_indices("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:37:22 + --> $DIR/single_char_pattern.rs:47:22 | -37 | x.rmatch_indices("x"); +47 | x.rmatch_indices("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:38:25 + --> $DIR/single_char_pattern.rs:48:25 | -38 | x.trim_left_matches("x"); +48 | x.trim_left_matches("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:39:26 + --> $DIR/single_char_pattern.rs:49:26 | -39 | x.trim_right_matches("x"); +49 | x.trim_right_matches("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:41:13 + --> $DIR/single_char_pattern.rs:51:13 | -41 | x.split("/n"); +51 | x.split("/n"); | ^^^^ help: try using a char instead: `'/n'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:46:31 + --> $DIR/single_char_pattern.rs:56:31 | -46 | x.replace(";", ",").split(","); // issue #2978 +56 | x.replace(";", ",").split(","); // issue #2978 | ^^^ help: try using a char instead: `','` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:47:19 + --> $DIR/single_char_pattern.rs:57:19 | -47 | x.starts_with("/x03"); // issue #2996 +57 | x.starts_with("/x03"); // issue #2996 | ^^^^^^ help: try using a char instead: `'/x03'` error: aborting due to 20 previous errors diff --git a/tests/ui/single_match.rs b/tests/ui/single_match.rs index c0c82adaf..07c1a9502 100644 --- a/tests/ui/single_match.rs +++ b/tests/ui/single_match.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::single_match)] diff --git a/tests/ui/single_match.stderr b/tests/ui/single_match.stderr index 20d8fed25..74448391c 100644 --- a/tests/ui/single_match.stderr +++ b/tests/ui/single_match.stderr @@ -1,48 +1,48 @@ error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:11:5 + --> $DIR/single_match.rs:21:5 | -11 | / match x { -12 | | Some(y) => { println!("{:?}", y); } -13 | | _ => () -14 | | }; +21 | / match x { +22 | | Some(y) => { println!("{:?}", y); } +23 | | _ => () +24 | | }; | |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y); }` | = note: `-D clippy::single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:17:5 + --> $DIR/single_match.rs:27:5 | -17 | / match z { -18 | | (2...3, 7...9) => dummy(), -19 | | _ => {} -20 | | }; +27 | / match z { +28 | | (2...3, 7...9) => dummy(), +29 | | _ => {} +30 | | }; | |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:43:5 + --> $DIR/single_match.rs:53:5 | -43 | / match x { -44 | | Some(y) => dummy(), -45 | | None => () -46 | | }; +53 | / match x { +54 | | Some(y) => dummy(), +55 | | None => () +56 | | }; | |_____^ help: try this: `if let Some(y) = x { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:48:5 + --> $DIR/single_match.rs:58:5 | -48 | / match y { -49 | | Ok(y) => dummy(), -50 | | Err(..) => () -51 | | }; +58 | / match y { +59 | | Ok(y) => dummy(), +60 | | Err(..) => () +61 | | }; | |_____^ help: try this: `if let Ok(y) = y { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:55:5 + --> $DIR/single_match.rs:65:5 | -55 | / match c { -56 | | Cow::Borrowed(..) => dummy(), -57 | | Cow::Owned(..) => (), -58 | | }; +65 | / match c { +66 | | Cow::Borrowed(..) => dummy(), +67 | | Cow::Owned(..) => (), +68 | | }; | |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }` error: aborting due to 5 previous errors diff --git a/tests/ui/starts_ends_with.rs b/tests/ui/starts_ends_with.rs index adea56cf9..180924d2c 100644 --- a/tests/ui/starts_ends_with.rs +++ b/tests/ui/starts_ends_with.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(dead_code)] diff --git a/tests/ui/starts_ends_with.stderr b/tests/ui/starts_ends_with.stderr index b3fb444b5..9921819e0 100644 --- a/tests/ui/starts_ends_with.stderr +++ b/tests/ui/starts_ends_with.stderr @@ -1,77 +1,77 @@ error: you should use the `starts_with` method - --> $DIR/starts_ends_with.rs:9:5 - | -9 | "".chars().next() == Some(' '); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with(' ')` - | - = note: `-D clippy::chars-next-cmp` implied by `-D warnings` + --> $DIR/starts_ends_with.rs:19:5 + | +19 | "".chars().next() == Some(' '); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with(' ')` + | + = note: `-D clippy::chars-next-cmp` implied by `-D warnings` error: you should use the `starts_with` method - --> $DIR/starts_ends_with.rs:10:5 + --> $DIR/starts_ends_with.rs:20:5 | -10 | Some(' ') != "".chars().next(); +20 | Some(' ') != "".chars().next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with(' ')` error: you should use the `starts_with` method - --> $DIR/starts_ends_with.rs:15:8 + --> $DIR/starts_ends_with.rs:25:8 | -15 | if s.chars().next().unwrap() == 'f' { // s.starts_with('f') +25 | if s.chars().next().unwrap() == 'f' { // s.starts_with('f') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.starts_with('f')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:18:8 + --> $DIR/starts_ends_with.rs:28:8 | -18 | if s.chars().next_back().unwrap() == 'o' { // s.ends_with('o') +28 | if s.chars().next_back().unwrap() == 'o' { // s.ends_with('o') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.ends_with('o')` | = note: `-D clippy::chars-last-cmp` implied by `-D warnings` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:21:8 + --> $DIR/starts_ends_with.rs:31:8 | -21 | if s.chars().last().unwrap() == 'o' { // s.ends_with('o') +31 | if s.chars().last().unwrap() == 'o' { // s.ends_with('o') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.ends_with('o')` error: you should use the `starts_with` method - --> $DIR/starts_ends_with.rs:24:8 + --> $DIR/starts_ends_with.rs:34:8 | -24 | if s.chars().next().unwrap() != 'f' { // !s.starts_with('f') +34 | if s.chars().next().unwrap() != 'f' { // !s.starts_with('f') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.starts_with('f')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:27:8 + --> $DIR/starts_ends_with.rs:37:8 | -27 | if s.chars().next_back().unwrap() != 'o' { // !s.ends_with('o') +37 | if s.chars().next_back().unwrap() != 'o' { // !s.ends_with('o') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('o')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:30:8 + --> $DIR/starts_ends_with.rs:40:8 | -30 | if s.chars().last().unwrap() != 'o' { // !s.ends_with('o') +40 | if s.chars().last().unwrap() != 'o' { // !s.ends_with('o') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('o')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:37:5 + --> $DIR/starts_ends_with.rs:47:5 | -37 | "".chars().last() == Some(' '); +47 | "".chars().last() == Some(' '); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:38:5 + --> $DIR/starts_ends_with.rs:48:5 | -38 | Some(' ') != "".chars().last(); +48 | Some(' ') != "".chars().last(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with(' ')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:39:5 + --> $DIR/starts_ends_with.rs:49:5 | -39 | "".chars().next_back() == Some(' '); +49 | "".chars().next_back() == Some(' '); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:40:5 + --> $DIR/starts_ends_with.rs:50:5 | -40 | Some(' ') != "".chars().next_back(); +50 | Some(' ') != "".chars().next_back(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with(' ')` error: aborting due to 12 previous errors diff --git a/tests/ui/string_extend.rs b/tests/ui/string_extend.rs index d99adb19f..a0cf9c469 100644 --- a/tests/ui/string_extend.rs +++ b/tests/ui/string_extend.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #[derive(Copy, Clone)] struct HasChars; diff --git a/tests/ui/string_extend.stderr b/tests/ui/string_extend.stderr index 32e348269..2a82972a3 100644 --- a/tests/ui/string_extend.stderr +++ b/tests/ui/string_extend.stderr @@ -1,21 +1,21 @@ error: calling `.extend(_.chars())` - --> $DIR/string_extend.rs:16:5 + --> $DIR/string_extend.rs:26:5 | -16 | s.extend(abc.chars()); +26 | s.extend(abc.chars()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(abc)` | = note: `-D clippy::string-extend-chars` implied by `-D warnings` error: calling `.extend(_.chars())` - --> $DIR/string_extend.rs:19:5 + --> $DIR/string_extend.rs:29:5 | -19 | s.extend("abc".chars()); +29 | s.extend("abc".chars()); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str("abc")` error: calling `.extend(_.chars())` - --> $DIR/string_extend.rs:22:5 + --> $DIR/string_extend.rs:32:5 | -22 | s.extend(def.chars()); +32 | s.extend(def.chars()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(&def)` error: aborting due to 3 previous errors diff --git a/tests/ui/strings.rs b/tests/ui/strings.rs index 86819e3fd..31e6c9a05 100644 --- a/tests/ui/strings.rs +++ b/tests/ui/strings.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/strings.stderr b/tests/ui/strings.stderr index 258920e26..bcdf91568 100644 --- a/tests/ui/strings.stderr +++ b/tests/ui/strings.stderr @@ -1,75 +1,75 @@ error: manual implementation of an assign operation - --> $DIR/strings.rs:10:9 + --> $DIR/strings.rs:20:9 | -10 | x = x + "."; +20 | x = x + "."; | ^^^^^^^^^^^ help: replace it with: `x += "."` | = note: `-D clippy::assign-op-pattern` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:10:13 + --> $DIR/strings.rs:20:13 | -10 | x = x + "."; +20 | x = x + "."; | ^^^^^^^ | = note: `-D clippy::string-add` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:14:13 + --> $DIR/strings.rs:24:13 | -14 | let z = y + "..."; +24 | let z = y + "..."; | ^^^^^^^^^ error: you assigned the result of adding something to this string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:24:9 + --> $DIR/strings.rs:34:9 | -24 | x = x + "."; +34 | x = x + "."; | ^^^^^^^^^^^ | = note: `-D clippy::string-add-assign` implied by `-D warnings` error: manual implementation of an assign operation - --> $DIR/strings.rs:24:9 + --> $DIR/strings.rs:34:9 | -24 | x = x + "."; +34 | x = x + "."; | ^^^^^^^^^^^ help: replace it with: `x += "."` error: you assigned the result of adding something to this string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:38:9 + --> $DIR/strings.rs:48:9 | -38 | x = x + "."; +48 | x = x + "."; | ^^^^^^^^^^^ error: manual implementation of an assign operation - --> $DIR/strings.rs:38:9 + --> $DIR/strings.rs:48:9 | -38 | x = x + "."; +48 | x = x + "."; | ^^^^^^^^^^^ help: replace it with: `x += "."` error: you added something to a string. Consider using `String::push_str()` instead - --> $DIR/strings.rs:42:13 + --> $DIR/strings.rs:52:13 | -42 | let z = y + "..."; +52 | let z = y + "..."; | ^^^^^^^^^ error: calling `as_bytes()` on a string literal - --> $DIR/strings.rs:50:14 + --> $DIR/strings.rs:60:14 | -50 | let bs = "hello there".as_bytes(); +60 | let bs = "hello there".as_bytes(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"hello there"` | = note: `-D clippy::string-lit-as-bytes` implied by `-D warnings` error: calling `as_bytes()` on a string literal - --> $DIR/strings.rs:55:18 + --> $DIR/strings.rs:65:18 | -55 | let strify = stringify!(foobar).as_bytes(); +65 | let strify = stringify!(foobar).as_bytes(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `bstringify!(foobar)` error: manual implementation of an assign operation - --> $DIR/strings.rs:65:7 + --> $DIR/strings.rs:75:7 | -65 | ; x = x + 1; +75 | ; x = x + 1; | ^^^^^^^^^ help: replace it with: `x += 1` error: aborting due to 11 previous errors diff --git a/tests/ui/stutter.rs b/tests/ui/stutter.rs index de67bb1af..148e8071c 100644 --- a/tests/ui/stutter.rs +++ b/tests/ui/stutter.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::stutter)] diff --git a/tests/ui/stutter.stderr b/tests/ui/stutter.stderr index 3cc0be395..2ff992fcc 100644 --- a/tests/ui/stutter.stderr +++ b/tests/ui/stutter.stderr @@ -1,33 +1,33 @@ error: item name starts with its containing module's name - --> $DIR/stutter.rs:8:5 - | -8 | pub fn foo_bar() {} - | ^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::stutter` implied by `-D warnings` + --> $DIR/stutter.rs:18:5 + | +18 | pub fn foo_bar() {} + | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::stutter` implied by `-D warnings` error: item name ends with its containing module's name - --> $DIR/stutter.rs:9:5 - | -9 | pub fn bar_foo() {} - | ^^^^^^^^^^^^^^^^^^^ - -error: item name starts with its containing module's name - --> $DIR/stutter.rs:10:5 + --> $DIR/stutter.rs:19:5 | -10 | pub struct FooCake {} - | ^^^^^^^^^^^^^^^^^^^^^ - -error: item name ends with its containing module's name - --> $DIR/stutter.rs:11:5 - | -11 | pub enum CakeFoo {} +19 | pub fn bar_foo() {} | ^^^^^^^^^^^^^^^^^^^ error: item name starts with its containing module's name - --> $DIR/stutter.rs:12:5 + --> $DIR/stutter.rs:20:5 | -12 | pub struct Foo7Bar; +20 | pub struct FooCake {} + | ^^^^^^^^^^^^^^^^^^^^^ + +error: item name ends with its containing module's name + --> $DIR/stutter.rs:21:5 + | +21 | pub enum CakeFoo {} + | ^^^^^^^^^^^^^^^^^^^ + +error: item name starts with its containing module's name + --> $DIR/stutter.rs:22:5 + | +22 | pub struct Foo7Bar; | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/suspicious_arithmetic_impl.rs b/tests/ui/suspicious_arithmetic_impl.rs index 04e235c69..a183576b4 100644 --- a/tests/ui/suspicious_arithmetic_impl.rs +++ b/tests/ui/suspicious_arithmetic_impl.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/suspicious_arithmetic_impl.stderr b/tests/ui/suspicious_arithmetic_impl.stderr index 0f396c3a5..64070cce3 100644 --- a/tests/ui/suspicious_arithmetic_impl.stderr +++ b/tests/ui/suspicious_arithmetic_impl.stderr @@ -1,15 +1,15 @@ error: Suspicious use of binary operator in `Add` impl - --> $DIR/suspicious_arithmetic_impl.rs:14:20 + --> $DIR/suspicious_arithmetic_impl.rs:24:20 | -14 | Foo(self.0 - other.0) +24 | Foo(self.0 - other.0) | ^ | = note: `-D clippy::suspicious-arithmetic-impl` implied by `-D warnings` error: Suspicious use of binary operator in `AddAssign` impl - --> $DIR/suspicious_arithmetic_impl.rs:20:23 + --> $DIR/suspicious_arithmetic_impl.rs:30:23 | -20 | *self = *self - other; +30 | *self = *self - other; | ^ | = note: #[deny(clippy::suspicious_op_assign_impl)] on by default diff --git a/tests/ui/swap.rs b/tests/ui/swap.rs index 377319e8f..bef2031f8 100644 --- a/tests/ui/swap.rs +++ b/tests/ui/swap.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/swap.stderr b/tests/ui/swap.stderr index 67d4fd8a1..7a4fbdad7 100644 --- a/tests/ui/swap.stderr +++ b/tests/ui/swap.stderr @@ -1,66 +1,66 @@ error: this looks like you are swapping elements of `foo` manually - --> $DIR/swap.rs:11:5 + --> $DIR/swap.rs:21:5 | -11 | / let temp = foo[0]; -12 | | foo[0] = foo[1]; -13 | | foo[1] = temp; +21 | / let temp = foo[0]; +22 | | foo[0] = foo[1]; +23 | | foo[1] = temp; | |_________________^ help: try: `foo.swap(0, 1)` | = note: `-D clippy::manual-swap` implied by `-D warnings` error: this looks like you are swapping elements of `foo` manually - --> $DIR/swap.rs:20:5 + --> $DIR/swap.rs:30:5 | -20 | / let temp = foo[0]; -21 | | foo[0] = foo[1]; -22 | | foo[1] = temp; +30 | / let temp = foo[0]; +31 | | foo[0] = foo[1]; +32 | | foo[1] = temp; | |_________________^ help: try: `foo.swap(0, 1)` error: this looks like you are swapping elements of `foo` manually - --> $DIR/swap.rs:29:5 + --> $DIR/swap.rs:39:5 | -29 | / let temp = foo[0]; -30 | | foo[0] = foo[1]; -31 | | foo[1] = temp; +39 | / let temp = foo[0]; +40 | | foo[0] = foo[1]; +41 | | foo[1] = temp; | |_________________^ help: try: `foo.swap(0, 1)` error: this looks like you are swapping `a` and `b` manually - --> $DIR/swap.rs:47:7 + --> $DIR/swap.rs:57:7 | -47 | ; let t = a; +57 | ; let t = a; | _______^ -48 | | a = b; -49 | | b = t; +58 | | a = b; +59 | | b = t; | |_________^ help: try: `std::mem::swap(&mut a, &mut b)` | = note: or maybe you should use `std::mem::replace`? error: this looks like you are swapping `c.0` and `a` manually - --> $DIR/swap.rs:56:7 + --> $DIR/swap.rs:66:7 | -56 | ; let t = c.0; +66 | ; let t = c.0; | _______^ -57 | | c.0 = a; -58 | | a = t; +67 | | c.0 = a; +68 | | a = t; | |_________^ help: try: `std::mem::swap(&mut c.0, &mut a)` | = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `a` and `b` - --> $DIR/swap.rs:44:5 + --> $DIR/swap.rs:54:5 | -44 | / a = b; -45 | | b = a; +54 | / a = b; +55 | | b = a; | |_________^ help: try: `std::mem::swap(&mut a, &mut b)` | = note: `-D clippy::almost-swapped` implied by `-D warnings` = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `c.0` and `a` - --> $DIR/swap.rs:53:5 + --> $DIR/swap.rs:63:5 | -53 | / c.0 = a; -54 | | a = c.0; +63 | / c.0 = a; +64 | | a = c.0; | |___________^ help: try: `std::mem::swap(&mut c.0, &mut a)` | = note: or maybe you should use `std::mem::replace`? diff --git a/tests/ui/temporary_assignment.rs b/tests/ui/temporary_assignment.rs index 1d0cffcfc..cf92f9fd6 100644 --- a/tests/ui/temporary_assignment.rs +++ b/tests/ui/temporary_assignment.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/temporary_assignment.stderr b/tests/ui/temporary_assignment.stderr index 38379d8bd..17b1ca125 100644 --- a/tests/ui/temporary_assignment.stderr +++ b/tests/ui/temporary_assignment.stderr @@ -1,15 +1,15 @@ error: assignment to temporary - --> $DIR/temporary_assignment.rs:29:5 + --> $DIR/temporary_assignment.rs:39:5 | -29 | Struct { field: 0 }.field = 1; +39 | Struct { field: 0 }.field = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::temporary-assignment` implied by `-D warnings` error: assignment to temporary - --> $DIR/temporary_assignment.rs:30:5 + --> $DIR/temporary_assignment.rs:40:5 | -30 | (0, 0).0 = 1; +40 | (0, 0).0 = 1; | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/toplevel_ref_arg.rs b/tests/ui/toplevel_ref_arg.rs index 86eb7fa55..9f92d706a 100644 --- a/tests/ui/toplevel_ref_arg.rs +++ b/tests/ui/toplevel_ref_arg.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/toplevel_ref_arg.stderr b/tests/ui/toplevel_ref_arg.stderr index f3fe563f2..edde5510e 100644 --- a/tests/ui/toplevel_ref_arg.stderr +++ b/tests/ui/toplevel_ref_arg.stderr @@ -1,33 +1,33 @@ error: `ref` directly on a function argument is ignored. Consider using a reference type instead. - --> $DIR/toplevel_ref_arg.rs:7:15 - | -7 | fn the_answer(ref mut x: u8) { - | ^^^^^^^^^ - | - = note: `-D clippy::toplevel-ref-arg` implied by `-D warnings` + --> $DIR/toplevel_ref_arg.rs:17:15 + | +17 | fn the_answer(ref mut x: u8) { + | ^^^^^^^^^ + | + = note: `-D clippy::toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> $DIR/toplevel_ref_arg.rs:18:7 + --> $DIR/toplevel_ref_arg.rs:28:7 | -18 | let ref x = 1; +28 | let ref x = 1; | ----^^^^^----- help: try: `let x = &1;` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> $DIR/toplevel_ref_arg.rs:20:7 + --> $DIR/toplevel_ref_arg.rs:30:7 | -20 | let ref y: (&_, u8) = (&1, 2); +30 | let ref y: (&_, u8) = (&1, 2); | ----^^^^^--------------------- help: try: `let y: &(&_, u8) = &(&1, 2);` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> $DIR/toplevel_ref_arg.rs:22:7 + --> $DIR/toplevel_ref_arg.rs:32:7 | -22 | let ref z = 1 + 2; +32 | let ref z = 1 + 2; | ----^^^^^--------- help: try: `let z = &(1 + 2);` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> $DIR/toplevel_ref_arg.rs:24:7 + --> $DIR/toplevel_ref_arg.rs:34:7 | -24 | let ref mut z = 1 + 2; +34 | let ref mut z = 1 + 2; | ----^^^^^^^^^--------- help: try: `let z = &mut (1 + 2);` error: aborting due to 5 previous errors diff --git a/tests/ui/trailing_zeros.rs b/tests/ui/trailing_zeros.rs index 58c04d292..7ed076225 100644 --- a/tests/ui/trailing_zeros.rs +++ b/tests/ui/trailing_zeros.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(stmt_expr_attributes)] #![allow(unused_parens)] diff --git a/tests/ui/trailing_zeros.stderr b/tests/ui/trailing_zeros.stderr index 477f42c28..4dbb82b34 100644 --- a/tests/ui/trailing_zeros.stderr +++ b/tests/ui/trailing_zeros.stderr @@ -1,16 +1,16 @@ error: bit mask could be simplified with a call to `trailing_zeros` - --> $DIR/trailing_zeros.rs:7:31 - | -7 | let _ = #[clippy::author] (x & 0b1111 == 0); // suggest trailing_zeros - | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 4` - | - = note: `-D clippy::verbose-bit-mask` implied by `-D warnings` + --> $DIR/trailing_zeros.rs:17:31 + | +17 | let _ = #[clippy::author] (x & 0b1111 == 0); // suggest trailing_zeros + | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 4` + | + = note: `-D clippy::verbose-bit-mask` implied by `-D warnings` error: bit mask could be simplified with a call to `trailing_zeros` - --> $DIR/trailing_zeros.rs:8:13 - | -8 | let _ = x & 0b1_1111 == 0; // suggest trailing_zeros - | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 5` + --> $DIR/trailing_zeros.rs:18:13 + | +18 | let _ = x & 0b1_1111 == 0; // suggest trailing_zeros + | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 5` error: aborting due to 2 previous errors diff --git a/tests/ui/transmute.rs b/tests/ui/transmute.rs index 34d50da11..4108750ac 100644 --- a/tests/ui/transmute.rs +++ b/tests/ui/transmute.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/transmute.stderr b/tests/ui/transmute.stderr index 4340c16b9..bde43da49 100644 --- a/tests/ui/transmute.stderr +++ b/tests/ui/transmute.stderr @@ -1,245 +1,245 @@ error: transmute from a type (`&'a T`) to itself - --> $DIR/transmute.rs:22:20 + --> $DIR/transmute.rs:32:20 | -22 | let _: &'a T = core::intrinsics::transmute(t); +32 | let _: &'a T = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::useless-transmute` implied by `-D warnings` error: transmute from a reference to a pointer - --> $DIR/transmute.rs:26:23 + --> $DIR/transmute.rs:36:23 | -26 | let _: *const T = core::intrinsics::transmute(t); +36 | let _: *const T = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T` error: transmute from a reference to a pointer - --> $DIR/transmute.rs:28:21 + --> $DIR/transmute.rs:38:21 | -28 | let _: *mut T = core::intrinsics::transmute(t); +38 | let _: *mut T = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *mut T` error: transmute from a reference to a pointer - --> $DIR/transmute.rs:30:23 + --> $DIR/transmute.rs:40:23 | -30 | let _: *const U = core::intrinsics::transmute(t); +40 | let _: *const U = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *const U` error: transmute from a pointer type (`*const T`) to a reference type (`&T`) - --> $DIR/transmute.rs:35:17 + --> $DIR/transmute.rs:45:17 | -35 | let _: &T = std::mem::transmute(p); +45 | let _: &T = std::mem::transmute(p); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p` | = note: `-D clippy::transmute-ptr-to-ref` implied by `-D warnings` error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) - --> $DIR/transmute.rs:38:21 + --> $DIR/transmute.rs:48:21 | -38 | let _: &mut T = std::mem::transmute(m); +48 | let _: &mut T = std::mem::transmute(m); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *m` error: transmute from a pointer type (`*mut T`) to a reference type (`&T`) - --> $DIR/transmute.rs:41:17 + --> $DIR/transmute.rs:51:17 | -41 | let _: &T = std::mem::transmute(m); +51 | let _: &T = std::mem::transmute(m); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*m` error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) - --> $DIR/transmute.rs:44:21 + --> $DIR/transmute.rs:54:21 | -44 | let _: &mut T = std::mem::transmute(p as *mut T); +54 | let _: &mut T = std::mem::transmute(p as *mut T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(p as *mut T)` error: transmute from a pointer type (`*const U`) to a reference type (`&T`) - --> $DIR/transmute.rs:47:17 + --> $DIR/transmute.rs:57:17 | -47 | let _: &T = std::mem::transmute(o); +57 | let _: &T = std::mem::transmute(o); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(o as *const T)` error: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`) - --> $DIR/transmute.rs:50:21 + --> $DIR/transmute.rs:60:21 | -50 | let _: &mut T = std::mem::transmute(om); +60 | let _: &mut T = std::mem::transmute(om); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(om as *mut T)` error: transmute from a pointer type (`*mut U`) to a reference type (`&T`) - --> $DIR/transmute.rs:53:17 + --> $DIR/transmute.rs:63:17 | -53 | let _: &T = std::mem::transmute(om); +63 | let _: &T = std::mem::transmute(om); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)` error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`) - --> $DIR/transmute.rs:64:32 + --> $DIR/transmute.rs:74:32 | -64 | let _: &Foo = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) }; +74 | let _: &Foo = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const Foo<_>)` error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`) - --> $DIR/transmute.rs:66:33 + --> $DIR/transmute.rs:76:33 | -66 | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) }; +76 | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const Foo<&_>)` error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`) - --> $DIR/transmute.rs:70:14 + --> $DIR/transmute.rs:80:14 | -70 | unsafe { std::mem::transmute::<_, Bar>(raw) }; +80 | unsafe { std::mem::transmute::<_, Bar>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)` error: transmute from a type (`std::vec::Vec`) to itself - --> $DIR/transmute.rs:76:27 + --> $DIR/transmute.rs:86:27 | -76 | let _: Vec = core::intrinsics::transmute(my_vec()); +86 | let _: Vec = core::intrinsics::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`std::vec::Vec`) to itself - --> $DIR/transmute.rs:78:27 + --> $DIR/transmute.rs:88:27 | -78 | let _: Vec = core::mem::transmute(my_vec()); +88 | let _: Vec = core::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`std::vec::Vec`) to itself - --> $DIR/transmute.rs:80:27 + --> $DIR/transmute.rs:90:27 | -80 | let _: Vec = std::intrinsics::transmute(my_vec()); +90 | let _: Vec = std::intrinsics::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`std::vec::Vec`) to itself - --> $DIR/transmute.rs:82:27 + --> $DIR/transmute.rs:92:27 | -82 | let _: Vec = std::mem::transmute(my_vec()); +92 | let _: Vec = std::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`std::vec::Vec`) to itself - --> $DIR/transmute.rs:84:27 + --> $DIR/transmute.rs:94:27 | -84 | let _: Vec = my_transmute(my_vec()); +94 | let _: Vec = my_transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^ error: transmute from an integer to a pointer - --> $DIR/transmute.rs:92:31 - | -92 | let _: *const usize = std::mem::transmute(5_isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `5_isize as *const usize` + --> $DIR/transmute.rs:102:31 + | +102 | let _: *const usize = std::mem::transmute(5_isize); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `5_isize as *const usize` error: transmute from an integer to a pointer - --> $DIR/transmute.rs:96:31 - | -96 | let _: *const usize = std::mem::transmute(1+1usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(1+1usize) as *const usize` + --> $DIR/transmute.rs:106:31 + | +106 | let _: *const usize = std::mem::transmute(1+1usize); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(1+1usize) as *const usize` error: transmute from a type (`*const Usize`) to the type that it points to (`Usize`) - --> $DIR/transmute.rs:111:24 + --> $DIR/transmute.rs:121:24 | -111 | let _: Usize = core::intrinsics::transmute(int_const_ptr); +121 | let _: Usize = core::intrinsics::transmute(int_const_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::crosspointer-transmute` implied by `-D warnings` error: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`) - --> $DIR/transmute.rs:113:24 + --> $DIR/transmute.rs:123:24 | -113 | let _: Usize = core::intrinsics::transmute(int_mut_ptr); +123 | let _: Usize = core::intrinsics::transmute(int_mut_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`Usize`) to a pointer to that type (`*const Usize`) - --> $DIR/transmute.rs:115:31 + --> $DIR/transmute.rs:125:31 | -115 | let _: *const Usize = core::intrinsics::transmute(my_int()); +125 | let _: *const Usize = core::intrinsics::transmute(my_int()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`) - --> $DIR/transmute.rs:117:29 + --> $DIR/transmute.rs:127:29 | -117 | let _: *mut Usize = core::intrinsics::transmute(my_int()); +127 | let _: *mut Usize = core::intrinsics::transmute(my_int()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a `u32` to a `char` - --> $DIR/transmute.rs:123:28 + --> $DIR/transmute.rs:133:28 | -123 | let _: char = unsafe { std::mem::transmute(0_u32) }; +133 | let _: char = unsafe { std::mem::transmute(0_u32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_u32).unwrap()` | = note: `-D clippy::transmute-int-to-char` implied by `-D warnings` error: transmute from a `i32` to a `char` - --> $DIR/transmute.rs:124:28 + --> $DIR/transmute.rs:134:28 | -124 | let _: char = unsafe { std::mem::transmute(0_i32) }; +134 | let _: char = unsafe { std::mem::transmute(0_i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_i32 as u32).unwrap()` error: transmute from a `u8` to a `bool` - --> $DIR/transmute.rs:129:28 + --> $DIR/transmute.rs:139:28 | -129 | let _: bool = unsafe { std::mem::transmute(0_u8) }; +139 | let _: bool = unsafe { std::mem::transmute(0_u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `0_u8 != 0` | = note: `-D clippy::transmute-int-to-bool` implied by `-D warnings` error: transmute from a `u32` to a `f32` - --> $DIR/transmute.rs:134:27 + --> $DIR/transmute.rs:144:27 | -134 | let _: f32 = unsafe { std::mem::transmute(0_u32) }; +144 | let _: f32 = unsafe { std::mem::transmute(0_u32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_u32)` | = note: `-D clippy::transmute-int-to-float` implied by `-D warnings` error: transmute from a `i32` to a `f32` - --> $DIR/transmute.rs:135:27 + --> $DIR/transmute.rs:145:27 | -135 | let _: f32 = unsafe { std::mem::transmute(0_i32) }; +145 | let _: f32 = unsafe { std::mem::transmute(0_i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_i32 as u32)` error: transmute from a `&[u8]` to a `&str` - --> $DIR/transmute.rs:139:28 + --> $DIR/transmute.rs:149:28 | -139 | let _: &str = unsafe { std::mem::transmute(b) }; +149 | let _: &str = unsafe { std::mem::transmute(b) }; | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(b).unwrap()` | = note: `-D clippy::transmute-bytes-to-str` implied by `-D warnings` error: transmute from a `&mut [u8]` to a `&mut str` - --> $DIR/transmute.rs:140:32 + --> $DIR/transmute.rs:150:32 | -140 | let _: &mut str = unsafe { std::mem::transmute(mb) }; +150 | let _: &mut str = unsafe { std::mem::transmute(mb) }; | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()` error: transmute from a pointer to a pointer - --> $DIR/transmute.rs:172:29 + --> $DIR/transmute.rs:182:29 | -172 | let _: *const f32 = std::mem::transmute(ptr); +182 | let _: *const f32 = std::mem::transmute(ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr as *const f32` | = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings` error: transmute from a pointer to a pointer - --> $DIR/transmute.rs:173:27 + --> $DIR/transmute.rs:183:27 | -173 | let _: *mut f32 = std::mem::transmute(mut_ptr); +183 | let _: *mut f32 = std::mem::transmute(mut_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `mut_ptr as *mut f32` error: transmute from a reference to a reference - --> $DIR/transmute.rs:175:23 + --> $DIR/transmute.rs:185:23 | -175 | let _: &f32 = std::mem::transmute(&1u32); +185 | let _: &f32 = std::mem::transmute(&1u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1u32 as *const u32 as *const f32)` error: transmute from a reference to a reference - --> $DIR/transmute.rs:176:23 + --> $DIR/transmute.rs:186:23 | -176 | let _: &f64 = std::mem::transmute(&1f32); +186 | let _: &f64 = std::mem::transmute(&1f32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1f32 as *const f32 as *const f64)` error: transmute from a reference to a reference - --> $DIR/transmute.rs:179:27 + --> $DIR/transmute.rs:189:27 | -179 | let _: &mut f32 = std::mem::transmute(&mut 1u32); +189 | let _: &mut f32 = std::mem::transmute(&mut 1u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(&mut 1u32 as *mut u32 as *mut f32)` error: transmute from a reference to a reference - --> $DIR/transmute.rs:180:37 + --> $DIR/transmute.rs:190:37 | -180 | let _: &GenericParam = std::mem::transmute(&GenericParam { t: 1u32 }); +190 | let _: &GenericParam = std::mem::transmute(&GenericParam { t: 1u32 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam as *const GenericParam)` error: aborting due to 38 previous errors diff --git a/tests/ui/transmute_32bit.rs b/tests/ui/transmute_32bit.rs index 08866c63e..59d3d82cc 100644 --- a/tests/ui/transmute_32bit.rs +++ b/tests/ui/transmute_32bit.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + //ignore-x86_64 diff --git a/tests/ui/transmute_64bit.rs b/tests/ui/transmute_64bit.rs index 539b403cf..630b594eb 100644 --- a/tests/ui/transmute_64bit.rs +++ b/tests/ui/transmute_64bit.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] //ignore-x86 diff --git a/tests/ui/transmute_64bit.stderr b/tests/ui/transmute_64bit.stderr index e86908655..dcc6d264c 100644 --- a/tests/ui/transmute_64bit.stderr +++ b/tests/ui/transmute_64bit.stderr @@ -1,15 +1,15 @@ error: transmute from a `f64` to a pointer - --> $DIR/transmute_64bit.rs:11:31 + --> $DIR/transmute_64bit.rs:21:31 | -11 | let _: *const usize = std::mem::transmute(6.0f64); +21 | let _: *const usize = std::mem::transmute(6.0f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::wrong-transmute` implied by `-D warnings` error: transmute from a `f64` to a pointer - --> $DIR/transmute_64bit.rs:13:29 + --> $DIR/transmute_64bit.rs:23:29 | -13 | let _: *mut usize = std::mem::transmute(6.0f64); +23 | let _: *mut usize = std::mem::transmute(6.0f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/trivially_copy_pass_by_ref.rs b/tests/ui/trivially_copy_pass_by_ref.rs index e3dbe510a..716e0dc64 100644 --- a/tests/ui/trivially_copy_pass_by_ref.rs +++ b/tests/ui/trivially_copy_pass_by_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::many_single_char_names, clippy::blacklisted_name, clippy::redundant_field_names)] diff --git a/tests/ui/trivially_copy_pass_by_ref.stderr b/tests/ui/trivially_copy_pass_by_ref.stderr index 2db627dd9..2026d4c00 100644 --- a/tests/ui/trivially_copy_pass_by_ref.stderr +++ b/tests/ui/trivially_copy_pass_by_ref.stderr @@ -1,81 +1,81 @@ error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:42:11 + --> $DIR/trivially_copy_pass_by_ref.rs:52:11 | -42 | fn bad(x: &u32, y: &Foo, z: &Baz) { +52 | fn bad(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `u32` | = note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:42:20 + --> $DIR/trivially_copy_pass_by_ref.rs:52:20 | -42 | fn bad(x: &u32, y: &Foo, z: &Baz) { +52 | fn bad(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Foo` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:42:29 + --> $DIR/trivially_copy_pass_by_ref.rs:52:29 | -42 | fn bad(x: &u32, y: &Foo, z: &Baz) { +52 | fn bad(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Baz` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:52:12 + --> $DIR/trivially_copy_pass_by_ref.rs:62:12 | -52 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { +62 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { | ^^^^^ help: consider passing by value instead: `self` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:52:22 + --> $DIR/trivially_copy_pass_by_ref.rs:62:22 | -52 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { +62 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `u32` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:52:31 + --> $DIR/trivially_copy_pass_by_ref.rs:62:31 | -52 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { +62 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Foo` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:52:40 + --> $DIR/trivially_copy_pass_by_ref.rs:62:40 | -52 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { +62 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Baz` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:55:16 + --> $DIR/trivially_copy_pass_by_ref.rs:65:16 | -55 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +65 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `u32` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:55:25 + --> $DIR/trivially_copy_pass_by_ref.rs:65:25 | -55 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +65 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Foo` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:55:34 + --> $DIR/trivially_copy_pass_by_ref.rs:65:34 | -55 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +65 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Baz` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:69:16 + --> $DIR/trivially_copy_pass_by_ref.rs:79:16 | -69 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +79 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `u32` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:69:25 + --> $DIR/trivially_copy_pass_by_ref.rs:79:25 | -69 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +79 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Foo` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:69:34 + --> $DIR/trivially_copy_pass_by_ref.rs:79:34 | -69 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +79 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Baz` error: aborting due to 13 previous errors diff --git a/tests/ui/ty_fn_sig.rs b/tests/ui/ty_fn_sig.rs index 9e2753dcb..82b5deda3 100644 --- a/tests/ui/ty_fn_sig.rs +++ b/tests/ui/ty_fn_sig.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // Regression test pub fn retry(f: F) { diff --git a/tests/ui/types.rs b/tests/ui/types.rs index 10d1c490e..03676f69a 100644 --- a/tests/ui/types.rs +++ b/tests/ui/types.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + // should not warn on lossy casting in constant types // because not supported yet const C : i32 = 42; diff --git a/tests/ui/types.stderr b/tests/ui/types.stderr index e2f751628..0940cd53b 100644 --- a/tests/ui/types.stderr +++ b/tests/ui/types.stderr @@ -1,10 +1,10 @@ error: casting i32 to i64 may become silently lossy if types change - --> $DIR/types.rs:9:23 - | -9 | let c_i64 : i64 = c as i64; - | ^^^^^^^^ help: try: `i64::from(c)` - | - = note: `-D clippy::cast-lossless` implied by `-D warnings` + --> $DIR/types.rs:19:23 + | +19 | let c_i64 : i64 = c as i64; + | ^^^^^^^^ help: try: `i64::from(c)` + | + = note: `-D clippy::cast-lossless` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/unicode.rs b/tests/ui/unicode.rs index b997d6d3f..486135ddf 100644 --- a/tests/ui/unicode.rs +++ b/tests/ui/unicode.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/unicode.stderr b/tests/ui/unicode.stderr index b0e567fc2..8de848cae 100644 --- a/tests/ui/unicode.stderr +++ b/tests/ui/unicode.stderr @@ -1,17 +1,17 @@ error: zero-width space detected - --> $DIR/unicode.rs:6:12 - | -6 | print!("Here >​< is a ZWS, and ​another"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::zero-width-space` implied by `-D warnings` - = help: Consider replacing the string with: - ""Here >/u{200B}< is a ZWS, and /u{200B}another"" + --> $DIR/unicode.rs:16:12 + | +16 | print!("Here >​< is a ZWS, and ​another"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::zero-width-space` implied by `-D warnings` + = help: Consider replacing the string with: + ""Here >/u{200B}< is a ZWS, and /u{200B}another"" error: non-nfc unicode sequence detected - --> $DIR/unicode.rs:12:12 + --> $DIR/unicode.rs:22:12 | -12 | print!("̀àh?"); +22 | print!("̀àh?"); | ^^^^^ | = note: `-D clippy::unicode-not-nfc` implied by `-D warnings` @@ -19,9 +19,9 @@ error: non-nfc unicode sequence detected ""̀àh?"" error: literal non-ASCII character detected - --> $DIR/unicode.rs:18:12 + --> $DIR/unicode.rs:28:12 | -18 | print!("Üben!"); +28 | print!("Üben!"); | ^^^^^^^ | = note: `-D clippy::non-ascii-literal` implied by `-D warnings` diff --git a/tests/ui/unit_arg.rs b/tests/ui/unit_arg.rs index 2f743f227..ed70ee843 100644 --- a/tests/ui/unit_arg.rs +++ b/tests/ui/unit_arg.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::unit_arg)] diff --git a/tests/ui/unit_arg.stderr b/tests/ui/unit_arg.stderr index e1845c0c0..6e5cf8354 100644 --- a/tests/ui/unit_arg.stderr +++ b/tests/ui/unit_arg.stderr @@ -1,67 +1,67 @@ error: passing a unit value to a function - --> $DIR/unit_arg.rs:25:9 + --> $DIR/unit_arg.rs:35:9 | -25 | foo({}); +35 | foo({}); | ^^ | = note: `-D clippy::unit-arg` implied by `-D warnings` help: if you intended to pass a unit value, use a unit literal instead | -25 | foo(()); +35 | foo(()); | ^^ error: passing a unit value to a function - --> $DIR/unit_arg.rs:26:9 + --> $DIR/unit_arg.rs:36:9 | -26 | foo({ 1; }); +36 | foo({ 1; }); | ^^^^^^ help: if you intended to pass a unit value, use a unit literal instead | -26 | foo(()); +36 | foo(()); | ^^ error: passing a unit value to a function - --> $DIR/unit_arg.rs:27:9 + --> $DIR/unit_arg.rs:37:9 | -27 | foo(foo(1)); +37 | foo(foo(1)); | ^^^^^^ help: if you intended to pass a unit value, use a unit literal instead | -27 | foo(()); +37 | foo(()); | ^^ error: passing a unit value to a function - --> $DIR/unit_arg.rs:28:9 + --> $DIR/unit_arg.rs:38:9 | -28 | foo({ +38 | foo({ | _________^ -29 | | foo(1); -30 | | foo(2); -31 | | }); +39 | | foo(1); +40 | | foo(2); +41 | | }); | |_____^ help: if you intended to pass a unit value, use a unit literal instead | -28 | foo(()); +38 | foo(()); | ^^ error: passing a unit value to a function - --> $DIR/unit_arg.rs:32:10 + --> $DIR/unit_arg.rs:42:10 | -32 | foo3({}, 2, 2); +42 | foo3({}, 2, 2); | ^^ help: if you intended to pass a unit value, use a unit literal instead | -32 | foo3((), 2, 2); +42 | foo3((), 2, 2); | ^^ error: passing a unit value to a function - --> $DIR/unit_arg.rs:34:11 + --> $DIR/unit_arg.rs:44:11 | -34 | b.bar({ 1; }); +44 | b.bar({ 1; }); | ^^^^^^ help: if you intended to pass a unit value, use a unit literal instead | -34 | b.bar(()); +44 | b.bar(()); | ^^ error: aborting due to 6 previous errors diff --git a/tests/ui/unit_cmp.rs b/tests/ui/unit_cmp.rs index bd79d0f81..e8726bf73 100644 --- a/tests/ui/unit_cmp.rs +++ b/tests/ui/unit_cmp.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/unit_cmp.stderr b/tests/ui/unit_cmp.stderr index a85eb3284..bd9ac25a6 100644 --- a/tests/ui/unit_cmp.stderr +++ b/tests/ui/unit_cmp.stderr @@ -1,15 +1,15 @@ error: ==-comparison of unit values detected. This will always be true - --> $DIR/unit_cmp.rs:16:8 + --> $DIR/unit_cmp.rs:26:8 | -16 | if { true; } == { false; } { +26 | if { true; } == { false; } { | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unit-cmp` implied by `-D warnings` error: >-comparison of unit values detected. This will always be false - --> $DIR/unit_cmp.rs:19:8 + --> $DIR/unit_cmp.rs:29:8 | -19 | if { true; } > { false; } { +29 | if { true; } > { false; } { | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/unnecessary_clone.rs b/tests/ui/unnecessary_clone.rs index 7a2fc4ac1..82010db7a 100644 --- a/tests/ui/unnecessary_clone.rs +++ b/tests/ui/unnecessary_clone.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::clone_on_ref_ptr)] diff --git a/tests/ui/unnecessary_clone.stderr b/tests/ui/unnecessary_clone.stderr index b2985f84b..051fc1fcd 100644 --- a/tests/ui/unnecessary_clone.stderr +++ b/tests/ui/unnecessary_clone.stderr @@ -1,81 +1,81 @@ error: using `clone` on a `Copy` type - --> $DIR/unnecessary_clone.rs:18:5 + --> $DIR/unnecessary_clone.rs:28:5 | -18 | 42.clone(); +28 | 42.clone(); | ^^^^^^^^^^ help: try removing the `clone` call: `42` | = note: `-D clippy::clone-on-copy` implied by `-D warnings` error: using `clone` on a `Copy` type - --> $DIR/unnecessary_clone.rs:22:5 + --> $DIR/unnecessary_clone.rs:32:5 | -22 | (&42).clone(); +32 | (&42).clone(); | ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:32:5 + --> $DIR/unnecessary_clone.rs:42:5 | -32 | rc.clone(); +42 | rc.clone(); | ^^^^^^^^^^ help: try this: `Rc::::clone(&rc)` | = note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:35:5 + --> $DIR/unnecessary_clone.rs:45:5 | -35 | arc.clone(); +45 | arc.clone(); | ^^^^^^^^^^^ help: try this: `Arc::::clone(&arc)` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:38:5 + --> $DIR/unnecessary_clone.rs:48:5 | -38 | rcweak.clone(); +48 | rcweak.clone(); | ^^^^^^^^^^^^^^ help: try this: `Weak::::clone(&rcweak)` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:41:5 + --> $DIR/unnecessary_clone.rs:51:5 | -41 | arc_weak.clone(); +51 | arc_weak.clone(); | ^^^^^^^^^^^^^^^^ help: try this: `Weak::::clone(&arc_weak)` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:45:29 + --> $DIR/unnecessary_clone.rs:55:29 | -45 | let _: Arc = x.clone(); +55 | let _: Arc = x.clone(); | ^^^^^^^^^ help: try this: `Arc::::clone(&x)` error: using `clone` on a `Copy` type - --> $DIR/unnecessary_clone.rs:49:5 + --> $DIR/unnecessary_clone.rs:59:5 | -49 | t.clone(); +59 | t.clone(); | ^^^^^^^^^ help: try removing the `clone` call: `t` error: using `clone` on a `Copy` type - --> $DIR/unnecessary_clone.rs:51:5 + --> $DIR/unnecessary_clone.rs:61:5 | -51 | Some(t).clone(); +61 | Some(t).clone(); | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)` error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type - --> $DIR/unnecessary_clone.rs:57:22 + --> $DIR/unnecessary_clone.rs:67:22 | -57 | let z: &Vec<_> = y.clone(); +67 | let z: &Vec<_> = y.clone(); | ^^^^^^^^^ | = note: #[deny(clippy::clone_double_ref)] on by default help: try dereferencing it | -57 | let z: &Vec<_> = &(*y).clone(); +67 | let z: &Vec<_> = &(*y).clone(); | ^^^^^^^^^^^^^ help: or try being explicit about what type to clone | -57 | let z: &Vec<_> = &std::vec::Vec::clone(y); +67 | let z: &Vec<_> = &std::vec::Vec::clone(y); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable - --> $DIR/unnecessary_clone.rs:64:27 + --> $DIR/unnecessary_clone.rs:74:27 | -64 | let v2 : Vec = v.iter().cloned().collect(); +74 | let v2 : Vec = v.iter().cloned().collect(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-cloned-collect` implied by `-D warnings` diff --git a/tests/ui/unnecessary_filter_map.rs b/tests/ui/unnecessary_filter_map.rs index dd6cdc5d3..8b74ca3a4 100644 --- a/tests/ui/unnecessary_filter_map.rs +++ b/tests/ui/unnecessary_filter_map.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + fn main() { let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None }); let _ = (0..4).filter_map(|x| { if x > 1 { return Some(x); }; None }); diff --git a/tests/ui/unnecessary_filter_map.stderr b/tests/ui/unnecessary_filter_map.stderr index 045802047..8fef60681 100644 --- a/tests/ui/unnecessary_filter_map.stderr +++ b/tests/ui/unnecessary_filter_map.stderr @@ -1,32 +1,32 @@ error: this `.filter_map` can be written more simply using `.filter` - --> $DIR/unnecessary_filter_map.rs:2:13 - | -2 | let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::unnecessary-filter-map` implied by `-D warnings` + --> $DIR/unnecessary_filter_map.rs:12:13 + | +12 | let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::unnecessary-filter-map` implied by `-D warnings` error: this `.filter_map` can be written more simply using `.filter` - --> $DIR/unnecessary_filter_map.rs:3:13 - | -3 | let _ = (0..4).filter_map(|x| { if x > 1 { return Some(x); }; None }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $DIR/unnecessary_filter_map.rs:13:13 + | +13 | let _ = (0..4).filter_map(|x| { if x > 1 { return Some(x); }; None }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this `.filter_map` can be written more simply using `.filter` - --> $DIR/unnecessary_filter_map.rs:4:13 - | -4 | let _ = (0..4).filter_map(|x| match x { - | _____________^ -5 | | 0 | 1 => None, -6 | | _ => Some(x), -7 | | }); - | |______^ + --> $DIR/unnecessary_filter_map.rs:14:13 + | +14 | let _ = (0..4).filter_map(|x| match x { + | _____________^ +15 | | 0 | 1 => None, +16 | | _ => Some(x), +17 | | }); + | |______^ error: this `.filter_map` can be written more simply using `.map` - --> $DIR/unnecessary_filter_map.rs:9:13 - | -9 | let _ = (0..4).filter_map(|x| Some(x + 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $DIR/unnecessary_filter_map.rs:19:13 + | +19 | let _ = (0..4).filter_map(|x| Some(x + 1)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/unnecessary_fold.rs b/tests/ui/unnecessary_fold.rs index 62198e21e..e8d84ecea 100644 --- a/tests/ui/unnecessary_fold.rs +++ b/tests/ui/unnecessary_fold.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + /// Calls which should trigger the `UNNECESSARY_FOLD` lint fn unnecessary_fold() { // Can be replaced by .any diff --git a/tests/ui/unnecessary_fold.stderr b/tests/ui/unnecessary_fold.stderr index e72f671b6..b2865479c 100644 --- a/tests/ui/unnecessary_fold.stderr +++ b/tests/ui/unnecessary_fold.stderr @@ -1,33 +1,33 @@ error: this `.fold` can be written more succinctly using another method - --> $DIR/unnecessary_fold.rs:4:19 - | -4 | let _ = (0..3).fold(false, |acc, x| acc || x > 2); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)` - | - = note: `-D clippy::unnecessary-fold` implied by `-D warnings` - -error: this `.fold` can be written more succinctly using another method - --> $DIR/unnecessary_fold.rs:6:19 - | -6 | let _ = (0..3).fold(true, |acc, x| acc && x > 2); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.all(|x| x > 2)` - -error: this `.fold` can be written more succinctly using another method - --> $DIR/unnecessary_fold.rs:8:19 - | -8 | let _ = (0..3).fold(0, |acc, x| acc + x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.sum()` - -error: this `.fold` can be written more succinctly using another method - --> $DIR/unnecessary_fold.rs:10:19 + --> $DIR/unnecessary_fold.rs:14:19 | -10 | let _ = (0..3).fold(1, |acc, x| acc * x); +14 | let _ = (0..3).fold(false, |acc, x| acc || x > 2); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)` + | + = note: `-D clippy::unnecessary-fold` implied by `-D warnings` + +error: this `.fold` can be written more succinctly using another method + --> $DIR/unnecessary_fold.rs:16:19 + | +16 | let _ = (0..3).fold(true, |acc, x| acc && x > 2); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.all(|x| x > 2)` + +error: this `.fold` can be written more succinctly using another method + --> $DIR/unnecessary_fold.rs:18:19 + | +18 | let _ = (0..3).fold(0, |acc, x| acc + x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.sum()` + +error: this `.fold` can be written more succinctly using another method + --> $DIR/unnecessary_fold.rs:20:19 + | +20 | let _ = (0..3).fold(1, |acc, x| acc * x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.product()` error: this `.fold` can be written more succinctly using another method - --> $DIR/unnecessary_fold.rs:15:34 + --> $DIR/unnecessary_fold.rs:25:34 | -15 | let _ = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2); +25 | let _ = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)` error: aborting due to 5 previous errors diff --git a/tests/ui/unnecessary_ref.rs b/tests/ui/unnecessary_ref.rs index afc920832..6fb2abaf1 100644 --- a/tests/ui/unnecessary_ref.rs +++ b/tests/ui/unnecessary_ref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![feature(tool_attributes)] diff --git a/tests/ui/unnecessary_ref.stderr b/tests/ui/unnecessary_ref.stderr index d27ba26f3..a3d8f5e33 100644 --- a/tests/ui/unnecessary_ref.stderr +++ b/tests/ui/unnecessary_ref.stderr @@ -1,13 +1,13 @@ error: Creating a reference that is immediately dereferenced. - --> $DIR/unnecessary_ref.rs:13:17 + --> $DIR/unnecessary_ref.rs:23:17 | -13 | let inner = (&outer).inner; +23 | let inner = (&outer).inner; | ^^^^^^^^ help: try this: `outer.inner` | note: lint level defined here - --> $DIR/unnecessary_ref.rs:10:8 + --> $DIR/unnecessary_ref.rs:20:8 | -10 | #[deny(clippy::ref_in_deref)] +20 | #[deny(clippy::ref_in_deref)] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/unneeded_field_pattern.rs b/tests/ui/unneeded_field_pattern.rs index 88b91235d..963d555ca 100644 --- a/tests/ui/unneeded_field_pattern.rs +++ b/tests/ui/unneeded_field_pattern.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/unneeded_field_pattern.stderr b/tests/ui/unneeded_field_pattern.stderr index 40aa4f524..85982d754 100644 --- a/tests/ui/unneeded_field_pattern.stderr +++ b/tests/ui/unneeded_field_pattern.stderr @@ -1,16 +1,16 @@ error: You matched a field with a wildcard pattern. Consider using `..` instead - --> $DIR/unneeded_field_pattern.rs:17:15 + --> $DIR/unneeded_field_pattern.rs:27:15 | -17 | Foo { a: _, b: 0, .. } => {} +27 | Foo { a: _, b: 0, .. } => {} | ^^^^ | = note: `-D clippy::unneeded-field-pattern` implied by `-D warnings` = help: Try with `Foo { b: 0, .. }` error: All the struct fields are matched to a wildcard pattern, consider using `..`. - --> $DIR/unneeded_field_pattern.rs:19:9 + --> $DIR/unneeded_field_pattern.rs:29:9 | -19 | Foo { a: _, b: _, c: _ } => {} +29 | Foo { a: _, b: _, c: _ } => {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Try with `Foo { .. }` instead diff --git a/tests/ui/unreadable_literal.rs b/tests/ui/unreadable_literal.rs index df3539e38..67e04706f 100644 --- a/tests/ui/unreadable_literal.rs +++ b/tests/ui/unreadable_literal.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #[warn(clippy::unreadable_literal)] diff --git a/tests/ui/unreadable_literal.stderr b/tests/ui/unreadable_literal.stderr index 516b6ccc5..b5ab6937d 100644 --- a/tests/ui/unreadable_literal.stderr +++ b/tests/ui/unreadable_literal.stderr @@ -1,34 +1,34 @@ error: long literal lacking separators - --> $DIR/unreadable_literal.rs:7:16 - | -7 | let bad = (0b110110_i64, 0x12345678901_usize, 123456_f32, 1.234567_f32); - | ^^^^^^^^^^^^ help: consider: `0b11_0110_i64` - | - = note: `-D clippy::unreadable-literal` implied by `-D warnings` + --> $DIR/unreadable_literal.rs:17:16 + | +17 | let bad = (0b110110_i64, 0x12345678901_usize, 123456_f32, 1.234567_f32); + | ^^^^^^^^^^^^ help: consider: `0b11_0110_i64` + | + = note: `-D clippy::unreadable-literal` implied by `-D warnings` error: long literal lacking separators - --> $DIR/unreadable_literal.rs:7:30 - | -7 | let bad = (0b110110_i64, 0x12345678901_usize, 123456_f32, 1.234567_f32); - | ^^^^^^^^^^^^^^^^^^^ help: consider: `0x0123_4567_8901_usize` + --> $DIR/unreadable_literal.rs:17:30 + | +17 | let bad = (0b110110_i64, 0x12345678901_usize, 123456_f32, 1.234567_f32); + | ^^^^^^^^^^^^^^^^^^^ help: consider: `0x0123_4567_8901_usize` error: long literal lacking separators - --> $DIR/unreadable_literal.rs:7:51 - | -7 | let bad = (0b110110_i64, 0x12345678901_usize, 123456_f32, 1.234567_f32); - | ^^^^^^^^^^ help: consider: `123_456_f32` + --> $DIR/unreadable_literal.rs:17:51 + | +17 | let bad = (0b110110_i64, 0x12345678901_usize, 123456_f32, 1.234567_f32); + | ^^^^^^^^^^ help: consider: `123_456_f32` error: long literal lacking separators - --> $DIR/unreadable_literal.rs:7:63 - | -7 | let bad = (0b110110_i64, 0x12345678901_usize, 123456_f32, 1.234567_f32); - | ^^^^^^^^^^^^ help: consider: `1.234_567_f32` + --> $DIR/unreadable_literal.rs:17:63 + | +17 | let bad = (0b110110_i64, 0x12345678901_usize, 123456_f32, 1.234567_f32); + | ^^^^^^^^^^^^ help: consider: `1.234_567_f32` error: long literal lacking separators - --> $DIR/unreadable_literal.rs:9:19 - | -9 | let bad_sci = 1.123456e1; - | ^^^^^^^^^^ help: consider: `1.123_456e1` + --> $DIR/unreadable_literal.rs:19:19 + | +19 | let bad_sci = 1.123456e1; + | ^^^^^^^^^^ help: consider: `1.123_456e1` error: aborting due to 5 previous errors diff --git a/tests/ui/unsafe_removed_from_name.rs b/tests/ui/unsafe_removed_from_name.rs index 41b98975d..39aa4afdf 100644 --- a/tests/ui/unsafe_removed_from_name.rs +++ b/tests/ui/unsafe_removed_from_name.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused_imports)] diff --git a/tests/ui/unsafe_removed_from_name.stderr b/tests/ui/unsafe_removed_from_name.stderr index 2b014ca58..f4bb93735 100644 --- a/tests/ui/unsafe_removed_from_name.stderr +++ b/tests/ui/unsafe_removed_from_name.stderr @@ -1,21 +1,21 @@ error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCell` - --> $DIR/unsafe_removed_from_name.rs:7:1 - | -7 | use std::cell::{UnsafeCell as TotallySafeCell}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::unsafe-removed-from-name` implied by `-D warnings` + --> $DIR/unsafe_removed_from_name.rs:17:1 + | +17 | use std::cell::{UnsafeCell as TotallySafeCell}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::unsafe-removed-from-name` implied by `-D warnings` error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCellAgain` - --> $DIR/unsafe_removed_from_name.rs:9:1 - | -9 | use std::cell::UnsafeCell as TotallySafeCellAgain; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $DIR/unsafe_removed_from_name.rs:19:1 + | +19 | use std::cell::UnsafeCell as TotallySafeCellAgain; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: removed "unsafe" from the name of `Unsafe` in use as `LieAboutModSafety` - --> $DIR/unsafe_removed_from_name.rs:23:1 + --> $DIR/unsafe_removed_from_name.rs:33:1 | -23 | use mod_with_some_unsafe_things::Unsafe as LieAboutModSafety; +33 | use mod_with_some_unsafe_things::Unsafe as LieAboutModSafety; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/unused_io_amount.rs b/tests/ui/unused_io_amount.rs index 53bcbce9d..0ab89c994 100644 --- a/tests/ui/unused_io_amount.rs +++ b/tests/ui/unused_io_amount.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/unused_io_amount.stderr b/tests/ui/unused_io_amount.stderr index 48a575157..329dfacd4 100644 --- a/tests/ui/unused_io_amount.stderr +++ b/tests/ui/unused_io_amount.stderr @@ -1,42 +1,42 @@ error: handle written amount returned or use `Write::write_all` instead - --> $DIR/unused_io_amount.rs:11:5 + --> $DIR/unused_io_amount.rs:21:5 | -11 | try!(s.write(b"test")); +21 | try!(s.write(b"test")); | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unused-io-amount` implied by `-D warnings` = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: handle read amount returned or use `Read::read_exact` instead - --> $DIR/unused_io_amount.rs:13:5 + --> $DIR/unused_io_amount.rs:23:5 | -13 | try!(s.read(&mut buf)); +23 | try!(s.read(&mut buf)); | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: handle written amount returned or use `Write::write_all` instead - --> $DIR/unused_io_amount.rs:18:5 + --> $DIR/unused_io_amount.rs:28:5 | -18 | s.write(b"test")?; +28 | s.write(b"test")?; | ^^^^^^^^^^^^^^^^^ error: handle read amount returned or use `Read::read_exact` instead - --> $DIR/unused_io_amount.rs:20:5 + --> $DIR/unused_io_amount.rs:30:5 | -20 | s.read(&mut buf)?; +30 | s.read(&mut buf)?; | ^^^^^^^^^^^^^^^^^ error: handle written amount returned or use `Write::write_all` instead - --> $DIR/unused_io_amount.rs:25:5 + --> $DIR/unused_io_amount.rs:35:5 | -25 | s.write(b"test").unwrap(); +35 | s.write(b"test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: handle read amount returned or use `Read::read_exact` instead - --> $DIR/unused_io_amount.rs:27:5 + --> $DIR/unused_io_amount.rs:37:5 | -27 | s.read(&mut buf).unwrap(); +37 | s.read(&mut buf).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/unused_labels.rs b/tests/ui/unused_labels.rs index b76fcad16..ecfdab490 100644 --- a/tests/ui/unused_labels.rs +++ b/tests/ui/unused_labels.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/unused_labels.stderr b/tests/ui/unused_labels.stderr index d35ca41a1..5a31ada90 100644 --- a/tests/ui/unused_labels.stderr +++ b/tests/ui/unused_labels.stderr @@ -1,25 +1,25 @@ error: unused label `'label` - --> $DIR/unused_labels.rs:8:5 + --> $DIR/unused_labels.rs:18:5 | -8 | / 'label: for i in 1..2 { -9 | | if i > 4 { continue } -10 | | } +18 | / 'label: for i in 1..2 { +19 | | if i > 4 { continue } +20 | | } | |_____^ | = note: `-D clippy::unused-label` implied by `-D warnings` error: unused label `'a` - --> $DIR/unused_labels.rs:21:5 + --> $DIR/unused_labels.rs:31:5 | -21 | 'a: loop { break } +31 | 'a: loop { break } | ^^^^^^^^^^^^^^^^^^ error: unused label `'same_label_in_two_fns` - --> $DIR/unused_labels.rs:32:5 + --> $DIR/unused_labels.rs:42:5 | -32 | / 'same_label_in_two_fns: loop { -33 | | let _ = 1; -34 | | } +42 | / 'same_label_in_two_fns: loop { +43 | | let _ = 1; +44 | | } | |_____^ error: aborting due to 3 previous errors diff --git a/tests/ui/unused_lt.rs b/tests/ui/unused_lt.rs index e5c5e8935..3aea986d2 100644 --- a/tests/ui/unused_lt.rs +++ b/tests/ui/unused_lt.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused, dead_code, clippy::needless_lifetimes, clippy::needless_pass_by_value, clippy::trivially_copy_pass_by_ref)] diff --git a/tests/ui/unused_lt.stderr b/tests/ui/unused_lt.stderr index 4cad611c2..f5b788c16 100644 --- a/tests/ui/unused_lt.stderr +++ b/tests/ui/unused_lt.stderr @@ -1,21 +1,21 @@ error: this lifetime isn't used in the function definition - --> $DIR/unused_lt.rs:16:14 + --> $DIR/unused_lt.rs:26:14 | -16 | fn unused_lt<'a>(x: u8) { +26 | fn unused_lt<'a>(x: u8) { | ^^ | = note: `-D clippy::extra-unused-lifetimes` implied by `-D warnings` error: this lifetime isn't used in the function definition - --> $DIR/unused_lt.rs:20:25 + --> $DIR/unused_lt.rs:30:25 | -20 | fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) { +30 | fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) { | ^^ error: this lifetime isn't used in the function definition - --> $DIR/unused_lt.rs:50:10 + --> $DIR/unused_lt.rs:60:10 | -50 | fn x<'a>(&self) {} +60 | fn x<'a>(&self) {} | ^^ error: aborting due to 3 previous errors diff --git a/tests/ui/unwrap_or.rs b/tests/ui/unwrap_or.rs index 682c42dc9..b31ccfea2 100644 --- a/tests/ui/unwrap_or.rs +++ b/tests/ui/unwrap_or.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all)] diff --git a/tests/ui/unwrap_or.stderr b/tests/ui/unwrap_or.stderr index 42c72090c..ffdeeb530 100644 --- a/tests/ui/unwrap_or.stderr +++ b/tests/ui/unwrap_or.stderr @@ -1,15 +1,15 @@ error: use of `unwrap_or` followed by a function call - --> $DIR/unwrap_or.rs:5:47 - | -5 | let s = Some(String::from("test string")).unwrap_or("Fail".to_string()).len(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "Fail".to_string())` - | - = note: `-D clippy::or-fun-call` implied by `-D warnings` + --> $DIR/unwrap_or.rs:15:47 + | +15 | let s = Some(String::from("test string")).unwrap_or("Fail".to_string()).len(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "Fail".to_string())` + | + = note: `-D clippy::or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> $DIR/unwrap_or.rs:10:10 + --> $DIR/unwrap_or.rs:20:10 | -10 | .unwrap_or("Fail".to_string()) +20 | .unwrap_or("Fail".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "Fail".to_string())` error: aborting due to 2 previous errors diff --git a/tests/ui/use_self.rs b/tests/ui/use_self.rs index 8d18d848a..784e0c040 100644 --- a/tests/ui/use_self.rs +++ b/tests/ui/use_self.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::use_self)] diff --git a/tests/ui/use_self.stderr b/tests/ui/use_self.stderr index cf673e166..627fc3a97 100644 --- a/tests/ui/use_self.stderr +++ b/tests/ui/use_self.stderr @@ -1,123 +1,123 @@ error: unnecessary structure name repetition - --> $DIR/use_self.rs:13:21 + --> $DIR/use_self.rs:23:21 | -13 | fn new() -> Foo { +23 | fn new() -> Foo { | ^^^ help: use the applicable keyword: `Self` | = note: `-D clippy::use-self` implied by `-D warnings` error: unnecessary structure name repetition - --> $DIR/use_self.rs:14:13 + --> $DIR/use_self.rs:24:13 | -14 | Foo {} +24 | Foo {} | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:16:22 + --> $DIR/use_self.rs:26:22 | -16 | fn test() -> Foo { +26 | fn test() -> Foo { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:17:13 + --> $DIR/use_self.rs:27:13 | -17 | Foo::new() +27 | Foo::new() | ^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:22:25 + --> $DIR/use_self.rs:32:25 | -22 | fn default() -> Foo { +32 | fn default() -> Foo { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:23:13 + --> $DIR/use_self.rs:33:13 | -23 | Foo::new() +33 | Foo::new() | ^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:86:22 + --> $DIR/use_self.rs:96:22 | -86 | fn refs(p1: &Bad) -> &Bad { +96 | fn refs(p1: &Bad) -> &Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:86:31 + --> $DIR/use_self.rs:96:31 | -86 | fn refs(p1: &Bad) -> &Bad { +96 | fn refs(p1: &Bad) -> &Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:90:37 - | -90 | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { - | ^^^ help: use the applicable keyword: `Self` - -error: unnecessary structure name repetition - --> $DIR/use_self.rs:90:53 - | -90 | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { - | ^^^ help: use the applicable keyword: `Self` - -error: unnecessary structure name repetition - --> $DIR/use_self.rs:94:30 - | -94 | fn mut_refs(p1: &mut Bad) -> &mut Bad { - | ^^^ help: use the applicable keyword: `Self` - -error: unnecessary structure name repetition - --> $DIR/use_self.rs:94:43 - | -94 | fn mut_refs(p1: &mut Bad) -> &mut Bad { - | ^^^ help: use the applicable keyword: `Self` - -error: unnecessary structure name repetition - --> $DIR/use_self.rs:98:28 - | -98 | fn nested(_p1: Box, _p2: (&u8, &Bad)) { - | ^^^ help: use the applicable keyword: `Self` - -error: unnecessary structure name repetition - --> $DIR/use_self.rs:98:46 - | -98 | fn nested(_p1: Box, _p2: (&u8, &Bad)) { - | ^^^ help: use the applicable keyword: `Self` - -error: unnecessary structure name repetition - --> $DIR/use_self.rs:101:20 + --> $DIR/use_self.rs:100:37 | -101 | fn vals(_: Bad) -> Bad { - | ^^^ help: use the applicable keyword: `Self` +100 | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { + | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:101:28 + --> $DIR/use_self.rs:100:53 | -101 | fn vals(_: Bad) -> Bad { +100 | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { + | ^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> $DIR/use_self.rs:104:30 + | +104 | fn mut_refs(p1: &mut Bad) -> &mut Bad { + | ^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> $DIR/use_self.rs:104:43 + | +104 | fn mut_refs(p1: &mut Bad) -> &mut Bad { + | ^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> $DIR/use_self.rs:108:28 + | +108 | fn nested(_p1: Box, _p2: (&u8, &Bad)) { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:102:13 + --> $DIR/use_self.rs:108:46 | -102 | Bad::default() +108 | fn nested(_p1: Box, _p2: (&u8, &Bad)) { + | ^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> $DIR/use_self.rs:111:20 + | +111 | fn vals(_: Bad) -> Bad { + | ^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> $DIR/use_self.rs:111:28 + | +111 | fn vals(_: Bad) -> Bad { + | ^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> $DIR/use_self.rs:112:13 + | +112 | Bad::default() | ^^^^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:107:23 + --> $DIR/use_self.rs:117:23 | -107 | type Output = Bad; +117 | type Output = Bad; | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:109:27 + --> $DIR/use_self.rs:119:27 | -109 | fn mul(self, rhs: Bad) -> Bad { +119 | fn mul(self, rhs: Bad) -> Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:109:35 + --> $DIR/use_self.rs:119:35 | -109 | fn mul(self, rhs: Bad) -> Bad { +119 | fn mul(self, rhs: Bad) -> Bad { | ^^^ help: use the applicable keyword: `Self` error: aborting due to 20 previous errors diff --git a/tests/ui/used_underscore_binding.rs b/tests/ui/used_underscore_binding.rs index c1e1c9af5..13ae1d67f 100644 --- a/tests/ui/used_underscore_binding.rs +++ b/tests/ui/used_underscore_binding.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::all)] diff --git a/tests/ui/used_underscore_binding.stderr b/tests/ui/used_underscore_binding.stderr index a1bb57a50..809211947 100644 --- a/tests/ui/used_underscore_binding.stderr +++ b/tests/ui/used_underscore_binding.stderr @@ -1,33 +1,33 @@ error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:17:5 + --> $DIR/used_underscore_binding.rs:27:5 | -17 | _foo + 1 +27 | _foo + 1 | ^^^^ | = note: `-D clippy::used-underscore-binding` implied by `-D warnings` error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:22:20 + --> $DIR/used_underscore_binding.rs:32:20 | -22 | println!("{}", _foo); +32 | println!("{}", _foo); | ^^^^ error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:23:16 + --> $DIR/used_underscore_binding.rs:33:16 | -23 | assert_eq!(_foo, _foo); +33 | assert_eq!(_foo, _foo); | ^^^^ error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:23:22 + --> $DIR/used_underscore_binding.rs:33:22 | -23 | assert_eq!(_foo, _foo); +33 | assert_eq!(_foo, _foo); | ^^^^ error: used binding `_underscore_field` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> $DIR/used_underscore_binding.rs:36:5 + --> $DIR/used_underscore_binding.rs:46:5 | -36 | s._underscore_field += 1; +46 | s._underscore_field += 1; | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/useless_asref.rs b/tests/ui/useless_asref.rs index 52994566e..598618365 100644 --- a/tests/ui/useless_asref.rs +++ b/tests/ui/useless_asref.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![deny(clippy::useless_asref)] diff --git a/tests/ui/useless_asref.stderr b/tests/ui/useless_asref.stderr index 6247fb27a..8e45facf5 100644 --- a/tests/ui/useless_asref.stderr +++ b/tests/ui/useless_asref.stderr @@ -1,73 +1,73 @@ error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:33:18 + --> $DIR/useless_asref.rs:43:18 | -33 | foo_rstr(rstr.as_ref()); +43 | foo_rstr(rstr.as_ref()); | ^^^^^^^^^^^^^ help: try this: `rstr` | note: lint level defined here - --> $DIR/useless_asref.rs:3:9 + --> $DIR/useless_asref.rs:13:9 | -3 | #![deny(clippy::useless_asref)] +13 | #![deny(clippy::useless_asref)] | ^^^^^^^^^^^^^^^^^^^^^ error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:35:20 + --> $DIR/useless_asref.rs:45:20 | -35 | foo_rslice(rslice.as_ref()); +45 | foo_rslice(rslice.as_ref()); | ^^^^^^^^^^^^^^^ help: try this: `rslice` error: this call to `as_mut` does nothing - --> $DIR/useless_asref.rs:39:21 + --> $DIR/useless_asref.rs:49:21 | -39 | foo_mrslice(mrslice.as_mut()); +49 | foo_mrslice(mrslice.as_mut()); | ^^^^^^^^^^^^^^^^ help: try this: `mrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:41:20 + --> $DIR/useless_asref.rs:51:20 | -41 | foo_rslice(mrslice.as_ref()); +51 | foo_rslice(mrslice.as_ref()); | ^^^^^^^^^^^^^^^^ help: try this: `mrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:48:20 + --> $DIR/useless_asref.rs:58:20 | -48 | foo_rslice(rrrrrslice.as_ref()); +58 | foo_rslice(rrrrrslice.as_ref()); | ^^^^^^^^^^^^^^^^^^^ help: try this: `rrrrrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:50:18 + --> $DIR/useless_asref.rs:60:18 | -50 | foo_rstr(rrrrrstr.as_ref()); +60 | foo_rstr(rrrrrstr.as_ref()); | ^^^^^^^^^^^^^^^^^ help: try this: `rrrrrstr` error: this call to `as_mut` does nothing - --> $DIR/useless_asref.rs:55:21 + --> $DIR/useless_asref.rs:65:21 | -55 | foo_mrslice(mrrrrrslice.as_mut()); +65 | foo_mrslice(mrrrrrslice.as_mut()); | ^^^^^^^^^^^^^^^^^^^^ help: try this: `mrrrrrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:57:20 + --> $DIR/useless_asref.rs:67:20 | -57 | foo_rslice(mrrrrrslice.as_ref()); +67 | foo_rslice(mrrrrrslice.as_ref()); | ^^^^^^^^^^^^^^^^^^^^ help: try this: `mrrrrrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:60:16 + --> $DIR/useless_asref.rs:70:16 | -60 | foo_rrrrmr((&&&&MoreRef).as_ref()); +70 | foo_rrrrmr((&&&&MoreRef).as_ref()); | ^^^^^^^^^^^^^^^^^^^^^^ help: try this: `(&&&&MoreRef)` error: this call to `as_mut` does nothing - --> $DIR/useless_asref.rs:106:13 + --> $DIR/useless_asref.rs:116:13 | -106 | foo_mrt(mrt.as_mut()); +116 | foo_mrt(mrt.as_mut()); | ^^^^^^^^^^^^ help: try this: `mrt` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:108:12 + --> $DIR/useless_asref.rs:118:12 | -108 | foo_rt(mrt.as_ref()); +118 | foo_rt(mrt.as_ref()); | ^^^^^^^^^^^^ help: try this: `mrt` error: aborting due to 11 previous errors diff --git a/tests/ui/useless_attribute.rs b/tests/ui/useless_attribute.rs index 80d4ebced..710f35da7 100644 --- a/tests/ui/useless_attribute.rs +++ b/tests/ui/useless_attribute.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![warn(clippy::useless_attribute)] diff --git a/tests/ui/useless_attribute.stderr b/tests/ui/useless_attribute.stderr index d498fe64e..4a27d1148 100644 --- a/tests/ui/useless_attribute.stderr +++ b/tests/ui/useless_attribute.stderr @@ -1,16 +1,16 @@ error: useless lint attribute - --> $DIR/useless_attribute.rs:5:1 - | -5 | #[allow(dead_code)] - | ^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(dead_code)]` - | - = note: `-D clippy::useless-attribute` implied by `-D warnings` + --> $DIR/useless_attribute.rs:15:1 + | +15 | #[allow(dead_code)] + | ^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(dead_code)]` + | + = note: `-D clippy::useless-attribute` implied by `-D warnings` error: useless lint attribute - --> $DIR/useless_attribute.rs:6:1 - | -6 | #[cfg_attr(feature = "cargo-clippy", allow(dead_code))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code))` + --> $DIR/useless_attribute.rs:16:1 + | +16 | #[cfg_attr(feature = "cargo-clippy", allow(dead_code))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code))` error: aborting due to 2 previous errors diff --git a/tests/ui/vec.rs b/tests/ui/vec.rs index 78a49f258..45e516637 100644 --- a/tests/ui/vec.rs +++ b/tests/ui/vec.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/vec.stderr b/tests/ui/vec.stderr index b9541e58c..e4649eab5 100644 --- a/tests/ui/vec.stderr +++ b/tests/ui/vec.stderr @@ -1,39 +1,39 @@ error: useless use of `vec!` - --> $DIR/vec.rs:24:14 + --> $DIR/vec.rs:34:14 | -24 | on_slice(&vec![]); +34 | on_slice(&vec![]); | ^^^^^^^ help: you can use a slice directly: `&[]` | = note: `-D clippy::useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> $DIR/vec.rs:27:14 + --> $DIR/vec.rs:37:14 | -27 | on_slice(&vec![1, 2]); +37 | on_slice(&vec![1, 2]); | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!` - --> $DIR/vec.rs:30:14 + --> $DIR/vec.rs:40:14 | -30 | on_slice(&vec ![1, 2]); +40 | on_slice(&vec ![1, 2]); | ^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!` - --> $DIR/vec.rs:33:14 + --> $DIR/vec.rs:43:14 | -33 | on_slice(&vec!(1, 2)); +43 | on_slice(&vec!(1, 2)); | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!` - --> $DIR/vec.rs:36:14 + --> $DIR/vec.rs:46:14 | -36 | on_slice(&vec![1; 2]); +46 | on_slice(&vec![1; 2]); | ^^^^^^^^^^^ help: you can use a slice directly: `&[1; 2]` error: useless use of `vec!` - --> $DIR/vec.rs:49:14 + --> $DIR/vec.rs:59:14 | -49 | for a in vec![1, 2, 3] { +59 | for a in vec![1, 2, 3] { | ^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2, 3]` error: aborting due to 6 previous errors diff --git a/tests/ui/while_loop.rs b/tests/ui/while_loop.rs index 0b8691d57..ff7a43fd6 100644 --- a/tests/ui/while_loop.rs +++ b/tests/ui/while_loop.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/while_loop.stderr b/tests/ui/while_loop.stderr index cc309e379..b166e8bac 100644 --- a/tests/ui/while_loop.stderr +++ b/tests/ui/while_loop.stderr @@ -1,114 +1,114 @@ error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:9:5 + --> $DIR/while_loop.rs:19:5 | -9 | / loop { -10 | | if let Some(_x) = y { -11 | | let _v = 1; -12 | | } else { -13 | | break -14 | | } -15 | | } +19 | / loop { +20 | | if let Some(_x) = y { +21 | | let _v = 1; +22 | | } else { +23 | | break +24 | | } +25 | | } | |_____^ help: try: `while let Some(_x) = y { .. }` | = note: `-D clippy::while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:22:5 + --> $DIR/while_loop.rs:32:5 | -22 | / loop { -23 | | match y { -24 | | Some(_x) => true, -25 | | None => break -26 | | }; -27 | | } +32 | / loop { +33 | | match y { +34 | | Some(_x) => true, +35 | | None => break +36 | | }; +37 | | } | |_____^ help: try: `while let Some(_x) = y { .. }` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:28:5 + --> $DIR/while_loop.rs:38:5 | -28 | / loop { -29 | | let x = match y { -30 | | Some(x) => x, -31 | | None => break +38 | / loop { +39 | | let x = match y { +40 | | Some(x) => x, +41 | | None => break ... | -34 | | let _str = "foo"; -35 | | } +44 | | let _str = "foo"; +45 | | } | |_____^ help: try: `while let Some(x) = y { .. }` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:36:5 + --> $DIR/while_loop.rs:46:5 | -36 | / loop { -37 | | let x = match y { -38 | | Some(x) => x, -39 | | None => break, +46 | / loop { +47 | | let x = match y { +48 | | Some(x) => x, +49 | | None => break, ... | -42 | | { let _b = "foobar"; } -43 | | } +52 | | { let _b = "foobar"; } +53 | | } | |_____^ help: try: `while let Some(x) = y { .. }` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:58:5 + --> $DIR/while_loop.rs:68:5 | -58 | / loop { -59 | | let (e, l) = match "".split_whitespace().next() { -60 | | Some(word) => (word.is_empty(), word.len()), -61 | | None => break +68 | / loop { +69 | | let (e, l) = match "".split_whitespace().next() { +70 | | Some(word) => (word.is_empty(), word.len()), +71 | | None => break ... | -64 | | let _ = (e, l); -65 | | } +74 | | let _ = (e, l); +75 | | } | |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }` error: this loop could be written as a `for` loop - --> $DIR/while_loop.rs:68:33 + --> $DIR/while_loop.rs:78:33 | -68 | while let Option::Some(x) = iter.next() { +78 | while let Option::Some(x) = iter.next() { | ^^^^^^^^^^^ help: try: `for x in iter { .. }` | = note: `-D clippy::while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `for` loop - --> $DIR/while_loop.rs:73:25 + --> $DIR/while_loop.rs:83:25 | -73 | while let Some(x) = iter.next() { +83 | while let Some(x) = iter.next() { | ^^^^^^^^^^^ help: try: `for x in iter { .. }` error: this loop could be written as a `for` loop - --> $DIR/while_loop.rs:78:25 + --> $DIR/while_loop.rs:88:25 | -78 | while let Some(_) = iter.next() {} +88 | while let Some(_) = iter.next() {} | ^^^^^^^^^^^ help: try: `for _ in iter { .. }` error: this loop could be written as a `while let` loop - --> $DIR/while_loop.rs:118:5 + --> $DIR/while_loop.rs:128:5 | -118 | / loop { -119 | | let _ = match iter.next() { -120 | | Some(ele) => ele, -121 | | None => break -122 | | }; -123 | | loop {} -124 | | } +128 | / loop { +129 | | let _ = match iter.next() { +130 | | Some(ele) => ele, +131 | | None => break +132 | | }; +133 | | loop {} +134 | | } | |_____^ help: try: `while let Some(ele) = iter.next() { .. }` error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body. - --> $DIR/while_loop.rs:123:9 + --> $DIR/while_loop.rs:133:9 | -123 | loop {} +133 | loop {} | ^^^^^^^ | = note: `-D clippy::empty-loop` implied by `-D warnings` error: this loop could be written as a `for` loop - --> $DIR/while_loop.rs:183:29 + --> $DIR/while_loop.rs:193:29 | -183 | while let Some(v) = y.next() { // use a for loop here +193 | while let Some(v) = y.next() { // use a for loop here | ^^^^^^^^ help: try: `for v in y { .. }` error: this loop could be written as a `for` loop - --> $DIR/while_loop.rs:210:26 + --> $DIR/while_loop.rs:220:26 | -210 | while let Some(..) = values.iter().next() { +220 | while let Some(..) = values.iter().next() { | ^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in values.iter() { .. }` error: aborting due to 12 previous errors diff --git a/tests/ui/write_literal.rs b/tests/ui/write_literal.rs index 5ef4c15f4..9a27ca11d 100644 --- a/tests/ui/write_literal.rs +++ b/tests/ui/write_literal.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused_must_use)] diff --git a/tests/ui/write_literal.stderr b/tests/ui/write_literal.stderr index 644f6f15b..2aa66c320 100644 --- a/tests/ui/write_literal.stderr +++ b/tests/ui/write_literal.stderr @@ -1,87 +1,87 @@ error: literal with an empty format string - --> $DIR/write_literal.rs:29:79 + --> $DIR/write_literal.rs:39:79 | -29 | writeln!(&mut v, "{} of {:b} people know binary, the other half doesn't", 1, 2); +39 | writeln!(&mut v, "{} of {:b} people know binary, the other half doesn't", 1, 2); | ^ | = note: `-D clippy::write-literal` implied by `-D warnings` error: literal with an empty format string - --> $DIR/write_literal.rs:30:32 + --> $DIR/write_literal.rs:40:32 | -30 | write!(&mut v, "Hello {}", "world"); +40 | write!(&mut v, "Hello {}", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:31:44 + --> $DIR/write_literal.rs:41:44 | -31 | writeln!(&mut v, "Hello {} {}", world, "world"); +41 | writeln!(&mut v, "Hello {} {}", world, "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:32:34 + --> $DIR/write_literal.rs:42:34 | -32 | writeln!(&mut v, "Hello {}", "world"); +42 | writeln!(&mut v, "Hello {}", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:33:38 + --> $DIR/write_literal.rs:43:38 | -33 | writeln!(&mut v, "10 / 4 is {}", 2.5); +43 | writeln!(&mut v, "10 / 4 is {}", 2.5); | ^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:34:36 + --> $DIR/write_literal.rs:44:36 | -34 | writeln!(&mut v, "2 + 1 = {}", 3); +44 | writeln!(&mut v, "2 + 1 = {}", 3); | ^ error: literal with an empty format string - --> $DIR/write_literal.rs:39:33 + --> $DIR/write_literal.rs:49:33 | -39 | writeln!(&mut v, "{0} {1}", "hello", "world"); +49 | writeln!(&mut v, "{0} {1}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:39:42 + --> $DIR/write_literal.rs:49:42 | -39 | writeln!(&mut v, "{0} {1}", "hello", "world"); +49 | writeln!(&mut v, "{0} {1}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:40:33 + --> $DIR/write_literal.rs:50:33 | -40 | writeln!(&mut v, "{1} {0}", "hello", "world"); +50 | writeln!(&mut v, "{1} {0}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:40:42 + --> $DIR/write_literal.rs:50:42 | -40 | writeln!(&mut v, "{1} {0}", "hello", "world"); +50 | writeln!(&mut v, "{1} {0}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:43:41 + --> $DIR/write_literal.rs:53:41 | -43 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world"); +53 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:43:54 + --> $DIR/write_literal.rs:53:54 | -43 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world"); +53 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:44:41 + --> $DIR/write_literal.rs:54:41 | -44 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world"); +54 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:44:54 + --> $DIR/write_literal.rs:54:54 | -44 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world"); +54 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world"); | ^^^^^^^ error: aborting due to 14 previous errors diff --git a/tests/ui/write_with_newline.rs b/tests/ui/write_with_newline.rs index 58e6002fa..f3e26ed90 100644 --- a/tests/ui/write_with_newline.rs +++ b/tests/ui/write_with_newline.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(clippy::write_literal)] diff --git a/tests/ui/write_with_newline.stderr b/tests/ui/write_with_newline.stderr index c8617b493..dd7f223c5 100644 --- a/tests/ui/write_with_newline.stderr +++ b/tests/ui/write_with_newline.stderr @@ -1,27 +1,27 @@ error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead - --> $DIR/write_with_newline.rs:12:5 + --> $DIR/write_with_newline.rs:22:5 | -12 | write!(&mut v, "Hello/n"); +22 | write!(&mut v, "Hello/n"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::write-with-newline` implied by `-D warnings` error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead - --> $DIR/write_with_newline.rs:13:5 + --> $DIR/write_with_newline.rs:23:5 | -13 | write!(&mut v, "Hello {}/n", "world"); +23 | write!(&mut v, "Hello {}/n", "world"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead - --> $DIR/write_with_newline.rs:14:5 + --> $DIR/write_with_newline.rs:24:5 | -14 | write!(&mut v, "Hello {} {}/n", "world", "#2"); +24 | write!(&mut v, "Hello {} {}/n", "world", "#2"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead - --> $DIR/write_with_newline.rs:15:5 + --> $DIR/write_with_newline.rs:25:5 | -15 | write!(&mut v, "{}/n", 1265); +25 | write!(&mut v, "{}/n", 1265); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/writeln_empty_string.rs b/tests/ui/writeln_empty_string.rs index 81dfdcdc0..888e87066 100644 --- a/tests/ui/writeln_empty_string.rs +++ b/tests/ui/writeln_empty_string.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] #![allow(unused_must_use)] diff --git a/tests/ui/writeln_empty_string.stderr b/tests/ui/writeln_empty_string.stderr index ef1e9b3d3..3e6ec3362 100644 --- a/tests/ui/writeln_empty_string.stderr +++ b/tests/ui/writeln_empty_string.stderr @@ -1,15 +1,15 @@ error: using `writeln!(&mut v, "")` - --> $DIR/writeln_empty_string.rs:11:5 + --> $DIR/writeln_empty_string.rs:21:5 | -11 | writeln!(&mut v, ""); +21 | writeln!(&mut v, ""); | ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `writeln!(&mut v)` | = note: `-D clippy::writeln-empty-string` implied by `-D warnings` error: using `writeln!(&mut suggestion, "")` - --> $DIR/writeln_empty_string.rs:14:5 + --> $DIR/writeln_empty_string.rs:24:5 | -14 | writeln!(&mut suggestion, ""); +24 | writeln!(&mut suggestion, ""); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `writeln!(&mut suggestion)` error: aborting due to 2 previous errors diff --git a/tests/ui/wrong_self_convention.rs b/tests/ui/wrong_self_convention.rs index 2fb33d086..d843af1a3 100644 --- a/tests/ui/wrong_self_convention.rs +++ b/tests/ui/wrong_self_convention.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/wrong_self_convention.stderr b/tests/ui/wrong_self_convention.stderr index 4a6e5e0ab..ee0f4f8a1 100644 --- a/tests/ui/wrong_self_convention.stderr +++ b/tests/ui/wrong_self_convention.stderr @@ -1,75 +1,75 @@ error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:21:17 + --> $DIR/wrong_self_convention.rs:31:17 | -21 | fn from_i32(self) {} +31 | fn from_i32(self) {} | ^^^^ | = note: `-D clippy::wrong-self-convention` implied by `-D warnings` error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:27:21 + --> $DIR/wrong_self_convention.rs:37:21 | -27 | pub fn from_i64(self) {} +37 | pub fn from_i64(self) {} | ^^^^ error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:40:15 + --> $DIR/wrong_self_convention.rs:50:15 | -40 | fn as_i32(self) {} +50 | fn as_i32(self) {} | ^^^^ error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:42:17 + --> $DIR/wrong_self_convention.rs:52:17 | -42 | fn into_i32(&self) {} +52 | fn into_i32(&self) {} | ^^^^^ error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:44:15 + --> $DIR/wrong_self_convention.rs:54:15 | -44 | fn is_i32(self) {} +54 | fn is_i32(self) {} | ^^^^ error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:46:15 + --> $DIR/wrong_self_convention.rs:56:15 | -46 | fn to_i32(self) {} +56 | fn to_i32(self) {} | ^^^^ error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:48:17 + --> $DIR/wrong_self_convention.rs:58:17 | -48 | fn from_i32(self) {} +58 | fn from_i32(self) {} | ^^^^ error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:50:19 + --> $DIR/wrong_self_convention.rs:60:19 | -50 | pub fn as_i64(self) {} +60 | pub fn as_i64(self) {} | ^^^^ error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:51:21 + --> $DIR/wrong_self_convention.rs:61:21 | -51 | pub fn into_i64(&self) {} +61 | pub fn into_i64(&self) {} | ^^^^^ error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:52:19 + --> $DIR/wrong_self_convention.rs:62:19 | -52 | pub fn is_i64(self) {} +62 | pub fn is_i64(self) {} | ^^^^ error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:53:19 + --> $DIR/wrong_self_convention.rs:63:19 | -53 | pub fn to_i64(self) {} +63 | pub fn to_i64(self) {} | ^^^^ error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> $DIR/wrong_self_convention.rs:54:21 + --> $DIR/wrong_self_convention.rs:64:21 | -54 | pub fn from_i64(self) {} +64 | pub fn from_i64(self) {} | ^^^^ error: aborting due to 12 previous errors diff --git a/tests/ui/zero_div_zero.rs b/tests/ui/zero_div_zero.rs index 7927e8b8a..c2cbd3296 100644 --- a/tests/ui/zero_div_zero.rs +++ b/tests/ui/zero_div_zero.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + #![feature(tool_lints)] diff --git a/tests/ui/zero_div_zero.stderr b/tests/ui/zero_div_zero.stderr index a5e86883d..0c24a08a6 100644 --- a/tests/ui/zero_div_zero.stderr +++ b/tests/ui/zero_div_zero.stderr @@ -1,58 +1,58 @@ error: equal expressions as operands to `/` - --> $DIR/zero_div_zero.rs:7:15 - | -7 | let nan = 0.0 / 0.0; - | ^^^^^^^^^ - | - = note: #[deny(clippy::eq_op)] on by default - -error: constant division of 0.0 with 0.0 will always result in NaN - --> $DIR/zero_div_zero.rs:7:15 - | -7 | let nan = 0.0 / 0.0; - | ^^^^^^^^^ - | - = note: `-D clippy::zero-divided-by-zero` implied by `-D warnings` - = help: Consider using `std::f64::NAN` if you would like a constant representing NaN - -error: equal expressions as operands to `/` - --> $DIR/zero_div_zero.rs:8:19 - | -8 | let f64_nan = 0.0 / 0.0f64; - | ^^^^^^^^^^^^ - -error: constant division of 0.0 with 0.0 will always result in NaN - --> $DIR/zero_div_zero.rs:8:19 - | -8 | let f64_nan = 0.0 / 0.0f64; - | ^^^^^^^^^^^^ - | - = help: Consider using `std::f64::NAN` if you would like a constant representing NaN - -error: equal expressions as operands to `/` - --> $DIR/zero_div_zero.rs:9:25 - | -9 | let other_f64_nan = 0.0f64 / 0.0; - | ^^^^^^^^^^^^ - -error: constant division of 0.0 with 0.0 will always result in NaN - --> $DIR/zero_div_zero.rs:9:25 - | -9 | let other_f64_nan = 0.0f64 / 0.0; - | ^^^^^^^^^^^^ - | - = help: Consider using `std::f64::NAN` if you would like a constant representing NaN - -error: equal expressions as operands to `/` - --> $DIR/zero_div_zero.rs:10:28 + --> $DIR/zero_div_zero.rs:17:15 | -10 | let one_more_f64_nan = 0.0f64/0.0f64; +17 | let nan = 0.0 / 0.0; + | ^^^^^^^^^ + | + = note: #[deny(clippy::eq_op)] on by default + +error: constant division of 0.0 with 0.0 will always result in NaN + --> $DIR/zero_div_zero.rs:17:15 + | +17 | let nan = 0.0 / 0.0; + | ^^^^^^^^^ + | + = note: `-D clippy::zero-divided-by-zero` implied by `-D warnings` + = help: Consider using `std::f64::NAN` if you would like a constant representing NaN + +error: equal expressions as operands to `/` + --> $DIR/zero_div_zero.rs:18:19 + | +18 | let f64_nan = 0.0 / 0.0f64; + | ^^^^^^^^^^^^ + +error: constant division of 0.0 with 0.0 will always result in NaN + --> $DIR/zero_div_zero.rs:18:19 + | +18 | let f64_nan = 0.0 / 0.0f64; + | ^^^^^^^^^^^^ + | + = help: Consider using `std::f64::NAN` if you would like a constant representing NaN + +error: equal expressions as operands to `/` + --> $DIR/zero_div_zero.rs:19:25 + | +19 | let other_f64_nan = 0.0f64 / 0.0; + | ^^^^^^^^^^^^ + +error: constant division of 0.0 with 0.0 will always result in NaN + --> $DIR/zero_div_zero.rs:19:25 + | +19 | let other_f64_nan = 0.0f64 / 0.0; + | ^^^^^^^^^^^^ + | + = help: Consider using `std::f64::NAN` if you would like a constant representing NaN + +error: equal expressions as operands to `/` + --> $DIR/zero_div_zero.rs:20:28 + | +20 | let one_more_f64_nan = 0.0f64/0.0f64; | ^^^^^^^^^^^^^ error: constant division of 0.0 with 0.0 will always result in NaN - --> $DIR/zero_div_zero.rs:10:28 + --> $DIR/zero_div_zero.rs:20:28 | -10 | let one_more_f64_nan = 0.0f64/0.0f64; +20 | let one_more_f64_nan = 0.0f64/0.0f64; | ^^^^^^^^^^^^^ | = help: Consider using `std::f64::NAN` if you would like a constant representing NaN diff --git a/tests/ui/zero_ptr.rs b/tests/ui/zero_ptr.rs index 4a6010f4b..fbe4f950d 100644 --- a/tests/ui/zero_ptr.rs +++ b/tests/ui/zero_ptr.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + diff --git a/tests/ui/zero_ptr.stderr b/tests/ui/zero_ptr.stderr index b5e279eaa..7a0c8e70b 100644 --- a/tests/ui/zero_ptr.stderr +++ b/tests/ui/zero_ptr.stderr @@ -1,16 +1,16 @@ error: `0 as *const _` detected. Consider using `ptr::null()` - --> $DIR/zero_ptr.rs:6:13 - | -6 | let x = 0 as *const usize; - | ^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::zero-ptr` implied by `-D warnings` + --> $DIR/zero_ptr.rs:16:13 + | +16 | let x = 0 as *const usize; + | ^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::zero-ptr` implied by `-D warnings` error: `0 as *mut _` detected. Consider using `ptr::null_mut()` - --> $DIR/zero_ptr.rs:7:13 - | -7 | let y = 0 as *mut f64; - | ^^^^^^^^^^^^^ + --> $DIR/zero_ptr.rs:17:13 + | +17 | let y = 0 as *mut f64; + | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/versioncheck.rs b/tests/versioncheck.rs index 25b0ceefa..5b189a797 100644 --- a/tests/versioncheck.rs +++ b/tests/versioncheck.rs @@ -1,3 +1,13 @@ +// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + extern crate cargo_metadata; extern crate semver; use semver::VersionReq;