From eb6c5939098d18874c2efd5264b89ead1b6598ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 3 Jul 2024 18:30:12 +0000 Subject: [PATCH] Make the default suggestions show the full patch output Before ``` error: almost complete ascii range --> tests/ui/almost_complete_range.rs:17:17 | LL | let _ = ('a') ..'z'; | ^^^^^^--^^^ | | | help: use an inclusive range: `..=` | = note: `-D clippy::almost-complete-range` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]` ``` After ``` error: almost complete ascii range --> tests/ui/almost_complete_range.rs:17:17 | LL | let _ = ('a') ..'z'; | ^^^^^^^^^^^ | = note: `-D clippy::almost-complete-range` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]` help: use an inclusive range | LL | let _ = ('a') ..='z'; | ~~~ ``` --- compiler/rustc_ast_lowering/src/errors.rs | 7 +- compiler/rustc_ast_passes/src/errors.rs | 17 +- .../src/diagnostics/conflict_errors.rs | 26 +- .../src/diagnostics/explain_borrow.rs | 4 +- .../rustc_borrowck/src/diagnostics/mod.rs | 8 +- .../src/diagnostics/move_errors.rs | 10 +- .../src/diagnostics/mutability_errors.rs | 22 +- .../src/diagnostics/region_errors.rs | 10 +- .../rustc_borrowck/src/session_diagnostics.rs | 8 +- compiler/rustc_builtin_macros/src/errors.rs | 5 +- .../src/annotate_snippet_emitter_writer.rs | 3 +- compiler/rustc_errors/src/diagnostic.rs | 110 +- compiler/rustc_errors/src/diagnostic_impls.rs | 2 +- compiler/rustc_errors/src/emitter.rs | 96 +- compiler/rustc_errors/src/lib.rs | 14 - compiler/rustc_expand/src/errors.rs | 7 +- compiler/rustc_expand/src/mbe/diagnostics.rs | 6 +- compiler/rustc_hir_analysis/messages.ftl | 2 +- .../src/check/compare_impl_item.rs | 2 +- compiler/rustc_hir_analysis/src/check/mod.rs | 13 +- .../src/coherence/unsafety.rs | 6 +- compiler/rustc_hir_analysis/src/errors.rs | 14 +- .../src/hir_ty_lowering/errors.rs | 30 +- .../src/hir_ty_lowering/lint.rs | 16 +- .../src/hir_ty_lowering/mod.rs | 2 +- .../wrong_number_of_generic_args.rs | 20 +- compiler/rustc_hir_typeck/src/callee.rs | 2 +- compiler/rustc_hir_typeck/src/cast.rs | 6 +- compiler/rustc_hir_typeck/src/coercion.rs | 2 +- compiler/rustc_hir_typeck/src/demand.rs | 2 +- compiler/rustc_hir_typeck/src/errors.rs | 26 +- compiler/rustc_hir_typeck/src/expr.rs | 28 +- .../rustc_hir_typeck/src/fn_ctxt/checks.rs | 8 +- .../src/fn_ctxt/suggestions.rs | 70 +- compiler/rustc_hir_typeck/src/method/mod.rs | 2 +- .../rustc_hir_typeck/src/method/suggest.rs | 47 +- compiler/rustc_hir_typeck/src/op.rs | 14 +- compiler/rustc_hir_typeck/src/pat.rs | 38 +- compiler/rustc_hir_typeck/src/place_op.rs | 2 +- compiler/rustc_infer/src/errors/mod.rs | 86 +- .../src/infer/error_reporting/mod.rs | 2 +- .../nice_region_error/static_impl_trait.rs | 14 +- .../infer/error_reporting/note_and_explain.rs | 4 +- .../src/infer/error_reporting/suggest.rs | 6 +- .../src/traits/error_reporting/mod.rs | 2 +- compiler/rustc_lint/src/errors.rs | 2 +- compiler/rustc_lint/src/lints.rs | 57 +- compiler/rustc_lint/src/non_fmt_panic.rs | 4 +- .../src/opaque_hidden_inferred_bound.rs | 1 - compiler/rustc_macros/src/diagnostics/mod.rs | 2 +- .../rustc_macros/src/diagnostics/utils.rs | 21 - compiler/rustc_macros/src/lib.rs | 2 +- compiler/rustc_middle/src/middle/stability.rs | 1 - compiler/rustc_middle/src/ty/context.rs | 2 +- compiler/rustc_middle/src/ty/diagnostics.rs | 6 +- compiler/rustc_mir_build/src/errors.rs | 2 +- .../src/thir/pattern/check_match.rs | 2 +- compiler/rustc_parse/src/errors.rs | 211 +-- compiler/rustc_parse/src/parser/attr.rs | 4 +- .../rustc_parse/src/parser/diagnostics.rs | 24 +- compiler/rustc_parse/src/parser/expr.rs | 12 +- compiler/rustc_parse/src/parser/generics.rs | 4 +- compiler/rustc_parse/src/parser/item.rs | 13 +- compiler/rustc_parse/src/parser/mod.rs | 4 +- compiler/rustc_parse/src/parser/pat.rs | 2 +- compiler/rustc_parse/src/parser/path.rs | 6 +- compiler/rustc_parse/src/parser/stmt.rs | 8 +- compiler/rustc_parse/src/parser/ty.rs | 2 +- compiler/rustc_passes/src/errors.rs | 6 +- compiler/rustc_resolve/src/diagnostics.rs | 4 +- compiler/rustc_resolve/src/errors.rs | 25 +- compiler/rustc_resolve/src/late.rs | 2 +- .../rustc_resolve/src/late/diagnostics.rs | 53 +- compiler/rustc_trait_selection/src/errors.rs | 4 +- .../src/traits/const_evaluatable.rs | 2 +- .../traits/error_reporting/infer_ctxt_ext.rs | 6 +- .../src/traits/error_reporting/suggestions.rs | 82 +- .../error_reporting/type_err_ctxt_ext.rs | 6 +- .../passes/collect_intra_doc_links.rs | 2 +- .../src/cargo/lint_groups_priority.rs | 2 +- .../clippy_lints/src/derivable_impls.rs | 4 +- .../clippy_lints/src/empty_with_brackets.rs | 4 +- .../clippy/clippy_lints/src/format_args.rs | 6 +- .../src/items_after_test_module.rs | 5 +- .../src/iter_without_into_iter.rs | 4 +- .../clippy_lints/src/loops/never_loop.rs | 2 +- .../clippy_lints/src/manual_float_methods.rs | 6 +- .../src/matches/redundant_guards.rs | 2 +- .../clippy_lints/src/methods/iter_nth.rs | 2 +- .../clippy_lints/src/methods/str_splitn.rs | 2 +- .../src/methods/string_lit_chars_any.rs | 2 +- .../methods/suspicious_command_arg_space.rs | 2 +- .../clippy_lints/src/missing_const_for_fn.rs | 2 +- .../clippy_lints/src/needless_borrowed_ref.rs | 2 +- .../clippy_lints/src/needless_maybe_sized.rs | 2 +- .../clippy/clippy_lints/src/raw_strings.rs | 2 +- .../src/repeat_vec_with_capacity.rs | 2 +- src/tools/clippy/clippy_lints/src/returns.rs | 2 +- .../src/significant_drop_tightening.rs | 2 +- .../clippy_lints/src/unnested_or_patterns.rs | 2 +- .../internal_lints/metadata_collector.rs | 3 - .../array_size_threshold.stderr | 8 +- .../decimal_literal_representation.stderr | 6 +- .../explicit_iter_loop.stderr | 13 +- .../large_futures/large_futures.stderr | 6 +- .../large_types_passed_by_value.stderr | 6 +- .../lint_decimal_readability/test.stderr | 12 +- .../manual_let_else/manual_let_else.stderr | 6 +- .../min_rust_version/min_rust_version.stderr | 6 +- ...conf_missing_enforced_import_rename.stderr | 41 +- .../conf_nonstandard_macro_braces.stderr | 54 +- .../renamed_function_params.default.stderr | 34 +- .../renamed_function_params.extend.stderr | 20 +- .../ui-toml/toml_trivially_copy/test.stderr | 13 +- .../toml_unknown_key/conf_unknown_key.stderr | 7 +- .../too_large_for_stack/useless_vec.stderr | 6 +- .../unnecessary_box_returns.stderr | 6 +- .../ui-toml/unwrap_used/unwrap_used.stderr | 104 +- .../upper_case_acronyms.stderr | 90 +- .../ui-toml/useless_vec/useless_vec.stderr | 6 +- .../tests/ui-toml/vec_box_sized/test.stderr | 20 +- .../verbose_bit_mask/verbose_bit_mask.stderr | 6 +- .../wildcard_imports/wildcard_imports.stderr | 20 +- .../wildcard_imports.stderr | 6 +- .../clippy/tests/ui/allow_attributes.stderr | 26 +- .../tests/ui/almost_complete_range.stderr | 239 ++-- .../clippy/tests/ui/as_ptr_cast_mut.stderr | 13 +- .../clippy/tests/ui/as_underscore.stderr | 17 +- .../ui/assertions_on_result_states.stderr | 48 +- src/tools/clippy/tests/ui/assign_ops.stderr | 76 +- src/tools/clippy/tests/ui/assign_ops2.stderr | 6 +- .../clippy/tests/ui/assigning_clones.stderr | 167 ++- .../clippy/tests/ui/async_yields_async.stderr | 36 +- .../tests/ui/bind_instead_of_map.stderr | 20 +- .../tests/ui/blocks_in_conditions.stderr | 13 +- .../clippy/tests/ui/bool_comparison.stderr | 174 ++- .../tests/ui/bool_to_int_with_if.stderr | 54 +- .../clippy/tests/ui/borrow_as_ptr.stderr | 13 +- .../tests/ui/borrow_as_ptr_no_std.stderr | 13 +- src/tools/clippy/tests/ui/borrow_box.stderr | 69 +- .../clippy/tests/ui/borrow_deref_ref.stderr | 20 +- src/tools/clippy/tests/ui/box_default.stderr | 69 +- src/tools/clippy/tests/ui/bytecount.stderr | 20 +- .../clippy/tests/ui/bytes_count_to_len.stderr | 27 +- src/tools/clippy/tests/ui/bytes_nth.stderr | 20 +- .../tests/ui/cast_abs_to_unsigned.stderr | 125 +- .../clippy/tests/ui/cast_lossless_bool.stderr | 104 +- .../tests/ui/cast_lossless_float.stderr | 90 +- .../tests/ui/cast_lossless_integer.stderr | 153 +- .../ui/cast_raw_slice_pointer_cast.stderr | 48 +- .../ui/cast_slice_different_sizes.stderr | 90 +- .../tests/ui/cfg_attr_cargo_clippy.stderr | 48 +- .../clippy/tests/ui/cfg_attr_rustfmt.stderr | 20 +- .../ui/char_lit_as_u8_suggestions.stderr | 24 +- .../tests/ui/checked_conversions.stderr | 118 +- .../complex_conditionals_nested.stderr | 7 +- .../checked_unwrap/simple_conditionals.stderr | 98 +- .../clippy/tests/ui/clear_with_drain.stderr | 146 +- .../clippy/tests/ui/clone_on_copy.stderr | 62 +- .../tests/ui/cloned_instead_of_copied.stderr | 55 +- .../ui/cmp_owned/asymmetric_partial_eq.stderr | 47 +- .../tests/ui/cmp_owned/comparison_flip.stderr | 15 +- .../tests/ui/cmp_owned/with_suggestion.stderr | 41 +- .../tests/ui/collapsible_else_if.stderr | 7 +- .../clippy/tests/ui/collapsible_if.stderr | 14 +- .../tests/ui/collapsible_str_replace.stderr | 97 +- .../tests/ui/comparison_to_empty.stderr | 62 +- .../clippy/tests/ui/crashes/ice-10148.stderr | 9 +- .../clippy/tests/ui/crashes/ice-12616.stderr | 6 +- .../clippy/tests/ui/crashes/ice-360.stderr | 6 +- .../clippy/tests/ui/crashes/ice-5835.stderr | 6 +- .../clippy/tests/ui/crashes/ice-5872.stderr | 6 +- .../clippy/tests/ui/crashes/ice-7169.stderr | 6 +- .../clippy/tests/ui/crashes/ice-8250.stderr | 6 +- .../clippy/tests/ui/crashes/ice-9041.stderr | 6 +- .../clippy/tests/ui/crashes/ice-96721.stderr | 7 +- ...needless_pass_by_value-w-late-bound.stderr | 6 +- .../clippy/tests/ui/crate_in_macro_def.stderr | 6 +- .../ui/crate_level_checks/no_std_swap.stderr | 6 +- src/tools/clippy/tests/ui/create_dir.stderr | 13 +- .../ui/decimal_literal_representation.stderr | 48 +- .../default_constructed_unit_structs.stderr | 47 +- .../ui/default_instead_of_iter_empty.stderr | 20 +- ...efault_instead_of_iter_empty_no_std.stderr | 13 +- .../ui/default_numeric_fallback_f64.stderr | 159 ++- .../ui/default_numeric_fallback_i32.stderr | 194 ++- .../tests/ui/default_trait_access.stderr | 55 +- src/tools/clippy/tests/ui/deref_addrof.stderr | 74 +- .../ui/deref_addrof_double_trigger.stderr | 20 +- .../clippy/tests/ui/deref_by_slicing.stderr | 62 +- .../clippy/tests/ui/derivable_impls.stderr | 85 +- .../ui/derive_partial_eq_without_eq.stderr | 90 +- .../clippy/tests/ui/doc/doc-fixable.stderr | 7 +- .../clippy/tests/ui/double_comparison.stderr | 55 +- .../clippy/tests/ui/drain_collect.stderr | 69 +- .../clippy/tests/ui/duration_subsec.stderr | 34 +- src/tools/clippy/tests/ui/empty_drop.stderr | 19 +- .../empty_enum_variants_with_brackets.stderr | 24 +- .../ui/empty_structs_with_brackets.stderr | 10 +- src/tools/clippy/tests/ui/entry.stderr | 13 +- .../clippy/tests/ui/enum_glob_use.stderr | 20 +- .../clippy/tests/ui/equatable_if_let.stderr | 97 +- src/tools/clippy/tests/ui/err_expect.stderr | 13 +- src/tools/clippy/tests/ui/eta.stderr | 229 ++- .../tests/ui/excessive_precision.stderr | 104 +- .../clippy/tests/ui/expect_fun_call.stderr | 104 +- .../tests/ui/explicit_auto_deref.stderr | 314 ++++- .../tests/ui/explicit_counter_loop.stderr | 61 +- .../tests/ui/explicit_deref_methods.stderr | 83 +- .../tests/ui/explicit_into_iter_loop.stderr | 41 +- .../clippy/tests/ui/explicit_iter_loop.stderr | 125 +- .../clippy/tests/ui/explicit_write.stderr | 90 +- .../clippy/tests/ui/extend_with_drain.stderr | 27 +- .../ui/extra_unused_type_parameters.stderr | 47 +- .../tests/ui/filter_map_bool_then.stderr | 69 +- .../tests/ui/filter_map_identity.stderr | 153 +- .../tests/ui/filter_map_next_fixable.stderr | 13 +- .../clippy/tests/ui/flat_map_identity.stderr | 20 +- .../clippy/tests/ui/flat_map_option.stderr | 13 +- src/tools/clippy/tests/ui/float_cmp.stderr | 30 +- .../clippy/tests/ui/float_cmp_const.stderr | 42 +- .../ui/float_equality_without_abs.stderr | 98 +- .../clippy/tests/ui/floating_point_abs.stderr | 55 +- .../clippy/tests/ui/floating_point_exp.stderr | 34 +- .../tests/ui/floating_point_hypot.stderr | 20 +- .../clippy/tests/ui/floating_point_log.stderr | 201 ++- .../tests/ui/floating_point_logbase.stderr | 34 +- .../tests/ui/floating_point_mul_add.stderr | 90 +- .../tests/ui/floating_point_powf.stderr | 215 ++- .../tests/ui/floating_point_powi.stderr | 97 +- .../clippy/tests/ui/floating_point_rad.stderr | 55 +- .../tests/ui/fn_to_numeric_cast.64bit.stderr | 159 ++- .../tests/ui/fn_to_numeric_cast_any.stderr | 118 +- src/tools/clippy/tests/ui/format.stderr | 97 +- src/tools/clippy/tests/ui/format_args.stderr | 202 ++- .../ui/from_iter_instead_of_collect.stderr | 104 +- .../clippy/tests/ui/from_str_radix_10.stderr | 55 +- src/tools/clippy/tests/ui/get_first.stderr | 34 +- .../clippy/tests/ui/get_last_with_len.stderr | 41 +- src/tools/clippy/tests/ui/get_unwrap.stderr | 118 +- src/tools/clippy/tests/ui/identity_op.stderr | 363 ++++- .../tests/ui/ignored_unit_patterns.stderr | 62 +- .../clippy/tests/ui/implicit_clone.stderr | 76 +- .../clippy/tests/ui/implicit_return.stderr | 104 +- .../tests/ui/implicit_saturating_add.stderr | 167 ++- .../tests/ui/implicit_saturating_sub.stderr | 160 ++- .../ui/inconsistent_digit_grouping.stderr | 68 +- .../ui/inconsistent_struct_constructor.stderr | 13 +- .../tests/ui/ineffective_open_options.stderr | 15 +- .../tests/ui/inefficient_to_string.stderr | 36 +- .../ui/infallible_destructuring_match.stderr | 27 +- .../tests/ui/inline_fn_without_body.stderr | 32 +- src/tools/clippy/tests/ui/int_plus_one.stderr | 27 +- .../clippy/tests/ui/into_iter_on_ref.stderr | 181 ++- .../tests/ui/invalid_null_ptr_usage.stderr | 174 ++- .../tests/ui/is_digit_ascii_radix.stderr | 20 +- src/tools/clippy/tests/ui/issue_2356.stderr | 6 +- .../root_module.stderr | 16 +- .../tests/ui/iter_cloned_collect.stderr | 34 +- src/tools/clippy/tests/ui/iter_count.stderr | 174 ++- .../clippy/tests/ui/iter_filter_is_ok.stderr | 83 +- .../tests/ui/iter_filter_is_some.stderr | 69 +- src/tools/clippy/tests/ui/iter_kv_map.stderr | 251 +++- .../clippy/tests/ui/iter_next_slice.stderr | 27 +- .../clippy/tests/ui/iter_nth_zero.stderr | 20 +- .../tests/ui/iter_on_empty_collections.stderr | 48 +- .../tests/ui/iter_on_single_items.stderr | 41 +- .../tests/ui/iter_overeager_cloned.stderr | 160 ++- .../clippy/tests/ui/iter_skip_next.stderr | 48 +- .../tests/ui/iter_skip_next_unfixable.stderr | 18 +- .../clippy/tests/ui/iter_skip_zero.stderr | 30 +- .../clippy/tests/ui/iter_with_drain.stderr | 41 +- .../clippy/tests/ui/large_const_arrays.stderr | 80 +- .../clippy/tests/ui/large_digit_groups.stderr | 33 +- .../clippy/tests/ui/large_futures.stderr | 41 +- .../ui/large_types_passed_by_value.stderr | 55 +- src/tools/clippy/tests/ui/len_zero.stderr | 180 ++- .../clippy/tests/ui/len_zero_ranges.stderr | 13 +- src/tools/clippy/tests/ui/let_if_seq.stderr | 25 +- src/tools/clippy/tests/ui/let_unit.stderr | 6 +- .../tests/ui/lines_filter_map_ok.stderr | 36 +- src/tools/clippy/tests/ui/literals.stderr | 80 +- .../tests/ui/lossy_float_literal.stderr | 76 +- .../clippy/tests/ui/macro_use_imports.stderr | 27 +- .../tests/ui/manual_assert.edition2018.stderr | 62 +- .../tests/ui/manual_assert.edition2021.stderr | 62 +- src/tools/clippy/tests/ui/manual_bits.stderr | 202 ++- .../tests/ui/manual_c_str_literals.stderr | 90 +- src/tools/clippy/tests/ui/manual_clamp.stderr | 210 ++- .../clippy/tests/ui/manual_filter.stderr | 97 +- .../clippy/tests/ui/manual_filter_map.stderr | 193 ++- src/tools/clippy/tests/ui/manual_find.stderr | 12 +- .../tests/ui/manual_find_fixable.stderr | 80 +- .../clippy/tests/ui/manual_find_map.stderr | 201 ++- .../clippy/tests/ui/manual_flatten.stderr | 72 +- .../tests/ui/manual_float_methods.stderr | 20 +- .../tests/ui/manual_instant_elapsed.stderr | 13 +- .../tests/ui/manual_is_ascii_check.stderr | 174 ++- .../tests/ui/manual_is_variant_and.stderr | 41 +- .../clippy/tests/ui/manual_let_else.stderr | 75 +- .../tests/ui/manual_let_else_match.stderr | 69 +- .../ui/manual_let_else_question_mark.stderr | 41 +- .../tests/ui/manual_main_separator_str.stderr | 27 +- .../clippy/tests/ui/manual_map_option.stderr | 146 +- .../tests/ui/manual_map_option_2.stderr | 28 +- .../manual_memcpy/with_loop_counters.stderr | 69 +- .../without_loop_counters.stderr | 118 +- .../clippy/tests/ui/manual_next_back.stderr | 13 +- .../ui/manual_non_exhaustive_enum.stderr | 20 +- .../ui/manual_non_exhaustive_struct.stderr | 28 +- src/tools/clippy/tests/ui/manual_ok_or.stderr | 26 +- .../ui/manual_pattern_char_comparison.stderr | 69 +- .../tests/ui/manual_range_patterns.stderr | 131 +- .../clippy/tests/ui/manual_rem_euclid.stderr | 68 +- .../clippy/tests/ui/manual_retain.stderr | 265 +++- .../ui/manual_saturating_arithmetic.stderr | 167 ++- .../ui/manual_slice_size_calculation.stderr | 48 +- .../clippy/tests/ui/manual_split_once.stderr | 97 +- .../clippy/tests/ui/manual_str_repeat.stderr | 69 +- .../clippy/tests/ui/manual_string_new.stderr | 62 +- .../tests/ui/manual_swap_auto_fix.stderr | 35 +- .../clippy/tests/ui/manual_try_fold.stderr | 27 +- .../clippy/tests/ui/manual_unwrap_or.stderr | 97 +- .../tests/ui/manual_unwrap_or_default.stderr | 55 +- src/tools/clippy/tests/ui/map_clone.stderr | 105 +- .../tests/ui/map_collect_result_unit.stderr | 13 +- .../tests/ui/map_flatten_fixable.stderr | 48 +- src/tools/clippy/tests/ui/map_identity.stderr | 91 +- .../clippy/tests/ui/map_unwrap_or.stderr | 7 +- .../tests/ui/map_unwrap_or_fixable.stderr | 13 +- src/tools/clippy/tests/ui/match_as_ref.stderr | 20 +- src/tools/clippy/tests/ui/match_bool.stderr | 19 +- .../ui/match_expr_like_matches_macro.stderr | 96 +- .../clippy/tests/ui/match_on_vec_items.stderr | 55 +- .../clippy/tests/ui/match_ref_pats.stderr | 13 +- .../clippy/tests/ui/match_same_arms.stderr | 7 +- .../clippy/tests/ui/match_same_arms2.stderr | 14 +- .../ui/match_same_arms_non_exhaustive.stderr | 12 +- .../tests/ui/match_single_binding.stderr | 77 +- .../match_wildcard_for_single_variants.stderr | 69 +- src/tools/clippy/tests/ui/mem_replace.stderr | 166 ++- .../clippy/tests/ui/mem_replace_no_std.stderr | 47 +- .../clippy/tests/ui/methods_fixable.stderr | 6 +- .../clippy/tests/ui/methods_unfixable.stderr | 6 +- .../clippy/tests/ui/misnamed_getters.stderr | 107 +- .../ui/missing_asserts_for_indexing.stderr | 71 +- .../clippy/tests/ui/missing_spin_loop.stderr | 41 +- .../tests/ui/missing_spin_loop_no_std.stderr | 6 +- .../ui/missing_transmute_annotations.stderr | 75 +- .../tests/ui/mistyped_literal_suffix.stderr | 111 +- .../tests/ui/must_use_candidates.stderr | 34 +- .../clippy/tests/ui/must_use_unit.stderr | 20 +- .../clippy/tests/ui/mut_mutex_lock.stderr | 6 +- .../ui/needless_arbitrary_self_type.stderr | 41 +- ...dless_arbitrary_self_type_unfixable.stderr | 6 +- .../tests/ui/needless_bitwise_bool.stderr | 6 +- .../tests/ui/needless_bool/fixable.stderr | 166 ++- .../tests/ui/needless_bool_assign.stderr | 20 +- .../clippy/tests/ui/needless_borrow.stderr | 195 ++- .../tests/ui/needless_borrow_pat.stderr | 41 +- .../needless_borrows_for_generic_args.stderr | 76 +- .../ui/needless_character_iteration.stderr | 62 +- .../clippy/tests/ui/needless_collect.stderr | 136 +- .../clippy/tests/ui/needless_else.stderr | 8 +- src/tools/clippy/tests/ui/needless_if.stderr | 34 +- .../clippy/tests/ui/needless_match.stderr | 90 +- .../tests/ui/needless_option_as_deref.stderr | 20 +- .../tests/ui/needless_option_take.stderr | 6 +- .../needless_parens_on_range_literals.stderr | 41 +- .../tests/ui/needless_pass_by_ref_mut.stderr | 232 +++- .../tests/ui/needless_pass_by_ref_mut2.stderr | 12 +- .../tests/ui/needless_pass_by_value.stderr | 135 +- .../clippy/tests/ui/needless_pub_self.stderr | 23 +- .../tests/ui/needless_question_mark.stderr | 103 +- .../needless_return_with_question_mark.stderr | 15 +- .../clippy/tests/ui/needless_splitn.stderr | 90 +- src/tools/clippy/tests/ui/neg_multiply.stderr | 55 +- .../clippy/tests/ui/no_effect_return.stderr | 44 +- .../tests/ui/non_canonical_clone_impl.stderr | 33 +- .../ui/non_canonical_partial_ord_impl.stderr | 18 +- ...nonical_partial_ord_impl_fully_qual.stderr | 43 +- .../clippy/tests/ui/non_minimal_cfg.stderr | 27 +- .../ui/non_octal_unix_permissions.stderr | 27 +- .../clippy/tests/ui/nonminimal_bool.stderr | 166 ++- .../tests/ui/nonminimal_bool_methods.stderr | 111 +- .../clippy/tests/ui/numbered_fields.stderr | 20 +- .../clippy/tests/ui/obfuscated_if_else.stderr | 6 +- .../tests/ui/only_used_in_recursion.stderr | 90 +- .../tests/ui/only_used_in_recursion2.stderr | 30 +- src/tools/clippy/tests/ui/op_ref.stderr | 27 +- .../tests/ui/open_options_fixable.stderr | 6 +- .../tests/ui/option_as_ref_deref.stderr | 125 +- .../clippy/tests/ui/option_filter_map.stderr | 55 +- .../clippy/tests/ui/option_if_let_else.stderr | 118 +- .../tests/ui/option_map_or_err_ok.stderr | 6 +- .../clippy/tests/ui/option_map_or_none.stderr | 26 +- .../ui/option_map_unit_fn_fixable.stderr | 170 ++- src/tools/clippy/tests/ui/or_fun_call.stderr | 215 ++- .../clippy/tests/ui/or_then_unwrap.stderr | 20 +- .../tests/ui/overly_complex_bool_expr.stderr | 30 +- .../clippy/tests/ui/partialeq_to_none.stderr | 97 +- .../tests/ui/path_buf_push_overwrite.stderr | 6 +- .../clippy/tests/ui/path_ends_with_ext.stderr | 13 +- src/tools/clippy/tests/ui/patterns.stderr | 20 +- src/tools/clippy/tests/ui/precedence.stderr | 83 +- .../tests/ui/print_in_format_impl.stderr | 48 +- .../tests/ui/println_empty_string.stderr | 39 +- src/tools/clippy/tests/ui/ptr_arg.stderr | 118 +- src/tools/clippy/tests/ui/ptr_as_ptr.stderr | 229 ++- .../clippy/tests/ui/ptr_cast_constness.stderr | 48 +- src/tools/clippy/tests/ui/ptr_eq.stderr | 13 +- .../clippy/tests/ui/ptr_eq_no_std.stderr | 13 +- .../tests/ui/ptr_offset_with_cast.stderr | 13 +- .../clippy/tests/ui/pub_with_shorthand.stderr | 27 +- .../tests/ui/pub_without_shorthand.stderr | 20 +- .../clippy/tests/ui/question_mark.stderr | 118 +- .../clippy/tests/ui/range_contains.stderr | 146 +- .../tests/ui/range_plus_minus_one.stderr | 61 +- src/tools/clippy/tests/ui/rc_buffer.stderr | 55 +- .../clippy/tests/ui/rc_buffer_arc.stderr | 55 +- .../tests/ui/read_line_without_trim.stderr | 56 +- .../clippy/tests/ui/read_zero_byte_vec.stderr | 13 +- .../tests/ui/readonly_write_lock.stderr | 13 +- .../ui/redundant_allocation_fixable.stderr | 72 +- .../clippy/tests/ui/redundant_as_str.stderr | 13 +- .../tests/ui/redundant_async_block.stderr | 67 +- .../tests/ui/redundant_at_rest_pattern.stderr | 41 +- .../clippy/tests/ui/redundant_clone.stderr | 105 +- .../ui/redundant_closure_call_fixable.stderr | 102 +- .../tests/ui/redundant_field_names.stderr | 61 +- ...dundant_pattern_matching_drop_order.stderr | 142 +- ...undant_pattern_matching_if_let_true.stderr | 48 +- .../redundant_pattern_matching_ipaddr.stderr | 139 +- .../redundant_pattern_matching_option.stderr | 209 ++- .../ui/redundant_pattern_matching_poll.stderr | 139 +- .../redundant_pattern_matching_result.stderr | 195 ++- .../tests/ui/redundant_pub_crate.stderr | 143 +- .../clippy/tests/ui/redundant_slicing.stderr | 20 +- .../ui/redundant_static_lifetimes.stderr | 125 +- ...redundant_static_lifetimes_multiple.stderr | 69 +- src/tools/clippy/tests/ui/ref_as_ptr.stderr | 307 +++- .../clippy/tests/ui/ref_option_ref.stderr | 76 +- src/tools/clippy/tests/ui/rename.stderr | 405 +++++- .../tests/ui/renamed_builtin_attr.stderr | 7 +- src/tools/clippy/tests/ui/repeat_once.stderr | 41 +- src/tools/clippy/tests/ui/repl_uninit.stderr | 20 +- .../ui/reserve_after_initialization.stderr | 20 +- .../clippy/tests/ui/result_filter_map.stderr | 27 +- .../tests/ui/result_map_or_into_option.stderr | 20 +- .../ui/result_map_unit_fn_fixable.stderr | 161 ++- .../ui/result_map_unit_fn_unfixable.stderr | 61 +- .../clippy/tests/ui/search_is_some.stderr | 14 +- .../ui/search_is_some_fixable_none.stderr | 370 ++++- .../ui/search_is_some_fixable_some.stderr | 328 ++++- .../clippy/tests/ui/seek_from_current.stderr | 6 +- .../ui/seek_to_start_instead_of_rewind.stderr | 20 +- .../ui/semicolon_if_nothing_returned.stderr | 34 +- .../tests/ui/short_circuit_statement.stderr | 20 +- .../ui/should_panic_without_expect.stderr | 6 +- .../tests/ui/single_char_add_str.stderr | 146 +- .../tests/ui/single_char_pattern.stderr | 244 +++- .../ui/single_component_path_imports.stderr | 13 +- ...component_path_imports_nested_first.stderr | 6 +- .../tests/ui/single_element_loop.stderr | 28 +- src/tools/clippy/tests/ui/single_match.stderr | 105 +- .../ui/slow_vector_initialization.stderr | 90 +- .../tests/ui/stable_sort_primitive.stderr | 42 +- .../clippy/tests/ui/starts_ends_with.stderr | 110 +- .../tests/ui/std_instead_of_core.stderr | 88 +- src/tools/clippy/tests/ui/str_split.stderr | 69 +- .../clippy/tests/ui/str_to_string.stderr | 13 +- src/tools/clippy/tests/ui/string_add.stderr | 13 +- .../clippy/tests/ui/string_add_assign.stderr | 13 +- .../clippy/tests/ui/string_extend.stderr | 27 +- .../tests/ui/string_from_utf8_as_bytes.stderr | 6 +- .../tests/ui/string_lit_as_bytes.stderr | 47 +- .../tests/ui/strlen_on_c_strings.stderr | 48 +- .../ui/suspicious_operation_groupings.stderr | 181 ++- .../tests/ui/suspicious_to_owned.stderr | 13 +- .../ui/suspicious_xor_used_as_pow.stderr | 47 +- src/tools/clippy/tests/ui/swap.stderr | 108 +- .../clippy/tests/ui/swap_ptr_to_ref.stderr | 27 +- .../tests/ui/tabs_in_doc_comments.stderr | 55 +- ...local_initializer_can_be_made_const.stderr | 41 +- .../clippy/tests/ui/to_digit_is_some.stderr | 13 +- .../clippy/tests/ui/toplevel_ref_arg.stderr | 40 +- .../clippy/tests/ui/trailing_zeros.stderr | 13 +- .../ui/trait_duplication_in_bounds.stderr | 62 +- src/tools/clippy/tests/ui/transmute.stderr | 226 ++- .../tests/ui/transmute_float_to_int.stderr | 41 +- .../tests/ui/transmute_int_to_char.stderr | 13 +- .../ui/transmute_int_to_char_no_std.stderr | 13 +- .../tests/ui/transmute_int_to_non_zero.stderr | 69 +- .../tests/ui/transmute_ptr_to_ptr.stderr | 48 +- .../tests/ui/transmute_ptr_to_ref.stderr | 153 +- .../tests/ui/transmute_ref_to_ref.stderr | 20 +- .../ui/transmute_ref_to_ref_no_std.stderr | 20 +- ...transmutes_expressible_as_ptr_casts.stderr | 67 +- .../tests/ui/trim_split_whitespace.stderr | 63 +- .../ui/trivially_copy_pass_by_ref.stderr | 125 +- src/tools/clippy/tests/ui/try_err.stderr | 74 +- .../clippy/tests/ui/type_id_on_box.stderr | 32 +- src/tools/clippy/tests/ui/types.stderr | 6 +- .../ui/unchecked_duration_subtraction.stderr | 27 +- src/tools/clippy/tests/ui/unicode.stderr | 52 +- .../tests/ui/unit_arg_empty_blocks.stderr | 17 +- src/tools/clippy/tests/ui/unit_hash.stderr | 18 +- .../tests/ui/unknown_clippy_lints.stderr | 48 +- .../tests/ui/unnecessary_box_returns.stderr | 24 +- .../clippy/tests/ui/unnecessary_cast.stderr | 286 +++- .../ui/unnecessary_cast_unfixable.stderr | 13 +- .../tests/ui/unnecessary_clippy_cfg.stderr | 27 +- .../clippy/tests/ui/unnecessary_clone.stderr | 61 +- ...sary_fallible_conversions_unfixable.stderr | 36 +- .../clippy/tests/ui/unnecessary_fold.stderr | 110 +- .../ui/unnecessary_get_then_check.stderr | 79 +- .../tests/ui/unnecessary_iter_cloned.stderr | 7 +- .../clippy/tests/ui/unnecessary_join.stderr | 13 +- .../tests/ui/unnecessary_lazy_eval.stderr | 566 +++++--- .../ui/unnecessary_lazy_eval_unfixable.stderr | 35 +- .../ui/unnecessary_literal_unwrap.stderr | 28 +- ...nnecessary_literal_unwrap_unfixable.stderr | 14 +- .../ui/unnecessary_map_on_constructor.stderr | 55 +- .../tests/ui/unnecessary_min_or_max.stderr | 118 +- .../tests/ui/unnecessary_operation.stderr | 132 +- .../ui/unnecessary_owned_empty_strings.stderr | 13 +- .../ui/unnecessary_result_map_or_else.stderr | 27 +- .../tests/ui/unnecessary_self_imports.stderr | 16 +- .../tests/ui/unnecessary_sort_by.stderr | 83 +- .../unnecessary_struct_initialization.stderr | 41 +- .../tests/ui/unnecessary_to_owned.stderr | 593 ++++++-- .../ui/unnecessary_to_owned_on_split.stderr | 62 +- .../tests/ui/unneeded_wildcard_pattern.stderr | 111 +- .../clippy/tests/ui/unreadable_literal.stderr | 69 +- .../ui/unseparated_prefix_literals.stderr | 61 +- .../clippy/tests/ui/unused_rounding.stderr | 34 +- src/tools/clippy/tests/ui/unused_unit.stderr | 150 +- src/tools/clippy/tests/ui/unwrap_or.stderr | 13 +- .../tests/ui/unwrap_or_else_default.stderr | 111 +- .../tests/ui/upper_case_acronyms.stderr | 83 +- src/tools/clippy/tests/ui/use_self.stderr | 300 +++- .../clippy/tests/ui/use_self_trait.stderr | 111 +- .../clippy/tests/ui/useless_asref.stderr | 125 +- .../clippy/tests/ui/useless_attribute.stderr | 20 +- .../clippy/tests/ui/useless_conversion.stderr | 186 ++- src/tools/clippy/tests/ui/vec.stderr | 146 +- .../clippy/tests/ui/vec_box_sized.stderr | 62 +- .../clippy/tests/ui/vec_init_then_push.stderr | 55 +- .../clippy/tests/ui/vec_resize_to_zero.stderr | 8 +- .../clippy/tests/ui/waker_clone_wake.stderr | 13 +- .../clippy/tests/ui/while_let_loop.stderr | 34 +- .../tests/ui/while_let_on_iterator.stderr | 188 ++- .../tests/ui/wildcard_enum_match_arm.stderr | 41 +- .../clippy/tests/ui/wildcard_imports.stderr | 153 +- .../wildcard_imports_2021.edition2018.stderr | 153 +- .../wildcard_imports_2021.edition2021.stderr | 153 +- .../tests/ui/writeln_empty_string.stderr | 19 +- src/tools/clippy/tests/ui/zero_ptr.stderr | 34 +- .../clippy/tests/ui/zero_ptr_no_std.stderr | 20 +- .../tests/ui/zero_repeat_side_effects.stderr | 83 +- tests/rustdoc-ui/check-cfg.stderr | 6 +- tests/rustdoc-ui/doc-cfg.stderr | 14 +- .../rustdoc-ui/doc-include-suggestion.stderr | 6 +- .../rustdoc-ui/doctest/display-output.stdout | 13 +- ...led-doctest-extra-semicolon-on-item.stdout | 7 +- .../doctest/non-local-defs-impl.stdout | 6 +- tests/rustdoc-ui/invalid-cfg.stderr | 7 +- .../invalid_const_in_lifetime_position.stderr | 27 +- tests/rustdoc-ui/lints/doc-spotlight.stderr | 6 +- .../lints/renamed-lint-still-applies.stderr | 13 +- .../lints/unknown-renamed-lints.stderr | 34 +- tests/rustdoc-ui/mismatched_arg_count.stderr | 9 +- .../qualified_ty_ty_ctxt.stderr | 13 +- .../internal-lints/rustc_pass_by_value.stderr | 139 +- .../internal-lints/ty_tykind_usage.stderr | 218 ++- .../session-diagnostic/diagnostic-derive.rs | 8 +- .../diagnostic-derive.stderr | 21 +- .../subdiagnostic-derive.rs | 8 +- .../subdiagnostic-derive.stderr | 8 +- ...cv-discoverability-guidance.riscv32.stderr | 18 +- ...cv-discoverability-guidance.riscv64.stderr | 18 +- tests/ui/allocator/allocator-args.stderr | 7 +- .../anon-params/anon-params-deprecated.stderr | 18 +- tests/ui/argument-suggestions/basic.stderr | 10 +- .../argument-suggestions/exotic-calls.stderr | 40 +- .../extra_arguments.stderr | 169 ++- .../argument-suggestions/issue-100154.stderr | 9 +- .../argument-suggestions/issue-109831.stderr | 7 +- ...uggest-better-removing-issue-126246.stderr | 60 +- .../suggest-array-length.stderr | 42 +- tests/ui/asm/issue-89305.stderr | 6 +- .../asm/naked-functions-unused.x86_64.stderr | 69 +- tests/ui/asm/parse-error.stderr | 40 +- tests/ui/asm/type-check-1.stderr | 24 +- tests/ui/asm/x86_64/x86_64_parse_error.stderr | 24 +- .../assoc-const-eq-missing.stderr | 14 +- .../assoc-inherent-no-body.stderr | 9 +- .../issue-109299.stderr | 9 +- ...fers-shadowing-trait-item.uncovered.stderr | 7 +- .../ui/associated-inherent-types/style.stderr | 6 +- .../substitute-params-bad.stderr | 7 +- ...guous-associated-type-with-generics.stderr | 7 +- .../associated-item-duplicate-names-3.stderr | 7 +- tests/ui/associated-item/issue-87638.stderr | 20 +- .../issue-71443-1.stderr | 7 +- .../overlaping-bound-suggestion.stderr | 7 +- .../bad-inputs-and-output.stderr | 22 +- .../return-type-notation/missing.stderr | 7 +- ...sociated-types-in-ambiguous-context.stderr | 14 +- .../associated-types-incomplete-object.stderr | 21 +- .../defaults-specialization.stderr | 18 +- tests/ui/associated-types/issue-19883.stderr | 10 +- tests/ui/associated-types/issue-22037.stderr | 10 +- .../ui/associated-types/issue-23595-1.stderr | 7 +- .../ui/associated-types/issue-23595-2.stderr | 7 +- ...t-precise-captures-we-are-powerless.stderr | 8 +- .../async-await/async-fn/impl-header.stderr | 5 +- ...015-edition-error-various-positions.stderr | 60 +- .../await-keyword/2015-edition-warning.stderr | 36 +- .../incorrect-syntax-suggestions.stderr | 144 +- ...-ice-attempted-to-add-with-overflow.stderr | 10 +- .../drop-track-bad-field-in-fru.stderr | 10 +- .../in-trait/bad-signatures.stderr | 10 +- tests/ui/async-await/issue-101715.stderr | 9 +- tests/ui/async-await/issue-74047.stderr | 10 +- .../async-await/issues/issue-63388-1.stderr | 8 +- .../async-await/issues/issue-63388-2.stderr | 8 +- tests/ui/async-await/no-async-const.stderr | 9 +- tests/ui/async-await/no-unsafe-async.stderr | 18 +- .../async-closure-gate.afn.stderr | 12 +- .../async-closure-gate.nofeat.stderr | 12 +- tests/ui/async-await/unnecessary-await.stderr | 20 +- tests/ui/async-await/unused-lifetime.stderr | 51 +- tests/ui/attributes/issue-90873.stderr | 7 +- tests/ui/attributes/rustc_confusables.stderr | 7 +- .../auto-traits/auto-trait-validation.stderr | 35 +- .../ui/auto-traits/bad-generics-on-dyn.stderr | 8 +- tests/ui/auto-traits/has-arguments.stderr | 8 +- tests/ui/auto-traits/issue-117789.stderr | 8 +- .../auto-traits/issue-23080-2.current.stderr | 8 +- .../ui/auto-traits/issue-23080-2.next.stderr | 8 +- tests/ui/auto-traits/issue-23080.stderr | 18 +- tests/ui/auto-traits/issue-84075.stderr | 8 +- .../typeck-auto-trait-no-supertraits-2.stderr | 16 +- .../typeck-auto-trait-no-supertraits.stderr | 8 +- tests/ui/blind/blind-item-block-middle.stderr | 6 +- .../block-must-not-have-result-while.stderr | 6 +- .../consider-removing-last-semi.stderr | 27 +- tests/ui/block-result/issue-11714.stderr | 8 +- tests/ui/block-result/issue-13428.stderr | 8 +- tests/ui/block-result/issue-20862.stderr | 6 +- .../borrowck/generic_const_early_param.stderr | 17 +- ...ice-mutability-error-slicing-121807.stderr | 6 +- ...issue-109271-pass-self-into-closure.stderr | 12 +- tests/ui/borrowck/issue-82032.stderr | 10 +- ...ssue-82126-mismatched-subst-and-hir.stderr | 18 +- tests/ui/borrowck/mut-borrow-in-loop.stderr | 6 +- ...ruct-pattern-box-pattern-ice-121463.stderr | 20 +- .../trait-impl-argument-difference-ice.stderr | 6 +- tests/ui/c-variadic/issue-32201.stderr | 7 +- tests/ui/c-variadic/variadic-ffi-1.stderr | 42 +- tests/ui/cast/cast-char.stderr | 13 +- tests/ui/cast/cast-to-slice.stderr | 18 +- ...-to-unsized-trait-object-suggestion.stderr | 18 +- .../ice-cast-type-with-error-124848.stderr | 25 +- tests/ui/check-cfg/cargo-build-script.stderr | 9 +- tests/ui/check-cfg/cargo-feature.none.stderr | 14 +- tests/ui/check-cfg/cargo-feature.some.stderr | 14 +- .../check-cfg/cfg-value-for-cfg-name.stderr | 6 +- tests/ui/check-cfg/diagnotics.cargo.stderr | 29 +- tests/ui/check-cfg/diagnotics.rustc.stderr | 29 +- tests/ui/check-cfg/empty-values.stderr | 14 +- .../exhaustive-names-values.empty_cfg.stderr | 9 +- .../exhaustive-names-values.feature.stderr | 9 +- .../exhaustive-names-values.full.stderr | 9 +- .../exhaustive-values.empty_cfg.stderr | 9 +- .../exhaustive-values.without_names.stderr | 9 +- tests/ui/check-cfg/mix.stderr | 18 +- .../check-cfg/no-expected-values.empty.stderr | 18 +- .../check-cfg/no-expected-values.mixed.stderr | 18 +- .../no-expected-values.simple.stderr | 18 +- tests/ui/check-cfg/unexpected-cfg-name.stderr | 6 +- .../ui/check-cfg/unexpected-cfg-value.stderr | 8 +- .../ui/check-cfg/values-none.explicit.stderr | 18 +- .../ui/check-cfg/values-none.implicit.stderr | 18 +- tests/ui/check-cfg/well-known-names.stderr | 6 +- tests/ui/check-cfg/well-known-values.stderr | 125 +- .../2229_closure_analysis/bad-pattern.stderr | 5 +- .../migrations/old_name.stderr | 6 +- ...ture-pattern-closure-within-closure.stderr | 13 +- .../run_pass/destructure_patterns.stderr | 34 +- tests/ui/closures/issue-90871.stderr | 7 +- .../old-closure-expr-precedence.stderr | 7 +- ...closure-expression-remove-semicolon.stderr | 7 +- tests/ui/codemap_tests/tab.stderr | 7 +- tests/ui/codemap_tests/unicode_3.stderr | 6 +- .../coercion/coerce-loop-issue-122561.stderr | 13 +- ...coercion-missing-tail-expected-type.stderr | 15 +- tests/ui/coercion/issue-73886.stderr | 6 +- tests/ui/compare-method/bad-self-type.stderr | 18 +- tests/ui/compare-method/issue-90444.stderr | 18 +- .../reordered-type-param.stderr | 10 +- .../run-rustfix-revisions.foo.stderr | 6 +- .../ui-testing-optout.stderr | 14 +- .../cfg-attr-parse.stderr | 6 +- .../cfg-attr-syntax-validation.stderr | 31 +- .../cfg_accessible-input-validation.stderr | 14 +- .../issue-2392.stderr | 20 +- .../transmutable-ice-110969.stderr | 10 +- tests/ui/const-generics/argument_order.stderr | 7 +- .../assoc_const_eq_diagnostic.stderr | 20 +- .../const-param-before-other-params.stderr | 7 +- .../const-parameter-uppercase-lint.stderr | 6 +- .../defaults/intermixed-lifetime.stderr | 14 +- ...ram-order-err-pretty-prints-default.stderr | 7 +- .../early/const-param-from-outer-fn.stderr | 6 +- .../early/invalid-const-arguments.stderr | 9 +- .../generic_arg_infer/in-signature.stderr | 73 +- .../generic_arg_infer/infer-arg-test.stderr | 9 +- .../const_kind_expr/issue_114151.stderr | 9 +- .../generic_const_exprs/error_in_ty.stderr | 7 +- .../generic_const_exprs/issue-102768.stderr | 27 +- .../unevaluated-const-ice-119731.stderr | 44 +- .../unresolved_lifetimes_error.stderr | 7 +- ...ice-unexpected-inference-var-122549.stderr | 9 +- .../incorrect-number-of-const-args.stderr | 9 +- .../invalid-const-arg-for-type-param.stderr | 9 +- .../invalid-constant-in-args.stderr | 10 +- tests/ui/const-generics/invalid-enum.stderr | 30 +- tests/ui/const-generics/kind_mismatch.stderr | 18 +- .../legacy-const-generics-bad.stderr | 7 +- .../occurs-check/unused-substs-3.stderr | 9 +- .../suggest_const_for_array.stderr | 14 +- ...e-type-mismatch-when-copying-112824.stderr | 9 +- tests/ui/constructor-lifetime-args.stderr | 18 +- .../consts/array-literal-len-mismatch.stderr | 9 +- tests/ui/consts/const-array-oob-arith.stderr | 18 +- .../ui/consts/const-blocks/trait-error.stderr | 9 +- .../ui/consts/const-eval/issue-104390.stderr | 21 +- tests/ui/consts/const-fn-in-vec.stderr | 27 +- tests/ui/consts/const-fn-mismatch.stderr | 11 +- tests/ui/consts/const-fn-not-in-trait.stderr | 22 +- .../consts/const-pattern-irrefutable.stderr | 15 +- tests/ui/consts/effect_param.stderr | 40 +- tests/ui/consts/issue-104768.stderr | 10 +- tests/ui/consts/issue-3521.stderr | 8 +- tests/ui/consts/issue-54954.stderr | 11 +- tests/ui/consts/issue-91560.stderr | 16 +- .../ui/consts/missing_assoc_const_type.stderr | 7 +- .../consts/missing_assoc_const_type2.stderr | 7 +- .../ui/consts/non-const-value-in-const.stderr | 17 +- tests/ui/coroutine/type-mismatch-error.stderr | 11 +- tests/ui/coroutine/unresolved-ct-var.stderr | 11 +- tests/ui/coverage-attr/bad-syntax.stderr | 25 +- tests/ui/cross-crate/unit-struct.stderr | 7 +- tests/ui/delegation/bad-resolve.stderr | 17 +- tests/ui/delegation/explicit-paths.stderr | 20 +- tests/ui/delegation/target-expr.stderr | 7 +- .../ui/deprecation/deprecation-sanity.stderr | 24 +- .../deriving-meta-unknown-trait.stderr | 13 +- .../note-unsupported.stderr | 8 +- .../struct_destructure_fail.stderr | 8 +- tests/ui/did_you_mean/E0178.stderr | 21 +- tests/ui/did_you_mean/issue-105225.stderr | 21 +- ...1679-tilde-bitwise-negation-attempt.stderr | 43 +- ...issue-43871-enum-instead-of-variant.stderr | 18 +- ...-identifier-not-instead-of-negation.stderr | 43 +- ...sue-54109-and_instead_of_ampersands.stderr | 48 +- .../issue-54109-without-witness.stderr | 48 +- tests/ui/did_you_mean/println-typo.stderr | 7 +- tests/ui/did_you_mean/pub-macro-rules.stderr | 7 +- ...reference-without-parens-suggestion.stderr | 14 +- .../did_you_mean/use_instead_of_import.stderr | 28 +- tests/ui/drop/missing-drop-method.stderr | 5 +- ...dyn-2015-edition-keyword-ident-lint.stderr | 84 +- .../edition-extern-crate-allowed.stderr | 6 +- tests/ui/empty/empty-attributes.stderr | 56 +- .../ui/empty/empty-struct-braces-expr.stderr | 27 +- tests/ui/empty/empty-struct-tuple-pat.stderr | 27 +- tests/ui/empty/empty-struct-unit-pat.stderr | 14 +- tests/ui/enum/enum-variant-type-2.stderr | 10 +- tests/ui/enum/nested-enum.stderr | 30 +- .../error-recovery-issue-55897.stderr | 10 +- tests/ui/error-codes/E0057.stderr | 10 +- tests/ui/error-codes/E0107.stderr | 72 +- tests/ui/error-codes/E0121.stderr | 20 +- tests/ui/error-codes/E0191.stderr | 7 +- tests/ui/error-codes/E0220.stderr | 14 +- tests/ui/error-codes/E0223.stderr | 7 +- tests/ui/error-codes/E0261.stderr | 16 +- tests/ui/error-codes/E0401.stderr | 17 +- tests/ui/error-codes/E0407.stderr | 10 +- tests/ui/error-codes/E0435.stderr | 7 +- tests/ui/error-codes/E0449.stderr | 21 +- tests/ui/error-codes/E0565-2.stderr | 10 +- tests/ui/error-codes/E0586.stderr | 6 +- tests/ui/error-codes/E0604.stderr | 10 +- tests/ui/error-codes/E0617.stderr | 35 +- tests/ui/error-codes/E0620.stderr | 9 +- tests/ui/error-festival.stderr | 17 +- ...emap-path-prefix-reverse.local-self.stderr | 7 +- ...p-path-prefix-reverse.remapped-self.stderr | 7 +- tests/ui/expr/if/attrs/else-attrs.stderr | 9 +- tests/ui/expr/if/bad-if-let-suggestion.stderr | 28 +- tests/ui/expr/if/if-else-type-mismatch.stderr | 22 +- tests/ui/expr/issue-22933-2.stderr | 10 +- tests/ui/extern/extern-const.stderr | 8 +- .../ui/extern/extern-ffi-fn-with-body.stderr | 17 +- tests/ui/extern/extern-no-mangle.stderr | 12 +- ...extern-item-where-clauses-debug-ice.stderr | 7 +- tests/ui/extern/issue-47725.stderr | 7 +- tests/ui/extern/issue-95829.stderr | 26 +- ...gate-dispatch-from-dyn-missing-impl.stderr | 14 +- .../feature-gate-extern_absolute_paths.stderr | 10 +- ...ature-gate-generic_arg_infer.normal.stderr | 6 +- .../feature-gate-min_const_fn.stderr | 33 +- .../feature-gate-negate-unsigned.stderr | 9 +- .../feature-gate-never_patterns.stderr | 43 +- .../feature-gate-offset-of-enum.stderr | 10 +- ...-gate-unboxed-closures-manual-impls.stderr | 28 +- .../ui/feature-gates/gated-bad-feature.stderr | 28 +- ...issue-43106-gating-of-builtin-attrs.stderr | 13 +- .../format-args-capture-issue-102057.stderr | 35 +- .../format-args-capture-issue-94010.stderr | 14 +- tests/ui/fmt/format-string-error-2.stderr | 7 +- tests/ui/fmt/ifmt-bad-arg.stderr | 8 +- .../no-inline-literals-out-of-range.stderr | 6 +- tests/ui/fmt/raw-idents.stderr | 30 +- tests/ui/fn/fn-compare-mismatch.stderr | 5 +- tests/ui/fn/fn-item-type.stderr | 20 +- tests/ui/fn/fn-pointer-mismatch.stderr | 15 +- tests/ui/fn/fn-recover-return-sign.stderr | 28 +- tests/ui/fn/fn-recover-return-sign2.stderr | 7 +- tests/ui/fn/issue-80179.stderr | 19 +- tests/ui/fn/suggest-return-closure.stderr | 27 +- tests/ui/fn/suggest-return-future.stderr | 20 +- .../label_break_value_invalid.stderr | 10 +- ...-74120-lowering-of-ffi-block-bodies.stderr | 18 +- .../issue-91370-foreign-fn-block-impl.stderr | 19 +- .../ui/future-incompatible-lint-group.stderr | 6 +- .../equality-bound.stderr | 52 +- .../gat-trait-path-parenthesised-args.stderr | 37 +- .../issue-70304.stderr | 8 +- .../issue-80433.stderr | 8 +- .../issue-86787.stderr | 8 +- .../missing-item-sugg.rs | 2 +- .../missing-item-sugg.stderr | 5 +- .../parameter_number_and_kind.stderr | 18 +- ...it-path-type-error-once-implemented.stderr | 27 +- .../self-outlives-lint.stderr | 128 +- .../assoc-const-missing-type.stderr | 14 +- .../generics/bad-mid-path-type-params.stderr | 45 +- .../generics/foreign-generic-mismatch.stderr | 9 +- .../generic-arg-mismatch-recover.stderr | 27 +- .../generics/generic-extern-lifetime.stderr | 9 +- ...eric-impl-more-params-with-defaults.stderr | 9 +- tests/ui/generics/generic-no-mangle.stderr | 118 +- ...eric-type-more-params-with-defaults.stderr | 9 +- ...declared-in-wrong-spot-issue-113073.stderr | 9 +- tests/ui/generics/issue-59508-1.stderr | 7 +- tests/ui/generics/issue-59508.stderr | 7 +- ...0512-param-reordering-with-defaults.stderr | 7 +- tests/ui/generics/issue-83556.stderr | 7 +- .../generics/issue-95208-ignore-qself.stderr | 9 +- tests/ui/generics/issue-95208.stderr | 9 +- tests/ui/generics/issue-98432.stderr | 9 +- .../lifetime-before-type-params.stderr | 28 +- ...ingle-colon-path-not-const-generics.stderr | 6 +- tests/ui/generics/wrong-number-of-args.stderr | 256 ++-- ...pats-inclusive-dotdotdot-bad-syntax.stderr | 34 +- ...lf-open-range-pats-inclusive-no-end.stderr | 36 +- ...pen-range-pats-ref-ambiguous-interp.stderr | 54 +- tests/ui/hygiene/assoc_item_ctxt.stderr | 9 +- .../hygiene/rustc-macro-transparency.stderr | 10 +- tests/ui/illegal-ufcs-drop.stderr | 10 +- .../impl-trait/associated-type-cycle.stderr | 7 +- .../explicit-generic-args-for-impl.stderr | 9 +- .../extra-impl-in-trait-impl.stderr | 14 +- .../impl-fn-parsing-ambiguities.stderr | 14 +- .../impl-generic-mismatch-ab.stderr | 10 +- .../impl-trait-plus-priority.stderr | 70 +- .../in-assoc-type-unconstrained.stderr | 9 +- .../in-trait/default-body-type-err-2.stderr | 9 +- .../impl-trait/in-trait/gat-outlives.stderr | 16 +- .../method-signature-matches.lt.stderr | 10 +- .../method-signature-matches.mismatch.stderr | 9 +- ...od-signature-matches.mismatch_async.stderr | 9 +- .../opaque-and-lifetime-mismatch.stderr | 36 +- .../in-trait/specialization-broken.stderr | 9 +- .../must_outlive_least_region_or_bound.stderr | 9 +- .../opaque-used-in-extraneous-argument.stderr | 32 +- .../precise-capturing/bad-lifetimes.stderr | 9 +- .../precise-capturing/redundant.normal.stderr | 19 +- ...s-impl-trait-declaration-too-subtle.stderr | 18 +- tests/ui/impl-trait/trait_type.stderr | 14 +- tests/ui/impl-trait/where-allowed.stderr | 9 +- tests/ui/imports/extern-crate-used.stderr | 7 +- tests/ui/imports/glob-resolve1.stderr | 18 +- tests/ui/imports/import.stderr | 10 +- tests/ui/imports/issue-52891.stderr | 49 +- tests/ui/imports/issue-55457.stderr | 10 +- .../ui/imports/resolve_self_super_hint.stderr | 34 +- .../shadow-glob-module-resolution-2.stderr | 10 +- tests/ui/indexing/index_message.stderr | 7 +- tests/ui/inference/array-len-mismatch.stderr | 16 +- tests/ui/inference/deref-suggestion.stderr | 9 +- ...r-var-leaked-out-of-rollback-122098.stderr | 19 +- tests/ui/inference/issue-107090.stderr | 25 +- ...suggest-add-return-to-coerce-ret-ty.stderr | 20 +- tests/ui/inference/stmts-as-exp-105431.stderr | 56 +- .../diagnostics_incorrect.stderr | 7 +- .../query_stability_incorrect.stderr | 7 +- .../rustc_pass_by_value_self.stderr | 34 +- .../invalid/invalid-crate-type-macro.stderr | 7 +- tests/ui/invalid/invalid-crate-type.stderr | 56 +- ...stc_legacy_const_generics-arguments.stderr | 14 +- tests/ui/invalid_crate_type_syntax.stderr | 7 +- tests/ui/issues/issue-13058.stderr | 8 +- tests/ui/issues/issue-14285.stderr | 7 +- tests/ui/issues/issue-15034.stderr | 7 +- tests/ui/issues/issue-16048.stderr | 6 +- tests/ui/issues/issue-16939.stderr | 10 +- tests/ui/issues/issue-17441.stderr | 18 +- tests/ui/issues/issue-17999.stderr | 13 +- tests/ui/issues/issue-18423.stderr | 10 +- tests/ui/issues/issue-19086.stderr | 7 +- tests/ui/issues/issue-19100.stderr | 13 +- tests/ui/issues/issue-19482.stderr | 7 +- tests/ui/issues/issue-20225.stderr | 27 +- tests/ui/issues/issue-21332.stderr | 9 +- tests/ui/issues/issue-21950.stderr | 7 +- tests/ui/issues/issue-22434.stderr | 7 +- tests/ui/issues/issue-22599.stderr | 6 +- tests/ui/issues/issue-23024.stderr | 13 +- tests/ui/issues/issue-23217.stderr | 10 +- tests/ui/issues/issue-27042.stderr | 6 +- tests/ui/issues/issue-27433.stderr | 9 +- tests/ui/issues/issue-27842.stderr | 7 +- tests/ui/issues/issue-28344.stderr | 14 +- tests/ui/issues/issue-28433.stderr | 14 +- tests/ui/issues/issue-2848.stderr | 6 +- tests/ui/issues/issue-28971.stderr | 10 +- tests/ui/issues/issue-3154.stderr | 7 +- tests/ui/issues/issue-32004.stderr | 7 +- tests/ui/issues/issue-32086.stderr | 14 +- tests/ui/issues/issue-32655.stderr | 13 +- tests/ui/issues/issue-3344.stderr | 5 +- tests/ui/issues/issue-33504.stderr | 6 +- tests/ui/issues/issue-34209.stderr | 7 +- tests/ui/issues/issue-3521-2.stderr | 9 +- .../issue-3668-2.stderr | 9 +- .../issue-3668.stderr | 9 +- tests/ui/issues/issue-40288-2.stderr | 16 +- tests/ui/issues/issue-40782.stderr | 14 +- tests/ui/issues/issue-4265.stderr | 9 +- tests/ui/issues/issue-43988.stderr | 14 +- tests/ui/issues/issue-44239.stderr | 8 +- tests/ui/issues/issue-45562.stderr | 8 +- tests/ui/issues/issue-46332.stderr | 7 +- tests/ui/issues/issue-4935.stderr | 10 +- tests/ui/issues/issue-4968.stderr | 5 +- tests/ui/issues/issue-5100.stderr | 7 +- tests/ui/issues/issue-51102.stderr | 10 +- tests/ui/issues/issue-52717.stderr | 10 +- tests/ui/issues/issue-53251.stderr | 18 +- tests/ui/issues/issue-56199.stderr | 14 +- tests/ui/issues/issue-56835.stderr | 7 +- .../issue-57741.stderr | 36 +- .../issue-5997-enum.stderr | 9 +- .../issue-5997-struct.stderr | 9 +- tests/ui/issues/issue-60622.stderr | 9 +- tests/ui/issues/issue-63983.stderr | 7 +- .../issue-64792-bad-unicode-ctor.stderr | 7 +- .../issue-66667-function-cmp-cycle.stderr | 21 +- tests/ui/issues/issue-66706.stderr | 18 +- tests/ui/issues/issue-75283.stderr | 17 +- tests/ui/issues/issue-81584.stderr | 5 +- tests/ui/issues/issue-pr29383.stderr | 14 +- .../iterators/into-iter-on-arrays-2018.stderr | 18 +- .../iterators/into-iter-on-arrays-lint.stderr | 48 +- .../into-iter-on-boxed-slices-2021.stderr | 18 +- .../into-iter-on-boxed-slices-lint.stderr | 12 +- tests/ui/label/label_misspelled.stderr | 60 +- tests/ui/label/label_misspelled_2.stderr | 34 +- tests/ui/lang-items/issue-83471.stderr | 6 +- .../mismatched_arg_count.stderr | 9 +- .../leading-where-clause.stderr | 7 +- .../ui/let-else/let-else-allow-in-expr.stderr | 13 +- .../ui/let-else/let-else-allow-unused.stderr | 6 +- tests/ui/let-else/let-else-check.stderr | 13 +- .../let-else-missing-semicolon.stderr | 14 +- .../ui/let-else/let-else-then-diverge.stderr | 6 +- ...-bare-cr-string-literal-doc-comment.stderr | 7 +- tests/ui/lifetimes/issue-107988.stderr | 9 +- .../issue-83907-invalid-fn-like-path.stderr | 9 +- tests/ui/lifetimes/issue-95023.stderr | 27 +- tests/ui/lifetimes/issue-97193.stderr | 19 +- tests/ui/lifetimes/issue-97194.stderr | 20 +- .../42701_one_named_and_one_anonymous.stderr | 8 +- ...existing-name-early-bound-in-struct.stderr | 8 +- ...-return-one-existing-name-if-else-2.stderr | 7 +- ...-return-one-existing-name-if-else-3.stderr | 7 +- ...-existing-name-if-else-using-impl-2.stderr | 7 +- ...-existing-name-if-else-using-impl-3.stderr | 8 +- ...x1-return-one-existing-name-if-else.stderr | 7 +- .../ex2a-push-one-existing-name-2.stderr | 7 +- ...-push-one-existing-name-early-bound.stderr | 8 +- .../ex2a-push-one-existing-name.stderr | 7 +- .../ui/lifetimes/noisy-follow-up-erro.stderr | 17 +- ...ime-used-in-debug-macro-issue-70152.stderr | 13 +- tests/ui/lint/bare-trait-objects-path.stderr | 7 +- .../lint/command-line-lint-group-deny.stderr | 6 +- .../command-line-lint-group-forbid.stderr | 6 +- .../lint/command-line-lint-group-warn.stderr | 6 +- tests/ui/lint/dead-code/issue-85071-2.stderr | 6 +- tests/ui/lint/dead-code/issue-85071.stderr | 6 +- .../ui/lint/deny-overflowing-literals.stderr | 7 +- .../lint/enable-unstable-lib-feature.stderr | 6 +- tests/ui/lint/expr_attr_paren_order.stderr | 6 +- tests/ui/lint/forbid-group-group-1.stderr | 6 +- ...s-warn-allowed-warn-by-default-lint.stderr | 6 +- .../lint-group-allow-warnings.stderr | 6 +- tests/ui/lint/function-item-references.stderr | 230 ++- .../ui/lint/future-incompat-json-test.stderr | 7 +- tests/ui/lint/future-incompat-test.stderr | 7 +- .../group-forbid-always-trumps-cli.stderr | 6 +- .../inclusive-range-pattern-syntax.stderr | 12 +- tests/ui/lint/issue-103317.stderr | 8 +- tests/ui/lint/issue-109529.stderr | 8 +- tests/ui/lint/issue-17718-const-naming.stderr | 6 +- tests/ui/lint/issue-30302.stderr | 6 +- tests/ui/lint/issue-83477.stderr | 13 +- tests/ui/lint/issue-97094.stderr | 6 +- .../ui/lint/lint-attr-everywhere-early.stderr | 90 +- .../ui/lint/lint-attr-everywhere-late.stderr | 18 +- tests/ui/lint/lint-change-warnings.stderr | 18 +- .../lint/lint-group-nonstandard-style.stderr | 30 +- tests/ui/lint/lint-impl-fn.stderr | 18 +- ...lint-lowercase-static-const-pattern.stderr | 20 +- tests/ui/lint/lint-malformed.stderr | 7 +- tests/ui/lint/lint-match-arms-2.stderr | 6 +- tests/ui/lint/lint-match-arms.stderr | 6 +- .../ui/lint/lint-non-camel-case-types.stderr | 62 +- ...lint-non-uppercase-associated-const.stderr | 6 +- .../ui/lint/lint-non-uppercase-statics.stderr | 13 +- ...int-non-uppercase-trait-assoc-const.stderr | 6 +- .../lint-nonstandard-style-unicode-1.stderr | 48 +- .../lint-nonstandard-style-unicode-3.stderr | 6 +- .../lint-pre-expansion-extern-module.stderr | 6 +- .../lint/lint-range-endpoint-overflow.stderr | 20 +- tests/ui/lint/lint-removed-allow.stderr | 6 +- .../ui/lint/lint-removed-cmdline-deny.stderr | 6 +- tests/ui/lint/lint-removed-cmdline.stderr | 6 +- tests/ui/lint/lint-removed.stderr | 6 +- tests/ui/lint/lint-renamed-allow.stderr | 6 +- .../ui/lint/lint-renamed-cmdline-deny.stderr | 6 +- tests/ui/lint/lint-renamed-cmdline.stderr | 6 +- tests/ui/lint/lint-renamed.stderr | 12 +- tests/ui/lint/lint-shorthand-field.stderr | 34 +- .../lint-strict-provenance-lossy-casts.stderr | 16 +- .../ui/lint/lint-unexported-no-mangle.stderr | 17 +- tests/ui/lint/lint-unknown-lint.stderr | 14 +- tests/ui/lint/non-local-defs/consts.stderr | 9 +- .../ui/lint/non-local-defs/exhaustive.stderr | 6 +- .../from-local-for-global.stderr | 6 +- .../trait-solver-overflow-123573.stderr | 6 +- .../lint-non-snake-case-crate-cdylib.stderr | 6 +- .../lint-non-snake-case-crate-dylib.stderr | 6 +- .../lint-non-snake-case-crate-lib.stderr | 6 +- ...int-non-snake-case-crate-proc-macro.stderr | 6 +- .../lint-non-snake-case-crate-rlib.stderr | 6 +- ...lint-non-snake-case-crate-staticlib.stderr | 6 +- .../lint-non-snake-case-functions.stderr | 62 +- ...ase-identifiers-suggestion-reserved.stderr | 20 +- .../lint-non-snake-case-lifetimes.stderr | 6 +- .../lint-non-snake-case-modules.stderr | 6 +- .../lint-nonstandard-style-unicode-2.stderr | 13 +- .../lint-uppercase-variables.stderr | 81 +- ...-warning-for-field-puns-issue-66362.stderr | 27 +- tests/ui/lint/noop-method-call.stderr | 14 +- tests/ui/lint/not_found.stderr | 14 +- tests/ui/lint/reasons.stderr | 6 +- tests/ui/lint/recommend-literal.stderr | 70 +- .../redundant-semicolon/item-stmt-semi.stderr | 15 +- .../redundant-semi-proc-macro.stderr | 15 +- .../ui/lint/renamed-lints-still-apply.stderr | 6 +- .../expect_lint_from_macro.stderr | 12 +- .../expect_nested_lint_levels.stderr | 15 +- .../expect_with_forbid.stderr | 6 +- ...force_warn_expected_lints_fulfilled.stderr | 35 +- ...rce_warn_expected_lints_unfulfilled.stderr | 6 +- .../lint-attribute-only-with-reason.stderr | 35 +- .../lint-uncommon-codepoints.stderr | 6 +- tests/ui/lint/suggestions.stderr | 92 +- tests/ui/lint/type-overflow.stderr | 12 +- tests/ui/lint/unnecessary-extern-crate.stderr | 41 +- tests/ui/lint/unreachable_pub.stderr | 106 +- .../unused/issue-117284-arg-in-macro.stderr | 7 +- .../unused/issue-119383-if-let-guard.stderr | 6 +- ...0-unused-variable-in-struct-pattern.stderr | 102 +- .../issue-54180-unused-ref-field.stderr | 27 +- .../issue-81314-unused-span-ident.stderr | 13 +- .../unused/lint-unused-extern-crate.stderr | 15 +- .../lint/unused/lint-unused-mut-self.stderr | 19 +- .../unused/lint-unused-mut-variables.stderr | 268 ++-- .../lint/unused/lint-unused-variables.stderr | 76 +- .../lint/unused/unused-attr-duplicate.stderr | 161 ++- .../unused-mut-warning-captured-var.stderr | 9 +- .../lint/unused_variables-issue-82488.stderr | 6 +- tests/ui/lint/warn-path-statement.stderr | 14 +- tests/ui/liveness/liveness-consts.stderr | 34 +- tests/ui/liveness/liveness-derive.stderr | 13 +- .../ui/liveness/liveness-move-in-while.stderr | 20 +- .../liveness-return-last-stmt-semi.stderr | 8 +- tests/ui/liveness/liveness-unused.stderr | 55 +- tests/ui/loops/issue-1962.stderr | 6 +- tests/ui/loops/loop-break-value.stderr | 16 +- ...rt-trailing-junk.with-generic-asset.stderr | 44 +- ...trailing-junk.without-generic-asset.stderr | 44 +- tests/ui/macros/bang-after-name.stderr | 8 +- tests/ui/macros/concat-bytes-error.stderr | 49 +- tests/ui/macros/format-foreign.stderr | 16 +- tests/ui/macros/format-unused-lables.stderr | 9 +- .../issue-69396-const-no-type-in-macro.stderr | 15 +- tests/ui/macros/issue-86865.stderr | 20 +- tests/ui/macros/macro-context.stderr | 6 +- .../syntax-errors.stderr | 16 +- tests/ui/macros/macro-name-typo.stderr | 7 +- .../macro-or-patterns-back-compat.stderr | 24 +- ...-pat-pattern-followed-by-or-in-2021.stderr | 24 +- ...acro-pat2021-pattern-followed-by-or.stderr | 24 +- .../macros/macro-path-prelude-fail-3.stderr | 6 +- tests/ui/macros/macro-reexport-removed.stderr | 7 +- tests/ui/macros/macro-use-all-and-none.stderr | 7 +- tests/ui/macros/macro_undefined.stderr | 7 +- tests/ui/macros/macros-nonfatal-errors.stderr | 5 +- tests/ui/macros/missing-bang-in-decl.stderr | 8 +- tests/ui/macros/missing-comma.stderr | 24 +- tests/ui/macros/recovery-allowed.stderr | 9 +- .../syntax-errors.stderr | 8 +- .../do-not-ice-on-note_and_explain.stderr | 7 +- .../malformed/malformed-derive-entry.stderr | 23 +- .../malformed/malformed-special-attrs.stderr | 26 +- .../marker-attribute-with-values.stderr | 21 +- tests/ui/match/issue-56685.stderr | 14 +- .../ui/match/match-incompat-type-semi.stderr | 22 +- .../match-pattern-field-mismatch-2.stderr | 7 +- .../match-tail-expr-never-type-error.stderr | 7 +- ...t_one_layer_2024_ref_mut_inside_and.stderr | 45 +- tests/ui/methods/issue-3707.stderr | 9 +- tests/ui/methods/issues/issue-105732.stderr | 8 +- tests/ui/methods/method-call-err-msg.stderr | 10 +- .../method-call-lifetime-args-fail.stderr | 18 +- ...ethod-call-lifetime-args-unresolved.stderr | 7 +- tests/ui/mir/issue-112269.stderr | 10 +- tests/ui/mismatched_types/E0053.stderr | 18 +- tests/ui/mismatched_types/cast-rfc0401.stderr | 10 +- .../mismatched_types/const-fn-in-trait.stderr | 22 +- tests/ui/mismatched_types/issue-112036.stderr | 9 +- tests/ui/mismatched_types/issue-13033.stderr | 9 +- tests/ui/mismatched_types/issue-19109.stderr | 6 +- .../ref-pat-suggestions.stderr | 5 +- .../trait-impl-fn-incompatibility.stderr | 18 +- .../ui/missing/missing-comma-in-match.stderr | 7 +- tests/ui/missing/missing-items/m2.stderr | 35 +- tests/ui/modules/path-invalid-form.stderr | 7 +- tests/ui/modules/path-macro.stderr | 7 +- tests/ui/nested-ty-params.stderr | 18 +- tests/ui/never_type/issue-52443.stderr | 6 +- .../never_type/never-assign-dead-code.stderr | 6 +- tests/ui/nll/capture-mut-ref.stderr | 9 +- tests/ui/nll/issue-61424.stderr | 9 +- tests/ui/nll/unused-mut-issue-50343.stderr | 9 +- .../region-error-ice-109072.stderr | 9 +- tests/ui/no_crate_type.stderr | 7 +- tests/ui/non-fmt-panic.stderr | 8 +- tests/ui/nonscalar-cast.stderr | 6 +- tests/ui/numeric/numeric-fields.stderr | 10 +- tests/ui/numeric/uppercase-base-prefix.stderr | 72 +- ...ect-lifetime-default-from-box-error.stderr | 8 +- .../ui/object-safety/assoc_type_bounds.stderr | 14 +- .../object-safety/assoc_type_bounds2.stderr | 14 +- .../assoc_type_bounds_sized_others.stderr | 14 +- ...assoc_type_bounds_sized_unnecessary.stderr | 7 +- .../avoid-ice-on-warning.new.stderr | 7 +- .../avoid-ice-on-warning.old.stderr | 7 +- tests/ui/object-safety/issue-102762.stderr | 21 +- tests/ui/offset-of/offset-of-enum.stderr | 10 +- .../less-than-greater-than.stderr | 7 +- .../or-patterns/fn-param-wrap-parens.stderr | 7 +- .../issue-64879-trailing-before-guard.stderr | 8 +- tests/ui/or-patterns/missing-bindings.stderr | 7 +- .../or-patterns/multiple-pattern-typo.stderr | 49 +- .../nested-undelimited-precedence.stderr | 35 +- .../or-patterns-syntactic-fail.stderr | 28 +- .../ui/or-patterns/remove-leading-vert.stderr | 159 ++- .../assoc/assoc-static-semantic-fail.stderr | 50 +- .../attribute/attr-stmt-expr-attr-bad.stderr | 90 +- tests/ui/parser/bad-char-literals.stderr | 28 +- tests/ui/parser/bad-fn-ptr-qualifier.stderr | 112 +- tests/ui/parser/byte-literals.stderr | 14 +- .../char/whitespace-character-literal.stderr | 8 +- .../parser/default-on-wrong-item-kind.stderr | 8 +- tests/ui/parser/default.stderr | 7 +- tests/ui/parser/do-catch-suggests-try.stderr | 6 +- .../parser/doc-comment-in-if-statement.stderr | 9 +- tests/ui/parser/duplicate-visibility.stderr | 10 +- tests/ui/parser/emoji-identifiers.stderr | 14 +- tests/ui/parser/empty-impl-semicolon.stderr | 5 +- tests/ui/parser/eq-less-to-less-eq.stderr | 9 +- tests/ui/parser/expr-as-stmt.stderr | 18 +- tests/ui/parser/expr-rarrow-call.stderr | 30 +- tests/ui/parser/fn-body-eq-expr-semi.stderr | 16 +- .../fn-body-optional-semantic-fail.stderr | 35 +- tests/ui/parser/fn-colon-return-type.stderr | 7 +- tests/ui/parser/fn-defined-using-def.stderr | 9 +- tests/ui/parser/fn-defined-using-fun.stderr | 9 +- tests/ui/parser/fn-defined-using-func.stderr | 9 +- .../parser/fn-defined-using-function.stderr | 9 +- .../ui/parser/fn-field-parse-error-ice.stderr | 7 +- .../ui/parser/fn-header-semantic-fail.stderr | 92 +- .../parser/foreign-const-semantic-fail.stderr | 16 +- .../foreign-const-syntactic-fail.stderr | 16 +- .../ui/parser/foreign-ty-semantic-fail.stderr | 35 +- tests/ui/parser/ident-recovery.stderr | 22 +- tests/ui/parser/if-in-in.stderr | 10 +- .../impl-item-const-semantic-fail.stderr | 9 +- .../impl-item-fn-no-body-semantic-fail.stderr | 9 +- ...mpl-item-type-no-body-semantic-fail.stderr | 36 +- tests/ui/parser/impl-parsing.stderr | 14 +- .../ui/parser/intersection-patterns-1.stderr | 12 +- tests/ui/parser/inverted-parameters.stderr | 30 +- ...icolon-issue-124935-semi-after-item.stderr | 8 +- .../parser/issues/issue-100197-mut-let.stderr | 7 +- .../ui/parser/issues/issue-101477-enum.stderr | 6 +- .../ui/parser/issues/issue-101477-let.stderr | 7 +- tests/ui/parser/issues/issue-103425.stderr | 21 +- .../issue-103748-ICE-wrong-braces.stderr | 9 +- tests/ui/parser/issues/issue-10392-2.stderr | 7 +- .../issue-108109-fn-missing-params.stderr | 14 +- ...issue-108109-fn-trait-missing-paren.stderr | 10 +- tests/ui/parser/issues/issue-112188.stderr | 16 +- tests/ui/parser/issues/issue-113203.stderr | 7 +- tests/ui/parser/issues/issue-113342.stderr | 10 +- .../ui/parser/issues/issue-118530-ice.stderr | 13 +- tests/ui/parser/issues/issue-14303.stderr | 35 +- .../issues/issue-17718-const-mut.stderr | 7 +- .../issues/issue-23620-invalid-escapes.stderr | 9 +- tests/ui/parser/issues/issue-27255.stderr | 14 +- tests/ui/parser/issues/issue-3036.stderr | 7 +- tests/ui/parser/issues/issue-32501.stderr | 7 +- tests/ui/parser/issues/issue-46186.stderr | 7 +- tests/ui/parser/issues/issue-48636.stderr | 5 +- tests/ui/parser/issues/issue-49040.stderr | 8 +- tests/ui/parser/issues/issue-49257.stderr | 7 +- tests/ui/parser/issues/issue-52496.stderr | 7 +- tests/ui/parser/issues/issue-54521-2.stderr | 32 +- tests/ui/parser/issues/issue-54521-3.stderr | 32 +- tests/ui/parser/issues/issue-57684.stderr | 18 +- tests/ui/parser/issues/issue-57819.stderr | 56 +- ...sue-65122-mac-invoc-in-mut-patterns.stderr | 14 +- ...sue-65257-invalid-var-decl-recovery.stderr | 14 +- ...0-unicode-ident-after-missing-comma.stderr | 7 +- ...ue-70388-recover-dotdotdot-rest-pat.stderr | 20 +- .../issues/issue-70388-without-witness.stderr | 20 +- ...9-resolve-after-recovered-self-ctor.stderr | 28 +- .../issue-73568-lifetime-after-mut.stderr | 20 +- .../ui/parser/issues/issue-76437-async.stderr | 10 +- .../issue-76437-const-async-unsafe.stderr | 10 +- .../issues/issue-76437-const-async.stderr | 10 +- .../ui/parser/issues/issue-76437-const.stderr | 10 +- .../issue-76437-pub-crate-unsafe.stderr | 10 +- .../parser/issues/issue-76437-unsafe.stderr | 10 +- tests/ui/parser/issues/issue-76597.stderr | 10 +- .../issue-87197-missing-semicolon.stderr | 21 +- .../const-async-const.stderr | 10 +- .../issue-87217-keyword-order/recovery.stderr | 19 +- .../several-kw-jump.stderr | 9 +- .../wrong-async.stderr | 9 +- .../wrong-const.stderr | 9 +- .../wrong-unsafe.stderr | 9 +- tests/ui/parser/issues/issue-87635.stderr | 7 +- .../issues/issue-87694-duplicated-pub.stderr | 10 +- .../issues/issue-87694-misplaced-pub.stderr | 10 +- tests/ui/parser/issues/issue-89396.stderr | 20 +- tests/ui/parser/issues/issue-89574.stderr | 7 +- tests/ui/parser/issues/issue-90993.stderr | 6 +- ...9625-enum-struct-mutually-exclusive.stderr | 7 +- ...-99910-const-let-mutually-exclusive.stderr | 14 +- ...g-main-issue-124935-semi-after-item.stderr | 7 +- .../issues/recover-ge-as-fat-arrow.stderr | 10 +- ...em-free-const-no-body-semantic-fail.stderr | 25 +- ...m-free-static-no-body-semantic-fail.stderr | 50 +- ...item-free-type-bounds-semantic-fail.stderr | 18 +- tests/ui/parser/item-kw-case-mismatch.stderr | 98 +- tests/ui/parser/item-needs-block.stderr | 15 +- tests/ui/parser/kw-in-trait-bounds.stderr | 28 +- tests/ui/parser/label-after-block-like.stderr | 63 +- tests/ui/parser/labeled-no-colon-expr.stderr | 53 +- tests/ui/parser/let-binop.stderr | 18 +- .../parser/lifetime-in-pattern-recover.stderr | 16 +- tests/ui/parser/lifetime-in-pattern.stderr | 8 +- .../macro/macro-expand-to-match-arm.stderr | 7 +- tests/ui/parser/macro/pub-item-macro.stderr | 7 +- tests/ui/parser/macros-no-semicolon.stderr | 14 +- tests/ui/parser/match-arm-without-body.stderr | 63 +- .../ui/parser/match-arm-without-braces.stderr | 7 +- tests/ui/parser/match-refactor-to-expr.stderr | 11 +- tests/ui/parser/misspelled-macro-rules.stderr | 9 +- ...byte-char-use-seperator-issue-80134.stderr | 20 +- tests/ui/parser/mut-patterns.stderr | 61 +- .../parser/no-const-fn-in-extern-block.stderr | 16 +- tests/ui/parser/not-a-pred.stderr | 7 +- tests/ui/parser/pat-lt-bracket-7.stderr | 10 +- .../ui/parser/pat-recover-methodcalls.stderr | 10 +- tests/ui/parser/pat-recover-ranges.stderr | 6 +- tests/ui/parser/pat-recover-wildcards.stderr | 6 +- tests/ui/parser/pub-method-macro.stderr | 7 +- .../parser/qualified-path-in-turbofish.stderr | 7 +- .../ui/parser/range-exclusive-dotdotlt.stderr | 40 +- .../range-inclusive-extra-equals.stderr | 6 +- tests/ui/parser/range_inclusive.stderr | 6 +- .../ui/parser/raw/raw-byte-string-eof.stderr | 8 +- tests/ui/parser/raw/raw-str-unbalanced.stderr | 31 +- tests/ui/parser/raw/raw-string-2.stderr | 6 +- tests/ui/parser/raw/raw-string.stderr | 8 +- ...ecover-colon-instead-of-eq-in-local.stderr | 6 +- .../recover/recover-const-async-fn-ptr.stderr | 112 +- tests/ui/parser/recover/recover-enum.stderr | 30 +- ...gle-brackets-in-struct-with-a-field.stderr | 10 +- .../recover-field-extra-angle-brackets.stderr | 8 +- .../parser/recover/recover-field-semi.stderr | 21 +- .../recover-missing-semi-before-item.stderr | 70 +- .../recover/recover-missing-semi.stderr | 14 +- .../parser/recover/recover-range-pats.stderr | 232 +++- .../parser/recover/recover-ref-dyn-mut.stderr | 7 +- .../recover/recover-unticked-labels.stderr | 29 +- .../parser/regions-out-of-scope-slice.stderr | 7 +- .../removed-syntax-field-let-2.stderr | 20 +- .../removed-syntax-field-let.stderr | 10 +- .../removed-syntax-field-semicolon.stderr | 7 +- .../removed-syntax-fn-sigil.stderr | 7 +- .../removed-syntax-static-fn.stderr | 7 +- .../removed-syntax-with-1.stderr | 10 +- tests/ui/parser/similar-tokens.stderr | 10 +- ...-values-and-missing-field-separator.stderr | 114 +- tests/ui/parser/struct-filed-with-attr.stderr | 7 +- tests/ui/parser/suggest-assoc-const.stderr | 7 +- ...ng-semicolon-after-impl-trait-items.stderr | 11 +- .../ui/parser/trait-object-delimiters.stderr | 23 +- .../trait-object-lifetime-parens.stderr | 14 +- .../trait-object-polytrait-priority.stderr | 7 +- tests/ui/parser/trait-pub-assoc-const.stderr | 7 +- tests/ui/parser/trait-pub-assoc-ty.stderr | 7 +- tests/ui/parser/trait-pub-method.stderr | 7 +- .../parser/unicode-character-literal.stderr | 8 +- .../parser/unicode-control-codepoints.stderr | 30 +- tests/ui/parser/unmatched-langle-1.stderr | 8 +- tests/ui/parser/unnecessary-let.stderr | 23 +- tests/ui/parser/use-colon-as-mod-sep.stderr | 24 +- .../patchable-function-entry-attribute.stderr | 7 +- ...ld-before-at-syntactically-rejected.stderr | 18 +- tests/ui/pattern/issue-106862.stderr | 35 +- tests/ui/pattern/issue-14221.stderr | 13 +- ...6-match-same-name-enum-variant-refs.stderr | 41 +- ...e-80186-mut-binding-help-suggestion.stderr | 6 +- tests/ui/pattern/match_ergonomics_2024.stderr | 44 +- ...tch-tuple-variant-self-ctor.struct_.stderr | 7 +- tests/ui/pattern/no-patterns-in-args-2.stderr | 6 +- .../pat-tuple-field-count-cross.stderr | 10 +- tests/ui/pattern/pat-tuple-overfield.stderr | 10 +- tests/ui/pattern/pat-tuple-underfield.stderr | 7 +- .../pattern/pattern-bad-ref-box-order.stderr | 7 +- .../pattern-binding-disambiguation.stderr | 20 +- .../ui/pattern/pattern-error-continue.stderr | 10 +- ...tern-meant-to-be-slice-rest-pattern.stderr | 7 +- .../integer-ranges/gap_between_ranges.stderr | 148 +- tests/ui/privacy/issue-113860-1.stderr | 7 +- tests/ui/privacy/issue-113860-2.stderr | 7 +- tests/ui/privacy/issue-113860.stderr | 7 +- tests/ui/privacy/issue-29161.stderr | 7 +- tests/ui/privacy/priv-in-bad-locations.stderr | 28 +- tests/ui/privacy/privacy-sanity.stderr | 126 +- .../privacy/restricted/relative-2018.stderr | 9 +- .../privacy/unresolved-trait-impl-item.stderr | 10 +- tests/ui/privacy/useless-pub.stderr | 21 +- tests/ui/proc-macro/attribute.stderr | 14 +- .../ui/proc-macro/attributes-included.stderr | 6 +- .../proc-macro/gen-macro-rules-hygiene.stderr | 13 +- tests/ui/proc-macro/invalid-attributes.stderr | 42 +- tests/ui/proc-macro/issue-37788.stderr | 8 +- .../ui/proc-macro/lints_in_proc_macros.stderr | 6 +- tests/ui/proc-macro/mixed-site-span.stderr | 13 +- tests/ui/proc-macro/no-macro-use-attr.stderr | 6 +- .../ui/proc-macro/parent-source-spans.stderr | 18 +- .../proc-macro/proc-macro-attributes.stderr | 7 +- tests/ui/proc-macro/resolve-error.stderr | 67 +- tests/ui/proc-macro/span-preservation.stderr | 28 +- tests/ui/pub/pub-ident-fn-or-struct.stderr | 7 +- tests/ui/pub/pub-restricted.stderr | 30 +- tests/ui/query-system/issue-83479.stderr | 18 +- .../exclusive-range-patterns-2021.stderr | 27 +- tests/ui/range/impossible_range.stderr | 12 +- .../range-inclusive-pattern-precedence.stderr | 13 +- ...range-inclusive-pattern-precedence2.stderr | 13 +- .../recursion_limit/invalid_digit_type.stderr | 7 +- tests/ui/recursion_limit/invalid_macro.stderr | 7 +- tests/ui/recursion_limit/no-value.stderr | 7 +- tests/ui/regions/outlives-with-missing.stderr | 7 +- tests/ui/regions/regions-glb-free-free.stderr | 7 +- tests/ui/regions/regions-in-enums.stderr | 14 +- tests/ui/regions/regions-in-structs.stderr | 15 +- .../regions-infer-at-fn-not-param.stderr | 9 +- .../ui/regions/regions-name-undeclared.stderr | 49 +- tests/ui/regions/regions-static-bound.stderr | 9 +- tests/ui/regions/regions-undeclared.stderr | 31 +- tests/ui/removing-extern-crate.stderr | 31 +- tests/ui/repeat-expr/repeat_count.stderr | 7 +- tests/ui/repr/issue-83505-repr-simd.stderr | 9 +- tests/ui/repr/malformed-repr-hints.stderr | 7 +- tests/ui/repr/repr-align-assign.stderr | 26 +- tests/ui/repr/repr.stderr | 21 +- tests/ui/resolve/112590-2.stderr | 10 +- tests/ui/resolve/bad-type-env-capture.stderr | 9 +- .../explicit-self-lowercase-param.stderr | 7 +- ...m-in-const-item.generic_const_items.stderr | 24 +- tests/ui/resolve/issue-100365.stderr | 27 +- tests/ui/resolve/issue-10200.stderr | 7 +- tests/ui/resolve/issue-22692.stderr | 33 +- tests/ui/resolve/issue-3021-c.stderr | 18 +- tests/ui/resolve/issue-30535.stderr | 10 +- tests/ui/resolve/issue-3214.stderr | 15 +- tests/ui/resolve/issue-35675.stderr | 30 +- tests/ui/resolve/issue-49074.stderr | 7 +- tests/ui/resolve/issue-6702.stderr | 7 +- ...0736-async-fn-no-body-def-collector.stderr | 27 +- tests/ui/resolve/issue-73427.stderr | 6 +- tests/ui/resolve/issue-81508.stderr | 18 +- tests/ui/resolve/levenshtein.stderr | 49 +- tests/ui/resolve/privacy-enum-ctor.stderr | 24 +- tests/ui/resolve/privacy-struct-ctor.stderr | 17 +- .../resolve/resolve-primitive-fallback.stderr | 10 +- ...resolve-type-param-in-item-in-trait.stderr | 36 +- .../suggest-path-for-tuple-struct.stderr | 14 +- ...uggest-path-instead-of-mod-dot-item.stderr | 67 +- tests/ui/resolve/tuple-struct-alias.stderr | 12 +- ...e-with-name-similar-to-struct-field.stderr | 14 +- .../typo-suggestion-mistyped-in-path.stderr | 30 +- ...r-return-ty-for-fn-sig-issue-125488.stderr | 40 +- tests/ui/return/return-impl-trait-bad.stderr | 10 +- tests/ui/return/return-impl-trait.stderr | 19 +- tests/ui/return/return-struct.stderr | 15 +- .../ICE-119271-never-arm-attr-in-guard.stderr | 8 +- .../rfc-0000-never_patterns/bindings.stderr | 56 +- .../rfcs/rfc-0000-never_patterns/check.stderr | 41 +- .../rfcs/rfc-0000-never_patterns/parse.stderr | 52 +- .../const.stderr | 6 +- .../invalid-attribute.stderr | 7 +- .../error-odd-syntax.stderr | 7 +- .../error-with-main.stderr | 8 +- .../param-attrs-cfg.stderr | 132 +- .../const-impl-requires-const-trait.stderr | 7 +- ...o-explicit-const-params-cross-crate.stderr | 18 +- .../effects/no-explicit-const-params.stderr | 18 +- .../effects/spec-effectvar-ice.stderr | 14 +- .../effects/trait-fn-const.stderr | 22 +- .../ice-120503-async-const-method.stderr | 27 +- .../ice-126148-failed-to-normalize.stderr | 15 +- .../issue-102156.stderr | 19 +- tests/ui/rust-2018/async-ident-allowed.stderr | 6 +- tests/ui/rust-2018/async-ident.stderr | 84 +- tests/ui/rust-2018/dyn-keyword.stderr | 6 +- .../edition-lint-fully-qualified-paths.stderr | 18 +- .../edition-lint-infer-outlives-macro.stderr | 86 +- ...ition-lint-infer-outlives-multispan.stderr | 21 +- .../edition-lint-infer-outlives.stderr | 1232 ++++++++++++++--- .../edition-lint-nested-empty-paths.stderr | 30 +- .../edition-lint-nested-paths.stderr | 24 +- tests/ui/rust-2018/edition-lint-paths.stderr | 54 +- .../extern-crate-idiomatic-in-2018.stderr | 6 +- tests/ui/rust-2018/extern-crate-rename.stderr | 6 +- tests/ui/rust-2018/extern-crate-submod.stderr | 6 +- tests/ui/rust-2018/issue-54006.stderr | 7 +- ...54400-unused-extern-crate-attr-span.stderr | 12 +- .../local-path-suggestions-2015.stderr | 10 +- .../local-path-suggestions-2018.stderr | 13 +- tests/ui/rust-2018/remove-extern-crate.stderr | 7 +- tests/ui/rust-2018/try-ident.stderr | 12 +- tests/ui/rust-2018/try-macro.stderr | 6 +- .../array-into-iter-ambiguous.stderr | 6 +- ...ure-prelude-collision-generic-trait.stderr | 6 +- .../future-prelude-collision-generic.stderr | 18 +- .../future-prelude-collision-imported.stderr | 24 +- .../future-prelude-collision-macros.stderr | 12 +- .../future-prelude-collision-turbofish.stderr | 12 +- .../rust-2021/future-prelude-collision.stderr | 48 +- .../rust-2021/generic-type-collision.stderr | 6 +- .../rust-2021/inherent-dyn-collision.stderr | 6 +- .../box-slice-into-iter-ambiguous.stderr | 6 +- tests/ui/rust-2024/gen-kw.e2015.stderr | 18 +- tests/ui/rust-2024/gen-kw.e2018.stderr | 18 +- .../unsafe-extern-suggestion.stderr | 10 +- .../cfi-invalid-attr-cfi-encoding.stderr | 7 +- ...ary-self-types-not-object-safe.curr.stderr | 14 +- ...bject-safe.object_safe_for_dispatch.stderr | 7 +- tests/ui/self/self-ctor-nongeneric.stderr | 12 +- tests/ui/self/self-ctor.stderr | 14 +- tests/ui/self/self-impl.stderr | 14 +- tests/ui/self/self-vs-path-ambiguity.stderr | 8 +- tests/ui/self/self_type_keyword.stderr | 7 +- tests/ui/self/suggest-self-2.stderr | 27 +- tests/ui/self/suggest-self.stderr | 30 +- tests/ui/seq-args.stderr | 18 +- .../portable-intrinsics-arent-exposed.stderr | 10 +- .../single-use-lifetime/issue-107998.stderr | 11 +- .../zero-uses-in-fn.stderr | 27 +- .../zero-uses-in-impl.stderr | 7 +- .../ui/span/impl-wrong-item-for-trait.stderr | 5 +- tests/ui/span/issue-23729.stderr | 6 +- tests/ui/span/issue-23827.stderr | 5 +- tests/ui/span/issue-24356.stderr | 6 +- tests/ui/span/issue-24690.stderr | 19 +- tests/ui/span/issue-34264.stderr | 20 +- tests/ui/span/suggestion-non-ascii.stderr | 7 +- tests/ui/span/suggestion-raw-68962.stderr | 14 +- tests/ui/span/type-binding.stderr | 7 +- tests/ui/span/typo-suggestion.stderr | 7 +- .../specialization-default-projection.stderr | 8 +- .../stability-attribute/issue-109177.stderr | 7 +- .../stability-attribute-sanity-4.stderr | 28 +- .../stability-attribute-sanity.stderr | 7 +- .../suggest-vec-allocator-api.stderr | 16 +- tests/ui/static/bad-const-type.stderr | 9 +- .../ui/static/static-reference-to-fn-2.stderr | 5 +- .../ui/structs/struct-duplicate-comma.stderr | 11 +- .../structs/struct-field-init-syntax.stderr | 14 +- .../struct-fields-shorthand-unresolved.stderr | 7 +- tests/ui/structs/struct-missing-comma.stderr | 7 +- .../struct-path-associated-type.stderr | 39 +- ...structure-constructor-type-mismatch.stderr | 18 +- ...ing-field-when-specifying-same-type.stderr | 20 +- tests/ui/suggestions/abi-typo.stderr | 9 +- .../suggestions/assoc-const-as-field.stderr | 7 +- tests/ui/suggestions/attribute-typos.stderr | 21 +- tests/ui/suggestions/const-no-type.stderr | 49 +- ...const-pat-non-exaustive-let-new-var.stderr | 5 +- tests/ui/suggestions/count2len.stderr | 27 +- ...-to-add-suggestions-with-no-changes.stderr | 7 +- .../dont-try-removing-the-field.stderr | 6 +- .../expected-boxed-future-isnt-pinned.stderr | 5 +- tests/ui/suggestions/fn-trait-notation.stderr | 18 +- .../ui/suggestions/if-then-neeing-semi.stderr | 11 +- .../ignore-nested-field-binding.stderr | 13 +- ...mpl-trait-return-trailing-semicolon.stderr | 10 +- tests/ui/suggestions/issue-101421.stderr | 9 +- tests/ui/suggestions/issue-102354.stderr | 9 +- tests/ui/suggestions/issue-103646.stderr | 9 +- tests/ui/suggestions/issue-104287.stderr | 9 +- tests/ui/suggestions/issue-105226.stderr | 28 +- ...ng-semicolon-between-call-and-tuple.stderr | 9 +- tests/ui/suggestions/issue-52820.stderr | 10 +- tests/ui/suggestions/issue-53692.stderr | 21 +- tests/ui/suggestions/issue-59819.stderr | 10 +- tests/ui/suggestions/issue-61226.stderr | 7 +- .../issue-66968-suggest-sorted-words.stderr | 7 +- tests/ui/suggestions/issue-81098.stderr | 9 +- tests/ui/suggestions/issue-81839.stderr | 11 +- tests/ui/suggestions/issue-83892.stderr | 7 +- tests/ui/suggestions/issue-83943.stderr | 9 +- tests/ui/suggestions/issue-84700.stderr | 7 +- tests/ui/suggestions/issue-89064.stderr | 9 +- tests/ui/suggestions/issue-98562.rs | 2 +- tests/ui/suggestions/issue-98562.stderr | 5 +- .../suggestions/js-style-comparison-op.stderr | 14 +- .../let-binding-init-expr-as-ty.stderr | 9 +- .../missing-lifetimes-in-signature.stderr | 17 +- .../ui/suggestions/match-needing-semi.stderr | 9 +- .../match-prev-arm-needing-semi.stderr | 11 +- ...t-arm-types-as-stmt-instead-of-expr.stderr | 9 +- ...missing-assoc-fn-applicable-suggestions.rs | 8 +- ...ing-assoc-fn-applicable-suggestions.stderr | 20 +- tests/ui/suggestions/missing-assoc-fn.stderr | 5 +- ...sing-impl-trait-block-but-not-ascii.stderr | 5 +- tests/ui/suggestions/missing-semicolon.stderr | 59 +- ...it-should-use-self-2021-without-dyn.stderr | 8 +- ...-removal-of-conversion-method-calls.stderr | 9 +- ...ecover-from-semicolon-trailing-item.stderr | 21 +- .../suggestions/recover-invalid-float.stderr | 21 +- tests/ui/suggestions/remove-as_str.stderr | 32 +- tests/ui/suggestions/return-closures.stderr | 14 +- tests/ui/suggestions/return-cycle-2.stderr | 10 +- tests/ui/suggestions/return-cycle.stderr | 10 +- .../struct-initializer-comma.stderr | 10 +- .../suggest-assoc-fn-call-deref.stderr | 9 +- ...uggest-assoc-fn-call-for-impl-trait.stderr | 27 +- ...-fn-call-with-turbofish-placeholder.stderr | 9 +- ...n-call-with-turbofish-through-deref.stderr | 9 +- ...uggest-assoc-fn-call-with-turbofish.stderr | 45 +- ...gest-assoc-fn-call-without-receiver.stderr | 36 +- ...uggest-fn-ptr-for-fn-item-in-fn-ret.stderr | 10 +- tests/ui/suggestions/suggest-labels.stderr | 30 +- .../suggestions/suggest-move-lifetimes.stderr | 28 +- ...suggest-mut-method-for-loop-closure.stderr | 10 +- ...suggest-mut-method-for-loop-hashmap.stderr | 10 +- .../suggest-mut-method-for-loop.stderr | 10 +- .../suggest-ret-on-async-w-late.stderr | 7 +- ...st-semicolon-for-fn-in-extern-block.stderr | 7 +- .../ui/suggestions/suggest-trait-items.stderr | 50 +- tests/ui/suggestions/suggest-variants.stderr | 34 +- .../ui/suggestions/trait-hidden-method.stderr | 7 +- .../suggestions/try-removing-the-field.stderr | 26 +- .../type-ascription-instead-of-method.stderr | 6 +- .../type-ascription-instead-of-path.stderr | 6 +- .../type-ascription-instead-of-variant.stderr | 6 +- tests/ui/suggestions/unnamable-types.stderr | 31 +- .../unused-closure-argument.stderr | 13 +- tests/ui/switched-expectations.stderr | 9 +- tests/ui/tag-variant-cast-non-nullary.stderr | 6 +- .../target-feature/invalid-attribute.stderr | 21 +- tests/ui/traits/alias/object-fail.stderr | 7 +- tests/ui/traits/alias/style_lint.stderr | 6 +- ...assoc-type-suggestion-in-trait-impl.stderr | 9 +- .../assoc_type_bound_with_struct.stderr | 7 +- .../rustc_must_implement_one_of_misuse.stderr | 7 +- tests/ui/traits/impl-for-module.stderr | 7 +- .../supertrait-auto-trait.stderr | 8 +- tests/ui/traits/issue-35869.stderr | 36 +- tests/ui/traits/issue-78372.stderr | 7 +- tests/ui/traits/issue-87558.stderr | 5 +- tests/ui/traits/item-privacy.stderr | 14 +- .../dont-canonicalize-re-error.stderr | 9 +- tests/ui/traits/object/pretty.stderr | 112 +- tests/ui/traits/object/vs-lifetime.stderr | 9 +- .../with-self-in-projection-output-bad.stderr | 14 +- .../question-mark-result-err-mismatch.stderr | 12 +- tests/ui/traits/span-bug-issue-121414.stderr | 9 +- tests/ui/traits/test-2.stderr | 18 +- .../traits/trait-selection-ice-84727.stderr | 8 +- .../traits/wrong-mul-method-signature.stderr | 27 +- .../ui/transmutability/issue-101739-2.stderr | 17 +- tests/ui/tuple/array-diagnostics.stderr | 7 +- .../ui/tuple/tuple-struct-fields/test.stderr | 9 +- .../ui/tuple/tuple-struct-fields/test2.stderr | 8 +- .../ui/tuple/tuple-struct-fields/test3.stderr | 8 +- tests/ui/tuple/wrong_argument_ice-4.stderr | 13 +- .../enum-variant-generic-args.stderr | 54 +- ...ity-lint-ambiguous_associated_items.stderr | 6 +- .../constrain_in_projection2.next.stderr | 6 +- .../type-alias-impl-trait/issue-77179.stderr | 10 +- .../unnameable_type.stderr | 9 +- tests/ui/type/ascription/issue-47666.stderr | 6 +- tests/ui/type/ascription/issue-54516.stderr | 6 +- tests/ui/type/ascription/issue-60933.stderr | 6 +- ...igned-block-without-tail-expression.stderr | 25 +- tests/ui/type/issue-102598.stderr | 9 +- tests/ui/type/issue-7607-1.stderr | 7 +- tests/ui/type/pattern_types/bad_pat.stderr | 12 +- tests/ui/type/type-arg-out-of-scope.stderr | 18 +- ...e-ascription-instead-of-initializer.stderr | 16 +- ...ascription-instead-of-statement-end.stderr | 6 +- .../type/type-ascription-with-fn-call.stderr | 6 +- .../type-dependent-def-issue-49241.stderr | 9 +- tests/ui/typeck/conversion-methods.stderr | 30 +- ...holder-to-const-static-without-type.stderr | 14 +- tests/ui/typeck/issue-100164.stderr | 14 +- tests/ui/typeck/issue-107087.stderr | 7 +- ...114423-ice-regression-in-suggestion.stderr | 7 +- tests/ui/typeck/issue-120856.stderr | 20 +- ...e-57673-ice-on-deref-of-boxed-trait.stderr | 6 +- ...ssue-73592-borrow_mut-through-deref.stderr | 19 +- tests/ui/typeck/issue-79040.stderr | 7 +- tests/ui/typeck/issue-80779.stderr | 20 +- tests/ui/typeck/issue-81943.stderr | 8 +- tests/ui/typeck/issue-83693.stderr | 7 +- tests/ui/typeck/issue-88844.stderr | 7 +- ...ue-90027-async-fn-return-suggestion.stderr | 7 +- tests/ui/typeck/issue-98260.stderr | 10 +- .../typeck/mismatched-map-under-self.stderr | 9 +- .../ptr-null-mutability-suggestions.stderr | 10 +- tests/ui/typeck/remove-extra-argument.stderr | 10 +- .../remove-semi-but-confused-char.stderr | 9 +- tests/ui/typeck/struct-enum-wrong-args.stderr | 30 +- ...ypeck-builtin-bound-type-parameters.stderr | 78 +- .../typeck_type_placeholder_item.stderr | 235 ++-- .../typeck_type_placeholder_item_help.stderr | 50 +- .../typeck_type_placeholder_lifetime_1.stderr | 9 +- .../typeck_type_placeholder_lifetime_2.stderr | 9 +- tests/ui/typeof/issue-42060.stderr | 14 +- tests/ui/ufcs/ufcs-explicit-self-bad.stderr | 9 +- tests/ui/ufcs/ufcs-partially-resolved.stderr | 110 +- .../ui/ufcs/ufcs-qpath-missing-params.stderr | 9 +- ...nboxed-closure-sugar-not-used-on-fn.stderr | 12 +- ...wrong-number-number-type-parameters.stderr | 45 +- .../unboxed-closure-sugar-wrong-trait.stderr | 9 +- .../unboxed-closures-counter-not-moved.stderr | 6 +- ...mismatch-closure-from-another-scope.stderr | 7 +- tests/ui/unresolved/unresolved-import.stderr | 44 +- tests/ui/unsigned-literal-negation.stderr | 27 +- tests/ui/use/use-mod/use-mod.stderr | 9 +- tests/ui/use/use-nested-groups-error.stderr | 10 +- tests/ui/variance/leaking-unnameables.stderr | 10 +- .../variance/variance-trait-matching.stderr | 8 +- tests/ui/wf/issue-110157.stderr | 10 +- ...clause-placement-assoc-type-in-impl.stderr | 7 +- 1704 files changed, 44007 insertions(+), 11642 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index 4c77892a6b753..c26271b992bed 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -102,7 +102,7 @@ pub struct MisplacedImplTrait<'a> { pub struct MisplacedAssocTyBinding { #[primary_span] pub span: Span, - #[suggestion(code = " = impl", applicability = "maybe-incorrect", style = "verbose")] + #[suggestion(code = " = impl", applicability = "maybe-incorrect")] pub suggestion: Option, } @@ -118,7 +118,7 @@ pub struct UnderscoreExprLhsAssign { #[diag(ast_lowering_base_expression_double_dot, code = E0797)] pub struct BaseExpressionDoubleDot { #[primary_span] - #[suggestion(code = "/* expr */", applicability = "has-placeholders", style = "verbose")] + #[suggestion(code = "/* expr */", applicability = "has-placeholders")] pub span: Span, } @@ -301,7 +301,6 @@ pub struct SubTupleBinding<'a> { #[label] #[suggestion( ast_lowering_sub_tuple_binding_suggestion, - style = "verbose", code = "..", applicability = "maybe-incorrect" )] @@ -448,6 +447,6 @@ pub(crate) struct NoPreciseCapturesOnRpitit { pub(crate) struct YieldInClosure { #[primary_span] pub span: Span, - #[suggestion(code = "#[coroutine] ", applicability = "maybe-incorrect", style = "verbose")] + #[suggestion(code = "#[coroutine] ", applicability = "maybe-incorrect")] pub suggestion: Option, } diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs index bfb9047645011..94128ee2fac09 100644 --- a/compiler/rustc_ast_passes/src/errors.rs +++ b/compiler/rustc_ast_passes/src/errors.rs @@ -221,7 +221,7 @@ pub enum ExternBlockSuggestion { pub struct InvalidSafetyOnExtern { #[primary_span] pub item_span: Span, - #[suggestion(code = "unsafe ", applicability = "machine-applicable", style = "verbose")] + #[suggestion(code = "unsafe ", applicability = "machine-applicable")] pub block: Option, } @@ -380,7 +380,7 @@ pub struct ArgsBeforeConstraint { pub constraints: Span, #[label(ast_passes_args)] pub args: Span, - #[suggestion(code = "{suggestion}", applicability = "machine-applicable", style = "verbose")] + #[suggestion(code = "{suggestion}", applicability = "machine-applicable")] pub data: Span, pub suggestion: String, pub constraint_len: usize, @@ -550,11 +550,7 @@ pub enum WhereClauseBeforeTypeAliasSugg { #[primary_span] span: Span, }, - #[multipart_suggestion( - ast_passes_move_suggestion, - applicability = "machine-applicable", - style = "verbose" - )] + #[multipart_suggestion(ast_passes_move_suggestion, applicability = "machine-applicable")] Move { #[suggestion_part(code = "")] left: Span, @@ -722,12 +718,7 @@ pub struct EqualityInWhere { } #[derive(Subdiagnostic)] -#[suggestion( - ast_passes_suggestion, - code = "{param}: {path}", - style = "verbose", - applicability = "maybe-incorrect" -)] +#[suggestion(ast_passes_suggestion, code = "{param}: {path}", applicability = "maybe-incorrect")] pub struct AssociatedSuggestion { #[primary_span] pub span: Span, diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index e291ebd9bb832..bc9003980e341 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -257,7 +257,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { if is_loop_move & !in_pattern && !matches!(use_spans, UseSpans::ClosureUse { .. }) { if let ty::Ref(_, _, hir::Mutability::Mut) = ty.kind() { // We have a `&mut` ref, we need to reborrow on each iteration (#62112). - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), format!( "consider creating a fresh reborrow of {} here", @@ -500,7 +500,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { if let Some(pat) = finder.parent_pat { sugg.insert(0, (pat.span.shrink_to_lo(), "ref ".to_string())); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "borrow this binding in the pattern to avoid moving the value", sugg, Applicability::MachineApplicable, @@ -680,7 +680,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { return; }; - err.span_suggestion_verbose( + err.span_suggestion( sugg_span.shrink_to_hi(), "consider assigning a value", format!(" = {assign_value}"), @@ -748,7 +748,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { (move_span.shrink_to_lo(), suggestion) }) .collect(); - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("consider {}borrowing {value_name}", borrow_level.mutably_str()), sugg, Applicability::MaybeIncorrect, @@ -1071,7 +1071,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { "{prefix}clone the value from the field instead of using the functional record update \ syntax", ); - err.span_suggestion_verbose(span, msg, sugg, Applicability::MachineApplicable); + err.span_suggestion(span, msg, sugg, Applicability::MachineApplicable); } pub(crate) fn suggest_cloning( @@ -1345,7 +1345,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { } else { "consider cloning the value if the performance cost is acceptable" }; - err.multipart_suggestion_verbose(msg, sugg, Applicability::MachineApplicable); + err.multipart_suggestion(msg, sugg, Applicability::MachineApplicable); true } @@ -2604,7 +2604,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { sugg.push((span, suggest)); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "try explicitly pass `&Self` into the Closure as an argument", sugg, Applicability::MachineApplicable, @@ -3164,7 +3164,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { && path.ident.name == sym::iter && let Some(ty) = expr_ty { - err.span_suggestion_verbose( + err.span_suggestion( path.ident.span, format!( "consider consuming the `{ty}` when turning it into an \ @@ -3176,7 +3176,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { } if !is_format_arguments_item { let addition = format!("let binding = {};\n{}", s, " ".repeat(p)); - err.multipart_suggestion_verbose( + err.multipart_suggestion( msg, vec![ (stmt.span.shrink_to_lo(), addition), @@ -3297,7 +3297,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { .type_implements_trait(iter_trait, [return_ty], self.param_env) .must_apply_modulo_regions() { - err.span_suggestion_hidden( + err.span_suggestion( return_span.shrink_to_hi(), "use `.collect()` to allocate the iterator", ".collect::>()", @@ -3384,7 +3384,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { var_span, scope, ); - err.span_suggestion_verbose( + err.span_suggestion( sugg_span, format!( "to force the {kind} to take ownership of {captured_var} (and any \ @@ -3795,7 +3795,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { if let Some(decl) = local_decl && decl.can_be_made_mutable() { - err.span_suggestion_verbose( + err.span_suggestion( decl.source_info.span.shrink_to_lo(), "consider making this binding mutable", "mut ".to_string(), @@ -3810,7 +3810,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { })) ) { - err.span_suggestion_verbose( + err.span_suggestion( decl.source_info.span.shrink_to_lo(), "to modify the original value, take a borrow instead", "ref mut ".to_string(), diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index 6165a718a3030..0c9dbb1859e73 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -228,7 +228,7 @@ impl<'tcx> BorrowExplanation<'tcx> { if !multiple_borrow_span.is_some_and(|(old, new)| { old.to(info.span.shrink_to_hi()).contains(new) }) { - err.span_suggestion_verbose( + err.span_suggestion( info.span.shrink_to_hi(), "consider adding semicolon after the expression so its \ temporaries are dropped sooner, before the local variables \ @@ -379,7 +379,7 @@ impl<'tcx> BorrowExplanation<'tcx> { category.description(), ); - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_hi(), msg, format!(" + {suggestable_name}"), diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 4567a014fe83d..a1e59a472bb36 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -1184,7 +1184,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { { // If we are in a loop this will be suggested later. if !is_loop_move { - err.span_suggestion_verbose( + err.span_suggestion( move_span.shrink_to_lo(), format!( "consider creating a fresh reborrow of {} here", @@ -1286,11 +1286,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { ) } }; - err.multipart_suggestion_verbose( - msg, - sugg, - Applicability::MaybeIncorrect, - ); + err.multipart_suggestion(msg, sugg, Applicability::MaybeIncorrect); for error in errors { if let FulfillmentErrorCode::Select( SelectionError::Unimplemented, diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index c817a80a541f7..a64726f6ea7a0 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -377,7 +377,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { .source_map() .indentation_before(stmt.span) .unwrap_or_else(|| " ".to_string()); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "clone the value before moving it into the closure", vec![ ( @@ -407,7 +407,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { .source_map() .indentation_before(closure_expr.span) .unwrap_or_else(|| " ".to_string()); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "clone the value before moving it into the closure", vec![ ( @@ -653,7 +653,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { // If the `inner` is a raw pointer, do not suggest removing the "*", see #126863 // FIXME: need to check whether the assigned object can be a raw pointer, see `tests/ui/borrowck/issue-20801.rs`. if !is_raw_ptr { - err.span_suggestion_verbose( + err.span_suggestion( span.with_hi(span.lo() + BytePos(1)), "consider removing the dereference here", String::new(), @@ -662,7 +662,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { } } _ => { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), "consider borrowing here", '&', @@ -720,7 +720,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { suggestions.sort_unstable_by_key(|&(span, _, _)| span); suggestions.dedup_by_key(|&mut (span, _, _)| span); for (span, msg, suggestion) in suggestions { - err.span_suggestion_verbose(span, msg, suggestion, Applicability::MachineApplicable); + err.span_suggestion(span, msg, suggestion, Applicability::MachineApplicable); } } diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index 677029f9d3f95..194bd4cc93534 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -268,7 +268,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { let place = Place::ty_from(local, proj_base, self.body, self.infcx.tcx); if let Some(span) = get_mut_span_in_struct_field(self.infcx.tcx, place.ty, *field) { - err.span_suggestion_verbose( + err.span_suggestion( span, "consider changing this to be mutable", " mut ", @@ -325,7 +325,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { if snippet.starts_with("&mut ") { // We don't have access to the HIR to get accurate spans, but we can // give a best effort structured suggestion. - err.span_suggestion_verbose( + err.span_suggestion( source_info.span.with_hi(source_info.span.lo() + BytePos(5)), "try removing `&mut` here", "", @@ -348,7 +348,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { ); err.note("however, `&mut self` expands to `self: &mut Self`, therefore `self` cannot be borrowed mutably"); } else { - err.span_suggestion_verbose( + err.span_suggestion( decl.source_info.span.shrink_to_lo(), "consider making the binding mutable", "mut ", @@ -408,7 +408,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { fn_decl.implicit_self, hir::ImplicitSelfKind::RefImm | hir::ImplicitSelfKind::RefMut ) { - err.span_suggestion_verbose( + err.span_suggestion( upvar_ident.span.shrink_to_lo(), "consider changing this to be mutable", "mut ", @@ -419,7 +419,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { } } } else { - err.span_suggestion_verbose( + err.span_suggestion( upvar_ident.span.shrink_to_lo(), "consider changing this to be mutable", "mut ", @@ -449,7 +449,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { .is_ok_and(|snippet| snippet.starts_with("&mut ")) => { err.span_label(span, format!("cannot {act}")); - err.span_suggestion_verbose( + err.span_suggestion( span.with_hi(span.lo() + BytePos(5)), "try removing `&mut` here", "", @@ -770,7 +770,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { return; } - err.span_suggestion_verbose( + err.span_suggestion( local_decl.source_info.span.shrink_to_lo(), "consider changing this to be mutable", "mut ", @@ -915,7 +915,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { } AddrOf(BorrowKind::Ref, Mutability::Not, expr) => { // We have `for _ in &i`, suggest `for _ in &mut i`. - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_lo(), "use a mutable iterator instead", "mut ", @@ -1070,7 +1070,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { if let Some(mut res) = res && res.peek().is_some() { - err.span_suggestion_verbose( + err.span_suggestion( path_segment.ident.span, "you may want to use `iter_mut` here", "iter_mut", @@ -1198,7 +1198,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { sugg.push(s); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "consider changing this to be a mutable {pointer_desc}{}", if is_trait_sig { @@ -1330,7 +1330,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { ("specifying", local.pat.span.shrink_to_hi(), format!(": {message}")) } }; - err.span_suggestion_verbose( + err.span_suggestion( span, format!("consider {changing} this binding's type"), sugg, diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 13839214adc05..41c0a7dc2587c 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -293,7 +293,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { }); if suggestions.len() > 0 { suggestions.dedup(); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "consider restricting the type parameter to the `'static` lifetime", suggestions, Applicability::MaybeIncorrect, @@ -912,7 +912,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { spans_suggs.push((alias_span.shrink_to_hi(), "<'a>".to_string())); } - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!( "to declare that the trait object {captures}, you can add a lifetime parameter `'a` in the type alias" ), @@ -1009,7 +1009,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { "calling this method introduces the `impl`'s `'static` requirement", ); err.subdiagnostic(RequireStaticErr::UsedImpl { multi_span }); - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_hi(), "consider relaxing the implicit `'static` requirement", " + '_", @@ -1172,7 +1172,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { })); if ocx.select_all_or_error().is_empty() && count > 0 { - diag.span_suggestion_verbose( + diag.span_suggestion( tcx.hir().body(*body).value.peel_blocks().span.shrink_to_lo(), "dereference the return value", "*".repeat(count), @@ -1219,7 +1219,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { _ => {} } if let Some(closure_span) = closure_span { - diag.span_suggestion_verbose( + diag.span_suggestion( closure_span, "consider adding 'move' keyword before the nested closure", "move ", diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs index 40c2ef1c91e14..9cf3b83ce6503 100644 --- a/compiler/rustc_borrowck/src/session_diagnostics.rs +++ b/compiler/rustc_borrowck/src/session_diagnostics.rs @@ -49,7 +49,7 @@ pub(crate) struct GenericDoesNotLiveLongEnough { #[derive(LintDiagnostic)] #[diag(borrowck_var_does_not_need_mut)] pub(crate) struct VarNeedNotMut { - #[suggestion(style = "short", applicability = "machine-applicable", code = "")] + #[suggestion(applicability = "machine-applicable", code = "")] pub span: Span, } #[derive(Diagnostic)] @@ -405,8 +405,7 @@ pub(crate) enum CaptureReasonSuggest<'tcx> { #[suggestion( borrowck_suggest_iterate_over_slice, applicability = "maybe-incorrect", - code = "&", - style = "verbose" + code = "&" )] IterateSlice { ty: Ty<'tcx>, @@ -416,8 +415,7 @@ pub(crate) enum CaptureReasonSuggest<'tcx> { #[suggestion( borrowck_suggest_create_freash_reborrow, applicability = "maybe-incorrect", - code = ".as_mut()", - style = "verbose" + code = ".as_mut()" )] FreshReborrow { #[primary_span] diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/errors.rs index 49d640436c2f3..4548fd1c4793e 100644 --- a/compiler/rustc_builtin_macros/src/errors.rs +++ b/compiler/rustc_builtin_macros/src/errors.rs @@ -49,7 +49,7 @@ pub(crate) struct AssertRequiresExpression { pub(crate) struct AssertMissingComma { #[primary_span] pub(crate) span: Span, - #[suggestion(code = ", ", applicability = "maybe-incorrect", style = "short")] + #[suggestion(code = ", ", applicability = "maybe-incorrect")] pub(crate) comma: Span, } @@ -401,7 +401,7 @@ pub(crate) struct MultipleDefaultAttrsSugg { #[diag(builtin_macros_default_arg)] pub(crate) struct DefaultHasArg { #[primary_span] - #[suggestion(code = "#[default]", style = "hidden", applicability = "maybe-incorrect")] + #[suggestion(code = "#[default]", applicability = "maybe-incorrect")] pub(crate) span: Span, } @@ -536,7 +536,6 @@ pub(crate) struct InvalidFormatStringLabel { pub(crate) enum InvalidFormatStringSuggestion { #[multipart_suggestion( builtin_macros_format_use_positional, - style = "verbose", applicability = "machine-applicable" )] UsePositional { diff --git a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs index b71b93cc67c16..c634982a55db2 100644 --- a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs +++ b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs @@ -47,8 +47,7 @@ impl Emitter for AnnotateSnippetEmitter { fn emit_diagnostic(&mut self, mut diag: DiagInner) { let fluent_args = to_fluent_args(diag.args.iter()); - let mut suggestions = diag.suggestions.unwrap_or(vec![]); - self.primary_span_formatted(&mut diag.span, &mut suggestions, &fluent_args); + let suggestions = diag.suggestions.unwrap_or(vec![]); self.fix_multispans_in_extern_macros_and_render_macro_backtrace( &mut diag.span, diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index d500f6d88a01b..5df06cc1a4b9c 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -863,23 +863,6 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { msg: impl Into, suggestion: Vec<(Span, String)>, applicability: Applicability, - ) -> &mut Self { - self.multipart_suggestion_with_style( - msg, - suggestion, - applicability, - SuggestionStyle::ShowCode, - ) - } } - - /// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic. - /// In other words, multiple changes need to be applied as part of this suggestion. - #[rustc_lint_diagnostics] - pub fn multipart_suggestion_verbose( - &mut self, - msg: impl Into, - suggestion: Vec<(Span, String)>, - applicability: Applicability, ) -> &mut Self { self.multipart_suggestion_with_style( msg, @@ -887,7 +870,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { applicability, SuggestionStyle::ShowAlways, ) - } + } } /// [`Diag::multipart_suggestion()`] but you can set the [`SuggestionStyle`]. #[rustc_lint_diagnostics] @@ -948,42 +931,6 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { ) } - with_fn! { with_span_suggestion, - /// Prints out a message with a suggested edit of the code. - /// - /// In case of short messages and a simple suggestion, rustc displays it as a label: - /// - /// ```text - /// try adding parentheses: `(tup.0).1` - /// ``` - /// - /// The message - /// - /// * should not end in any punctuation (a `:` is added automatically) - /// * should not be a question (avoid language like "did you mean") - /// * should not contain any phrases like "the following", "as shown", etc. - /// * may look like "to do xyz, use" or "to do xyz, use abc" - /// * may contain a name of a function, variable, or type, but not whole expressions - /// - /// See `CodeSuggestion` for more information. - #[rustc_lint_diagnostics] - pub fn span_suggestion( - &mut self, - sp: Span, - msg: impl Into, - suggestion: impl ToString, - applicability: Applicability, - ) -> &mut Self { - self.span_suggestion_with_style( - sp, - msg, - suggestion, - applicability, - SuggestionStyle::ShowCode, - ); - self - } } - /// [`Diag::span_suggestion()`] but you can set the [`SuggestionStyle`]. #[rustc_lint_diagnostics] pub fn span_suggestion_with_style( @@ -1009,10 +956,10 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { self } - with_fn! { with_span_suggestion_verbose, + with_fn! { with_span_suggestion, /// Always show the suggested change. #[rustc_lint_diagnostics] - pub fn span_suggestion_verbose( + pub fn span_suggestion( &mut self, sp: Span, msg: impl Into, @@ -1045,7 +992,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { msg, suggestions, applicability, - SuggestionStyle::ShowCode, + SuggestionStyle::ShowAlways, ) } } @@ -1116,59 +1063,12 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { self.push_suggestion(CodeSuggestion { substitutions, msg: self.subdiagnostic_message_to_diagnostic_message(msg), - style: SuggestionStyle::ShowCode, + style: SuggestionStyle::ShowAlways, applicability, }); self } - with_fn! { with_span_suggestion_short, - /// Prints out a message with a suggested edit of the code. If the suggestion is presented - /// inline, it will only show the message and not the suggestion. - /// - /// See `CodeSuggestion` for more information. - #[rustc_lint_diagnostics] - pub fn span_suggestion_short( - &mut self, - sp: Span, - msg: impl Into, - suggestion: impl ToString, - applicability: Applicability, - ) -> &mut Self { - self.span_suggestion_with_style( - sp, - msg, - suggestion, - applicability, - SuggestionStyle::HideCodeInline, - ); - self - } } - - /// Prints out a message for a suggestion without showing the suggested code. - /// - /// This is intended to be used for suggestions that are obvious in what the changes need to - /// be from the message, showing the span label inline would be visually unpleasant - /// (marginally overlapping spans or multiline spans) and showing the snippet window wouldn't - /// improve understandability. - #[rustc_lint_diagnostics] - pub fn span_suggestion_hidden( - &mut self, - sp: Span, - msg: impl Into, - suggestion: impl ToString, - applicability: Applicability, - ) -> &mut Self { - self.span_suggestion_with_style( - sp, - msg, - suggestion, - applicability, - SuggestionStyle::HideCodeAlways, - ); - self - } - with_fn! { with_tool_only_span_suggestion, /// Adds a suggestion to the JSON output that will not be shown in the CLI. /// diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index 0af80bc5c67b6..14e20948cb51a 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -381,7 +381,7 @@ pub struct ExpectedLifetimeParameter { } #[derive(Subdiagnostic)] -#[suggestion(errors_indicate_anonymous_lifetime, code = "{suggestion}", style = "verbose")] +#[suggestion(errors_indicate_anonymous_lifetime, code = "{suggestion}")] pub struct IndicateAnonymousLifetime { #[primary_span] pub span: Span, diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index aa47ca166764b..c6beb7b881b37 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -212,81 +212,6 @@ pub trait Emitter: Translate { fn source_map(&self) -> Option<&Lrc>; - /// Formats the substitutions of the primary_span - /// - /// There are a lot of conditions to this method, but in short: - /// - /// * If the current `DiagInner` has only one visible `CodeSuggestion`, - /// we format the `help` suggestion depending on the content of the - /// substitutions. In that case, we modify the span and clear the - /// suggestions. - /// - /// * If the current `DiagInner` has multiple suggestions, - /// we leave `primary_span` and the suggestions untouched. - fn primary_span_formatted( - &mut self, - primary_span: &mut MultiSpan, - suggestions: &mut Vec, - fluent_args: &FluentArgs<'_>, - ) { - if let Some((sugg, rest)) = suggestions.split_first() { - let msg = self.translate_message(&sugg.msg, fluent_args).map_err(Report::new).unwrap(); - if rest.is_empty() && - // ^ if there is only one suggestion - // don't display multi-suggestions as labels - sugg.substitutions.len() == 1 && - // don't display multipart suggestions as labels - sugg.substitutions[0].parts.len() == 1 && - // don't display long messages as labels - msg.split_whitespace().count() < 10 && - // don't display multiline suggestions as labels - !sugg.substitutions[0].parts[0].snippet.contains('\n') && - ![ - // when this style is set we want the suggestion to be a message, not inline - SuggestionStyle::HideCodeAlways, - // trivial suggestion for tooling's sake, never shown - SuggestionStyle::CompletelyHidden, - // subtle suggestion, never shown inline - SuggestionStyle::ShowAlways, - ].contains(&sugg.style) - { - let substitution = &sugg.substitutions[0].parts[0].snippet.trim(); - let msg = if substitution.is_empty() || sugg.style.hide_inline() { - // This substitution is only removal OR we explicitly don't want to show the - // code inline (`hide_inline`). Therefore, we don't show the substitution. - format!("help: {msg}") - } else { - // Show the default suggestion text with the substitution - format!( - "help: {}{}: `{}`", - msg, - if self.source_map().is_some_and(|sm| is_case_difference( - sm, - substitution, - sugg.substitutions[0].parts[0].span, - )) { - " (notice the capitalization)" - } else { - "" - }, - substitution, - ) - }; - primary_span.push_span_label(sugg.substitutions[0].parts[0].span, msg); - - // We return only the modified primary_span - suggestions.clear(); - } else { - // if there are multiple suggestions, print them all in full - // to be consistent. We could try to figure out if we can - // make one (or the first one) inline, but that would give - // undue importance to a semi-random suggestion - } - } else { - // do nothing - } - } - fn fix_multispans_in_extern_macros_and_render_macro_backtrace( &self, span: &mut MultiSpan, @@ -504,8 +429,7 @@ impl Emitter for HumanEmitter { fn emit_diagnostic(&mut self, mut diag: DiagInner) { let fluent_args = to_fluent_args(diag.args.iter()); - let mut suggestions = diag.suggestions.unwrap_or(vec![]); - self.primary_span_formatted(&mut diag.span, &mut suggestions, &fluent_args); + let suggestions = diag.suggestions.unwrap_or(vec![]); self.fix_multispans_in_extern_macros_and_render_macro_backtrace( &mut diag.span, @@ -2177,23 +2101,7 @@ impl HumanEmitter { SuggestionStyle::CompletelyHidden => { // do not display this suggestion, it is meant only for tools } - SuggestionStyle::HideCodeAlways => { - if let Err(e) = self.emit_messages_default_inner( - &MultiSpan::new(), - &[(sugg.msg.to_owned(), Style::HeaderMsg)], - args, - &None, - &Level::Help, - max_line_num_len, - true, - None, - ) { - panic!("failed to emit error: {e}"); - } - } - SuggestionStyle::HideCodeInline - | SuggestionStyle::ShowCode - | SuggestionStyle::ShowAlways => { + SuggestionStyle::ShowAlways => { if let Err(e) = self.emit_suggestion_default( span, sugg, diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 2086d4030f905..ac2c59c6269ab 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -105,26 +105,12 @@ rustc_data_structures::static_assert_size!(PResult<'_, bool>, 24); #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, Encodable, Decodable)] pub enum SuggestionStyle { - /// Hide the suggested code when displaying this suggestion inline. - HideCodeInline, - /// Always hide the suggested code but display the message. - HideCodeAlways, /// Do not display this suggestion in the cli output, it is only meant for tools. CompletelyHidden, - /// Always show the suggested code. - /// This will *not* show the code if the suggestion is inline *and* the suggested code is - /// empty. - ShowCode, /// Always show the suggested code independently. ShowAlways, } -impl SuggestionStyle { - fn hide_inline(&self) -> bool { - !matches!(*self, SuggestionStyle::ShowCode) - } -} - #[derive(Clone, Debug, PartialEq, Hash, Encodable, Decodable)] pub struct CodeSuggestion { /// Each substitute can have multiple variants due to multiple diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs index 0be7403f25b17..c3293722722f6 100644 --- a/compiler/rustc_expand/src/errors.rs +++ b/compiler/rustc_expand/src/errors.rs @@ -282,12 +282,7 @@ pub(crate) struct IncompleteParse<'a> { #[note(expand_macro_expands_to_match_arm)] pub expands_to_match_arm: Option<()>, - #[suggestion( - expand_suggestion_add_semi, - style = "verbose", - code = ";", - applicability = "maybe-incorrect" - )] + #[suggestion(expand_suggestion_add_semi, code = ";", applicability = "maybe-incorrect")] pub add_semicolon: Option, } diff --git a/compiler/rustc_expand/src/mbe/diagnostics.rs b/compiler/rustc_expand/src/mbe/diagnostics.rs index 2df8b8f00f862..fc13435f092c4 100644 --- a/compiler/rustc_expand/src/mbe/diagnostics.rs +++ b/compiler/rustc_expand/src/mbe/diagnostics.rs @@ -93,7 +93,7 @@ pub(super) fn failed_to_match_macro<'cx>( if comma_span.is_dummy() { err.note("you might be missing a comma"); } else { - err.span_suggestion_short( + err.span_suggestion( comma_span, "missing comma here", ", ", @@ -276,7 +276,7 @@ pub(super) fn emit_frag_parse_err( if parser.token == token::Semi { if let Ok(snippet) = parser.psess.source_map().span_to_snippet(site_span) { - e.span_suggestion_verbose( + e.span_suggestion( site_span, "surround the macro invocation with `{}` to interpret the expansion as a statement", format!("{{ {snippet}; }}"), @@ -284,7 +284,7 @@ pub(super) fn emit_frag_parse_err( ); } } else { - e.span_suggestion_verbose( + e.span_suggestion( site_span.shrink_to_hi(), "add `;` to interpret the expansion as a statement", ";", diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 91b1506d1e4e5..52886f66a95a7 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -273,7 +273,7 @@ hir_analysis_missing_trait_item = not all trait items implemented, missing: `{$m hir_analysis_missing_trait_item_label = `{$item}` from trait -hir_analysis_missing_trait_item_suggestion = implement the missing item: `{$snippet}` +hir_analysis_missing_trait_item_suggestion = implement the missing item hir_analysis_missing_trait_item_unstable = not all trait items implemented, missing: `{$missing_item_name}` .note = default implementation of `{$missing_item_name}` is unstable diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs index b5b68471b9d16..9b7e969b2add2 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -1001,7 +1001,7 @@ fn report_trait_method_mismatch<'tcx>( match sig.decl.output { hir::FnRetTy::DefaultReturn(sp) => { let sugg = format!(" -> {}", trait_sig.output()); - diag.span_suggestion_verbose(sp, msg, sugg, ap); + diag.span_suggestion(sp, msg, sugg, ap); } hir::FnRetTy::Return(hir_ty) => { let sugg = trait_sig.output(); diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index 8469cbbbc7d61..c849c6a5557dc 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -239,17 +239,10 @@ fn missing_items_err( if let Some(span) = tcx.hir().span_if_local(trait_item.def_id) { missing_trait_item_label .push(errors::MissingTraitItemLabel { span, item: trait_item.name }); - missing_trait_item.push(errors::MissingTraitItemSuggestion { - span: sugg_sp, - code, - snippet, - }); + missing_trait_item.push(errors::MissingTraitItemSuggestion { span: sugg_sp, code }); } else { - missing_trait_item_none.push(errors::MissingTraitItemSuggestionNone { - span: sugg_sp, - code, - snippet, - }) + missing_trait_item_none + .push(errors::MissingTraitItemSuggestionNone { span: sugg_sp, code }) } } diff --git a/compiler/rustc_hir_analysis/src/coherence/unsafety.rs b/compiler/rustc_hir_analysis/src/coherence/unsafety.rs index 5fe21e9b82242..863e0763216c1 100644 --- a/compiler/rustc_hir_analysis/src/coherence/unsafety.rs +++ b/compiler/rustc_hir_analysis/src/coherence/unsafety.rs @@ -28,7 +28,7 @@ pub(super) fn check_item( "implementing the trait `{}` is not unsafe", trait_ref.print_trait_sugared() ) - .with_span_suggestion_verbose( + .with_span_suggestion( span.with_hi(span.lo() + rustc_span::BytePos(7)), "remove `unsafe` from this trait implementation", "", @@ -52,7 +52,7 @@ pub(super) fn check_item( upholds those invariants before adding the `unsafe` keyword", trait_ref.print_trait_sugared() )) - .with_span_suggestion_verbose( + .with_span_suggestion( span.shrink_to_lo(), "add `unsafe` to this trait implementation", "unsafe ", @@ -76,7 +76,7 @@ pub(super) fn check_item( upholds those invariants before adding the `unsafe` keyword", trait_ref.print_trait_sugared() )) - .with_span_suggestion_verbose( + .with_span_suggestion( span.shrink_to_lo(), "add `unsafe` to this trait implementation", "unsafe ", diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 7d44ac458de86..c0e14706204fd 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -116,7 +116,6 @@ pub enum AssocItemNotFoundSugg<'a> { #[suggestion( hir_analysis_assoc_item_not_found_similar_in_other_trait_sugg, code = "{suggested_name}", - style = "verbose", applicability = "maybe-incorrect" )] SimilarInOtherTrait { @@ -366,7 +365,7 @@ pub struct TypeofReservedKeywordUsed<'tcx> { #[primary_span] #[label] pub span: Span, - #[suggestion(style = "verbose", code = "{ty}")] + #[suggestion(code = "{ty}")] pub opt_sugg: Option<(Span, Applicability)>, } @@ -453,7 +452,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for MissingTypeParams { } else { // The user wrote `Iterator`, so we don't have a type we can suggest, but at // least we can clue them to the correct syntax `Iterator`. - err.span_suggestion_verbose( + err.span_suggestion( self.span.shrink_to_hi(), fluent::hir_analysis_suggestion, format!( @@ -766,7 +765,7 @@ pub(crate) struct PlaceholderNotAllowedItemSignatures { pub(crate) struct AssociatedTypeTraitUninferredGenericParams { #[primary_span] pub span: Span, - #[suggestion(style = "verbose", applicability = "maybe-incorrect", code = "{bound}")] + #[suggestion(applicability = "maybe-incorrect", code = "{bound}")] pub inferred_sugg: Option, pub bound: String, #[subdiagnostic] @@ -932,13 +931,11 @@ pub(crate) struct MissingTraitItemSuggestion { #[primary_span] pub span: Span, pub code: String, - pub snippet: String, } #[derive(Subdiagnostic)] #[suggestion( hir_analysis_missing_trait_item_suggestion, - style = "hidden", applicability = "has-placeholders", code = "{code}" )] @@ -946,7 +943,6 @@ pub(crate) struct MissingTraitItemSuggestionNone { #[primary_span] pub span: Span, pub code: String, - pub snippet: String, } #[derive(Diagnostic)] @@ -1521,7 +1517,6 @@ pub struct StaticMutRef<'a> { pub enum StaticMutRefSugg { #[suggestion( hir_analysis_suggestion, - style = "verbose", code = "addr_of!({var})", applicability = "maybe-incorrect" )] @@ -1532,7 +1527,6 @@ pub enum StaticMutRefSugg { }, #[suggestion( hir_analysis_suggestion_mut, - style = "verbose", code = "addr_of_mut!({var})", applicability = "maybe-incorrect" )] @@ -1560,7 +1554,6 @@ pub struct RefOfMutStatic<'a> { pub enum RefOfMutStaticSugg { #[suggestion( hir_analysis_suggestion, - style = "verbose", code = "addr_of!({var})", applicability = "maybe-incorrect" )] @@ -1571,7 +1564,6 @@ pub enum RefOfMutStaticSugg { }, #[suggestion( hir_analysis_suggestion_mut, - style = "verbose", code = "addr_of_mut!({var})", applicability = "maybe-incorrect" )] diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs index 2d240699105d6..b4061ad24317c 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs @@ -255,7 +255,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { { // We suggested constraining a type parameter, but the associated item on it // was also not an exact match, so we also suggest changing it. - err.span_suggestion_verbose( + err.span_suggestion( assoc_name.span, fluent::hir_analysis_assoc_item_not_found_similar_in_other_trait_with_bound_sugg, suggested_name, @@ -375,7 +375,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { .keys() .any(|full_span| full_span.contains(span)) { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), "you are looking for the module in `std`, not the primitive type", "std::", @@ -388,7 +388,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { traits.sort(); match (&types[..], &traits[..]) { ([], []) => { - err.span_suggestion_verbose( + err.span_suggestion( span, format!( "if there were a type named `Type` that implements a trait named \ @@ -400,7 +400,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { ); } ([], [trait_str]) => { - err.span_suggestion_verbose( + err.span_suggestion( span, format!( "if there were a type named `Example` that implemented `{trait_str}`, \ @@ -423,7 +423,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { ); } ([type_str], []) => { - err.span_suggestion_verbose( + err.span_suggestion( span, format!( "if there were a trait named `Example` with associated type `{name}` \ @@ -1013,7 +1013,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { { let reported = struct_span_code_err!(tcx.dcx(), span, E0223, "ambiguous associated type") - .with_span_suggestion_verbose( + .with_span_suggestion( ident2.span.to(ident3.span), format!("there is an associated function with a similar name: `{name}`"), name, @@ -1260,7 +1260,7 @@ pub fn prohibit_assoc_item_constraint( // Now emit the suggestion if let Ok(suggestion) = tcx.sess.source_map().span_to_snippet(removal_span) { - e.span_suggestion_verbose( + e.span_suggestion( removal_span, format!("consider removing this associated item {}", constraint.kind.descr()), suggestion, @@ -1273,7 +1273,7 @@ pub fn prohibit_assoc_item_constraint( // i.e., replacing `<..., T = A, ...>` with `<..., A, ...>`. let suggest_direct_use = |e: &mut Diag<'_>, sp: Span| { if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(sp) { - e.span_suggestion_verbose( + e.span_suggestion( constraint.span, format!("to use `{snippet}` as a generic argument specify it directly"), snippet, @@ -1345,7 +1345,7 @@ pub fn prohibit_assoc_item_constraint( let suggestions = vec![param_decl, (constraint.span, format!("{}", matching_param.name))]; - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("declare the type parameter right after the `impl` keyword"), suggestions, Applicability::MaybeIncorrect, @@ -1455,7 +1455,7 @@ fn generics_args_err_extend<'a>( if tcx.generics_of(adt_def.did()).is_empty() { // FIXME(estebank): we could also verify that the arguments being // work for the `enum`, instead of just looking if it takes *any*. - err.span_suggestion_verbose( + err.span_suggestion( args_span, format!("{type_name} doesn't have generic parameters"), "", @@ -1520,13 +1520,13 @@ fn generics_args_err_extend<'a>( }, (args_span, String::new()), ]; - err.multipart_suggestion_verbose(msg, suggestion, Applicability::MaybeIncorrect); + err.multipart_suggestion(msg, suggestion, Applicability::MaybeIncorrect); } GenericsArgsErrExtend::PrimTy(prim_ty) => { let name = prim_ty.name_str(); for segment in segments { if let Some(args) = segment.args { - err.span_suggestion_verbose( + err.span_suggestion( segment.ident.span.shrink_to_hi().to(args.span_ext), format!("primitive type `{name}` doesn't have generic parameters"), "", @@ -1548,7 +1548,7 @@ fn generics_args_err_extend<'a>( err.span_note(span, format!("{kind} `{name}` defined here")); } GenericsArgsErrExtend::SelfTyParam(span) => { - err.span_suggestion_verbose( + err.span_suggestion( span, "the `Self` type doesn't accept type parameters", "", @@ -1590,7 +1590,7 @@ fn generics_args_err_extend<'a>( if generics == 0 { // FIXME(estebank): we could also verify that the arguments being // work for the `enum`, instead of just looking if it takes *any*. - err.span_suggestion_verbose( + err.span_suggestion( segment.ident.span.shrink_to_hi().to(args.span_ext), "the `Self` type doesn't accept type parameters", "", @@ -1598,7 +1598,7 @@ fn generics_args_err_extend<'a>( ); return; } else { - err.span_suggestion_verbose( + err.span_suggestion( segment.ident.span, format!( "the `Self` type doesn't accept type parameters, use the \ diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs index 240a749de96a6..2011f607811a3 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs @@ -65,7 +65,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { && !self.maybe_suggest_impl_trait(self_ty, &mut diag) { // FIXME: Only emit this suggestion if the trait is object safe. - diag.multipart_suggestion_verbose(label, sugg, Applicability::MachineApplicable); + diag.multipart_suggestion(label, sugg, Applicability::MachineApplicable); } // Check if the impl trait that we are considering is an impl of a local trait. self.maybe_suggest_blanket_trait_impl(self_ty, &mut diag); @@ -75,7 +75,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { tcx.node_span_lint(BARE_TRAIT_OBJECTS, self_ty.hir_id, self_ty.span, |lint| { lint.primary_message("trait objects without an explicit `dyn` are deprecated"); if self_ty.span.can_be_used_for_suggestions() { - lint.multipart_suggestion_verbose( + lint.multipart_suggestion( "if this is an object-safe trait, use `dyn`", sugg, Applicability::MachineApplicable, @@ -201,9 +201,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { "{pre}use `impl {trait_name}` to return an opaque type, as long as you return a \ single underlying type", ); - diag.multipart_suggestion_verbose(msg, impl_sugg, Applicability::MachineApplicable); + diag.multipart_suggestion(msg, impl_sugg, Applicability::MachineApplicable); if is_object_safe { - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "alternatively, you can return an owned trait object", vec![ (ty.span.shrink_to_lo(), "Box dyn HirTyLowerer<'tcx> + '_ { } let sugg = self.add_generic_param_suggestion(generics, self_ty.span, &trait_name); if !sugg.is_empty() { - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("use a new generic type parameter, constrained by `{trait_name}`"), sugg, Applicability::MachineApplicable, ); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "you can also use an opaque type, but users won't be able to specify the type \ parameter when calling the `fn`, having to rely exclusively on type inference", impl_sugg, @@ -251,7 +251,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } else { vec![(self_ty.span.shrink_to_lo(), "&dyn ".to_string())] }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!( "alternatively, use a trait object to accept any type that implements \ `{trait_name}`, accessing its methods at runtime using dynamic dispatch", @@ -290,7 +290,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { return; } - diag.span_suggestion_verbose( + diag.span_suggestion( lo.between(hi), "you might have meant to write a bound here", ": ", diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 2a68d3915bbbc..1620e227a55e5 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -937,7 +937,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { hir::AssocItemConstraintKind::Bound { bounds: _ } => {} } } else { - err.span_suggestion_verbose( + err.span_suggestion( span.with_hi(assoc_name.span.lo()), "use fully-qualified syntax to disambiguate", format!("<{ty_param_name} as {}>::", bound.print_only_trait_path()), diff --git a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs index 5d435a8edf9ff..63b0bf4a79ae5 100644 --- a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs @@ -667,12 +667,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let sugg = format!("<{suggested_args}>"); debug!("sugg: {:?}", sugg); - err.span_suggestion_verbose( - span.shrink_to_hi(), - msg, - sugg, - Applicability::HasPlaceholders, - ); + err.span_suggestion(span.shrink_to_hi(), msg, sugg, Applicability::HasPlaceholders); } AngleBrackets::Available => { @@ -692,7 +687,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let sugg = format!("{sugg_prefix}{suggested_args}{sugg_suffix}"); debug!("sugg: {:?}", sugg); - err.span_suggestion_verbose(sugg_span, msg, sugg, Applicability::HasPlaceholders); + err.span_suggestion(sugg_span, msg, sugg, Applicability::HasPlaceholders); } AngleBrackets::Implied => { // We never encounter missing lifetimes in situations in which lifetimes are elided @@ -717,12 +712,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let sugg = format!("<{suggested_args}>"); debug!("sugg: {:?}", sugg); - err.span_suggestion_verbose( - span.shrink_to_hi(), - msg, - sugg, - Applicability::HasPlaceholders, - ); + err.span_suggestion(span.shrink_to_hi(), msg, sugg, Applicability::HasPlaceholders); } AngleBrackets::Available => { let gen_args_span = self.gen_args.span().unwrap(); @@ -750,7 +740,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let sugg = format!("{sugg_prefix}{suggested_args}{sugg_suffix}"); debug!("sugg: {:?}", sugg); - err.span_suggestion_verbose(sugg_span, msg, sugg, Applicability::HasPlaceholders); + err.span_suggestion(sugg_span, msg, sugg, Applicability::HasPlaceholders); } } } @@ -1019,7 +1009,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { .collect::>(); if !suggestions.is_empty() { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "replace the generic bound{s} with the associated type{s}", s = pluralize!(unbound_types.len()) diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index 3b199b7e3c26d..1f8701d30572c 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -739,7 +739,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); if let Some((removal_span, kind, path)) = &unit_variant { - err.span_suggestion_verbose( + err.span_suggestion( *removal_span, format!( "`{path}` is a unit {kind}, and does not take parentheses to be constructed", diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs index 53e44d6bcaee8..5e8da4a55ad28 100644 --- a/compiler/rustc_hir_typeck/src/cast.rs +++ b/compiler/rustc_hir_typeck/src/cast.rs @@ -262,14 +262,14 @@ impl<'a, 'tcx> CastCheck<'tcx> { if matches!(self.expr.kind, ExprKind::AddrOf(..)) { // get just the borrow part of the expression let span = self.expr_span.with_hi(self.expr.peel_borrows().span.lo()); - err.span_suggestion_verbose( + err.span_suggestion( span, "remove the unneeded borrow", "", Applicability::MachineApplicable, ); } else { - err.span_suggestion_verbose( + err.span_suggestion( self.expr_span.shrink_to_lo(), "dereference the expression", "*", @@ -428,7 +428,7 @@ impl<'a, 'tcx> CastCheck<'tcx> { )); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider borrowing the value", suggestion, Applicability::MachineApplicable, diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index f72e8a4afdef6..1e856b74b9f06 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -1585,7 +1585,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { ); if let Some(value) = fcx.err_ctxt().ty_kind_suggestion(fcx.param_env, found) { - err.span_suggestion_verbose( + err.span_suggestion( cause.span.shrink_to_hi(), "give the `return` a value of the expected type", format!(" {value}"), diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index ad9c1e2821172..03d177a05522b 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -1085,7 +1085,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && let ty::Adt(f_def, _f_args) = found.kind() && e_def == f_def { - err.span_suggestion_verbose( + err.span_suggestion( *span, "use the type name directly", self.tcx.value_path_str_with_args(e_def.did(), e_args), diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index e49b921e63cac..9fcc3eb69b038 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -144,7 +144,7 @@ pub struct ExplicitDestructorCall { pub enum ExplicitDestructorCallSugg { #[suggestion(hir_typeck_suggestion, code = "drop", applicability = "maybe-incorrect")] Empty(#[primary_span] Span), - #[multipart_suggestion(hir_typeck_suggestion, style = "short")] + #[multipart_suggestion(hir_typeck_suggestion)] Snippet { #[suggestion_part(code = "drop(")] lo: Span, @@ -196,7 +196,6 @@ pub struct DependencyOnUnitNeverTypeFallback<'tcx> { #[derive(Subdiagnostic)] #[multipart_suggestion( hir_typeck_add_missing_parentheses_in_range, - style = "verbose", applicability = "maybe-incorrect" )] pub struct AddMissingParenthesesInRange { @@ -354,7 +353,6 @@ pub enum OptionResultRefMismatch { #[suggestion( hir_typeck_option_result_copied, code = ".copied()", - style = "verbose", applicability = "machine-applicable" )] Copied { @@ -365,7 +363,6 @@ pub enum OptionResultRefMismatch { #[suggestion( hir_typeck_option_result_cloned, code = ".cloned()", - style = "verbose", applicability = "machine-applicable" )] Cloned { @@ -377,7 +374,7 @@ pub enum OptionResultRefMismatch { // #[suggestion( // hir_typeck_option_result_asref, // code = ".as_ref()", - // style = "verbose", + // // applicability = "machine-applicable" // )] // AsRef { @@ -449,11 +446,7 @@ pub struct UnionPatDotDot { } #[derive(Subdiagnostic)] -#[multipart_suggestion( - hir_typeck_use_is_empty, - applicability = "maybe-incorrect", - style = "verbose" -)] +#[multipart_suggestion(hir_typeck_use_is_empty, applicability = "maybe-incorrect")] pub struct UseIsEmpty { #[suggestion_part(code = "!")] pub lo: Span, @@ -594,12 +587,7 @@ impl rustc_errors::Subdiagnostic for CastUnknownPointerSub { #[derive(Subdiagnostic)] pub enum CannotCastToBoolHelp { - #[suggestion( - hir_typeck_suggestion, - applicability = "machine-applicable", - code = " != 0", - style = "verbose" - )] + #[suggestion(hir_typeck_suggestion, applicability = "machine-applicable", code = " != 0")] Numeric(#[primary_span] Span), #[label(hir_typeck_label)] Unsupported(#[primary_span] Span), @@ -622,11 +610,7 @@ pub struct DerefImplsIsEmpty { } #[derive(Subdiagnostic)] -#[multipart_suggestion( - hir_typeck_convert_using_method, - applicability = "machine-applicable", - style = "verbose" -)] +#[multipart_suggestion(hir_typeck_convert_using_method, applicability = "machine-applicable")] pub struct SuggestConvertViaMethod<'tcx> { #[suggestion_part(code = "{sugg}")] pub span: Span, diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index bd5e5294983d2..86101ab540429 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -689,7 +689,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Some(val) = self.err_ctxt().ty_kind_suggestion(self.param_env, ty) { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_hi(), "give the `break` a value of the expected type", format!(" {val}"), @@ -959,7 +959,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_label(lhs.span, "cannot assign to this expression"); self.comes_from_while_condition(lhs.hir_id, |expr| { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_lo(), "you might have meant to use pattern destructuring", "let ", @@ -984,7 +984,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // foo() // *bar = baz; // (#80446). - err.span_suggestion_verbose( + err.span_suggestion( lhs.span.shrink_to_hi(), "you might have meant to write a semicolon here", ";", @@ -1185,7 +1185,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let hir::Node::Expr(hir::Expr { kind: ExprKind::If { .. }, .. }) = self.tcx.parent_hir_node(expr.hir_id) { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_lo(), "you might have meant to use pattern matching", "let ", @@ -1194,7 +1194,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; } if eq { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_hi(), "you might have meant to compare for equality", '=', @@ -1223,7 +1223,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) .may_apply(); if lhs_deref_ty_is_sized && self.can_coerce(rhs_ty, lhs_deref_ty) { - err.span_suggestion_verbose( + err.span_suggestion( lhs.span.shrink_to_lo(), "consider dereferencing here to assign to the mutably borrowed value", "*", @@ -2129,7 +2129,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { match &items[..] { [] => {} [(_, name, args)] => { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_hi().with_hi(expr_span.hi()), format!("you might have meant to use the `{name}` associated function"), suggestion(name, *args), @@ -2222,7 +2222,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ), ); err.span_label(field.ident.span, "field does not exist"); - err.span_suggestion_verbose( + err.span_suggestion( expr.span, format!( "`{adt}::{variant}` is a tuple {kind_name}, use the appropriate syntax", @@ -2240,7 +2240,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { _ => { err.span_label(variant_ident_span, format!("`{ty}` defined here")); err.span_label(field.ident.span, "field does not exist"); - err.span_suggestion_verbose( + err.span_suggestion( expr.span, format!("`{ty}` is a tuple {kind_name}, use the appropriate syntax",), format!("{ty}(/* fields */)"), @@ -2255,7 +2255,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { find_best_match_for_name(&available_field_names, field.ident.name, None) { err.span_label(field.ident.span, "unknown field"); - err.span_suggestion_verbose( + err.span_suggestion( field.ident.span, "a field with a similar name exists", field_name, @@ -2479,14 +2479,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && !base.span.from_expansion() { if is_valid_suffix(&field_name) { - err.span_suggestion_verbose( + err.span_suggestion( field.span.shrink_to_lo(), "if intended to be a floating point literal, consider adding a `0` after the period", '0', Applicability::MaybeIncorrect, ); } else if let Some(correct_suffix) = maybe_partial_suffix(&field_name) { - err.span_suggestion_verbose( + err.span_suggestion( field.span, format!("if intended to be a floating point literal, consider adding a `0` after the period and a `{correct_suffix}` suffix"), format!("0{correct_suffix}"), @@ -2528,7 +2528,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { field_ident.span, "field not available in `impl Future`, but it is available in its `Output`", ); - err.span_suggestion_verbose( + err.span_suggestion( base.span.shrink_to_hi(), "consider `await`ing on the `Future` and access the field of its `Output`", ".await", @@ -2830,7 +2830,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); } else { if let Some(field_name) = find_best_match_for_name(&field_names, field.name, None) { - err.span_suggestion_verbose( + err.span_suggestion( field.span, "a field with a similar name exists", format!("{unwrap}{}", field_name), diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 56dff0808676b..885e972ea97f6 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -615,7 +615,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .all(|(expected, found)| self.can_coerce(*expected, *found)) && fn_sig.inputs()[1..].len() == input_types.len() { - err.span_suggestion_verbose( + err.span_suggestion( call_name.span, format!("you might have meant to use `{}`", assoc.name), assoc.name, @@ -802,7 +802,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ), ); err.code(err_code.to_owned()); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "wrap these arguments in parentheses to construct a tuple", vec![ (lo.shrink_to_lo(), "(".to_string()), @@ -1434,7 +1434,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { suggestion += &suggestion_text; } suggestion += ")"; - err.span_suggestion_verbose( + err.span_suggestion( suggestion_span, suggestion_text, suggestion, @@ -2067,7 +2067,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } if block_num > 1 && found_semi { - err.span_suggestion_verbose( + err.span_suggestion( // use the span of the *whole* expr self.tcx.hir().span(binding_hir_id).shrink_to_lo(), "you might have meant to return this to infer its type parameters", diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 8d380caf91628..ada84cc14268c 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -50,7 +50,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub(in super::super) fn suggest_semicolon_at_end(&self, span: Span, err: &mut Diag<'_>) { // This suggestion is incorrect for // fn foo() -> bool { match () { () => true } || match () { () => true } } - err.span_suggestion_short( + err.span_suggestion( span.shrink_to_hi(), "consider using a semicolon here", ";", @@ -156,11 +156,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } }; - err.multipart_suggestion_verbose( - format!("use parentheses to {msg}"), - sugg, - applicability, - ); + err.multipart_suggestion(format!("use parentheses to {msg}"), sugg, applicability); return true; } false @@ -242,7 +238,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - err.multipart_suggestion_verbose("use parentheses to call these", sugg, applicability); + err.multipart_suggestion("use parentheses to call these", sugg, applicability); true } else { @@ -268,7 +264,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { expr.span.with_lo(method.span.lo() - rustc_span::BytePos(1)) }; - err.span_suggestion_verbose( + err.span_suggestion( span, "try removing the method call", "", @@ -295,7 +291,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.suggest_deref_or_ref(expr, found, expected) { if verbose { - err.multipart_suggestion_verbose(msg, suggestion, applicability); + err.multipart_suggestion(msg, suggestion, applicability); } else { err.multipart_suggestion(msg, suggestion, applicability); } @@ -489,7 +485,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }) { let sugg = prefix_wrap(".map(|x| x.as_str())"); - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_hi(), fluent::hir_typeck_convert_to_str, sugg, @@ -1156,7 +1152,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if !is_in_arm(expr, self.tcx) { suggs.push((span.shrink_to_hi(), ";".to_string())); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "you might have meant to return this value", suggs, Applicability::MaybeIncorrect, @@ -1233,7 +1229,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { None => ".clone()".to_string(), }; - diag.span_suggestion_verbose( + diag.span_suggestion( expr.span.shrink_to_hi(), "consider using clone here", suggestion, @@ -1398,7 +1394,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { None => ".is_some()".to_string(), }; - diag.span_suggestion_verbose( + diag.span_suggestion( expr.span.shrink_to_hi(), "use `Option::is_some` to test if the `Option` has a value", suggestion, @@ -1424,7 +1420,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let source_map = self.tcx.sess.source_map(); if let Ok(snippet) = source_map.span_to_snippet(blk.span) { if snippet.starts_with('{') && snippet.ends_with('}') { - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "to create an array, use square brackets instead of curly braces", vec![ ( @@ -1460,7 +1456,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } match expr.kind { ExprKind::Struct(QPath::LangItem(LangItem::Range, ..), [start, end], _) => { - err.span_suggestion_verbose( + err.span_suggestion( start.span.shrink_to_hi().with_hi(end.span.lo()), "remove the unnecessary `.` operator for a floating point literal", '.', @@ -1469,7 +1465,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { true } ExprKind::Struct(QPath::LangItem(LangItem::RangeFrom, ..), [start], _) => { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.with_lo(start.span.hi()), "remove the unnecessary `.` operator for a floating point literal", '.', @@ -1478,7 +1474,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { true } ExprKind::Struct(QPath::LangItem(LangItem::RangeTo, ..), [end], _) => { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.until(end.span), "remove the unnecessary `.` operator and add an integer part for a floating point literal", "0.", @@ -1628,7 +1624,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return false; } if self.can_coerce(item_ty, expected_ty) { - err.span_suggestion_verbose( + err.span_suggestion( segment.ident.span, format!("try referring to the associated const `{capitalized_name}` instead",), capitalized_name, @@ -1933,7 +1929,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; let span = expr.span.find_oldest_ancestor_in_same_ctxt(); - err.span_suggestion_verbose(span.shrink_to_hi(), msg, sugg, Applicability::HasPlaceholders); + err.span_suggestion(span.shrink_to_hi(), msg, sugg, Applicability::HasPlaceholders); return true; } @@ -2053,7 +2049,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { format!(" /* {suggestion} */") }; - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_hi(), msg, suggestion, @@ -2084,7 +2080,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if self.can_eq(self.param_env, base_ty, expected) && let Some(base_span) = base.span.find_ancestor_inside(expr.span) { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.with_lo(base_span.hi()), format!("consider removing the tuple struct field `{ident}`"), "", @@ -2225,7 +2221,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { [] => { /* No variants to format */ } [(variant, ctor_kind, field_name, note)] => { // Just a single matching variant. - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "try wrapping the expression in `{variant}`{note}", note = note.as_deref().unwrap_or("") @@ -2946,7 +2942,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { )); (msg, suggestion) }; - err.multipart_suggestion_verbose(msg, suggestion, Applicability::MachineApplicable); + err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable); }; let suggest_to_change_suffix_or_into = @@ -2981,7 +2977,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { into_suggestion.clone() }; - err.multipart_suggestion_verbose(msg, suggestion, Applicability::MachineApplicable); + err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable); }; match (&expected_ty.kind(), &checked_ty.kind()) { @@ -3035,14 +3031,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if found.bit_width() < exp.bit_width() { suggest_to_change_suffix_or_into(err, false, true); } else if literal_is_ty_suffixed(expr) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else if can_cast { // Missing try_into implementation for `f64` to `f32` - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{cast_msg}, producing the closest possible value"), cast_suggestion, Applicability::MaybeIncorrect, // lossy conversion @@ -3052,14 +3048,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } (&ty::Uint(_) | &ty::Int(_), &ty::Float(_)) => { if literal_is_ty_suffixed(expr) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else if can_cast { // Missing try_into implementation for `{float}` to `{integer}` - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{msg}, rounding the float towards zero"), cast_suggestion, Applicability::MaybeIncorrect, // lossy conversion @@ -3070,7 +3066,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (ty::Float(exp), ty::Uint(found)) => { // if `found` is `None` (meaning found is `usize`), don't suggest `.into()` if exp.bit_width() > found.bit_width().unwrap_or(256) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "{msg}, producing the floating point representation of the integer", ), @@ -3078,14 +3074,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Applicability::MachineApplicable, ); } else if literal_is_ty_suffixed(expr) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else { // Missing try_into implementation for `{integer}` to `{float}` - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "{cast_msg}, producing the floating point representation of the integer, \ rounded if necessary", @@ -3099,7 +3095,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (ty::Float(exp), ty::Int(found)) => { // if `found` is `None` (meaning found is `isize`), don't suggest `.into()` if exp.bit_width() > found.bit_width().unwrap_or(256) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "{}, producing the floating point representation of the integer", msg.clone(), @@ -3108,14 +3104,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Applicability::MachineApplicable, ); } else if literal_is_ty_suffixed(expr) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else { // Missing try_into implementation for `{integer}` to `{float}` - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "{}, producing the floating point representation of the integer, \ rounded if necessary", @@ -3132,7 +3128,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | &ty::Int(ty::IntTy::I32 | ty::IntTy::I64 | ty::IntTy::I128), &ty::Char, ) => { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{cast_msg}, since a `char` always occupies 4 bytes"), cast_suggestion, Applicability::MachineApplicable, @@ -3212,7 +3208,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span = span.with_lo(span.lo() + BytePos(1)); sugg = ""; } - err.span_suggestion_verbose( + err.span_suggestion( span, "you likely meant to write a method call instead of a range", sugg, @@ -3263,7 +3259,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return; }; if self.can_eq(self.param_env, expected_ty, ty) { - err.span_suggestion_short( + err.span_suggestion( stmt.span.with_lo(tail_expr.span.hi()), "remove this semicolon", "", diff --git a/compiler/rustc_hir_typeck/src/method/mod.rs b/compiler/rustc_hir_typeck/src/method/mod.rs index ff8899ae0368d..18969c9327456 100644 --- a/compiler/rustc_hir_typeck/src/method/mod.rs +++ b/compiler/rustc_hir_typeck/src/method/mod.rs @@ -154,7 +154,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if params > 0 { Applicability::HasPlaceholders } else { Applicability::MaybeIncorrect }, ); - err.span_suggestion_verbose(sugg_span, msg, suggestion, applicability); + err.span_suggestion(sugg_span, msg, suggestion, applicability); } /// Performs method lookup. If lookup is successful, it will return the callee diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index dba3edbc1d722..96d881fdbe429 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -375,7 +375,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && let hir::TyKind::Ref(_, mut_ty) = &ty.kind && let hir::Mutability::Not = mut_ty.mutbl { - err.span_suggestion_verbose( + err.span_suggestion( mut_ty.ty.span.shrink_to_lo(), msg, "mut ", @@ -908,7 +908,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if item_name.name == sym::count && self.is_slice_ty(rcvr_ty, span) { let msg = "consider using `len` instead"; if let SelfSource::MethodCall(_expr) = source { - err.span_suggestion_short(span, msg, "len", Applicability::MachineApplicable); + err.span_suggestion(span, msg, "len", Applicability::MachineApplicable); } else { err.span_label(span, msg); } @@ -921,7 +921,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else if self.impl_into_iterator_should_be_iterator(rcvr_ty, span, unsatisfied_predicates) { err.span_label(span, format!("`{rcvr_ty}` is not an iterator")); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "call `.into_iter()` first", vec![(span.shrink_to_lo(), format!("into_iter()."))], Applicability::MaybeIncorrect, @@ -1157,7 +1157,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Some(sp) => (sp.shrink_to_hi(), " ?Sized +"), None => (param.span.shrink_to_hi(), ": ?Sized"), }; - err.span_suggestion_verbose( + err.span_suggestion( sp, "consider relaxing the type parameter's implicit `Sized` bound", sugg, @@ -1299,7 +1299,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { restrict_type_params = true; // #74886: Sort here so that the output is always the same. let obligations = obligations.into_sorted_stable_ord(); - err.span_suggestion_verbose( + err.span_suggestion( span, format!( "consider restricting the type parameter{s} to satisfy the trait \ @@ -1425,7 +1425,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { _ => false, }; if is_string_or_ref_str && item_name.name == sym::iter { - err.span_suggestion_verbose( + err.span_suggestion( item_name.span, "because of the in-memory representation of `&str`, to obtain \ an `Iterator` over each of its codepoint use method `chars`", @@ -1746,7 +1746,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { // We found a method with the same number of arguments as the method // call expression the user wrote. - err.span_suggestion_verbose( + err.span_suggestion( span, msg, similar_candidate.name, @@ -1768,7 +1768,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { // We have fn call expression and the argument count match the associated // function we found. - err.span_suggestion_verbose( + err.span_suggestion( span, msg, similar_candidate.name, @@ -1781,12 +1781,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && args.unwrap_or(&[]).is_empty() { // We have an associated item syntax and we found something that isn't an fn. - err.span_suggestion_verbose( - span, - msg, - similar_candidate.name, - Applicability::MaybeIncorrect, - ); + err.span_suggestion(span, msg, similar_candidate.name, Applicability::MaybeIncorrect); } else { // The expression is a function or method call, but the item we found is an // associated const or type. @@ -1833,7 +1828,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .all(|(expected, found)| self.can_coerce(*expected, *found)) && fn_sig.inputs()[1..].len() == args.len() { - err.span_suggestion_verbose( + err.span_suggestion( item_name.span, format!("you might have meant to use `{}`", inherent_method.name), inherent_method.name, @@ -2542,7 +2537,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); if probe.is_ok() { let sm = self.infcx.tcx.sess.source_map(); - err.span_suggestion_verbose( + err.span_suggestion( sm.span_extend_while(seg1.ident.span.shrink_to_hi(), |c| c == ':') .unwrap(), "you may have meant to call an instance method", @@ -2710,7 +2705,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return; }; if question { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_hi(), format!( "use the `?` operator to extract the `{self_ty}` value, propagating \ @@ -2720,7 +2715,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Applicability::MachineApplicable, ); } else { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_hi(), format!( "consider using `{kind}::expect` to unwrap the `{self_ty}` value, \ @@ -2779,7 +2774,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } None => return, }; - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_hi(), format!( "use `{suggestion}` to {borrow_kind} the `{ty}`, \ @@ -2789,7 +2784,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Applicability::MaybeIncorrect, ); } else if tcx.is_diagnostic_item(sym::Mutex, inner_id) { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_hi(), format!( "use `.lock().unwrap()` to borrow the `{ty}`, \ @@ -2804,7 +2799,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Some(Mutability::Mut) => (".write().unwrap()", "mutably borrow"), None => return, }; - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_hi(), format!( "use `{suggestion}` to {borrow_kind} the `{ty}`, \ @@ -3066,7 +3061,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } for (self_name, self_span, traits) in &derives_grouped { - err.span_suggestion_verbose( + err.span_suggestion( self_span.shrink_to_lo(), format!("consider annotating `{self_name}` with `#[derive({traits})]`"), format!("#[derive({traits})]\n"), @@ -3131,7 +3126,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } _ => format!("<{deref_ty}>"), }; - err.span_suggestion_verbose( + err.span_suggestion( ty.span, format!("the function `{item_name}` is implemented on `{deref_ty}`"), suggested_path, @@ -3173,7 +3168,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.method_exists_for_diagnostic(item_name, output_ty, call.hir_id, return_type); debug!("suggest_await_before_method: is_method_exist={}", method_exists); if method_exists { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), "consider `await`ing on the `Future` and calling the method on its `Output`", "await.", @@ -3979,7 +3974,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && let fn_args = fn_sig.skip_binder().skip_binder().inputs() && fn_args.len() == args.len() + 1 { - err.span_suggestion_verbose( + err.span_suggestion( method_name.span.shrink_to_hi(), format!("try calling `{}` instead", new_name.name.as_str()), "_else", @@ -4092,7 +4087,7 @@ fn print_disambiguation_help<'tcx>( .join(", "); let args = format!("({}{})", rcvr_ref, args); - err.span_suggestion_verbose( + err.span_suggestion( span, format!( "disambiguate the {def_kind_descr} for {}", diff --git a/compiler/rustc_hir_typeck/src/op.rs b/compiler/rustc_hir_typeck/src/op.rs index 5a11cb7096f33..799446483f020 100644 --- a/compiler/rustc_hir_typeck/src/op.rs +++ b/compiler/rustc_hir_typeck/src/op.rs @@ -69,7 +69,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.downgrade_to_delayed_bug(); } else { // Otherwise, it's valid to suggest dereferencing the LHS here. - err.span_suggestion_verbose( + err.span_suggestion( lhs.span.shrink_to_lo(), "consider dereferencing the left-hand side of this operation", "*", @@ -412,7 +412,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }, lhs_deref_ty, ); - err.span_suggestion_verbose( + err.span_suggestion( lhs_expr.span.shrink_to_lo(), msg, "*", @@ -444,7 +444,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && lhs_new_mutbl.is_not() && rhs_new_mutbl.is_not() { - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider reborrowing both sides", vec![ (lhs_expr.span.shrink_to_lo(), "&*".to_string()), @@ -457,7 +457,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |new_mutbl: ast::Mutability, sp: Span| { // Can reborrow (&mut -> &) if new_mutbl.is_not() { - err.span_suggestion_verbose( + err.span_suggestion( sp.shrink_to_lo(), "consider reborrowing this side", "&*", @@ -716,14 +716,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_label(op.span, "`+` cannot be used to concatenate two `&str` strings"); err.note(str_concat_note); if let hir::ExprKind::AddrOf(_, _, lhs_inner_expr) = lhs_expr.kind { - err.span_suggestion_verbose( + err.span_suggestion( lhs_expr.span.until(lhs_inner_expr.span), rm_borrow_msg, "", Applicability::MachineApplicable ); } else { - err.span_suggestion_verbose( + err.span_suggestion( lhs_expr.span.shrink_to_hi(), to_owned_msg, ".to_owned()", @@ -754,7 +754,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { lhs_sugg, (rhs_expr.span.shrink_to_lo(), "&".to_owned()), ]; - err.multipart_suggestion_verbose( + err.multipart_suggestion( sugg_msg, suggestions, Applicability::MachineApplicable, diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 478bbc0ed9855..f321a285b0784 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -803,7 +803,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (ty::Ref(_, inner_ty, _), _, BindingMode::NONE) if self.can_eq(self.param_env, *inner_ty, actual) => { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), "consider adding `ref`", "ref ", @@ -813,7 +813,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (_, ty::Ref(_, inner_ty, _), BindingMode::REF) if self.can_eq(self.param_env, expected, *inner_ty) => { - err.span_suggestion_verbose( + err.span_suggestion( span.with_hi(span.lo() + BytePos(4)), "consider removing `ref`", "", @@ -884,7 +884,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Check that there is explicit type (ie this is not a closure param with inferred type) // so we don't suggest moving something to the type that does not exist hir::Node::Param(hir::Param { ty_span, pat, .. }) if pat.span != *ty_span => { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("to take parameter `{binding}` by reference, move `&{mutability}` to the type"), vec![ (pat.span.until(inner.span), "".to_owned()), @@ -903,7 +903,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && let PatKind::Binding(mt, _, ident, _) = the_ref.kind { let BindingMode(_, mtblty) = mt; - err.span_suggestion_verbose( + err.span_suggestion( i.span, format!("consider removing `&{mutability}` from the pattern"), mtblty.prefix_str().to_string() + &ident.name.to_string(), @@ -917,7 +917,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } hir::Node::Param(_) | hir::Node::Arm(_) | hir::Node::Pat(_) => { // rely on match ergonomics or it might be nested `&&pat` - err.span_suggestion_verbose( + err.span_suggestion( pat.span.until(inner.span), format!("consider removing `&{mutability}` from the pattern"), "", @@ -1075,7 +1075,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if hir::is_range_literal(expr) { let span = self.tcx.hir().span(body_id.hir_id); if let Ok(snip) = self.tcx.sess.source_map().span_to_snippet(span) { - e.span_suggestion_verbose( + e.span_suggestion( ident.span, "you may want to move the range into the match block", snip, @@ -1118,7 +1118,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); match self.tcx.parent_hir_node(pat.hir_id) { hir::Node::PatField(..) => { - e.span_suggestion_verbose( + e.span_suggestion( ident.span.shrink_to_hi(), "bind the struct field to a different name instead", format!(": other_{}", ident.as_str().to_lowercase()), @@ -1393,7 +1393,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { wildcard_sugg = String::from(", ") + &wildcard_sugg; } - err.span_suggestion_verbose( + err.span_suggestion( after_fields_span, "use `_` to explicitly ignore each field", wildcard_sugg, @@ -1404,14 +1404,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // or the pattern consists of all wildcards. if fields.len() - subpats.len() > 1 || all_wildcards { if subpats.is_empty() || all_wildcards { - err.span_suggestion_verbose( + err.span_suggestion( all_fields_span, "use `..` to ignore all fields", "..", Applicability::MaybeIncorrect, ); } else { - err.span_suggestion_verbose( + err.span_suggestion( tail_span, "use `..` to ignore the rest of the fields", ", ..", @@ -1631,7 +1631,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { E0769, "tuple variant `{path}` written as struct variant", ); - err.span_suggestion_verbose( + err.span_suggestion( qpath.span().shrink_to_hi().to(pat.span.shrink_to_hi()), "use the tuple variant pattern syntax instead", format!("({})", self.get_suggested_tuple_struct_pattern(fields, variant)), @@ -1656,7 +1656,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { E0638, "`..` required with {descr} marked as non-exhaustive", ) - .with_span_suggestion_verbose( + .with_span_suggestion( sp_comma, "add `..` at the end of the field list to ignore all other fields", sugg, @@ -1761,7 +1761,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.field_ty(field.span, field_def, args), ) => {} _ => { - err.span_suggestion_short( + err.span_suggestion( pat_field.ident.span, format!( "`{}` has a field named `{}`", @@ -1825,7 +1825,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Applicability::MaybeIncorrect, ) }; - err.span_suggestion_verbose( + err.span_suggestion( qpath.span().shrink_to_hi().to(pat.span.shrink_to_hi()), "use the tuple variant pattern syntax instead", format!("({sugg})"), @@ -1888,7 +1888,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .struct_span_err(pat.span, "pattern requires `..` due to inaccessible fields"); if let Some(field) = fields.last() { - err.span_suggestion_verbose( + err.span_suggestion( field.span.shrink_to_hi(), "ignore the inaccessible and unused fields", ", ..", @@ -1903,7 +1903,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Shrink the span to exclude the `foo:Foo` in `foo::Foo { }`. let span = pat.span.with_lo(qpath_span.shrink_to_hi().hi()); - err.span_suggestion_verbose( + err.span_suggestion( span, "ignore the inaccessible and unused fields", " { .. }", @@ -2147,7 +2147,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let err_msg = "cannot match inherited `&` with `&mut` pattern"; let err = if let Some(span) = pat_prefix_span { let mut err = self.dcx().struct_span_err(span, err_msg); - err.span_suggestion_verbose( + err.span_suggestion( span, "replace this `&mut` pattern with `&`", "&", @@ -2509,7 +2509,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { || self.tcx.is_diagnostic_item(sym::Result, adt_def.did()) => { // Slicing won't work here, but `.as_deref()` might (issue #91328). - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_hi(), "consider using `as_deref` here", ".as_deref()", @@ -2521,7 +2521,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let is_top_level = current_depth <= 1; if is_slice_or_array_or_vector && is_top_level { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_hi(), "consider slicing here", "[..]", diff --git a/compiler/rustc_hir_typeck/src/place_op.rs b/compiler/rustc_hir_typeck/src/place_op.rs index 515e1b5ed0e0b..addba6c2f2873 100644 --- a/compiler/rustc_hir_typeck/src/place_op.rs +++ b/compiler/rustc_hir_typeck/src/place_op.rs @@ -80,7 +80,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (&base_expr.kind, self.tcx.sess.source_map().span_to_snippet(base_expr.span)) { // `foo[-1]` to `foo[foo.len() - 1]` - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), format!( "to access an element starting from the end of the `{ty}`, compute the index", diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs index a801001eaf988..1d6fc7768bb02 100644 --- a/compiler/rustc_infer/src/errors/mod.rs +++ b/compiler/rustc_infer/src/errors/mod.rs @@ -118,7 +118,6 @@ pub struct InferenceBadError<'a> { pub enum SourceKindSubdiag<'a> { #[suggestion( infer_source_kind_subdiag_let, - style = "verbose", code = ": {type_name}", applicability = "has-placeholders" )] @@ -145,7 +144,6 @@ pub enum SourceKindSubdiag<'a> { }, #[suggestion( infer_source_kind_subdiag_generic_suggestion, - style = "verbose", code = "::<{args}>", applicability = "has-placeholders" )] @@ -159,11 +157,7 @@ pub enum SourceKindSubdiag<'a> { #[derive(Subdiagnostic)] pub enum SourceKindMultiSuggestion<'a> { - #[multipart_suggestion( - infer_source_kind_fully_qualified, - style = "verbose", - applicability = "has-placeholders" - )] + #[multipart_suggestion(infer_source_kind_fully_qualified, applicability = "has-placeholders")] FullyQualified { #[suggestion_part(code = "{def_path}({adjustment}")] span_lo: Span, @@ -173,11 +167,7 @@ pub enum SourceKindMultiSuggestion<'a> { adjustment: &'a str, successor_pos: &'a str, }, - #[multipart_suggestion( - infer_source_kind_closure_return, - style = "verbose", - applicability = "has-placeholders" - )] + #[multipart_suggestion(infer_source_kind_closure_return, applicability = "has-placeholders")] ClosureReturn { #[suggestion_part(code = "{start_span_code}")] start_span: Span, @@ -514,7 +504,7 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> { visitor.suggestions.push(new_param_suggestion); } - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( fluent::infer_lifetime_param_suggestion, visitor.suggestions, Applicability::MaybeIncorrect, @@ -579,7 +569,6 @@ pub enum ImplicitStaticLifetimeSubdiag { }, #[suggestion( infer_implicit_static_lifetime_suggestion, - style = "verbose", code = " + '_", applicability = "maybe-incorrect" )] @@ -922,12 +911,7 @@ impl Subdiagnostic for DynTraitConstraintSuggestion { let msg = f(diag, fluent::infer_dtcs_has_req_note.into()); diag.span_note(multi_span, msg); let msg = f(diag, fluent::infer_dtcs_suggestion.into()); - diag.span_suggestion_verbose( - self.span.shrink_to_hi(), - msg, - " + '_", - Applicability::MaybeIncorrect, - ); + diag.span_suggestion(self.span.shrink_to_hi(), msg, " + '_", Applicability::MaybeIncorrect); } } @@ -1067,12 +1051,7 @@ pub struct RefLongerThanData<'a> { #[derive(Subdiagnostic)] pub enum WhereClauseSuggestions { - #[suggestion( - infer_where_remove, - code = "", - applicability = "machine-applicable", - style = "verbose" - )] + #[suggestion(infer_where_remove, code = "", applicability = "machine-applicable")] Remove { #[primary_span] span: Span, @@ -1080,8 +1059,7 @@ pub enum WhereClauseSuggestions { #[suggestion( infer_where_copy_predicates, code = "{space}where {trait_predicates}", - applicability = "machine-applicable", - style = "verbose" + applicability = "machine-applicable" )] CopyPredicates { #[primary_span] @@ -1106,22 +1084,12 @@ pub enum SuggestRemoveSemiOrReturnBinding { #[suggestion_part(code = "")] sp: Span, }, - #[suggestion( - infer_srs_remove, - style = "short", - code = "", - applicability = "machine-applicable" - )] + #[suggestion(infer_srs_remove, code = "", applicability = "machine-applicable")] Remove { #[primary_span] sp: Span, }, - #[suggestion( - infer_srs_add, - style = "verbose", - code = "{code}", - applicability = "maybe-incorrect" - )] + #[suggestion(infer_srs_add, code = "{code}", applicability = "maybe-incorrect")] Add { #[primary_span] sp: Span, @@ -1146,12 +1114,7 @@ pub enum ConsiderAddingAwait { #[suggestion_part(code = ".await")] second: Span, }, - #[suggestion( - infer_await_future, - code = ".await", - style = "verbose", - applicability = "maybe-incorrect" - )] + #[suggestion(infer_await_future, code = ".await", applicability = "maybe-incorrect")] FutureSugg { #[primary_span] span: Span, @@ -1161,11 +1124,7 @@ pub enum ConsiderAddingAwait { #[primary_span] span: Span, }, - #[multipart_suggestion( - infer_await_future, - style = "verbose", - applicability = "maybe-incorrect" - )] + #[multipart_suggestion(infer_await_future, applicability = "maybe-incorrect")] FutureSuggMultiple { #[suggestion_part(code = ".await")] spans: Vec, @@ -1243,24 +1202,14 @@ pub struct OpaqueCapturesLifetime<'tcx> { #[derive(Subdiagnostic)] pub enum FunctionPointerSuggestion<'a> { - #[suggestion( - infer_fps_use_ref, - code = "&{fn_name}", - style = "verbose", - applicability = "maybe-incorrect" - )] + #[suggestion(infer_fps_use_ref, code = "&{fn_name}", applicability = "maybe-incorrect")] UseRef { #[primary_span] span: Span, #[skip_arg] fn_name: String, }, - #[suggestion( - infer_fps_remove_ref, - code = "{fn_name}", - style = "verbose", - applicability = "maybe-incorrect" - )] + #[suggestion(infer_fps_remove_ref, code = "{fn_name}", applicability = "maybe-incorrect")] RemoveRef { #[primary_span] span: Span, @@ -1270,7 +1219,6 @@ pub enum FunctionPointerSuggestion<'a> { #[suggestion( infer_fps_cast, code = "&({fn_name} as {sig})", - style = "verbose", applicability = "maybe-incorrect" )] CastRef { @@ -1281,12 +1229,7 @@ pub enum FunctionPointerSuggestion<'a> { #[skip_arg] sig: Binder<'a, FnSig<'a>>, }, - #[suggestion( - infer_fps_cast, - code = "{fn_name} as {sig}", - style = "verbose", - applicability = "maybe-incorrect" - )] + #[suggestion(infer_fps_cast, code = "{fn_name} as {sig}", applicability = "maybe-incorrect")] Cast { #[primary_span] span: Span, @@ -1298,7 +1241,6 @@ pub enum FunctionPointerSuggestion<'a> { #[suggestion( infer_fps_cast_both, code = "{fn_name} as {found_sig}", - style = "hidden", applicability = "maybe-incorrect" )] CastBoth { @@ -1313,7 +1255,6 @@ pub enum FunctionPointerSuggestion<'a> { #[suggestion( infer_fps_cast_both, code = "&({fn_name} as {found_sig})", - style = "hidden", applicability = "maybe-incorrect" )] CastBothRef { @@ -1461,7 +1402,6 @@ pub enum TypeErrorAdditionalDiags { }, #[suggestion( infer_suggest_add_let_for_letchains, - style = "verbose", applicability = "machine-applicable", code = "let " )] diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index a8fd3ca8c59bd..f521a8028e357 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -2505,7 +2505,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } if !suggs.is_empty() { - err.multipart_suggestion_verbose( + err.multipart_suggestion( msg, suggs, Applicability::MaybeIncorrect, // Issue #41966 diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index 9973646aecd6a..5cb3d12ed31ce 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -301,7 +301,7 @@ pub fn suggest_new_region_bound( _ => None, }) { if let Some(explicit_static) = &explicit_static { - err.span_suggestion_verbose( + err.span_suggestion( span, format!("{consider} `{ty}`'s {explicit_static}"), &lifetime_name, @@ -309,7 +309,7 @@ pub fn suggest_new_region_bound( ); } if let Some((param_span, ref param_ty)) = param { - err.span_suggestion_verbose( + err.span_suggestion( param_span, add_static_bound, param_ty, @@ -368,13 +368,13 @@ pub fn suggest_new_region_bound( format!("you can use the named lifetime parameter `{name}`") }; spans_suggs.push((fn_return.span.shrink_to_hi(), format!(" + {name} "))); - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{declare} `{ty}` {captures}, {use_lt}",), spans_suggs, Applicability::MaybeIncorrect, ); } else { - err.span_suggestion_verbose( + err.span_suggestion( fn_return.span.shrink_to_hi(), format!("{declare} `{ty}` {captures}, {explicit}",), &plus_lt, @@ -385,7 +385,7 @@ pub fn suggest_new_region_bound( } TyKind::TraitObject(_, lt, _) => { if let LifetimeName::ImplicitObjectLifetimeDefault = lt.res { - err.span_suggestion_verbose( + err.span_suggestion( fn_return.span.shrink_to_hi(), format!("{declare} the trait object {captures}, {explicit}",), &plus_lt, @@ -397,7 +397,7 @@ pub fn suggest_new_region_bound( // one of them has the bound we'd suggest already there, like // in `impl Foo + '_`. if let Some(explicit_static) = &explicit_static { - err.span_suggestion_verbose( + err.span_suggestion( lt.ident.span, format!("{consider} the trait object's {explicit_static}"), &lifetime_name, @@ -405,7 +405,7 @@ pub fn suggest_new_region_bound( ); } if let Some((param_span, param_ty)) = param.clone() { - err.span_suggestion_verbose( + err.span_suggestion( param_span, add_static_bound, param_ty, diff --git a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs index fd50d1eb438aa..a5f02ecd963c2 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs @@ -52,7 +52,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { ) = tcx.sess.source_map().span_to_snippet(sp) => { if snippet.chars().all(|c| c.is_digit(10) || c == '-' || c == '_') { - diag.span_suggestion_verbose( + diag.span_suggestion( sp.shrink_to_hi(), "use a float literal", ".0", @@ -925,7 +925,7 @@ fn foo(&self) -> Self::T { String::new() } let item_args = self.format_generic_args(assoc_args); (span.shrink_to_hi(), format!("<{}{} = {}>", assoc.ident(tcx), item_args, ty)) }; - diag.span_suggestion_verbose(span, msg(), sugg, MaybeIncorrect); + diag.span_suggestion(span, msg(), sugg, MaybeIncorrect); return true; } false diff --git a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs index 13b145296a7c9..443c039fa6b3a 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs @@ -349,14 +349,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { ) -> bool { if let Some((span_semi, boxed)) = self.could_remove_semicolon(blk, expected_ty) { if let StatementAsExpression::NeedsBoxing = boxed { - diag.span_suggestion_verbose( + diag.span_suggestion( span_semi, "consider removing this semicolon and boxing the expression", "", Applicability::HasPlaceholders, ); } else { - diag.span_suggestion_short( + diag.span_suggestion( span_semi, "remove this semicolon to return this value", "", @@ -679,7 +679,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { suggestion += "|"; if has_suggestion { - diag.span_suggestion_verbose( + diag.span_suggestion( span, "consider specifying the type of the closure parameters", suggestion, diff --git a/compiler/rustc_infer/src/traits/error_reporting/mod.rs b/compiler/rustc_infer/src/traits/error_reporting/mod.rs index 7730fe29e0933..3bce0ebf9bc3a 100644 --- a/compiler/rustc_infer/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/traits/error_reporting/mod.rs @@ -70,7 +70,7 @@ pub fn report_object_safety_error<'tcx>( } if tcx.parent_hir_node(hir_id).fn_sig().is_some() { // Do not suggest `impl Trait` when dealing with things like super-traits. - err.span_suggestion_verbose( + err.span_suggestion( ty.span.until(trait_ref.span), "consider using an opaque type instead", "impl ", diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs index 46dfaf0b83f95..5a5cce66f6386 100644 --- a/compiler/rustc_lint/src/errors.rs +++ b/compiler/rustc_lint/src/errors.rs @@ -83,7 +83,7 @@ pub struct UnknownToolInScopedLint { pub struct BuiltinEllipsisInclusiveRangePatterns { #[primary_span] pub span: Span, - #[suggestion(style = "short", code = "{replace}", applicability = "machine-applicable")] + #[suggestion(code = "{replace}", applicability = "machine-applicable")] pub suggestion: Span, pub replace: String, } diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 7c5640f5959a0..a688c97f5449a 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -7,7 +7,7 @@ use crate::fluent_generated as fluent; use rustc_errors::{ codes::*, Applicability, Diag, DiagArgValue, DiagMessage, DiagStyledString, ElidedLifetimeInPathSubdiag, EmissionGuarantee, LintDiagnostic, MultiSpan, SubdiagMessageOp, - Subdiagnostic, SuggestionStyle, + Subdiagnostic, }; use rustc_hir::{def::Namespace, def_id::DefId}; use rustc_macros::{LintDiagnostic, Subdiagnostic}; @@ -61,7 +61,7 @@ pub enum ShadowedIntoIterDiagSub { #[derive(LintDiagnostic)] #[diag(lint_builtin_while_true)] pub struct BuiltinWhileTrue { - #[suggestion(style = "short", code = "{replace}", applicability = "machine-applicable")] + #[suggestion(code = "{replace}", applicability = "machine-applicable")] pub suggestion: Span, pub replace: String, } @@ -184,7 +184,6 @@ pub struct BuiltinDeprecatedAttrUsed { pub name: String, #[suggestion( lint_builtin_deprecated_attr_default_suggestion, - style = "short", code = "", applicability = "machine-applicable" )] @@ -214,7 +213,7 @@ pub enum BuiltinUnusedDocCommentSub { pub struct BuiltinNoMangleGeneric { // Use of `#[no_mangle]` suggests FFI intent; correct // fix may be to monomorphize source by hand - #[suggestion(style = "short", code = "", applicability = "maybe-incorrect")] + #[suggestion(code = "", applicability = "maybe-incorrect")] pub suggestion: Span, } @@ -352,7 +351,7 @@ pub enum BuiltinEllipsisInclusiveRangePatternsLint { }, #[diag(lint_builtin_ellipsis_inclusive_range_patterns)] NonParenthesise { - #[suggestion(style = "short", code = "..=", applicability = "machine-applicable")] + #[suggestion(code = "..=", applicability = "machine-applicable")] suggestion: Span, }, } @@ -656,7 +655,6 @@ pub enum UseLetUnderscoreIgnoreSuggestion { Note, #[multipart_suggestion( lint_use_let_underscore_ignore_suggestion, - style = "verbose", applicability = "maybe-incorrect" )] Suggestion { @@ -824,11 +822,10 @@ impl Subdiagnostic for HiddenUnicodeCodepointsDiagSub { ) { match self { HiddenUnicodeCodepointsDiagSub::Escape { spans } => { - diag.multipart_suggestion_with_style( + diag.multipart_suggestion( fluent::lint_suggestion_remove, spans.iter().map(|(_, span)| (*span, "".to_string())).collect(), Applicability::MachineApplicable, - SuggestionStyle::HideCodeAlways, ); diag.multipart_suggestion( fluent::lint_suggestion_escape, @@ -872,7 +869,7 @@ pub struct MappingToUnit { pub argument_label: Span, #[label(lint_map_label)] pub map_label: Span, - #[suggestion(style = "verbose", code = "{replace}", applicability = "maybe-incorrect")] + #[suggestion(code = "{replace}", applicability = "maybe-incorrect")] pub suggestion: Span, pub replace: String, } @@ -974,7 +971,7 @@ impl Subdiagnostic for NonBindingLetSub { if can_suggest_binding { let prefix = if self.is_assign_desugar { "let " } else { "" }; - diag.span_suggestion_verbose( + diag.span_suggestion( self.suggestion, fluent::lint_non_binding_let_suggestion, format!("{prefix}_unused"), @@ -1694,11 +1691,7 @@ pub enum InvalidNanComparisons { #[derive(Subdiagnostic)] pub enum InvalidNanComparisonsSuggestion { - #[multipart_suggestion( - lint_suggestion, - style = "verbose", - applicability = "machine-applicable" - )] + #[multipart_suggestion(lint_suggestion, applicability = "machine-applicable")] Spanful { #[suggestion_part(code = "!")] neg: Option, @@ -1729,7 +1722,6 @@ pub enum AmbiguousWidePointerComparisons<'a> { #[derive(Subdiagnostic)] #[multipart_suggestion( lint_addr_metadata_suggestion, - style = "verbose", // FIXME(#53934): make machine-applicable again applicability = "maybe-incorrect" )] @@ -1751,7 +1743,6 @@ pub struct AmbiguousWidePointerComparisonsAddrMetadataSuggestion<'a> { pub enum AmbiguousWidePointerComparisonsAddrSuggestion<'a> { #[multipart_suggestion( lint_addr_suggestion, - style = "verbose", // FIXME(#53934): make machine-applicable again applicability = "maybe-incorrect" )] @@ -1770,7 +1761,6 @@ pub enum AmbiguousWidePointerComparisonsAddrSuggestion<'a> { }, #[multipart_suggestion( lint_addr_suggestion, - style = "verbose", // FIXME(#53934): make machine-applicable again applicability = "maybe-incorrect" )] @@ -1861,17 +1851,12 @@ pub struct UnusedOp<'a> { #[derive(Subdiagnostic)] pub enum UnusedOpSuggestion { - #[suggestion( - lint_suggestion, - style = "verbose", - code = "let _ = ", - applicability = "maybe-incorrect" - )] + #[suggestion(lint_suggestion, code = "let _ = ", applicability = "maybe-incorrect")] NormalExpr { #[primary_span] span: Span, }, - #[multipart_suggestion(lint_suggestion, style = "verbose", applicability = "maybe-incorrect")] + #[multipart_suggestion(lint_suggestion, applicability = "maybe-incorrect")] BlockTailExpr { #[suggestion_part(code = "let _ = ")] before_span: Span, @@ -1922,17 +1907,12 @@ pub struct UnusedDef<'a, 'b> { #[derive(Subdiagnostic)] pub enum UnusedDefSuggestion { - #[suggestion( - lint_suggestion, - style = "verbose", - code = "let _ = ", - applicability = "maybe-incorrect" - )] + #[suggestion(lint_suggestion, code = "let _ = ", applicability = "maybe-incorrect")] NormalExpr { #[primary_span] span: Span, }, - #[multipart_suggestion(lint_suggestion, style = "verbose", applicability = "maybe-incorrect")] + #[multipart_suggestion(lint_suggestion, applicability = "maybe-incorrect")] BlockTailExpr { #[suggestion_part(code = "let _ = ")] before_span: Span, @@ -2328,7 +2308,7 @@ pub struct UnusedMacroUse; #[diag(lint_private_extern_crate_reexport, code = E0365)] pub struct PrivateExternCrateReexport { pub ident: Ident, - #[suggestion(code = "pub ", style = "verbose", applicability = "maybe-incorrect")] + #[suggestion(code = "pub ", applicability = "maybe-incorrect")] pub sugg: Span, } @@ -2458,7 +2438,6 @@ pub struct UnknownDiagnosticAttribute { #[derive(Subdiagnostic)] #[suggestion( lint_unknown_diagnostic_attribute_typo_sugg, - style = "verbose", code = "{typo_name}", applicability = "machine-applicable" )] @@ -2491,7 +2470,7 @@ pub struct UnicodeCharNoteSub { } #[derive(Subdiagnostic)] -#[multipart_suggestion(lint_suggestion, applicability = "machine-applicable", style = "hidden")] +#[multipart_suggestion(lint_suggestion, applicability = "machine-applicable")] pub struct UnicodeTextFlowSuggestion { #[suggestion_part(code = "")] pub spans: Vec, @@ -2785,7 +2764,7 @@ pub struct NamedArgumentUsedPositionally { pub named_arg_sp: Span, #[label(lint_label_position_arg)] pub position_label_sp: Option, - #[suggestion(style = "verbose", code = "{name}", applicability = "maybe-incorrect")] + #[suggestion(code = "{name}", applicability = "maybe-incorrect")] pub suggestion: Option, pub name: String, @@ -2810,7 +2789,7 @@ pub struct UnusedExternCrate { #[derive(LintDiagnostic)] #[diag(lint_extern_crate_not_idiomatic)] pub struct ExternCrateNotIdiomatic { - #[suggestion(style = "verbose", code = "{code}", applicability = "machine-applicable")] + #[suggestion(code = "{code}", applicability = "machine-applicable")] pub span: Span, pub code: &'static str, @@ -2857,14 +2836,14 @@ pub struct HiddenGlobReexports { #[derive(LintDiagnostic)] #[diag(lint_unnecessary_qualification)] pub struct UnusedQualifications { - #[suggestion(style = "verbose", code = "", applicability = "machine-applicable")] + #[suggestion(code = "", applicability = "machine-applicable")] pub removal_span: Span, } #[derive(LintDiagnostic)] #[diag(lint_associated_const_elided_lifetime)] pub struct AssociatedConstElidedLifetime { - #[suggestion(style = "verbose", code = "{code}", applicability = "machine-applicable")] + #[suggestion(code = "{code}", applicability = "machine-applicable")] pub span: Span, pub code: &'static str, diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs index 2dc2a0efdf040..1cd84eaae72e0 100644 --- a/compiler/rustc_lint/src/non_fmt_panic.rs +++ b/compiler/rustc_lint/src/non_fmt_panic.rs @@ -177,7 +177,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc }; if suggest_display { - lint.span_suggestion_verbose( + lint.span_suggestion( arg_span.shrink_to_lo(), fluent::lint_display_suggestion, "\"{}\", ", @@ -185,7 +185,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc ); } else if suggest_debug { lint.arg("ty", ty); - lint.span_suggestion_verbose( + lint.span_suggestion( arg_span.shrink_to_lo(), fluent::lint_debug_suggestion, "\"{:?}\", ", diff --git a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs index 8b669bcc13f0b..45bea6b7eb146 100644 --- a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs +++ b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs @@ -198,7 +198,6 @@ struct OpaqueHiddenInferredBoundLint<'tcx> { #[derive(Subdiagnostic)] #[suggestion( lint_opaque_hidden_inferred_bound_sugg, - style = "verbose", applicability = "machine-applicable", code = " + {trait_ref}" )] diff --git a/compiler/rustc_macros/src/diagnostics/mod.rs b/compiler/rustc_macros/src/diagnostics/mod.rs index 134045d0644c0..38c18cd462f1a 100644 --- a/compiler/rustc_macros/src/diagnostics/mod.rs +++ b/compiler/rustc_macros/src/diagnostics/mod.rs @@ -128,7 +128,7 @@ pub fn lint_diagnostic_derive(mut s: Structure<'_>) -> TokenStream { /// } /// /// #[derive(Subdiagnostic)] -/// #[suggestion(style = "verbose",parser::raw_identifier)] +/// #[suggestion(parser::raw_identifier)] /// pub struct RawIdentifierSuggestion<'tcx> { /// #[primary_span] /// span: Span, diff --git a/compiler/rustc_macros/src/diagnostics/utils.rs b/compiler/rustc_macros/src/diagnostics/utils.rs index 05a5a32514bb7..35a173455a6ac 100644 --- a/compiler/rustc_macros/src/diagnostics/utils.rs +++ b/compiler/rustc_macros/src/diagnostics/utils.rs @@ -503,9 +503,6 @@ pub(super) fn build_suggestion_code( #[derive(Clone, Copy, PartialEq)] pub(super) enum SuggestionKind { Normal, - Short, - Hidden, - Verbose, ToolOnly, } @@ -515,9 +512,6 @@ impl FromStr for SuggestionKind { fn from_str(s: &str) -> Result { match s { "normal" => Ok(SuggestionKind::Normal), - "short" => Ok(SuggestionKind::Short), - "hidden" => Ok(SuggestionKind::Hidden), - "verbose" => Ok(SuggestionKind::Verbose), "tool-only" => Ok(SuggestionKind::ToolOnly), _ => Err(()), } @@ -528,9 +522,6 @@ impl fmt::Display for SuggestionKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { SuggestionKind::Normal => write!(f, "normal"), - SuggestionKind::Short => write!(f, "short"), - SuggestionKind::Hidden => write!(f, "hidden"), - SuggestionKind::Verbose => write!(f, "verbose"), SuggestionKind::ToolOnly => write!(f, "tool-only"), } } @@ -540,15 +531,6 @@ impl SuggestionKind { pub(crate) fn to_suggestion_style(&self) -> TokenStream { match self { SuggestionKind::Normal => { - quote! { rustc_errors::SuggestionStyle::ShowCode } - } - SuggestionKind::Short => { - quote! { rustc_errors::SuggestionStyle::HideCodeInline } - } - SuggestionKind::Hidden => { - quote! { rustc_errors::SuggestionStyle::HideCodeAlways } - } - SuggestionKind::Verbose => { quote! { rustc_errors::SuggestionStyle::ShowAlways } } SuggestionKind::ToolOnly => { @@ -560,9 +542,6 @@ impl SuggestionKind { fn from_suffix(s: &str) -> Option { match s { "" => Some(SuggestionKind::Normal), - "_short" => Some(SuggestionKind::Short), - "_hidden" => Some(SuggestionKind::Hidden), - "_verbose" => Some(SuggestionKind::Verbose), _ => None, } } diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index 9d7418cd370af..01adc724368b5 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -160,7 +160,7 @@ decl_derive!( multipart_suggestion, multipart_suggestion_short, multipart_suggestion_hidden, - multipart_suggestion_verbose, + multipart_suggestion, // field attributes skip_arg, primary_span, diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index d1ccd158cf938..21b93495142a1 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -134,7 +134,6 @@ fn deprecation_lint(is_in_effect: bool) -> &'static Lint { #[suggestion( middle_deprecated_suggestion, code = "{suggestion}", - style = "verbose", applicability = "machine-applicable" )] pub struct DeprecationSuggestion { diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 055749ba3a322..17081fdf20ec0 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2936,7 +2936,7 @@ impl<'tcx> TyCtxt<'tcx> { let msg = format!("add `#![feature({feature})]` to the crate attributes to enable{desc}"); if let Some(span) = span { - diag.span_suggestion_verbose( + diag.span_suggestion( span, msg, format!("#![feature({feature})]\n"), diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs index 4bf2233799130..99c62878148d3 100644 --- a/compiler/rustc_middle/src/ty/diagnostics.rs +++ b/compiler/rustc_middle/src/ty/diagnostics.rs @@ -149,7 +149,7 @@ pub fn suggest_arbitrary_trait_bound<'tcx>( } // Suggest a where clause bound for a non-type parameter. - err.span_suggestion_verbose( + err.span_suggestion( generics.tail_span_for_predicate_suggestion(), format!( "consider {} `where` clause, but there might be an alternative better way to express \ @@ -438,9 +438,9 @@ pub fn suggest_constraining_type_params<'a>( } }; - err.span_suggestion_verbose(span, msg, suggestion, applicability); + err.span_suggestion(span, msg, suggestion, applicability); } else if suggestions.len() > 1 { - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider restricting type parameters", suggestions.into_iter().map(|(span, suggestion, _)| (span, suggestion)).collect(), applicability, diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 7c73d8a6d47d4..56967e626518b 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -541,7 +541,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NonExhaustivePatternsTypeNo } else { (" ".to_string(), "") }; - diag.span_suggestion_verbose( + diag.span_suggestion( braces_span, fluent::mir_build_suggestion, format!(" {{{indentation}{more}_ => todo!(),{indentation}}}"), diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 70065b5a2c329..8ba6bd6e35498 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -1140,7 +1140,7 @@ fn report_non_exhaustive_match<'p, 'tcx>( err.subdiagnostic(NonExhaustiveMatchAllArmsGuarded); } if let Some((span, sugg)) = suggestion { - err.span_suggestion_verbose(span, msg, sugg, Applicability::HasPlaceholders); + err.span_suggestion(span, msg, sugg, Applicability::HasPlaceholders); } else { err.help(msg); } diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 6894f470d88fd..d82d82cdcd263 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -80,7 +80,7 @@ pub(crate) struct WrapType { #[diag(parse_incorrect_semicolon)] pub(crate) struct IncorrectSemicolon<'a> { #[primary_span] - #[suggestion(style = "short", code = "", applicability = "machine-applicable")] + #[suggestion(code = "", applicability = "machine-applicable")] pub span: Span, #[help] pub show_help: bool, @@ -160,12 +160,7 @@ pub(crate) struct InvalidComparisonOperator { #[derive(Subdiagnostic)] pub(crate) enum InvalidComparisonOperatorSub { - #[suggestion( - parse_use_instead, - style = "short", - applicability = "machine-applicable", - code = "{correct}" - )] + #[suggestion(parse_use_instead, applicability = "machine-applicable", code = "{correct}")] Correctable { #[primary_span] span: Span, @@ -191,14 +186,12 @@ pub(crate) struct InvalidLogicalOperator { pub(crate) enum InvalidLogicalOperatorSub { #[suggestion( parse_use_amp_amp_for_conjunction, - style = "short", applicability = "machine-applicable", code = "&&" )] Conjunction(#[primary_span] Span), #[suggestion( parse_use_pipe_pipe_for_disjunction, - style = "short", applicability = "machine-applicable", code = "||" )] @@ -209,7 +202,7 @@ pub(crate) enum InvalidLogicalOperatorSub { #[diag(parse_tilde_is_not_unary_operator)] pub(crate) struct TildeAsUnaryOperator( #[primary_span] - #[suggestion(style = "short", applicability = "machine-applicable", code = "!")] + #[suggestion(applicability = "machine-applicable", code = "!")] pub Span, ); @@ -227,7 +220,6 @@ pub(crate) struct NotAsNegationOperator { pub enum NotAsNegationOperatorSub { #[suggestion( parse_unexpected_token_after_not_default, - style = "short", applicability = "machine-applicable", code = "!" )] @@ -235,7 +227,6 @@ pub enum NotAsNegationOperatorSub { #[suggestion( parse_unexpected_token_after_not_bitwise, - style = "short", applicability = "machine-applicable", code = "!" )] @@ -243,7 +234,6 @@ pub enum NotAsNegationOperatorSub { #[suggestion( parse_unexpected_token_after_not_logical, - style = "short", applicability = "machine-applicable", code = "!" )] @@ -283,7 +273,7 @@ pub(crate) struct UnexpectedTokenAfterLabel { #[primary_span] #[label(parse_unexpected_token_after_label)] pub span: Span, - #[suggestion(parse_suggestion_remove_label, style = "verbose", code = "")] + #[suggestion(parse_suggestion_remove_label, code = "")] pub remove_label: Option, #[subdiagnostic] pub enclose_in_block: Option, @@ -306,7 +296,7 @@ pub(crate) struct RequireColonAfterLabeledExpression { pub span: Span, #[label] pub label: Span, - #[suggestion(style = "short", applicability = "machine-applicable", code = ": ")] + #[suggestion(applicability = "machine-applicable", code = ": ")] pub label_end: Span, } @@ -333,7 +323,7 @@ pub(crate) struct FloatLiteralRequiresIntegerPart { pub(crate) struct MissingSemicolonBeforeArray { #[primary_span] pub open_delim: Span, - #[suggestion(style = "verbose", applicability = "maybe-incorrect", code = ";")] + #[suggestion(applicability = "maybe-incorrect", code = ";")] pub semicolon: Span, } @@ -342,7 +332,7 @@ pub(crate) struct MissingSemicolonBeforeArray { pub(crate) struct MissingDotDot { #[primary_span] pub token_span: Span, - #[suggestion(applicability = "maybe-incorrect", code = "..", style = "verbose")] + #[suggestion(applicability = "maybe-incorrect", code = "..")] pub sugg_span: Span, } @@ -425,22 +415,14 @@ pub(crate) struct ExpectedExpressionFoundLet { } #[derive(Subdiagnostic, Clone, Copy)] -#[multipart_suggestion( - parse_maybe_missing_let, - applicability = "maybe-incorrect", - style = "verbose" -)] +#[multipart_suggestion(parse_maybe_missing_let, applicability = "maybe-incorrect")] pub(crate) struct MaybeMissingLet { #[suggestion_part(code = "let ")] pub span: Span, } #[derive(Subdiagnostic, Clone, Copy)] -#[multipart_suggestion( - parse_maybe_comparison, - applicability = "maybe-incorrect", - style = "verbose" -)] +#[multipart_suggestion(parse_maybe_comparison, applicability = "maybe-incorrect")] pub(crate) struct MaybeComparison { #[suggestion_part(code = "=")] pub span: Span, @@ -451,7 +433,7 @@ pub(crate) struct MaybeComparison { pub(crate) struct ExpectedEqForLetExpr { #[primary_span] pub span: Span, - #[suggestion(applicability = "maybe-incorrect", code = "=", style = "verbose")] + #[suggestion(applicability = "maybe-incorrect", code = "=")] pub sugg_span: Span, } @@ -507,14 +489,9 @@ pub(crate) struct MissingInInForLoop { #[derive(Subdiagnostic)] pub(crate) enum MissingInInForLoopSub { // Has been misleading, at least in the past (closed Issue #48492), thus maybe-incorrect - #[suggestion( - parse_use_in_not_of, - style = "short", - applicability = "maybe-incorrect", - code = "in" - )] + #[suggestion(parse_use_in_not_of, applicability = "maybe-incorrect", code = "in")] InNotOf(#[primary_span] Span), - #[suggestion(parse_add_in, style = "short", applicability = "maybe-incorrect", code = " in ")] + #[suggestion(parse_add_in, applicability = "maybe-incorrect", code = " in ")] AddIn(#[primary_span] Span), } @@ -522,11 +499,7 @@ pub(crate) enum MissingInInForLoopSub { #[diag(parse_missing_expression_in_for_loop)] pub(crate) struct MissingExpressionInForLoop { #[primary_span] - #[suggestion( - code = "/* expression */ ", - applicability = "has-placeholders", - style = "verbose" - )] + #[suggestion(code = "/* expression */ ", applicability = "has-placeholders")] pub span: Span, } @@ -563,7 +536,7 @@ pub(crate) struct CatchAfterTry { pub(crate) struct CommaAfterBaseStruct { #[primary_span] pub span: Span, - #[suggestion(style = "short", applicability = "machine-applicable", code = "")] + #[suggestion(applicability = "machine-applicable", code = "")] pub comma: Span, } @@ -605,7 +578,7 @@ pub(crate) struct RemoveLet { #[diag(parse_use_eq_instead)] pub(crate) struct UseEqInstead { #[primary_span] - #[suggestion(style = "short", applicability = "machine-applicable", code = "=")] + #[suggestion(applicability = "machine-applicable", code = "=")] pub span: Span, } @@ -613,7 +586,7 @@ pub(crate) struct UseEqInstead { #[diag(parse_use_empty_block_not_semi)] pub(crate) struct UseEmptyBlockNotSemi { #[primary_span] - #[suggestion(style = "hidden", applicability = "machine-applicable", code = "{{}}")] + #[suggestion(applicability = "machine-applicable", code = "{{}}")] pub span: Span, } @@ -669,12 +642,7 @@ pub(crate) struct LeadingPlusNotSupported { #[primary_span] #[label] pub span: Span, - #[suggestion( - parse_suggestion_remove_plus, - style = "verbose", - code = "", - applicability = "machine-applicable" - )] + #[suggestion(parse_suggestion_remove_plus, code = "", applicability = "machine-applicable")] pub remove_plus: Option, #[subdiagnostic] pub add_parentheses: Option, @@ -778,12 +746,7 @@ pub(crate) struct MatchArmBodyWithoutBraces { #[note] pub(crate) struct InclusiveRangeExtraEquals { #[primary_span] - #[suggestion( - parse_suggestion_remove_eq, - style = "short", - code = "..=", - applicability = "maybe-incorrect" - )] + #[suggestion(parse_suggestion_remove_eq, code = "..=", applicability = "maybe-incorrect")] pub span: Span, } @@ -794,7 +757,7 @@ pub(crate) struct InclusiveRangeMatchArrow { pub arrow: Span, #[label] pub span: Span, - #[suggestion(style = "verbose", code = " ", applicability = "machine-applicable")] + #[suggestion(code = " ", applicability = "machine-applicable")] pub after_pat: Span, } @@ -803,12 +766,7 @@ pub(crate) struct InclusiveRangeMatchArrow { #[note] pub(crate) struct InclusiveRangeNoEnd { #[primary_span] - #[suggestion( - parse_suggestion_open_range, - code = "..", - applicability = "machine-applicable", - style = "short" - )] + #[suggestion(parse_suggestion_open_range, code = "..", applicability = "machine-applicable")] pub span: Span, } @@ -951,7 +909,7 @@ pub(crate) struct InvalidCurlyInLetElse { #[help] pub(crate) struct CompoundAssignmentExpressionInLet { #[primary_span] - #[suggestion(style = "short", code = "=", applicability = "maybe-incorrect")] + #[suggestion(code = "=", applicability = "maybe-incorrect")] pub span: Span, } @@ -983,12 +941,7 @@ pub(crate) struct InvalidMetaItemQuoteIdentSugg { } #[derive(Subdiagnostic)] -#[suggestion( - parse_sugg_escape_identifier, - style = "verbose", - applicability = "maybe-incorrect", - code = "r#" -)] +#[suggestion(parse_sugg_escape_identifier, applicability = "maybe-incorrect", code = "r#")] pub(crate) struct SuggEscapeIdentifier { #[primary_span] pub span: Span, @@ -1003,12 +956,7 @@ pub(crate) struct SuggRemoveComma { } #[derive(Subdiagnostic)] -#[suggestion( - parse_sugg_add_let_for_stmt, - style = "verbose", - applicability = "maybe-incorrect", - code = "let " -)] +#[suggestion(parse_sugg_add_let_for_stmt, applicability = "maybe-incorrect", code = "let ")] pub(crate) struct SuggAddMissingLetStmt { #[primary_span] pub span: Span, @@ -1149,12 +1097,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for ExpectedSemi { pub(crate) enum ExpectedSemiSugg { #[suggestion(parse_sugg_change_this_to_semi, code = ";", applicability = "machine-applicable")] ChangeToSemi(#[primary_span] Span), - #[suggestion( - parse_sugg_add_semi, - style = "short", - code = ";", - applicability = "machine-applicable" - )] + #[suggestion(parse_sugg_add_semi, code = ";", applicability = "machine-applicable")] AddSemi(#[primary_span] Span), } @@ -1226,12 +1169,7 @@ pub(crate) struct GenericParamsWithoutAngleBracketsSugg { pub(crate) struct ComparisonOperatorsCannotBeChained { #[primary_span] pub span: Vec, - #[suggestion( - parse_sugg_turbofish_syntax, - style = "verbose", - code = "::", - applicability = "maybe-incorrect" - )] + #[suggestion(parse_sugg_turbofish_syntax, code = "::", applicability = "maybe-incorrect")] pub suggest_turbofish: Option, #[help(parse_sugg_turbofish_syntax)] #[help(parse_sugg_parentheses_for_function_args)] @@ -1244,7 +1182,6 @@ pub(crate) struct ComparisonOperatorsCannotBeChained { pub(crate) enum ComparisonOperatorsCannotBeChainedSugg { #[suggestion( parse_sugg_split_comparison, - style = "verbose", code = " && {middle_term}", applicability = "maybe-incorrect" )] @@ -1404,7 +1341,7 @@ pub(crate) enum UnexpectedConstParamDeclarationSugg { pub(crate) struct UnexpectedConstInGenericParam { #[primary_span] pub span: Span, - #[suggestion(style = "verbose", code = "", applicability = "maybe-incorrect")] + #[suggestion(code = "", applicability = "maybe-incorrect")] pub to_remove: Option, } @@ -1412,7 +1349,7 @@ pub(crate) struct UnexpectedConstInGenericParam { #[diag(parse_async_move_order_incorrect)] pub(crate) struct AsyncMoveOrderIncorrect { #[primary_span] - #[suggestion(style = "verbose", code = "async move", applicability = "maybe-incorrect")] + #[suggestion(code = "async move", applicability = "maybe-incorrect")] pub span: Span, } @@ -1463,7 +1400,7 @@ impl Subdiagnostic for FnTraitMissingParen { } else { Applicability::MaybeIncorrect }; - diag.span_suggestion_short( + diag.span_suggestion( self.span.shrink_to_hi(), crate::fluent_generated::parse_add_paren, "()", @@ -1476,7 +1413,7 @@ impl Subdiagnostic for FnTraitMissingParen { #[diag(parse_unexpected_if_with_if)] pub(crate) struct UnexpectedIfWithIf( #[primary_span] - #[suggestion(applicability = "machine-applicable", code = " ", style = "verbose")] + #[suggestion(applicability = "machine-applicable", code = " ")] pub Span, ); @@ -1484,7 +1421,7 @@ pub(crate) struct UnexpectedIfWithIf( #[diag(parse_maybe_fn_typo_with_impl)] pub(crate) struct FnTypoWithImpl { #[primary_span] - #[suggestion(applicability = "maybe-incorrect", code = "impl", style = "verbose")] + #[suggestion(applicability = "maybe-incorrect", code = "impl")] pub fn_span: Span, } @@ -1492,7 +1429,7 @@ pub(crate) struct FnTypoWithImpl { #[diag(parse_expected_fn_path_found_fn_keyword)] pub(crate) struct ExpectedFnPathFoundFnKeyword { #[primary_span] - #[suggestion(applicability = "machine-applicable", code = "Fn", style = "verbose")] + #[suggestion(applicability = "machine-applicable", code = "Fn")] pub fn_token_span: Span, } @@ -1615,21 +1552,21 @@ pub(crate) enum MissingKeywordForItemDefinition { #[diag(parse_missing_struct_for_struct_definition)] Struct { #[primary_span] - #[suggestion(style = "short", applicability = "maybe-incorrect", code = " struct ")] + #[suggestion(applicability = "maybe-incorrect", code = " struct ")] span: Span, ident: Ident, }, #[diag(parse_missing_fn_for_function_definition)] Function { #[primary_span] - #[suggestion(style = "short", applicability = "maybe-incorrect", code = " fn ")] + #[suggestion(applicability = "maybe-incorrect", code = " fn ")] span: Span, ident: Ident, }, #[diag(parse_missing_fn_for_method_definition)] Method { #[primary_span] - #[suggestion(style = "short", applicability = "maybe-incorrect", code = " fn ")] + #[suggestion(applicability = "maybe-incorrect", code = " fn ")] span: Span, ident: Ident, }, @@ -1658,7 +1595,7 @@ pub(crate) enum AmbiguousMissingKwForItemSub { #[diag(parse_missing_fn_params)] pub(crate) struct MissingFnParams { #[primary_span] - #[suggestion(code = "()", applicability = "machine-applicable", style = "short")] + #[suggestion(code = "()", applicability = "machine-applicable")] pub span: Span, } @@ -1676,7 +1613,7 @@ pub(crate) struct MissingTraitInTraitImpl { #[diag(parse_missing_for_in_trait_impl)] pub(crate) struct MissingForInTraitImpl { #[primary_span] - #[suggestion(style = "short", code = " for ", applicability = "machine-applicable")] + #[suggestion(code = " for ", applicability = "machine-applicable")] pub span: Span, } @@ -1857,7 +1794,7 @@ pub(crate) struct MultipleWhereClauses { pub span: Span, #[label] pub previous: Span, - #[suggestion(style = "verbose", code = ",", applicability = "maybe-incorrect")] + #[suggestion(code = ",", applicability = "maybe-incorrect")] pub between: Span, } @@ -1965,25 +1902,11 @@ pub struct MacroExpandsToAdtField<'a> { #[derive(Subdiagnostic)] pub enum UnknownPrefixSugg { - #[suggestion( - parse_suggestion_br, - code = "br", - applicability = "maybe-incorrect", - style = "verbose" - )] + #[suggestion(parse_suggestion_br, code = "br", applicability = "maybe-incorrect")] UseBr(#[primary_span] Span), - #[suggestion( - parse_suggestion_whitespace, - code = " ", - applicability = "maybe-incorrect", - style = "verbose" - )] + #[suggestion(parse_suggestion_whitespace, code = " ", applicability = "maybe-incorrect")] Whitespace(#[primary_span] Span), - #[multipart_suggestion( - parse_suggestion_str, - applicability = "maybe-incorrect", - style = "verbose" - )] + #[multipart_suggestion(parse_suggestion_str, applicability = "maybe-incorrect")] MeantStr { #[suggestion_part(code = "\"")] start: Span, @@ -2109,13 +2032,7 @@ pub enum UnescapeError { #[primary_span] #[label] Span, - #[suggestion( - parse_terminate, - code = "}}", - applicability = "maybe-incorrect", - style = "verbose" - )] - Span, + #[suggestion(parse_terminate, code = "}}", applicability = "maybe-incorrect")] Span, ), #[diag(parse_no_brace_unicode_escape)] NoBraceInUnicodeEscape { @@ -2308,7 +2225,7 @@ pub(crate) struct TrailingVertNotAllowed { #[diag(parse_dotdotdot_rest_pattern)] pub(crate) struct DotDotDotRestPattern { #[primary_span] - #[suggestion(style = "short", code = "..", applicability = "machine-applicable")] + #[suggestion(code = "..", applicability = "machine-applicable")] #[label] pub span: Span, } @@ -2387,7 +2304,7 @@ pub(crate) struct RepeatedMutInPattern { #[diag(parse_dot_dot_dot_range_to_pattern_not_allowed)] pub(crate) struct DotDotDotRangeToPatternNotAllowed { #[primary_span] - #[suggestion(style = "short", code = "..=", applicability = "machine-applicable")] + #[suggestion(code = "..=", applicability = "machine-applicable")] pub span: Span, } @@ -2402,7 +2319,7 @@ pub(crate) struct EnumPatternInsteadOfIdentifier { #[diag(parse_dot_dot_dot_for_remaining_fields)] pub(crate) struct DotDotDotForRemainingFields { #[primary_span] - #[suggestion(code = "..", style = "verbose", applicability = "machine-applicable")] + #[suggestion(code = "..", applicability = "machine-applicable")] pub span: Span, pub token_str: Cow<'static, str>, } @@ -2451,7 +2368,7 @@ pub(crate) struct UnexpectedParenInRangePatSugg { #[diag(parse_return_types_use_thin_arrow)] pub(crate) struct ReturnTypesUseThinArrow { #[primary_span] - #[suggestion(style = "short", code = "->", applicability = "machine-applicable")] + #[suggestion(code = "->", applicability = "machine-applicable")] pub span: Span, } @@ -2550,11 +2467,7 @@ impl HelpUseLatestEdition { #[diag(parse_box_syntax_removed)] pub struct BoxSyntaxRemoved<'a> { #[primary_span] - #[suggestion( - code = "Box::new({code})", - applicability = "machine-applicable", - style = "verbose" - )] + #[suggestion(code = "Box::new({code})", applicability = "machine-applicable")] pub span: Span, pub code: &'a str, } @@ -2616,12 +2529,7 @@ pub(crate) struct LifetimeInEqConstraint { pub lifetime: Ident, #[label(parse_context_label)] pub binding_label: Span, - #[suggestion( - parse_colon_sugg, - style = "verbose", - applicability = "maybe-incorrect", - code = ": " - )] + #[suggestion(parse_colon_sugg, applicability = "maybe-incorrect", code = ": ")] pub colon_sugg: Span, } @@ -2639,7 +2547,7 @@ pub(crate) struct ModifierLifetime { pub(crate) struct ParenthesizedLifetime { #[primary_span] pub span: Span, - #[suggestion(style = "short", applicability = "machine-applicable", code = "{snippet}")] + #[suggestion(applicability = "machine-applicable", code = "{snippet}")] pub sugg: Option, pub snippet: String, } @@ -2656,7 +2564,7 @@ pub(crate) struct UnderscoreLiteralSuffix { pub(crate) struct ExpectedLabelFoundIdent { #[primary_span] pub span: Span, - #[suggestion(code = "'", applicability = "machine-applicable", style = "short")] + #[suggestion(code = "'", applicability = "machine-applicable")] pub start: Span, } @@ -2675,7 +2583,7 @@ pub(crate) struct InappropriateDefault { #[diag(parse_recover_import_as_use)] pub(crate) struct RecoverImportAsUse { #[primary_span] - #[suggestion(code = "use", applicability = "machine-applicable", style = "short")] + #[suggestion(code = "use", applicability = "machine-applicable")] pub span: Span, pub token_name: String, } @@ -2685,7 +2593,7 @@ pub(crate) struct RecoverImportAsUse { #[note] pub(crate) struct SingleColonImportPath { #[primary_span] - #[suggestion(code = "::", applicability = "machine-applicable", style = "short")] + #[suggestion(code = "::", applicability = "machine-applicable")] pub span: Span, } @@ -2704,7 +2612,7 @@ pub(crate) struct BadItemKind { #[diag(parse_single_colon_struct_type)] pub(crate) struct SingleColonStructType { #[primary_span] - #[suggestion(code = "::", applicability = "maybe-incorrect", style = "verbose")] + #[suggestion(code = "::", applicability = "maybe-incorrect")] pub span: Span, } @@ -2721,7 +2629,7 @@ pub(crate) struct EqualsStructDefault { pub(crate) struct MacroRulesMissingBang { #[primary_span] pub span: Span, - #[suggestion(code = "!", applicability = "machine-applicable", style = "verbose")] + #[suggestion(code = "!", applicability = "machine-applicable")] pub hi: Span, } @@ -2788,7 +2696,7 @@ pub(crate) struct BoxNotPat { pub span: Span, #[note] pub kw: Span, - #[suggestion(code = "r#", applicability = "maybe-incorrect", style = "verbose")] + #[suggestion(code = "r#", applicability = "maybe-incorrect")] pub lo: Span, pub descr: String, } @@ -2807,7 +2715,7 @@ pub(crate) struct UnmatchedAngle { pub(crate) struct MissingPlusBounds { #[primary_span] pub span: Span, - #[suggestion(code = " +", applicability = "maybe-incorrect", style = "verbose")] + #[suggestion(code = " +", applicability = "maybe-incorrect")] pub hi: Span, pub sym: Symbol, } @@ -2930,12 +2838,7 @@ pub(crate) struct WhereClauseBeforeConstBodySugg { pub(crate) struct GenericArgsInPatRequireTurbofishSyntax { #[primary_span] pub span: Span, - #[suggestion( - parse_sugg_turbofish_syntax, - style = "verbose", - code = "::", - applicability = "maybe-incorrect" - )] + #[suggestion(parse_sugg_turbofish_syntax, code = "::", applicability = "maybe-incorrect")] pub suggest_turbofish: Span, } @@ -2979,7 +2882,7 @@ pub(crate) struct AsyncImpl { #[help] pub(crate) struct ExprRArrowCall { #[primary_span] - #[suggestion(style = "short", applicability = "machine-applicable", code = ".")] + #[suggestion(applicability = "machine-applicable", code = ".")] pub span: Span, } diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index 58fef9b6c4562..a0963995b5704 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -69,7 +69,7 @@ impl<'a> Parser<'a> { }, ) { err.note(fluent::parse_note); - err.span_suggestion_verbose( + err.span_suggestion( replacement_span, fluent::parse_suggestion, "", @@ -176,7 +176,7 @@ impl<'a> Parser<'a> { // FIXME(#100717) err.arg("item", item.kind.descr()); err.span_label(item.span, fluent::parse_label_does_not_annotate_this); - err.span_suggestion_verbose( + err.span_suggestion( replacement_span, fluent::parse_sugg_change_inner_to_outer, match attr_type { diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 81d5f0fca0ec9..34bc9a4391957 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -214,7 +214,7 @@ impl MultiSugg { } fn emit_verbose(self, err: &mut Diag<'_>) { - err.multipart_suggestion_verbose(self.msg, self.patches, self.applicability); + err.multipart_suggestion(self.msg, self.patches, self.applicability); } } @@ -365,7 +365,7 @@ impl<'a> Parser<'a> { && let Ok(snippet) = self.psess.source_map().span_to_snippet(generic.span) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("place the generic parameter name after the {ident_name} name"), vec![ (self.token.span.shrink_to_hi(), snippet), @@ -622,7 +622,7 @@ impl<'a> Parser<'a> { if let TokenKind::Ident(symbol, _) = &self.prev_token.kind { if ["def", "fun", "func", "function"].contains(&symbol.as_str()) { - err.span_suggestion_short( + err.span_suggestion( self.prev_token.span, format!("write `fn` instead of `{symbol}` to declare a function"), "fn", @@ -638,7 +638,7 @@ impl<'a> Parser<'a> { let ident = Ident::new(concat, DUMMY_SP); if ident.is_used_keyword() || ident.is_reserved() || ident.is_raw_guess() { let span = self.prev_token.span.to(self.token.span); - err.span_suggestion_verbose( + err.span_suggestion( span, format!("consider removing the space to spell keyword `{concat}`"), concat, @@ -674,7 +674,7 @@ impl<'a> Parser<'a> { && (self.token.can_begin_item() || self.token.kind == TokenKind::OpenDelim(Delimiter::Parenthesis)) { - err.span_suggestion_short( + err.span_suggestion( self.prev_token.span, "write `pub` instead of `public` to make the item public", "pub", @@ -686,7 +686,7 @@ impl<'a> Parser<'a> { // We have something like `expr //!val` where the user likely meant `expr // !val` let pos = self.token.span.lo() + BytePos(2); let span = self.token.span.with_lo(pos).with_hi(pos); - err.span_suggestion_verbose( + err.span_suggestion( span, format!( "add a space before {} to write a regular comment", @@ -1015,7 +1015,7 @@ impl<'a> Parser<'a> { // and recover. self.eat_to_tokens(&[&token::CloseDelim(Delimiter::Parenthesis), &token::Comma]); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "you might have meant to open the body of the closure", vec![ (prev.span.shrink_to_hi(), " {".to_string()), @@ -1028,7 +1028,7 @@ impl<'a> Parser<'a> { _ if !matches!(token.kind, token::OpenDelim(Delimiter::Brace)) => { // We don't have a heuristic to correctly identify where the block // should be closed. - err.multipart_suggestion_verbose( + err.multipart_suggestion( "you might have meant to open the body of the closure", vec![(prev.span.shrink_to_hi(), " {".to_string())], Applicability::HasPlaceholders, @@ -1231,7 +1231,7 @@ impl<'a> Parser<'a> { Ok((_, _, Recovered::No)) => { if self.eat(&token::Gt) { // We made sense of it. Improve the error message. - e.span_suggestion_verbose( + e.span_suggestion( binop.span.shrink_to_lo(), fluent::parse_sugg_turbofish_syntax, "::", @@ -2050,7 +2050,7 @@ impl<'a> Parser<'a> { }) .last() { - err.span_suggestion_verbose( + err.span_suggestion( poly.span.shrink_to_hi(), "you might have meant to end the type parameters here", ">", @@ -2250,7 +2250,7 @@ impl<'a> Parser<'a> { _ => { // Otherwise, try to get a type and emit a suggestion. if let Some(ty) = pat.to_ty() { - err.span_suggestion_verbose( + err.span_suggestion( pat.span, "explicitly ignore the parameter name", format!("_: {}", pprust::ty_to_string(&ty)), @@ -2822,7 +2822,7 @@ impl<'a> Parser<'a> { _ => {} } if show_sugg { - err.span_suggestion_verbose( + err.span_suggestion( colon_span.until(self.look_ahead(1, |t| t.span)), "maybe write a path separator here", "::", diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index b2df9a14eb01e..6aa86a077d7cf 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1764,7 +1764,7 @@ impl<'a> Parser<'a> { assert!(could_be_unclosed_char_literal(ident)); self.dcx() .try_steal_modify_and_emit_err(ident.span, StashKey::LifetimeIsChar, |err| { - err.span_suggestion_verbose( + err.span_suggestion( ident.span.shrink_to_hi(), "add `'` to close the char literal", "'", @@ -1773,7 +1773,7 @@ impl<'a> Parser<'a> { }) .unwrap_or_else(|| { err(self) - .with_span_suggestion_verbose( + .with_span_suggestion( ident.span.shrink_to_hi(), "add `'` to close the char literal", "'", @@ -2957,7 +2957,7 @@ impl<'a> Parser<'a> { ) -> PResult<'a, P> { if let Err(mut e) = self.expect(&token::OpenDelim(Delimiter::Brace)) { if self.token == token::Semi { - e.span_suggestion_short( + e.span_suggestion( match_span, "try removing this `match`", "", @@ -3189,7 +3189,7 @@ impl<'a> Parser<'a> { // | - ^^ self.token.span // | | // | parsed until here as `"y" & X` - err.span_suggestion_short( + err.span_suggestion( arm_start_span.shrink_to_hi(), "missing a comma here to end this `match` arm", ",", @@ -3371,7 +3371,7 @@ impl<'a> Parser<'a> { } else { Applicability::MaybeIncorrect }; - err.span_suggestion_verbose(sugg_sp, msg, "=> ", applicability); + err.span_suggestion(sugg_sp, msg, "=> ", applicability); } } err @@ -3587,7 +3587,7 @@ impl<'a> Parser<'a> { }) { // Looks like they tried to write a shorthand, complex expression. - e.span_suggestion_verbose( + e.span_suggestion( self.token.span.shrink_to_lo(), "try naming a field", &format!("{ident}: ",), diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 10c7715c7dcd5..33e2067f3fc0c 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -70,7 +70,7 @@ impl<'a> Parser<'a> { ); err.span_label(span, "not a trait"); if let [bound, ..] = &bounds[..] { - err.span_suggestion_verbose( + err.span_suggestion( impl_span.until(bound.span()), "use the trait bounds directly", String::new(), @@ -145,7 +145,7 @@ impl<'a> Parser<'a> { mistyped_const_ident.span, format!("`const` keyword was mistyped as `{}`", mistyped_const_ident.as_str()), ) - .with_span_suggestion_verbose( + .with_span_suggestion( mistyped_const_ident.span, "use the `const` keyword", kw::Const, diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index abb6b51cebd68..58485830245c3 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -503,7 +503,7 @@ impl<'a> Parser<'a> { if end.is_doc_comment() { err.span_label(end.span, "this doc comment doesn't document anything"); } else if self.token.kind == TokenKind::Semi { - err.span_suggestion_verbose( + err.span_suggestion( self.token.span, "consider removing this semicolon", "", @@ -1519,7 +1519,7 @@ impl<'a> Parser<'a> { self.bump(); match self.parse_ty() { Ok(_) => { - err.span_suggestion_verbose( + err.span_suggestion( prev_span, "perhaps you meant to use `struct` here", "struct", @@ -1854,12 +1854,7 @@ impl<'a> Parser<'a> { let sp = self.prev_token.span; let mut err = self.dcx().struct_span_err(sp, format!("{adt_ty} fields are separated by `,`")); - err.span_suggestion_short( - sp, - "replace `;` with `,`", - ",", - Applicability::MachineApplicable, - ); + err.span_suggestion(sp, "replace `;` with `,`", ",", Applicability::MachineApplicable); return Err(err); } match self.token.kind { @@ -1954,7 +1949,7 @@ impl<'a> Parser<'a> { if eq_typo || semi_typo { self.bump(); // Gracefully handle small typos. - err.with_span_suggestion_short( + err.with_span_suggestion( self.prev_token.span, "field names and their types are separated with `:`", ":", diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 5f16a3e1f3784..4fc8aab8afd4b 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -878,7 +878,7 @@ impl<'a> Parser<'a> { pprust::token_to_string(&self.prev_token) ); expect_err - .with_span_suggestion_verbose( + .with_span_suggestion( self.prev_token.span.shrink_to_hi().until(self.token.span), msg, " @ ", @@ -895,7 +895,7 @@ impl<'a> Parser<'a> { // Parsed successfully, therefore most probably the code only // misses a separator. expect_err - .with_span_suggestion_short( + .with_span_suggestion( sp, format!("missing `{token_str}`"), token_str, diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 6f2b717715945..807fb5bec1337 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -1254,7 +1254,7 @@ impl<'a> Parser<'a> { if self.token == token::CloseDelim(Delimiter::Brace) { // If the struct looks otherwise well formed, recover and continue. if let Some(sp) = comma_sp { - err.span_suggestion_short( + err.span_suggestion( sp, "remove this comma", "", diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 03c647dd5278e..34bb856976b60 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -342,7 +342,7 @@ impl<'a> Parser<'a> { .rev() .find(|arg| !matches!(arg, AngleBracketedArg::Constraint(_))) { - err.span_suggestion_verbose( + err.span_suggestion( arg.span().shrink_to_hi(), "you might have meant to end the type parameters here", ">", @@ -474,7 +474,7 @@ impl<'a> Parser<'a> { return; } - error.span_suggestion_verbose( + error.span_suggestion( prev_token_before_parsing.span, format!( "consider removing the `::` here to {}", @@ -662,7 +662,7 @@ impl<'a> Parser<'a> { // Handle `,` to `;` substitution let mut err = self.unexpected().unwrap_err(); self.bump(); - err.span_suggestion_verbose( + err.span_suggestion( self.prev_token.span.until(self.token.span), "use a comma to separate type parameters", ", ", diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index d65f6ff68eeeb..80a80f7f61721 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -325,7 +325,7 @@ impl<'a> Parser<'a> { // init parsed, ty error // Could parse the type as if it were the initializer, it is likely there was a // typo in the code: `:` instead of `=`. Add suggestion and emit the error. - err.span_suggestion_short( + err.span_suggestion( colon_sp, "use `=` if you meant to assign", " =", @@ -589,7 +589,7 @@ impl<'a> Parser<'a> { { // FIXME(hkmatsumoto): Might be better to trigger // this only when parsing an index expression. - err.span_suggestion_verbose( + err.span_suggestion( self.token.span, "you might have meant a range expression", "..", @@ -600,7 +600,7 @@ impl<'a> Parser<'a> { // and we can suggest a path separator self.bump(); if self.token.span.lo() == self.prev_token.span.hi() { - err.span_suggestion_verbose( + err.span_suggestion( self.prev_token.span, "maybe write a path separator here", "::", @@ -798,7 +798,7 @@ impl<'a> Parser<'a> { false }; if suggest_eq { - e.span_suggestion_short( + e.span_suggestion( colon_sp, "use `=` if you meant to assign", "=", diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 1e5b227aaa9be..bb86a5970c38a 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -1039,7 +1039,7 @@ impl<'a> Parser<'a> { _ => return Err(err), }; - err.span_suggestion_verbose(span, message, sugg, applicability); + err.span_suggestion(span, message, sugg, applicability); path.clone() } else { diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index a026ff3b13b57..50d03c5b09939 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -309,7 +309,7 @@ pub struct DocTestUnknownAny { #[note(passes_no_op_note)] pub struct DocTestUnknownSpotlight { pub path: String, - #[suggestion(style = "short", applicability = "machine-applicable", code = "notable_trait")] + #[suggestion(applicability = "machine-applicable", code = "notable_trait")] pub span: Span, } @@ -869,7 +869,7 @@ impl Diagnostic<'_, G> for InvalidAttrAtCrateLevel { // Only emit an error with a suggestion if we can create a string out // of the attribute span if let Some(span) = self.sugg_span { - diag.span_suggestion_verbose( + diag.span_suggestion( span, fluent::passes_suggestion, String::new(), @@ -1776,7 +1776,7 @@ pub struct AttrCrateLevelOnly { } #[derive(Subdiagnostic)] -#[suggestion(passes_suggestion, applicability = "maybe-incorrect", code = "!", style = "verbose")] +#[suggestion(passes_suggestion, applicability = "maybe-incorrect", code = "!")] pub struct AttrCrateLevelOnlySugg { #[primary_span] pub attr: Span, diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 50a4e03d233a7..dea1c771924cb 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -187,7 +187,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { ); err.emit(); } else if let Some((span, msg, sugg, appl)) = suggestion { - err.span_suggestion_verbose(span, msg, sugg, appl); + err.span_suggestion(span, msg, sugg, appl); err.emit(); } else if let [segment] = path.as_slice() && is_call @@ -2906,7 +2906,7 @@ fn show_candidates( // Our suggestion is empty, so make sure the span is not empty (or we'd ICE). // Can happen for derive-generated spans. if sp.can_be_used_for_suggestions() && !sp.is_empty() { - err.span_suggestion_verbose( + err.span_suggestion( sp, format!("if you import `{}`, refer to it directly", last.ident), "", diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 0620f3d709eb2..70633d7e9e7a0 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -454,7 +454,7 @@ pub(crate) struct InvalidAsmSym { #[diag(resolve_lowercase_self)] pub(crate) struct LowercaseSelf { #[primary_span] - #[suggestion(code = "Self", applicability = "maybe-incorrect", style = "short")] + #[suggestion(code = "Self", applicability = "maybe-incorrect")] pub(crate) span: Span, } @@ -463,7 +463,7 @@ pub(crate) struct LowercaseSelf { #[diag(resolve_binding_in_never_pattern)] pub(crate) struct BindingInNeverPattern { #[primary_span] - #[suggestion(code = "_", applicability = "machine-applicable", style = "short")] + #[suggestion(code = "_", applicability = "machine-applicable")] pub(crate) span: Span, } @@ -778,11 +778,7 @@ pub(crate) struct IsNotDirectlyImportable { } #[derive(Subdiagnostic)] -#[suggestion( - resolve_unexpected_res_change_ty_to_const_param_sugg, - code = "const ", - style = "verbose" -)] +#[suggestion(resolve_unexpected_res_change_ty_to_const_param_sugg, code = "const ")] pub(crate) struct UnexpectedResChangeTyToConstParamSugg { #[primary_span] pub span: Span, @@ -794,8 +790,7 @@ pub(crate) struct UnexpectedResChangeTyToConstParamSugg { #[suggestion( resolve_unexpected_res_use_at_op_in_slice_pat_with_range_sugg, code = "{snippet}", - applicability = "maybe-incorrect", - style = "verbose" + applicability = "maybe-incorrect" )] pub(crate) struct UnexpectedResUseAtOpInSlicePatWithRangeSugg { #[primary_span] @@ -1130,11 +1125,7 @@ pub(crate) struct ConstructorPrivateIfAnyFieldPrivate { } #[derive(Subdiagnostic)] -#[multipart_suggestion( - resolve_consider_making_the_field_public, - applicability = "maybe-incorrect", - style = "verbose" -)] +#[multipart_suggestion(resolve_consider_making_the_field_public, applicability = "maybe-incorrect")] pub(crate) struct ConsiderMakingTheFieldPublic { #[suggestion_part(code = "pub ")] pub(crate) spans: Vec, @@ -1146,8 +1137,7 @@ pub(crate) enum ImportIdent { #[suggestion( resolve_suggestion_import_ident_through_reexport, code = "{path}", - applicability = "machine-applicable", - style = "verbose" + applicability = "machine-applicable" )] ThroughReExport { #[primary_span] @@ -1158,8 +1148,7 @@ pub(crate) enum ImportIdent { #[suggestion( resolve_suggestion_import_ident_directly, code = "{path}", - applicability = "machine-applicable", - style = "verbose" + applicability = "machine-applicable" )] Directly { #[primary_span] diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index ad4e222f4deda..0f05c6ac62529 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -4013,7 +4013,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { }) { let mut diag = self.r.tcx.dcx().struct_allow(""); - diag.span_suggestion_verbose( + diag.span_suggestion( path_span.shrink_to_lo(), "there is an associated type with the same name", "Self::", diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 764cc350182a6..972267dc4b890 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -432,7 +432,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } if let Some(ref sugg) = base_error.suggestion { - err.span_suggestion_verbose(sugg.0, sugg.1, &sugg.2, Applicability::MaybeIncorrect); + err.span_suggestion(sugg.0, sugg.1, &sugg.2, Applicability::MaybeIncorrect); } self.suggest_bare_struct_literal(&mut err); @@ -517,7 +517,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { continue; }; if base_error.span == trait_ref.span { - err.span_suggestion_verbose( + err.span_suggestion( constraint.ident.span.between(trait_ref.span), "you might have meant to write a path instead of an associated type bound", "::", @@ -537,7 +537,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { let item_str = path_last_segment.ident; // Emit help message for fake-self from other languages (e.g., `this` in JavaScript). if ["this", "my"].contains(&item_str.as_str()) { - err.span_suggestion_short( + err.span_suggestion( span, "you might have meant to use `self` here instead", "self", @@ -560,7 +560,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { "&self", ) }; - err.span_suggestion_verbose( + err.span_suggestion( span, "if you meant to use `self`, you are also missing a `self` receiver \ argument", @@ -675,7 +675,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { match candidate { AssocSuggestion::Field(field_span) => { if self_is_available { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), "you might have meant to use the available field", format!("{pre}self."), @@ -691,7 +691,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } else { "you might have meant to refer to the method" }; - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), msg, "self.", @@ -702,7 +702,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { | AssocSuggestion::AssocFn { .. } | AssocSuggestion::AssocConst | AssocSuggestion::AssocType => { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), format!("you might have meant to {}", candidate.action()), "Self::", @@ -874,7 +874,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { Some((pat_sp, Some(ty_sp), None)) if ty_sp.contains(base_error.span) && base_error.could_be_expr => { - err.span_suggestion_short( + err.span_suggestion( pat_sp.between(ty_sp), "use `=` if you meant to assign", " = ", @@ -1052,7 +1052,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { "&self", ) }); - err.span_suggestion_verbose( + err.span_suggestion( span, "add a `self` receiver parameter to make the associated `fn` a method", sugg, @@ -1226,7 +1226,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { // `if (i + 2) = 2` => `if let (i + 2) = 2` (approximately pattern) // `if 2 = i` => `if let 2 = i` (lhs needs to contain error span) if lhs.is_approximately_pattern() && lhs.span.contains(span) { - err.span_suggestion_verbose( + err.span_suggestion( expr_span.shrink_to_lo(), "you might have meant to use pattern matching", "let ", @@ -1330,7 +1330,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { else { return false; }; - err.span_suggestion_verbose( + err.span_suggestion( *where_span, format!("constrain the associated type to `{ident}`"), where_bound_predicate_to_string(&new_where_bound_predicate), @@ -1439,7 +1439,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { // The LHS is a type that originates from a macro call. // We have to add angle brackets around it. - err.span_suggestion_verbose( + err.span_suggestion( lhs_source_span.until(rhs_span), MESSAGE, format!("<{snippet}>::"), @@ -1612,7 +1612,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { .is_some_and(|segment| !segment.has_generic_args && !segment.has_lifetime_args) && suggestable { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_hi(), "use `!` to invoke the macro", "!", @@ -1745,7 +1745,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { if non_visible_spans.len() > 0 { if let Some(fields) = self.r.field_visibility_spans.get(&def_id) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "consider making the field{} publicly accessible", pluralize!(fields.len()) @@ -1860,7 +1860,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { match &items[..] { [] => {} [(_, name, len)] if *len == args.len() => { - err.span_suggestion_verbose( + err.span_suggestion( path_span.shrink_to_hi(), format!("you might have meant to use the `{name}` associated function",), format!("::{name}"), @@ -1868,7 +1868,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { ); } [(_, name, len)] => { - err.span_suggestion_verbose( + err.span_suggestion( path_span.shrink_to_hi().with_hi(call_span.hi()), format!("you might have meant to use the `{name}` associated function",), suggestion(name, *len), @@ -2266,7 +2266,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { _ => (ident_span.shrink_to_lo(), "let ".to_string()), }; - err.span_suggestion_verbose( + err.span_suggestion( span, "you might have meant to introduce a new binding", text, @@ -2719,15 +2719,10 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { &mut err, Some(lifetime_ref.ident.name.as_str()), |err, _, span, message, suggestion, span_suggs| { - err.multipart_suggestion_with_style( + err.multipart_suggestion( message, std::iter::once((span, suggestion)).chain(span_suggs.clone()).collect(), Applicability::MaybeIncorrect, - if span_suggs.is_empty() { - SuggestionStyle::ShowCode - } else { - SuggestionStyle::ShowAlways - }, ); true }, @@ -3111,7 +3106,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { err, None, |err, higher_ranked, span, message, intro_sugg, _| { - err.multipart_suggestion_verbose( + err.multipart_suggestion( message, std::iter::once((span, intro_sugg)) .chain(spans_suggs.clone()) @@ -3138,7 +3133,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } else { String::new() }; - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("consider using the `{existing_name}` lifetime{post}"), spans_suggs, Applicability::MaybeIncorrect, @@ -3184,7 +3179,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } else { ("one of the", "s") }; - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "instead, you are more likely to want to change {the} \ argument{s} to be borrowed...", @@ -3239,7 +3234,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { err, None, |err, higher_ranked, span, message, intro_sugg, _| { - err.multipart_suggestion_verbose( + err.multipart_suggestion( message, std::iter::once((span, intro_sugg)) .chain(spans_suggs.clone()) @@ -3347,7 +3342,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } } if owned_sugg { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{pre} to return an owned value"), sugg, Applicability::MaybeIncorrect, @@ -3370,7 +3365,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { if spans_suggs.len() > 0 { // This happens when we have `Foo` where we point at the space before `T`, // but this can be confusing so we give a suggestion with placeholders. - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider using one of the available lifetimes here", spans_suggs, Applicability::HasPlaceholders, diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs index a46cba35b2d2f..c710031ce37cb 100644 --- a/compiler/rustc_trait_selection/src/errors.rs +++ b/compiler/rustc_trait_selection/src/errors.rs @@ -109,7 +109,7 @@ impl Subdiagnostic for AdjustSignatureBorrow { match self { AdjustSignatureBorrow::Borrow { to_borrow } => { diag.arg("len", to_borrow.len()); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( fluent::trait_selection_adjust_signature_borrow, to_borrow, Applicability::MaybeIncorrect, @@ -117,7 +117,7 @@ impl Subdiagnostic for AdjustSignatureBorrow { } AdjustSignatureBorrow::RemoveBorrow { remove_borrow } => { diag.arg("len", remove_borrow.len()); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( fluent::trait_selection_adjust_signature_remove_borrow, remove_borrow, Applicability::MaybeIncorrect, diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index f93bd0a396ddf..eb3884072a4df 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -120,7 +120,7 @@ pub fn is_const_evaluatable<'tcx>( "failed to evaluate generic const expression", ) .with_note("the crate this constant originates from uses `#![feature(generic_const_exprs)]`") - .with_span_suggestion_verbose( + .with_span_suggestion( DUMMY_SP, "consider enabling this feature", "#![feature(generic_const_exprs)]\n", diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/infer_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/infer_ctxt_ext.rs index 34da8e576ce86..c56043eed1af7 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/infer_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/infer_ctxt_ext.rs @@ -130,7 +130,7 @@ impl<'tcx> InferCtxt<'tcx> { // For example, if `expected_args_length` is 2, suggest `|_, _|`. if found_args.is_empty() && is_closure { let underscores = vec!["_"; expected_args.len()].join(", "); - err.span_suggestion_verbose( + err.span_suggestion( closure_arg_span.unwrap_or(found_span), format!( "consider changing the closure to take and ignore the expected argument{}", @@ -148,7 +148,7 @@ impl<'tcx> InferCtxt<'tcx> { .map(|(name, _)| name.to_owned()) .collect::>() .join(", "); - err.span_suggestion_verbose( + err.span_suggestion( found_span, "change the closure to take multiple arguments instead of a single tuple", format!("|{sugg}|"), @@ -187,7 +187,7 @@ impl<'tcx> InferCtxt<'tcx> { String::new() }, ); - err.span_suggestion_verbose( + err.span_suggestion( found_span, "change the closure to accept a tuple instead of individual arguments", sugg, diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index a0a8e5963f109..dd1a8318d06b0 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -232,7 +232,7 @@ pub fn suggest_restriction<'tcx, G: EmissionGuarantee>( ), }; - err.span_suggestion_verbose( + err.span_suggestion( sp, format!("consider further restricting {msg}"), suggestion, @@ -518,7 +518,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { }) = self.tcx.hir_node(*arg_hir_id) { let derefs = "*".repeat(steps); - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_lo(), "consider dereferencing here", derefs, @@ -565,7 +565,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if receiver_expr.hir_id == *arg_hir_id ); if is_receiver { - err.multipart_suggestion_verbose( + err.multipart_suggestion( msg, vec![ (span.shrink_to_lo(), "(*".to_string()), @@ -574,7 +574,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { Applicability::MachineApplicable, ) } else { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), msg, '*', @@ -712,7 +712,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { { let mut suggestion = make_sugg(lhs, lsteps).1; suggestion.append(&mut make_sugg(rhs, rsteps).1); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider dereferencing both sides of the expression", suggestion, Applicability::MachineApplicable, @@ -722,21 +722,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { && lsteps > 0 { let (msg, suggestion) = make_sugg(lhs, lsteps); - err.multipart_suggestion_verbose( - msg, - suggestion, - Applicability::MachineApplicable, - ); + err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable); return true; } else if let Some(rsteps) = rsteps && rsteps > 0 { let (msg, suggestion) = make_sugg(rhs, rsteps); - err.multipart_suggestion_verbose( - msg, - suggestion, - Applicability::MachineApplicable, - ); + err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable); return true; } } @@ -859,7 +851,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { // an argument, the `obligation.cause.span` points at the expression // of the argument, so we can provide a suggestion. Otherwise, we give // a more general note. - err.span_suggestion_verbose( + err.span_suggestion( obligation.cause.span.shrink_to_hi(), msg, format!("({args})"), @@ -961,7 +953,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let new_obligation = self.mk_trait_obligation_with_new_self_ty(obligation.param_env, trait_pred_and_self); if self.predicate_must_hold_modulo_regions(&new_obligation) { - err.span_suggestion_short( + err.span_suggestion( stmt.span.with_lo(tail_expr.span.hi()), "remove this semicolon", "", @@ -1056,7 +1048,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ), ); } else { - err.span_suggestion_verbose( + err.span_suggestion( obligation.cause.span.shrink_to_hi(), "consider using clone here", ".clone()".to_string(), @@ -1355,7 +1347,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if let Some(_) = self.tcx.sess.source_map().span_look_ahead(span, ".", Some(50)) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( sugg_msg, vec![ (span.shrink_to_lo(), format!("({sugg_prefix}")), @@ -1396,7 +1388,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { (span.shrink_to_hi(), ")".to_string()), ] }; - err.multipart_suggestion_verbose( + err.multipart_suggestion( sugg_msg, suggestions, Applicability::MaybeIncorrect, @@ -1496,11 +1488,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { format!("consider removing {count} leading `&`-references") }; - err.multipart_suggestion_verbose( - msg, - suggestions, - Applicability::MachineApplicable, - ); + err.multipart_suggestion(msg, suggestions, Applicability::MachineApplicable); true } else { false @@ -1621,14 +1609,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { { let msg = format!("alternatively, consider making `fn {ident}` asynchronous"); if vis_span.is_empty() { - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), msg, "async ", Applicability::MaybeIncorrect, ); } else { - err.span_suggestion_verbose( + err.span_suggestion( vis_span.shrink_to_hi(), msg, " async", @@ -1699,7 +1687,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { { return; } - err.span_suggestion_verbose( + err.span_suggestion( sp, "consider changing this borrow's mutability", "&mut ", @@ -2817,7 +2805,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } else { (generics.span.shrink_to_hi(), ":") }; - err.span_suggestion_verbose( + err.span_suggestion( span, "consider relaxing the implicit `Sized` restriction", format!("{separator} ?Sized"), @@ -2951,7 +2939,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } match tcx.parent_hir_node(hir_id) { Node::LetStmt(hir::LetStmt { ty: Some(ty), .. }) => { - err.span_suggestion_verbose( + err.span_suggestion( ty.span.shrink_to_lo(), "consider borrowing here", "&", @@ -2966,7 +2954,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { // When encountering an assignment of an unsized trait, like // `let x = ""[..];`, provide a suggestion to borrow the initializer in // order to use have a slice instead. - err.span_suggestion_verbose( + err.span_suggestion( span.shrink_to_lo(), "consider borrowing here", "&", @@ -2975,7 +2963,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { err.note("all local variables must have a statically known size"); } Node::Param(param) => { - err.span_suggestion_verbose( + err.span_suggestion( param.ty_span.shrink_to_lo(), "function arguments must have a statically known size, borrowed types \ always have a known size", @@ -3025,7 +3013,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { [] => span_bug!(ty.span, "trait object with no traits: {ty:?}"), }; let needs_parens = traits.len() != 1; - err.span_suggestion_verbose( + err.span_suggestion( span, "you can use `impl Trait` as the argument type", "impl ", @@ -3039,14 +3027,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { (ty.span.shrink_to_hi(), ")".to_string()), ] }; - err.multipart_suggestion_verbose( + err.multipart_suggestion( borrowed_msg, sugg, Applicability::MachineApplicable, ); } hir::TyKind::Slice(_ty) => { - err.span_suggestion_verbose( + err.span_suggestion( ty.span.shrink_to_lo(), "function arguments must have a statically known size, borrowed \ slices always have a known size", @@ -3055,7 +3043,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ); } hir::TyKind::Path(_) => { - err.span_suggestion_verbose( + err.span_suggestion( ty.span.shrink_to_lo(), borrowed_msg, "&", @@ -3575,7 +3563,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { && let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) && snippet.ends_with('?') { - err.span_suggestion_verbose( + err.span_suggestion( span.with_hi(span.hi() - BytePos(1)).shrink_to_hi(), "consider `await`ing on the `Future`", ".await", @@ -3600,7 +3588,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if let ty::Float(_) = trait_ref.skip_binder().self_ty().kind() && let ty::Infer(InferTy::IntVar(_)) = trait_ref.skip_binder().args.type_at(1).kind() { - err.span_suggestion_verbose( + err.span_suggestion( rhs_span.shrink_to_hi(), "consider using a floating-point literal by writing it with `.0`", ".0", @@ -3661,7 +3649,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { }) }; if can_derive { - err.span_suggestion_verbose( + err.span_suggestion( self.tcx.def_span(adt.did()).shrink_to_lo(), format!( "consider annotating `{}` with `#[derive({})]`", @@ -3689,7 +3677,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { && let ty::Ref(_, inner_ty, _) = trait_pred.skip_binder().self_ty().kind() && let ty::Uint(ty::UintTy::Usize) = inner_ty.kind() { - err.span_suggestion_verbose( + err.span_suggestion( obligation.cause.span.shrink_to_lo(), "dereference this index", '*', @@ -3720,7 +3708,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { tcx, expr.span, body_id, param_env, pred, )) { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.with_lo(rcvr.span.hi()), format!( "consider removing this method call, as the receiver has type `{ty}` and \ @@ -3776,7 +3764,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ); } else { // Maybe the bare block was meant to be a closure. - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_lo(), "you might have meant to create the closure instead of a block", format!( @@ -3996,7 +3984,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { // && let Some(tail_ty) = typeck_results.expr_ty_opt(expr) && expected_found.found.is_unit() { - err.span_suggestion_verbose( + err.span_suggestion( expr.span.shrink_to_hi().with_hi(stmt.span.hi()), "consider removing this semicolon", String::new(), @@ -4361,7 +4349,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { suggestions.push((span.shrink_to_lo(), "&".into())); } suggestions.push((span.shrink_to_hi(), "[..]".into())); - err.multipart_suggestion_verbose(msg, suggestions, Applicability::MaybeIncorrect); + err.multipart_suggestion(msg, suggestions, Applicability::MaybeIncorrect); } else { err.span_help(span, msg); } @@ -4612,7 +4600,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { "\n Ok(())\n}".to_string(), )); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("consider adding return type"), sugg_spans, Applicability::MaybeIncorrect, @@ -5058,7 +5046,7 @@ fn point_at_assoc_type_restriction( pred.span }; - err.span_suggestion_verbose( + err.span_suggestion( span, "associated type for the current `impl` cannot be restricted in `where` \ clauses, remove this bound", @@ -5089,7 +5077,7 @@ fn point_at_assoc_type_restriction( let mut visitor = SelfVisitor { paths: vec![], name: Some(name) }; visitor.visit_trait_ref(trait_ref); for path in visitor.paths { - err.span_suggestion_verbose( + err.span_suggestion( path.span, "replace the associated type with the type specified in this `impl`", tcx.type_of(new.def_id).skip_binder(), diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index 17b6dd2bc58dd..21efe977a956e 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -1273,7 +1273,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { .must_apply_modulo_regions() { suggested = true; - err.span_suggestion_short( + err.span_suggestion( stmt.span.with_lo(expr.span.hi()), "remove this semicolon", String::new(), @@ -3033,7 +3033,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { suggs.push((span, suggestion)); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider relaxing the implicit `Sized` restriction", suggs, Applicability::MachineApplicable, @@ -3663,7 +3663,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if let Some(def_id) = def_id && let Some(generics) = self.tcx.hir().get_generics(def_id) { - err.span_suggestion_verbose( + err.span_suggestion( generics.tail_span_for_predicate_suggestion(), msg, format!("{} {code}", generics.add_where_or_trailing_comma()), diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 37f7e7ed38518..4c42c718c0910 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -2169,7 +2169,7 @@ fn suggest_disambiguator( diag.multipart_suggestion(help, spans, Applicability::MaybeIncorrect); } else { let (sp, suggestion_text) = spans.pop().unwrap(); - diag.span_suggestion_verbose(sp, help, suggestion_text, Applicability::MaybeIncorrect); + diag.span_suggestion(sp, help, suggestion_text, Applicability::MaybeIncorrect); } } else { diag.help(format!("{help}: {}", suggestion.as_help(path_str))); diff --git a/src/tools/clippy/clippy_lints/src/cargo/lint_groups_priority.rs b/src/tools/clippy/clippy_lints/src/cargo/lint_groups_priority.rs index e924542fea2aa..305cdaa46fd0f 100644 --- a/src/tools/clippy/clippy_lints/src/cargo/lint_groups_priority.rs +++ b/src/tools/clippy/clippy_lints/src/cargo/lint_groups_priority.rs @@ -133,7 +133,7 @@ fn check_table(cx: &LateContext<'_>, table: LintTable, known_groups: &FxHashSet< toml::ser::ValueSerializer::new(&mut suggestion), ) .unwrap(); - diag.span_suggestion_verbose( + diag.span_suggestion( config_span, format!( "to have lints override the group set `{}` to a lower priority", diff --git a/src/tools/clippy/clippy_lints/src/derivable_impls.rs b/src/tools/clippy/clippy_lints/src/derivable_impls.rs index 0c9ad5e8d0015..7924323beddef 100644 --- a/src/tools/clippy/clippy_lints/src/derivable_impls.rs +++ b/src/tools/clippy/clippy_lints/src/derivable_impls.rs @@ -131,7 +131,7 @@ fn check_struct<'tcx>( if should_emit { let struct_span = cx.tcx.def_span(adt_def.did()); span_lint_and_then(cx, DERIVABLE_IMPLS, item.span, "this `impl` can be derived", |diag| { - diag.span_suggestion_hidden( + diag.span_suggestion( item.span, "remove the manual implementation...", String::new(), @@ -160,7 +160,7 @@ fn check_enum<'tcx>(cx: &LateContext<'tcx>, item: &'tcx Item<'_>, func_expr: &Ex let variant_span = cx.tcx.def_span(variant_def.def_id); let indent_variant = indent_of(cx, variant_span).unwrap_or(0); span_lint_and_then(cx, DERIVABLE_IMPLS, item.span, "this `impl` can be derived", |diag| { - diag.span_suggestion_hidden( + diag.span_suggestion( item.span, "remove the manual implementation...", String::new(), diff --git a/src/tools/clippy/clippy_lints/src/empty_with_brackets.rs b/src/tools/clippy/clippy_lints/src/empty_with_brackets.rs index 743ec5b9ea7fb..05b68462eb5e4 100644 --- a/src/tools/clippy/clippy_lints/src/empty_with_brackets.rs +++ b/src/tools/clippy/clippy_lints/src/empty_with_brackets.rs @@ -86,7 +86,7 @@ impl EarlyLintPass for EmptyWithBrackets { span_after_ident, "found empty brackets on struct declaration", |diagnostic| { - diagnostic.span_suggestion_hidden( + diagnostic.span_suggestion( span_after_ident, "remove the brackets", ";", @@ -107,7 +107,7 @@ impl EarlyLintPass for EmptyWithBrackets { span_after_ident, "enum variant has empty brackets", |diagnostic| { - diagnostic.span_suggestion_hidden( + diagnostic.span_suggestion( span_after_ident, "remove the brackets", "", diff --git a/src/tools/clippy/clippy_lints/src/format_args.rs b/src/tools/clippy/clippy_lints/src/format_args.rs index 99def199af0c2..7b71a409eefb2 100644 --- a/src/tools/clippy/clippy_lints/src/format_args.rs +++ b/src/tools/clippy/clippy_lints/src/format_args.rs @@ -14,7 +14,7 @@ use rustc_ast::{ FormatPlaceholder, FormatTrait, }; use rustc_errors::Applicability; -use rustc_errors::SuggestionStyle::{CompletelyHidden, ShowCode}; +use rustc_errors::SuggestionStyle::{CompletelyHidden, ShowAlways}; use rustc_hir::{Expr, ExprKind, LangItem}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_middle::ty::adjustment::{Adjust, Adjustment}; @@ -295,7 +295,7 @@ impl<'a, 'tcx> FormatArgsExpr<'a, 'tcx> { } if let Some(format_span) = format_placeholder_format_span(placeholder) { - diag.span_suggestion_verbose( + diag.span_suggestion( format_span, "if the current behavior is intentional, remove the format specifiers", "", @@ -355,7 +355,7 @@ impl<'a, 'tcx> FormatArgsExpr<'a, 'tcx> { "change this to", fixes, Applicability::MachineApplicable, - if multiline_fix { CompletelyHidden } else { ShowCode }, + if multiline_fix { CompletelyHidden } else { ShowAlways }, ); }, ); diff --git a/src/tools/clippy/clippy_lints/src/items_after_test_module.rs b/src/tools/clippy/clippy_lints/src/items_after_test_module.rs index 3614fb8cc963b..ad72128876c25 100644 --- a/src/tools/clippy/clippy_lints/src/items_after_test_module.rs +++ b/src/tools/clippy/clippy_lints/src/items_after_test_module.rs @@ -1,7 +1,7 @@ use clippy_utils::diagnostics::span_lint_hir_and_then; use clippy_utils::source::snippet_opt; use clippy_utils::{fulfill_or_allowed, is_cfg_test, is_from_proc_macro}; -use rustc_errors::{Applicability, SuggestionStyle}; +use rustc_errors::Applicability; use rustc_hir::{HirId, Item, ItemKind, Mod}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::declare_lint_pass; @@ -95,11 +95,10 @@ impl LateLintPass<'_> for ItemsAfterTestModule { && let items_span = last.span.with_lo(test_mod.span.hi()) && let Some(items) = snippet_opt(cx, items_span) { - diag.multipart_suggestion_with_style( + diag.multipart_suggestion( "move the items to before the test module was defined", vec![(prev.span.shrink_to_hi(), items), (items_span, String::new())], Applicability::MachineApplicable, - SuggestionStyle::HideCodeAlways, ); } }, diff --git a/src/tools/clippy/clippy_lints/src/iter_without_into_iter.rs b/src/tools/clippy/clippy_lints/src/iter_without_into_iter.rs index 6b03f2597b083..ecd99ba01b9f2 100644 --- a/src/tools/clippy/clippy_lints/src/iter_without_into_iter.rs +++ b/src/tools/clippy/clippy_lints/src/iter_without_into_iter.rs @@ -172,7 +172,7 @@ impl {self_ty_without_ref} {{ iter_ty = snippet(cx, iter_assoc_span, ".."), ); - diag.span_suggestion_verbose( + diag.span_suggestion( item.span.shrink_to_lo(), format!("consider implementing `{expected_method_name}`"), sugg, @@ -255,7 +255,7 @@ impl IntoIterator for {self_ty_snippet} {{ }} " ); - diag.span_suggestion_verbose( + diag.span_suggestion( span_behind_impl, format!("consider implementing `IntoIterator` for `{self_ty_snippet}`"), sugg, diff --git a/src/tools/clippy/clippy_lints/src/loops/never_loop.rs b/src/tools/clippy/clippy_lints/src/loops/never_loop.rs index 313a5bfefbc8d..ab2c1afad2f7f 100644 --- a/src/tools/clippy/clippy_lints/src/loops/never_loop.rs +++ b/src/tools/clippy/clippy_lints/src/loops/never_loop.rs @@ -30,7 +30,7 @@ pub(super) fn check<'tcx>( // Suggests using an `if let` instead. This is `Unspecified` because the // loop may (probably) contain `break` statements which would be invalid // in an `if let`. - diag.span_suggestion_verbose( + diag.span_suggestion( for_span.with_hi(iterator.span.hi()), "if you need the first element of the iterator, try writing", for_to_if_let_sugg(cx, iterator, pat), diff --git a/src/tools/clippy/clippy_lints/src/manual_float_methods.rs b/src/tools/clippy/clippy_lints/src/manual_float_methods.rs index 89eea0b4456d4..ecea100168381 100644 --- a/src/tools/clippy/clippy_lints/src/manual_float_methods.rs +++ b/src/tools/clippy/clippy_lints/src/manual_float_methods.rs @@ -129,19 +129,19 @@ impl<'tcx> LateLintPass<'tcx> for ManualFloatMethods { Variant::ManualIsFinite => { // TODO: There's probably some better way to do this, i.e., create // multiple suggestions with notes between each of them - diag.span_suggestion_verbose( + diag.span_suggestion( expr.span, "use the dedicated method instead", format!("{local_snippet}.is_finite()"), Applicability::MaybeIncorrect, ) - .span_suggestion_verbose( + .span_suggestion( expr.span, "this will alter how it handles NaN; if that is a problem, use instead", format!("{local_snippet}.is_finite() || {local_snippet}.is_nan()"), Applicability::MaybeIncorrect, ) - .span_suggestion_verbose( + .span_suggestion( expr.span, "or, for conciseness", format!("!{local_snippet}.is_infinite()"), diff --git a/src/tools/clippy/clippy_lints/src/matches/redundant_guards.rs b/src/tools/clippy/clippy_lints/src/matches/redundant_guards.rs index c2c0fbf439d51..e799fa602f530 100644 --- a/src/tools/clippy/clippy_lints/src/matches/redundant_guards.rs +++ b/src/tools/clippy/clippy_lints/src/matches/redundant_guards.rs @@ -225,7 +225,7 @@ fn emit_redundant_guards<'tcx>( } => (span.shrink_to_hi(), format!(": {binding_replacement}")), PatBindingInfo { span, .. } => (span, binding_replacement.into_owned()), }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "try", vec![ suggestion_span, diff --git a/src/tools/clippy/clippy_lints/src/methods/iter_nth.rs b/src/tools/clippy/clippy_lints/src/methods/iter_nth.rs index e31fa2f777d8e..885392bbb0eae 100644 --- a/src/tools/clippy/clippy_lints/src/methods/iter_nth.rs +++ b/src/tools/clippy/clippy_lints/src/methods/iter_nth.rs @@ -31,7 +31,7 @@ pub(super) fn check<'tcx>( format!("called `.{iter_method}().nth()` on a {caller_type}"), |diag| { let get_method = if iter_method == "iter_mut" { "get_mut" } else { "get" }; - diag.span_suggestion_verbose( + diag.span_suggestion( iter_span.to(nth_span), format!("`{get_method}` is equivalent but more concise"), get_method, diff --git a/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs b/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs index 4f42fb73547a7..d1d05e459a736 100644 --- a/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs +++ b/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs @@ -162,7 +162,7 @@ fn check_manual_split_once_indirect( UnwrapKind::Unwrap => ".unwrap()", UnwrapKind::QuestionMark => "?", }; - diag.span_suggestion_verbose( + diag.span_suggestion( local.span, format!("try `{r}split_once`"), format!("let ({lhs}, {rhs}) = {self_snip}.{r}split_once({pat_snip}){unwrap};"), diff --git a/src/tools/clippy/clippy_lints/src/methods/string_lit_chars_any.rs b/src/tools/clippy/clippy_lints/src/methods/string_lit_chars_any.rs index 5f6f027a3b59e..8242e0c5bfe07 100644 --- a/src/tools/clippy/clippy_lints/src/methods/string_lit_chars_any.rs +++ b/src/tools/clippy/clippy_lints/src/methods/string_lit_chars_any.rs @@ -46,7 +46,7 @@ pub(super) fn check<'tcx>( expr.span, "usage of `.chars().any(...)` to check if a char matches any from a string literal", |diag| { - diag.span_suggestion_verbose( + diag.span_suggestion( expr.span, "use `matches!(...)` instead", format!("matches!({scrutinee_snip}, {pat_snip})"), diff --git a/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs b/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs index 38f2c9169124a..143f60f9f3acd 100644 --- a/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs +++ b/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs @@ -23,7 +23,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, recv: &'tcx hir::Expr<'_>, arg arg.span, "single argument that looks like it should be multiple arguments", |diag: &mut Diag<'_, ()>| { - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "consider splitting the argument", vec![(span, "args".to_string()), (arg.span, format!("[{arg1:?}, {arg2:?}]"))], Applicability::MaybeIncorrect, diff --git a/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs b/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs index bb0d714a31fd4..8116f94f1672f 100644 --- a/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs +++ b/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs @@ -153,7 +153,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingConstForFn { { let suggestion = if vis_span.is_empty() { "const " } else { " const" }; span_lint_and_then(cx, MISSING_CONST_FOR_FN, span, "this could be a `const fn`", |diag| { - diag.span_suggestion_verbose( + diag.span_suggestion( vis_span.shrink_to_hi(), "make the function `const`", suggestion, diff --git a/src/tools/clippy/clippy_lints/src/needless_borrowed_ref.rs b/src/tools/clippy/clippy_lints/src/needless_borrowed_ref.rs index fb02f24c9dc67..a7983e7b437a8 100644 --- a/src/tools/clippy/clippy_lints/src/needless_borrowed_ref.rs +++ b/src/tools/clippy/clippy_lints/src/needless_borrowed_ref.rs @@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessBorrowedRef { // `&ref ident` // ^^^^^ let span = ref_pat.span.until(ident.span); - diag.span_suggestion_verbose( + diag.span_suggestion( span, "try removing the `&ref` part", String::new(), diff --git a/src/tools/clippy/clippy_lints/src/needless_maybe_sized.rs b/src/tools/clippy/clippy_lints/src/needless_maybe_sized.rs index a1d8ec3b32ec9..113ca11902299 100644 --- a/src/tools/clippy/clippy_lints/src/needless_maybe_sized.rs +++ b/src/tools/clippy/clippy_lints/src/needless_maybe_sized.rs @@ -148,7 +148,7 @@ impl LateLintPass<'_> for NeedlessMaybeSized { diag.note(format!("...because `{current}` has the bound `{next}`")); } - diag.span_suggestion_verbose( + diag.span_suggestion( generics.span_for_bound_removal(sized_bound.predicate_pos, sized_bound.bound_pos), "change the bounds that require `Sized`, or remove the `?Sized` bound", "", diff --git a/src/tools/clippy/clippy_lints/src/raw_strings.rs b/src/tools/clippy/clippy_lints/src/raw_strings.rs index 3a00424545922..3eb8cc3d2423c 100644 --- a/src/tools/clippy/clippy_lints/src/raw_strings.rs +++ b/src/tools/clippy/clippy_lints/src/raw_strings.rs @@ -98,7 +98,7 @@ impl EarlyLintPass for RawStrings { remove.push((end, String::new())); } - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("use a plain {descr} literal instead"), remove, Applicability::MachineApplicable, diff --git a/src/tools/clippy/clippy_lints/src/repeat_vec_with_capacity.rs b/src/tools/clippy/clippy_lints/src/repeat_vec_with_capacity.rs index 792d8fc88f0bb..e131d1e7d7a07 100644 --- a/src/tools/clippy/clippy_lints/src/repeat_vec_with_capacity.rs +++ b/src/tools/clippy/clippy_lints/src/repeat_vec_with_capacity.rs @@ -58,7 +58,7 @@ fn emit_lint(cx: &LateContext<'_>, span: Span, kind: &str, note: &'static str, s format!("repeating `Vec::with_capacity` using `{kind}`, which does not retain capacity"), |diag| { diag.note(note); - diag.span_suggestion_verbose(span, sugg_msg, sugg, Applicability::MaybeIncorrect); + diag.span_suggestion(span, sugg_msg, sugg, Applicability::MaybeIncorrect); }, ); } diff --git a/src/tools/clippy/clippy_lints/src/returns.rs b/src/tools/clippy/clippy_lints/src/returns.rs index c11da3147ef4a..c3e9cd2bc2af8 100644 --- a/src/tools/clippy/clippy_lints/src/returns.rs +++ b/src/tools/clippy/clippy_lints/src/returns.rs @@ -430,7 +430,7 @@ fn emit_return_lint( .chain(semi_spans.into_iter().map(|span| (span, String::new()))) .collect(); - diag.multipart_suggestion_verbose(replacement.sugg_help(), suggestions, replacement.applicability()); + diag.multipart_suggestion(replacement.sugg_help(), suggestions, replacement.applicability()); }, ); } diff --git a/src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs b/src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs index 979d6dc77aede..7296fc7254310 100644 --- a/src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs +++ b/src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs @@ -99,7 +99,7 @@ impl<'tcx> LateLintPass<'tcx> for SignificantDropTightening<'tcx> { snippet(cx, apa.last_bind_ident.span, ".."), ) }; - diag.span_suggestion_verbose( + diag.span_suggestion( apa.first_stmt_span, "merge the temporary construction with its single usage", stmt, diff --git a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs index fcc41b51542fb..c1fb0e03ea94f 100644 --- a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs +++ b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs @@ -107,7 +107,7 @@ fn lint_unnested_or_patterns(cx: &EarlyContext<'_>, pat: &Pat) { span_lint_and_then(cx, UNNESTED_OR_PATTERNS, pat.span, "unnested or-patterns", |db| { insert_necessary_parens(&mut pat); - db.span_suggestion_verbose( + db.span_suggestion( pat.span, "nest the patterns", pprust::pat_to_string(&pat), diff --git a/src/tools/clippy/clippy_lints/src/utils/internal_lints/metadata_collector.rs b/src/tools/clippy/clippy_lints/src/utils/internal_lints/metadata_collector.rs index 1c149f2045629..bfd0da48df216 100644 --- a/src/tools/clippy/clippy_lints/src/utils/internal_lints/metadata_collector.rs +++ b/src/tools/clippy/clippy_lints/src/utils/internal_lints/metadata_collector.rs @@ -76,9 +76,6 @@ const LINT_EMISSION_FUNCTIONS: [&[&str]; 7] = [ ]; const SUGGESTION_DIAG_METHODS: [(&str, bool); 9] = [ ("span_suggestion", false), - ("span_suggestion_short", false), - ("span_suggestion_verbose", false), - ("span_suggestion_hidden", false), ("tool_only_span_suggestion", false), ("multipart_suggestion", true), ("multipart_suggestions", true), diff --git a/src/tools/clippy/tests/ui-toml/array_size_threshold/array_size_threshold.stderr b/src/tools/clippy/tests/ui-toml/array_size_threshold/array_size_threshold.stderr index 009153bc4a11b..5c0ad007b04b3 100644 --- a/src/tools/clippy/tests/ui-toml/array_size_threshold/array_size_threshold.stderr +++ b/src/tools/clippy/tests/ui-toml/array_size_threshold/array_size_threshold.stderr @@ -2,12 +2,14 @@ error: large array defined as const --> tests/ui-toml/array_size_threshold/array_size_threshold.rs:4:1 | LL | const ABOVE: [u8; 11] = [0; 11]; - | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::large-const-arrays` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_const_arrays)]` +help: make this a static item + | +LL | static ABOVE: [u8; 11] = [0; 11]; + | ~~~~~~ error: allocating a local array larger than 10 bytes --> tests/ui-toml/array_size_threshold/array_size_threshold.rs:4:25 diff --git a/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.stderr b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.stderr index 861ba9e79a18e..15dffb19e602e 100644 --- a/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.stderr +++ b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.stderr @@ -2,10 +2,14 @@ error: integer literal has a better hexadecimal representation --> tests/ui-toml/decimal_literal_representation/decimal_literal_representation.rs:4:13 | LL | let _ = 16777215; - | ^^^^^^^^ help: consider: `0x00FF_FFFF` + | ^^^^^^^^ | = note: `-D clippy::decimal-literal-representation` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::decimal_literal_representation)]` +help: consider + | +LL | let _ = 0x00FF_FFFF; + | ~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui-toml/explicit_iter_loop/explicit_iter_loop.stderr b/src/tools/clippy/tests/ui-toml/explicit_iter_loop/explicit_iter_loop.stderr index 96b4736bbdf9c..a84a5e673a022 100644 --- a/src/tools/clippy/tests/ui-toml/explicit_iter_loop/explicit_iter_loop.stderr +++ b/src/tools/clippy/tests/ui-toml/explicit_iter_loop/explicit_iter_loop.stderr @@ -2,16 +2,25 @@ error: it is more concise to loop over references to containers instead of using --> tests/ui-toml/explicit_iter_loop/explicit_iter_loop.rs:6:14 | LL | for _ in rmvec.iter() {} - | ^^^^^^^^^^^^ help: to write this more concisely, try: `&*rmvec` + | ^^^^^^^^^^^^ | = note: `-D clippy::explicit-iter-loop` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::explicit_iter_loop)]` +help: to write this more concisely, try + | +LL | for _ in &*rmvec {} + | ~~~~~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui-toml/explicit_iter_loop/explicit_iter_loop.rs:8:14 | LL | for _ in rmvec.iter_mut() {} - | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut *rmvec` + | ^^^^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &mut *rmvec {} + | ~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui-toml/large_futures/large_futures.stderr b/src/tools/clippy/tests/ui-toml/large_futures/large_futures.stderr index 7779bfeca5dd0..67a03924f7c26 100644 --- a/src/tools/clippy/tests/ui-toml/large_futures/large_futures.stderr +++ b/src/tools/clippy/tests/ui-toml/large_futures/large_futures.stderr @@ -2,10 +2,14 @@ error: large future with a size of 1026 bytes --> tests/ui-toml/large_futures/large_futures.rs:18:5 | LL | should_warn().await; - | ^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(should_warn())` + | ^^^^^^^^^^^^^ | = note: `-D clippy::large-futures` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_futures)]` +help: consider `Box::pin` on it + | +LL | Box::pin(should_warn()).await; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui-toml/large_types_passed_by_value/large_types_passed_by_value.stderr b/src/tools/clippy/tests/ui-toml/large_types_passed_by_value/large_types_passed_by_value.stderr index 848fe4ba2bbe2..838cdd75772b9 100644 --- a/src/tools/clippy/tests/ui-toml/large_types_passed_by_value/large_types_passed_by_value.stderr +++ b/src/tools/clippy/tests/ui-toml/large_types_passed_by_value/large_types_passed_by_value.stderr @@ -2,10 +2,14 @@ error: this argument (513 byte) is passed by value, but might be more efficient --> tests/ui-toml/large_types_passed_by_value/large_types_passed_by_value.rs:4:11 | LL | fn f2(_v: [u8; 513]) {} - | ^^^^^^^^^ help: consider passing by reference instead: `&[u8; 513]` + | ^^^^^^^^^ | = note: `-D clippy::large-types-passed-by-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_types_passed_by_value)]` +help: consider passing by reference instead + | +LL | fn f2(_v: &[u8; 513]) {} + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.stderr b/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.stderr index 766722d35ab71..854853ef83112 100644 --- a/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.stderr +++ b/src/tools/clippy/tests/ui-toml/lint_decimal_readability/test.stderr @@ -2,19 +2,27 @@ error: digits grouped inconsistently by underscores --> tests/ui-toml/lint_decimal_readability/test.rs:19:18 | LL | let _fail1 = 100_200_300.123456789; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.123_456_789` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::inconsistent_digit_grouping)]` +help: consider + | +LL | let _fail1 = 100_200_300.123_456_789; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: long literal lacking separators --> tests/ui-toml/lint_decimal_readability/test.rs:22:18 | LL | let _fail2 = 100200300.300200100; - | ^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.300_200_100` + | ^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unreadable-literal` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unreadable_literal)]` +help: consider + | +LL | let _fail2 = 100_200_300.300_200_100; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui-toml/manual_let_else/manual_let_else.stderr b/src/tools/clippy/tests/ui-toml/manual_let_else/manual_let_else.stderr index 30253cd0c943e..a2522e2ce1406 100644 --- a/src/tools/clippy/tests/ui-toml/manual_let_else/manual_let_else.stderr +++ b/src/tools/clippy/tests/ui-toml/manual_let_else/manual_let_else.stderr @@ -6,10 +6,14 @@ LL | | LL | | Foo::A(x) => x, LL | | Foo::B => return, LL | | }; - | |______^ help: consider writing: `let Foo::A(x) = Foo::A(1) else { return };` + | |______^ | = note: `-D clippy::manual-let-else` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_let_else)]` +help: consider writing + | +LL | let Foo::A(x) = Foo::A(1) else { return }; + | error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.stderr b/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.stderr index 81b0cda94af4a..642ab513f4646 100644 --- a/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.stderr +++ b/src/tools/clippy/tests/ui-toml/min_rust_version/min_rust_version.stderr @@ -2,10 +2,14 @@ error: you are using an explicit closure for cloning elements --> tests/ui-toml/min_rust_version/min_rust_version.rs:74:26 | LL | let _: Option = Some(&16).map(|b| *b); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `Some(&16).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::map-clone` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::map_clone)]` +help: consider calling the dedicated `cloned` method + | +LL | let _: Option = Some(&16).cloned(); + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.stderr b/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.stderr index f66938c83fbf8..bdc2d324105e4 100644 --- a/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.stderr +++ b/src/tools/clippy/tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.stderr @@ -2,40 +2,69 @@ error: this import should be renamed --> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:5:20 | LL | use std::process::{exit as wrong_exit, Child as Kid}; - | ^^^^^^^^^^^^^^^^^^ help: try: `exit as goodbye` + | ^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::missing-enforced-import-renames` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::missing_enforced_import_renames)]` +help: try + | +LL | use std::process::{exit as goodbye, Child as Kid}; + | ~~~~~~~~~~~~~~~ error: this import should be renamed --> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:6:1 | LL | use std::thread::sleep; - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `use std::thread::sleep as thread_sleep` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use std::thread::sleep as thread_sleep; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this import should be renamed --> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:9:11 | LL | any::{type_name, Any}, - | ^^^^^^^^^ help: try: `type_name as ident` + | ^^^^^^^^^ + | +help: try + | +LL | any::{type_name as ident, Any}, + | ~~~~~~~~~~~~~~~~~~ error: this import should be renamed --> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:10:5 | LL | clone, - | ^^^^^ help: try: `clone as foo` + | ^^^^^ + | +help: try + | +LL | clone as foo, + | ~~~~~~~~~~~~ error: this import should be renamed --> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:11:5 | LL | sync :: Mutex, - | ^^^^^^^^^^^^^ help: try: `sync :: Mutex as StdMutie` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | sync :: Mutex as StdMutie, + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: this import should be renamed --> tests/ui-toml/missing_enforced_import_rename/conf_missing_enforced_import_rename.rs:15:5 | LL | use std::collections::BTreeMap as OopsWrongRename; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `use std::collections::BTreeMap as Map` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use std::collections::BTreeMap as Map; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr index c2c76e444cfe0..6f0f0edcf430b 100644 --- a/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr +++ b/src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.stderr @@ -2,57 +2,95 @@ error: use of irregular braces for `vec!` macro --> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:43:13 | LL | let _ = vec! {1, 2, 3}; - | ^^^^^^^^^^^^^^ help: consider writing: `vec![1, 2, 3]` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::nonstandard_macro_braces)]` +help: consider writing + | +LL | let _ = vec![1, 2, 3]; + | ~~~~~~~~~~~~~ error: use of irregular braces for `format!` macro --> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:44:13 | LL | let _ = format!["ugh {} stop being such a good compiler", "hello"]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `format!("ugh {} stop being such a good compiler", "hello")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let _ = format!("ugh {} stop being such a good compiler", "hello"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of irregular braces for `matches!` macro --> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:45:13 | LL | let _ = matches!{{}, ()}; - | ^^^^^^^^^^^^^^^^ help: consider writing: `matches!({}, ())` + | ^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let _ = matches!({}, ()); + | ~~~~~~~~~~~~~~~~ error: use of irregular braces for `quote!` macro --> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:46:13 | LL | let _ = quote!(let x = 1;); - | ^^^^^^^^^^^^^^^^^^ help: consider writing: `quote!{let x = 1;}` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let _ = quote!{let x = 1;}; + | ~~~~~~~~~~~~~~~~~~ error: use of irregular braces for `quote::quote!` macro --> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:47:13 | LL | let _ = quote::quote!(match match match); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `quote::quote!{match match match}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let _ = quote::quote!{match match match}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of irregular braces for `vec!` macro --> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:18:9 | LL | vec!{0, 0, 0} - | ^^^^^^^^^^^^^ help: consider writing: `vec![0, 0, 0]` + | ^^^^^^^^^^^^^ ... LL | let _ = test!(); // trigger when macro def is inside our own crate | ------- in this macro invocation | = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider writing + | +LL | vec![0, 0, 0] + | error: use of irregular braces for `type_pos!` macro --> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:56:12 | LL | let _: type_pos!(usize) = vec![]; - | ^^^^^^^^^^^^^^^^ help: consider writing: `type_pos![usize]` + | ^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let _: type_pos![usize] = vec![]; + | ~~~~~~~~~~~~~~~~ error: use of irregular braces for `eprint!` macro --> tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs:58:5 | LL | eprint!("test if user config overrides defaults"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `eprint!["test if user config overrides defaults"]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | eprint!["test if user config overrides defaults"]; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.default.stderr b/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.default.stderr index 2d700f6075926..2800d036b6719 100644 --- a/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.default.stderr +++ b/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.default.stderr @@ -2,28 +2,47 @@ error: renamed function parameter of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:30:18 | LL | fn eq(&self, rhs: &Self) -> bool { - | ^^^ help: consider using the default name: `other` + | ^^^ | = note: `-D clippy::renamed-function-params` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::renamed_function_params)]` +help: consider using the default name + | +LL | fn eq(&self, other: &Self) -> bool { + | ~~~~~ error: renamed function parameter of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:34:18 | LL | fn ne(&self, rhs: &Self) -> bool { - | ^^^ help: consider using the default name: `other` + | ^^^ + | +help: consider using the default name + | +LL | fn ne(&self, other: &Self) -> bool { + | ~~~~~ error: renamed function parameter of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:48:19 | LL | fn foo(&self, i_dont_wanna_use_your_name: u8) {} // only lint in `extend` - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using the default name: `val` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using the default name + | +LL | fn foo(&self, val: u8) {} // only lint in `extend` + | ~~~ error: renamed function parameter of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:55:31 | LL | fn hash(&self, states: &mut H) { - | ^^^^^^ help: consider using the default name: `state` + | ^^^^^^ + | +help: consider using the default name + | +LL | fn hash(&self, state: &mut H) { + | ~~~~~ error: renamed function parameters of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:59:30 @@ -40,7 +59,12 @@ error: renamed function parameter of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:80:18 | LL | fn add(self, b: B) -> C { - | ^ help: consider using the default name: `rhs` + | ^ + | +help: consider using the default name + | +LL | fn add(self, rhs: B) -> C { + | ~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.extend.stderr b/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.extend.stderr index e57554fa613ac..a175b4016da90 100644 --- a/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.extend.stderr +++ b/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.extend.stderr @@ -2,22 +2,36 @@ error: renamed function parameter of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:30:18 | LL | fn eq(&self, rhs: &Self) -> bool { - | ^^^ help: consider using the default name: `other` + | ^^^ | = note: `-D clippy::renamed-function-params` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::renamed_function_params)]` +help: consider using the default name + | +LL | fn eq(&self, other: &Self) -> bool { + | ~~~~~ error: renamed function parameter of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:34:18 | LL | fn ne(&self, rhs: &Self) -> bool { - | ^^^ help: consider using the default name: `other` + | ^^^ + | +help: consider using the default name + | +LL | fn ne(&self, other: &Self) -> bool { + | ~~~~~ error: renamed function parameter of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:55:31 | LL | fn hash(&self, states: &mut H) { - | ^^^^^^ help: consider using the default name: `state` + | ^^^^^^ + | +help: consider using the default name + | +LL | fn hash(&self, state: &mut H) { + | ~~~~~ error: renamed function parameters of trait impl --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:59:30 diff --git a/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr b/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr index a631674526002..98b4559501e1d 100644 --- a/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr +++ b/src/tools/clippy/tests/ui-toml/toml_trivially_copy/test.stderr @@ -2,16 +2,25 @@ error: this argument (N byte) is passed by reference, but would be more efficien --> tests/ui-toml/toml_trivially_copy/test.rs:15:11 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::trivially_copy_pass_by_ref)]` +help: consider passing by value instead + | +LL | fn bad(x: u16, y: &Foo) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) --> tests/ui-toml/toml_trivially_copy/test.rs:15:20 | LL | fn bad(x: &u16, y: &Foo) {} - | ^^^^ help: consider passing by value instead: `Foo` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad(x: &u16, y: Foo) {} + | ~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr b/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr index 5cf9c0fb27102..18814953068ad 100644 --- a/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr +++ b/src/tools/clippy/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr @@ -248,7 +248,12 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni --> $DIR/tests/ui-toml/toml_unknown_key/clippy.toml:7:1 | LL | allow_mixed_uninlined_format_args = true - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: perhaps you meant: `allow-mixed-uninlined-format-args` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: perhaps you meant + | +LL | allow-mixed-uninlined-format-args = true + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui-toml/too_large_for_stack/useless_vec.stderr b/src/tools/clippy/tests/ui-toml/too_large_for_stack/useless_vec.stderr index 90c5cdb8aa711..510e2de0ec687 100644 --- a/src/tools/clippy/tests/ui-toml/too_large_for_stack/useless_vec.stderr +++ b/src/tools/clippy/tests/ui-toml/too_large_for_stack/useless_vec.stderr @@ -2,10 +2,14 @@ error: useless use of `vec!` --> tests/ui-toml/too_large_for_stack/useless_vec.rs:4:13 | LL | let x = vec![0u8; 500]; - | ^^^^^^^^^^^^^^ help: you can use an array directly: `[0u8; 500]` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::useless-vec` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]` +help: you can use an array directly + | +LL | let x = [0u8; 500]; + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui-toml/unnecessary_box_returns/unnecessary_box_returns.stderr b/src/tools/clippy/tests/ui-toml/unnecessary_box_returns/unnecessary_box_returns.stderr index f10b486464884..127436bdac14e 100644 --- a/src/tools/clippy/tests/ui-toml/unnecessary_box_returns/unnecessary_box_returns.stderr +++ b/src/tools/clippy/tests/ui-toml/unnecessary_box_returns/unnecessary_box_returns.stderr @@ -2,11 +2,15 @@ error: boxed return of the sized type `[u8; 64]` --> tests/ui-toml/unnecessary_box_returns/unnecessary_box_returns.rs:3:11 | LL | fn f() -> Box<[u8; 64]> { - | ^^^^^^^^^^^^^ help: try: `[u8; 64]` + | ^^^^^^^^^^^^^ | = help: changing this also requires a change to the return expressions in this function = note: `-D clippy::unnecessary-box-returns` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_box_returns)]` +help: try + | +LL | fn f() -> [u8; 64] { + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr index 41d5afd3efeca..24e7bc502c287 100644 --- a/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr +++ b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr @@ -2,10 +2,14 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> tests/ui-toml/unwrap_used/unwrap_used.rs:38:17 | LL | let _ = boxed_slice.get(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&boxed_slice[1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::get-unwrap` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::get_unwrap)]` +help: try + | +LL | let _ = &boxed_slice[1]; + | ~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:38:17 @@ -22,7 +26,12 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> tests/ui-toml/unwrap_used/unwrap_used.rs:39:17 | LL | let _ = some_slice.get(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_slice[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_slice[0]; + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:39:17 @@ -37,7 +46,12 @@ error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more conc --> tests/ui-toml/unwrap_used/unwrap_used.rs:40:17 | LL | let _ = some_vec.get(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_vec[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_vec[0]; + | ~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:40:17 @@ -52,7 +66,12 @@ error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more --> tests/ui-toml/unwrap_used/unwrap_used.rs:41:17 | LL | let _ = some_vecdeque.get(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_vecdeque[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_vecdeque[0]; + | ~~~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:41:17 @@ -67,7 +86,12 @@ error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more --> tests/ui-toml/unwrap_used/unwrap_used.rs:42:17 | LL | let _ = some_hashmap.get(&1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_hashmap[&1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_hashmap[&1]; + | ~~~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:42:17 @@ -82,7 +106,12 @@ error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more --> tests/ui-toml/unwrap_used/unwrap_used.rs:43:17 | LL | let _ = some_btreemap.get(&1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_btreemap[&1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_btreemap[&1]; + | ~~~~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:43:17 @@ -97,7 +126,12 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> tests/ui-toml/unwrap_used/unwrap_used.rs:47:21 | LL | let _: u8 = *boxed_slice.get(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `boxed_slice[1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: u8 = boxed_slice[1]; + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:47:22 @@ -112,7 +146,12 @@ error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and mor --> tests/ui-toml/unwrap_used/unwrap_used.rs:52:9 | LL | *boxed_slice.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `boxed_slice[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | boxed_slice[0] = 1; + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:52:10 @@ -127,7 +166,12 @@ error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and mor --> tests/ui-toml/unwrap_used/unwrap_used.rs:53:9 | LL | *some_slice.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_slice[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | some_slice[0] = 1; + | ~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:53:10 @@ -142,7 +186,12 @@ error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more --> tests/ui-toml/unwrap_used/unwrap_used.rs:54:9 | LL | *some_vec.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vec[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | some_vec[0] = 1; + | ~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:54:10 @@ -157,7 +206,12 @@ error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and --> tests/ui-toml/unwrap_used/unwrap_used.rs:55:9 | LL | *some_vecdeque.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vecdeque[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | some_vecdeque[0] = 1; + | ~~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:55:10 @@ -172,7 +226,12 @@ error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more conc --> tests/ui-toml/unwrap_used/unwrap_used.rs:67:17 | LL | let _ = some_vec.get(0..1).unwrap().to_vec(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vec[0..1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = some_vec[0..1].to_vec(); + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:67:17 @@ -187,7 +246,12 @@ error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more --> tests/ui-toml/unwrap_used/unwrap_used.rs:68:17 | LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vec[0..1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = some_vec[0..1].to_vec(); + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui-toml/unwrap_used/unwrap_used.rs:68:17 @@ -202,13 +266,23 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> tests/ui-toml/unwrap_used/unwrap_used.rs:75:13 | LL | let _ = boxed_slice.get(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&boxed_slice[1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &boxed_slice[1]; + | ~~~~~~~~~~~~~~~ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise --> tests/ui-toml/unwrap_used/unwrap_used.rs:93:17 | LL | let _ = Box::new([0]).get(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&Box::new([0])[1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &Box::new([0])[1]; + | ~~~~~~~~~~~~~~~~~ error: aborting due to 28 previous errors diff --git a/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr index 88917603ff8ce..1dafcbf9d3005 100644 --- a/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr +++ b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr @@ -2,82 +2,146 @@ error: name `HTTPResponse` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:3:8 | LL | struct HTTPResponse; // not linted by default, but with cfg option - | ^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `HttpResponse` + | ^^^^^^^^^^^^ | = note: `-D clippy::upper-case-acronyms` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::upper_case_acronyms)]` +help: consider making the acronym lowercase, except the initial letter + | +LL | struct HttpResponse; // not linted by default, but with cfg option + | ~~~~~~~~~~~~ error: name `NS` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:8:5 | LL | NS, // not linted - | ^^ help: consider making the acronym lowercase, except the initial letter (notice the capitalization): `Ns` + | ^^ + | +help: consider making the acronym lowercase, except the initial letter (notice the capitalization difference) + | +LL | Ns, // not linted + | ~~ error: name `CWR` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:9:5 | LL | CWR, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Cwr` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Cwr, + | ~~~ error: name `ECE` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:10:5 | LL | ECE, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Ece` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Ece, + | ~~~ error: name `URG` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:11:5 | LL | URG, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Urg` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Urg, + | ~~~ error: name `ACK` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:12:5 | LL | ACK, - | ^^^ help: consider making the acronym lowercase, except the initial letter (notice the capitalization): `Ack` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter (notice the capitalization difference) + | +LL | Ack, + | ~~~ error: name `PSH` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:13:5 | LL | PSH, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Psh` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Psh, + | ~~~ error: name `RST` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:14:5 | LL | RST, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Rst` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Rst, + | ~~~ error: name `SYN` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:15:5 | LL | SYN, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Syn` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Syn, + | ~~~ error: name `FIN` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:16:5 | LL | FIN, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Fin` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Fin, + | ~~~ error: name `GCCLLVMSomething` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:21:8 | LL | struct GCCLLVMSomething; - | ^^^^^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `GccllvmSomething` + | ^^^^^^^^^^^^^^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | struct GccllvmSomething; + | ~~~~~~~~~~~~~~~~ error: name `WASD` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:38:5 | LL | WASD(u8), - | ^^^^ help: consider making the acronym lowercase, except the initial letter: `Wasd` + | ^^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Wasd(u8), + | ~~~~ error: name `WASDMixed` contains a capitalized acronym --> tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.rs:39:5 | LL | WASDMixed(String), - | ^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `WasdMixed` + | ^^^^^^^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | WasdMixed(String), + | ~~~~~~~~~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui-toml/useless_vec/useless_vec.stderr b/src/tools/clippy/tests/ui-toml/useless_vec/useless_vec.stderr index 633110c3c8d92..3eac010a08fa1 100644 --- a/src/tools/clippy/tests/ui-toml/useless_vec/useless_vec.stderr +++ b/src/tools/clippy/tests/ui-toml/useless_vec/useless_vec.stderr @@ -2,10 +2,14 @@ error: useless use of `vec!` --> tests/ui-toml/useless_vec/useless_vec.rs:8:9 | LL | foo(&vec![1_u32]); - | ^^^^^^^^^^^^ help: you can use a slice directly: `&[1_u32]` + | ^^^^^^^^^^^^ | = note: `-D clippy::useless-vec` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]` +help: you can use a slice directly + | +LL | foo(&[1_u32]); + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui-toml/vec_box_sized/test.stderr b/src/tools/clippy/tests/ui-toml/vec_box_sized/test.stderr index 8c0750d866639..1976c5479a034 100644 --- a/src/tools/clippy/tests/ui-toml/vec_box_sized/test.stderr +++ b/src/tools/clippy/tests/ui-toml/vec_box_sized/test.stderr @@ -2,22 +2,36 @@ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui-toml/vec_box_sized/test.rs:9:12 | LL | struct Foo(Vec>); - | ^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^ | = note: `-D clippy::vec-box` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::vec_box)]` +help: try + | +LL | struct Foo(Vec); + | ~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui-toml/vec_box_sized/test.rs:10:12 | LL | struct Bar(Vec>); - | ^^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | struct Bar(Vec); + | ~~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui-toml/vec_box_sized/test.rs:14:18 | LL | struct FooBarBaz(Vec>); - | ^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^ + | +help: try + | +LL | struct FooBarBaz(Vec); + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui-toml/verbose_bit_mask/verbose_bit_mask.stderr b/src/tools/clippy/tests/ui-toml/verbose_bit_mask/verbose_bit_mask.stderr index 64500b858001e..21da292382567 100644 --- a/src/tools/clippy/tests/ui-toml/verbose_bit_mask/verbose_bit_mask.stderr +++ b/src/tools/clippy/tests/ui-toml/verbose_bit_mask/verbose_bit_mask.stderr @@ -2,10 +2,14 @@ error: bit mask could be simplified with a call to `trailing_zeros` --> tests/ui-toml/verbose_bit_mask/verbose_bit_mask.rs:5:13 | LL | let _ = v & 0b111111 == 0; - | ^^^^^^^^^^^^^^^^^ help: try: `v.trailing_zeros() >= 6` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::verbose-bit-mask` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::verbose_bit_mask)]` +help: try + | +LL | let _ = v.trailing_zeros() >= 6; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.stderr b/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.stderr index 3d3be965aa411..8821b5194d722 100644 --- a/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.stderr +++ b/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.stderr @@ -2,22 +2,36 @@ error: usage of wildcard import --> tests/ui-toml/wildcard_imports/wildcard_imports.rs:18:5 | LL | use utils::*; - | ^^^^^^^^ help: try: `utils::{BAR, print}` + | ^^^^^^^^ | = note: `-D clippy::wildcard-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::wildcard_imports)]` +help: try + | +LL | use utils::{BAR, print}; + | ~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui-toml/wildcard_imports/wildcard_imports.rs:20:5 | LL | use my_crate::utils::*; - | ^^^^^^^^^^^^^^^^^^ help: try: `my_crate::utils::my_util_fn` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use my_crate::utils::my_util_fn; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui-toml/wildcard_imports/wildcard_imports.rs:22:5 | LL | use prelude::*; - | ^^^^^^^^^^ help: try: `prelude::FOO` + | ^^^^^^^^^^ + | +help: try + | +LL | use prelude::FOO; + | ~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui-toml/wildcard_imports_whitelist/wildcard_imports.stderr b/src/tools/clippy/tests/ui-toml/wildcard_imports_whitelist/wildcard_imports.stderr index 962337a73bdff..2a212f72e8fb0 100644 --- a/src/tools/clippy/tests/ui-toml/wildcard_imports_whitelist/wildcard_imports.stderr +++ b/src/tools/clippy/tests/ui-toml/wildcard_imports_whitelist/wildcard_imports.stderr @@ -2,10 +2,14 @@ error: usage of wildcard import --> tests/ui-toml/wildcard_imports_whitelist/wildcard_imports.rs:19:5 | LL | use utils_plus::*; - | ^^^^^^^^^^^^^ help: try: `utils_plus::do_something` + | ^^^^^^^^^^^^^ | = note: `-D clippy::wildcard-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::wildcard_imports)]` +help: try + | +LL | use utils_plus::do_something; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/allow_attributes.stderr b/src/tools/clippy/tests/ui/allow_attributes.stderr index 10dac0bc80808..e3ed65b19adcd 100644 --- a/src/tools/clippy/tests/ui/allow_attributes.stderr +++ b/src/tools/clippy/tests/ui/allow_attributes.stderr @@ -2,30 +2,48 @@ error: #[allow] attribute found --> tests/ui/allow_attributes.rs:12:3 | LL | #[allow(dead_code)] - | ^^^^^ help: replace it with: `expect` + | ^^^^^ | = note: `-D clippy::allow-attributes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::allow_attributes)]` +help: replace it with + | +LL | #[expect(dead_code)] + | ~~~~~~ error: #[allow] attribute found --> tests/ui/allow_attributes.rs:21:30 | LL | #[cfg_attr(panic = "unwind", allow(dead_code))] - | ^^^^^ help: replace it with: `expect` + | ^^^^^ + | +help: replace it with + | +LL | #[cfg_attr(panic = "unwind", expect(dead_code))] + | ~~~~~~ error: #[allow] attribute found --> tests/ui/allow_attributes.rs:52:7 | LL | #[allow(unused)] - | ^^^^^ help: replace it with: `expect` + | ^^^^^ + | +help: replace it with + | +LL | #[expect(unused)] + | ~~~~~~ error: #[allow] attribute found --> tests/ui/allow_attributes.rs:52:7 | LL | #[allow(unused)] - | ^^^^^ help: replace it with: `expect` + | ^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: replace it with + | +LL | #[expect(unused)] + | ~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/almost_complete_range.stderr b/src/tools/clippy/tests/ui/almost_complete_range.stderr index bfc2beb07d857..282a053169aca 100644 --- a/src/tools/clippy/tests/ui/almost_complete_range.stderr +++ b/src/tools/clippy/tests/ui/almost_complete_range.stderr @@ -2,226 +2,303 @@ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:17:17 | LL | let _ = ('a') ..'z'; - | ^^^^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^^ | = note: `-D clippy::almost-complete-range` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]` +help: use an inclusive range + | +LL | let _ = ('a') ..='z'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:18:17 | LL | let _ = 'A' .. ('Z'); - | ^^^^--^^^^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = 'A' ..= ('Z'); + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:19:17 | LL | let _ = ((('0'))) .. ('9'); - | ^^^^^^^^^^--^^^^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = ((('0'))) ..= ('9'); + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:26:13 | LL | let _ = (b'a')..(b'z'); - | ^^^^^^--^^^^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = (b'a')..=(b'z'); + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:27:13 | LL | let _ = b'A'..b'Z'; - | ^^^^--^^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = b'A'..=b'Z'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:28:13 | LL | let _ = b'0'..b'9'; - | ^^^^--^^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = b'0'..=b'9'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:34:13 | LL | let _ = inline!('a')..'z'; - | ^^^^^^^^^^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = inline!('a')..='z'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:35:13 | LL | let _ = inline!('A')..'Z'; - | ^^^^^^^^^^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = inline!('A')..='Z'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:36:13 | LL | let _ = inline!('0')..'9'; - | ^^^^^^^^^^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = inline!('0')..='9'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:39:9 | LL | b'a'..b'z' if true => 1, - | ^^^^--^^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^ + | +help: use an inclusive range + | +LL | b'a'..=b'z' if true => 1, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:40:9 | LL | b'A'..b'Z' if true => 2, - | ^^^^--^^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^ + | +help: use an inclusive range + | +LL | b'A'..=b'Z' if true => 2, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:41:9 | LL | b'0'..b'9' if true => 3, - | ^^^^--^^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^^^ + | +help: use an inclusive range + | +LL | b'0'..=b'9' if true => 3, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:49:9 | LL | 'a'..'z' if true => 1, - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | 'a'..='z' if true => 1, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:50:9 | LL | 'A'..'Z' if true => 2, - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | 'A'..='Z' if true => 2, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:51:9 | LL | '0'..'9' if true => 3, - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | '0'..='9' if true => 3, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:64:17 | LL | let _ = 'a'..'z'; - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ | = note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use an inclusive range + | +LL | let _ = 'a'..='z'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:65:17 | LL | let _ = 'A'..'Z'; - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ | = note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use an inclusive range + | +LL | let _ = 'A'..='Z'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:66:17 | LL | let _ = '0'..'9'; - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ | = note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use an inclusive range + | +LL | let _ = '0'..='9'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:73:9 | LL | 'a'..'z' => 1, - | ^^^--^^^ - | | - | help: use an inclusive range: `...` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | 'a'...'z' => 1, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:74:9 | LL | 'A'..'Z' => 2, - | ^^^--^^^ - | | - | help: use an inclusive range: `...` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | 'A'...'Z' => 2, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:75:9 | LL | '0'..'9' => 3, - | ^^^--^^^ - | | - | help: use an inclusive range: `...` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | '0'...'9' => 3, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:82:13 | LL | let _ = 'a'..'z'; - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = 'a'..='z'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:83:13 | LL | let _ = 'A'..'Z'; - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = 'A'..='Z'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:84:13 | LL | let _ = '0'..'9'; - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | let _ = '0'..='9'; + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:86:9 | LL | 'a'..'z' => 1, - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | 'a'..='z' => 1, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:87:9 | LL | 'A'..'Z' => 1, - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | 'A'..='Z' => 1, + | ~~~ error: almost complete ascii range --> tests/ui/almost_complete_range.rs:88:9 | LL | '0'..'9' => 3, - | ^^^--^^^ - | | - | help: use an inclusive range: `..=` + | ^^^^^^^^ + | +help: use an inclusive range + | +LL | '0'..='9' => 3, + | ~~~ error: aborting due to 27 previous errors diff --git a/src/tools/clippy/tests/ui/as_ptr_cast_mut.stderr b/src/tools/clippy/tests/ui/as_ptr_cast_mut.stderr index b3fc223ccdba1..acd5c75134c7d 100644 --- a/src/tools/clippy/tests/ui/as_ptr_cast_mut.stderr +++ b/src/tools/clippy/tests/ui/as_ptr_cast_mut.stderr @@ -2,16 +2,25 @@ error: casting the result of `as_ptr` to *mut u8 --> tests/ui/as_ptr_cast_mut.rs:22:13 | LL | let _ = string.as_ptr() as *mut u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `string.as_mut_ptr()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::as-ptr-cast-mut` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::as_ptr_cast_mut)]` +help: replace with + | +LL | let _ = string.as_mut_ptr(); + | ~~~~~~~~~~~~~~~~~~~ error: casting the result of `as_ptr` to *mut i8 --> tests/ui/as_ptr_cast_mut.rs:25:22 | LL | let _: *mut i8 = string.as_ptr() as *mut _; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `string.as_mut_ptr()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _: *mut i8 = string.as_mut_ptr(); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/as_underscore.stderr b/src/tools/clippy/tests/ui/as_underscore.stderr index dba56a2a8af38..2218d6d431728 100644 --- a/src/tools/clippy/tests/ui/as_underscore.stderr +++ b/src/tools/clippy/tests/ui/as_underscore.stderr @@ -2,20 +2,25 @@ error: using `as _` conversion --> tests/ui/as_underscore.rs:7:9 | LL | foo(n as _); - | ^^^^^- - | | - | help: consider giving the type explicitly: `usize` + | ^^^^^^ | = note: `-D clippy::as-underscore` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::as_underscore)]` +help: consider giving the type explicitly + | +LL | foo(n as usize); + | ~~~~~ error: using `as _` conversion --> tests/ui/as_underscore.rs:10:18 | LL | let _n: u8 = n as _; - | ^^^^^- - | | - | help: consider giving the type explicitly: `u8` + | ^^^^^^ + | +help: consider giving the type explicitly + | +LL | let _n: u8 = n as u8; + | ~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/assertions_on_result_states.stderr b/src/tools/clippy/tests/ui/assertions_on_result_states.stderr index a2bddc7025a97..389c78014ebd4 100644 --- a/src/tools/clippy/tests/ui/assertions_on_result_states.stderr +++ b/src/tools/clippy/tests/ui/assertions_on_result_states.stderr @@ -2,46 +2,80 @@ error: called `assert!` with `Result::is_ok` --> tests/ui/assertions_on_result_states.rs:24:5 | LL | assert!(r.is_ok()); - | ^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap()` + | ^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::assertions-on-result-states` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::assertions_on_result_states)]` +help: replace with + | +LL | r.unwrap(); + | ~~~~~~~~~~ error: called `assert!` with `Result::is_ok` --> tests/ui/assertions_on_result_states.rs:42:5 | LL | assert!(get_ok().is_ok()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `get_ok().unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | get_ok().unwrap(); + | ~~~~~~~~~~~~~~~~~ error: called `assert!` with `Result::is_ok` --> tests/ui/assertions_on_result_states.rs:45:5 | LL | assert!(get_ok_macro!().is_ok()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `get_ok_macro!().unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | get_ok_macro!().unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: called `assert!` with `Result::is_ok` --> tests/ui/assertions_on_result_states.rs:58:5 | LL | assert!(r.is_ok()); - | ^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap()` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | r.unwrap(); + | ~~~~~~~~~~ error: called `assert!` with `Result::is_ok` --> tests/ui/assertions_on_result_states.rs:64:9 | LL | assert!(r.is_ok()); - | ^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap()` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | r.unwrap(); + | ~~~~~~~~~~ error: called `assert!` with `Result::is_err` --> tests/ui/assertions_on_result_states.rs:72:5 | LL | assert!(r.is_err()); - | ^^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap_err()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | r.unwrap_err(); + | ~~~~~~~~~~~~~~ error: called `assert!` with `Result::is_err` --> tests/ui/assertions_on_result_states.rs:82:5 | LL | assert!(res.is_err()) - | ^^^^^^^^^^^^^^^^^^^^^ help: replace with: `res.unwrap_err();` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | res.unwrap_err(); + | error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/assign_ops.stderr b/src/tools/clippy/tests/ui/assign_ops.stderr index 4975ac5911fdd..008868f62a225 100644 --- a/src/tools/clippy/tests/ui/assign_ops.stderr +++ b/src/tools/clippy/tests/ui/assign_ops.stderr @@ -2,70 +2,124 @@ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:7:5 | LL | a = a + 1; - | ^^^^^^^^^ help: replace it with: `a += 1` + | ^^^^^^^^^ | = note: `-D clippy::assign-op-pattern` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::assign_op_pattern)]` +help: replace it with + | +LL | a += 1; + | ~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:8:5 | LL | a = 1 + a; - | ^^^^^^^^^ help: replace it with: `a += 1` + | ^^^^^^^^^ + | +help: replace it with + | +LL | a += 1; + | ~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:9:5 | LL | a = a - 1; - | ^^^^^^^^^ help: replace it with: `a -= 1` + | ^^^^^^^^^ + | +help: replace it with + | +LL | a -= 1; + | ~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:10:5 | LL | a = a * 99; - | ^^^^^^^^^^ help: replace it with: `a *= 99` + | ^^^^^^^^^^ + | +help: replace it with + | +LL | a *= 99; + | ~~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:11:5 | LL | a = 42 * a; - | ^^^^^^^^^^ help: replace it with: `a *= 42` + | ^^^^^^^^^^ + | +help: replace it with + | +LL | a *= 42; + | ~~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:12:5 | LL | a = a / 2; - | ^^^^^^^^^ help: replace it with: `a /= 2` + | ^^^^^^^^^ + | +help: replace it with + | +LL | a /= 2; + | ~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:13:5 | LL | a = a % 5; - | ^^^^^^^^^ help: replace it with: `a %= 5` + | ^^^^^^^^^ + | +help: replace it with + | +LL | a %= 5; + | ~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:14:5 | LL | a = a & 1; - | ^^^^^^^^^ help: replace it with: `a &= 1` + | ^^^^^^^^^ + | +help: replace it with + | +LL | a &= 1; + | ~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:20:5 | LL | s = s + "bla"; - | ^^^^^^^^^^^^^ help: replace it with: `s += "bla"` + | ^^^^^^^^^^^^^ + | +help: replace it with + | +LL | s += "bla"; + | ~~~~~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:24:5 | LL | a = a + Wrapping(1u32); - | ^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `a += Wrapping(1u32)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | a += Wrapping(1u32); + | ~~~~~~~~~~~~~~~~~~~ error: manual implementation of an assign operation --> tests/ui/assign_ops.rs:26:5 | LL | v[0] = v[0] + v[1]; - | ^^^^^^^^^^^^^^^^^^ help: replace it with: `v[0] += v[1]` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | v[0] += v[1]; + | ~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/assign_ops2.stderr b/src/tools/clippy/tests/ui/assign_ops2.stderr index ddeba2b2ff8f3..b5544de6c59f3 100644 --- a/src/tools/clippy/tests/ui/assign_ops2.stderr +++ b/src/tools/clippy/tests/ui/assign_ops2.stderr @@ -139,10 +139,14 @@ error: manual implementation of an assign operation --> tests/ui/assign_ops2.rs:63:5 | LL | buf = buf + cows.clone(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `buf += cows.clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::assign-op-pattern` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::assign_op_pattern)]` +help: replace it with + | +LL | buf += cows.clone(); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/assigning_clones.stderr b/src/tools/clippy/tests/ui/assigning_clones.stderr index a68516376abb5..6fbd33992c34b 100644 --- a/src/tools/clippy/tests/ui/assigning_clones.stderr +++ b/src/tools/clippy/tests/ui/assigning_clones.stderr @@ -2,148 +2,267 @@ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:24:5 | LL | *mut_thing = value_thing.clone(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `mut_thing.clone_from(&value_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::assigning-clones` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::assigning_clones)]` +help: use `clone_from()` + | +LL | mut_thing.clone_from(&value_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:28:5 | LL | *mut_thing = ref_thing.clone(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `mut_thing.clone_from(ref_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | mut_thing.clone_from(ref_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:32:5 | LL | mut_thing = ref_thing.clone(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `mut_thing.clone_from(ref_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | mut_thing.clone_from(ref_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:36:5 | LL | *mut_thing = Clone::clone(ref_thing); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(mut_thing, ref_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | Clone::clone_from(mut_thing, ref_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:40:5 | LL | mut_thing = Clone::clone(ref_thing); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(&mut mut_thing, ref_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | Clone::clone_from(&mut mut_thing, ref_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:44:5 | LL | *mut_thing = Clone::clone(ref_thing); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(mut_thing, ref_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | Clone::clone_from(mut_thing, ref_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:48:5 | LL | *mut_thing = HasCloneFrom::clone(ref_thing); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(mut_thing, ref_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | Clone::clone_from(mut_thing, ref_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:52:5 | LL | *mut_thing = ::clone(ref_thing); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(mut_thing, ref_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | Clone::clone_from(mut_thing, ref_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:57:5 | LL | *(mut_thing + &mut HasCloneFrom) = ref_thing.clone(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `(mut_thing + &mut HasCloneFrom).clone_from(ref_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | (mut_thing + &mut HasCloneFrom).clone_from(ref_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:62:5 | LL | *mut_thing = (ref_thing + ref_thing).clone(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `mut_thing.clone_from(ref_thing + ref_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | mut_thing.clone_from(ref_thing + ref_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:67:5 | LL | s = format!("{} {}", "hello", "world").clone(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `s.clone_from(&format!("{} {}", "hello", "world"))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | s.clone_from(&format!("{} {}", "hello", "world")); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:72:5 | LL | s = Clone::clone(&format!("{} {}", "hello", "world")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(&mut s, &format!("{} {}", "hello", "world"))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | Clone::clone_from(&mut s, &format!("{} {}", "hello", "world")); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:78:9 | LL | a = b.clone(); - | ^^^^^^^^^^^^^ help: use `clone_from()`: `a.clone_from(&b)` + | ^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | a.clone_from(&b); + | ~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:149:5 | LL | a = b.clone(); - | ^^^^^^^^^^^^^ help: use `clone_from()`: `a.clone_from(&b)` + | ^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | a.clone_from(&b); + | ~~~~~~~~~~~~~~~~ error: assigning the result of `Clone::clone()` may be inefficient --> tests/ui/assigning_clones.rs:156:5 | LL | a = b.clone(); - | ^^^^^^^^^^^^^ help: use `clone_from()`: `a.clone_from(&b)` + | ^^^^^^^^^^^^^ + | +help: use `clone_from()` + | +LL | a.clone_from(&b); + | ~~~~~~~~~~~~~~~~ error: assigning the result of `ToOwned::to_owned()` may be inefficient --> tests/ui/assigning_clones.rs:157:5 | LL | a = c.to_owned(); - | ^^^^^^^^^^^^^^^^ help: use `clone_into()`: `c.clone_into(&mut a)` + | ^^^^^^^^^^^^^^^^ + | +help: use `clone_into()` + | +LL | c.clone_into(&mut a); + | ~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `ToOwned::to_owned()` may be inefficient --> tests/ui/assigning_clones.rs:187:5 | LL | *mut_string = ref_str.to_owned(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ref_str.clone_into(mut_string)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_into()` + | +LL | ref_str.clone_into(mut_string); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `ToOwned::to_owned()` may be inefficient --> tests/ui/assigning_clones.rs:191:5 | LL | mut_string = ref_str.to_owned(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ref_str.clone_into(&mut mut_string)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_into()` + | +LL | ref_str.clone_into(&mut mut_string); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `ToOwned::to_owned()` may be inefficient --> tests/ui/assigning_clones.rs:212:5 | LL | **mut_box_string = ref_str.to_owned(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ref_str.clone_into(&mut (*mut_box_string))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_into()` + | +LL | ref_str.clone_into(&mut (*mut_box_string)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `ToOwned::to_owned()` may be inefficient --> tests/ui/assigning_clones.rs:216:5 | LL | **mut_box_string = ref_str.to_owned(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ref_str.clone_into(&mut (*mut_box_string))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_into()` + | +LL | ref_str.clone_into(&mut (*mut_box_string)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `ToOwned::to_owned()` may be inefficient --> tests/ui/assigning_clones.rs:220:5 | LL | *mut_thing = ToOwned::to_owned(ref_str); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ToOwned::clone_into(ref_str, mut_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_into()` + | +LL | ToOwned::clone_into(ref_str, mut_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `ToOwned::to_owned()` may be inefficient --> tests/ui/assigning_clones.rs:224:5 | LL | mut_thing = ToOwned::to_owned(ref_str); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ToOwned::clone_into(ref_str, &mut mut_thing)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_into()` + | +LL | ToOwned::clone_into(ref_str, &mut mut_thing); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `ToOwned::to_owned()` may be inefficient --> tests/ui/assigning_clones.rs:229:5 | LL | s = format!("{} {}", "hello", "world").to_owned(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `format!("{} {}", "hello", "world").clone_into(&mut s)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_into()` + | +LL | format!("{} {}", "hello", "world").clone_into(&mut s); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: assigning the result of `ToOwned::to_owned()` may be inefficient --> tests/ui/assigning_clones.rs:234:5 | LL | s = ToOwned::to_owned(&format!("{} {}", "hello", "world")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ToOwned::clone_into(&format!("{} {}", "hello", "world"), &mut s)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `clone_into()` + | +LL | ToOwned::clone_into(&format!("{} {}", "hello", "world"), &mut s); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 24 previous errors diff --git a/src/tools/clippy/tests/ui/async_yields_async.stderr b/src/tools/clippy/tests/ui/async_yields_async.stderr index 861c3f2ce4a5f..991ce60ec8b58 100644 --- a/src/tools/clippy/tests/ui/async_yields_async.stderr +++ b/src/tools/clippy/tests/ui/async_yields_async.stderr @@ -25,12 +25,14 @@ error: an async construct yields a type which is itself awaitable LL | let _i = async { | ____________________- LL | | CustomFutureType - | | ^^^^^^^^^^^^^^^^ - | | | - | | awaitable value not awaited - | | help: consider awaiting this value: `CustomFutureType.await` + | | ^^^^^^^^^^^^^^^^ awaitable value not awaited LL | | }; | |_____- outer async construct + | +help: consider awaiting this value + | +LL | CustomFutureType.await + | error: an async construct yields a type which is itself awaitable --> tests/ui/async_yields_async.rs:49:9 @@ -57,12 +59,14 @@ error: an async construct yields a type which is itself awaitable LL | let _k = async || { | _______________________- LL | | CustomFutureType - | | ^^^^^^^^^^^^^^^^ - | | | - | | awaitable value not awaited - | | help: consider awaiting this value: `CustomFutureType.await` + | | ^^^^^^^^^^^^^^^^ awaitable value not awaited LL | | }; | |_____- outer async construct + | +help: consider awaiting this value + | +LL | CustomFutureType.await + | error: an async construct yields a type which is itself awaitable --> tests/ui/async_yields_async.rs:56:23 @@ -72,7 +76,11 @@ LL | let _l = async || CustomFutureType; | | | outer async construct | awaitable value not awaited - | help: consider awaiting this value: `CustomFutureType.await` + | +help: consider awaiting this value + | +LL | let _l = async || CustomFutureType.await; + | ~~~~~~~~~~~~~~~~~~~~~~ error: an async construct yields a type which is itself awaitable --> tests/ui/async_yields_async.rs:62:9 @@ -83,12 +91,14 @@ LL | | println!("I'm bored"); LL | | // Some more stuff ... | LL | | CustomFutureType - | | ^^^^^^^^^^^^^^^^ - | | | - | | awaitable value not awaited - | | help: consider awaiting this value: `CustomFutureType.await` + | | ^^^^^^^^^^^^^^^^ awaitable value not awaited LL | | }; | |_____- outer async construct + | +help: consider awaiting this value + | +LL | CustomFutureType.await + | error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/bind_instead_of_map.stderr b/src/tools/clippy/tests/ui/bind_instead_of_map.stderr index 57e0e4fb84752..7a069c2c25b6c 100644 --- a/src/tools/clippy/tests/ui/bind_instead_of_map.stderr +++ b/src/tools/clippy/tests/ui/bind_instead_of_map.stderr @@ -2,25 +2,39 @@ error: using `Option.and_then(Some)`, which is a no-op --> tests/ui/bind_instead_of_map.rs:8:13 | LL | let _ = x.and_then(Some); - | ^^^^^^^^^^^^^^^^ help: use the expression directly: `x` + | ^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/bind_instead_of_map.rs:1:9 | LL | #![deny(clippy::bind_instead_of_map)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use the expression directly + | +LL | let _ = x; + | ~ error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)` --> tests/ui/bind_instead_of_map.rs:9:13 | LL | let _ = x.and_then(|o| Some(o + 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.map(|o| o + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x.map(|o| o + 1); + | ~~~~~~~~~~~~~~~~ error: using `Result.and_then(Ok)`, which is a no-op --> tests/ui/bind_instead_of_map.rs:15:13 | LL | let _ = x.and_then(Ok); - | ^^^^^^^^^^^^^^ help: use the expression directly: `x` + | ^^^^^^^^^^^^^^ + | +help: use the expression directly + | +LL | let _ = x; + | ~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/blocks_in_conditions.stderr b/src/tools/clippy/tests/ui/blocks_in_conditions.stderr index a55e1efb575ea..95c8cbba40402 100644 --- a/src/tools/clippy/tests/ui/blocks_in_conditions.stderr +++ b/src/tools/clippy/tests/ui/blocks_in_conditions.stderr @@ -23,16 +23,25 @@ error: omit braces around single expression condition --> tests/ui/blocks_in_conditions.rs:42:8 | LL | if { true } { 6 } else { 10 } - | ^^^^^^^^ help: try: `true` + | ^^^^^^^^ + | +help: try + | +LL | if true { 6 } else { 10 } + | ~~~~ error: this boolean expression can be simplified --> tests/ui/blocks_in_conditions.rs:48:8 | LL | if true && x == 3 { 6 } else { 10 } - | ^^^^^^^^^^^^^^ help: try: `x == 3` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]` +help: try + | +LL | if x == 3 { 6 } else { 10 } + | ~~~~~~ error: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let` --> tests/ui/blocks_in_conditions.rs:75:5 diff --git a/src/tools/clippy/tests/ui/bool_comparison.stderr b/src/tools/clippy/tests/ui/bool_comparison.stderr index 7c8b906221fa9..dfc141b5b59b4 100644 --- a/src/tools/clippy/tests/ui/bool_comparison.stderr +++ b/src/tools/clippy/tests/ui/bool_comparison.stderr @@ -2,154 +2,278 @@ error: equality checks against true are unnecessary --> tests/ui/bool_comparison.rs:7:8 | LL | if x == true { - | ^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^ | = note: `-D clippy::bool-comparison` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]` +help: try simplifying it as shown + | +LL | if x { + | ~ error: equality checks against false can be replaced by a negation --> tests/ui/bool_comparison.rs:12:8 | LL | if x == false { - | ^^^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !x { + | ~~ error: equality checks against true are unnecessary --> tests/ui/bool_comparison.rs:17:8 | LL | if true == x { - | ^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if x { + | ~ error: equality checks against false can be replaced by a negation --> tests/ui/bool_comparison.rs:22:8 | LL | if false == x { - | ^^^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !x { + | ~~ error: inequality checks against true can be replaced by a negation --> tests/ui/bool_comparison.rs:27:8 | LL | if x != true { - | ^^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !x { + | ~~ error: inequality checks against false are unnecessary --> tests/ui/bool_comparison.rs:32:8 | LL | if x != false { - | ^^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if x { + | ~ error: inequality checks against true can be replaced by a negation --> tests/ui/bool_comparison.rs:37:8 | LL | if true != x { - | ^^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !x { + | ~~ error: inequality checks against false are unnecessary --> tests/ui/bool_comparison.rs:42:8 | LL | if false != x { - | ^^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if x { + | ~ error: less than comparison against true can be replaced by a negation --> tests/ui/bool_comparison.rs:47:8 | LL | if x < true { - | ^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !x { + | ~~ error: greater than checks against false are unnecessary --> tests/ui/bool_comparison.rs:52:8 | LL | if false < x { - | ^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if x { + | ~ error: greater than checks against false are unnecessary --> tests/ui/bool_comparison.rs:57:8 | LL | if x > false { - | ^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if x { + | ~ error: less than comparison against true can be replaced by a negation --> tests/ui/bool_comparison.rs:62:8 | LL | if true > x { - | ^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !x { + | ~~ error: order comparisons between booleans can be simplified --> tests/ui/bool_comparison.rs:68:8 | LL | if x < y { - | ^^^^^ help: try simplifying it as shown: `!x & y` + | ^^^^^ + | +help: try simplifying it as shown + | +LL | if !x & y { + | ~~~~~~ error: order comparisons between booleans can be simplified --> tests/ui/bool_comparison.rs:73:8 | LL | if x > y { - | ^^^^^ help: try simplifying it as shown: `x & !y` + | ^^^^^ + | +help: try simplifying it as shown + | +LL | if x & !y { + | ~~~~~~ error: this comparison might be written more concisely --> tests/ui/bool_comparison.rs:121:8 | LL | if a == !b {}; - | ^^^^^^^ help: try simplifying it as shown: `a != b` + | ^^^^^^^ + | +help: try simplifying it as shown + | +LL | if a != b {}; + | ~~~~~~ error: this comparison might be written more concisely --> tests/ui/bool_comparison.rs:122:8 | LL | if !a == b {}; - | ^^^^^^^ help: try simplifying it as shown: `a != b` + | ^^^^^^^ + | +help: try simplifying it as shown + | +LL | if a != b {}; + | ~~~~~~ error: this comparison might be written more concisely --> tests/ui/bool_comparison.rs:126:8 | LL | if b == !a {}; - | ^^^^^^^ help: try simplifying it as shown: `b != a` + | ^^^^^^^ + | +help: try simplifying it as shown + | +LL | if b != a {}; + | ~~~~~~ error: this comparison might be written more concisely --> tests/ui/bool_comparison.rs:127:8 | LL | if !b == a {}; - | ^^^^^^^ help: try simplifying it as shown: `b != a` + | ^^^^^^^ + | +help: try simplifying it as shown + | +LL | if b != a {}; + | ~~~~~~ error: equality checks against false can be replaced by a negation --> tests/ui/bool_comparison.rs:151:8 | LL | if false == m!(func) {} - | ^^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `!m!(func)` + | ^^^^^^^^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !m!(func) {} + | ~~~~~~~~~ error: equality checks against false can be replaced by a negation --> tests/ui/bool_comparison.rs:152:8 | LL | if m!(func) == false {} - | ^^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `!m!(func)` + | ^^^^^^^^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !m!(func) {} + | ~~~~~~~~~ error: equality checks against true are unnecessary --> tests/ui/bool_comparison.rs:153:8 | LL | if true == m!(func) {} - | ^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `m!(func)` + | ^^^^^^^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if m!(func) {} + | ~~~~~~~~ error: equality checks against true are unnecessary --> tests/ui/bool_comparison.rs:154:8 | LL | if m!(func) == true {} - | ^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `m!(func)` + | ^^^^^^^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if m!(func) {} + | ~~~~~~~~ error: equality checks against false can be replaced by a negation --> tests/ui/bool_comparison.rs:171:14 | LL | let _ = ((1 < 2) == false) as usize; - | ^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `1 >= 2` + | ^^^^^^^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | let _ = (1 >= 2) as usize; + | ~~~~~~ error: equality checks against false can be replaced by a negation --> tests/ui/bool_comparison.rs:172:14 | LL | let _ = (false == m!(func)) as usize; - | ^^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `!m!(func)` + | ^^^^^^^^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | let _ = (!m!(func)) as usize; + | ~~~~~~~~~ error: this comparison might be written more concisely --> tests/ui/bool_comparison.rs:175:14 | LL | let _ = ((1 < 2) == !m!(func)) as usize; - | ^^^^^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `(1 < 2) != m!(func)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | let _ = ((1 < 2) != m!(func)) as usize; + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 25 previous errors diff --git a/src/tools/clippy/tests/ui/bool_to_int_with_if.stderr b/src/tools/clippy/tests/ui/bool_to_int_with_if.stderr index 1e4a843071a1c..1d77987b390cd 100644 --- a/src/tools/clippy/tests/ui/bool_to_int_with_if.stderr +++ b/src/tools/clippy/tests/ui/bool_to_int_with_if.stderr @@ -6,11 +6,15 @@ LL | | 1 LL | | } else { LL | | 0 LL | | }; - | |_____^ help: replace with from: `i32::from(a)` + | |_____^ | = note: `a as i32` or `a.into()` can also be valid options = note: `-D clippy::bool-to-int-with-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::bool_to_int_with_if)]` +help: replace with from + | +LL | i32::from(a); + | ~~~~~~~~~~~~ error: boolean to int conversion using if --> tests/ui/bool_to_int_with_if.rs:19:5 @@ -20,9 +24,13 @@ LL | | 0 LL | | } else { LL | | 1 LL | | }; - | |_____^ help: replace with from: `i32::from(!a)` + | |_____^ | = note: `!a as i32` or `(!a).into()` can also be valid options +help: replace with from + | +LL | i32::from(!a); + | ~~~~~~~~~~~~~ error: boolean to int conversion using if --> tests/ui/bool_to_int_with_if.rs:24:5 @@ -32,9 +40,13 @@ LL | | 1 LL | | } else { LL | | 0 LL | | }; - | |_____^ help: replace with from: `i32::from(!a)` + | |_____^ | = note: `!a as i32` or `(!a).into()` can also be valid options +help: replace with from + | +LL | i32::from(!a); + | ~~~~~~~~~~~~~ error: boolean to int conversion using if --> tests/ui/bool_to_int_with_if.rs:29:5 @@ -44,9 +56,13 @@ LL | | 1 LL | | } else { LL | | 0 LL | | }; - | |_____^ help: replace with from: `i32::from(a || b)` + | |_____^ | = note: `(a || b) as i32` or `(a || b).into()` can also be valid options +help: replace with from + | +LL | i32::from(a || b); + | ~~~~~~~~~~~~~~~~~ error: boolean to int conversion using if --> tests/ui/bool_to_int_with_if.rs:34:5 @@ -56,9 +72,13 @@ LL | | 1 LL | | } else { LL | | 0 LL | | }; - | |_____^ help: replace with from: `i32::from(cond(a, b))` + | |_____^ | = note: `cond(a, b) as i32` or `cond(a, b).into()` can also be valid options +help: replace with from + | +LL | i32::from(cond(a, b)); + | ~~~~~~~~~~~~~~~~~~~~~ error: boolean to int conversion using if --> tests/ui/bool_to_int_with_if.rs:39:5 @@ -68,9 +88,13 @@ LL | | 1 LL | | } else { LL | | 0 LL | | }; - | |_____^ help: replace with from: `i32::from(x + y < 4)` + | |_____^ | = note: `(x + y < 4) as i32` or `(x + y < 4).into()` can also be valid options +help: replace with from + | +LL | i32::from(x + y < 4); + | ~~~~~~~~~~~~~~~~~~~~ error: boolean to int conversion using if --> tests/ui/bool_to_int_with_if.rs:48:12 @@ -81,9 +105,13 @@ LL | | 1 LL | | } else { LL | | 0 LL | | }; - | |_____^ help: replace with from: `{ i32::from(b) }` + | |_____^ | = note: `b as i32` or `b.into()` can also be valid options +help: replace with from + | +LL | } else { i32::from(b) }; + | ~~~~~~~~~~~~~~~~ error: boolean to int conversion using if --> tests/ui/bool_to_int_with_if.rs:57:12 @@ -94,17 +122,25 @@ LL | | 0 LL | | } else { LL | | 1 LL | | }; - | |_____^ help: replace with from: `{ i32::from(!b) }` + | |_____^ | = note: `!b as i32` or `(!b).into()` can also be valid options +help: replace with from + | +LL | } else { i32::from(!b) }; + | ~~~~~~~~~~~~~~~~~ error: boolean to int conversion using if --> tests/ui/bool_to_int_with_if.rs:122:5 | LL | if a { 1 } else { 0 } - | ^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `u8::from(a)` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `a as u8` or `a.into()` can also be valid options +help: replace with from + | +LL | u8::from(a) + | error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/borrow_as_ptr.stderr b/src/tools/clippy/tests/ui/borrow_as_ptr.stderr index ea618b06e2c86..cb026a2ab3e56 100644 --- a/src/tools/clippy/tests/ui/borrow_as_ptr.stderr +++ b/src/tools/clippy/tests/ui/borrow_as_ptr.stderr @@ -2,16 +2,25 @@ error: borrow as raw pointer --> tests/ui/borrow_as_ptr.rs:11:14 | LL | let _p = &val as *const i32; - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of!(val)` + | ^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::borrow-as-ptr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::borrow_as_ptr)]` +help: try + | +LL | let _p = std::ptr::addr_of!(val); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: borrow as raw pointer --> tests/ui/borrow_as_ptr.rs:18:18 | LL | let _p_mut = &mut val_mut as *mut i32; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of_mut!(val_mut)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _p_mut = std::ptr::addr_of_mut!(val_mut); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/borrow_as_ptr_no_std.stderr b/src/tools/clippy/tests/ui/borrow_as_ptr_no_std.stderr index 6802c86ec95a5..e1f2896ba7b5a 100644 --- a/src/tools/clippy/tests/ui/borrow_as_ptr_no_std.stderr +++ b/src/tools/clippy/tests/ui/borrow_as_ptr_no_std.stderr @@ -2,16 +2,25 @@ error: borrow as raw pointer --> tests/ui/borrow_as_ptr_no_std.rs:9:14 | LL | let _p = &val as *const i32; - | ^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::addr_of!(val)` + | ^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::borrow-as-ptr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::borrow_as_ptr)]` +help: try + | +LL | let _p = core::ptr::addr_of!(val); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: borrow as raw pointer --> tests/ui/borrow_as_ptr_no_std.rs:12:18 | LL | let _p_mut = &mut val_mut as *mut i32; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::addr_of_mut!(val_mut)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _p_mut = core::ptr::addr_of_mut!(val_mut); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/borrow_box.stderr b/src/tools/clippy/tests/ui/borrow_box.stderr index 34e8f11dfd743..c155904c85fdf 100644 --- a/src/tools/clippy/tests/ui/borrow_box.stderr +++ b/src/tools/clippy/tests/ui/borrow_box.stderr @@ -2,67 +2,116 @@ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:25:14 | LL | let foo: &Box; - | ^^^^^^^^^^ help: try: `&bool` + | ^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/borrow_box.rs:1:9 | LL | #![deny(clippy::borrowed_box)] | ^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | let foo: &bool; + | ~~~~~ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:30:10 | LL | foo: &'a Box, - | ^^^^^^^^^^^^^ help: try: `&'a bool` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | foo: &'a bool, + | ~~~~~~~~ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:35:17 | LL | fn test4(a: &Box); - | ^^^^^^^^^^ help: try: `&bool` + | ^^^^^^^^^^ + | +help: try + | +LL | fn test4(a: &bool); + | ~~~~~ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:102:25 | LL | pub fn test14(_display: &Box) {} - | ^^^^^^^^^^^^^^^^^ help: try: `&dyn Display` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | pub fn test14(_display: &dyn Display) {} + | ~~~~~~~~~~~~ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:104:25 | LL | pub fn test15(_display: &Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | pub fn test15(_display: &(dyn Display + Send)) {} + | ~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:106:29 | LL | pub fn test16<'a>(_display: &'a Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (dyn Display + 'a)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | pub fn test16<'a>(_display: &'a (dyn Display + 'a)) {} + | ~~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:109:25 | LL | pub fn test17(_display: &Box) {} - | ^^^^^^^^^^^^^^^^^^ help: try: `&impl Display` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | pub fn test17(_display: &impl Display) {} + | ~~~~~~~~~~~~~ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:111:25 | LL | pub fn test18(_display: &Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(impl Display + Send)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | pub fn test18(_display: &(impl Display + Send)) {} + | ~~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:113:29 | LL | pub fn test19<'a>(_display: &'a Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (impl Display + 'a)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | pub fn test19<'a>(_display: &'a (impl Display + 'a)) {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to use `&Box`. Consider using just `&T` --> tests/ui/borrow_box.rs:119:25 | LL | pub fn test20(_display: &Box<(dyn Display + Send)>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | pub fn test20(_display: &(dyn Display + Send)) {} + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/borrow_deref_ref.stderr b/src/tools/clippy/tests/ui/borrow_deref_ref.stderr index 7fa43ef49cf72..1f814863c8302 100644 --- a/src/tools/clippy/tests/ui/borrow_deref_ref.stderr +++ b/src/tools/clippy/tests/ui/borrow_deref_ref.stderr @@ -2,22 +2,36 @@ error: deref on an immutable reference --> tests/ui/borrow_deref_ref.rs:13:17 | LL | let b = &*a; - | ^^^ help: if you would like to reborrow, try removing `&*`: `a` + | ^^^ | = note: `-D clippy::borrow-deref-ref` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::borrow_deref_ref)]` +help: if you would like to reborrow, try removing `&*` + | +LL | let b = a; + | ~ error: deref on an immutable reference --> tests/ui/borrow_deref_ref.rs:15:22 | LL | let b = &mut &*bar(&12); - | ^^^^^^^^^^ help: if you would like to reborrow, try removing `&*`: `bar(&12)` + | ^^^^^^^^^^ + | +help: if you would like to reborrow, try removing `&*` + | +LL | let b = &mut bar(&12); + | ~~~~~~~~ error: deref on an immutable reference --> tests/ui/borrow_deref_ref.rs:69:23 | LL | let addr_y = &&*x as *const _ as usize; // assert ok - | ^^^ help: if you would like to reborrow, try removing `&*`: `x` + | ^^^ + | +help: if you would like to reborrow, try removing `&*` + | +LL | let addr_y = &x as *const _ as usize; // assert ok + | ~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/box_default.stderr b/src/tools/clippy/tests/ui/box_default.stderr index 39fd0d29bbf9a..32da2c9dd41ca 100644 --- a/src/tools/clippy/tests/ui/box_default.stderr +++ b/src/tools/clippy/tests/ui/box_default.stderr @@ -2,64 +2,113 @@ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:34:32 | LL | let string1: Box = Box::new(Default::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::box-default` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::box_default)]` +help: try + | +LL | let string1: Box = Box::default(); + | ~~~~~~~~~~~~~~ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:35:32 | LL | let string2: Box = Box::new(String::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let string2: Box = Box::default(); + | ~~~~~~~~~~~~~~ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:36:41 | LL | let impl1: Box = Box::new(Default::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let impl1: Box = Box::default(); + | ~~~~~~~~~~~~~~ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:37:29 | LL | let vec: Box> = Box::new(Vec::new()); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let vec: Box> = Box::default(); + | ~~~~~~~~~~~~~~ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:38:25 | LL | let byte: Box = Box::new(u8::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let byte: Box = Box::default(); + | ~~~~~~~~~~~~~~ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:39:45 | LL | let vec2: Box> = Box::new(vec![]); - | ^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let vec2: Box> = Box::default(); + | ~~~~~~~~~~~~~~ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:40:32 | LL | let vec3: Box> = Box::new(Vec::from([])); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let vec3: Box> = Box::default(); + | ~~~~~~~~~~~~~~ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:42:25 | LL | let plain_default = Box::new(Default::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let plain_default = Box::default(); + | ~~~~~~~~~~~~~~ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:59:16 | LL | call_ty_fn(Box::new(u8::default())); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | call_ty_fn(Box::default()); + | ~~~~~~~~~~~~~~ error: `Box::new(_)` of default value --> tests/ui/box_default.rs:86:17 | LL | Self::x(Box::new(T::default())); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Self::x(Box::default()); + | ~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/bytecount.stderr b/src/tools/clippy/tests/ui/bytecount.stderr index d1a73fe983584..1d9b1a4092ae8 100644 --- a/src/tools/clippy/tests/ui/bytecount.stderr +++ b/src/tools/clippy/tests/ui/bytecount.stderr @@ -2,25 +2,39 @@ error: you appear to be counting bytes the naive way --> tests/ui/bytecount.rs:10:13 | LL | let _ = x.iter().filter(|&&a| a == 0).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using the bytecount crate: `bytecount::count(x, 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/bytecount.rs:5:8 | LL | #[deny(clippy::naive_bytecount)] | ^^^^^^^^^^^^^^^^^^^^^^^ +help: consider using the bytecount crate + | +LL | let _ = bytecount::count(x, 0); + | ~~~~~~~~~~~~~~~~~~~~~~ error: you appear to be counting bytes the naive way --> tests/ui/bytecount.rs:14:13 | LL | let _ = (&x[..]).iter().filter(|&a| *a == 0).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using the bytecount crate: `bytecount::count((&x[..]), 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using the bytecount crate + | +LL | let _ = bytecount::count((&x[..]), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: you appear to be counting bytes the naive way --> tests/ui/bytecount.rs:32:13 | LL | let _ = x.iter().filter(|a| b + 1 == **a).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using the bytecount crate: `bytecount::count(x, b + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using the bytecount crate + | +LL | let _ = bytecount::count(x, b + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/bytes_count_to_len.stderr b/src/tools/clippy/tests/ui/bytes_count_to_len.stderr index b80f3af18f780..53f6fe247c1d0 100644 --- a/src/tools/clippy/tests/ui/bytes_count_to_len.stderr +++ b/src/tools/clippy/tests/ui/bytes_count_to_len.stderr @@ -2,28 +2,47 @@ error: using long and hard to read `.bytes().count()` --> tests/ui/bytes_count_to_len.rs:7:13 | LL | let _ = String::from("foo").bytes().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.len()` instead: `String::from("foo").len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::bytes-count-to-len` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::bytes_count_to_len)]` +help: consider calling `.len()` instead + | +LL | let _ = String::from("foo").len(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: using long and hard to read `.bytes().count()` --> tests/ui/bytes_count_to_len.rs:10:13 | LL | let _ = s1.bytes().count(); - | ^^^^^^^^^^^^^^^^^^ help: consider calling `.len()` instead: `s1.len()` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.len()` instead + | +LL | let _ = s1.len(); + | ~~~~~~~~ error: using long and hard to read `.bytes().count()` --> tests/ui/bytes_count_to_len.rs:13:13 | LL | let _ = "foo".bytes().count(); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.len()` instead: `"foo".len()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.len()` instead + | +LL | let _ = "foo".len(); + | ~~~~~~~~~~~ error: using long and hard to read `.bytes().count()` --> tests/ui/bytes_count_to_len.rs:16:13 | LL | let _ = s2.bytes().count(); - | ^^^^^^^^^^^^^^^^^^ help: consider calling `.len()` instead: `s2.len()` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.len()` instead + | +LL | let _ = s2.len(); + | ~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/bytes_nth.stderr b/src/tools/clippy/tests/ui/bytes_nth.stderr index c6f21576c3dbf..88dba414786f3 100644 --- a/src/tools/clippy/tests/ui/bytes_nth.stderr +++ b/src/tools/clippy/tests/ui/bytes_nth.stderr @@ -2,22 +2,36 @@ error: called `.bytes().nth()` on a `String` --> tests/ui/bytes_nth.rs:6:13 | LL | let _ = s.bytes().nth(3); - | ^^^^^^^^^^^^^^^^ help: try: `s.as_bytes().get(3).copied()` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::bytes-nth` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::bytes_nth)]` +help: try + | +LL | let _ = s.as_bytes().get(3).copied(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `.bytes().nth().unwrap()` on a `String` --> tests/ui/bytes_nth.rs:7:14 | LL | let _ = &s.bytes().nth(3).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.as_bytes()[3]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &s.as_bytes()[3]; + | ~~~~~~~~~~~~~~~ error: called `.bytes().nth()` on a `str` --> tests/ui/bytes_nth.rs:8:13 | LL | let _ = s[..].bytes().nth(3); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `s[..].as_bytes().get(3).copied()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s[..].as_bytes().get(3).copied(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/cast_abs_to_unsigned.stderr b/src/tools/clippy/tests/ui/cast_abs_to_unsigned.stderr index 96e5c1724a51b..2e4eafa31c407 100644 --- a/src/tools/clippy/tests/ui/cast_abs_to_unsigned.stderr +++ b/src/tools/clippy/tests/ui/cast_abs_to_unsigned.stderr @@ -2,112 +2,201 @@ error: casting the result of `i32::abs()` to u32 --> tests/ui/cast_abs_to_unsigned.rs:6:18 | LL | let y: u32 = x.abs() as u32; - | ^^^^^^^^^^^^^^ help: replace with: `x.unsigned_abs()` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::cast-abs-to-unsigned` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cast_abs_to_unsigned)]` +help: replace with + | +LL | let y: u32 = x.unsigned_abs(); + | ~~~~~~~~~~~~~~~~ error: casting the result of `i32::abs()` to usize --> tests/ui/cast_abs_to_unsigned.rs:10:20 | LL | let _: usize = a.abs() as usize; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _: usize = a.unsigned_abs() as usize; + | ~~~~~~~~~~~~~~~~ error: casting the result of `i32::abs()` to usize --> tests/ui/cast_abs_to_unsigned.rs:11:20 | LL | let _: usize = a.abs() as _; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _: usize = a.unsigned_abs() as _; + | ~~~~~~~~~~~~~~~~ error: casting the result of `i32::abs()` to usize --> tests/ui/cast_abs_to_unsigned.rs:12:13 | LL | let _ = a.abs() as usize; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as usize; + | ~~~~~~~~~~~~~~~~ error: casting the result of `i64::abs()` to usize --> tests/ui/cast_abs_to_unsigned.rs:15:13 | LL | let _ = a.abs() as usize; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as usize; + | ~~~~~~~~~~~~~~~~ error: casting the result of `i64::abs()` to u8 --> tests/ui/cast_abs_to_unsigned.rs:16:13 | LL | let _ = a.abs() as u8; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as u8; + | ~~~~~~~~~~~~~~~~ error: casting the result of `i64::abs()` to u16 --> tests/ui/cast_abs_to_unsigned.rs:17:13 | LL | let _ = a.abs() as u16; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as u16; + | ~~~~~~~~~~~~~~~~ error: casting the result of `i64::abs()` to u32 --> tests/ui/cast_abs_to_unsigned.rs:18:13 | LL | let _ = a.abs() as u32; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as u32; + | ~~~~~~~~~~~~~~~~ error: casting the result of `i64::abs()` to u64 --> tests/ui/cast_abs_to_unsigned.rs:19:13 | LL | let _ = a.abs() as u64; - | ^^^^^^^^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs(); + | ~~~~~~~~~~~~~~~~ error: casting the result of `i64::abs()` to u128 --> tests/ui/cast_abs_to_unsigned.rs:20:13 | LL | let _ = a.abs() as u128; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as u128; + | ~~~~~~~~~~~~~~~~ error: casting the result of `isize::abs()` to usize --> tests/ui/cast_abs_to_unsigned.rs:23:13 | LL | let _ = a.abs() as usize; - | ^^^^^^^^^^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs(); + | ~~~~~~~~~~~~~~~~ error: casting the result of `isize::abs()` to u8 --> tests/ui/cast_abs_to_unsigned.rs:24:13 | LL | let _ = a.abs() as u8; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as u8; + | ~~~~~~~~~~~~~~~~ error: casting the result of `isize::abs()` to u16 --> tests/ui/cast_abs_to_unsigned.rs:25:13 | LL | let _ = a.abs() as u16; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as u16; + | ~~~~~~~~~~~~~~~~ error: casting the result of `isize::abs()` to u32 --> tests/ui/cast_abs_to_unsigned.rs:26:13 | LL | let _ = a.abs() as u32; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as u32; + | ~~~~~~~~~~~~~~~~ error: casting the result of `isize::abs()` to u64 --> tests/ui/cast_abs_to_unsigned.rs:27:13 | LL | let _ = a.abs() as u64; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as u64; + | ~~~~~~~~~~~~~~~~ error: casting the result of `isize::abs()` to u128 --> tests/ui/cast_abs_to_unsigned.rs:28:13 | LL | let _ = a.abs() as u128; - | ^^^^^^^ help: replace with: `a.unsigned_abs()` + | ^^^^^^^ + | +help: replace with + | +LL | let _ = a.unsigned_abs() as u128; + | ~~~~~~~~~~~~~~~~ error: casting the result of `i64::abs()` to u32 --> tests/ui/cast_abs_to_unsigned.rs:30:13 | LL | let _ = (x as i64 - y as i64).abs() as u32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `(x as i64 - y as i64).unsigned_abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = (x as i64 - y as i64).unsigned_abs() as u32; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting the result of `i32::abs()` to u32 --> tests/ui/cast_abs_to_unsigned.rs:42:23 | LL | assert_eq!(10u32, x.abs() as u32); - | ^^^^^^^^^^^^^^ help: replace with: `x.unsigned_abs()` + | ^^^^^^^^^^^^^^ + | +help: replace with + | +LL | assert_eq!(10u32, x.unsigned_abs()); + | ~~~~~~~~~~~~~~~~ error: aborting due to 18 previous errors diff --git a/src/tools/clippy/tests/ui/cast_lossless_bool.stderr b/src/tools/clippy/tests/ui/cast_lossless_bool.stderr index b47b35461f686..3287b13439f97 100644 --- a/src/tools/clippy/tests/ui/cast_lossless_bool.stderr +++ b/src/tools/clippy/tests/ui/cast_lossless_bool.stderr @@ -2,94 +2,168 @@ error: casting `bool` to `u8` is more cleanly stated with `u8::from(_)` --> tests/ui/cast_lossless_bool.rs:8:13 | LL | let _ = true as u8; - | ^^^^^^^^^^ help: try: `u8::from(true)` + | ^^^^^^^^^^ | = note: `-D clippy::cast-lossless` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]` +help: try + | +LL | let _ = u8::from(true); + | ~~~~~~~~~~~~~~ error: casting `bool` to `u16` is more cleanly stated with `u16::from(_)` --> tests/ui/cast_lossless_bool.rs:9:13 | LL | let _ = true as u16; - | ^^^^^^^^^^^ help: try: `u16::from(true)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = u16::from(true); + | ~~~~~~~~~~~~~~~ error: casting `bool` to `u32` is more cleanly stated with `u32::from(_)` --> tests/ui/cast_lossless_bool.rs:10:13 | LL | let _ = true as u32; - | ^^^^^^^^^^^ help: try: `u32::from(true)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = u32::from(true); + | ~~~~~~~~~~~~~~~ error: casting `bool` to `u64` is more cleanly stated with `u64::from(_)` --> tests/ui/cast_lossless_bool.rs:11:13 | LL | let _ = true as u64; - | ^^^^^^^^^^^ help: try: `u64::from(true)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = u64::from(true); + | ~~~~~~~~~~~~~~~ error: casting `bool` to `u128` is more cleanly stated with `u128::from(_)` --> tests/ui/cast_lossless_bool.rs:12:13 | LL | let _ = true as u128; - | ^^^^^^^^^^^^ help: try: `u128::from(true)` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u128::from(true); + | ~~~~~~~~~~~~~~~~ error: casting `bool` to `usize` is more cleanly stated with `usize::from(_)` --> tests/ui/cast_lossless_bool.rs:13:13 | LL | let _ = true as usize; - | ^^^^^^^^^^^^^ help: try: `usize::from(true)` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = usize::from(true); + | ~~~~~~~~~~~~~~~~~ error: casting `bool` to `i8` is more cleanly stated with `i8::from(_)` --> tests/ui/cast_lossless_bool.rs:15:13 | LL | let _ = true as i8; - | ^^^^^^^^^^ help: try: `i8::from(true)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = i8::from(true); + | ~~~~~~~~~~~~~~ error: casting `bool` to `i16` is more cleanly stated with `i16::from(_)` --> tests/ui/cast_lossless_bool.rs:16:13 | LL | let _ = true as i16; - | ^^^^^^^^^^^ help: try: `i16::from(true)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = i16::from(true); + | ~~~~~~~~~~~~~~~ error: casting `bool` to `i32` is more cleanly stated with `i32::from(_)` --> tests/ui/cast_lossless_bool.rs:17:13 | LL | let _ = true as i32; - | ^^^^^^^^^^^ help: try: `i32::from(true)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::from(true); + | ~~~~~~~~~~~~~~~ error: casting `bool` to `i64` is more cleanly stated with `i64::from(_)` --> tests/ui/cast_lossless_bool.rs:18:13 | LL | let _ = true as i64; - | ^^^^^^^^^^^ help: try: `i64::from(true)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = i64::from(true); + | ~~~~~~~~~~~~~~~ error: casting `bool` to `i128` is more cleanly stated with `i128::from(_)` --> tests/ui/cast_lossless_bool.rs:19:13 | LL | let _ = true as i128; - | ^^^^^^^^^^^^ help: try: `i128::from(true)` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i128::from(true); + | ~~~~~~~~~~~~~~~~ error: casting `bool` to `isize` is more cleanly stated with `isize::from(_)` --> tests/ui/cast_lossless_bool.rs:20:13 | LL | let _ = true as isize; - | ^^^^^^^^^^^^^ help: try: `isize::from(true)` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = isize::from(true); + | ~~~~~~~~~~~~~~~~~ error: casting `bool` to `u16` is more cleanly stated with `u16::from(_)` --> tests/ui/cast_lossless_bool.rs:23:13 | LL | let _ = (true | false) as u16; - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::from(true | false)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u16::from(true | false); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: casting `bool` to `U8` is more cleanly stated with `U8::from(_)` --> tests/ui/cast_lossless_bool.rs:25:13 | LL | let _ = true as U8; - | ^^^^^^^^^^ help: try: `U8::from(true)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = U8::from(true); + | ~~~~~~~~~~~~~~ error: casting `bool` to `u8` is more cleanly stated with `u8::from(_)` --> tests/ui/cast_lossless_bool.rs:53:13 | LL | let _ = true as u8; - | ^^^^^^^^^^ help: try: `u8::from(true)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = u8::from(true); + | ~~~~~~~~~~~~~~ error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/cast_lossless_float.stderr b/src/tools/clippy/tests/ui/cast_lossless_float.stderr index f2ba4e3b99038..4a30a73039278 100644 --- a/src/tools/clippy/tests/ui/cast_lossless_float.stderr +++ b/src/tools/clippy/tests/ui/cast_lossless_float.stderr @@ -2,82 +2,146 @@ error: casting `i8` to `f32` may become silently lossy if you later change the t --> tests/ui/cast_lossless_float.rs:12:13 | LL | let _ = x0 as f32; - | ^^^^^^^^^ help: try: `f32::from(x0)` + | ^^^^^^^^^ | = note: `-D clippy::cast-lossless` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]` +help: try + | +LL | let _ = f32::from(x0); + | ~~~~~~~~~~~~~ error: casting `i8` to `f64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:13:13 | LL | let _ = x0 as f64; - | ^^^^^^^^^ help: try: `f64::from(x0)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = f64::from(x0); + | ~~~~~~~~~~~~~ error: casting `i8` to `F32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:14:13 | LL | let _ = x0 as F32; - | ^^^^^^^^^ help: try: `F32::from(x0)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = F32::from(x0); + | ~~~~~~~~~~~~~ error: casting `i8` to `F64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:15:13 | LL | let _ = x0 as F64; - | ^^^^^^^^^ help: try: `F64::from(x0)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = F64::from(x0); + | ~~~~~~~~~~~~~ error: casting `u8` to `f32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:17:13 | LL | let _ = x1 as f32; - | ^^^^^^^^^ help: try: `f32::from(x1)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = f32::from(x1); + | ~~~~~~~~~~~~~ error: casting `u8` to `f64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:18:13 | LL | let _ = x1 as f64; - | ^^^^^^^^^ help: try: `f64::from(x1)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = f64::from(x1); + | ~~~~~~~~~~~~~ error: casting `i16` to `f32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:20:13 | LL | let _ = x2 as f32; - | ^^^^^^^^^ help: try: `f32::from(x2)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = f32::from(x2); + | ~~~~~~~~~~~~~ error: casting `i16` to `f64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:21:13 | LL | let _ = x2 as f64; - | ^^^^^^^^^ help: try: `f64::from(x2)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = f64::from(x2); + | ~~~~~~~~~~~~~ error: casting `u16` to `f32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:23:13 | LL | let _ = x3 as f32; - | ^^^^^^^^^ help: try: `f32::from(x3)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = f32::from(x3); + | ~~~~~~~~~~~~~ error: casting `u16` to `f64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:24:13 | LL | let _ = x3 as f64; - | ^^^^^^^^^ help: try: `f64::from(x3)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = f64::from(x3); + | ~~~~~~~~~~~~~ error: casting `i32` to `f64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:26:13 | LL | let _ = x4 as f64; - | ^^^^^^^^^ help: try: `f64::from(x4)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = f64::from(x4); + | ~~~~~~~~~~~~~ error: casting `u32` to `f64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:28:13 | LL | let _ = x5 as f64; - | ^^^^^^^^^ help: try: `f64::from(x5)` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = f64::from(x5); + | ~~~~~~~~~~~~~ error: casting `f32` to `f64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_float.rs:31:13 | LL | let _ = 1.0f32 as f64; - | ^^^^^^^^^^^^^ help: try: `f64::from(1.0f32)` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = f64::from(1.0f32); + | ~~~~~~~~~~~~~~~~~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/cast_lossless_integer.stderr b/src/tools/clippy/tests/ui/cast_lossless_integer.stderr index aaece9392856f..671566406370a 100644 --- a/src/tools/clippy/tests/ui/cast_lossless_integer.stderr +++ b/src/tools/clippy/tests/ui/cast_lossless_integer.stderr @@ -2,136 +2,245 @@ error: casting `i8` to `i16` may become silently lossy if you later change the t --> tests/ui/cast_lossless_integer.rs:9:13 | LL | let _ = 1i8 as i16; - | ^^^^^^^^^^ help: try: `i16::from(1i8)` + | ^^^^^^^^^^ | = note: `-D clippy::cast-lossless` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]` +help: try + | +LL | let _ = i16::from(1i8); + | ~~~~~~~~~~~~~~ error: casting `i8` to `i32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:10:13 | LL | let _ = 1i8 as i32; - | ^^^^^^^^^^ help: try: `i32::from(1i8)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::from(1i8); + | ~~~~~~~~~~~~~~ error: casting `i8` to `i64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:11:13 | LL | let _ = 1i8 as i64; - | ^^^^^^^^^^ help: try: `i64::from(1i8)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = i64::from(1i8); + | ~~~~~~~~~~~~~~ error: casting `u8` to `i16` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:12:13 | LL | let _ = 1u8 as i16; - | ^^^^^^^^^^ help: try: `i16::from(1u8)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = i16::from(1u8); + | ~~~~~~~~~~~~~~ error: casting `u8` to `i32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:13:13 | LL | let _ = 1u8 as i32; - | ^^^^^^^^^^ help: try: `i32::from(1u8)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::from(1u8); + | ~~~~~~~~~~~~~~ error: casting `u8` to `i64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:14:13 | LL | let _ = 1u8 as i64; - | ^^^^^^^^^^ help: try: `i64::from(1u8)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = i64::from(1u8); + | ~~~~~~~~~~~~~~ error: casting `u8` to `u16` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:15:13 | LL | let _ = 1u8 as u16; - | ^^^^^^^^^^ help: try: `u16::from(1u8)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = u16::from(1u8); + | ~~~~~~~~~~~~~~ error: casting `u8` to `u32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:16:13 | LL | let _ = 1u8 as u32; - | ^^^^^^^^^^ help: try: `u32::from(1u8)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = u32::from(1u8); + | ~~~~~~~~~~~~~~ error: casting `u8` to `u64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:17:13 | LL | let _ = 1u8 as u64; - | ^^^^^^^^^^ help: try: `u64::from(1u8)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = u64::from(1u8); + | ~~~~~~~~~~~~~~ error: casting `i16` to `i32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:18:13 | LL | let _ = 1i16 as i32; - | ^^^^^^^^^^^ help: try: `i32::from(1i16)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::from(1i16); + | ~~~~~~~~~~~~~~~ error: casting `i16` to `i64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:19:13 | LL | let _ = 1i16 as i64; - | ^^^^^^^^^^^ help: try: `i64::from(1i16)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = i64::from(1i16); + | ~~~~~~~~~~~~~~~ error: casting `u16` to `i32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:20:13 | LL | let _ = 1u16 as i32; - | ^^^^^^^^^^^ help: try: `i32::from(1u16)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::from(1u16); + | ~~~~~~~~~~~~~~~ error: casting `u16` to `i64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:21:13 | LL | let _ = 1u16 as i64; - | ^^^^^^^^^^^ help: try: `i64::from(1u16)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = i64::from(1u16); + | ~~~~~~~~~~~~~~~ error: casting `u16` to `u32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:22:13 | LL | let _ = 1u16 as u32; - | ^^^^^^^^^^^ help: try: `u32::from(1u16)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = u32::from(1u16); + | ~~~~~~~~~~~~~~~ error: casting `u16` to `u64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:23:13 | LL | let _ = 1u16 as u64; - | ^^^^^^^^^^^ help: try: `u64::from(1u16)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = u64::from(1u16); + | ~~~~~~~~~~~~~~~ error: casting `i32` to `i64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:24:13 | LL | let _ = 1i32 as i64; - | ^^^^^^^^^^^ help: try: `i64::from(1i32)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = i64::from(1i32); + | ~~~~~~~~~~~~~~~ error: casting `u32` to `i64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:25:13 | LL | let _ = 1u32 as i64; - | ^^^^^^^^^^^ help: try: `i64::from(1u32)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = i64::from(1u32); + | ~~~~~~~~~~~~~~~ error: casting `u32` to `u64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:26:13 | LL | let _ = 1u32 as u64; - | ^^^^^^^^^^^ help: try: `u64::from(1u32)` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = u64::from(1u32); + | ~~~~~~~~~~~~~~~ error: casting `u8` to `u16` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:29:13 | LL | let _ = (1u8 + 1u8) as u16; - | ^^^^^^^^^^^^^^^^^^ help: try: `u16::from(1u8 + 1u8)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u16::from(1u8 + 1u8); + | ~~~~~~~~~~~~~~~~~~~~ error: casting `i8` to `I64` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:31:13 | LL | let _ = 1i8 as I64; - | ^^^^^^^^^^ help: try: `I64::from(1i8)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = I64::from(1i8); + | ~~~~~~~~~~~~~~ error: casting `i8` to `i32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:70:13 | LL | let _ = sign_cast!(x, u8, i8) as i32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::from(sign_cast!(x, u8, i8))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::from(sign_cast!(x, u8, i8)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting `i8` to `i32` may become silently lossy if you later change the type --> tests/ui/cast_lossless_integer.rs:71:13 | LL | let _ = (sign_cast!(x, u8, i8) + 1) as i32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::from(sign_cast!(x, u8, i8) + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::from(sign_cast!(x, u8, i8) + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 22 previous errors diff --git a/src/tools/clippy/tests/ui/cast_raw_slice_pointer_cast.stderr b/src/tools/clippy/tests/ui/cast_raw_slice_pointer_cast.stderr index 2aedd320a4289..0b03ac67076f1 100644 --- a/src/tools/clippy/tests/ui/cast_raw_slice_pointer_cast.stderr +++ b/src/tools/clippy/tests/ui/cast_raw_slice_pointer_cast.stderr @@ -2,46 +2,80 @@ error: casting the result of `from_raw_parts` to *const [u8] --> tests/ui/cast_raw_slice_pointer_cast.rs:8:35 | LL | let _: *const [u8] = unsafe { std::slice::from_raw_parts(ptr, 1) as *const [u8] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts(ptr, 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::cast-slice-from-raw-parts` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cast_slice_from_raw_parts)]` +help: replace with + | +LL | let _: *const [u8] = unsafe { core::ptr::slice_from_raw_parts(ptr, 1) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting the result of `from_raw_parts_mut` to *mut [u8] --> tests/ui/cast_raw_slice_pointer_cast.rs:9:35 | LL | let _: *const [u8] = unsafe { std::slice::from_raw_parts_mut(mptr, 1) as *mut [u8] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts_mut(mptr, 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _: *const [u8] = unsafe { core::ptr::slice_from_raw_parts_mut(mptr, 1) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting the result of `from_raw_parts` to *const [u8] --> tests/ui/cast_raw_slice_pointer_cast.rs:10:26 | LL | let _: *const [u8] = unsafe { std::slice::from_raw_parts(ptr, 1) } as *const [u8]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts(ptr, 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _: *const [u8] = core::ptr::slice_from_raw_parts(ptr, 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting the result of `from_raw_parts` to *const [u8] --> tests/ui/cast_raw_slice_pointer_cast.rs:13:30 | LL | let _: *const [u8] = unsafe { slice::from_raw_parts(ptr, 1) } as *const [u8]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts(ptr, 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _: *const [u8] = core::ptr::slice_from_raw_parts(ptr, 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting the result of `from_raw_parts` to *const [u8] --> tests/ui/cast_raw_slice_pointer_cast.rs:15:30 | LL | let _: *const [u8] = unsafe { one::from_raw_parts(ptr, 1) } as *const [u8]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts(ptr, 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _: *const [u8] = core::ptr::slice_from_raw_parts(ptr, 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting the result of `from_raw_parts` to *const [u8] --> tests/ui/cast_raw_slice_pointer_cast.rs:19:30 | LL | let _: *const [u8] = unsafe { slice::from_raw_parts(ptr, 1) } as *const [u8]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts(ptr, 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _: *const [u8] = core::ptr::slice_from_raw_parts(ptr, 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting the result of `from_raw_parts` to *const [u8] --> tests/ui/cast_raw_slice_pointer_cast.rs:21:30 | LL | let _: *const [u8] = unsafe { one::from_raw_parts(ptr, 1) } as *const [u8]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts(ptr, 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _: *const [u8] = core::ptr::slice_from_raw_parts(ptr, 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/cast_slice_different_sizes.stderr b/src/tools/clippy/tests/ui/cast_slice_different_sizes.stderr index 625de4a8359ba..a514987a9e254 100644 --- a/src/tools/clippy/tests/ui/cast_slice_different_sizes.stderr +++ b/src/tools/clippy/tests/ui/cast_slice_different_sizes.stderr @@ -2,27 +2,46 @@ error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (elem --> tests/ui/cast_slice_different_sizes.rs:10:13 | LL | let b = a as *const [u8]; - | ^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(a as *const u8, ..)` + | ^^^^^^^^^^^^^^^^ | = note: `#[deny(clippy::cast_slice_different_sizes)]` on by default +help: replace with `ptr::slice_from_raw_parts` + | +LL | let b = core::ptr::slice_from_raw_parts(a as *const u8, ..); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[u8]` (element size 1) and `[u32]` (element size 4) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:13:13 | LL | let c = b as *const [u32]; - | ^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(b as *const u32, ..)` + | ^^^^^^^^^^^^^^^^^ + | +help: replace with `ptr::slice_from_raw_parts` + | +LL | let c = core::ptr::slice_from_raw_parts(b as *const u32, ..); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:17:16 | LL | let loss = r_x as *const [i32] as *const [u8]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const u8, ..)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with `ptr::slice_from_raw_parts` + | +LL | let loss = core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const u8, ..); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:25:24 | LL | let loss_block_1 = { r_x as *const [i32] } as *const [u8]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts({ r_x as *const [i32] } as *const u8, ..)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with `ptr::slice_from_raw_parts` + | +LL | let loss_block_1 = core::ptr::slice_from_raw_parts({ r_x as *const [i32] } as *const u8, ..); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:27:24 @@ -48,7 +67,12 @@ error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (elem --> tests/ui/cast_slice_different_sizes.rs:45:27 | LL | let long_chain_loss = r_x as *const [i32] as *const [u32] as *const [u16] as *const [i8] as *const [u8]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const u8, ..)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with `ptr::slice_from_raw_parts` + | +LL | let long_chain_loss = core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const u8, ..); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:61:36 @@ -58,7 +82,12 @@ LL | fn bar(x: *mut [u16]) -> *mut [u8] { LL | | LL | | x as *mut [u8] LL | | } - | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)` + | |_^ + | +help: replace with `ptr::slice_from_raw_parts_mut` + | +LL | fn bar(x: *mut [u16]) -> *mut [u8] core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:66:36 @@ -68,7 +97,12 @@ LL | fn uwu(x: *mut [u16]) -> *mut [u8] { LL | | LL | | x as *mut _ LL | | } - | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)` + | |_^ + | +help: replace with `ptr::slice_from_raw_parts_mut` + | +LL | fn uwu(x: *mut [u16]) -> *mut [u8] core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:71:37 @@ -78,7 +112,12 @@ LL | fn bar2(x: *mut [u16]) -> *mut [u8] { LL | | LL | | x as _ LL | | } - | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)` + | |_^ + | +help: replace with `ptr::slice_from_raw_parts_mut` + | +LL | fn bar2(x: *mut [u16]) -> *mut [u8] core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:77:39 @@ -88,7 +127,12 @@ LL | fn bar3(x: *mut [u16]) -> *const [u8] { LL | | LL | | x as _ LL | | } - | |_^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(x as *const u8, ..)` + | |_^ + | +help: replace with `ptr::slice_from_raw_parts` + | +LL | fn bar3(x: *mut [u16]) -> *const [u8] core::ptr::slice_from_raw_parts(x as *const u8, ..) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:83:39 @@ -98,7 +142,12 @@ LL | fn bar4(x: *const [u16]) -> *mut [u8] { LL | | LL | | x as _ LL | | } - | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)` + | |_^ + | +help: replace with `ptr::slice_from_raw_parts_mut` + | +LL | fn bar4(x: *const [u16]) -> *mut [u8] core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:89:39 @@ -108,7 +157,12 @@ LL | fn blocks(x: *mut [u16]) -> *mut [u8] { LL | | LL | | ({ x }) as _ LL | | } - | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..)` + | |_^ + | +help: replace with `ptr::slice_from_raw_parts_mut` + | +LL | fn blocks(x: *mut [u16]) -> *mut [u8] core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:94:44 @@ -119,13 +173,23 @@ LL | | LL | | { ({ x }) as _ } LL | | LL | | } - | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..)` + | |_^ + | +help: replace with `ptr::slice_from_raw_parts_mut` + | +LL | fn more_blocks(x: *mut [u16]) -> *mut [u8] core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count --> tests/ui/cast_slice_different_sizes.rs:96:5 | LL | { ({ x }) as _ } - | ^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..)` + | ^^^^^^^^^^^^^^^^ + | +help: replace with `ptr::slice_from_raw_parts_mut` + | +LL | core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..) + | error: aborting due to 14 previous errors diff --git a/src/tools/clippy/tests/ui/cfg_attr_cargo_clippy.stderr b/src/tools/clippy/tests/ui/cfg_attr_cargo_clippy.stderr index 0a358f1a68475..9c52b7c7f92e1 100644 --- a/src/tools/clippy/tests/ui/cfg_attr_cargo_clippy.stderr +++ b/src/tools/clippy/tests/ui/cfg_attr_cargo_clippy.stderr @@ -2,46 +2,80 @@ error: `feature = "cargo-clippy"` was replaced by `clippy` --> tests/ui/cfg_attr_cargo_clippy.rs:3:13 | LL | #![cfg_attr(feature = "cargo-clippy", doc = "a")] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::deprecated-clippy-cfg-attr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::deprecated_clippy_cfg_attr)]` +help: replace with + | +LL | #![cfg_attr(clippy, doc = "a")] + | ~~~~~~ error: `feature = "cargo-clippy"` was replaced by `clippy` --> tests/ui/cfg_attr_cargo_clippy.rs:5:12 | LL | #[cfg_attr(feature = "cargo-clippy", derive(Debug))] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | #[cfg_attr(clippy, derive(Debug))] + | ~~~~~~ error: `feature = "cargo-clippy"` was replaced by `clippy` --> tests/ui/cfg_attr_cargo_clippy.rs:6:16 | LL | #[cfg_attr(not(feature = "cargo-clippy"), derive(Debug))] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | #[cfg_attr(not(clippy), derive(Debug))] + | ~~~~~~ error: `feature = "cargo-clippy"` was replaced by `clippy` --> tests/ui/cfg_attr_cargo_clippy.rs:7:7 | LL | #[cfg(feature = "cargo-clippy")] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | #[cfg(clippy)] + | ~~~~~~ error: `feature = "cargo-clippy"` was replaced by `clippy` --> tests/ui/cfg_attr_cargo_clippy.rs:8:11 | LL | #[cfg(not(feature = "cargo-clippy"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | #[cfg(not(clippy))] + | ~~~~~~ error: `feature = "cargo-clippy"` was replaced by `clippy` --> tests/ui/cfg_attr_cargo_clippy.rs:9:11 | LL | #[cfg(any(feature = "cargo-clippy"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | #[cfg(any(clippy))] + | ~~~~~~ error: `feature = "cargo-clippy"` was replaced by `clippy` --> tests/ui/cfg_attr_cargo_clippy.rs:10:11 | LL | #[cfg(all(feature = "cargo-clippy"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | #[cfg(all(clippy))] + | ~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/cfg_attr_rustfmt.stderr b/src/tools/clippy/tests/ui/cfg_attr_rustfmt.stderr index 24b6ed1b0458d..e60f8dec3ba51 100644 --- a/src/tools/clippy/tests/ui/cfg_attr_rustfmt.stderr +++ b/src/tools/clippy/tests/ui/cfg_attr_rustfmt.stderr @@ -2,22 +2,36 @@ error: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes --> tests/ui/cfg_attr_rustfmt.rs:18:5 | LL | #[cfg_attr(rustfmt, rustfmt::skip)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::deprecated-cfg-attr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::deprecated_cfg_attr)]` +help: use + | +LL | #[rustfmt::skip] + | error: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes --> tests/ui/cfg_attr_rustfmt.rs:22:1 | LL | #[cfg_attr(rustfmt, rustfmt_skip)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | #[rustfmt::skip] + | error: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes --> tests/ui/cfg_attr_rustfmt.rs:41:5 | LL | #[cfg_attr(rustfmt, rustfmt::skip)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | #[rustfmt::skip] + | error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/char_lit_as_u8_suggestions.stderr b/src/tools/clippy/tests/ui/char_lit_as_u8_suggestions.stderr index 4826aca42e1c3..75db18b79d33b 100644 --- a/src/tools/clippy/tests/ui/char_lit_as_u8_suggestions.stderr +++ b/src/tools/clippy/tests/ui/char_lit_as_u8_suggestions.stderr @@ -2,35 +2,51 @@ error: casting a character literal to `u8` truncates --> tests/ui/char_lit_as_u8_suggestions.rs:4:13 | LL | let _ = 'a' as u8; - | ^^^^^^^^^ help: use a byte literal instead: `b'a'` + | ^^^^^^^^^ | = note: `char` is four bytes wide, but `u8` is a single byte = note: `-D clippy::char-lit-as-u8` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::char_lit_as_u8)]` +help: use a byte literal instead + | +LL | let _ = b'a'; + | ~~~~ error: casting a character literal to `u8` truncates --> tests/ui/char_lit_as_u8_suggestions.rs:5:13 | LL | let _ = '\n' as u8; - | ^^^^^^^^^^ help: use a byte literal instead: `b'\n'` + | ^^^^^^^^^^ | = note: `char` is four bytes wide, but `u8` is a single byte +help: use a byte literal instead + | +LL | let _ = b'\n'; + | ~~~~~ error: casting a character literal to `u8` truncates --> tests/ui/char_lit_as_u8_suggestions.rs:6:13 | LL | let _ = '\0' as u8; - | ^^^^^^^^^^ help: use a byte literal instead: `b'\0'` + | ^^^^^^^^^^ | = note: `char` is four bytes wide, but `u8` is a single byte +help: use a byte literal instead + | +LL | let _ = b'\0'; + | ~~~~~ error: casting a character literal to `u8` truncates --> tests/ui/char_lit_as_u8_suggestions.rs:7:13 | LL | let _ = '\x01' as u8; - | ^^^^^^^^^^^^ help: use a byte literal instead: `b'\x01'` + | ^^^^^^^^^^^^ | = note: `char` is four bytes wide, but `u8` is a single byte +help: use a byte literal instead + | +LL | let _ = b'\x01'; + | ~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/checked_conversions.stderr b/src/tools/clippy/tests/ui/checked_conversions.stderr index 453cd7fcf0169..0fce77d23dad0 100644 --- a/src/tools/clippy/tests/ui/checked_conversions.stderr +++ b/src/tools/clippy/tests/ui/checked_conversions.stderr @@ -2,106 +2,190 @@ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:15:13 | LL | let _ = value <= (u32::max_value() as i64) && value >= 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u32::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::checked-conversions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::checked_conversions)]` +help: try + | +LL | let _ = u32::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:16:13 | LL | let _ = value <= (u32::MAX as i64) && value >= 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u32::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u32::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:20:13 | LL | let _ = value <= i64::from(u16::max_value()) && value >= 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u16::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:21:13 | LL | let _ = value <= i64::from(u16::MAX) && value >= 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u16::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:25:13 | LL | let _ = value <= (u8::max_value() as isize) && value >= 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u8::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u8::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:26:13 | LL | let _ = value <= (u8::MAX as isize) && value >= 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u8::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u8::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:32:13 | LL | let _ = value <= (i32::max_value() as i64) && value >= (i32::min_value() as i64); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:33:13 | LL | let _ = value <= (i32::MAX as i64) && value >= (i32::MIN as i64); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:37:13 | LL | let _ = value <= i64::from(i16::max_value()) && value >= i64::from(i16::min_value()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i16::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i16::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:38:13 | LL | let _ = value <= i64::from(i16::MAX) && value >= i64::from(i16::MIN); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i16::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i16::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:44:13 | LL | let _ = value <= i32::max_value() as u32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:45:13 | LL | let _ = value <= i32::MAX as u32; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i32::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:49:13 | LL | let _ = value <= isize::max_value() as usize && value as i32 == 5; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `isize::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = isize::try_from(value).is_ok() && value as i32 == 5; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:50:13 | LL | let _ = value <= isize::MAX as usize && value as i32 == 5; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `isize::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = isize::try_from(value).is_ok() && value as i32 == 5; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:54:13 | LL | let _ = value <= u16::max_value() as u32 && value as i32 == 5; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u16::try_from(value).is_ok() && value as i32 == 5; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:55:13 | LL | let _ = value <= u16::MAX as u32 && value as i32 == 5; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u16::try_from(value).is_ok() && value as i32 == 5; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checked cast can be simplified --> tests/ui/checked_conversions.rs:88:13 | LL | let _ = value <= (u32::MAX as i64) && value >= 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u32::try_from(value).is_ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = u32::try_from(value).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 17 previous errors diff --git a/src/tools/clippy/tests/ui/checked_unwrap/complex_conditionals_nested.stderr b/src/tools/clippy/tests/ui/checked_unwrap/complex_conditionals_nested.stderr index f7e659b10de07..33c6be9d4ff61 100644 --- a/src/tools/clippy/tests/ui/checked_unwrap/complex_conditionals_nested.stderr +++ b/src/tools/clippy/tests/ui/checked_unwrap/complex_conditionals_nested.stderr @@ -1,9 +1,6 @@ error: called `unwrap` on `x` after checking its variant with `is_some` --> tests/ui/checked_unwrap/complex_conditionals_nested.rs:13:13 | -LL | if x.is_some() { - | -------------- help: try: `if let Some(..) = x` -LL | // unnecessary LL | x.unwrap(); | ^^^^^^^^^^ | @@ -12,6 +9,10 @@ note: the lint level is defined here | LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | if let Some(..) = x { + | ~~~~~~~~~~~~~~~~~~~ error: this call to `unwrap()` will always panic --> tests/ui/checked_unwrap/complex_conditionals_nested.rs:17:13 diff --git a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr index ddd600418afec..7bb91712d3c27 100644 --- a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr +++ b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr @@ -1,9 +1,6 @@ error: called `unwrap` on `x` after checking its variant with `is_some` --> tests/ui/checked_unwrap/simple_conditionals.rs:46:9 | -LL | if x.is_some() { - | -------------- help: try: `if let Some(..) = x` -LL | // unnecessary LL | x.unwrap(); | ^^^^^^^^^^ | @@ -12,15 +9,21 @@ note: the lint level is defined here | LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | if let Some(..) = x { + | ~~~~~~~~~~~~~~~~~~~ error: called `expect` on `x` after checking its variant with `is_some` --> tests/ui/checked_unwrap/simple_conditionals.rs:49:9 | -LL | if x.is_some() { - | -------------- help: try: `if let Some(..) = x` -... LL | x.expect("an error message"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(..) = x { + | ~~~~~~~~~~~~~~~~~~~ error: this call to `unwrap()` will always panic --> tests/ui/checked_unwrap/simple_conditionals.rs:53:9 @@ -58,18 +61,17 @@ LL | x.unwrap(); error: called `unwrap` on `x` after checking its variant with `is_none` --> tests/ui/checked_unwrap/simple_conditionals.rs:65:9 | -LL | if x.is_none() { - | -------------- help: try: `if let Some(..) = x` -... LL | x.unwrap(); | ^^^^^^^^^^ + | +help: try + | +LL | if let Some(..) = x { + | ~~~~~~~~~~~~~~~~~~~ error: called `unwrap` on `x` after checking its variant with `is_some` --> tests/ui/checked_unwrap/simple_conditionals.rs:13:13 | -LL | if $a.is_some() { - | --------------- help: try: `if let Some(..) = x` -LL | // unnecessary LL | $a.unwrap(); | ^^^^^^^^^^^ ... @@ -77,24 +79,32 @@ LL | m!(x); | ----- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try + | +LL | if let Some(..) = x { + | ~~~~~~~~~~~~~~~~~~~ error: called `unwrap` on `x` after checking its variant with `is_ok` --> tests/ui/checked_unwrap/simple_conditionals.rs:78:9 | -LL | if x.is_ok() { - | ------------ help: try: `if let Ok(..) = x` -LL | // unnecessary LL | x.unwrap(); | ^^^^^^^^^^ + | +help: try + | +LL | if let Ok(..) = x { + | ~~~~~~~~~~~~~~~~~ error: called `expect` on `x` after checking its variant with `is_ok` --> tests/ui/checked_unwrap/simple_conditionals.rs:81:9 | -LL | if x.is_ok() { - | ------------ help: try: `if let Ok(..) = x` -... LL | x.expect("an error message"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(..) = x { + | ~~~~~~~~~~~~~~~~~ error: this call to `unwrap_err()` will always panic --> tests/ui/checked_unwrap/simple_conditionals.rs:84:9 @@ -126,11 +136,13 @@ LL | x.expect("an error message"); error: called `unwrap_err` on `x` after checking its variant with `is_ok` --> tests/ui/checked_unwrap/simple_conditionals.rs:94:9 | -LL | if x.is_ok() { - | ------------ help: try: `if let Err(..) = x` -... LL | x.unwrap_err(); | ^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Err(..) = x { + | ~~~~~~~~~~~~~~~~~~ error: this call to `unwrap()` will always panic --> tests/ui/checked_unwrap/simple_conditionals.rs:99:9 @@ -144,20 +156,24 @@ LL | x.unwrap(); error: called `unwrap_err` on `x` after checking its variant with `is_err` --> tests/ui/checked_unwrap/simple_conditionals.rs:102:9 | -LL | if x.is_err() { - | ------------- help: try: `if let Err(..) = x` -... LL | x.unwrap_err(); | ^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Err(..) = x { + | ~~~~~~~~~~~~~~~~~~ error: called `unwrap` on `x` after checking its variant with `is_err` --> tests/ui/checked_unwrap/simple_conditionals.rs:106:9 | -LL | if x.is_err() { - | ------------- help: try: `if let Ok(..) = x` -... LL | x.unwrap(); | ^^^^^^^^^^ + | +help: try + | +LL | if let Ok(..) = x { + | ~~~~~~~~~~~~~~~~~ error: this call to `unwrap_err()` will always panic --> tests/ui/checked_unwrap/simple_conditionals.rs:109:9 @@ -171,10 +187,13 @@ LL | x.unwrap_err(); error: called `unwrap` on `option` after checking its variant with `is_some` --> tests/ui/checked_unwrap/simple_conditionals.rs:134:9 | -LL | if option.is_some() { - | ------------------- help: try: `if let Some(..) = &option` LL | option.as_ref().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(..) = &option { + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: this call to `unwrap()` will always panic --> tests/ui/checked_unwrap/simple_conditionals.rs:137:9 @@ -188,10 +207,13 @@ LL | option.as_ref().unwrap(); error: called `unwrap` on `result` after checking its variant with `is_ok` --> tests/ui/checked_unwrap/simple_conditionals.rs:144:9 | -LL | if result.is_ok() { - | ----------------- help: try: `if let Ok(..) = &result` LL | result.as_ref().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(..) = &result { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this call to `unwrap()` will always panic --> tests/ui/checked_unwrap/simple_conditionals.rs:147:9 @@ -205,10 +227,13 @@ LL | result.as_ref().unwrap(); error: called `unwrap` on `option` after checking its variant with `is_some` --> tests/ui/checked_unwrap/simple_conditionals.rs:153:9 | -LL | if option.is_some() { - | ------------------- help: try: `if let Some(..) = &mut option` LL | option.as_mut().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(..) = &mut option { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this call to `unwrap()` will always panic --> tests/ui/checked_unwrap/simple_conditionals.rs:156:9 @@ -222,10 +247,13 @@ LL | option.as_mut().unwrap(); error: called `unwrap` on `result` after checking its variant with `is_ok` --> tests/ui/checked_unwrap/simple_conditionals.rs:162:9 | -LL | if result.is_ok() { - | ----------------- help: try: `if let Ok(..) = &mut result` LL | result.as_mut().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(..) = &mut result { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this call to `unwrap()` will always panic --> tests/ui/checked_unwrap/simple_conditionals.rs:165:9 diff --git a/src/tools/clippy/tests/ui/clear_with_drain.stderr b/src/tools/clippy/tests/ui/clear_with_drain.stderr index 3c7d22192dc77..322c85a11acb3 100644 --- a/src/tools/clippy/tests/ui/clear_with_drain.stderr +++ b/src/tools/clippy/tests/ui/clear_with_drain.stderr @@ -2,130 +2,234 @@ error: `drain` used to clear a `Vec` --> tests/ui/clear_with_drain.rs:22:7 | LL | v.drain(0..v.len()); - | ^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::clear-with-drain` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::clear_with_drain)]` +help: try + | +LL | v.clear(); + | ~~~~~~~ error: `drain` used to clear a `Vec` --> tests/ui/clear_with_drain.rs:26:7 | LL | v.drain(usize::MIN..v.len()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | v.clear(); + | ~~~~~~~ error: `drain` used to clear a `Vec` --> tests/ui/clear_with_drain.rs:45:7 | LL | v.drain(0..); - | ^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^ + | +help: try + | +LL | v.clear(); + | ~~~~~~~ error: `drain` used to clear a `Vec` --> tests/ui/clear_with_drain.rs:49:7 | LL | v.drain(usize::MIN..); - | ^^^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | v.clear(); + | ~~~~~~~ error: `drain` used to clear a `Vec` --> tests/ui/clear_with_drain.rs:65:7 | LL | v.drain(..); - | ^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^ + | +help: try + | +LL | v.clear(); + | ~~~~~~~ error: `drain` used to clear a `Vec` --> tests/ui/clear_with_drain.rs:82:7 | LL | v.drain(..v.len()); - | ^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | v.clear(); + | ~~~~~~~ error: `drain` used to clear a `VecDeque` --> tests/ui/clear_with_drain.rs:120:11 | LL | deque.drain(0..deque.len()); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | deque.clear(); + | ~~~~~~~ error: `drain` used to clear a `VecDeque` --> tests/ui/clear_with_drain.rs:124:11 | LL | deque.drain(usize::MIN..deque.len()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | deque.clear(); + | ~~~~~~~ error: `drain` used to clear a `VecDeque` --> tests/ui/clear_with_drain.rs:143:11 | LL | deque.drain(0..); - | ^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^ + | +help: try + | +LL | deque.clear(); + | ~~~~~~~ error: `drain` used to clear a `VecDeque` --> tests/ui/clear_with_drain.rs:147:11 | LL | deque.drain(usize::MIN..); - | ^^^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | deque.clear(); + | ~~~~~~~ error: `drain` used to clear a `VecDeque` --> tests/ui/clear_with_drain.rs:163:11 | LL | deque.drain(..); - | ^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^ + | +help: try + | +LL | deque.clear(); + | ~~~~~~~ error: `drain` used to clear a `VecDeque` --> tests/ui/clear_with_drain.rs:180:11 | LL | deque.drain(..deque.len()); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | deque.clear(); + | ~~~~~~~ error: `drain` used to clear a `String` --> tests/ui/clear_with_drain.rs:218:7 | LL | s.drain(0..s.len()); - | ^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | s.clear(); + | ~~~~~~~ error: `drain` used to clear a `String` --> tests/ui/clear_with_drain.rs:222:7 | LL | s.drain(usize::MIN..s.len()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | s.clear(); + | ~~~~~~~ error: `drain` used to clear a `String` --> tests/ui/clear_with_drain.rs:241:7 | LL | s.drain(0..); - | ^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^ + | +help: try + | +LL | s.clear(); + | ~~~~~~~ error: `drain` used to clear a `String` --> tests/ui/clear_with_drain.rs:245:7 | LL | s.drain(usize::MIN..); - | ^^^^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | s.clear(); + | ~~~~~~~ error: `drain` used to clear a `String` --> tests/ui/clear_with_drain.rs:261:7 | LL | s.drain(..); - | ^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^ + | +help: try + | +LL | s.clear(); + | ~~~~~~~ error: `drain` used to clear a `String` --> tests/ui/clear_with_drain.rs:278:7 | LL | s.drain(..s.len()); - | ^^^^^^^^^^^^^^^^ help: try: `clear()` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | s.clear(); + | ~~~~~~~ error: `drain` used to clear a `HashSet` --> tests/ui/clear_with_drain.rs:316:9 | LL | set.drain(); - | ^^^^^^^ help: try: `clear()` + | ^^^^^^^ + | +help: try + | +LL | set.clear(); + | ~~~~~~~ error: `drain` used to clear a `HashMap` --> tests/ui/clear_with_drain.rs:335:9 | LL | map.drain(); - | ^^^^^^^ help: try: `clear()` + | ^^^^^^^ + | +help: try + | +LL | map.clear(); + | ~~~~~~~ error: `drain` used to clear a `BinaryHeap` --> tests/ui/clear_with_drain.rs:354:10 | LL | heap.drain(); - | ^^^^^^^ help: try: `clear()` + | ^^^^^^^ + | +help: try + | +LL | heap.clear(); + | ~~~~~~~ error: aborting due to 21 previous errors diff --git a/src/tools/clippy/tests/ui/clone_on_copy.stderr b/src/tools/clippy/tests/ui/clone_on_copy.stderr index 314fd13afca43..72c1776f9e9a4 100644 --- a/src/tools/clippy/tests/ui/clone_on_copy.stderr +++ b/src/tools/clippy/tests/ui/clone_on_copy.stderr @@ -2,58 +2,102 @@ error: using `clone` on type `i32` which implements the `Copy` trait --> tests/ui/clone_on_copy.rs:23:5 | LL | 42.clone(); - | ^^^^^^^^^^ help: try removing the `clone` call: `42` + | ^^^^^^^^^^ | = note: `-D clippy::clone-on-copy` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::clone_on_copy)]` +help: try removing the `clone` call + | +LL | 42; + | ~~ error: using `clone` on type `i32` which implements the `Copy` trait --> tests/ui/clone_on_copy.rs:27:5 | LL | (&42).clone(); - | ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)` + | ^^^^^^^^^^^^^ + | +help: try dereferencing it + | +LL | *(&42); + | ~~~~~~ error: using `clone` on type `i32` which implements the `Copy` trait --> tests/ui/clone_on_copy.rs:30:5 | LL | rc.borrow().clone(); - | ^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*rc.borrow()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try dereferencing it + | +LL | *rc.borrow(); + | ~~~~~~~~~~~~ error: using `clone` on type `u32` which implements the `Copy` trait --> tests/ui/clone_on_copy.rs:33:5 | LL | x.clone().rotate_left(1); - | ^^^^^^^^^ help: try removing the `clone` call: `x` + | ^^^^^^^^^ + | +help: try removing the `clone` call + | +LL | x.rotate_left(1); + | ~ error: using `clone` on type `i32` which implements the `Copy` trait --> tests/ui/clone_on_copy.rs:47:5 | LL | m!(42).clone(); - | ^^^^^^^^^^^^^^ help: try removing the `clone` call: `m!(42)` + | ^^^^^^^^^^^^^^ + | +help: try removing the `clone` call + | +LL | m!(42); + | ~~~~~~ error: using `clone` on type `[u32; 2]` which implements the `Copy` trait --> tests/ui/clone_on_copy.rs:57:5 | LL | x.clone()[0]; - | ^^^^^^^^^ help: try dereferencing it: `(*x)` + | ^^^^^^^^^ + | +help: try dereferencing it + | +LL | (*x)[0]; + | ~~~~ error: using `clone` on type `char` which implements the `Copy` trait --> tests/ui/clone_on_copy.rs:67:14 | LL | is_ascii('z'.clone()); - | ^^^^^^^^^^^ help: try removing the `clone` call: `'z'` + | ^^^^^^^^^^^ + | +help: try removing the `clone` call + | +LL | is_ascii('z'); + | ~~~ error: using `clone` on type `i32` which implements the `Copy` trait --> tests/ui/clone_on_copy.rs:71:14 | LL | vec.push(42.clone()); - | ^^^^^^^^^^ help: try removing the `clone` call: `42` + | ^^^^^^^^^^ + | +help: try removing the `clone` call + | +LL | vec.push(42); + | ~~ error: using `clone` on type `Option` which implements the `Copy` trait --> tests/ui/clone_on_copy.rs:75:17 | LL | let value = opt.clone()?; // operator precedence needed (*opt)? - | ^^^^^^^^^^^ help: try dereferencing it: `(*opt)` + | ^^^^^^^^^^^ + | +help: try dereferencing it + | +LL | let value = (*opt)?; // operator precedence needed (*opt)? + | ~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/cloned_instead_of_copied.stderr b/src/tools/clippy/tests/ui/cloned_instead_of_copied.stderr index ad857c4ef7d0f..ea0aff23db38e 100644 --- a/src/tools/clippy/tests/ui/cloned_instead_of_copied.stderr +++ b/src/tools/clippy/tests/ui/cloned_instead_of_copied.stderr @@ -2,52 +2,91 @@ error: used `cloned` where `copied` could be used instead --> tests/ui/cloned_instead_of_copied.rs:7:24 | LL | let _ = [1].iter().cloned(); - | ^^^^^^ help: try: `copied` + | ^^^^^^ | = note: `-D clippy::cloned-instead-of-copied` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cloned_instead_of_copied)]` +help: try + | +LL | let _ = [1].iter().copied(); + | ~~~~~~ error: used `cloned` where `copied` could be used instead --> tests/ui/cloned_instead_of_copied.rs:8:31 | LL | let _ = vec!["hi"].iter().cloned(); - | ^^^^^^ help: try: `copied` + | ^^^^^^ + | +help: try + | +LL | let _ = vec!["hi"].iter().copied(); + | ~~~~~~ error: used `cloned` where `copied` could be used instead --> tests/ui/cloned_instead_of_copied.rs:9:22 | LL | let _ = Some(&1).cloned(); - | ^^^^^^ help: try: `copied` + | ^^^^^^ + | +help: try + | +LL | let _ = Some(&1).copied(); + | ~~~~~~ error: used `cloned` where `copied` could be used instead --> tests/ui/cloned_instead_of_copied.rs:10:34 | LL | let _ = Box::new([1].iter()).cloned(); - | ^^^^^^ help: try: `copied` + | ^^^^^^ + | +help: try + | +LL | let _ = Box::new([1].iter()).copied(); + | ~~~~~~ error: used `cloned` where `copied` could be used instead --> tests/ui/cloned_instead_of_copied.rs:11:32 | LL | let _ = Box::new(Some(&1)).cloned(); - | ^^^^^^ help: try: `copied` + | ^^^^^^ + | +help: try + | +LL | let _ = Box::new(Some(&1)).copied(); + | ~~~~~~ error: used `cloned` where `copied` could be used instead --> tests/ui/cloned_instead_of_copied.rs:27:22 | LL | let _ = Some(&1).cloned(); // Option::copied needs 1.35 - | ^^^^^^ help: try: `copied` + | ^^^^^^ + | +help: try + | +LL | let _ = Some(&1).copied(); // Option::copied needs 1.35 + | ~~~~~~ error: used `cloned` where `copied` could be used instead --> tests/ui/cloned_instead_of_copied.rs:32:24 | LL | let _ = [1].iter().cloned(); // Iterator::copied needs 1.36 - | ^^^^^^ help: try: `copied` + | ^^^^^^ + | +help: try + | +LL | let _ = [1].iter().copied(); // Iterator::copied needs 1.36 + | ~~~~~~ error: used `cloned` where `copied` could be used instead --> tests/ui/cloned_instead_of_copied.rs:33:22 | LL | let _ = Some(&1).cloned(); - | ^^^^^^ help: try: `copied` + | ^^^^^^ + | +help: try + | +LL | let _ = Some(&1).copied(); + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/cmp_owned/asymmetric_partial_eq.stderr b/src/tools/clippy/tests/ui/cmp_owned/asymmetric_partial_eq.stderr index e230d5f06bb05..1c6c974448462 100644 --- a/src/tools/clippy/tests/ui/cmp_owned/asymmetric_partial_eq.stderr +++ b/src/tools/clippy/tests/ui/cmp_owned/asymmetric_partial_eq.stderr @@ -2,46 +2,69 @@ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/asymmetric_partial_eq.rs:46:12 | LL | if borrowed.to_owned() == owned {} - | ^^^^^^^^^^^^^^^^^^^ help: try: `borrowed` + | ^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::cmp-owned` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cmp_owned)]` +help: try + | +LL | if borrowed == owned {} + | ~~~~~~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/asymmetric_partial_eq.rs:47:21 | LL | if owned == borrowed.to_owned() {} - | ---------^^^^^^^^^^^^^^^^^^^ - | | - | help: try: `borrowed == owned` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if borrowed == owned {} + | ~~~~~~~~~~~~~~~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/asymmetric_partial_eq.rs:65:21 | LL | if owned == borrowed.to_owned() {} - | ^^^^^^^^^^^^^^^^^^^ help: try: `borrowed` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if owned == borrowed {} + | ~~~~~~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/asymmetric_partial_eq.rs:66:12 | LL | if borrowed.to_owned() == owned {} - | ^^^^^^^^^^^^^^^^^^^--------- - | | - | help: try: `owned == borrowed` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if owned == borrowed {} + | ~~~~~~~~~~~~~~~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/asymmetric_partial_eq.rs:92:20 | LL | if "Hi" == borrowed.to_string() {} - | --------^^^^^^^^^^^^^^^^^^^^ - | | - | help: try: `borrowed == "Hi"` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if borrowed == "Hi" {} + | ~~~~~~~~~~~~~~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/asymmetric_partial_eq.rs:93:12 | LL | if borrowed.to_string() == "Hi" {} - | ^^^^^^^^^^^^^^^^^^^^ help: try: `borrowed` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if borrowed == "Hi" {} + | ~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/cmp_owned/comparison_flip.stderr b/src/tools/clippy/tests/ui/cmp_owned/comparison_flip.stderr index cfb6978158b37..a102cf12bac49 100644 --- a/src/tools/clippy/tests/ui/cmp_owned/comparison_flip.stderr +++ b/src/tools/clippy/tests/ui/cmp_owned/comparison_flip.stderr @@ -2,18 +2,25 @@ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/comparison_flip.rs:6:8 | LL | if a.to_string() != "bar" { - | ^^^^^^^^^^^^^ help: try: `a` + | ^^^^^^^^^^^^^ | = note: `-D clippy::cmp-owned` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cmp_owned)]` +help: try + | +LL | if a != "bar" { + | ~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/comparison_flip.rs:10:17 | LL | if "bar" != a.to_string() { - | ---------^^^^^^^^^^^^^ - | | - | help: try: `a != "bar"` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | if a != "bar" { + | ~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/cmp_owned/with_suggestion.stderr b/src/tools/clippy/tests/ui/cmp_owned/with_suggestion.stderr index 41448e0120039..e52b99de6a685 100644 --- a/src/tools/clippy/tests/ui/cmp_owned/with_suggestion.stderr +++ b/src/tools/clippy/tests/ui/cmp_owned/with_suggestion.stderr @@ -2,40 +2,69 @@ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/with_suggestion.rs:5:14 | LL | x != "foo".to_string(); - | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::cmp-owned` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cmp_owned)]` +help: try + | +LL | x != "foo"; + | ~~~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/with_suggestion.rs:7:9 | LL | "foo".to_string() != x; - | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | "foo" != x; + | ~~~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/with_suggestion.rs:14:10 | LL | x != "foo".to_owned(); - | ^^^^^^^^^^^^^^^^ help: try: `"foo"` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | x != "foo"; + | ~~~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/with_suggestion.rs:16:10 | LL | x != String::from("foo"); - | ^^^^^^^^^^^^^^^^^^^ help: try: `"foo"` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | x != "foo"; + | ~~~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/with_suggestion.rs:20:5 | LL | Foo.to_owned() == Foo; - | ^^^^^^^^^^^^^^ help: try: `Foo` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | Foo == Foo; + | ~~~ error: this creates an owned instance just for comparison --> tests/ui/cmp_owned/with_suggestion.rs:22:30 | LL | "abc".chars().filter(|c| c.to_owned() != 'X'); - | ^^^^^^^^^^^^ help: try: `*c` + | ^^^^^^^^^^^^ + | +help: try + | +LL | "abc".chars().filter(|c| *c != 'X'); + | ~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/collapsible_else_if.stderr b/src/tools/clippy/tests/ui/collapsible_else_if.stderr index dc19d90b4d132..8de14f5612870 100644 --- a/src/tools/clippy/tests/ui/collapsible_else_if.stderr +++ b/src/tools/clippy/tests/ui/collapsible_else_if.stderr @@ -158,7 +158,12 @@ LL | }else{ | __________^ LL | | if false {} LL | | } - | |_____^ help: collapse nested if block: `if false {}` + | |_____^ + | +help: collapse nested if block + | +LL | }else if false {} + | ~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/collapsible_if.stderr b/src/tools/clippy/tests/ui/collapsible_if.stderr index 5bcbdf2fd08da..b4d44c6422c7f 100644 --- a/src/tools/clippy/tests/ui/collapsible_if.stderr +++ b/src/tools/clippy/tests/ui/collapsible_if.stderr @@ -125,7 +125,12 @@ error: this `if` statement can be collapsed LL | / if matches!(true, true) { LL | | if matches!(true, true) {} LL | | } - | |_____^ help: collapse nested if block: `if matches!(true, true) && matches!(true, true) {}` + | |_____^ + | +help: collapse nested if block + | +LL | if matches!(true, true) && matches!(true, true) {} + | error: this `if` statement can be collapsed --> tests/ui/collapsible_if.rs:165:5 @@ -133,7 +138,12 @@ error: this `if` statement can be collapsed LL | / if matches!(true, true) && truth() { LL | | if matches!(true, true) {} LL | | } - | |_____^ help: collapse nested if block: `if matches!(true, true) && truth() && matches!(true, true) {}` + | |_____^ + | +help: collapse nested if block + | +LL | if matches!(true, true) && truth() && matches!(true, true) {} + | error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/collapsible_str_replace.stderr b/src/tools/clippy/tests/ui/collapsible_str_replace.stderr index da681dffd8757..b9b430100b5f5 100644 --- a/src/tools/clippy/tests/ui/collapsible_str_replace.stderr +++ b/src/tools/clippy/tests/ui/collapsible_str_replace.stderr @@ -2,22 +2,36 @@ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:18:27 | LL | let _ = "hesuo worpd".replace('s', "l").replace('u', "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace(['s', 'u'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::collapsible-str-replace` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::collapsible_str_replace)]` +help: replace with + | +LL | let _ = "hesuo worpd".replace(['s', 'u'], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:20:27 | LL | let _ = "hesuo worpd".replace('s', l).replace('u', l); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace(['s', 'u'], l)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesuo worpd".replace(['s', 'u'], l); + | ~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:22:27 | LL | let _ = "hesuo worpd".replace('s', "l").replace('u', "l").replace('p', "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace(['s', 'u', 'p'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesuo worpd".replace(['s', 'u', 'p'], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:25:10 @@ -27,67 +41,122 @@ LL | .replace('s', "l") LL | | .replace('u', "l") LL | | .replace('p', "l") LL | | .replace('d', "l"); - | |__________________________^ help: replace with: `replace(['s', 'u', 'p', 'd'], "l")` + | |__________________________^ + | +help: replace with + | +LL | .replace(['s', 'u', 'p', 'd'], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:30:27 | LL | let _ = "hesuo world".replace(s, "l").replace('u', "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace([s, 'u'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesuo world".replace([s, 'u'], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:32:27 | LL | let _ = "hesuo worpd".replace(s, "l").replace('u', "l").replace('p', "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace([s, 'u', 'p'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesuo worpd".replace([s, 'u', 'p'], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:34:27 | LL | let _ = "hesuo worpd".replace(s, "l").replace(u, "l").replace('p', "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace([s, u, 'p'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesuo worpd".replace([s, u, 'p'], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:36:27 | LL | let _ = "hesuo worpd".replace(s, "l").replace(u, "l").replace(p, "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace([s, u, p], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesuo worpd".replace([s, u, p], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:38:27 | LL | let _ = "hesuo worlp".replace('s', "l").replace('u', "l").replace('p', "d"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace(['s', 'u'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesuo worlp".replace(['s', 'u'], "l").replace('p', "d"); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:40:45 | LL | let _ = "hesuo worpd".replace('s', "x").replace('u', "l").replace('p', "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace(['u', 'p'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesuo worpd".replace('s', "x").replace(['u', 'p'], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:43:47 | LL | let _ = "hesudo worpd".replace("su", "l").replace('d', "l").replace('p', "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace(['d', 'p'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesudo worpd".replace("su", "l").replace(['d', 'p'], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:45:28 | LL | let _ = "hesudo worpd".replace(d, "l").replace('p', "l").replace("su", "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace([d, 'p'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesudo worpd".replace([d, 'p'], "l").replace("su", "l"); + | ~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:47:27 | LL | let _ = "hesuo world".replace(get_filter(), "l").replace('s', "l"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace([get_filter(), 's'], "l")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "hesuo world".replace([get_filter(), 's'], "l"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: used consecutive `str::replace` call --> tests/ui/collapsible_str_replace.rs:84:16 | LL | let _ = "".replace('a', "1.58").replace('b', "1.58"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `replace(['a', 'b'], "1.58")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = "".replace(['a', 'b'], "1.58"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 14 previous errors diff --git a/src/tools/clippy/tests/ui/comparison_to_empty.stderr b/src/tools/clippy/tests/ui/comparison_to_empty.stderr index 6b027459ed347..b1f0684d05cd9 100644 --- a/src/tools/clippy/tests/ui/comparison_to_empty.stderr +++ b/src/tools/clippy/tests/ui/comparison_to_empty.stderr @@ -2,58 +2,102 @@ error: comparison to empty slice --> tests/ui/comparison_to_empty.rs:8:13 | LL | let _ = s == ""; - | ^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.is_empty()` + | ^^^^^^^ | = note: `-D clippy::comparison-to-empty` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::comparison_to_empty)]` +help: using `is_empty` is clearer and more explicit + | +LL | let _ = s.is_empty(); + | ~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/comparison_to_empty.rs:9:13 | LL | let _ = s != ""; - | ^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!s.is_empty()` + | ^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | let _ = !s.is_empty(); + | ~~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/comparison_to_empty.rs:12:13 | LL | let _ = v == []; - | ^^^^^^^ help: using `is_empty` is clearer and more explicit: `v.is_empty()` + | ^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | let _ = v.is_empty(); + | ~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/comparison_to_empty.rs:13:13 | LL | let _ = v != []; - | ^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!v.is_empty()` + | ^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | let _ = !v.is_empty(); + | ~~~~~~~~~~~~~ error: comparison to empty slice using `if let` --> tests/ui/comparison_to_empty.rs:14:8 | LL | if let [] = &*v {} - | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `(*v).is_empty()` + | ^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if (*v).is_empty() {} + | ~~~~~~~~~~~~~~~ error: comparison to empty slice using `if let` --> tests/ui/comparison_to_empty.rs:16:8 | LL | if let [] = s {} - | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.is_empty()` + | ^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if s.is_empty() {} + | ~~~~~~~~~~~~ error: comparison to empty slice using `if let` --> tests/ui/comparison_to_empty.rs:17:8 | LL | if let [] = &*s {} - | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.is_empty()` + | ^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if s.is_empty() {} + | ~~~~~~~~~~~~ error: comparison to empty slice using `if let` --> tests/ui/comparison_to_empty.rs:18:8 | LL | if let [] = &*s - | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.is_empty()` + | ^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if s.is_empty() + | ~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/comparison_to_empty.rs:19:12 | LL | && s == [] - | ^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.is_empty()` + | ^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | && s.is_empty() + | ~~~~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/crashes/ice-10148.stderr b/src/tools/clippy/tests/ui/crashes/ice-10148.stderr index 639cf2dd442b8..feb83f6f50713 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-10148.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-10148.stderr @@ -2,12 +2,15 @@ error: empty string literal in `println!` --> tests/ui/crashes/ice-10148.rs:8:5 | LL | println!(with_span!(""something "")); - | ^^^^^^^^^^^^^^^^^^^^-----------^^^^^ - | | - | help: remove the empty string + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::println-empty-string` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::println_empty_string)]` +help: remove the empty string + | +LL - println!(with_span!(""something "")); +LL + println!(with_span!( "")); + | error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crashes/ice-12616.stderr b/src/tools/clippy/tests/ui/crashes/ice-12616.stderr index c7cf5cf5483f7..f9c209a90e2e4 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-12616.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-12616.stderr @@ -2,10 +2,14 @@ error: `as` casting between raw pointers without changing its mutability --> tests/ui/crashes/ice-12616.rs:6:5 | LL | s() as *const (); - | ^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `s().cast::<()>()` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::ptr-as-ptr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_as_ptr)]` +help: try `pointer::cast`, a safer alternative + | +LL | s().cast::<()>(); + | ~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crashes/ice-360.stderr b/src/tools/clippy/tests/ui/crashes/ice-360.stderr index 50b245c65cde5..25ed59d2454e6 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-360.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-360.stderr @@ -22,10 +22,14 @@ LL | | ... | LL | | LL | | } - | |_____^ help: try: `while let Some(ele) = iter.next() { .. }` + | |_____^ | = note: `-D clippy::while-let-loop` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::while_let_loop)]` +help: try + | +LL | while let Some(ele) = iter.next() { .. } + | error: empty `loop {}` wastes CPU cycles --> tests/ui/crashes/ice-360.rs:13:9 diff --git a/src/tools/clippy/tests/ui/crashes/ice-5835.stderr b/src/tools/clippy/tests/ui/crashes/ice-5835.stderr index 45e5e9a4b83d5..14a90a50ea34e 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-5835.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-5835.stderr @@ -2,10 +2,14 @@ error: using tabs in doc comments is not recommended --> tests/ui/crashes/ice-5835.rs:3:10 | LL | /// 位 - | ^^^^ help: consider using four spaces per tab + | ^^^^ | = note: `-D clippy::tabs-in-doc-comments` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::tabs_in_doc_comments)]` +help: consider using four spaces per tab + | +LL | /// 位 + | ++++ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crashes/ice-5872.stderr b/src/tools/clippy/tests/ui/crashes/ice-5872.stderr index 3f6568d34542b..798e8c9794b8a 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-5872.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-5872.stderr @@ -2,10 +2,14 @@ error: avoid using `collect()` when not needed --> tests/ui/crashes/ice-5872.rs:4:39 | LL | let _ = vec![1, 2, 3].into_iter().collect::>().is_empty(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::needless-collect` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_collect)]` +help: replace with + | +LL | let _ = vec![1, 2, 3].into_iter().next().is_none(); + | ~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crashes/ice-7169.stderr b/src/tools/clippy/tests/ui/crashes/ice-7169.stderr index ac7d2862d3ade..fd8f600d0c1b7 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-7169.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-7169.stderr @@ -2,10 +2,14 @@ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/crashes/ice-7169.rs:10:12 | LL | if let Ok(_) = Ok::<_, ()>(A::::default()) {} - | -------^^^^^-------------------------------------- help: try: `if Ok::<_, ()>(A::::default()).is_ok()` + | ^^^^^ | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` +help: try + | +LL | if Ok::<_, ()>(A::::default()).is_ok() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crashes/ice-8250.stderr b/src/tools/clippy/tests/ui/crashes/ice-8250.stderr index 61576f13d1e1a..c930cbfe1de0d 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-8250.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-8250.stderr @@ -2,10 +2,14 @@ error: unnecessary use of `splitn` --> tests/ui/crashes/ice-8250.rs:2:13 | LL | let _ = s[1..].splitn(2, '.').next()?; - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `s[1..].split('.')` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::needless-splitn` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_splitn)]` +help: try + | +LL | let _ = s[1..].split('.').next()?; + | ~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crashes/ice-9041.stderr b/src/tools/clippy/tests/ui/crashes/ice-9041.stderr index dd9db71c5de83..fc7bb41438b0a 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-9041.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-9041.stderr @@ -2,10 +2,14 @@ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/crashes/ice-9041.rs:5:19 | LL | things.iter().find(|p| is_thing_ready(p)).is_some() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|p| is_thing_ready(&p))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::search-is-some` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::search_is_some)]` +help: consider using + | +LL | things.iter().any(|p| is_thing_ready(&p)) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crashes/ice-96721.stderr b/src/tools/clippy/tests/ui/crashes/ice-96721.stderr index f0778a4b32b3e..db19572ca2523 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-96721.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-96721.stderr @@ -2,7 +2,12 @@ error: malformed `path` attribute input --> tests/ui/crashes/ice-96721.rs:7:1 | LL | #[path = foo!()] - | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]` + | ^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[path = "file"] + | ~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr b/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr index 90076d4338a47..15fa76f006d03 100644 --- a/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr +++ b/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr @@ -2,7 +2,7 @@ error: this argument is passed by value, but not consumed in the function body --> tests/ui/crashes/needless_pass_by_value-w-late-bound.rs:7:12 | LL | fn test(x: Foo<'_>) {} - | ^^^^^^^ help: consider taking a reference instead: `&Foo<'_>` + | ^^^^^^^ | help: consider marking this type as `Copy` --> tests/ui/crashes/needless_pass_by_value-w-late-bound.rs:5:1 @@ -11,6 +11,10 @@ LL | struct Foo<'a>(&'a [(); 100]); | ^^^^^^^^^^^^^^ = note: `-D clippy::needless-pass-by-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_value)]` +help: consider taking a reference instead + | +LL | fn test(x: &Foo<'_>) {} + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crate_in_macro_def.stderr b/src/tools/clippy/tests/ui/crate_in_macro_def.stderr index 4202e9bc10357..30ba85c7a6220 100644 --- a/src/tools/clippy/tests/ui/crate_in_macro_def.stderr +++ b/src/tools/clippy/tests/ui/crate_in_macro_def.stderr @@ -2,10 +2,14 @@ error: `crate` references the macro call's crate --> tests/ui/crate_in_macro_def.rs:18:28 | LL | println!("{}", crate::unhygienic::MESSAGE); - | ^^^^^ help: to reference the macro definition's crate, use: `$crate` + | ^^^^^ | = note: `-D clippy::crate-in-macro-def` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::crate_in_macro_def)]` +help: to reference the macro definition's crate, use + | +LL | println!("{}", $crate::unhygienic::MESSAGE); + | ~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/crate_level_checks/no_std_swap.stderr b/src/tools/clippy/tests/ui/crate_level_checks/no_std_swap.stderr index 7d7922ae8cac7..23920c140be5f 100644 --- a/src/tools/clippy/tests/ui/crate_level_checks/no_std_swap.stderr +++ b/src/tools/clippy/tests/ui/crate_level_checks/no_std_swap.stderr @@ -5,11 +5,15 @@ LL | / a = b; LL | | LL | | LL | | b = a; - | |_________^ help: try: `core::mem::swap(&mut a, &mut b)` + | |_________^ | = note: or maybe you should use `core::mem::replace`? = note: `-D clippy::almost-swapped` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::almost_swapped)]` +help: try + | +LL | core::mem::swap(&mut a, &mut b); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/create_dir.stderr b/src/tools/clippy/tests/ui/create_dir.stderr index 9c6e640ca784c..ab51705bb55a5 100644 --- a/src/tools/clippy/tests/ui/create_dir.stderr +++ b/src/tools/clippy/tests/ui/create_dir.stderr @@ -2,16 +2,25 @@ error: calling `std::fs::create_dir` where there may be a better way --> tests/ui/create_dir.rs:10:5 | LL | std::fs::create_dir("foo"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `std::fs::create_dir_all` instead: `create_dir_all("foo")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::create-dir` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::create_dir)]` +help: consider calling `std::fs::create_dir_all` instead + | +LL | create_dir_all("foo"); + | ~~~~~~~~~~~~~~~~~~~~~ error: calling `std::fs::create_dir` where there may be a better way --> tests/ui/create_dir.rs:11:5 | LL | std::fs::create_dir("bar").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `std::fs::create_dir_all` instead: `create_dir_all("bar")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `std::fs::create_dir_all` instead + | +LL | create_dir_all("bar").unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/decimal_literal_representation.stderr b/src/tools/clippy/tests/ui/decimal_literal_representation.stderr index 824e7ec85ee00..735a83752f76b 100644 --- a/src/tools/clippy/tests/ui/decimal_literal_representation.stderr +++ b/src/tools/clippy/tests/ui/decimal_literal_representation.stderr @@ -2,46 +2,80 @@ error: integer literal has a better hexadecimal representation --> tests/ui/decimal_literal_representation.rs:16:9 | LL | 32_773, // 0x8005 - | ^^^^^^ help: consider: `0x8005` + | ^^^^^^ | = note: `-D clippy::decimal-literal-representation` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::decimal_literal_representation)]` +help: consider + | +LL | 0x8005, // 0x8005 + | ~~~~~~ error: integer literal has a better hexadecimal representation --> tests/ui/decimal_literal_representation.rs:17:9 | LL | 65_280, // 0xFF00 - | ^^^^^^ help: consider: `0xFF00` + | ^^^^^^ + | +help: consider + | +LL | 0xFF00, // 0xFF00 + | ~~~~~~ error: integer literal has a better hexadecimal representation --> tests/ui/decimal_literal_representation.rs:18:9 | LL | 2_131_750_927, // 0x7F0F_F00F - | ^^^^^^^^^^^^^ help: consider: `0x7F0F_F00F` + | ^^^^^^^^^^^^^ + | +help: consider + | +LL | 0x7F0F_F00F, // 0x7F0F_F00F + | ~~~~~~~~~~~ error: integer literal has a better hexadecimal representation --> tests/ui/decimal_literal_representation.rs:19:9 | LL | 2_147_483_647, // 0x7FFF_FFFF - | ^^^^^^^^^^^^^ help: consider: `0x7FFF_FFFF` + | ^^^^^^^^^^^^^ + | +help: consider + | +LL | 0x7FFF_FFFF, // 0x7FFF_FFFF + | ~~~~~~~~~~~ error: integer literal has a better hexadecimal representation --> tests/ui/decimal_literal_representation.rs:21:9 | LL | 4_042_322_160, // 0xF0F0_F0F0 - | ^^^^^^^^^^^^^ help: consider: `0xF0F0_F0F0` + | ^^^^^^^^^^^^^ + | +help: consider + | +LL | 0xF0F0_F0F0, // 0xF0F0_F0F0 + | ~~~~~~~~~~~ error: integer literal has a better hexadecimal representation --> tests/ui/decimal_literal_representation.rs:22:9 | LL | 32_773usize, // 0x8005_usize - | ^^^^^^^^^^^ help: consider: `0x8005_usize` + | ^^^^^^^^^^^ + | +help: consider + | +LL | 0x8005_usize, // 0x8005_usize + | ~~~~~~~~~~~~ error: integer literal has a better hexadecimal representation --> tests/ui/decimal_literal_representation.rs:23:9 | LL | 2_131_750_927isize, // 0x7F0F_F00F_isize - | ^^^^^^^^^^^^^^^^^^ help: consider: `0x7F0F_F00F_isize` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider + | +LL | 0x7F0F_F00F_isize, // 0x7F0F_F00F_isize + | ~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/default_constructed_unit_structs.stderr b/src/tools/clippy/tests/ui/default_constructed_unit_structs.stderr index c0fa73515c034..9c9ea76fa6c72 100644 --- a/src/tools/clippy/tests/ui/default_constructed_unit_structs.stderr +++ b/src/tools/clippy/tests/ui/default_constructed_unit_structs.stderr @@ -2,40 +2,75 @@ error: use of `default` to create a unit struct --> tests/ui/default_constructed_unit_structs.rs:11:13 | LL | Self::default() - | ^^^^^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ | = note: `-D clippy::default-constructed-unit-structs` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::default_constructed_unit_structs)]` +help: remove this call to `default` + | +LL - Self::default() +LL + Self + | error: use of `default` to create a unit struct --> tests/ui/default_constructed_unit_structs.rs:53:31 | LL | inner: PhantomData::default(), - | ^^^^^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ + | +help: remove this call to `default` + | +LL - inner: PhantomData::default(), +LL + inner: PhantomData, + | error: use of `default` to create a unit struct --> tests/ui/default_constructed_unit_structs.rs:126:33 | LL | let _ = PhantomData::::default(); - | ^^^^^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ + | +help: remove this call to `default` + | +LL - let _ = PhantomData::::default(); +LL + let _ = PhantomData::; + | error: use of `default` to create a unit struct --> tests/ui/default_constructed_unit_structs.rs:127:42 | LL | let _: PhantomData = PhantomData::default(); - | ^^^^^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ + | +help: remove this call to `default` + | +LL - let _: PhantomData = PhantomData::default(); +LL + let _: PhantomData = PhantomData; + | error: use of `default` to create a unit struct --> tests/ui/default_constructed_unit_structs.rs:128:55 | LL | let _: PhantomData = std::marker::PhantomData::default(); - | ^^^^^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ + | +help: remove this call to `default` + | +LL - let _: PhantomData = std::marker::PhantomData::default(); +LL + let _: PhantomData = std::marker::PhantomData; + | error: use of `default` to create a unit struct --> tests/ui/default_constructed_unit_structs.rs:129:23 | LL | let _ = UnitStruct::default(); - | ^^^^^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ + | +help: remove this call to `default` + | +LL - let _ = UnitStruct::default(); +LL + let _ = UnitStruct; + | error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/default_instead_of_iter_empty.stderr b/src/tools/clippy/tests/ui/default_instead_of_iter_empty.stderr index 4bd4d060a3f75..fc16583f4e830 100644 --- a/src/tools/clippy/tests/ui/default_instead_of_iter_empty.stderr +++ b/src/tools/clippy/tests/ui/default_instead_of_iter_empty.stderr @@ -2,22 +2,36 @@ error: `std::iter::empty()` is the more idiomatic way --> tests/ui/default_instead_of_iter_empty.rs:12:13 | LL | let _ = std::iter::Empty::::default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::empty::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::default-instead-of-iter-empty` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::default_instead_of_iter_empty)]` +help: try + | +LL | let _ = std::iter::empty::(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `std::iter::empty()` is the more idiomatic way --> tests/ui/default_instead_of_iter_empty.rs:13:13 | LL | let _ = std::iter::Empty::>::default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::empty::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = std::iter::empty::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `std::iter::empty()` is the more idiomatic way --> tests/ui/default_instead_of_iter_empty.rs:14:41 | LL | let _foo: std::iter::Empty = std::iter::Empty::default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _foo: std::iter::Empty = std::iter::empty(); + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/default_instead_of_iter_empty_no_std.stderr b/src/tools/clippy/tests/ui/default_instead_of_iter_empty_no_std.stderr index eb80da13e8506..905f87f2069a0 100644 --- a/src/tools/clippy/tests/ui/default_instead_of_iter_empty_no_std.stderr +++ b/src/tools/clippy/tests/ui/default_instead_of_iter_empty_no_std.stderr @@ -2,16 +2,25 @@ error: `core::iter::empty()` is the more idiomatic way --> tests/ui/default_instead_of_iter_empty_no_std.rs:23:13 | LL | let _ = core::iter::Empty::::default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::iter::empty::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::default-instead-of-iter-empty` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::default_instead_of_iter_empty)]` +help: try + | +LL | let _ = core::iter::empty::(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `core::iter::empty()` is the more idiomatic way --> tests/ui/default_instead_of_iter_empty_no_std.rs:24:42 | LL | let _foo: core::iter::Empty = core::iter::Empty::default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::iter::empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _foo: core::iter::Empty = core::iter::empty(); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/default_numeric_fallback_f64.stderr b/src/tools/clippy/tests/ui/default_numeric_fallback_f64.stderr index d7e4dbd637715..bdbe7b1ca099a 100644 --- a/src/tools/clippy/tests/ui/default_numeric_fallback_f64.stderr +++ b/src/tools/clippy/tests/ui/default_numeric_fallback_f64.stderr @@ -2,144 +2,257 @@ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:21:17 | LL | let x = 0.12; - | ^^^^ help: consider adding suffix: `0.12_f64` + | ^^^^ | = note: `-D clippy::default-numeric-fallback` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::default_numeric_fallback)]` +help: consider adding suffix + | +LL | let x = 0.12_f64; + | ~~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:22:18 | LL | let x = [1., 2., 3.]; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let x = [1.0_f64, 2., 3.]; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:22:22 | LL | let x = [1., 2., 3.]; - | ^^ help: consider adding suffix: `2.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let x = [1., 2.0_f64, 3.]; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:22:26 | LL | let x = [1., 2., 3.]; - | ^^ help: consider adding suffix: `3.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let x = [1., 2., 3.0_f64]; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:23:28 | LL | let x = if true { (1., 2.) } else { (3., 4.) }; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let x = if true { (1.0_f64, 2.) } else { (3., 4.) }; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:23:32 | LL | let x = if true { (1., 2.) } else { (3., 4.) }; - | ^^ help: consider adding suffix: `2.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let x = if true { (1., 2.0_f64) } else { (3., 4.) }; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:23:46 | LL | let x = if true { (1., 2.) } else { (3., 4.) }; - | ^^ help: consider adding suffix: `3.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let x = if true { (1., 2.) } else { (3.0_f64, 4.) }; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:23:50 | LL | let x = if true { (1., 2.) } else { (3., 4.) }; - | ^^ help: consider adding suffix: `4.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let x = if true { (1., 2.) } else { (3., 4.0_f64) }; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:24:23 | LL | let x = match 1. { - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let x = match 1.0_f64 { + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:25:18 | LL | _ => 1., - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | _ => 1.0_f64, + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:44:21 | LL | let y = 1.; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let y = 1.0_f64; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:52:21 | LL | let y = 1.; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let y = 1.0_f64; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:58:21 | LL | let y = 1.; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let y = 1.0_f64; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:66:21 | LL | let y = 1.; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let y = 1.0_f64; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:82:27 | LL | let f = || -> _ { 1. }; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let f = || -> _ { 1.0_f64 }; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:86:29 | LL | let f = || -> f64 { 1. }; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let f = || -> f64 { 1.0_f64 }; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:100:21 | LL | generic_arg(1.); - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | generic_arg(1.0_f64); + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:103:32 | LL | let x: _ = generic_arg(1.); - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let x: _ = generic_arg(1.0_f64); + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:121:28 | LL | GenericStruct { x: 1. }; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | GenericStruct { x: 1.0_f64 }; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:124:36 | LL | let _ = GenericStruct { x: 1. }; - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | let _ = GenericStruct { x: 1.0_f64 }; + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:142:24 | LL | GenericEnum::X(1.); - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | GenericEnum::X(1.0_f64); + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:162:23 | LL | s.generic_arg(1.); - | ^^ help: consider adding suffix: `1.0_f64` + | ^^ + | +help: consider adding suffix + | +LL | s.generic_arg(1.0_f64); + | ~~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_f64.rs:172:25 | LL | inline!(let x = 22.;); - | ^^^ help: consider adding suffix: `22.0_f64` + | ^^^ | = note: this error originates in the macro `__inline_mac_fn_internal` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider adding suffix + | +LL | inline!(let x = 22.0_f64;); + | ~~~~~~~~ error: aborting due to 23 previous errors diff --git a/src/tools/clippy/tests/ui/default_numeric_fallback_i32.stderr b/src/tools/clippy/tests/ui/default_numeric_fallback_i32.stderr index 67ab923ecf5fb..3ad5c15eb928d 100644 --- a/src/tools/clippy/tests/ui/default_numeric_fallback_i32.stderr +++ b/src/tools/clippy/tests/ui/default_numeric_fallback_i32.stderr @@ -2,174 +2,312 @@ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:20:17 | LL | let x = 22; - | ^^ help: consider adding suffix: `22_i32` + | ^^ | = note: `-D clippy::default-numeric-fallback` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::default_numeric_fallback)]` +help: consider adding suffix + | +LL | let x = 22_i32; + | ~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:21:18 | LL | let x = [1, 2, 3]; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let x = [1_i32, 2, 3]; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:21:21 | LL | let x = [1, 2, 3]; - | ^ help: consider adding suffix: `2_i32` + | ^ + | +help: consider adding suffix + | +LL | let x = [1, 2_i32, 3]; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:21:24 | LL | let x = [1, 2, 3]; - | ^ help: consider adding suffix: `3_i32` + | ^ + | +help: consider adding suffix + | +LL | let x = [1, 2, 3_i32]; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:22:28 | LL | let x = if true { (1, 2) } else { (3, 4) }; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let x = if true { (1_i32, 2) } else { (3, 4) }; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:22:31 | LL | let x = if true { (1, 2) } else { (3, 4) }; - | ^ help: consider adding suffix: `2_i32` + | ^ + | +help: consider adding suffix + | +LL | let x = if true { (1, 2_i32) } else { (3, 4) }; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:22:44 | LL | let x = if true { (1, 2) } else { (3, 4) }; - | ^ help: consider adding suffix: `3_i32` + | ^ + | +help: consider adding suffix + | +LL | let x = if true { (1, 2) } else { (3_i32, 4) }; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:22:47 | LL | let x = if true { (1, 2) } else { (3, 4) }; - | ^ help: consider adding suffix: `4_i32` + | ^ + | +help: consider adding suffix + | +LL | let x = if true { (1, 2) } else { (3, 4_i32) }; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:23:23 | LL | let x = match 1 { - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let x = match 1_i32 { + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:24:13 | LL | 1 => 1, - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | 1_i32 => 1, + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:24:18 | LL | 1 => 1, - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | 1 => 1_i32, + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:25:18 | LL | _ => 2, - | ^ help: consider adding suffix: `2_i32` + | ^ + | +help: consider adding suffix + | +LL | _ => 2_i32, + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:44:21 | LL | let y = 1; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let y = 1_i32; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:52:21 | LL | let y = 1; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let y = 1_i32; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:58:21 | LL | let y = 1; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let y = 1_i32; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:66:21 | LL | let y = 1; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let y = 1_i32; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:82:27 | LL | let f = || -> _ { 1 }; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let f = || -> _ { 1_i32 }; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:86:29 | LL | let f = || -> i32 { 1 }; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let f = || -> i32 { 1_i32 }; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:100:21 | LL | generic_arg(1); - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | generic_arg(1_i32); + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:103:32 | LL | let x: _ = generic_arg(1); - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let x: _ = generic_arg(1_i32); + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:121:28 | LL | GenericStruct { x: 1 }; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | GenericStruct { x: 1_i32 }; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:124:36 | LL | let _ = GenericStruct { x: 1 }; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let _ = GenericStruct { x: 1_i32 }; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:142:24 | LL | GenericEnum::X(1); - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | GenericEnum::X(1_i32); + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:162:23 | LL | s.generic_arg(1); - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | s.generic_arg(1_i32); + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:172:25 | LL | inline!(let x = 22;); - | ^^ help: consider adding suffix: `22_i32` + | ^^ | = note: this error originates in the macro `__inline_mac_fn_internal` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider adding suffix + | +LL | inline!(let x = 22_i32;); + | ~~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:214:29 | LL | let data_i32 = vec![1, 2, 3]; - | ^ help: consider adding suffix: `1_i32` + | ^ + | +help: consider adding suffix + | +LL | let data_i32 = vec![1_i32, 2, 3]; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:214:32 | LL | let data_i32 = vec![1, 2, 3]; - | ^ help: consider adding suffix: `2_i32` + | ^ + | +help: consider adding suffix + | +LL | let data_i32 = vec![1, 2_i32, 3]; + | ~~~~~ error: default numeric fallback might occur --> tests/ui/default_numeric_fallback_i32.rs:214:35 | LL | let data_i32 = vec![1, 2, 3]; - | ^ help: consider adding suffix: `3_i32` + | ^ + | +help: consider adding suffix + | +LL | let data_i32 = vec![1, 2, 3_i32]; + | ~~~~~ error: aborting due to 28 previous errors diff --git a/src/tools/clippy/tests/ui/default_trait_access.stderr b/src/tools/clippy/tests/ui/default_trait_access.stderr index 276f03d79df1d..e3c5b03310ac9 100644 --- a/src/tools/clippy/tests/ui/default_trait_access.stderr +++ b/src/tools/clippy/tests/ui/default_trait_access.stderr @@ -2,55 +2,94 @@ error: calling `String::default()` is more clear than this expression --> tests/ui/default_trait_access.rs:13:22 | LL | let s1: String = Default::default(); - | ^^^^^^^^^^^^^^^^^^ help: try: `String::default()` + | ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/default_trait_access.rs:2:9 | LL | #![deny(clippy::default_trait_access)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | let s1: String = String::default(); + | ~~~~~~~~~~~~~~~~~ error: calling `String::default()` is more clear than this expression --> tests/ui/default_trait_access.rs:17:22 | LL | let s3: String = D2::default(); - | ^^^^^^^^^^^^^ help: try: `String::default()` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let s3: String = String::default(); + | ~~~~~~~~~~~~~~~~~ error: calling `String::default()` is more clear than this expression --> tests/ui/default_trait_access.rs:19:22 | LL | let s4: String = std::default::Default::default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `String::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let s4: String = String::default(); + | ~~~~~~~~~~~~~~~~~ error: calling `String::default()` is more clear than this expression --> tests/ui/default_trait_access.rs:23:22 | LL | let s6: String = default::Default::default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `String::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let s6: String = String::default(); + | ~~~~~~~~~~~~~~~~~ error: calling `GenericDerivedDefault::default()` is more clear than this expression --> tests/ui/default_trait_access.rs:33:46 | LL | let s11: GenericDerivedDefault = Default::default(); - | ^^^^^^^^^^^^^^^^^^ help: try: `GenericDerivedDefault::default()` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let s11: GenericDerivedDefault = GenericDerivedDefault::default(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `TupleDerivedDefault::default()` is more clear than this expression --> tests/ui/default_trait_access.rs:39:36 | LL | let s14: TupleDerivedDefault = Default::default(); - | ^^^^^^^^^^^^^^^^^^ help: try: `TupleDerivedDefault::default()` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let s14: TupleDerivedDefault = TupleDerivedDefault::default(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `ArrayDerivedDefault::default()` is more clear than this expression --> tests/ui/default_trait_access.rs:41:36 | LL | let s15: ArrayDerivedDefault = Default::default(); - | ^^^^^^^^^^^^^^^^^^ help: try: `ArrayDerivedDefault::default()` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let s15: ArrayDerivedDefault = ArrayDerivedDefault::default(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `TupleStructDerivedDefault::default()` is more clear than this expression --> tests/ui/default_trait_access.rs:45:42 | LL | let s17: TupleStructDerivedDefault = Default::default(); - | ^^^^^^^^^^^^^^^^^^ help: try: `TupleStructDerivedDefault::default()` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let s17: TupleStructDerivedDefault = TupleStructDerivedDefault::default(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/deref_addrof.stderr b/src/tools/clippy/tests/ui/deref_addrof.stderr index 20069f746c81c..678a5ee315726 100644 --- a/src/tools/clippy/tests/ui/deref_addrof.stderr +++ b/src/tools/clippy/tests/ui/deref_addrof.stderr @@ -2,74 +2,126 @@ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:23:13 | LL | let b = *&a; - | ^^^ help: try: `a` + | ^^^ | = note: `-D clippy::deref-addrof` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::deref_addrof)]` +help: try + | +LL | let b = a; + | ~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:25:13 | LL | let b = *&get_number(); - | ^^^^^^^^^^^^^^ help: try: `get_number()` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | let b = get_number(); + | ~~~~~~~~~~~~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:30:13 | LL | let b = *&bytes[1..2][0]; - | ^^^^^^^^^^^^^^^^ help: try: `bytes[1..2][0]` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let b = bytes[1..2][0]; + | ~~~~~~~~~~~~~~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:34:13 | LL | let b = *&(a); - | ^^^^^ help: try: `(a)` + | ^^^^^ + | +help: try + | +LL | let b = (a); + | ~~~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:36:13 | LL | let b = *(&a); - | ^^^^^ help: try: `a` + | ^^^^^ + | +help: try + | +LL | let b = a; + | ~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:39:13 | LL | let b = *((&a)); - | ^^^^^^^ help: try: `a` + | ^^^^^^^ + | +help: try + | +LL | let b = a; + | ~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:41:13 | LL | let b = *&&a; - | ^^^^ help: try: `&a` + | ^^^^ + | +help: try + | +LL | let b = &a; + | ~~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:43:14 | LL | let b = **&aref; - | ^^^^^^ help: try: `aref` + | ^^^^^^ + | +help: try + | +LL | let b = *aref; + | ~~~~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:47:19 | LL | let _repeat = *&[0; 64]; - | ^^^^^^^^^ help: try: `[0; 64]` + | ^^^^^^^^^ + | +help: try + | +LL | let _repeat = [0; 64]; + | ~~~~~~~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:57:17 | LL | inline!(*& $(@expr self)) - | ^^^^^^^^^^^^^^^^ help: try: `$(@expr self)` + | ^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `__inline_mac_impl` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try + | +LL | inline!($(@expr self)) + | ~~~~~~~~~~~~~ error: immediately dereferencing a reference --> tests/ui/deref_addrof.rs:61:17 | LL | inline!(*&mut $(@expr self)) - | ^^^^^^^^^^^^^^^^^^^ help: try: `$(@expr self)` + | ^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `__inline_mac_impl` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try + | +LL | inline!($(@expr self)) + | ~~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/deref_addrof_double_trigger.stderr b/src/tools/clippy/tests/ui/deref_addrof_double_trigger.stderr index 8905b14246740..8efb5e4f52809 100644 --- a/src/tools/clippy/tests/ui/deref_addrof_double_trigger.stderr +++ b/src/tools/clippy/tests/ui/deref_addrof_double_trigger.stderr @@ -2,22 +2,36 @@ error: immediately dereferencing a reference --> tests/ui/deref_addrof_double_trigger.rs:10:14 | LL | let b = **&&a; - | ^^^^ help: try: `&a` + | ^^^^ | = note: `-D clippy::deref-addrof` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::deref_addrof)]` +help: try + | +LL | let b = *&a; + | ~~ error: immediately dereferencing a reference --> tests/ui/deref_addrof_double_trigger.rs:16:17 | LL | let y = *&mut x; - | ^^^^^^^ help: try: `x` + | ^^^^^^^ + | +help: try + | +LL | let y = x; + | ~ error: immediately dereferencing a reference --> tests/ui/deref_addrof_double_trigger.rs:24:18 | LL | let y = **&mut &mut x; - | ^^^^^^^^^^^^ help: try: `&mut x` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let y = *&mut x; + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/deref_by_slicing.stderr b/src/tools/clippy/tests/ui/deref_by_slicing.stderr index 17b00610899d6..adf7cf7293847 100644 --- a/src/tools/clippy/tests/ui/deref_by_slicing.stderr +++ b/src/tools/clippy/tests/ui/deref_by_slicing.stderr @@ -2,58 +2,102 @@ error: slicing when dereferencing would work --> tests/ui/deref_by_slicing.rs:8:13 | LL | let _ = &vec[..]; - | ^^^^^^^^ help: dereference the original value instead: `&*vec` + | ^^^^^^^^ | = note: `-D clippy::deref-by-slicing` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::deref_by_slicing)]` +help: dereference the original value instead + | +LL | let _ = &*vec; + | ~~~~~ error: slicing when dereferencing would work --> tests/ui/deref_by_slicing.rs:9:13 | LL | let _ = &mut vec[..]; - | ^^^^^^^^^^^^ help: dereference the original value instead: `&mut *vec` + | ^^^^^^^^^^^^ + | +help: dereference the original value instead + | +LL | let _ = &mut *vec; + | ~~~~~~~~~ error: slicing when dereferencing would work --> tests/ui/deref_by_slicing.rs:12:13 | LL | let _ = &ref_vec[..]; - | ^^^^^^^^^^^^ help: dereference the original value instead: `&**ref_vec` + | ^^^^^^^^^^^^ + | +help: dereference the original value instead + | +LL | let _ = &**ref_vec; + | ~~~~~~~~~~ error: slicing when dereferencing would work --> tests/ui/deref_by_slicing.rs:13:21 | LL | let mut_slice = &mut ref_vec[..]; - | ^^^^^^^^^^^^^^^^ help: dereference the original value instead: `&mut **ref_vec` + | ^^^^^^^^^^^^^^^^ + | +help: dereference the original value instead + | +LL | let mut_slice = &mut **ref_vec; + | ~~~~~~~~~~~~~~ error: slicing when dereferencing would work --> tests/ui/deref_by_slicing.rs:14:13 | LL | let _ = &mut mut_slice[..]; // Err, re-borrows slice - | ^^^^^^^^^^^^^^^^^^ help: reborrow the original value instead: `&mut *mut_slice` + | ^^^^^^^^^^^^^^^^^^ + | +help: reborrow the original value instead + | +LL | let _ = &mut *mut_slice; // Err, re-borrows slice + | ~~~~~~~~~~~~~~~ error: slicing when dereferencing would work --> tests/ui/deref_by_slicing.rs:17:13 | LL | let _ = &s[..]; - | ^^^^^^ help: dereference the original value instead: `&*s` + | ^^^^^^ + | +help: dereference the original value instead + | +LL | let _ = &*s; + | ~~~ error: slicing when dereferencing would work --> tests/ui/deref_by_slicing.rs:20:18 | LL | let _ = &mut &S[..]; // Err, re-borrows slice - | ^^^^^^ help: reborrow the original value instead: `&*S` + | ^^^^^^ + | +help: reborrow the original value instead + | +LL | let _ = &mut &*S; // Err, re-borrows slice + | ~~~ error: slicing when dereferencing would work --> tests/ui/deref_by_slicing.rs:24:13 | LL | let _ = &slice_ref[..]; // Err, derefs slice - | ^^^^^^^^^^^^^^ help: dereference the original value instead: `*slice_ref` + | ^^^^^^^^^^^^^^ + | +help: dereference the original value instead + | +LL | let _ = *slice_ref; // Err, derefs slice + | ~~~~~~~~~~ error: slicing when dereferencing would work --> tests/ui/deref_by_slicing.rs:27:13 | LL | let _ = (&bytes[..]).read_to_end(&mut vec![]).unwrap(); // Err, re-borrows slice - | ^^^^^^^^^^^^ help: reborrow the original value instead: `(&*bytes)` + | ^^^^^^^^^^^^ + | +help: reborrow the original value instead + | +LL | let _ = (&*bytes).read_to_end(&mut vec![]).unwrap(); // Err, re-borrows slice + | ~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/derivable_impls.stderr b/src/tools/clippy/tests/ui/derivable_impls.stderr index 0adb422373d86..f00a9ea3cad13 100644 --- a/src/tools/clippy/tests/ui/derivable_impls.stderr +++ b/src/tools/clippy/tests/ui/derivable_impls.stderr @@ -12,7 +12,27 @@ LL | | } | = note: `-D clippy::derivable-impls` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::derivable_impls)]` - = help: remove the manual implementation... +help: remove the manual implementation... + | +LL - impl std::default::Default for FooDefault<'_> { +LL - fn default() -> Self { +LL - Self { +LL - a: false, +LL - b: 0, +LL - c: 0u64, +LL - d: vec![], +LL - e: Default::default(), +LL - f: FooND2::default(), +LL - g: HashMap::new(), +LL - h: (0, vec![]), +LL - i: [vec![], vec![], vec![]], +LL - j: [0; 5], +LL - k: None, +LL - l: &[], +LL - } +LL - } +LL - } + | help: ...and instead derive it | LL + #[derive(Default)] @@ -29,7 +49,14 @@ LL | | } LL | | } | |_^ | - = help: remove the manual implementation... +help: remove the manual implementation... + | +LL - impl std::default::Default for TupleDefault { +LL - fn default() -> Self { +LL - Self(false, 0, 0u64) +LL - } +LL - } + | help: ...and instead derive it | LL + #[derive(Default)] @@ -46,7 +73,14 @@ LL | | } LL | | } | |_^ | - = help: remove the manual implementation... +help: remove the manual implementation... + | +LL - impl Default for StrDefault<'_> { +LL - fn default() -> Self { +LL - Self("") +LL - } +LL - } + | help: ...and instead derive it | LL + #[derive(Default)] @@ -63,7 +97,14 @@ LL | | } LL | | } | |_^ | - = help: remove the manual implementation... +help: remove the manual implementation... + | +LL - impl Default for Y { +LL - fn default() -> Self { +LL - Self(mac!()) +LL - } +LL - } + | help: ...and instead derive it | LL + #[derive(Default)] @@ -80,7 +121,14 @@ LL | | } LL | | } | |_^ | - = help: remove the manual implementation... +help: remove the manual implementation... + | +LL - impl Default for WithoutSelfCurly { +LL - fn default() -> Self { +LL - WithoutSelfCurly { a: false } +LL - } +LL - } + | help: ...and instead derive it | LL + #[derive(Default)] @@ -97,7 +145,14 @@ LL | | } LL | | } | |_^ | - = help: remove the manual implementation... +help: remove the manual implementation... + | +LL - impl Default for WithoutSelfParan { +LL - fn default() -> Self { +LL - WithoutSelfParan(false) +LL - } +LL - } + | help: ...and instead derive it | LL + #[derive(Default)] @@ -114,7 +169,14 @@ LL | | } LL | | } | |_^ | - = help: remove the manual implementation... +help: remove the manual implementation... + | +LL - impl Default for RepeatDefault1 { +LL - fn default() -> Self { +LL - RepeatDefault1 { a: [0; 32] } +LL - } +LL - } + | help: ...and instead derive it | LL + #[derive(Default)] @@ -131,7 +193,14 @@ LL | | } LL | | } | |_^ | - = help: remove the manual implementation... +help: remove the manual implementation... + | +LL - impl Default for SimpleEnum { +LL - fn default() -> Self { +LL - SimpleEnum::Bar +LL - } +LL - } + | help: ...and instead derive it... | LL + #[derive(Default)] diff --git a/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.stderr b/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.stderr index 7436114fadb2e..17b276c4654c3 100644 --- a/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.stderr +++ b/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.stderr @@ -2,82 +2,146 @@ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:11:17 | LL | #[derive(Debug, PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ | = note: `-D clippy::derive-partial-eq-without-eq` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::derive_partial_eq_without_eq)]` +help: consider deriving `Eq` as well + | +LL | #[derive(Debug, PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:69:10 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:75:10 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:81:10 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:84:10 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:90:10 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:96:10 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:109:17 | LL | #[derive(Debug, PartialEq, Clone)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(Debug, PartialEq, Eq, Clone)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:112:10 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:119:14 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:122:14 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:182:14 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: you are deriving `PartialEq` and can implement `Eq` --> tests/ui/derive_partial_eq_without_eq.rs:190:14 | LL | #[derive(PartialEq)] - | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + | ^^^^^^^^^ + | +help: consider deriving `Eq` as well + | +LL | #[derive(PartialEq, Eq)] + | ~~~~~~~~~~~~~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/doc/doc-fixable.stderr b/src/tools/clippy/tests/ui/doc/doc-fixable.stderr index a9263f62d38dc..1849db7082e1c 100644 --- a/src/tools/clippy/tests/ui/doc/doc-fixable.stderr +++ b/src/tools/clippy/tests/ui/doc/doc-fixable.stderr @@ -367,7 +367,12 @@ error: you should put bare URLs between `<`/`>` or make a proper Markdown link --> tests/ui/doc/doc-fixable.rs:244:5 | LL | /// https://github.com/rust-lang/rust-clippy/pull/12836 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | /// + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 34 previous errors diff --git a/src/tools/clippy/tests/ui/double_comparison.stderr b/src/tools/clippy/tests/ui/double_comparison.stderr index 01ba7a8ee1083..30dcc5d2a553c 100644 --- a/src/tools/clippy/tests/ui/double_comparison.stderr +++ b/src/tools/clippy/tests/ui/double_comparison.stderr @@ -2,52 +2,91 @@ error: this binary expression can be simplified --> tests/ui/double_comparison.rs:6:8 | LL | if x == y || x < y { - | ^^^^^^^^^^^^^^^ help: try: `x <= y` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::double-comparisons` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::double_comparisons)]` +help: try + | +LL | if x <= y { + | ~~~~~~ error: this binary expression can be simplified --> tests/ui/double_comparison.rs:9:8 | LL | if x < y || x == y { - | ^^^^^^^^^^^^^^^ help: try: `x <= y` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | if x <= y { + | ~~~~~~ error: this binary expression can be simplified --> tests/ui/double_comparison.rs:12:8 | LL | if x == y || x > y { - | ^^^^^^^^^^^^^^^ help: try: `x >= y` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | if x >= y { + | ~~~~~~ error: this binary expression can be simplified --> tests/ui/double_comparison.rs:15:8 | LL | if x > y || x == y { - | ^^^^^^^^^^^^^^^ help: try: `x >= y` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | if x >= y { + | ~~~~~~ error: this binary expression can be simplified --> tests/ui/double_comparison.rs:18:8 | LL | if x < y || x > y { - | ^^^^^^^^^^^^^^ help: try: `x != y` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | if x != y { + | ~~~~~~ error: this binary expression can be simplified --> tests/ui/double_comparison.rs:21:8 | LL | if x > y || x < y { - | ^^^^^^^^^^^^^^ help: try: `x != y` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | if x != y { + | ~~~~~~ error: this binary expression can be simplified --> tests/ui/double_comparison.rs:24:8 | LL | if x <= y && x >= y { - | ^^^^^^^^^^^^^^^^ help: try: `x == y` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if x == y { + | ~~~~~~ error: this binary expression can be simplified --> tests/ui/double_comparison.rs:27:8 | LL | if x >= y && x <= y { - | ^^^^^^^^^^^^^^^^ help: try: `x == y` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if x == y { + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/drain_collect.stderr b/src/tools/clippy/tests/ui/drain_collect.stderr index 1dfd0f1e3463e..d19f56b1d7baa 100644 --- a/src/tools/clippy/tests/ui/drain_collect.stderr +++ b/src/tools/clippy/tests/ui/drain_collect.stderr @@ -2,67 +2,116 @@ error: you seem to be trying to move all elements into a new `BinaryHeap` --> tests/ui/drain_collect.rs:7:5 | LL | b.drain().collect() - | ^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(b)` + | ^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/drain_collect.rs:1:9 | LL | #![deny(clippy::drain_collect)] | ^^^^^^^^^^^^^^^^^^^^^ +help: consider using `mem::take` + | +LL | std::mem::take(b) + | error: you seem to be trying to move all elements into a new `HashMap` --> tests/ui/drain_collect.rs:15:5 | LL | b.drain().collect() - | ^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(b)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using `mem::take` + | +LL | std::mem::take(b) + | error: you seem to be trying to move all elements into a new `HashSet` --> tests/ui/drain_collect.rs:23:5 | LL | b.drain().collect() - | ^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(b)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using `mem::take` + | +LL | std::mem::take(b) + | error: you seem to be trying to move all elements into a new `Vec` --> tests/ui/drain_collect.rs:31:5 | LL | b.drain(..).collect() - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(b)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `mem::take` + | +LL | std::mem::take(b) + | error: you seem to be trying to move all elements into a new `Vec` --> tests/ui/drain_collect.rs:39:5 | LL | b.drain(..).collect() - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(b)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `mem::take` + | +LL | std::mem::take(b) + | error: you seem to be trying to move all elements into a new `Vec` --> tests/ui/drain_collect.rs:43:5 | LL | b.drain(0..).collect() - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(b)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `mem::take` + | +LL | std::mem::take(b) + | error: you seem to be trying to move all elements into a new `Vec` --> tests/ui/drain_collect.rs:47:5 | LL | b.drain(..b.len()).collect() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `mem::take` + | +LL | std::mem::take(b) + | error: you seem to be trying to move all elements into a new `Vec` --> tests/ui/drain_collect.rs:51:5 | LL | b.drain(0..b.len()).collect() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `mem::take` + | +LL | std::mem::take(b) + | error: you seem to be trying to move all elements into a new `Vec` --> tests/ui/drain_collect.rs:56:5 | LL | b.drain(..).collect() - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(&mut b)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `mem::take` + | +LL | std::mem::take(&mut b) + | error: you seem to be trying to move all elements into a new `String` --> tests/ui/drain_collect.rs:64:5 | LL | b.drain(..).collect() - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(b)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `mem::take` + | +LL | std::mem::take(b) + | error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/duration_subsec.stderr b/src/tools/clippy/tests/ui/duration_subsec.stderr index 55e44f149cf1e..ad13982c6db84 100644 --- a/src/tools/clippy/tests/ui/duration_subsec.stderr +++ b/src/tools/clippy/tests/ui/duration_subsec.stderr @@ -2,34 +2,58 @@ error: calling `subsec_millis()` is more concise than this calculation --> tests/ui/duration_subsec.rs:9:24 | LL | let bad_millis_1 = dur.subsec_micros() / 1_000; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::duration-subsec` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::duration_subsec)]` +help: try + | +LL | let bad_millis_1 = dur.subsec_millis(); + | ~~~~~~~~~~~~~~~~~~~ error: calling `subsec_millis()` is more concise than this calculation --> tests/ui/duration_subsec.rs:10:24 | LL | let bad_millis_2 = dur.subsec_nanos() / 1_000_000; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let bad_millis_2 = dur.subsec_millis(); + | ~~~~~~~~~~~~~~~~~~~ error: calling `subsec_micros()` is more concise than this calculation --> tests/ui/duration_subsec.rs:15:22 | LL | let bad_micros = dur.subsec_nanos() / 1_000; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let bad_micros = dur.subsec_micros(); + | ~~~~~~~~~~~~~~~~~~~ error: calling `subsec_micros()` is more concise than this calculation --> tests/ui/duration_subsec.rs:20:13 | LL | let _ = (&dur).subsec_nanos() / 1_000; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&dur).subsec_micros()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = (&dur).subsec_micros(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: calling `subsec_micros()` is more concise than this calculation --> tests/ui/duration_subsec.rs:24:13 | LL | let _ = dur.subsec_nanos() / NANOS_IN_MICRO; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = dur.subsec_micros(); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/empty_drop.stderr b/src/tools/clippy/tests/ui/empty_drop.stderr index 4223ddaf3fba5..b20fba7763b8e 100644 --- a/src/tools/clippy/tests/ui/empty_drop.stderr +++ b/src/tools/clippy/tests/ui/empty_drop.stderr @@ -4,10 +4,16 @@ error: empty drop implementation LL | / impl Drop for Foo { LL | | fn drop(&mut self) {} LL | | } - | |_^ help: try removing this impl + | |_^ | = note: `-D clippy::empty-drop` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::empty_drop)]` +help: try removing this impl + | +LL - impl Drop for Foo { +LL - fn drop(&mut self) {} +LL - } + | error: empty drop implementation --> tests/ui/empty_drop.rs:23:1 @@ -17,7 +23,16 @@ LL | | fn drop(&mut self) { LL | | {} LL | | } LL | | } - | |_^ help: try removing this impl + | |_^ + | +help: try removing this impl + | +LL - impl Drop for Baz { +LL - fn drop(&mut self) { +LL - {} +LL - } +LL - } + | error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/empty_enum_variants_with_brackets.stderr b/src/tools/clippy/tests/ui/empty_enum_variants_with_brackets.stderr index 2b187b8f755b4..d0b8d28384661 100644 --- a/src/tools/clippy/tests/ui/empty_enum_variants_with_brackets.stderr +++ b/src/tools/clippy/tests/ui/empty_enum_variants_with_brackets.stderr @@ -6,7 +6,11 @@ LL | EmptyBraces {}, | = note: `-D clippy::empty-enum-variants-with-brackets` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::empty_enum_variants_with_brackets)]` - = help: remove the brackets +help: remove the brackets + | +LL - EmptyBraces {}, +LL + EmptyBraces, + | error: enum variant has empty brackets --> tests/ui/empty_enum_variants_with_brackets.rs:8:21 @@ -14,7 +18,11 @@ error: enum variant has empty brackets LL | EmptyParentheses(), | ^^ | - = help: remove the brackets +help: remove the brackets + | +LL - EmptyParentheses(), +LL + EmptyParentheses, + | error: enum variant has empty brackets --> tests/ui/empty_enum_variants_with_brackets.rs:14:16 @@ -22,7 +30,11 @@ error: enum variant has empty brackets LL | EmptyBraces {}, | ^^^ | - = help: remove the brackets +help: remove the brackets + | +LL - EmptyBraces {}, +LL + EmptyBraces, + | error: enum variant has empty brackets --> tests/ui/empty_enum_variants_with_brackets.rs:15:21 @@ -30,7 +42,11 @@ error: enum variant has empty brackets LL | EmptyParentheses(), | ^^ | - = help: remove the brackets +help: remove the brackets + | +LL - EmptyParentheses(), +LL + EmptyParentheses, + | error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/empty_structs_with_brackets.stderr b/src/tools/clippy/tests/ui/empty_structs_with_brackets.stderr index e57249aec0238..30b59f5c01f51 100644 --- a/src/tools/clippy/tests/ui/empty_structs_with_brackets.stderr +++ b/src/tools/clippy/tests/ui/empty_structs_with_brackets.stderr @@ -6,7 +6,10 @@ LL | pub struct MyEmptyStruct {} // should trigger lint | = note: `-D clippy::empty-structs-with-brackets` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::empty_structs_with_brackets)]` - = help: remove the brackets +help: remove the brackets + | +LL | pub struct MyEmptyStruct; // should trigger lint + | ~ error: found empty brackets on struct declaration --> tests/ui/empty_structs_with_brackets.rs:5:26 @@ -14,7 +17,10 @@ error: found empty brackets on struct declaration LL | struct MyEmptyTupleStruct(); // should trigger lint | ^^^ | - = help: remove the brackets +help: remove the brackets + | +LL | struct MyEmptyTupleStruct; // should trigger lint + | ~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/entry.stderr b/src/tools/clippy/tests/ui/entry.stderr index fb4676766066a..ed2b4a96efd46 100644 --- a/src/tools/clippy/tests/ui/entry.stderr +++ b/src/tools/clippy/tests/ui/entry.stderr @@ -4,10 +4,14 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` LL | / if !m.contains_key(&k) { LL | | m.insert(k, v); LL | | } - | |_____^ help: try: `m.entry(k).or_insert(v);` + | |_____^ | = note: `-D clippy::map-entry` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::map_entry)]` +help: try + | +LL | m.entry(k).or_insert(v); + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> tests/ui/entry.rs:29:5 @@ -193,7 +197,12 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` LL | / if !m.contains_key(&m!(k)) { LL | | m.insert(m!(k), m!(v)); LL | | } - | |_____^ help: try: `m.entry(m!(k)).or_insert_with(|| m!(v));` + | |_____^ + | +help: try + | +LL | m.entry(m!(k)).or_insert_with(|| m!(v)); + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> tests/ui/entry.rs:151:5 diff --git a/src/tools/clippy/tests/ui/enum_glob_use.stderr b/src/tools/clippy/tests/ui/enum_glob_use.stderr index 6825383b769d7..1e261ee487151 100644 --- a/src/tools/clippy/tests/ui/enum_glob_use.stderr +++ b/src/tools/clippy/tests/ui/enum_glob_use.stderr @@ -2,22 +2,36 @@ error: usage of wildcard import for enum variants --> tests/ui/enum_glob_use.rs:5:5 | LL | use std::cmp::Ordering::*; - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::cmp::Ordering::Less` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::enum-glob-use` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::enum_glob_use)]` +help: try + | +LL | use std::cmp::Ordering::Less; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import for enum variants --> tests/ui/enum_glob_use.rs:11:5 | LL | use self::Enum::*; - | ^^^^^^^^^^^^^ help: try: `self::Enum::Foo` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | use self::Enum::Foo; + | ~~~~~~~~~~~~~~~ error: usage of wildcard import for enum variants --> tests/ui/enum_glob_use.rs:15:13 | LL | use crate::Enum::*; - | ^^^^^^^^^^^^^^ help: try: `crate::Enum::Foo` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::Enum::Foo; + | ~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/equatable_if_let.stderr b/src/tools/clippy/tests/ui/equatable_if_let.stderr index 9e93a33cd7e21..18bec7b16e4a3 100644 --- a/src/tools/clippy/tests/ui/equatable_if_let.stderr +++ b/src/tools/clippy/tests/ui/equatable_if_let.stderr @@ -2,88 +2,157 @@ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:64:8 | LL | if let 2 = a {} - | ^^^^^^^^^ help: try: `a == 2` + | ^^^^^^^^^ | = note: `-D clippy::equatable-if-let` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::equatable_if_let)]` +help: try + | +LL | if a == 2 {} + | ~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:65:8 | LL | if let Ordering::Greater = a.cmp(&b) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.cmp(&b) == Ordering::Greater` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if a.cmp(&b) == Ordering::Greater {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:66:8 | LL | if let Some(2) = c {} - | ^^^^^^^^^^^^^^^ help: try: `c == Some(2)` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | if c == Some(2) {} + | ~~~~~~~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:67:8 | LL | if let Struct { a: 2, b: false } = d {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `d == (Struct { a: 2, b: false })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if d == (Struct { a: 2, b: false }) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:68:8 | LL | if let Enum::TupleVariant(32, 64) = e {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `e == Enum::TupleVariant(32, 64)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if e == Enum::TupleVariant(32, 64) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:69:8 | LL | if let Enum::RecordVariant { a: 64, b: 32 } = e {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `e == (Enum::RecordVariant { a: 64, b: 32 })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if e == (Enum::RecordVariant { a: 64, b: 32 }) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:70:8 | LL | if let Enum::UnitVariant = e {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `e == Enum::UnitVariant` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if e == Enum::UnitVariant {} + | ~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:71:8 | LL | if let (Enum::UnitVariant, &Struct { a: 2, b: false }) = (e, &d) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(e, &d) == (Enum::UnitVariant, &Struct { a: 2, b: false })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if (e, &d) == (Enum::UnitVariant, &Struct { a: 2, b: false }) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using `matches!` --> tests/ui/equatable_if_let.rs:80:8 | LL | if let NotPartialEq::A = f {} - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(f, NotPartialEq::A)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if matches!(f, NotPartialEq::A) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:81:8 | LL | if let NotStructuralEq::A = g {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `g == NotStructuralEq::A` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if g == NotStructuralEq::A {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using `matches!` --> tests/ui/equatable_if_let.rs:82:8 | LL | if let Some(NotPartialEq::A) = Some(f) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(Some(f), Some(NotPartialEq::A))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if matches!(Some(f), Some(NotPartialEq::A)) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:83:8 | LL | if let Some(NotStructuralEq::A) = Some(g) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(g) == Some(NotStructuralEq::A)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if Some(g) == Some(NotStructuralEq::A) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using `matches!` --> tests/ui/equatable_if_let.rs:84:8 | LL | if let NoPartialEqStruct { a: 2, b: false } = h {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(h, NoPartialEqStruct { a: 2, b: false })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if matches!(h, NoPartialEqStruct { a: 2, b: false }) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern matching can be expressed using equality --> tests/ui/equatable_if_let.rs:86:8 | LL | if let inline!("abc") = "abc" { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"abc" == inline!("abc")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if "abc" == inline!("abc") { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 14 previous errors diff --git a/src/tools/clippy/tests/ui/err_expect.stderr b/src/tools/clippy/tests/ui/err_expect.stderr index 68f39cc45c5b1..6e1aa14d585d0 100644 --- a/src/tools/clippy/tests/ui/err_expect.stderr +++ b/src/tools/clippy/tests/ui/err_expect.stderr @@ -2,16 +2,25 @@ error: called `.err().expect()` on a `Result` value --> tests/ui/err_expect.rs:10:16 | LL | test_debug.err().expect("Testing debug type"); - | ^^^^^^^^^^^^ help: try: `expect_err` + | ^^^^^^^^^^^^ | = note: `-D clippy::err-expect` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::err_expect)]` +help: try + | +LL | test_debug.expect_err("Testing debug type"); + | ~~~~~~~~~~ error: called `.err().expect()` on a `Result` value --> tests/ui/err_expect.rs:25:7 | LL | x.err().expect("17"); - | ^^^^^^^^^^^^ help: try: `expect_err` + | ^^^^^^^^^^^^ + | +help: try + | +LL | x.expect_err("17"); + | ~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/eta.stderr b/src/tools/clippy/tests/ui/eta.stderr index c757601042f16..813017e62a477 100644 --- a/src/tools/clippy/tests/ui/eta.stderr +++ b/src/tools/clippy/tests/ui/eta.stderr @@ -2,205 +2,368 @@ error: redundant closure --> tests/ui/eta.rs:29:27 | LL | let a = Some(1u8).map(|a| foo(a)); - | ^^^^^^^^^^ help: replace the closure with the function itself: `foo` + | ^^^^^^^^^^ | = note: `-D clippy::redundant-closure` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]` +help: replace the closure with the function itself + | +LL | let a = Some(1u8).map(foo); + | ~~~ error: redundant closure --> tests/ui/eta.rs:33:40 | LL | let _: Option> = true.then(|| vec![]); // special case vec! - | ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new` + | ^^^^^^^^^ + | +help: replace the closure with `Vec::new` + | +LL | let _: Option> = true.then(std::vec::Vec::new); // special case vec! + | ~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:34:35 | LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted? - | ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2` + | ^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | let d = Some(1u8).map(|a| foo(foo2(a))); //is adjusted? + | ~~~~ error: redundant closure --> tests/ui/eta.rs:35:26 | LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted - | ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | all(&[1, 2, 3], &&2, below); //is adjusted + | ~~~~~ error: redundant closure --> tests/ui/eta.rs:42:27 | LL | let e = Some(1u8).map(|a| generic(a)); - | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic` + | ^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | let e = Some(1u8).map(generic); + | ~~~~~~~ error: redundant closure --> tests/ui/eta.rs:94:51 | LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo()); - | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo` + | ^^^^^^^^^^^ | = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_closure_for_method_calls)]` +help: replace the closure with the method itself + | +LL | let e = Some(TestStruct { some_ref: &i }).map(TestStruct::foo); + | ~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:95:51 | LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo()); - | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo` + | ^^^^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | let e = Some(TestStruct { some_ref: &i }).map(TestTrait::trait_foo); + | ~~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:97:42 | LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear()); - | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear` + | ^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | let e = Some(&mut vec![1, 2, 3]).map(std::vec::Vec::clear); + | ~~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:101:29 | LL | let e = Some("str").map(|s| s.to_string()); - | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string` + | ^^^^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | let e = Some("str").map(std::string::ToString::to_string); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:102:27 | LL | let e = Some('a').map(|s| s.to_uppercase()); - | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | let e = Some('a').map(char::to_uppercase); + | ~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:104:65 | LL | let e: std::vec::Vec = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | let e: std::vec::Vec = vec!['a', 'b', 'c'].iter().map(char::to_ascii_uppercase).collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:167:22 | LL | requires_fn_once(|| x()); - | ^^^^^^ help: replace the closure with the function itself: `x` + | ^^^^^^ + | +help: replace the closure with the function itself + | +LL | requires_fn_once(x); + | ~ error: redundant closure --> tests/ui/eta.rs:174:27 | LL | let a = Some(1u8).map(|a| foo_ptr(a)); - | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr` + | ^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | let a = Some(1u8).map(foo_ptr); + | ~~~~~~~ error: redundant closure --> tests/ui/eta.rs:179:27 | LL | let a = Some(1u8).map(|a| closure(a)); - | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure` + | ^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | let a = Some(1u8).map(closure); + | ~~~~~~~ error: redundant closure --> tests/ui/eta.rs:211:28 | LL | x.into_iter().for_each(|x| add_to_res(x)); - | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res` + | ^^^^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | x.into_iter().for_each(&mut add_to_res); + | ~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:212:28 | LL | y.into_iter().for_each(|x| add_to_res(x)); - | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res` + | ^^^^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | y.into_iter().for_each(&mut add_to_res); + | ~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:213:28 | LL | z.into_iter().for_each(|x| add_to_res(x)); - | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res` + | ^^^^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | z.into_iter().for_each(add_to_res); + | ~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:220:21 | LL | Some(1).map(|n| closure(n)); - | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure` + | ^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | Some(1).map(&mut closure); + | ~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:224:21 | LL | Some(1).map(|n| in_loop(n)); - | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `in_loop` + | ^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | Some(1).map(in_loop); + | ~~~~~~~ error: redundant closure --> tests/ui/eta.rs:317:18 | LL | takes_fn_mut(|| f()); - | ^^^^^^ help: replace the closure with the function itself: `&mut f` + | ^^^^^^ + | +help: replace the closure with the function itself + | +LL | takes_fn_mut(&mut f); + | ~~~~~~ error: redundant closure --> tests/ui/eta.rs:320:19 | LL | takes_fn_once(|| f()); - | ^^^^^^ help: replace the closure with the function itself: `&mut f` + | ^^^^^^ + | +help: replace the closure with the function itself + | +LL | takes_fn_once(&mut f); + | ~~~~~~ error: redundant closure --> tests/ui/eta.rs:324:26 | LL | move || takes_fn_mut(|| f_used_once()) - | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once` + | ^^^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | move || takes_fn_mut(&mut f_used_once) + | ~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:336:19 | LL | array_opt.map(|a| a.as_slice()); - | ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8; 3]>::as_slice` + | ^^^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | array_opt.map(<[u8; 3]>::as_slice); + | ~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:339:19 | LL | slice_opt.map(|s| s.len()); - | ^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8]>::len` + | ^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | slice_opt.map(<[u8]>::len); + | ~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:342:17 | LL | ptr_opt.map(|p| p.is_null()); - | ^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<*const usize>::is_null` + | ^^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | ptr_opt.map(<*const usize>::is_null); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:346:17 | LL | dyn_opt.map(|d| d.method_on_dyn()); - | ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `::method_on_dyn` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | dyn_opt.map(::method_on_dyn); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:406:19 | LL | let _ = f(&0, |x, y| f2(x, y)); - | ^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `f2` + | ^^^^^^^^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | let _ = f(&0, f2); + | ~~ error: redundant closure --> tests/ui/eta.rs:434:22 | LL | test.map(|t| t.method()) - | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `Test::method` + | ^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | test.map(Test::method) + | ~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:438:22 | LL | test.map(|t| t.method()) - | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `super::Outer::method` + | ^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | test.map(super::Outer::method) + | ~~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:451:18 | LL | test.map(|t| t.method()) - | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `test_mod::Test::method` + | ^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | test.map(test_mod::Test::method) + | ~~~~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:458:30 | LL | test.map(|t| t.method()) - | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `crate::issue_10854::d::Test::method` + | ^^^^^^^^^^^^^^ + | +help: replace the closure with the method itself + | +LL | test.map(crate::issue_10854::d::Test::method) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/eta.rs:477:38 | LL | let x = Box::new(|| None.map(|x| f(x))); - | ^^^^^^^^ help: replace the closure with the function itself: `&f` + | ^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | let x = Box::new(|| None.map(&f)); + | ~~ error: redundant closure --> tests/ui/eta.rs:481:38 | LL | let x = Box::new(|| None.map(|x| f(x))); - | ^^^^^^^^ help: replace the closure with the function itself: `f` + | ^^^^^^^^ + | +help: replace the closure with the function itself + | +LL | let x = Box::new(|| None.map(f)); + | ~ error: aborting due to 33 previous errors diff --git a/src/tools/clippy/tests/ui/excessive_precision.stderr b/src/tools/clippy/tests/ui/excessive_precision.stderr index 22dd96e53bdbe..8323a130ad351 100644 --- a/src/tools/clippy/tests/ui/excessive_precision.stderr +++ b/src/tools/clippy/tests/ui/excessive_precision.stderr @@ -2,94 +2,168 @@ error: float has excessive precision --> tests/ui/excessive_precision.rs:20:26 | LL | const BAD32_1: f32 = 0.123_456_789_f32; - | ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79_f32` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::excessive-precision` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::excessive_precision)]` +help: consider changing the type or truncating it to + | +LL | const BAD32_1: f32 = 0.123_456_79_f32; + | ~~~~~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:21:26 | LL | const BAD32_2: f32 = 0.123_456_789; - | ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79` + | ^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | const BAD32_2: f32 = 0.123_456_79; + | ~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:22:26 | LL | const BAD32_3: f32 = 0.100_000_000_000_1; - | ^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.1` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | const BAD32_3: f32 = 0.1; + | ~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:23:29 | LL | const BAD32_EDGE: f32 = 1.000_000_9; - | ^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.000_001` + | ^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | const BAD32_EDGE: f32 = 1.000_001; + | ~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:27:26 | LL | const BAD64_3: f64 = 0.100_000_000_000_000_000_1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | const BAD64_3: f64 = 0.1; + | ~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:30:22 | LL | println!("{:?}", 8.888_888_888_888_888_888_888); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `8.888_888_888_888_89` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | println!("{:?}", 8.888_888_888_888_89); + | ~~~~~~~~~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:41:22 | LL | let bad32: f32 = 1.123_456_789; - | ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8` + | ^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | let bad32: f32 = 1.123_456_8; + | ~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:42:26 | LL | let bad32_suf: f32 = 1.123_456_789_f32; - | ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8_f32` + | ^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | let bad32_suf: f32 = 1.123_456_8_f32; + | ~~~~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:43:21 | LL | let bad32_inf = 1.123_456_789_f32; - | ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8_f32` + | ^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | let bad32_inf = 1.123_456_8_f32; + | ~~~~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:53:36 | LL | let bad_vec32: Vec = vec![0.123_456_789]; - | ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79` + | ^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | let bad_vec32: Vec = vec![0.123_456_79]; + | ~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:54:36 | LL | 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` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | let bad_vec64: Vec = vec![0.123_456_789_123_456_78]; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:58:24 | LL | let bad_e32: f32 = 1.123_456_788_888e-10; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8e-10` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | let bad_e32: f32 = 1.123_456_8e-10; + | ~~~~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:61:27 | LL | let bad_bige32: f32 = 1.123_456_788_888E-10; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8E-10` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | let bad_bige32: f32 = 1.123_456_8E-10; + | ~~~~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:70:13 | LL | let _ = 2.225_073_858_507_201_1e-308_f64; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `2.225_073_858_507_201e-308_f64` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | let _ = 2.225_073_858_507_201e-308_f64; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: float has excessive precision --> tests/ui/excessive_precision.rs:73:13 | LL | let _ = 1.000_000_000_000_001e-324_f64; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0_f64` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or truncating it to + | +LL | let _ = 0_f64; + | ~~~~~ error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/expect_fun_call.stderr b/src/tools/clippy/tests/ui/expect_fun_call.stderr index b41904d04fa4c..84a6fe98a78c7 100644 --- a/src/tools/clippy/tests/ui/expect_fun_call.stderr +++ b/src/tools/clippy/tests/ui/expect_fun_call.stderr @@ -2,94 +2,168 @@ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:37:26 | LL | with_none_and_format.expect(&format!("Error {}: fake error", error_code)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::expect-fun-call` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::expect_fun_call)]` +help: try + | +LL | with_none_and_format.unwrap_or_else(|| panic!("Error {}: fake error", error_code)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:40:26 | LL | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_none_and_as_str.unwrap_or_else(|| panic!("Error {}: fake error", error_code)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:43:37 | LL | with_none_and_format_with_macro.expect(format!("Error {}: fake error", one!()).as_str()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| panic!("Error {}: fake error", one!()))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_none_and_format_with_macro.unwrap_or_else(|| panic!("Error {}: fake error", one!())); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:53:25 | LL | with_err_and_format.expect(&format!("Error {}: fake error", error_code)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_err_and_format.unwrap_or_else(|_| panic!("Error {}: fake error", error_code)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:56:25 | LL | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_err_and_as_str.unwrap_or_else(|_| panic!("Error {}: fake error", error_code)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:68:17 | LL | Some("foo").expect(format!("{} {}", 1, 2).as_ref()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| panic!("{} {}", 1, 2))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Some("foo").unwrap_or_else(|| panic!("{} {}", 1, 2)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:89:21 | LL | Some("foo").expect(&get_string()); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| { panic!("{}", get_string()) })` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Some("foo").unwrap_or_else(|| { panic!("{}", get_string()) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:90:21 | LL | Some("foo").expect(get_string().as_ref()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| { panic!("{}", get_string()) })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Some("foo").unwrap_or_else(|| { panic!("{}", get_string()) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:91:21 | LL | Some("foo").expect(get_string().as_str()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| { panic!("{}", get_string()) })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Some("foo").unwrap_or_else(|| { panic!("{}", get_string()) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:93:21 | LL | Some("foo").expect(get_static_str()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| { panic!("{}", get_static_str()) })` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Some("foo").unwrap_or_else(|| { panic!("{}", get_static_str()) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:94:21 | LL | Some("foo").expect(get_non_static_str(&0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| { panic!("{}", get_non_static_str(&0).to_string()) })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Some("foo").unwrap_or_else(|| { panic!("{}", get_non_static_str(&0).to_string()) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:98:16 | LL | Some(true).expect(&format!("key {}, {}", 1, 2)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| panic!("key {}, {}", 1, 2))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Some(true).unwrap_or_else(|| panic!("key {}, {}", 1, 2)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:104:17 | LL | opt_ref.expect(&format!("{:?}", opt_ref)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| panic!("{:?}", opt_ref))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | opt_ref.unwrap_or_else(|| panic!("{:?}", opt_ref)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:108:20 | LL | format_capture.expect(&format!("{error_code}")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| panic!("{error_code}"))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | format_capture.unwrap_or_else(|| panic!("{error_code}")); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `expect` followed by a function call --> tests/ui/expect_fun_call.rs:111:30 | LL | format_capture_and_value.expect(&format!("{error_code}, {}", 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| panic!("{error_code}, {}", 1))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | format_capture_and_value.unwrap_or_else(|| panic!("{error_code}, {}", 1)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/explicit_auto_deref.stderr b/src/tools/clippy/tests/ui/explicit_auto_deref.stderr index 56a183de3487f..6997fe7567aa1 100644 --- a/src/tools/clippy/tests/ui/explicit_auto_deref.stderr +++ b/src/tools/clippy/tests/ui/explicit_auto_deref.stderr @@ -2,274 +2,498 @@ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:68:19 | LL | let _: &str = &*s; - | ^^^ help: try: `&s` + | ^^^ | = note: `-D clippy::explicit-auto-deref` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::explicit_auto_deref)]` +help: try + | +LL | let _: &str = &s; + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:69:19 | LL | let _: &str = &*{ String::new() }; - | ^^^^^^^^^^^^^^^^^^^ help: try: `&{ String::new() }` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &str = &{ String::new() }; + | ~~~~~~~~~~~~~~~~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:70:19 | LL | let _: &str = &mut *{ String::new() }; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut { String::new() }` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &str = &mut { String::new() }; + | ~~~~~~~~~~~~~~~~~~~~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:74:11 | LL | f_str(&*s); - | ^^^ help: try: `&s` + | ^^^ + | +help: try + | +LL | f_str(&s); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:78:13 | LL | f_str_t(&*s, &*s); // Don't lint second param. - | ^^^ help: try: `&s` + | ^^^ + | +help: try + | +LL | f_str_t(&s, &*s); // Don't lint second param. + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:81:24 | LL | let _: &Box = &**b; - | ^^^^ help: try: `&b` + | ^^^^ + | +help: try + | +LL | let _: &Box = &b; + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:87:7 | LL | c(&*s); - | ^^^ help: try: `&s` + | ^^^ + | +help: try + | +LL | c(&s); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:93:9 | LL | &**x - | ^^^^ help: try: `x` + | ^^^^ + | +help: try + | +LL | x + | error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:97:11 | LL | { &**x } - | ^^^^ help: try: `x` + | ^^^^ + | +help: try + | +LL | { x } + | ~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:101:9 | LL | &**{ x } - | ^^^^^^^^ help: try: `{ x }` + | ^^^^^^^^ + | +help: try + | +LL | { x } + | error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:105:9 | LL | &***x - | ^^^^^ help: try: `x` + | ^^^^^ + | +help: try + | +LL | x + | error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:122:12 | LL | f1(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f1(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:123:12 | LL | f2(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f2(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:124:12 | LL | f3(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f3(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:125:27 | LL | f4.callable_str()(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f4.callable_str()(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:126:12 | LL | f5(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f5(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:127:12 | LL | f6(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f6(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:128:27 | LL | f7.callable_str()(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f7.callable_str()(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:129:25 | LL | f8.callable_t()(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f8.callable_t()(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:130:12 | LL | f9(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f9(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:131:13 | LL | f10(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f10(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:132:26 | LL | f11.callable_t()(&*x); - | ^^^ help: try: `&x` + | ^^^ + | +help: try + | +LL | f11.callable_t()(&x); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:136:16 | LL | let _ = S1(&*s); - | ^^^ help: try: `&s` + | ^^^ + | +help: try + | +LL | let _ = S1(&s); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:141:21 | LL | let _ = S2 { s: &*s }; - | ^^^ help: try: `&s` + | ^^^ + | +help: try + | +LL | let _ = S2 { s: &s }; + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:157:30 | LL | let _ = Self::S1(&**s); - | ^^^^ help: try: `s` + | ^^^^ + | +help: try + | +LL | let _ = Self::S1(s); + | ~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:158:35 | LL | let _ = Self::S2 { s: &**s }; - | ^^^^ help: try: `s` + | ^^^^ + | +help: try + | +LL | let _ = Self::S2 { s: s }; + | ~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:161:20 | LL | let _ = E1::S1(&*s); - | ^^^ help: try: `&s` + | ^^^ + | +help: try + | +LL | let _ = E1::S1(&s); + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:162:25 | LL | let _ = E1::S2 { s: &*s }; - | ^^^ help: try: `&s` + | ^^^ + | +help: try + | +LL | let _ = E1::S2 { s: &s }; + | ~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:180:13 | LL | let _ = (*b).foo; - | ^^^^ help: try: `b` + | ^^^^ + | +help: try + | +LL | let _ = b.foo; + | ~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:181:13 | LL | let _ = (**b).foo; - | ^^^^^ help: try: `b` + | ^^^^^ + | +help: try + | +LL | let _ = b.foo; + | ~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:196:19 | LL | let _ = f_str(*ref_str); - | ^^^^^^^^ help: try: `ref_str` + | ^^^^^^^^ + | +help: try + | +LL | let _ = f_str(ref_str); + | ~~~~~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:198:19 | LL | let _ = f_str(**ref_ref_str); - | ^^^^^^^^^^^^^ help: try: `ref_ref_str` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = f_str(ref_ref_str); + | ~~~~~~~~~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:208:12 | LL | f_str(&&*ref_str); // `needless_borrow` will suggest removing both references - | ^^^^^^^^^ help: try: `ref_str` + | ^^^^^^^^^ + | +help: try + | +LL | f_str(&ref_str); // `needless_borrow` will suggest removing both references + | ~~~~~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:209:12 | LL | f_str(&&**ref_str); // `needless_borrow` will suggest removing only one reference - | ^^^^^^^^^^ help: try: `ref_str` + | ^^^^^^^^^^ + | +help: try + | +LL | f_str(&ref_str); // `needless_borrow` will suggest removing only one reference + | ~~~~~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:218:41 | LL | let _ = || -> &'static str { return *s }; - | ^^ help: try: `s` + | ^^ + | +help: try + | +LL | let _ = || -> &'static str { return s }; + | ~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:237:9 | LL | &**x - | ^^^^ help: try: `x` + | ^^^^ + | +help: try + | +LL | x + | error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:260:8 | LL | c1(*x); - | ^^ help: try: `x` + | ^^ + | +help: try + | +LL | c1(x); + | ~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:263:20 | LL | return *x; - | ^^ help: try: `x` + | ^^ + | +help: try + | +LL | return x; + | ~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:265:9 | LL | *x - | ^^ help: try: `x` + | ^^ + | +help: try + | +LL | x + | error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:299:20 | LL | Some(x) => &mut *x, - | ^^^^^^^ help: try: `x` + | ^^^^^^^ + | +help: try + | +LL | Some(x) => x, + | ~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:332:22 | LL | let _ = &mut (*{ x.u }).x; - | ^^^^^^^^^^ help: try: `{ x.u }` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = &mut { x.u }.x; + | ~~~~~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:338:22 | LL | let _ = &mut (**x.u).x; - | ^^^^^^^ help: try: `(*x.u)` + | ^^^^^^^ + | +help: try + | +LL | let _ = &mut (*x.u).x; + | ~~~~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:339:22 | LL | let _ = &mut (**{ x.u }).x; - | ^^^^^^^^^^^ help: try: `{ x.u }` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = &mut { x.u }.x; + | ~~~~~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:343:22 | LL | let _ = &mut (*x.u).x; - | ^^^^^^ help: try: `x.u` + | ^^^^^^ + | +help: try + | +LL | let _ = &mut x.u.x; + | ~~~ error: deref which would be done by auto-deref --> tests/ui/explicit_auto_deref.rs:344:22 | LL | let _ = &mut (*{ x.u }).x; - | ^^^^^^^^^^ help: try: `{ x.u }` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = &mut { x.u }.x; + | ~~~~~~~ error: aborting due to 45 previous errors diff --git a/src/tools/clippy/tests/ui/explicit_counter_loop.stderr b/src/tools/clippy/tests/ui/explicit_counter_loop.stderr index e28f8783f9c36..ac3c74cbca605 100644 --- a/src/tools/clippy/tests/ui/explicit_counter_loop.stderr +++ b/src/tools/clippy/tests/ui/explicit_counter_loop.stderr @@ -2,60 +2,103 @@ error: the variable `_index` is used as a loop counter --> tests/ui/explicit_counter_loop.rs:7:5 | LL | for _v in &vec { - | ^^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.iter().enumerate()` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::explicit-counter-loop` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::explicit_counter_loop)]` +help: consider using + | +LL | for (_index, _v) in vec.iter().enumerate() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: the variable `_index` is used as a loop counter --> tests/ui/explicit_counter_loop.rs:15:5 | LL | for _v in &vec { - | ^^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.iter().enumerate()` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | for (_index, _v) in vec.iter().enumerate() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: the variable `_index` is used as a loop counter --> tests/ui/explicit_counter_loop.rs:21:5 | LL | for _v in &mut vec { - | ^^^^^^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.iter_mut().enumerate()` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | for (_index, _v) in vec.iter_mut().enumerate() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: the variable `_index` is used as a loop counter --> tests/ui/explicit_counter_loop.rs:27:5 | LL | for _v in vec { - | ^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.into_iter().enumerate()` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | for (_index, _v) in vec.into_iter().enumerate() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: the variable `count` is used as a loop counter --> tests/ui/explicit_counter_loop.rs:115:9 | LL | for ch in text.chars() { - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (count, ch) in text.chars().enumerate()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | for (count, ch) in text.chars().enumerate() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: the variable `count` is used as a loop counter --> tests/ui/explicit_counter_loop.rs:127:9 | LL | for ch in text.chars() { - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (count, ch) in text.chars().enumerate()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | for (count, ch) in text.chars().enumerate() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: the variable `count` is used as a loop counter --> tests/ui/explicit_counter_loop.rs:186:9 | LL | for _i in 3..10 { - | ^^^^^^^^^^^^^^^ help: consider using: `for (count, _i) in (3..10).enumerate()` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | for (count, _i) in (3..10).enumerate() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: the variable `idx_usize` is used as a loop counter --> tests/ui/explicit_counter_loop.rs:227:9 | LL | for _item in slice { - | ^^^^^^^^^^^^^^^^^^ help: consider using: `for (idx_usize, _item) in slice.iter().enumerate()` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | for (idx_usize, _item) in slice.iter().enumerate() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: the variable `idx_u32` is used as a loop counter --> tests/ui/explicit_counter_loop.rs:240:9 | LL | for _item in slice { - | ^^^^^^^^^^^^^^^^^^ help: consider using: `for (idx_u32, _item) in (0_u32..).zip(slice.iter())` + | ^^^^^^^^^^^^^^^^^^ | = note: `idx_u32` is of type `u32`, making it ineligible for `Iterator::enumerate` +help: consider using + | +LL | for (idx_u32, _item) in (0_u32..).zip(slice.iter()) { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/explicit_deref_methods.stderr b/src/tools/clippy/tests/ui/explicit_deref_methods.stderr index aab862baf5991..4b7ecb3b38de5 100644 --- a/src/tools/clippy/tests/ui/explicit_deref_methods.stderr +++ b/src/tools/clippy/tests/ui/explicit_deref_methods.stderr @@ -2,76 +2,135 @@ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:54:19 | LL | let b: &str = a.deref(); - | ^^^^^^^^^ help: try: `&*a` + | ^^^^^^^^^ | = note: `-D clippy::explicit-deref-methods` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::explicit_deref_methods)]` +help: try + | +LL | let b: &str = &*a; + | ~~~ error: explicit `deref_mut` method call --> tests/ui/explicit_deref_methods.rs:56:23 | LL | let b: &mut str = a.deref_mut(); - | ^^^^^^^^^^^^^ help: try: `&mut **a` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let b: &mut str = &mut **a; + | ~~~~~~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:59:39 | LL | let b: String = format!("{}, {}", a.deref(), a.deref()); - | ^^^^^^^^^ help: try: `&*a` + | ^^^^^^^^^ + | +help: try + | +LL | let b: String = format!("{}, {}", &*a, a.deref()); + | ~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:59:50 | LL | let b: String = format!("{}, {}", a.deref(), a.deref()); - | ^^^^^^^^^ help: try: `&*a` + | ^^^^^^^^^ + | +help: try + | +LL | let b: String = format!("{}, {}", a.deref(), &*a); + | ~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:61:20 | LL | println!("{}", a.deref()); - | ^^^^^^^^^ help: try: `&*a` + | ^^^^^^^^^ + | +help: try + | +LL | println!("{}", &*a); + | ~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:64:11 | LL | match a.deref() { - | ^^^^^^^^^ help: try: `&*a` + | ^^^^^^^^^ + | +help: try + | +LL | match &*a { + | ~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:68:28 | LL | let b: String = concat(a.deref()); - | ^^^^^^^^^ help: try: `&*a` + | ^^^^^^^^^ + | +help: try + | +LL | let b: String = concat(&*a); + | ~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:70:13 | LL | let b = just_return(a).deref(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `just_return(a)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let b = just_return(a); + | ~~~~~~~~~~~~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:72:28 | LL | let b: String = concat(just_return(a).deref()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `just_return(a)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let b: String = concat(just_return(a)); + | ~~~~~~~~~~~~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:74:19 | LL | let b: &str = a.deref().deref(); - | ^^^^^^^^^^^^^^^^^ help: try: `&**a` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let b: &str = &**a; + | ~~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:77:13 | LL | let b = opt_a.unwrap().deref(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*opt_a.unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let b = &*opt_a.unwrap(); + | ~~~~~~~~~~~~~~~~ error: explicit `deref` method call --> tests/ui/explicit_deref_methods.rs:114:31 | LL | let b: &str = expr_deref!(a.deref()); - | ^^^^^^^^^ help: try: `&*a` + | ^^^^^^^^^ + | +help: try + | +LL | let b: &str = expr_deref!(&*a); + | ~~~ error: aborting due to 12 previous errors diff --git a/src/tools/clippy/tests/ui/explicit_into_iter_loop.stderr b/src/tools/clippy/tests/ui/explicit_into_iter_loop.stderr index f0e2048e036f5..c9668cf9449f6 100644 --- a/src/tools/clippy/tests/ui/explicit_into_iter_loop.stderr +++ b/src/tools/clippy/tests/ui/explicit_into_iter_loop.stderr @@ -2,40 +2,69 @@ error: it is more concise to loop over containers instead of using explicit iter --> tests/ui/explicit_into_iter_loop.rs:10:18 | LL | for _ in iterator.into_iter() {} - | ^^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `iterator` + | ^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::explicit-into-iter-loop` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::explicit_into_iter_loop)]` +help: to write this more concisely, try + | +LL | for _ in iterator {} + | ~~~~~~~~ error: it is more concise to loop over containers instead of using explicit iteration methods --> tests/ui/explicit_into_iter_loop.rs:23:14 | LL | for _ in t.into_iter() {} - | ^^^^^^^^^^^^^ help: to write this more concisely, try: `&t` + | ^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &t {} + | ~~ error: it is more concise to loop over containers instead of using explicit iteration methods --> tests/ui/explicit_into_iter_loop.rs:26:14 | LL | for _ in r.into_iter() {} - | ^^^^^^^^^^^^^ help: to write this more concisely, try: `r` + | ^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in r {} + | ~ error: it is more concise to loop over containers instead of using explicit iteration methods --> tests/ui/explicit_into_iter_loop.rs:34:14 | LL | for _ in mr.into_iter() {} - | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&*mr` + | ^^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &*mr {} + | ~~~~ error: it is more concise to loop over containers instead of using explicit iteration methods --> tests/ui/explicit_into_iter_loop.rs:46:14 | LL | for _ in u.into_iter() {} - | ^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut u` + | ^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &mut u {} + | ~~~~~~ error: it is more concise to loop over containers instead of using explicit iteration methods --> tests/ui/explicit_into_iter_loop.rs:49:14 | LL | for _ in mr.into_iter() {} - | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut *mr` + | ^^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &mut *mr {} + | ~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/explicit_iter_loop.stderr b/src/tools/clippy/tests/ui/explicit_iter_loop.stderr index c646e61aa0456..c7cb00e6f3da3 100644 --- a/src/tools/clippy/tests/ui/explicit_iter_loop.stderr +++ b/src/tools/clippy/tests/ui/explicit_iter_loop.stderr @@ -2,115 +2,204 @@ error: it is more concise to loop over references to containers instead of using --> tests/ui/explicit_iter_loop.rs:18:14 | LL | for _ in vec.iter() {} - | ^^^^^^^^^^ help: to write this more concisely, try: `&vec` + | ^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/explicit_iter_loop.rs:1:9 | LL | #![deny(clippy::explicit_iter_loop)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: to write this more concisely, try + | +LL | for _ in &vec {} + | ~~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:19:14 | LL | for _ in vec.iter_mut() {} - | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec` + | ^^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &mut vec {} + | ~~~~~~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:22:14 | LL | for _ in rvec.iter() {} - | ^^^^^^^^^^^ help: to write this more concisely, try: `rvec` + | ^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in rvec {} + | ~~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:31:14 | LL | for _ in [1, 2, 3].iter() {} - | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]` + | ^^^^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &[1, 2, 3] {} + | ~~~~~~~~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:35:14 | LL | for _ in [0; 32].iter() {} - | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]` + | ^^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &[0; 32] {} + | ~~~~~~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:36:14 | LL | for _ in [0; 33].iter() {} - | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 33]` + | ^^^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &[0; 33] {} + | ~~~~~~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:39:14 | LL | for _ in ll.iter() {} - | ^^^^^^^^^ help: to write this more concisely, try: `&ll` + | ^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &ll {} + | ~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:41:14 | LL | for _ in rll.iter() {} - | ^^^^^^^^^^ help: to write this more concisely, try: `rll` + | ^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in rll {} + | ~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:44:14 | LL | for _ in vd.iter() {} - | ^^^^^^^^^ help: to write this more concisely, try: `&vd` + | ^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &vd {} + | ~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:46:14 | LL | for _ in rvd.iter() {} - | ^^^^^^^^^^ help: to write this more concisely, try: `rvd` + | ^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in rvd {} + | ~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:49:14 | LL | for _ in bh.iter() {} - | ^^^^^^^^^ help: to write this more concisely, try: `&bh` + | ^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &bh {} + | ~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:52:14 | LL | for _ in hm.iter() {} - | ^^^^^^^^^ help: to write this more concisely, try: `&hm` + | ^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &hm {} + | ~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:55:14 | LL | for _ in bt.iter() {} - | ^^^^^^^^^ help: to write this more concisely, try: `&bt` + | ^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &bt {} + | ~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:58:14 | LL | for _ in hs.iter() {} - | ^^^^^^^^^ help: to write this more concisely, try: `&hs` + | ^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &hs {} + | ~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:61:14 | LL | for _ in bs.iter() {} - | ^^^^^^^^^ help: to write this more concisely, try: `&bs` + | ^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &bs {} + | ~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:150:14 | LL | for _ in x.iter() {} - | ^^^^^^^^ help: to write this more concisely, try: `&x` + | ^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &x {} + | ~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:151:14 | LL | for _ in x.iter_mut() {} - | ^^^^^^^^^^^^ help: to write this more concisely, try: `&mut x` + | ^^^^^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in &mut x {} + | ~~~~~~ error: it is more concise to loop over references to containers instead of using explicit iteration methods --> tests/ui/explicit_iter_loop.rs:154:14 | LL | for _ in r.iter() {} - | ^^^^^^^^ help: to write this more concisely, try: `r` + | ^^^^^^^^ + | +help: to write this more concisely, try + | +LL | for _ in r {} + | ~ error: aborting due to 18 previous errors diff --git a/src/tools/clippy/tests/ui/explicit_write.stderr b/src/tools/clippy/tests/ui/explicit_write.stderr index 0d22f02c36f2e..d32f0d434e5f8 100644 --- a/src/tools/clippy/tests/ui/explicit_write.stderr +++ b/src/tools/clippy/tests/ui/explicit_write.stderr @@ -2,82 +2,146 @@ error: use of `write!(stdout(), ...).unwrap()` --> tests/ui/explicit_write.rs:23:9 | LL | write!(std::io::stdout(), "test").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `print!("test")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::explicit-write` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::explicit_write)]` +help: try + | +LL | print!("test"); + | ~~~~~~~~~~~~~~ error: use of `write!(stderr(), ...).unwrap()` --> tests/ui/explicit_write.rs:24:9 | LL | write!(std::io::stderr(), "test").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprint!("test")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | eprint!("test"); + | ~~~~~~~~~~~~~~~ error: use of `writeln!(stdout(), ...).unwrap()` --> tests/ui/explicit_write.rs:25:9 | LL | writeln!(std::io::stdout(), "test").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `println!("test")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | println!("test"); + | ~~~~~~~~~~~~~~~~ error: use of `writeln!(stderr(), ...).unwrap()` --> tests/ui/explicit_write.rs:26:9 | LL | writeln!(std::io::stderr(), "test").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprintln!("test")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | eprintln!("test"); + | ~~~~~~~~~~~~~~~~~ error: use of `stdout().write_fmt(...).unwrap()` --> tests/ui/explicit_write.rs:27:9 | LL | std::io::stdout().write_fmt(format_args!("test")).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `print!("test")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | print!("test"); + | ~~~~~~~~~~~~~~ error: use of `stderr().write_fmt(...).unwrap()` --> tests/ui/explicit_write.rs:28:9 | LL | std::io::stderr().write_fmt(format_args!("test")).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprint!("test")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | eprint!("test"); + | ~~~~~~~~~~~~~~~ error: use of `writeln!(stdout(), ...).unwrap()` --> tests/ui/explicit_write.rs:31:9 | LL | writeln!(std::io::stdout(), "test\ntest").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `println!("test\ntest")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | println!("test\ntest"); + | ~~~~~~~~~~~~~~~~~~~~~~ error: use of `writeln!(stderr(), ...).unwrap()` --> tests/ui/explicit_write.rs:32:9 | LL | writeln!(std::io::stderr(), "test\ntest").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprintln!("test\ntest")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | eprintln!("test\ntest"); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: use of `writeln!(stderr(), ...).unwrap()` --> tests/ui/explicit_write.rs:35:9 | LL | writeln!(std::io::stderr(), "with {}", value).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprintln!("with {}", value)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | eprintln!("with {}", value); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `writeln!(stderr(), ...).unwrap()` --> tests/ui/explicit_write.rs:36:9 | LL | writeln!(std::io::stderr(), "with {} {}", 2, value).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprintln!("with {} {}", 2, value)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | eprintln!("with {} {}", 2, value); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `writeln!(stderr(), ...).unwrap()` --> tests/ui/explicit_write.rs:37:9 | LL | writeln!(std::io::stderr(), "with {value}").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprintln!("with {value}")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | eprintln!("with {value}"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `writeln!(stderr(), ...).unwrap()` --> tests/ui/explicit_write.rs:38:9 | LL | writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprintln!("macro arg {}", one!())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | eprintln!("macro arg {}", one!()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `writeln!(stderr(), ...).unwrap()` --> tests/ui/explicit_write.rs:40:9 | LL | writeln!(std::io::stderr(), "{:w$}", value, w = width).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprintln!("{:w$}", value, w = width)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | eprintln!("{:w$}", value, w = width); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/extend_with_drain.stderr b/src/tools/clippy/tests/ui/extend_with_drain.stderr index 444cc82bbae7c..7e356c9196d5f 100644 --- a/src/tools/clippy/tests/ui/extend_with_drain.stderr +++ b/src/tools/clippy/tests/ui/extend_with_drain.stderr @@ -2,28 +2,47 @@ error: use of `extend` instead of `append` for adding the full range of a second --> tests/ui/extend_with_drain.rs:8:5 | LL | vec2.extend(vec1.drain(..)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec2.append(&mut vec1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::extend-with-drain` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::extend_with_drain)]` +help: try + | +LL | vec2.append(&mut vec1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: use of `extend` instead of `append` for adding the full range of a second vector --> tests/ui/extend_with_drain.rs:13:5 | LL | vec4.extend(vec3.drain(..)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec4.append(&mut vec3)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec4.append(&mut vec3); + | ~~~~~~~~~~~~~~~~~~~~~~ error: use of `extend` instead of `append` for adding the full range of a second vector --> tests/ui/extend_with_drain.rs:17:5 | LL | vec11.extend(return_vector().drain(..)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec11.append(&mut return_vector())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec11.append(&mut return_vector()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `extend` instead of `append` for adding the full range of a second vector --> tests/ui/extend_with_drain.rs:48:5 | LL | y.extend(ref_x.drain(..)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `y.append(ref_x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | y.append(ref_x); + | ~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/extra_unused_type_parameters.stderr b/src/tools/clippy/tests/ui/extra_unused_type_parameters.stderr index 928c0038c2c3d..62a0f0620b16e 100644 --- a/src/tools/clippy/tests/ui/extra_unused_type_parameters.stderr +++ b/src/tools/clippy/tests/ui/extra_unused_type_parameters.stderr @@ -2,22 +2,39 @@ error: type parameter `T` goes unused in function definition --> tests/ui/extra_unused_type_parameters.rs:9:13 | LL | fn unused_ty(x: u8) { - | ^^^ help: consider removing the parameter + | ^^^ | = note: `-D clippy::extra-unused-type-parameters` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::extra_unused_type_parameters)]` +help: consider removing the parameter + | +LL - fn unused_ty(x: u8) { +LL + fn unused_ty(x: u8) { + | error: type parameters go unused in function definition: T, U --> tests/ui/extra_unused_type_parameters.rs:13:16 | LL | fn unused_multi(x: u8) { - | ^^^^^^ help: consider removing the parameters + | ^^^^^^ + | +help: consider removing the parameters + | +LL - fn unused_multi(x: u8) { +LL + fn unused_multi(x: u8) { + | error: type parameter `T` goes unused in function definition --> tests/ui/extra_unused_type_parameters.rs:17:21 | LL | fn unused_with_lt<'a, T>(x: &'a u8) { - | ^^^ help: consider removing the parameter + | ^^^ + | +help: consider removing the parameter + | +LL - fn unused_with_lt<'a, T>(x: &'a u8) { +LL + fn unused_with_lt<'a>(x: &'a u8) { + | error: type parameters go unused in function definition: T, V --> tests/ui/extra_unused_type_parameters.rs:29:19 @@ -47,19 +64,37 @@ error: type parameter `T` goes unused in function definition --> tests/ui/extra_unused_type_parameters.rs:58:22 | LL | fn unused_ty_impl(&self) { - | ^^^ help: consider removing the parameter + | ^^^ + | +help: consider removing the parameter + | +LL - fn unused_ty_impl(&self) { +LL + fn unused_ty_impl(&self) { + | error: type parameters go unused in function definition: A, B --> tests/ui/extra_unused_type_parameters.rs:80:17 | LL | fn unused_opaque(dummy: impl Default) { - | ^^^^^^ help: consider removing the parameters + | ^^^^^^ + | +help: consider removing the parameters + | +LL - fn unused_opaque(dummy: impl Default) { +LL + fn unused_opaque(dummy: impl Default) { + | error: type parameter `U` goes unused in function definition --> tests/ui/extra_unused_type_parameters.rs:93:56 | LL | fn unused_with_priv_trait_bound() { - | ^^^ help: consider removing the parameter + | ^^^ + | +help: consider removing the parameter + | +LL - fn unused_with_priv_trait_bound() { +LL + fn unused_with_priv_trait_bound() { + | error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/filter_map_bool_then.stderr b/src/tools/clippy/tests/ui/filter_map_bool_then.stderr index 088b9ba128675..8eb8495899851 100644 --- a/src/tools/clippy/tests/ui/filter_map_bool_then.stderr +++ b/src/tools/clippy/tests/ui/filter_map_bool_then.stderr @@ -2,64 +2,113 @@ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:19:22 | LL | v.clone().iter().filter_map(|i| (i % 2 == 0).then(|| i + 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&i| (i % 2 == 0)).map(|i| i + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::filter-map-bool-then` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::filter_map_bool_then)]` +help: use `filter` then `map` instead + | +LL | v.clone().iter().filter(|&i| (i % 2 == 0)).map(|i| i + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:20:27 | LL | v.clone().into_iter().filter_map(|i| (i % 2 == 0).then(|| i + 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&i| (i % 2 == 0)).map(|i| i + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `filter` then `map` instead + | +LL | v.clone().into_iter().filter(|&i| (i % 2 == 0)).map(|i| i + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:23:10 | LL | .filter_map(|i| -> Option<_> { (i % 2 == 0).then(|| i + 1) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&i| (i % 2 == 0)).map(|i| i + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `filter` then `map` instead + | +LL | .filter(|&i| (i % 2 == 0)).map(|i| i + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:27:10 | LL | .filter_map(|i| (i % 2 == 0).then(|| i + 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&i| (i % 2 == 0)).map(|i| i + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `filter` then `map` instead + | +LL | .filter(|&i| (i % 2 == 0)).map(|i| i + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:31:10 | LL | .filter_map(|i| (i.clone() % 2 == 0).then(|| i + 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&i| (i.clone() % 2 == 0)).map(|i| i + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `filter` then `map` instead + | +LL | .filter(|&i| (i.clone() % 2 == 0)).map(|i| i + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:37:22 | LL | v.clone().iter().filter_map(|i| (i == &NonCopy).then(|| i)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&i| (i == &NonCopy)).map(|i| i)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `filter` then `map` instead + | +LL | v.clone().iter().filter(|&i| (i == &NonCopy)).map(|i| i); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:61:50 | LL | let _: Vec = bools.iter().enumerate().filter_map(|(i, b)| b.then(|| i)).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&(i, b)| *b).map(|(i, b)| i)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `filter` then `map` instead + | +LL | let _: Vec = bools.iter().enumerate().filter(|&(i, b)| *b).map(|(i, b)| i).collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:65:50 | LL | let _: Vec = bools.iter().enumerate().filter_map(|(i, b)| b.then(|| i)).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&(i, b)| ***b).map(|(i, b)| i)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `filter` then `map` instead + | +LL | let _: Vec = bools.iter().enumerate().filter(|&(i, b)| ***b).map(|(i, b)| i).collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:69:50 | LL | let _: Vec = bools.iter().enumerate().filter_map(|(i, b)| b.then(|| i)).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&(i, b)| **b).map(|(i, b)| i)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `filter` then `map` instead + | +LL | let _: Vec = bools.iter().enumerate().filter(|&(i, b)| **b).map(|(i, b)| i).collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `bool::then` in `filter_map` --> tests/ui/filter_map_bool_then.rs:80:50 | LL | let _: Vec = bools.iter().enumerate().filter_map(|(i, b)| b.then(|| i)).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `filter` then `map` instead: `filter(|&(i, b)| ****b).map(|(i, b)| i)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `filter` then `map` instead + | +LL | let _: Vec = bools.iter().enumerate().filter(|&(i, b)| ****b).map(|(i, b)| i).collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/filter_map_identity.stderr b/src/tools/clippy/tests/ui/filter_map_identity.stderr index 55068db4e9d03..58132a16f153f 100644 --- a/src/tools/clippy/tests/ui/filter_map_identity.stderr +++ b/src/tools/clippy/tests/ui/filter_map_identity.stderr @@ -2,136 +2,245 @@ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:28:45 | LL | copy_vec_non_inferred().into_iter().filter_map(|x| x); - | ^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::filter-map-identity` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::filter_map_identity)]` +help: try + | +LL | copy_vec_non_inferred().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:30:45 | LL | copy_vec_non_inferred().into_iter().filter_map(std::convert::identity); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec_non_inferred().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:32:45 | LL | copy_vec_non_inferred().into_iter().filter_map(identity); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec_non_inferred().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:34:45 | LL | copy_vec_non_inferred().into_iter().filter_map(|x| return x); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec_non_inferred().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:36:45 | LL | copy_vec_non_inferred().into_iter().filter_map(|x| return x); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec_non_inferred().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:39:36 | LL | non_copy_vec().into_iter().filter_map(|x| x); - | ^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | non_copy_vec().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:41:36 | LL | non_copy_vec().into_iter().filter_map(|x| x); - | ^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | non_copy_vec().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:44:36 | LL | non_copy_vec().into_iter().filter_map(std::convert::identity); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | non_copy_vec().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:46:36 | LL | non_copy_vec().into_iter().filter_map(identity); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | non_copy_vec().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:48:36 | LL | non_copy_vec().into_iter().filter_map(|x| return x); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | non_copy_vec().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:50:36 | LL | non_copy_vec().into_iter().filter_map(|x| return x); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | non_copy_vec().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:53:39 | LL | copy_vec::().into_iter().filter_map(|x: Option<_>| x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:55:39 | LL | copy_vec::().into_iter().filter_map(|x: Option<_>| x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:57:39 | LL | copy_vec::().into_iter().filter_map(|x: Option<_>| return x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:59:39 | LL | copy_vec::().into_iter().filter_map(|x: Option<_>| return x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:63:39 | LL | copy_vec::().into_iter().filter_map(|x: Option| x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:65:39 | LL | copy_vec::().into_iter().filter_map(|x: Option| x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:67:39 | LL | copy_vec::().into_iter().filter_map(|x: Option| return x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:69:39 | LL | copy_vec::().into_iter().filter_map(|x: Option| return x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:72:43 | LL | copy_vec::().into_iter().filter_map(|x: Option| -> Option {{ x }}); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:75:43 | LL | copy_vec::().into_iter().filter_map(|x: Option| -> Option {{ return x }}); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | copy_vec::().into_iter().flatten(); + | ~~~~~~~~~ error: use of `filter_map` with an identity function --> tests/ui/filter_map_identity.rs:80:37 | LL | opaque::().into_iter().filter_map(|x| x); - | ^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | opaque::().into_iter().flatten(); + | ~~~~~~~~~ error: aborting due to 22 previous errors diff --git a/src/tools/clippy/tests/ui/filter_map_next_fixable.stderr b/src/tools/clippy/tests/ui/filter_map_next_fixable.stderr index 2c6148f3f4b6b..01124242afa37 100644 --- a/src/tools/clippy/tests/ui/filter_map_next_fixable.stderr +++ b/src/tools/clippy/tests/ui/filter_map_next_fixable.stderr @@ -2,16 +2,25 @@ error: called `filter_map(..).next()` on an `Iterator`. This is more succinctly --> tests/ui/filter_map_next_fixable.rs:7:32 | LL | let element: Option = a.iter().filter_map(|s| s.parse().ok()).next(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.iter().find_map(|s| s.parse().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::filter-map-next` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::filter_map_next)]` +help: try + | +LL | let element: Option = a.iter().find_map(|s| s.parse().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead --> tests/ui/filter_map_next_fixable.rs:20:26 | LL | let _: Option = a.iter().filter_map(|s| s.parse().ok()).next(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.iter().find_map(|s| s.parse().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: Option = a.iter().find_map(|s| s.parse().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/flat_map_identity.stderr b/src/tools/clippy/tests/ui/flat_map_identity.stderr index 496fd972a498f..767db2b95d1ae 100644 --- a/src/tools/clippy/tests/ui/flat_map_identity.stderr +++ b/src/tools/clippy/tests/ui/flat_map_identity.stderr @@ -2,22 +2,36 @@ error: use of `flat_map` with an identity function --> tests/ui/flat_map_identity.rs:8:22 | LL | let _ = iterator.flat_map(|x| x); - | ^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::flat-map-identity` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::flat_map_identity)]` +help: try + | +LL | let _ = iterator.flatten(); + | ~~~~~~~~~ error: use of `flat_map` with an identity function --> tests/ui/flat_map_identity.rs:11:22 | LL | let _ = iterator.flat_map(convert::identity); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = iterator.flatten(); + | ~~~~~~~~~ error: use of `flat_map` with an identity function --> tests/ui/flat_map_identity.rs:14:22 | LL | let _ = iterator.flat_map(|x| return x); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = iterator.flatten(); + | ~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/flat_map_option.stderr b/src/tools/clippy/tests/ui/flat_map_option.stderr index 6e151965fad53..647d9edfe980d 100644 --- a/src/tools/clippy/tests/ui/flat_map_option.stderr +++ b/src/tools/clippy/tests/ui/flat_map_option.stderr @@ -2,16 +2,25 @@ error: used `flat_map` where `filter_map` could be used instead --> tests/ui/flat_map_option.rs:7:24 | LL | let _ = [1].iter().flat_map(c); - | ^^^^^^^^ help: try: `filter_map` + | ^^^^^^^^ | = note: `-D clippy::flat-map-option` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::flat_map_option)]` +help: try + | +LL | let _ = [1].iter().filter_map(c); + | ~~~~~~~~~~ error: used `flat_map` where `filter_map` could be used instead --> tests/ui/flat_map_option.rs:8:24 | LL | let _ = [1].iter().flat_map(Some); - | ^^^^^^^^ help: try: `filter_map` + | ^^^^^^^^ + | +help: try + | +LL | let _ = [1].iter().filter_map(Some); + | ~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/float_cmp.stderr b/src/tools/clippy/tests/ui/float_cmp.stderr index c8a0bde6e63a8..265d5dff3ef62 100644 --- a/src/tools/clippy/tests/ui/float_cmp.stderr +++ b/src/tools/clippy/tests/ui/float_cmp.stderr @@ -2,35 +2,51 @@ error: strict comparison of `f32` or `f64` --> tests/ui/float_cmp.rs:72:5 | LL | ONE as f64 != 2.0; - | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(ONE as f64 - 2.0).abs() > error_margin` + | ^^^^^^^^^^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = note: `-D clippy::float-cmp` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::float_cmp)]` +help: consider comparing them within some margin of error + | +LL | (ONE as f64 - 2.0).abs() > error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` --> tests/ui/float_cmp.rs:79:5 | LL | x == 1.0; - | ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 1.0).abs() < error_margin` + | ^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (x - 1.0).abs() < error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` --> tests/ui/float_cmp.rs:84:5 | LL | twice(x) != twice(ONE as f64); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(twice(x) - twice(ONE as f64)).abs() > error_margin` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (twice(x) - twice(ONE as f64)).abs() > error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` --> tests/ui/float_cmp.rs:106:5 | LL | NON_ZERO_ARRAY[i] == NON_ZERO_ARRAY[j]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(NON_ZERO_ARRAY[i] - NON_ZERO_ARRAY[j]).abs() < error_margin` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (NON_ZERO_ARRAY[i] - NON_ZERO_ARRAY[j]).abs() < error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` arrays --> tests/ui/float_cmp.rs:113:5 @@ -44,9 +60,13 @@ error: strict comparison of `f32` or `f64` --> tests/ui/float_cmp.rs:116:5 | LL | a1[0] == a2[0]; - | ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(a1[0] - a2[0]).abs() < error_margin` + | ^^^^^^^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (a1[0] - a2[0]).abs() < error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/float_cmp_const.stderr b/src/tools/clippy/tests/ui/float_cmp_const.stderr index bffd2acc2e049..442a2152ec0a0 100644 --- a/src/tools/clippy/tests/ui/float_cmp_const.stderr +++ b/src/tools/clippy/tests/ui/float_cmp_const.stderr @@ -2,59 +2,87 @@ error: strict comparison of `f32` or `f64` constant --> tests/ui/float_cmp_const.rs:16:5 | LL | 1f32 == ONE; - | ^^^^^^^^^^^ help: consider comparing them within some margin of error: `(1f32 - ONE).abs() < error_margin` + | ^^^^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = note: `-D clippy::float-cmp-const` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::float_cmp_const)]` +help: consider comparing them within some margin of error + | +LL | (1f32 - ONE).abs() < error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` constant --> tests/ui/float_cmp_const.rs:19:5 | LL | TWO == ONE; - | ^^^^^^^^^^ help: consider comparing them within some margin of error: `(TWO - ONE).abs() < error_margin` + | ^^^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (TWO - ONE).abs() < error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` constant --> tests/ui/float_cmp_const.rs:22:5 | LL | TWO != ONE; - | ^^^^^^^^^^ help: consider comparing them within some margin of error: `(TWO - ONE).abs() > error_margin` + | ^^^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (TWO - ONE).abs() > error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` constant --> tests/ui/float_cmp_const.rs:25:5 | LL | ONE + ONE == TWO; - | ^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(ONE + ONE - TWO).abs() < error_margin` + | ^^^^^^^^^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (ONE + ONE - TWO).abs() < error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` constant --> tests/ui/float_cmp_const.rs:29:5 | LL | x as f32 == ONE; - | ^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x as f32 - ONE).abs() < error_margin` + | ^^^^^^^^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (x as f32 - ONE).abs() < error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` constant --> tests/ui/float_cmp_const.rs:34:5 | LL | v == ONE; - | ^^^^^^^^ help: consider comparing them within some margin of error: `(v - ONE).abs() < error_margin` + | ^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (v - ONE).abs() < error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` constant --> tests/ui/float_cmp_const.rs:37:5 | LL | v != ONE; - | ^^^^^^^^ help: consider comparing them within some margin of error: `(v - ONE).abs() > error_margin` + | ^^^^^^^^ | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` +help: consider comparing them within some margin of error + | +LL | (v - ONE).abs() > error_margin; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: strict comparison of `f32` or `f64` constant arrays --> tests/ui/float_cmp_const.rs:71:5 diff --git a/src/tools/clippy/tests/ui/float_equality_without_abs.stderr b/src/tools/clippy/tests/ui/float_equality_without_abs.stderr index cdaaf0cdbcf7e..5906bf1681aed 100644 --- a/src/tools/clippy/tests/ui/float_equality_without_abs.stderr +++ b/src/tools/clippy/tests/ui/float_equality_without_abs.stderr @@ -2,92 +2,124 @@ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:7:5 | LL | (a - b) < f32::EPSILON - | -------^^^^^^^^^^^^^^^ - | | - | help: add `.abs()`: `(a - b).abs()` + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::float-equality-without-abs` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::float_equality_without_abs)]` +help: add `.abs()` + | +LL | (a - b).abs() < f32::EPSILON + | ~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:18:13 | LL | let _ = (a - b) < f32::EPSILON; - | -------^^^^^^^^^^^^^^^ - | | - | help: add `.abs()`: `(a - b).abs()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = (a - b).abs() < f32::EPSILON; + | ~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:20:13 | LL | let _ = a - b < f32::EPSILON; - | -----^^^^^^^^^^^^^^^ - | | - | help: add `.abs()`: `(a - b).abs()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = (a - b).abs() < f32::EPSILON; + | ~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:22:13 | LL | let _ = a - b.abs() < f32::EPSILON; - | -----------^^^^^^^^^^^^^^^ - | | - | help: add `.abs()`: `(a - b.abs()).abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = (a - b.abs()).abs() < f32::EPSILON; + | ~~~~~~~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:24:13 | LL | let _ = (a as f64 - b as f64) < f64::EPSILON; - | ---------------------^^^^^^^^^^^^^^^ - | | - | help: add `.abs()`: `(a as f64 - b as f64).abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = (a as f64 - b as f64).abs() < f64::EPSILON; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:26:13 | LL | let _ = 1.0 - 2.0 < f32::EPSILON; - | ---------^^^^^^^^^^^^^^^ - | | - | help: add `.abs()`: `(1.0 - 2.0).abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = (1.0 - 2.0).abs() < f32::EPSILON; + | ~~~~~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:29:13 | LL | let _ = f32::EPSILON > (a - b); - | ^^^^^^^^^^^^^^^------- - | | - | help: add `.abs()`: `(a - b).abs()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = f32::EPSILON > (a - b).abs(); + | ~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:31:13 | LL | let _ = f32::EPSILON > a - b; - | ^^^^^^^^^^^^^^^----- - | | - | help: add `.abs()`: `(a - b).abs()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = f32::EPSILON > (a - b).abs(); + | ~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:33:13 | LL | let _ = f32::EPSILON > a - b.abs(); - | ^^^^^^^^^^^^^^^----------- - | | - | help: add `.abs()`: `(a - b.abs()).abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = f32::EPSILON > (a - b.abs()).abs(); + | ~~~~~~~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:35:13 | LL | let _ = f64::EPSILON > (a as f64 - b as f64); - | ^^^^^^^^^^^^^^^--------------------- - | | - | help: add `.abs()`: `(a as f64 - b as f64).abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = f64::EPSILON > (a as f64 - b as f64).abs(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: float equality check without `.abs()` --> tests/ui/float_equality_without_abs.rs:37:13 | LL | let _ = f32::EPSILON > 1.0 - 2.0; - | ^^^^^^^^^^^^^^^--------- - | | - | help: add `.abs()`: `(1.0 - 2.0).abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `.abs()` + | +LL | let _ = f32::EPSILON > (1.0 - 2.0).abs(); + | ~~~~~~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/floating_point_abs.stderr b/src/tools/clippy/tests/ui/floating_point_abs.stderr index f5a778c5b7650..1b1ecca77ed35 100644 --- a/src/tools/clippy/tests/ui/floating_point_abs.stderr +++ b/src/tools/clippy/tests/ui/floating_point_abs.stderr @@ -2,52 +2,91 @@ error: manual implementation of `abs` method --> tests/ui/floating_point_abs.rs:15:5 | LL | if num >= 0.0 { num } else { -num } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::suboptimal-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]` +help: try + | +LL | num.abs() + | error: manual implementation of `abs` method --> tests/ui/floating_point_abs.rs:19:5 | LL | if 0.0 < num { num } else { -num } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | num.abs() + | error: manual implementation of `abs` method --> tests/ui/floating_point_abs.rs:23:5 | LL | if a.a > 0.0 { a.a } else { -a.a } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.a.abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | a.a.abs() + | error: manual implementation of `abs` method --> tests/ui/floating_point_abs.rs:27:5 | LL | if 0.0 >= num { -num } else { num } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | num.abs() + | error: manual implementation of `abs` method --> tests/ui/floating_point_abs.rs:31:5 | LL | if a.a < 0.0 { -a.a } else { a.a } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.a.abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | a.a.abs() + | error: manual implementation of negation of `abs` method --> tests/ui/floating_point_abs.rs:35:5 | LL | if num < 0.0 { num } else { -num } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | -num.abs() + | error: manual implementation of negation of `abs` method --> tests/ui/floating_point_abs.rs:39:5 | LL | if 0.0 >= num { num } else { -num } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | -num.abs() + | error: manual implementation of negation of `abs` method --> tests/ui/floating_point_abs.rs:44:12 | LL | a: if a.a >= 0.0 { -a.a } else { a.a }, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-a.a.abs()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | a: -a.a.abs(), + | ~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/floating_point_exp.stderr b/src/tools/clippy/tests/ui/floating_point_exp.stderr index 6ce67254abc96..d60859348e00e 100644 --- a/src/tools/clippy/tests/ui/floating_point_exp.stderr +++ b/src/tools/clippy/tests/ui/floating_point_exp.stderr @@ -2,34 +2,58 @@ error: (e.pow(x) - 1) can be computed more accurately --> tests/ui/floating_point_exp.rs:8:13 | LL | let _ = x.exp() - 1.0; - | ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()` + | ^^^^^^^^^^^^^ | = note: `-D clippy::imprecise-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::imprecise_flops)]` +help: consider using + | +LL | let _ = x.exp_m1(); + | ~~~~~~~~~~ error: (e.pow(x) - 1) can be computed more accurately --> tests/ui/floating_point_exp.rs:9:13 | LL | let _ = x.exp() - 1.0 + 2.0; - | ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.exp_m1() + 2.0; + | ~~~~~~~~~~ error: (e.pow(x) - 1) can be computed more accurately --> tests/ui/floating_point_exp.rs:10:13 | LL | let _ = (x as f32).exp() - 1.0 + 2.0; - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).exp_m1()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x as f32).exp_m1() + 2.0; + | ~~~~~~~~~~~~~~~~~~~ error: (e.pow(x) - 1) can be computed more accurately --> tests/ui/floating_point_exp.rs:16:13 | LL | let _ = x.exp() - 1.0; - | ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.exp_m1(); + | ~~~~~~~~~~ error: (e.pow(x) - 1) can be computed more accurately --> tests/ui/floating_point_exp.rs:17:13 | LL | let _ = x.exp() - 1.0 + 2.0; - | ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.exp_m1() + 2.0; + | ~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/floating_point_hypot.stderr b/src/tools/clippy/tests/ui/floating_point_hypot.stderr index 8942e86910da1..fd4fc51c8d833 100644 --- a/src/tools/clippy/tests/ui/floating_point_hypot.stderr +++ b/src/tools/clippy/tests/ui/floating_point_hypot.stderr @@ -2,22 +2,36 @@ error: hypotenuse can be computed more accurately --> tests/ui/floating_point_hypot.rs:6:13 | LL | let _ = (x * x + y * y).sqrt(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.hypot(y)` + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::imprecise-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::imprecise_flops)]` +help: consider using + | +LL | let _ = x.hypot(y); + | ~~~~~~~~~~ error: hypotenuse can be computed more accurately --> tests/ui/floating_point_hypot.rs:7:13 | LL | let _ = ((x + 1f32) * (x + 1f32) + y * y).sqrt(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x + 1f32).hypot(y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x + 1f32).hypot(y); + | ~~~~~~~~~~~~~~~~~~~ error: hypotenuse can be computed more accurately --> tests/ui/floating_point_hypot.rs:8:13 | LL | let _ = (x.powi(2) + y.powi(2)).sqrt(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.hypot(y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.hypot(y); + | ~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/floating_point_log.stderr b/src/tools/clippy/tests/ui/floating_point_log.stderr index 19c28de8e39a1..372195952ea07 100644 --- a/src/tools/clippy/tests/ui/floating_point_log.stderr +++ b/src/tools/clippy/tests/ui/floating_point_log.stderr @@ -2,181 +2,324 @@ error: logarithm for bases 2, 10 and e can be computed more accurately --> tests/ui/floating_point_log.rs:11:13 | LL | let _ = x.log(2f32); - | ^^^^^^^^^^^ help: consider using: `x.log2()` + | ^^^^^^^^^^^ | = note: `-D clippy::suboptimal-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]` +help: consider using + | +LL | let _ = x.log2(); + | ~~~~~~~~ error: logarithm for bases 2, 10 and e can be computed more accurately --> tests/ui/floating_point_log.rs:12:13 | LL | let _ = x.log(10f32); - | ^^^^^^^^^^^^ help: consider using: `x.log10()` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.log10(); + | ~~~~~~~~~ error: logarithm for bases 2, 10 and e can be computed more accurately --> tests/ui/floating_point_log.rs:13:13 | LL | let _ = x.log(std::f32::consts::E); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.ln()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.ln(); + | ~~~~~~ error: logarithm for bases 2, 10 and e can be computed more accurately --> tests/ui/floating_point_log.rs:14:13 | LL | let _ = x.log(TWO); - | ^^^^^^^^^^ help: consider using: `x.log2()` + | ^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.log2(); + | ~~~~~~~~ error: logarithm for bases 2, 10 and e can be computed more accurately --> tests/ui/floating_point_log.rs:15:13 | LL | let _ = x.log(E); - | ^^^^^^^^ help: consider using: `x.ln()` + | ^^^^^^^^ + | +help: consider using + | +LL | let _ = x.ln(); + | ~~~~~~ error: logarithm for bases 2, 10 and e can be computed more accurately --> tests/ui/floating_point_log.rs:16:13 | LL | let _ = (x as f32).log(2f32); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).log2()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x as f32).log2(); + | ~~~~~~~~~~~~~~~~~ error: logarithm for bases 2, 10 and e can be computed more accurately --> tests/ui/floating_point_log.rs:19:13 | LL | let _ = x.log(2f64); - | ^^^^^^^^^^^ help: consider using: `x.log2()` + | ^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.log2(); + | ~~~~~~~~ error: logarithm for bases 2, 10 and e can be computed more accurately --> tests/ui/floating_point_log.rs:20:13 | LL | let _ = x.log(10f64); - | ^^^^^^^^^^^^ help: consider using: `x.log10()` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.log10(); + | ~~~~~~~~~ error: logarithm for bases 2, 10 and e can be computed more accurately --> tests/ui/floating_point_log.rs:21:13 | LL | let _ = x.log(std::f64::consts::E); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.ln()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.ln(); + | ~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:26:13 | LL | let _ = (1f32 + 2.).ln(); - | ^^^^^^^^^^^^^^^^ help: consider using: `2.0f32.ln_1p()` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::imprecise-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::imprecise_flops)]` +help: consider using + | +LL | let _ = 2.0f32.ln_1p(); + | ~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:27:13 | LL | let _ = (1f32 + 2.0).ln(); - | ^^^^^^^^^^^^^^^^^ help: consider using: `2.0f32.ln_1p()` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 2.0f32.ln_1p(); + | ~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:28:13 | LL | let _ = (1.0 + x).ln(); - | ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.ln_1p(); + | ~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:29:13 | LL | let _ = (1.0 + x / 2.0).ln(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x / 2.0).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x / 2.0).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:30:13 | LL | let _ = (1.0 + x.powi(3)).ln(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(3).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(3).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:31:13 | LL | let _ = (1.0 + x.powi(3) / 2.0).ln(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x.powi(3) / 2.0).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x.powi(3) / 2.0).ln_1p(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:32:13 | LL | let _ = (1.0 + (std::f32::consts::E - 1.0)).ln(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(std::f32::consts::E - 1.0).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (std::f32::consts::E - 1.0).ln_1p(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:33:13 | LL | let _ = (x + 1.0).ln(); - | ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.ln_1p(); + | ~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:34:13 | LL | let _ = (x.powi(3) + 1.0).ln(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(3).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(3).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:35:13 | LL | let _ = (x + 2.0 + 1.0).ln(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x + 2.0).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x + 2.0).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:36:13 | LL | let _ = (x / 2.0 + 1.0).ln(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x / 2.0).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x / 2.0).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:44:13 | LL | let _ = (1f64 + 2.).ln(); - | ^^^^^^^^^^^^^^^^ help: consider using: `2.0f64.ln_1p()` + | ^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 2.0f64.ln_1p(); + | ~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:45:13 | LL | let _ = (1f64 + 2.0).ln(); - | ^^^^^^^^^^^^^^^^^ help: consider using: `2.0f64.ln_1p()` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 2.0f64.ln_1p(); + | ~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:46:13 | LL | let _ = (1.0 + x).ln(); - | ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.ln_1p(); + | ~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:47:13 | LL | let _ = (1.0 + x / 2.0).ln(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x / 2.0).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x / 2.0).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:48:13 | LL | let _ = (1.0 + x.powi(3)).ln(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(3).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(3).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:49:13 | LL | let _ = (x + 1.0).ln(); - | ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.ln_1p(); + | ~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:50:13 | LL | let _ = (x.powi(3) + 1.0).ln(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(3).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(3).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:51:13 | LL | let _ = (x + 2.0 + 1.0).ln(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x + 2.0).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x + 2.0).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: ln(1 + x) can be computed more accurately --> tests/ui/floating_point_log.rs:52:13 | LL | let _ = (x / 2.0 + 1.0).ln(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x / 2.0).ln_1p()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x / 2.0).ln_1p(); + | ~~~~~~~~~~~~~~~~~ error: aborting due to 29 previous errors diff --git a/src/tools/clippy/tests/ui/floating_point_logbase.stderr b/src/tools/clippy/tests/ui/floating_point_logbase.stderr index 8dfc57b133c68..c00ba143aa8d8 100644 --- a/src/tools/clippy/tests/ui/floating_point_logbase.stderr +++ b/src/tools/clippy/tests/ui/floating_point_logbase.stderr @@ -2,34 +2,58 @@ error: log base can be expressed more clearly --> tests/ui/floating_point_logbase.rs:7:13 | LL | let _ = x.ln() / y.ln(); - | ^^^^^^^^^^^^^^^ help: consider using: `x.log(y)` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::suboptimal-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]` +help: consider using + | +LL | let _ = x.log(y); + | ~~~~~~~~ error: log base can be expressed more clearly --> tests/ui/floating_point_logbase.rs:8:13 | LL | let _ = (x as f32).ln() / y.ln(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).log(y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x as f32).log(y); + | ~~~~~~~~~~~~~~~~~ error: log base can be expressed more clearly --> tests/ui/floating_point_logbase.rs:9:13 | LL | let _ = x.log2() / y.log2(); - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.log(y); + | ~~~~~~~~ error: log base can be expressed more clearly --> tests/ui/floating_point_logbase.rs:10:13 | LL | let _ = x.log10() / y.log10(); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.log(y); + | ~~~~~~~~ error: log base can be expressed more clearly --> tests/ui/floating_point_logbase.rs:11:13 | LL | let _ = x.log(5f32) / y.log(5f32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.log(y); + | ~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/floating_point_mul_add.stderr b/src/tools/clippy/tests/ui/floating_point_mul_add.stderr index 3e1a071de7377..10f242db6d26a 100644 --- a/src/tools/clippy/tests/ui/floating_point_mul_add.stderr +++ b/src/tools/clippy/tests/ui/floating_point_mul_add.stderr @@ -2,82 +2,146 @@ error: multiply and add expressions can be calculated more efficiently and accur --> tests/ui/floating_point_mul_add.rs:20:13 | LL | let _ = a * b + c; - | ^^^^^^^^^ help: consider using: `a.mul_add(b, c)` + | ^^^^^^^^^ | = note: `-D clippy::suboptimal-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]` +help: consider using + | +LL | let _ = a.mul_add(b, c); + | ~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:21:13 | LL | let _ = a * b - c; - | ^^^^^^^^^ help: consider using: `a.mul_add(b, -c)` + | ^^^^^^^^^ + | +help: consider using + | +LL | let _ = a.mul_add(b, -c); + | ~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:22:13 | LL | let _ = c + a * b; - | ^^^^^^^^^ help: consider using: `a.mul_add(b, c)` + | ^^^^^^^^^ + | +help: consider using + | +LL | let _ = a.mul_add(b, c); + | ~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:23:13 | LL | let _ = c - a * b; - | ^^^^^^^^^ help: consider using: `a.mul_add(-b, c)` + | ^^^^^^^^^ + | +help: consider using + | +LL | let _ = a.mul_add(-b, c); + | ~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:24:13 | LL | let _ = a + 2.0 * 4.0; - | ^^^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4.0, a)` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 2.0f64.mul_add(4.0, a); + | ~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:25:13 | LL | let _ = a + 2. * 4.; - | ^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4., a)` + | ^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 2.0f64.mul_add(4., a); + | ~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:27:13 | LL | let _ = (a * b) + c; - | ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)` + | ^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = a.mul_add(b, c); + | ~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:28:13 | LL | let _ = c + (a * b); - | ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)` + | ^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = a.mul_add(b, c); + | ~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:29:13 | LL | let _ = a * b * c + d; - | ^^^^^^^^^^^^^ help: consider using: `(a * b).mul_add(c, d)` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (a * b).mul_add(c, d); + | ~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:31:13 | LL | let _ = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c)) + c; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:32:13 | LL | let _ = 1234.567_f64 * 45.67834_f64 + 0.0004_f64; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1234.567_f64.mul_add(45.67834_f64, 0.0004_f64)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 1234.567_f64.mul_add(45.67834_f64, 0.0004_f64); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:34:13 | LL | let _ = (a * a + b).sqrt(); - | ^^^^^^^^^^^ help: consider using: `a.mul_add(a, b)` + | ^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = a.mul_add(a, b).sqrt(); + | ~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_mul_add.rs:37:13 | LL | let _ = a - (b * u as f64); - | ^^^^^^^^^^^^^^^^^^ help: consider using: `b.mul_add(-(u as f64), a)` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = b.mul_add(-(u as f64), a); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/floating_point_powf.stderr b/src/tools/clippy/tests/ui/floating_point_powf.stderr index 671383401b554..8ffa826ebe1f6 100644 --- a/src/tools/clippy/tests/ui/floating_point_powf.stderr +++ b/src/tools/clippy/tests/ui/floating_point_powf.stderr @@ -2,193 +2,346 @@ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:8:13 | LL | let _ = 2f32.powf(x); - | ^^^^^^^^^^^^ help: consider using: `x.exp2()` + | ^^^^^^^^^^^^ | = note: `-D clippy::suboptimal-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]` +help: consider using + | +LL | let _ = x.exp2(); + | ~~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:9:13 | LL | let _ = 2f32.powf(3.1); - | ^^^^^^^^^^^^^^ help: consider using: `3.1f32.exp2()` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 3.1f32.exp2(); + | ~~~~~~~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:10:13 | LL | let _ = 2f32.powf(-3.1); - | ^^^^^^^^^^^^^^^ help: consider using: `(-3.1f32).exp2()` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (-3.1f32).exp2(); + | ~~~~~~~~~~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:11:13 | LL | let _ = std::f32::consts::E.powf(x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.exp()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.exp(); + | ~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:12:13 | LL | let _ = std::f32::consts::E.powf(3.1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `3.1f32.exp()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 3.1f32.exp(); + | ~~~~~~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:13:13 | LL | let _ = std::f32::consts::E.powf(-3.1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-3.1f32).exp()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (-3.1f32).exp(); + | ~~~~~~~~~~~~~~~ error: square-root of a number can be computed more efficiently and accurately --> tests/ui/floating_point_powf.rs:14:13 | LL | let _ = x.powf(1.0 / 2.0); - | ^^^^^^^^^^^^^^^^^ help: consider using: `x.sqrt()` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.sqrt(); + | ~~~~~~~~ error: cube-root of a number can be computed more accurately --> tests/ui/floating_point_powf.rs:15:13 | LL | let _ = x.powf(1.0 / 3.0); - | ^^^^^^^^^^^^^^^^^ help: consider using: `x.cbrt()` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::imprecise-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::imprecise_flops)]` +help: consider using + | +LL | let _ = x.cbrt(); + | ~~~~~~~~ error: cube-root of a number can be computed more accurately --> tests/ui/floating_point_powf.rs:16:13 | LL | let _ = (x as f32).powf(1.0 / 3.0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).cbrt()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x as f32).cbrt(); + | ~~~~~~~~~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:17:13 | LL | let _ = x.powf(3.0); - | ^^^^^^^^^^^ help: consider using: `x.powi(3)` + | ^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(3); + | ~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:18:13 | LL | let _ = x.powf(-2.0); - | ^^^^^^^^^^^^ help: consider using: `x.powi(-2)` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(-2); + | ~~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:19:13 | LL | let _ = x.powf(16_777_215.0); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(16_777_215)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(16_777_215); + | ~~~~~~~~~~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:20:13 | LL | let _ = x.powf(-16_777_215.0); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(-16_777_215)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(-16_777_215); + | ~~~~~~~~~~~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:21:13 | LL | let _ = (x as f32).powf(-16_777_215.0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).powi(-16_777_215)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x as f32).powi(-16_777_215); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:22:13 | LL | let _ = (x as f32).powf(3.0); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).powi(3)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x as f32).powi(3); + | ~~~~~~~~~~~~~~~~~~ error: cube-root of a number can be computed more accurately --> tests/ui/floating_point_powf.rs:23:13 | LL | let _ = (1.5_f32 + 1.0).powf(1.0 / 3.0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(1.5_f32 + 1.0).cbrt()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (1.5_f32 + 1.0).cbrt(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: cube-root of a number can be computed more accurately --> tests/ui/floating_point_powf.rs:24:13 | LL | let _ = 1.5_f64.powf(1.0 / 3.0); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1.5_f64.cbrt()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 1.5_f64.cbrt(); + | ~~~~~~~~~~~~~~ error: square-root of a number can be computed more efficiently and accurately --> tests/ui/floating_point_powf.rs:25:13 | LL | let _ = 1.5_f64.powf(1.0 / 2.0); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1.5_f64.sqrt()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 1.5_f64.sqrt(); + | ~~~~~~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:26:13 | LL | let _ = 1.5_f64.powf(3.0); - | ^^^^^^^^^^^^^^^^^ help: consider using: `1.5_f64.powi(3)` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 1.5_f64.powi(3); + | ~~~~~~~~~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:35:13 | LL | let _ = 2f64.powf(x); - | ^^^^^^^^^^^^ help: consider using: `x.exp2()` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.exp2(); + | ~~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:36:13 | LL | let _ = 2f64.powf(3.1); - | ^^^^^^^^^^^^^^ help: consider using: `3.1f64.exp2()` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 3.1f64.exp2(); + | ~~~~~~~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:37:13 | LL | let _ = 2f64.powf(-3.1); - | ^^^^^^^^^^^^^^^ help: consider using: `(-3.1f64).exp2()` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (-3.1f64).exp2(); + | ~~~~~~~~~~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:38:13 | LL | let _ = std::f64::consts::E.powf(x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.exp()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.exp(); + | ~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:39:13 | LL | let _ = std::f64::consts::E.powf(3.1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `3.1f64.exp()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 3.1f64.exp(); + | ~~~~~~~~~~~~ error: exponent for bases 2 and e can be computed more accurately --> tests/ui/floating_point_powf.rs:40:13 | LL | let _ = std::f64::consts::E.powf(-3.1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-3.1f64).exp()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (-3.1f64).exp(); + | ~~~~~~~~~~~~~~~ error: square-root of a number can be computed more efficiently and accurately --> tests/ui/floating_point_powf.rs:41:13 | LL | let _ = x.powf(1.0 / 2.0); - | ^^^^^^^^^^^^^^^^^ help: consider using: `x.sqrt()` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.sqrt(); + | ~~~~~~~~ error: cube-root of a number can be computed more accurately --> tests/ui/floating_point_powf.rs:42:13 | LL | let _ = x.powf(1.0 / 3.0); - | ^^^^^^^^^^^^^^^^^ help: consider using: `x.cbrt()` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.cbrt(); + | ~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:43:13 | LL | let _ = x.powf(3.0); - | ^^^^^^^^^^^ help: consider using: `x.powi(3)` + | ^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(3); + | ~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:44:13 | LL | let _ = x.powf(-2.0); - | ^^^^^^^^^^^^ help: consider using: `x.powi(-2)` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(-2); + | ~~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:45:13 | LL | let _ = x.powf(-2_147_483_648.0); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(-2_147_483_648)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(-2_147_483_648); + | ~~~~~~~~~~~~~~~~~~~~~~ error: exponentiation with integer powers can be computed more efficiently --> tests/ui/floating_point_powf.rs:46:13 | LL | let _ = x.powf(2_147_483_647.0); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(2_147_483_647)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.powi(2_147_483_647); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 31 previous errors diff --git a/src/tools/clippy/tests/ui/floating_point_powi.stderr b/src/tools/clippy/tests/ui/floating_point_powi.stderr index dfed20cb8c5a4..6ce43e8dde472 100644 --- a/src/tools/clippy/tests/ui/floating_point_powi.stderr +++ b/src/tools/clippy/tests/ui/floating_point_powi.stderr @@ -2,88 +2,157 @@ error: multiply and add expressions can be calculated more efficiently and accur --> tests/ui/floating_point_powi.rs:9:13 | LL | let _ = x.powi(2) + y; - | ^^^^^^^^^^^^^ help: consider using: `x.mul_add(x, y)` + | ^^^^^^^^^^^^^ | = note: `-D clippy::suboptimal-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]` +help: consider using + | +LL | let _ = x.mul_add(x, y); + | ~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:10:13 | LL | let _ = x.powi(2) - y; - | ^^^^^^^^^^^^^ help: consider using: `x.mul_add(x, -y)` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.mul_add(x, -y); + | ~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:11:13 | LL | let _ = x + y.powi(2); - | ^^^^^^^^^^^^^ help: consider using: `y.mul_add(y, x)` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = y.mul_add(y, x); + | ~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:12:13 | LL | let _ = x - y.powi(2); - | ^^^^^^^^^^^^^ help: consider using: `y.mul_add(-y, x)` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = y.mul_add(-y, x); + | ~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:13:13 | LL | let _ = x + (y as f32).powi(2); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(y as f32).mul_add(y as f32, x)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (y as f32).mul_add(y as f32, x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:14:13 | LL | let _ = (x.powi(2) + y).sqrt(); - | ^^^^^^^^^^^^^^^ help: consider using: `x.mul_add(x, y)` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.mul_add(x, y).sqrt(); + | ~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:15:13 | LL | let _ = (x + y.powi(2)).sqrt(); - | ^^^^^^^^^^^^^^^ help: consider using: `y.mul_add(y, x)` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = y.mul_add(y, x).sqrt(); + | ~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:17:13 | LL | let _ = (x - 1.0).powi(2) - y; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x - 1.0).mul_add(x - 1.0, -y)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x - 1.0).mul_add(x - 1.0, -y); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:18:13 | LL | let _ = (x - 1.0).powi(2) - y + 3.0; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x - 1.0).mul_add(x - 1.0, -y)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x - 1.0).mul_add(x - 1.0, -y) + 3.0; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:19:13 | LL | let _ = (x - 1.0).powi(2) - (y + 3.0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x - 1.0).mul_add(x - 1.0, -(y + 3.0))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (x - 1.0).mul_add(x - 1.0, -(y + 3.0)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:20:13 | LL | let _ = x - (y + 1.0).powi(2); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(y + 1.0).mul_add(-(y + 1.0), x)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (y + 1.0).mul_add(-(y + 1.0), x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:21:13 | LL | let _ = x - (3.0 * y).powi(2); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(3.0 * y).mul_add(-(3.0 * y), x)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (3.0 * y).mul_add(-(3.0 * y), x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:22:13 | LL | let _ = x - (y + 1.0 + x).powi(2); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(y + 1.0 + x).mul_add(-(y + 1.0 + x), x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (y + 1.0 + x).mul_add(-(y + 1.0 + x), x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: multiply and add expressions can be calculated more efficiently and accurately --> tests/ui/floating_point_powi.rs:23:13 | LL | let _ = x - (y + 1.0 + 2.0).powi(2); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(y + 1.0 + 2.0).mul_add(-(y + 1.0 + 2.0), x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (y + 1.0 + 2.0).mul_add(-(y + 1.0 + 2.0), x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 14 previous errors diff --git a/src/tools/clippy/tests/ui/floating_point_rad.stderr b/src/tools/clippy/tests/ui/floating_point_rad.stderr index 64674342c2b99..e4ceb548bffd4 100644 --- a/src/tools/clippy/tests/ui/floating_point_rad.stderr +++ b/src/tools/clippy/tests/ui/floating_point_rad.stderr @@ -2,52 +2,91 @@ error: conversion to radians can be done more accurately --> tests/ui/floating_point_rad.rs:11:13 | LL | let _ = degrees as f64 * std::f64::consts::PI / 180.0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(degrees as f64).to_radians()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::suboptimal-flops` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]` +help: consider using + | +LL | let _ = (degrees as f64).to_radians(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: conversion to degrees can be done more accurately --> tests/ui/floating_point_rad.rs:12:13 | LL | let _ = degrees as f64 * 180.0 / std::f64::consts::PI; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(degrees as f64).to_degrees()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (degrees as f64).to_degrees(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: conversion to degrees can be done more accurately --> tests/ui/floating_point_rad.rs:17:13 | LL | let _ = x * 180f32 / std::f32::consts::PI; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.to_degrees()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.to_degrees(); + | ~~~~~~~~~~~~~~ error: conversion to degrees can be done more accurately --> tests/ui/floating_point_rad.rs:18:13 | LL | let _ = 90. * 180f64 / std::f64::consts::PI; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.0_f64.to_degrees()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 90.0_f64.to_degrees(); + | ~~~~~~~~~~~~~~~~~~~~~ error: conversion to degrees can be done more accurately --> tests/ui/floating_point_rad.rs:19:13 | LL | let _ = 90.5 * 180f64 / std::f64::consts::PI; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.5_f64.to_degrees()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 90.5_f64.to_degrees(); + | ~~~~~~~~~~~~~~~~~~~~~ error: conversion to radians can be done more accurately --> tests/ui/floating_point_rad.rs:20:13 | LL | let _ = x * std::f32::consts::PI / 180f32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.to_radians()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = x.to_radians(); + | ~~~~~~~~~~~~~~ error: conversion to radians can be done more accurately --> tests/ui/floating_point_rad.rs:21:13 | LL | let _ = 90. * std::f32::consts::PI / 180f32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.0_f64.to_radians()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 90.0_f64.to_radians(); + | ~~~~~~~~~~~~~~~~~~~~~ error: conversion to radians can be done more accurately --> tests/ui/floating_point_rad.rs:22:13 | LL | let _ = 90.5 * std::f32::consts::PI / 180f32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.5_f64.to_radians()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = 90.5_f64.to_radians(); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/fn_to_numeric_cast.64bit.stderr b/src/tools/clippy/tests/ui/fn_to_numeric_cast.64bit.stderr index 58f55f19a745f..e4f17fd02835b 100644 --- a/src/tools/clippy/tests/ui/fn_to_numeric_cast.64bit.stderr +++ b/src/tools/clippy/tests/ui/fn_to_numeric_cast.64bit.stderr @@ -2,145 +2,258 @@ error: casting function pointer `foo` to `i8`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:10:13 | LL | let _ = foo as i8; - | ^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^ | = note: `-D clippy::fn-to-numeric-cast-with-truncation` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_with_truncation)]` +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `i16`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:11:13 | LL | let _ = foo as i16; - | ^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `i32`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:12:13 | LL | let _ = foo as i32; - | ^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `i64` --> tests/ui/fn_to_numeric_cast.rs:13:13 | LL | let _ = foo as i64; - | ^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^ | = note: `-D clippy::fn-to-numeric-cast` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast)]` +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `i128` --> tests/ui/fn_to_numeric_cast.rs:14:13 | LL | let _ = foo as i128; - | ^^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `isize` --> tests/ui/fn_to_numeric_cast.rs:15:13 | LL | let _ = foo as isize; - | ^^^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `u8`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:17:13 | LL | let _ = foo as u8; - | ^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `u16`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:18:13 | LL | let _ = foo as u16; - | ^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `u32`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:19:13 | LL | let _ = foo as u32; - | ^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `u64` --> tests/ui/fn_to_numeric_cast.rs:20:13 | LL | let _ = foo as u64; - | ^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `u128` --> tests/ui/fn_to_numeric_cast.rs:21:13 | LL | let _ = foo as u128; - | ^^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = foo as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `i8`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:34:13 | LL | let _ = abc as i8; - | ^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `i16`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:35:13 | LL | let _ = abc as i16; - | ^^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `i32`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:36:13 | LL | let _ = abc as i32; - | ^^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `i64` --> tests/ui/fn_to_numeric_cast.rs:37:13 | LL | let _ = abc as i64; - | ^^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `i128` --> tests/ui/fn_to_numeric_cast.rs:38:13 | LL | let _ = abc as i128; - | ^^^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `isize` --> tests/ui/fn_to_numeric_cast.rs:39:13 | LL | let _ = abc as isize; - | ^^^^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `u8`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:41:13 | LL | let _ = abc as u8; - | ^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `u16`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:42:13 | LL | let _ = abc as u16; - | ^^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `u32`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:43:13 | LL | let _ = abc as u32; - | ^^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `u64` --> tests/ui/fn_to_numeric_cast.rs:44:13 | LL | let _ = abc as u64; - | ^^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `abc` to `u128` --> tests/ui/fn_to_numeric_cast.rs:45:13 | LL | let _ = abc as u128; - | ^^^^^^^^^^^ help: try: `abc as usize` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = abc as usize; + | ~~~~~~~~~~~~ error: casting function pointer `f` to `i32`, which truncates the value --> tests/ui/fn_to_numeric_cast.rs:52:5 | LL | f as i32 - | ^^^^^^^^ help: try: `f as usize` + | ^^^^^^^^ + | +help: try + | +LL | f as usize + | error: aborting due to 23 previous errors diff --git a/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr b/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr index e5bb8d1326975..a05b7138bc99b 100644 --- a/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr +++ b/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr @@ -2,106 +2,190 @@ error: casting function pointer `foo` to `i8` --> tests/ui/fn_to_numeric_cast_any.rs:23:13 | LL | let _ = foo as i8; - | ^^^^^^^^^ help: did you mean to invoke the function?: `foo() as i8` + | ^^^^^^^^^ | = note: `-D clippy::fn-to-numeric-cast-any` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_any)]` +help: did you mean to invoke the function? + | +LL | let _ = foo() as i8; + | ~~~~~~~~~~~ error: casting function pointer `foo` to `i16` --> tests/ui/fn_to_numeric_cast_any.rs:26:13 | LL | let _ = foo as i16; - | ^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as i16` + | ^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as i16; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `i32` --> tests/ui/fn_to_numeric_cast_any.rs:28:13 | LL | let _ = foo as i32; - | ^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as i32` + | ^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as i32; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `i64` --> tests/ui/fn_to_numeric_cast_any.rs:30:13 | LL | let _ = foo as i64; - | ^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as i64` + | ^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as i64; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `i128` --> tests/ui/fn_to_numeric_cast_any.rs:32:13 | LL | let _ = foo as i128; - | ^^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as i128` + | ^^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as i128; + | ~~~~~~~~~~~~~ error: casting function pointer `foo` to `isize` --> tests/ui/fn_to_numeric_cast_any.rs:34:13 | LL | let _ = foo as isize; - | ^^^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as isize` + | ^^^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as isize; + | ~~~~~~~~~~~~~~ error: casting function pointer `foo` to `u8` --> tests/ui/fn_to_numeric_cast_any.rs:37:13 | LL | let _ = foo as u8; - | ^^^^^^^^^ help: did you mean to invoke the function?: `foo() as u8` + | ^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as u8; + | ~~~~~~~~~~~ error: casting function pointer `foo` to `u16` --> tests/ui/fn_to_numeric_cast_any.rs:39:13 | LL | let _ = foo as u16; - | ^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as u16` + | ^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as u16; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `u32` --> tests/ui/fn_to_numeric_cast_any.rs:41:13 | LL | let _ = foo as u32; - | ^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as u32` + | ^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as u32; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `u64` --> tests/ui/fn_to_numeric_cast_any.rs:43:13 | LL | let _ = foo as u64; - | ^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as u64` + | ^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as u64; + | ~~~~~~~~~~~~ error: casting function pointer `foo` to `u128` --> tests/ui/fn_to_numeric_cast_any.rs:45:13 | LL | let _ = foo as u128; - | ^^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as u128` + | ^^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as u128; + | ~~~~~~~~~~~~~ error: casting function pointer `foo` to `usize` --> tests/ui/fn_to_numeric_cast_any.rs:47:13 | LL | let _ = foo as usize; - | ^^^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as usize` + | ^^^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as usize; + | ~~~~~~~~~~~~~~ error: casting function pointer `Struct::static_method` to `usize` --> tests/ui/fn_to_numeric_cast_any.rs:52:13 | LL | let _ = Struct::static_method as usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean to invoke the function?: `Struct::static_method() as usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = Struct::static_method() as usize; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting function pointer `f` to `usize` --> tests/ui/fn_to_numeric_cast_any.rs:57:5 | LL | f as usize - | ^^^^^^^^^^ help: did you mean to invoke the function?: `f() as usize` + | ^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | f() as usize + | error: casting function pointer `T::static_method` to `usize` --> tests/ui/fn_to_numeric_cast_any.rs:62:5 | LL | T::static_method as usize - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean to invoke the function?: `T::static_method() as usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | T::static_method() as usize + | error: casting function pointer `(clos as fn(u32) -> u32)` to `usize` --> tests/ui/fn_to_numeric_cast_any.rs:69:13 | LL | let _ = (clos as fn(u32) -> u32) as usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean to invoke the function?: `(clos as fn(u32) -> u32)() as usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = (clos as fn(u32) -> u32)() as usize; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting function pointer `foo` to `*const ()` --> tests/ui/fn_to_numeric_cast_any.rs:74:13 | LL | let _ = foo as *const (); - | ^^^^^^^^^^^^^^^^ help: did you mean to invoke the function?: `foo() as *const ()` + | ^^^^^^^^^^^^^^^^ + | +help: did you mean to invoke the function? + | +LL | let _ = foo() as *const (); + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 17 previous errors diff --git a/src/tools/clippy/tests/ui/format.stderr b/src/tools/clippy/tests/ui/format.stderr index faa80b48000f9..259afb2722c70 100644 --- a/src/tools/clippy/tests/ui/format.stderr +++ b/src/tools/clippy/tests/ui/format.stderr @@ -2,22 +2,36 @@ error: useless use of `format!` --> tests/ui/format.rs:19:5 | LL | format!("foo"); - | ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::useless-format` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::useless_format)]` +help: consider using `.to_string()` + | +LL | "foo".to_string(); + | ~~~~~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:20:5 | LL | format!("{{}}"); - | ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{}".to_string()` + | ^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | "{}".to_string(); + | ~~~~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:21:5 | LL | format!("{{}} abc {{}}"); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{} abc {}".to_string()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | "{} abc {}".to_string(); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:22:5 @@ -38,67 +52,122 @@ error: useless use of `format!` --> tests/ui/format.rs:27:13 | LL | let _ = format!(""); - | ^^^^^^^^^^^ help: consider using `String::new()`: `String::new()` + | ^^^^^^^^^^^ + | +help: consider using `String::new()` + | +LL | let _ = String::new(); + | ~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:29:5 | LL | format!("{}", "foo"); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | "foo".to_string(); + | ~~~~~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:37:5 | LL | format!("{}", arg); - | ^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `arg.to_string()` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | arg.to_string(); + | ~~~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:67:5 | LL | format!("{}", 42.to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `42.to_string()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | 42.to_string(); + | ~~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:69:5 | LL | format!("{}", x.display().to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.display().to_string()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | x.display().to_string(); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:73:18 | LL | let _ = Some(format!("{}", a + "bar")); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `a + "bar"` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | let _ = Some(a + "bar"); + | ~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:77:22 | LL | let _s: String = format!("{}", &*v.join("\n")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `(&*v.join("\n")).to_string()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | let _s: String = (&*v.join("\n")).to_string(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:83:13 | LL | let _ = format!("{x}"); - | ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()` + | ^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | let _ = x.to_string(); + | ~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:85:13 | LL | let _ = format!("{y}", y = x); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | let _ = x.to_string(); + | ~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:89:13 | LL | let _ = format!("{abc}"); - | ^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `abc.to_string()` + | ^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | let _ = abc.to_string(); + | ~~~~~~~~~~~~~~~ error: useless use of `format!` --> tests/ui/format.rs:91:13 | LL | let _ = format!("{xx}"); - | ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `xx.to_string()` + | ^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` + | +LL | let _ = xx.to_string(); + | ~~~~~~~~~~~~~~ error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/format_args.stderr b/src/tools/clippy/tests/ui/format_args.stderr index 91a45e2700811..d2d3cb0cf0aa2 100644 --- a/src/tools/clippy/tests/ui/format_args.stderr +++ b/src/tools/clippy/tests/ui/format_args.stderr @@ -2,160 +2,310 @@ error: `to_string` applied to a type that implements `Display` in `format!` args --> tests/ui/format_args.rs:77:72 | LL | let _ = format!("error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ | = note: `-D clippy::to-string-in-format-args` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::to_string_in_format_args)]` +help: remove this + | +LL - let _ = format!("error: something failed at {}", Location::caller().to_string()); +LL + let _ = format!("error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `write!` args --> tests/ui/format_args.rs:81:27 | LL | Location::caller().to_string() - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - Location::caller().to_string() +LL + Location::caller() + | error: `to_string` applied to a type that implements `Display` in `writeln!` args --> tests/ui/format_args.rs:86:27 | LL | Location::caller().to_string() - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - Location::caller().to_string() +LL + Location::caller() + | error: `to_string` applied to a type that implements `Display` in `print!` args --> tests/ui/format_args.rs:88:63 | LL | print!("error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - print!("error: something failed at {}", Location::caller().to_string()); +LL + print!("error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:89:65 | LL | println!("error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - println!("error: something failed at {}", Location::caller().to_string()); +LL + println!("error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `eprint!` args --> tests/ui/format_args.rs:90:64 | LL | eprint!("error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - eprint!("error: something failed at {}", Location::caller().to_string()); +LL + eprint!("error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `eprintln!` args --> tests/ui/format_args.rs:91:66 | LL | eprintln!("error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - eprintln!("error: something failed at {}", Location::caller().to_string()); +LL + eprintln!("error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `format_args!` args --> tests/ui/format_args.rs:92:77 | LL | let _ = format_args!("error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - let _ = format_args!("error: something failed at {}", Location::caller().to_string()); +LL + let _ = format_args!("error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `assert!` args --> tests/ui/format_args.rs:93:70 | LL | assert!(true, "error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - assert!(true, "error: something failed at {}", Location::caller().to_string()); +LL + assert!(true, "error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `assert_eq!` args --> tests/ui/format_args.rs:94:73 | LL | assert_eq!(0, 0, "error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - assert_eq!(0, 0, "error: something failed at {}", Location::caller().to_string()); +LL + assert_eq!(0, 0, "error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `assert_ne!` args --> tests/ui/format_args.rs:95:73 | LL | assert_ne!(0, 0, "error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - assert_ne!(0, 0, "error: something failed at {}", Location::caller().to_string()); +LL + assert_ne!(0, 0, "error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `panic!` args --> tests/ui/format_args.rs:96:63 | LL | panic!("error: something failed at {}", Location::caller().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - panic!("error: something failed at {}", Location::caller().to_string()); +LL + panic!("error: something failed at {}", Location::caller()); + | error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:97:20 | LL | println!("{}", X(1).to_string()); - | ^^^^^^^^^^^^^^^^ help: use this: `*X(1)` + | ^^^^^^^^^^^^^^^^ + | +help: use this + | +LL | println!("{}", *X(1)); + | ~~~~~ error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:98:20 | LL | println!("{}", Y(&X(1)).to_string()); - | ^^^^^^^^^^^^^^^^^^^^ help: use this: `***Y(&X(1))` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use this + | +LL | println!("{}", ***Y(&X(1))); + | ~~~~~~~~~~~ error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:99:24 | LL | println!("{}", Z(1).to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - println!("{}", Z(1).to_string()); +LL + println!("{}", Z(1)); + | error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:100:20 | LL | println!("{}", x.to_string()); - | ^^^^^^^^^^^^^ help: use this: `**x` + | ^^^^^^^^^^^^^ + | +help: use this + | +LL | println!("{}", **x); + | ~~~ error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:101:20 | LL | println!("{}", x_ref.to_string()); - | ^^^^^^^^^^^^^^^^^ help: use this: `***x_ref` + | ^^^^^^^^^^^^^^^^^ + | +help: use this + | +LL | println!("{}", ***x_ref); + | ~~~~~~~~ error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:103:39 | LL | println!("{foo}{bar}", foo = "foo".to_string(), bar = "bar"); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - println!("{foo}{bar}", foo = "foo".to_string(), bar = "bar"); +LL + println!("{foo}{bar}", foo = "foo", bar = "bar"); + | error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:104:52 | LL | println!("{foo}{bar}", foo = "foo", bar = "bar".to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - println!("{foo}{bar}", foo = "foo", bar = "bar".to_string()); +LL + println!("{foo}{bar}", foo = "foo", bar = "bar"); + | error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:105:39 | LL | println!("{foo}{bar}", bar = "bar".to_string(), foo = "foo"); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - println!("{foo}{bar}", bar = "bar".to_string(), foo = "foo"); +LL + println!("{foo}{bar}", bar = "bar", foo = "foo"); + | error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:106:52 | LL | println!("{foo}{bar}", bar = "bar", foo = "foo".to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - println!("{foo}{bar}", bar = "bar", foo = "foo".to_string()); +LL + println!("{foo}{bar}", bar = "bar", foo = "foo"); + | error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:107:37 | LL | println!("{}", my_other_macro!().to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - println!("{}", my_other_macro!().to_string()); +LL + println!("{}", my_other_macro!()); + | error: `to_string` applied to a type that implements `Display` in `print!` args --> tests/ui/format_args.rs:119:37 | LL | print!("{}", (Location::caller().to_string())); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - print!("{}", (Location::caller().to_string())); +LL + print!("{}", (Location::caller())); + | error: `to_string` applied to a type that implements `Display` in `print!` args --> tests/ui/format_args.rs:120:39 | LL | print!("{}", ((Location::caller()).to_string())); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - print!("{}", ((Location::caller()).to_string())); +LL + print!("{}", ((Location::caller()))); + | error: `to_string` applied to a type that implements `Display` in `format!` args --> tests/ui/format_args.rs:148:38 | LL | let x = format!("{} {}", a, b.to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ + | +help: remove this + | +LL - let x = format!("{} {}", a, b.to_string()); +LL + let x = format!("{} {}", a, b); + | error: `to_string` applied to a type that implements `Display` in `println!` args --> tests/ui/format_args.rs:162:24 | LL | println!("{}", original[..10].to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use this: `&original[..10]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use this + | +LL | println!("{}", &original[..10]); + | ~~~~~~~~~~~~~~~ error: aborting due to 26 previous errors diff --git a/src/tools/clippy/tests/ui/from_iter_instead_of_collect.stderr b/src/tools/clippy/tests/ui/from_iter_instead_of_collect.stderr index 0824a526b793d..b2480da445ebe 100644 --- a/src/tools/clippy/tests/ui/from_iter_instead_of_collect.stderr +++ b/src/tools/clippy/tests/ui/from_iter_instead_of_collect.stderr @@ -2,94 +2,168 @@ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:17:9 | LL | >::from_iter(iter.into_iter().copied()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `iter.into_iter().copied().collect::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::from-iter-instead-of-collect` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::from_iter_instead_of_collect)]` +help: use `.collect()` instead of `::from_iter()` + | +LL | iter.into_iter().copied().collect::() + | error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:23:13 | LL | let _ = Vec::from_iter(iter_expr); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `iter_expr.collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let _ = iter_expr.collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:25:13 | LL | let _ = HashMap::::from_iter(vec![5, 5, 5, 5].iter().enumerate()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `vec![5, 5, 5, 5].iter().enumerate().collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let _ = vec![5, 5, 5, 5].iter().enumerate().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:30:19 | LL | assert_eq!(a, Vec::from_iter(0..3)); - | ^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `(0..3).collect::>()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | assert_eq!(a, (0..3).collect::>()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:31:19 | LL | assert_eq!(a, Vec::::from_iter(0..3)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `(0..3).collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | assert_eq!(a, (0..3).collect::>()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:33:17 | LL | let mut b = VecDeque::from_iter(0..3); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `(0..3).collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let mut b = (0..3).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:36:17 | LL | let mut b = VecDeque::::from_iter(0..3); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `(0..3).collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let mut b = (0..3).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:41:21 | LL | let mut b = collections::VecDeque::::from_iter(0..3); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `(0..3).collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let mut b = (0..3).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:46:14 | LL | let bm = BTreeMap::from_iter(values.iter().cloned()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `values.iter().cloned().collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let bm = values.iter().cloned().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:47:19 | LL | let mut bar = BTreeMap::from_iter(bm.range(0..2)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `bm.range(0..2).collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let mut bar = bm.range(0..2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:50:19 | LL | let mut bts = BTreeSet::from_iter(0..3); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `(0..3).collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let mut bts = (0..3).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:54:17 | LL | let _ = collections::BTreeSet::from_iter(0..3); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `(0..3).collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let _ = (0..3).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:55:17 | LL | let _ = collections::BTreeSet::::from_iter(0..3); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `(0..3).collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | let _ = (0..3).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:58:15 | LL | for _i in Vec::from_iter([1, 2, 3].iter()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `[1, 2, 3].iter().collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | for _i in [1, 2, 3].iter().collect::>() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `FromIterator::from_iter` --> tests/ui/from_iter_instead_of_collect.rs:59:15 | LL | for _i in Vec::<&i32>::from_iter([1, 2, 3].iter()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `[1, 2, 3].iter().collect::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `.collect()` instead of `::from_iter()` + | +LL | for _i in [1, 2, 3].iter().collect::>() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/from_str_radix_10.stderr b/src/tools/clippy/tests/ui/from_str_radix_10.stderr index 01a1bf8940a12..018d994a53f91 100644 --- a/src/tools/clippy/tests/ui/from_str_radix_10.stderr +++ b/src/tools/clippy/tests/ui/from_str_radix_10.stderr @@ -2,52 +2,91 @@ error: this call to `from_str_radix` can be replaced with a call to `str::parse` --> tests/ui/from_str_radix_10.rs:29:5 | LL | u32::from_str_radix("30", 10)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"30".parse::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::from-str-radix-10` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::from_str_radix_10)]` +help: try + | +LL | "30".parse::()?; + | ~~~~~~~~~~~~~~~~~~~ error: this call to `from_str_radix` can be replaced with a call to `str::parse` --> tests/ui/from_str_radix_10.rs:32:5 | LL | i64::from_str_radix("24", 10)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"24".parse::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | "24".parse::()?; + | ~~~~~~~~~~~~~~~~~~~ error: this call to `from_str_radix` can be replaced with a call to `str::parse` --> tests/ui/from_str_radix_10.rs:34:5 | LL | isize::from_str_radix("100", 10)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"100".parse::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | "100".parse::()?; + | ~~~~~~~~~~~~~~~~~~~~~~ error: this call to `from_str_radix` can be replaced with a call to `str::parse` --> tests/ui/from_str_radix_10.rs:36:5 | LL | u8::from_str_radix("7", 10)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"7".parse::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | "7".parse::()?; + | ~~~~~~~~~~~~~~~~~ error: this call to `from_str_radix` can be replaced with a call to `str::parse` --> tests/ui/from_str_radix_10.rs:38:5 | LL | u16::from_str_radix(&("10".to_owned() + "5"), 10)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `("10".to_owned() + "5").parse::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | ("10".to_owned() + "5").parse::()?; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this call to `from_str_radix` can be replaced with a call to `str::parse` --> tests/ui/from_str_radix_10.rs:40:5 | LL | i128::from_str_radix(Test + Test, 10)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(Test + Test).parse::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | (Test + Test).parse::()?; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this call to `from_str_radix` can be replaced with a call to `str::parse` --> tests/ui/from_str_radix_10.rs:44:5 | LL | i32::from_str_radix(string, 10)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.parse::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | string.parse::()?; + | ~~~~~~~~~~~~~~~~~~~~~ error: this call to `from_str_radix` can be replaced with a call to `str::parse` --> tests/ui/from_str_radix_10.rs:48:5 | LL | i32::from_str_radix(&stringier, 10)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `stringier.parse::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | stringier.parse::()?; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/get_first.stderr b/src/tools/clippy/tests/ui/get_first.stderr index 155d341b5a77d..0f9f9a23d74f7 100644 --- a/src/tools/clippy/tests/ui/get_first.stderr +++ b/src/tools/clippy/tests/ui/get_first.stderr @@ -2,34 +2,58 @@ error: accessing first element with `x.get(0)` --> tests/ui/get_first.rs:17:13 | LL | let _ = x.get(0); - | ^^^^^^^^ help: try: `x.first()` + | ^^^^^^^^ | = note: `-D clippy::get-first` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::get_first)]` +help: try + | +LL | let _ = x.first(); + | ~~~~~~~~~ error: accessing first element with `y.get(0)` --> tests/ui/get_first.rs:23:13 | LL | let _ = y.get(0); - | ^^^^^^^^ help: try: `y.first()` + | ^^^^^^^^ + | +help: try + | +LL | let _ = y.first(); + | ~~~~~~~~~ error: accessing first element with `z.get(0)` --> tests/ui/get_first.rs:29:13 | LL | let _ = z.get(0); - | ^^^^^^^^ help: try: `z.first()` + | ^^^^^^^^ + | +help: try + | +LL | let _ = z.first(); + | ~~~~~~~~~ error: accessing first element with `vecdeque.get(0)` --> tests/ui/get_first.rs:35:13 | LL | let _ = vecdeque.get(0); - | ^^^^^^^^^^^^^^^ help: try: `vecdeque.front()` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vecdeque.front(); + | ~~~~~~~~~~~~~~~~ error: accessing first element with `non_primitives.get(0)` --> tests/ui/get_first.rs:48:13 | LL | let _ = non_primitives.get(0); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `non_primitives.first()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = non_primitives.first(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/get_last_with_len.stderr b/src/tools/clippy/tests/ui/get_last_with_len.stderr index ba08f5db7cfae..d9a57f16caf84 100644 --- a/src/tools/clippy/tests/ui/get_last_with_len.stderr +++ b/src/tools/clippy/tests/ui/get_last_with_len.stderr @@ -2,40 +2,69 @@ error: accessing last element with `x.get(x.len() - 1)` --> tests/ui/get_last_with_len.rs:8:13 | LL | let _ = x.get(x.len() - 1); - | ^^^^^^^^^^^^^^^^^^ help: try: `x.last()` + | ^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::get-last-with-len` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::get_last_with_len)]` +help: try + | +LL | let _ = x.last(); + | ~~~~~~~~ error: accessing last element with `s.field.get(s.field.len() - 1)` --> tests/ui/get_last_with_len.rs:32:13 | LL | let _ = s.field.get(s.field.len() - 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.field.last()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.field.last(); + | ~~~~~~~~~~~~~~ error: accessing last element with `slice.get(slice.len() - 1)` --> tests/ui/get_last_with_len.rs:37:13 | LL | let _ = slice.get(slice.len() - 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `slice.last()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = slice.last(); + | ~~~~~~~~~~~~ error: accessing last element with `array.get(array.len() - 1)` --> tests/ui/get_last_with_len.rs:40:13 | LL | let _ = array.get(array.len() - 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `array.last()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = array.last(); + | ~~~~~~~~~~~~ error: accessing last element with `deq.get(deq.len() - 1)` --> tests/ui/get_last_with_len.rs:43:13 | LL | let _ = deq.get(deq.len() - 1); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `deq.back()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = deq.back(); + | ~~~~~~~~~~ error: accessing last element with `nested[0].get(nested[0].len() - 1)` --> tests/ui/get_last_with_len.rs:46:13 | LL | let _ = nested[0].get(nested[0].len() - 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `nested[0].last()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = nested[0].last(); + | ~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/get_unwrap.stderr b/src/tools/clippy/tests/ui/get_unwrap.stderr index a08b6657dcc7c..2c1f1fc88fde9 100644 --- a/src/tools/clippy/tests/ui/get_unwrap.stderr +++ b/src/tools/clippy/tests/ui/get_unwrap.stderr @@ -2,13 +2,17 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> tests/ui/get_unwrap.rs:37:17 | LL | let _ = boxed_slice.get(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&boxed_slice[1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/get_unwrap.rs:9:9 | LL | #![deny(clippy::get_unwrap)] | ^^^^^^^^^^^^^^^^^^ +help: try + | +LL | let _ = &boxed_slice[1]; + | ~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:37:17 @@ -25,7 +29,12 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> tests/ui/get_unwrap.rs:38:17 | LL | let _ = some_slice.get(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_slice[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_slice[0]; + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:38:17 @@ -40,7 +49,12 @@ error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more conc --> tests/ui/get_unwrap.rs:39:17 | LL | let _ = some_vec.get(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_vec[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_vec[0]; + | ~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:39:17 @@ -55,7 +69,12 @@ error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more --> tests/ui/get_unwrap.rs:40:17 | LL | let _ = some_vecdeque.get(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_vecdeque[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_vecdeque[0]; + | ~~~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:40:17 @@ -70,7 +89,12 @@ error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more --> tests/ui/get_unwrap.rs:41:17 | LL | let _ = some_hashmap.get(&1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_hashmap[&1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_hashmap[&1]; + | ~~~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:41:17 @@ -85,7 +109,12 @@ error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more --> tests/ui/get_unwrap.rs:42:17 | LL | let _ = some_btreemap.get(&1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_btreemap[&1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = &some_btreemap[&1]; + | ~~~~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:42:17 @@ -100,7 +129,12 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> tests/ui/get_unwrap.rs:46:21 | LL | let _: u8 = *boxed_slice.get(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `boxed_slice[1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: u8 = boxed_slice[1]; + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:46:22 @@ -115,7 +149,12 @@ error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and mor --> tests/ui/get_unwrap.rs:51:9 | LL | *boxed_slice.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `boxed_slice[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | boxed_slice[0] = 1; + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:51:10 @@ -130,7 +169,12 @@ error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and mor --> tests/ui/get_unwrap.rs:52:9 | LL | *some_slice.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_slice[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | some_slice[0] = 1; + | ~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:52:10 @@ -145,7 +189,12 @@ error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more --> tests/ui/get_unwrap.rs:53:9 | LL | *some_vec.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vec[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | some_vec[0] = 1; + | ~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:53:10 @@ -160,7 +209,12 @@ error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and --> tests/ui/get_unwrap.rs:54:9 | LL | *some_vecdeque.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vecdeque[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | some_vecdeque[0] = 1; + | ~~~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:54:10 @@ -175,7 +229,12 @@ error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more conc --> tests/ui/get_unwrap.rs:66:17 | LL | let _ = some_vec.get(0..1).unwrap().to_vec(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vec[0..1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = some_vec[0..1].to_vec(); + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:66:17 @@ -190,7 +249,12 @@ error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more --> tests/ui/get_unwrap.rs:67:17 | LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vec[0..1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = some_vec[0..1].to_vec(); + | ~~~~~~~~~~~~~~ error: used `unwrap()` on an `Option` value --> tests/ui/get_unwrap.rs:67:17 @@ -205,25 +269,45 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> tests/ui/get_unwrap.rs:77:24 | LL | let _x: &i32 = f.get(1 + 2).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `&f[1 + 2]` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _x: &i32 = &f[1 + 2]; + | ~~~~~~~~~ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise --> tests/ui/get_unwrap.rs:80:18 | LL | let _x = f.get(1 + 2).unwrap().to_string(); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `f[1 + 2]` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _x = f[1 + 2].to_string(); + | ~~~~~~~~ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise --> tests/ui/get_unwrap.rs:83:18 | LL | let _x = f.get(1 + 2).unwrap().abs(); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `f[1 + 2]` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _x = f[1 + 2].abs(); + | ~~~~~~~~ error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise --> tests/ui/get_unwrap.rs:100:33 | LL | let b = rest.get_mut(linidx(j, k) - linidx(i, k) - 1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut rest[linidx(j, k) - linidx(i, k) - 1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let b = &mut rest[linidx(j, k) - linidx(i, k) - 1]; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 30 previous errors diff --git a/src/tools/clippy/tests/ui/identity_op.stderr b/src/tools/clippy/tests/ui/identity_op.stderr index 9fff86b86f9f6..c88e5aef28639 100644 --- a/src/tools/clippy/tests/ui/identity_op.stderr +++ b/src/tools/clippy/tests/ui/identity_op.stderr @@ -2,316 +2,575 @@ error: this operation has no effect --> tests/ui/identity_op.rs:44:5 | LL | x + 0; - | ^^^^^ help: consider reducing it to: `x` + | ^^^^^ | = note: `-D clippy::identity-op` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::identity_op)]` +help: consider reducing it to + | +LL | x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:46:5 | LL | x + (1 - 1); - | ^^^^^^^^^^^ help: consider reducing it to: `x` + | ^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:49:5 | LL | 0 + x; - | ^^^^^ help: consider reducing it to: `x` + | ^^^^^ + | +help: consider reducing it to + | +LL | x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:53:5 | LL | x | (0); - | ^^^^^^^ help: consider reducing it to: `x` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:57:5 | LL | x * 1; - | ^^^^^ help: consider reducing it to: `x` + | ^^^^^ + | +help: consider reducing it to + | +LL | x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:59:5 | LL | 1 * x; - | ^^^^^ help: consider reducing it to: `x` + | ^^^^^ + | +help: consider reducing it to + | +LL | x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:66:5 | LL | -1 & x; - | ^^^^^^ help: consider reducing it to: `x` + | ^^^^^^ + | +help: consider reducing it to + | +LL | x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:70:5 | LL | u & 255; - | ^^^^^^^ help: consider reducing it to: `u` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | u; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:74:5 | LL | 42 << 0; - | ^^^^^^^ help: consider reducing it to: `42` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | 42; + | ~~ error: this operation has no effect --> tests/ui/identity_op.rs:76:5 | LL | 1 >> 0; - | ^^^^^^ help: consider reducing it to: `1` + | ^^^^^^ + | +help: consider reducing it to + | +LL | 1; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:78:5 | LL | 42 >> 0; - | ^^^^^^^ help: consider reducing it to: `42` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | 42; + | ~~ error: this operation has no effect --> tests/ui/identity_op.rs:80:5 | LL | &x >> 0; - | ^^^^^^^ help: consider reducing it to: `x` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:82:5 | LL | x >> &0; - | ^^^^^^^ help: consider reducing it to: `x` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:90:5 | LL | 2 % 3; - | ^^^^^ help: consider reducing it to: `2` + | ^^^^^ + | +help: consider reducing it to + | +LL | 2; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:92:5 | LL | -2 % 3; - | ^^^^^^ help: consider reducing it to: `-2` + | ^^^^^^ + | +help: consider reducing it to + | +LL | -2; + | ~~ error: this operation has no effect --> tests/ui/identity_op.rs:94:5 | LL | 2 % -3 + x; - | ^^^^^^ help: consider reducing it to: `2` + | ^^^^^^ + | +help: consider reducing it to + | +LL | 2 + x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:96:5 | LL | -2 % -3 + x; - | ^^^^^^^ help: consider reducing it to: `-2` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | -2 + x; + | ~~ error: this operation has no effect --> tests/ui/identity_op.rs:98:9 | LL | x + 1 % 3; - | ^^^^^ help: consider reducing it to: `1` + | ^^^^^ + | +help: consider reducing it to + | +LL | x + 1; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:107:5 | LL | 0 + if b { 1 } else { 2 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if b { 1 } else { 2 })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (if b { 1 } else { 2 }); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:109:5 | LL | 0 + if b { 1 } else { 2 } + if b { 3 } else { 4 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if b { 1 } else { 2 })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (if b { 1 } else { 2 }) + if b { 3 } else { 4 }; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:111:5 | LL | 0 + match a { 0 => 10, _ => 20 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(match a { 0 => 10, _ => 20 })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (match a { 0 => 10, _ => 20 }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:113:5 | LL | 0 + match a { 0 => 10, _ => 20 } + match a { 0 => 30, _ => 40 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(match a { 0 => 10, _ => 20 })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (match a { 0 => 10, _ => 20 }) + match a { 0 => 30, _ => 40 }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:115:5 | LL | 0 + if b { 1 } else { 2 } + match a { 0 => 30, _ => 40 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if b { 1 } else { 2 })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (if b { 1 } else { 2 }) + match a { 0 => 30, _ => 40 }; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:117:5 | LL | 0 + match a { 0 => 10, _ => 20 } + if b { 3 } else { 4 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(match a { 0 => 10, _ => 20 })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (match a { 0 => 10, _ => 20 }) + if b { 3 } else { 4 }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:119:5 | LL | (if b { 1 } else { 2 }) + 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if b { 1 } else { 2 })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (if b { 1 } else { 2 }); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:122:5 | LL | 0 + { a } + 3; - | ^^^^^^^^^ help: consider reducing it to: `({ a })` + | ^^^^^^^^^ + | +help: consider reducing it to + | +LL | ({ a }) + 3; + | ~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:124:5 | LL | 0 + { a } * 2; - | ^^^^^^^^^^^^^ help: consider reducing it to: `({ a } * 2)` + | ^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | ({ a } * 2); + | ~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:126:5 | LL | 0 + loop { let mut c = 0; if c == 10 { break c; } c += 1; } + { a * 2 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(loop { let mut c = 0; if c == 10 { break c; } c += 1; })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (loop { let mut c = 0; if c == 10 { break c; } c += 1; }) + { a * 2 }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:133:7 | LL | f(1 * a + { 8 * 5 }); - | ^^^^^ help: consider reducing it to: `a` + | ^^^^^ + | +help: consider reducing it to + | +LL | f(a + { 8 * 5 }); + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:135:7 | LL | f(0 + if b { 1 } else { 2 } + 3); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `if b { 1 } else { 2 }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | f(if b { 1 } else { 2 } + 3); + | ~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:138:20 | LL | const _: i32 = { 2 * 4 } + 0 + 3; - | ^^^^^^^^^^^^^ help: consider reducing it to: `{ 2 * 4 }` + | ^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | const _: i32 = { 2 * 4 } + 3; + | ~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:140:20 | LL | const _: i32 = 0 + { 1 + 2 * 3 } + 3; - | ^^^^^^^^^^^^^^^^^ help: consider reducing it to: `{ 1 + 2 * 3 }` + | ^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | const _: i32 = { 1 + 2 * 3 } + 3; + | ~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:143:5 | LL | 0 + a as usize; - | ^^^^^^^^^^^^^^ help: consider reducing it to: `a as usize` + | ^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | a as usize; + | ~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:145:13 | LL | let _ = 0 + a as usize; - | ^^^^^^^^^^^^^^ help: consider reducing it to: `a as usize` + | ^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | let _ = a as usize; + | ~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:147:5 | LL | 0 + { a } as usize; - | ^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `({ a } as usize)` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | ({ a } as usize); + | ~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:150:9 | LL | 2 * (0 + { a }); - | ^^^^^^^^^^^ help: consider reducing it to: `{ a }` + | ^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | 2 * { a }; + | ~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:152:5 | LL | 1 * ({ a } + 4); - | ^^^^^^^^^^^^^^^ help: consider reducing it to: `(({ a } + 4))` + | ^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (({ a } + 4)); + | ~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:154:5 | LL | 1 * 1; - | ^^^^^ help: consider reducing it to: `1` + | ^^^^^ + | +help: consider reducing it to + | +LL | 1; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:159:18 | LL | let _: i32 = &x + 0; - | ^^^^^^ help: consider reducing it to: `x` + | ^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = x; + | ~ error: this operation has no effect --> tests/ui/identity_op.rs:164:5 | LL | 0 + if a { 1 } else { 2 } + if b { 3 } else { 5 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if a { 1 } else { 2 })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | (if a { 1 } else { 2 }) + if b { 3 } else { 5 } + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:175:22 | LL | let _: i32 = *x + 0; - | ^^^^^^ help: consider reducing it to: `*x` + | ^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = *x; + | ~~ error: this operation has no effect --> tests/ui/identity_op.rs:177:22 | LL | let _: i32 = x + 0; - | ^^^^^ help: consider reducing it to: `*x` + | ^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = *x; + | ~~ error: this operation has no effect --> tests/ui/identity_op.rs:182:22 | LL | let _: i32 = **x + 0; - | ^^^^^^^ help: consider reducing it to: `**x` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = **x; + | ~~~ error: this operation has no effect --> tests/ui/identity_op.rs:185:22 | LL | let _: i32 = *x + 0; - | ^^^^^^ help: consider reducing it to: `**x` + | ^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = **x; + | ~~~ error: this operation has no effect --> tests/ui/identity_op.rs:191:22 | LL | let _: i32 = ***x + 0; - | ^^^^^^^^ help: consider reducing it to: `***x` + | ^^^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = ***x; + | ~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:193:22 | LL | let _: i32 = **x + 0; - | ^^^^^^^ help: consider reducing it to: `***x` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = ***x; + | ~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:196:22 | LL | let _: i32 = *&x + 0; - | ^^^^^^^ help: consider reducing it to: `*&x` + | ^^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = *&x; + | ~~~ error: this operation has no effect --> tests/ui/identity_op.rs:198:22 | LL | let _: i32 = **&&x + 0; - | ^^^^^^^^^ help: consider reducing it to: `**&&x` + | ^^^^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = **&&x; + | ~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:200:22 | LL | let _: i32 = *&*&x + 0; - | ^^^^^^^^^ help: consider reducing it to: `*&*&x` + | ^^^^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = *&*&x; + | ~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:202:22 | LL | let _: i32 = **&&*&x + 0; - | ^^^^^^^^^^^ help: consider reducing it to: `**&&*&x` + | ^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = **&&*&x; + | ~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:209:22 | LL | let _: i32 = **&&*&x + 0; - | ^^^^^^^^^^^ help: consider reducing it to: `***&&*&x` + | ^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = ***&&*&x; + | ~~~~~~~~ error: this operation has no effect --> tests/ui/identity_op.rs:211:22 | LL | let _: i32 = **&&*&x + 0; - | ^^^^^^^^^^^ help: consider reducing it to: `***&&*&x` + | ^^^^^^^^^^^ + | +help: consider reducing it to + | +LL | let _: i32 = ***&&*&x; + | ~~~~~~~~ error: aborting due to 52 previous errors diff --git a/src/tools/clippy/tests/ui/ignored_unit_patterns.stderr b/src/tools/clippy/tests/ui/ignored_unit_patterns.stderr index 00a254e39192c..61b7ce41c2034 100644 --- a/src/tools/clippy/tests/ui/ignored_unit_patterns.stderr +++ b/src/tools/clippy/tests/ui/ignored_unit_patterns.stderr @@ -2,58 +2,102 @@ error: matching over `()` is more explicit --> tests/ui/ignored_unit_patterns.rs:16:12 | LL | Ok(_) => {}, - | ^ help: use `()` instead of `_`: `()` + | ^ | = note: `-D clippy::ignored-unit-patterns` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ignored_unit_patterns)]` +help: use `()` instead of `_` + | +LL | Ok(()) => {}, + | ~~ error: matching over `()` is more explicit --> tests/ui/ignored_unit_patterns.rs:17:13 | LL | Err(_) => {}, - | ^ help: use `()` instead of `_`: `()` + | ^ + | +help: use `()` instead of `_` + | +LL | Err(()) => {}, + | ~~ error: matching over `()` is more explicit --> tests/ui/ignored_unit_patterns.rs:19:15 | LL | if let Ok(_) = foo() {} - | ^ help: use `()` instead of `_`: `()` + | ^ + | +help: use `()` instead of `_` + | +LL | if let Ok(()) = foo() {} + | ~~ error: matching over `()` is more explicit --> tests/ui/ignored_unit_patterns.rs:21:28 | LL | let _ = foo().map_err(|_| todo!()); - | ^ help: use `()` instead of `_`: `()` + | ^ + | +help: use `()` instead of `_` + | +LL | let _ = foo().map_err(|()| todo!()); + | ~~ error: matching over `()` is more explicit --> tests/ui/ignored_unit_patterns.rs:27:16 | LL | Ok(_) => {}, - | ^ help: use `()` instead of `_`: `()` + | ^ + | +help: use `()` instead of `_` + | +LL | Ok(()) => {}, + | ~~ error: matching over `()` is more explicit --> tests/ui/ignored_unit_patterns.rs:29:17 | LL | Err(_) => {}, - | ^ help: use `()` instead of `_`: `()` + | ^ + | +help: use `()` instead of `_` + | +LL | Err(()) => {}, + | ~~ error: matching over `()` is more explicit --> tests/ui/ignored_unit_patterns.rs:41:9 | LL | let _ = foo().unwrap(); - | ^ help: use `()` instead of `_`: `()` + | ^ + | +help: use `()` instead of `_` + | +LL | let () = foo().unwrap(); + | ~~ error: matching over `()` is more explicit --> tests/ui/ignored_unit_patterns.rs:50:13 | LL | (1, _) => unimplemented!(), - | ^ help: use `()` instead of `_`: `()` + | ^ + | +help: use `()` instead of `_` + | +LL | (1, ()) => unimplemented!(), + | ~~ error: matching over `()` is more explicit --> tests/ui/ignored_unit_patterns.rs:57:13 | LL | for (x, _) in v { - | ^ help: use `()` instead of `_`: `()` + | ^ + | +help: use `()` instead of `_` + | +LL | for (x, ()) in v { + | ~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/implicit_clone.stderr b/src/tools/clippy/tests/ui/implicit_clone.stderr index 31c212eba2c8d..a8e5a6dc86b3d 100644 --- a/src/tools/clippy/tests/ui/implicit_clone.stderr +++ b/src/tools/clippy/tests/ui/implicit_clone.stderr @@ -2,70 +2,124 @@ error: implicitly cloning a `Vec` by calling `to_owned` on its dereferenced type --> tests/ui/implicit_clone.rs:65:13 | LL | let _ = vec.to_owned(); - | ^^^^^^^^^^^^^^ help: consider using: `vec.clone()` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::implicit-clone` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::implicit_clone)]` +help: consider using + | +LL | let _ = vec.clone(); + | ~~~~~~~~~~~ error: implicitly cloning a `Vec` by calling `to_vec` on its dereferenced type --> tests/ui/implicit_clone.rs:66:13 | LL | let _ = vec.to_vec(); - | ^^^^^^^^^^^^ help: consider using: `vec.clone()` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = vec.clone(); + | ~~~~~~~~~~~ error: implicitly cloning a `Vec` by calling `to_vec` on its dereferenced type --> tests/ui/implicit_clone.rs:71:13 | LL | let _ = vec_ref.to_vec(); - | ^^^^^^^^^^^^^^^^ help: consider using: `vec_ref.clone()` + | ^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = vec_ref.clone(); + | ~~~~~~~~~~~~~~~ error: implicitly cloning a `String` by calling `to_owned` on its dereferenced type --> tests/ui/implicit_clone.rs:83:13 | LL | let _ = str.to_owned(); - | ^^^^^^^^^^^^^^ help: consider using: `str.clone()` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = str.clone(); + | ~~~~~~~~~~~ error: implicitly cloning a `Kitten` by calling `to_owned` on its dereferenced type --> tests/ui/implicit_clone.rs:87:13 | LL | let _ = kitten.to_owned(); - | ^^^^^^^^^^^^^^^^^ help: consider using: `kitten.clone()` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = kitten.clone(); + | ~~~~~~~~~~~~~~ error: implicitly cloning a `PathBuf` by calling `to_owned` on its dereferenced type --> tests/ui/implicit_clone.rs:97:13 | LL | let _ = pathbuf.to_owned(); - | ^^^^^^^^^^^^^^^^^^ help: consider using: `pathbuf.clone()` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = pathbuf.clone(); + | ~~~~~~~~~~~~~~~ error: implicitly cloning a `PathBuf` by calling `to_path_buf` on its dereferenced type --> tests/ui/implicit_clone.rs:98:13 | LL | let _ = pathbuf.to_path_buf(); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `pathbuf.clone()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = pathbuf.clone(); + | ~~~~~~~~~~~~~~~ error: implicitly cloning a `OsString` by calling `to_owned` on its dereferenced type --> tests/ui/implicit_clone.rs:101:13 | LL | let _ = os_string.to_owned(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `os_string.clone()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = os_string.clone(); + | ~~~~~~~~~~~~~~~~~ error: implicitly cloning a `OsString` by calling `to_os_string` on its dereferenced type --> tests/ui/implicit_clone.rs:102:13 | LL | let _ = os_string.to_os_string(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `os_string.clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = os_string.clone(); + | ~~~~~~~~~~~~~~~~~ error: implicitly cloning a `PathBuf` by calling `to_path_buf` on its dereferenced type --> tests/ui/implicit_clone.rs:113:13 | LL | let _ = pathbuf_ref.to_path_buf(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(*pathbuf_ref).clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (*pathbuf_ref).clone(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: implicitly cloning a `PathBuf` by calling `to_path_buf` on its dereferenced type --> tests/ui/implicit_clone.rs:116:13 | LL | let _ = pathbuf_ref.to_path_buf(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(**pathbuf_ref).clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (**pathbuf_ref).clone(); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/implicit_return.stderr b/src/tools/clippy/tests/ui/implicit_return.stderr index f06d4e983c57a..3b06f26f5a05f 100644 --- a/src/tools/clippy/tests/ui/implicit_return.stderr +++ b/src/tools/clippy/tests/ui/implicit_return.stderr @@ -2,88 +2,157 @@ error: missing `return` statement --> tests/ui/implicit_return.rs:15:5 | LL | true - | ^^^^ help: add `return` as shown: `return true` + | ^^^^ | = note: `-D clippy::implicit-return` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::implicit_return)]` +help: add `return` as shown + | +LL | return true + | error: missing `return` statement --> tests/ui/implicit_return.rs:19:15 | LL | if true { true } else { false } - | ^^^^ help: add `return` as shown: `return true` + | ^^^^ + | +help: add `return` as shown + | +LL | if true { return true } else { false } + | ~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:19:29 | LL | if true { true } else { false } - | ^^^^^ help: add `return` as shown: `return false` + | ^^^^^ + | +help: add `return` as shown + | +LL | if true { true } else { return false } + | ~~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:25:17 | LL | true => false, - | ^^^^^ help: add `return` as shown: `return false` + | ^^^^^ + | +help: add `return` as shown + | +LL | true => return false, + | ~~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:26:20 | LL | false => { true }, - | ^^^^ help: add `return` as shown: `return true` + | ^^^^ + | +help: add `return` as shown + | +LL | false => { return true }, + | ~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:39:9 | LL | break true; - | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` + | ^^^^^^^^^^ + | +help: change `break` to `return` as shown + | +LL | return true; + | ~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:46:13 | LL | break true; - | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` + | ^^^^^^^^^^ + | +help: change `break` to `return` as shown + | +LL | return true; + | ~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:54:13 | LL | break true; - | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` + | ^^^^^^^^^^ + | +help: change `break` to `return` as shown + | +LL | return true; + | ~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:72:18 | LL | let _ = || { true }; - | ^^^^ help: add `return` as shown: `return true` + | ^^^^ + | +help: add `return` as shown + | +LL | let _ = || { return true }; + | ~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:73:16 | LL | let _ = || true; - | ^^^^ help: add `return` as shown: `return true` + | ^^^^ + | +help: add `return` as shown + | +LL | let _ = || return true; + | ~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:81:5 | LL | format!("test {}", "test") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `return` as shown: `return format!("test {}", "test")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `return` as shown + | +LL | return format!("test {}", "test") + | error: missing `return` statement --> tests/ui/implicit_return.rs:90:5 | LL | m!(true, false) - | ^^^^^^^^^^^^^^^ help: add `return` as shown: `return m!(true, false)` + | ^^^^^^^^^^^^^^^ + | +help: add `return` as shown + | +LL | return m!(true, false) + | error: missing `return` statement --> tests/ui/implicit_return.rs:96:13 | LL | break true; - | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` + | ^^^^^^^^^^ + | +help: change `break` to `return` as shown + | +LL | return true; + | ~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:101:17 | LL | break 'outer false; - | ^^^^^^^^^^^^^^^^^^ help: change `break` to `return` as shown: `return false` + | ^^^^^^^^^^^^^^^^^^ + | +help: change `break` to `return` as shown + | +LL | return false; + | ~~~~~~~~~~~~ error: missing `return` statement --> tests/ui/implicit_return.rs:116:5 @@ -104,7 +173,12 @@ error: missing `return` statement --> tests/ui/implicit_return.rs:130:5 | LL | true - | ^^^^ help: add `return` as shown: `return true` + | ^^^^ + | +help: add `return` as shown + | +LL | return true + | error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/implicit_saturating_add.stderr b/src/tools/clippy/tests/ui/implicit_saturating_add.stderr index 4fb9282bc91db..5948de219b183 100644 --- a/src/tools/clippy/tests/ui/implicit_saturating_add.stderr +++ b/src/tools/clippy/tests/ui/implicit_saturating_add.stderr @@ -4,10 +4,14 @@ error: manual saturating add detected LL | / if u_8 != u8::MAX { LL | | u_8 += 1; LL | | } - | |_____^ help: use instead: `u_8 = u_8.saturating_add(1);` + | |_____^ | = note: `-D clippy::implicit-saturating-add` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::implicit_saturating_add)]` +help: use instead + | +LL | u_8 = u_8.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:25:5 @@ -15,7 +19,12 @@ error: manual saturating add detected LL | / if u_8 < u8::MAX { LL | | u_8 += 1; LL | | } - | |_____^ help: use instead: `u_8 = u_8.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_8 = u_8.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:33:5 @@ -23,7 +32,12 @@ error: manual saturating add detected LL | / if u_16 != u16::MAX { LL | | u_16 += 1; LL | | } - | |_____^ help: use instead: `u_16 = u_16.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_16 = u_16.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:37:5 @@ -31,7 +45,12 @@ error: manual saturating add detected LL | / if u_16 < u16::MAX { LL | | u_16 += 1; LL | | } - | |_____^ help: use instead: `u_16 = u_16.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_16 = u_16.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:41:5 @@ -39,7 +58,12 @@ error: manual saturating add detected LL | / if u16::MAX > u_16 { LL | | u_16 += 1; LL | | } - | |_____^ help: use instead: `u_16 = u_16.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_16 = u_16.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:45:5 @@ -47,7 +71,12 @@ error: manual saturating add detected LL | / if u_32 != u32::MAX { LL | | u_32 += 1; LL | | } - | |_____^ help: use instead: `u_32 = u_32.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_32 = u_32.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:49:5 @@ -55,7 +84,12 @@ error: manual saturating add detected LL | / if u_32 < u32::MAX { LL | | u_32 += 1; LL | | } - | |_____^ help: use instead: `u_32 = u_32.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_32 = u_32.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:53:5 @@ -63,7 +97,12 @@ error: manual saturating add detected LL | / if u32::MAX > u_32 { LL | | u_32 += 1; LL | | } - | |_____^ help: use instead: `u_32 = u_32.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_32 = u_32.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:57:5 @@ -71,7 +110,12 @@ error: manual saturating add detected LL | / if u_64 != u64::MAX { LL | | u_64 += 1; LL | | } - | |_____^ help: use instead: `u_64 = u_64.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_64 = u_64.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:61:5 @@ -79,7 +123,12 @@ error: manual saturating add detected LL | / if u_64 < u64::MAX { LL | | u_64 += 1; LL | | } - | |_____^ help: use instead: `u_64 = u_64.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_64 = u_64.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:65:5 @@ -87,7 +136,12 @@ error: manual saturating add detected LL | / if u64::MAX > u_64 { LL | | u_64 += 1; LL | | } - | |_____^ help: use instead: `u_64 = u_64.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | u_64 = u_64.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:69:5 @@ -95,7 +149,12 @@ error: manual saturating add detected LL | / if i_8 != i8::MAX { LL | | i_8 += 1; LL | | } - | |_____^ help: use instead: `i_8 = i_8.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_8 = i_8.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:73:5 @@ -103,7 +162,12 @@ error: manual saturating add detected LL | / if i_8 < i8::MAX { LL | | i_8 += 1; LL | | } - | |_____^ help: use instead: `i_8 = i_8.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_8 = i_8.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:77:5 @@ -111,7 +175,12 @@ error: manual saturating add detected LL | / if i8::MAX > i_8 { LL | | i_8 += 1; LL | | } - | |_____^ help: use instead: `i_8 = i_8.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_8 = i_8.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:81:5 @@ -119,7 +188,12 @@ error: manual saturating add detected LL | / if i_16 != i16::MAX { LL | | i_16 += 1; LL | | } - | |_____^ help: use instead: `i_16 = i_16.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_16 = i_16.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:85:5 @@ -127,7 +201,12 @@ error: manual saturating add detected LL | / if i_16 < i16::MAX { LL | | i_16 += 1; LL | | } - | |_____^ help: use instead: `i_16 = i_16.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_16 = i_16.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:89:5 @@ -135,7 +214,12 @@ error: manual saturating add detected LL | / if i16::MAX > i_16 { LL | | i_16 += 1; LL | | } - | |_____^ help: use instead: `i_16 = i_16.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_16 = i_16.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:93:5 @@ -143,7 +227,12 @@ error: manual saturating add detected LL | / if i_32 != i32::MAX { LL | | i_32 += 1; LL | | } - | |_____^ help: use instead: `i_32 = i_32.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_32 = i_32.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:97:5 @@ -151,7 +240,12 @@ error: manual saturating add detected LL | / if i_32 < i32::MAX { LL | | i_32 += 1; LL | | } - | |_____^ help: use instead: `i_32 = i_32.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_32 = i_32.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:101:5 @@ -159,7 +253,12 @@ error: manual saturating add detected LL | / if i32::MAX > i_32 { LL | | i_32 += 1; LL | | } - | |_____^ help: use instead: `i_32 = i_32.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_32 = i_32.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:105:5 @@ -167,7 +266,12 @@ error: manual saturating add detected LL | / if i_64 != i64::MAX { LL | | i_64 += 1; LL | | } - | |_____^ help: use instead: `i_64 = i_64.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_64 = i_64.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:109:5 @@ -175,7 +279,12 @@ error: manual saturating add detected LL | / if i_64 < i64::MAX { LL | | i_64 += 1; LL | | } - | |_____^ help: use instead: `i_64 = i_64.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_64 = i_64.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:113:5 @@ -183,7 +292,12 @@ error: manual saturating add detected LL | / if i64::MAX > i_64 { LL | | i_64 += 1; LL | | } - | |_____^ help: use instead: `i_64 = i_64.saturating_add(1);` + | |_____^ + | +help: use instead + | +LL | i_64 = i_64.saturating_add(1); + | error: manual saturating add detected --> tests/ui/implicit_saturating_add.rs:149:12 @@ -192,7 +306,12 @@ LL | } else if u_32 < u32::MAX { | ____________^ LL | | u_32 += 1; LL | | } - | |_____^ help: use instead: `{u_32 = u_32.saturating_add(1); }` + | |_____^ + | +help: use instead + | +LL | } else {u_32 = u_32.saturating_add(1); } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 24 previous errors diff --git a/src/tools/clippy/tests/ui/implicit_saturating_sub.stderr b/src/tools/clippy/tests/ui/implicit_saturating_sub.stderr index 59a9ddbff2d6e..6b32fc6493609 100644 --- a/src/tools/clippy/tests/ui/implicit_saturating_sub.stderr +++ b/src/tools/clippy/tests/ui/implicit_saturating_sub.stderr @@ -4,10 +4,14 @@ error: implicitly performing saturating subtraction LL | / if u_8 > 0 { LL | | u_8 = u_8 - 1; LL | | } - | |_____^ help: try: `u_8 = u_8.saturating_sub(1);` + | |_____^ | = note: `-D clippy::implicit-saturating-sub` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::implicit_saturating_sub)]` +help: try + | +LL | u_8 = u_8.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:34:13 @@ -15,7 +19,12 @@ error: implicitly performing saturating subtraction LL | / if u_8 > 0 { LL | | u_8 -= 1; LL | | } - | |_____________^ help: try: `u_8 = u_8.saturating_sub(1);` + | |_____________^ + | +help: try + | +LL | u_8 = u_8.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:48:5 @@ -23,7 +32,12 @@ error: implicitly performing saturating subtraction LL | / if u_16 > 0 { LL | | u_16 -= 1; LL | | } - | |_____^ help: try: `u_16 = u_16.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | u_16 = u_16.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:58:5 @@ -31,7 +45,12 @@ error: implicitly performing saturating subtraction LL | / if u_32 != 0 { LL | | u_32 -= 1; LL | | } - | |_____^ help: try: `u_32 = u_32.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | u_32 = u_32.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:79:5 @@ -39,7 +58,12 @@ error: implicitly performing saturating subtraction LL | / if u_64 > 0 { LL | | u_64 -= 1; LL | | } - | |_____^ help: try: `u_64 = u_64.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | u_64 = u_64.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:84:5 @@ -47,7 +71,12 @@ error: implicitly performing saturating subtraction LL | / if 0 < u_64 { LL | | u_64 -= 1; LL | | } - | |_____^ help: try: `u_64 = u_64.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | u_64 = u_64.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:89:5 @@ -55,7 +84,12 @@ error: implicitly performing saturating subtraction LL | / if 0 != u_64 { LL | | u_64 -= 1; LL | | } - | |_____^ help: try: `u_64 = u_64.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | u_64 = u_64.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:110:5 @@ -63,7 +97,12 @@ error: implicitly performing saturating subtraction LL | / if u_usize > 0 { LL | | u_usize -= 1; LL | | } - | |_____^ help: try: `u_usize = u_usize.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | u_usize = u_usize.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:122:5 @@ -71,7 +110,12 @@ error: implicitly performing saturating subtraction LL | / if i_8 > i8::MIN { LL | | i_8 -= 1; LL | | } - | |_____^ help: try: `i_8 = i_8.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_8 = i_8.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:127:5 @@ -79,7 +123,12 @@ error: implicitly performing saturating subtraction LL | / if i_8 > i8::MIN { LL | | i_8 -= 1; LL | | } - | |_____^ help: try: `i_8 = i_8.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_8 = i_8.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:132:5 @@ -87,7 +136,12 @@ error: implicitly performing saturating subtraction LL | / if i_8 != i8::MIN { LL | | i_8 -= 1; LL | | } - | |_____^ help: try: `i_8 = i_8.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_8 = i_8.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:137:5 @@ -95,7 +149,12 @@ error: implicitly performing saturating subtraction LL | / if i_8 != i8::MIN { LL | | i_8 -= 1; LL | | } - | |_____^ help: try: `i_8 = i_8.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_8 = i_8.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:147:5 @@ -103,7 +162,12 @@ error: implicitly performing saturating subtraction LL | / if i_16 > i16::MIN { LL | | i_16 -= 1; LL | | } - | |_____^ help: try: `i_16 = i_16.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_16 = i_16.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:152:5 @@ -111,7 +175,12 @@ error: implicitly performing saturating subtraction LL | / if i_16 > i16::MIN { LL | | i_16 -= 1; LL | | } - | |_____^ help: try: `i_16 = i_16.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_16 = i_16.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:157:5 @@ -119,7 +188,12 @@ error: implicitly performing saturating subtraction LL | / if i_16 != i16::MIN { LL | | i_16 -= 1; LL | | } - | |_____^ help: try: `i_16 = i_16.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_16 = i_16.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:162:5 @@ -127,7 +201,12 @@ error: implicitly performing saturating subtraction LL | / if i_16 != i16::MIN { LL | | i_16 -= 1; LL | | } - | |_____^ help: try: `i_16 = i_16.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_16 = i_16.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:172:5 @@ -135,7 +214,12 @@ error: implicitly performing saturating subtraction LL | / if i_32 > i32::MIN { LL | | i_32 -= 1; LL | | } - | |_____^ help: try: `i_32 = i_32.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_32 = i_32.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:177:5 @@ -143,7 +227,12 @@ error: implicitly performing saturating subtraction LL | / if i_32 > i32::MIN { LL | | i_32 -= 1; LL | | } - | |_____^ help: try: `i_32 = i_32.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_32 = i_32.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:182:5 @@ -151,7 +240,12 @@ error: implicitly performing saturating subtraction LL | / if i_32 != i32::MIN { LL | | i_32 -= 1; LL | | } - | |_____^ help: try: `i_32 = i_32.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_32 = i_32.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:187:5 @@ -159,7 +253,12 @@ error: implicitly performing saturating subtraction LL | / if i_32 != i32::MIN { LL | | i_32 -= 1; LL | | } - | |_____^ help: try: `i_32 = i_32.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_32 = i_32.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:197:5 @@ -167,7 +266,12 @@ error: implicitly performing saturating subtraction LL | / if i64::MIN < i_64 { LL | | i_64 -= 1; LL | | } - | |_____^ help: try: `i_64 = i_64.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_64 = i_64.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:202:5 @@ -175,7 +279,12 @@ error: implicitly performing saturating subtraction LL | / if i64::MIN != i_64 { LL | | i_64 -= 1; LL | | } - | |_____^ help: try: `i_64 = i_64.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_64 = i_64.saturating_sub(1); + | error: implicitly performing saturating subtraction --> tests/ui/implicit_saturating_sub.rs:207:5 @@ -183,7 +292,12 @@ error: implicitly performing saturating subtraction LL | / if i64::MIN < i_64 { LL | | i_64 -= 1; LL | | } - | |_____^ help: try: `i_64 = i_64.saturating_sub(1);` + | |_____^ + | +help: try + | +LL | i_64 = i_64.saturating_sub(1); + | error: aborting due to 23 previous errors diff --git a/src/tools/clippy/tests/ui/inconsistent_digit_grouping.stderr b/src/tools/clippy/tests/ui/inconsistent_digit_grouping.stderr index 173b824935c8f..7eeb93ec6caa8 100644 --- a/src/tools/clippy/tests/ui/inconsistent_digit_grouping.stderr +++ b/src/tools/clippy/tests/ui/inconsistent_digit_grouping.stderr @@ -2,70 +2,118 @@ error: digits grouped inconsistently by underscores --> tests/ui/inconsistent_digit_grouping.rs:25:16 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::inconsistent_digit_grouping)]` +help: consider + | +LL | let bad = (123_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); + | ~~~~~~~ error: digits grouped inconsistently by underscores --> tests/ui/inconsistent_digit_grouping.rs:25:26 | LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); - | ^^^^^^^^^^ help: consider: `12_345_678` + | ^^^^^^^^^^ + | +help: consider + | +LL | let bad = (1_23_456, 12_345_678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); + | ~~~~~~~~~~ error: digits grouped inconsistently by underscores --> tests/ui/inconsistent_digit_grouping.rs:25:38 | LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); - | ^^^^^^^^ help: consider: `1_234_567` + | ^^^^^^^^ + | +help: consider + | +LL | let bad = (1_23_456, 1_234_5678, 1_234_567, 1_234.5678_f32, 1.234_5678_f32); + | ~~~~~~~~~ error: digits grouped inconsistently by underscores --> tests/ui/inconsistent_digit_grouping.rs:25:48 | LL | 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` + | ^^^^^^^^^^^^^^ + | +help: consider + | +LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.567_8_f32, 1.234_5678_f32); + | ~~~~~~~~~~~~~~~ error: digits grouped inconsistently by underscores --> tests/ui/inconsistent_digit_grouping.rs:25:64 | LL | 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` + | ^^^^^^^^^^^^^^ + | +help: consider + | +LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_567_8_f32); + | ~~~~~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/inconsistent_digit_grouping.rs:28:13 | LL | let _ = 0x100000; - | ^^^^^^^^ help: consider: `0x0010_0000` + | ^^^^^^^^ | note: the lint level is defined here --> tests/ui/inconsistent_digit_grouping.rs:2:8 | LL | #[deny(clippy::unreadable_literal)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider + | +LL | let _ = 0x0010_0000; + | ~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/inconsistent_digit_grouping.rs:29:13 | LL | let _ = 0x1000000; - | ^^^^^^^^^ help: consider: `0x0100_0000` + | ^^^^^^^^^ + | +help: consider + | +LL | let _ = 0x0100_0000; + | ~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/inconsistent_digit_grouping.rs:30:13 | LL | let _ = 0x10000000; - | ^^^^^^^^^^ help: consider: `0x1000_0000` + | ^^^^^^^^^^ + | +help: consider + | +LL | let _ = 0x1000_0000; + | ~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/inconsistent_digit_grouping.rs:31:13 | LL | let _ = 0x100000000_u64; - | ^^^^^^^^^^^^^^^ help: consider: `0x0001_0000_0000_u64` + | ^^^^^^^^^^^^^^^ + | +help: consider + | +LL | let _ = 0x0001_0000_0000_u64; + | ~~~~~~~~~~~~~~~~~~~~ error: digits grouped inconsistently by underscores --> tests/ui/inconsistent_digit_grouping.rs:34:18 | LL | let _: f32 = 1_23_456.; - | ^^^^^^^^^ help: consider: `123_456.` + | ^^^^^^^^^ + | +help: consider + | +LL | let _: f32 = 123_456.; + | ~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/inconsistent_struct_constructor.stderr b/src/tools/clippy/tests/ui/inconsistent_struct_constructor.stderr index 1192271f911fd..b11850498df3b 100644 --- a/src/tools/clippy/tests/ui/inconsistent_struct_constructor.stderr +++ b/src/tools/clippy/tests/ui/inconsistent_struct_constructor.stderr @@ -2,10 +2,14 @@ error: struct constructor field order is inconsistent with struct definition fie --> tests/ui/inconsistent_struct_constructor.rs:28:9 | LL | Foo { y, x, z }; - | ^^^^^^^^^^^^^^^ help: try: `Foo { x, y, z }` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::inconsistent-struct-constructor` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::inconsistent_struct_constructor)]` +help: try + | +LL | Foo { x, y, z }; + | ~~~~~~~~~~~~~~~ error: struct constructor field order is inconsistent with struct definition field order --> tests/ui/inconsistent_struct_constructor.rs:55:9 @@ -15,7 +19,12 @@ LL | | z, LL | | x, LL | | ..Default::default() LL | | }; - | |_________^ help: try: `Foo { x, z, ..Default::default() }` + | |_________^ + | +help: try + | +LL | Foo { x, z, ..Default::default() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/ineffective_open_options.stderr b/src/tools/clippy/tests/ui/ineffective_open_options.stderr index 0d6933bb449e8..24b054b6b2e5a 100644 --- a/src/tools/clippy/tests/ui/ineffective_open_options.stderr +++ b/src/tools/clippy/tests/ui/ineffective_open_options.stderr @@ -2,16 +2,27 @@ error: unnecessary use of `.write(true)` because there is `.append(true)` --> tests/ui/ineffective_open_options.rs:8:9 | LL | .write(true) - | ^^^^^^^^^^^^ help: remove `.write(true)` + | ^^^^^^^^^^^^ | = note: `-D clippy::ineffective-open-options` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ineffective_open_options)]` +help: remove `.write(true)` + | +LL - .write(true) +LL + + | error: unnecessary use of `.write(true)` because there is `.append(true)` --> tests/ui/ineffective_open_options.rs:16:9 | LL | .write(true) - | ^^^^^^^^^^^^ help: remove `.write(true)` + | ^^^^^^^^^^^^ + | +help: remove `.write(true)` + | +LL - .write(true) +LL + + | error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/inefficient_to_string.stderr b/src/tools/clippy/tests/ui/inefficient_to_string.stderr index e71e667cf0cfe..6ebe0f35a2e47 100644 --- a/src/tools/clippy/tests/ui/inefficient_to_string.stderr +++ b/src/tools/clippy/tests/ui/inefficient_to_string.stderr @@ -2,7 +2,7 @@ error: calling `to_string` on `&&str` --> tests/ui/inefficient_to_string.rs:10:21 | LL | let _: String = rrstr.to_string(); - | ^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrstr).to_string()` + | ^^^^^^^^^^^^^^^^^ | = help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString` note: the lint level is defined here @@ -10,46 +10,70 @@ note: the lint level is defined here | LL | #![deny(clippy::inefficient_to_string)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try dereferencing the receiver + | +LL | let _: String = (*rrstr).to_string(); + | ~~~~~~~~~~~~~~~~~~~~ error: calling `to_string` on `&&&str` --> tests/ui/inefficient_to_string.rs:11:21 | LL | let _: String = rrrstr.to_string(); - | ^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrstr).to_string()` + | ^^^^^^^^^^^^^^^^^^ | = help: `&&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString` +help: try dereferencing the receiver + | +LL | let _: String = (**rrrstr).to_string(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: calling `to_string` on `&&std::string::String` --> tests/ui/inefficient_to_string.rs:19:21 | LL | let _: String = rrstring.to_string(); - | ^^^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrstring).to_string()` + | ^^^^^^^^^^^^^^^^^^^^ | = help: `&std::string::String` implements `ToString` through a slower blanket impl, but `std::string::String` has a fast specialization of `ToString` +help: try dereferencing the receiver + | +LL | let _: String = (*rrstring).to_string(); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: calling `to_string` on `&&&std::string::String` --> tests/ui/inefficient_to_string.rs:20:21 | LL | let _: String = rrrstring.to_string(); - | ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrstring).to_string()` + | ^^^^^^^^^^^^^^^^^^^^^ | = help: `&&std::string::String` implements `ToString` through a slower blanket impl, but `std::string::String` has a fast specialization of `ToString` +help: try dereferencing the receiver + | +LL | let _: String = (**rrrstring).to_string(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `to_string` on `&&std::borrow::Cow<'_, str>` --> tests/ui/inefficient_to_string.rs:28:21 | LL | let _: String = rrcow.to_string(); - | ^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrcow).to_string()` + | ^^^^^^^^^^^^^^^^^ | = help: `&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString` +help: try dereferencing the receiver + | +LL | let _: String = (*rrcow).to_string(); + | ~~~~~~~~~~~~~~~~~~~~ error: calling `to_string` on `&&&std::borrow::Cow<'_, str>` --> tests/ui/inefficient_to_string.rs:29:21 | LL | let _: String = rrrcow.to_string(); - | ^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrcow).to_string()` + | ^^^^^^^^^^^^^^^^^^ | = help: `&&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString` +help: try dereferencing the receiver + | +LL | let _: String = (**rrrcow).to_string(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/infallible_destructuring_match.stderr b/src/tools/clippy/tests/ui/infallible_destructuring_match.stderr index b709fd8630e99..9bdc858359532 100644 --- a/src/tools/clippy/tests/ui/infallible_destructuring_match.stderr +++ b/src/tools/clippy/tests/ui/infallible_destructuring_match.stderr @@ -4,10 +4,14 @@ error: you seem to be trying to use `match` to destructure a single infallible p LL | / let data = match wrapper { LL | | SingleVariantEnum::Variant(i) => i, LL | | }; - | |______^ help: try: `let SingleVariantEnum::Variant(data) = wrapper;` + | |______^ | = note: `-D clippy::infallible-destructuring-match` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::infallible_destructuring_match)]` +help: try + | +LL | let SingleVariantEnum::Variant(data) = wrapper; + | error: you seem to be trying to use `match` to destructure a single infallible pattern. Consider using `let` --> tests/ui/infallible_destructuring_match.rs:60:5 @@ -15,7 +19,12 @@ error: you seem to be trying to use `match` to destructure a single infallible p LL | / let data = match wrapper { LL | | TupleStruct(i) => i, LL | | }; - | |______^ help: try: `let TupleStruct(data) = wrapper;` + | |______^ + | +help: try + | +LL | let TupleStruct(data) = wrapper; + | error: you seem to be trying to use `match` to destructure a single infallible pattern. Consider using `let` --> tests/ui/infallible_destructuring_match.rs:84:5 @@ -23,7 +32,12 @@ error: you seem to be trying to use `match` to destructure a single infallible p LL | / let data = match wrapper { LL | | TupleStructWithNonCopy(ref n) => n, LL | | }; - | |______^ help: try: `let TupleStructWithNonCopy(ref data) = wrapper;` + | |______^ + | +help: try + | +LL | let TupleStructWithNonCopy(ref data) = wrapper; + | error: you seem to be trying to use `match` to destructure a single infallible pattern. Consider using `let` --> tests/ui/infallible_destructuring_match.rs:103:5 @@ -31,7 +45,12 @@ error: you seem to be trying to use `match` to destructure a single infallible p LL | / let data = match wrapper { LL | | Ok(i) => i, LL | | }; - | |______^ help: try: `let Ok(data) = wrapper;` + | |______^ + | +help: try + | +LL | let Ok(data) = wrapper; + | error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/inline_fn_without_body.stderr b/src/tools/clippy/tests/ui/inline_fn_without_body.stderr index 89db710fabe77..9a608bcdede5b 100644 --- a/src/tools/clippy/tests/ui/inline_fn_without_body.stderr +++ b/src/tools/clippy/tests/ui/inline_fn_without_body.stderr @@ -1,29 +1,37 @@ error: use of `#[inline]` on trait method `default_inline` which has no body --> tests/ui/inline_fn_without_body.rs:5:5 | -LL | #[inline] - | _____-^^^^^^^^ -LL | | fn default_inline(); - | |____- help: remove +LL | #[inline] + | ^^^^^^^^^ | = note: `-D clippy::inline-fn-without-body` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::inline_fn_without_body)]` +help: remove + | +LL - #[inline] + | error: use of `#[inline]` on trait method `always_inline` which has no body --> tests/ui/inline_fn_without_body.rs:8:5 | -LL | #[inline(always)] - | _____-^^^^^^^^^^^^^^^^ -LL | | fn always_inline(); - | |____- help: remove +LL | #[inline(always)] + | ^^^^^^^^^^^^^^^^^ + | +help: remove + | +LL - #[inline(always)] + | error: use of `#[inline]` on trait method `never_inline` which has no body --> tests/ui/inline_fn_without_body.rs:11:5 | -LL | #[inline(never)] - | _____-^^^^^^^^^^^^^^^ -LL | | fn never_inline(); - | |____- help: remove +LL | #[inline(never)] + | ^^^^^^^^^^^^^^^^ + | +help: remove + | +LL - #[inline(never)] + | error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/int_plus_one.stderr b/src/tools/clippy/tests/ui/int_plus_one.stderr index cedac14f350d4..bdba16d7247f0 100644 --- a/src/tools/clippy/tests/ui/int_plus_one.stderr +++ b/src/tools/clippy/tests/ui/int_plus_one.stderr @@ -2,28 +2,47 @@ error: unnecessary `>= y + 1` or `x - 1 >=` --> tests/ui/int_plus_one.rs:7:13 | LL | let _ = x >= y + 1; - | ^^^^^^^^^^ help: change it to: `x > y` + | ^^^^^^^^^^ | = note: `-D clippy::int-plus-one` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::int_plus_one)]` +help: change it to + | +LL | let _ = x > y; + | ~~~~~ error: unnecessary `>= y + 1` or `x - 1 >=` --> tests/ui/int_plus_one.rs:8:13 | LL | let _ = y + 1 <= x; - | ^^^^^^^^^^ help: change it to: `y < x` + | ^^^^^^^^^^ + | +help: change it to + | +LL | let _ = y < x; + | ~~~~~ error: unnecessary `>= y + 1` or `x - 1 >=` --> tests/ui/int_plus_one.rs:10:13 | LL | let _ = x - 1 >= y; - | ^^^^^^^^^^ help: change it to: `x > y` + | ^^^^^^^^^^ + | +help: change it to + | +LL | let _ = x > y; + | ~~~~~ error: unnecessary `>= y + 1` or `x - 1 >=` --> tests/ui/int_plus_one.rs:11:13 | LL | let _ = y <= x - 1; - | ^^^^^^^^^^ help: change it to: `y < x` + | ^^^^^^^^^^ + | +help: change it to + | +LL | let _ = y < x; + | ~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/into_iter_on_ref.stderr b/src/tools/clippy/tests/ui/into_iter_on_ref.stderr index 64d814074da46..205948512b83c 100644 --- a/src/tools/clippy/tests/ui/into_iter_on_ref.stderr +++ b/src/tools/clippy/tests/ui/into_iter_on_ref.stderr @@ -2,160 +2,289 @@ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume --> tests/ui/into_iter_on_ref.rs:13:30 | LL | let _ = (&vec![1, 2, 3]).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ | = note: `-D clippy::into-iter-on-ref` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::into_iter_on_ref)]` +help: call directly + | +LL | let _ = (&vec![1, 2, 3]).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice` --> tests/ui/into_iter_on_ref.rs:14:41 | LL | let _ = std::rc::Rc::from(&[X][..]).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = std::rc::Rc::from(&[X][..]).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice` --> tests/ui/into_iter_on_ref.rs:15:44 | LL | let _ = std::sync::Arc::from(&[X][..]).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = std::sync::Arc::from(&[X][..]).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `array` --> tests/ui/into_iter_on_ref.rs:17:32 | LL | let _ = (&&&&&&&[1, 2, 3]).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&&&&&&&[1, 2, 3]).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `array` --> tests/ui/into_iter_on_ref.rs:18:36 | LL | let _ = (&&&&mut &&&[1, 2, 3]).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&&&&mut &&&[1, 2, 3]).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not consume the `array` --> tests/ui/into_iter_on_ref.rs:19:40 | LL | let _ = (&mut &mut &mut [1, 2, 3]).into_iter(); - | ^^^^^^^^^ help: call directly: `iter_mut` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&mut &mut &mut [1, 2, 3]).iter_mut(); + | ~~~~~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Option` --> tests/ui/into_iter_on_ref.rs:21:24 | LL | let _ = (&Some(4)).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&Some(4)).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not consume the `Option` --> tests/ui/into_iter_on_ref.rs:22:28 | LL | let _ = (&mut Some(5)).into_iter(); - | ^^^^^^^^^ help: call directly: `iter_mut` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&mut Some(5)).iter_mut(); + | ~~~~~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Result` --> tests/ui/into_iter_on_ref.rs:23:32 | LL | let _ = (&Ok::<_, i32>(6)).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&Ok::<_, i32>(6)).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not consume the `Result` --> tests/ui/into_iter_on_ref.rs:24:37 | LL | let _ = (&mut Err::(7)).into_iter(); - | ^^^^^^^^^ help: call directly: `iter_mut` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&mut Err::(7)).iter_mut(); + | ~~~~~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec` --> tests/ui/into_iter_on_ref.rs:25:34 | LL | let _ = (&Vec::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&Vec::::new()).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not consume the `Vec` --> tests/ui/into_iter_on_ref.rs:26:38 | LL | let _ = (&mut Vec::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter_mut` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&mut Vec::::new()).iter_mut(); + | ~~~~~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `BTreeMap` --> tests/ui/into_iter_on_ref.rs:27:44 | LL | let _ = (&BTreeMap::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&BTreeMap::::new()).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not consume the `BTreeMap` --> tests/ui/into_iter_on_ref.rs:28:48 | LL | let _ = (&mut BTreeMap::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter_mut` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&mut BTreeMap::::new()).iter_mut(); + | ~~~~~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `VecDeque` --> tests/ui/into_iter_on_ref.rs:29:39 | LL | let _ = (&VecDeque::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&VecDeque::::new()).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not consume the `VecDeque` --> tests/ui/into_iter_on_ref.rs:30:43 | LL | let _ = (&mut VecDeque::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter_mut` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&mut VecDeque::::new()).iter_mut(); + | ~~~~~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `LinkedList` --> tests/ui/into_iter_on_ref.rs:31:41 | LL | let _ = (&LinkedList::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&LinkedList::::new()).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not consume the `LinkedList` --> tests/ui/into_iter_on_ref.rs:32:45 | LL | let _ = (&mut LinkedList::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter_mut` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&mut LinkedList::::new()).iter_mut(); + | ~~~~~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `HashMap` --> tests/ui/into_iter_on_ref.rs:33:43 | LL | let _ = (&HashMap::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&HashMap::::new()).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not consume the `HashMap` --> tests/ui/into_iter_on_ref.rs:34:47 | LL | let _ = (&mut HashMap::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter_mut` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&mut HashMap::::new()).iter_mut(); + | ~~~~~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `BTreeSet` --> tests/ui/into_iter_on_ref.rs:36:39 | LL | let _ = (&BTreeSet::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&BTreeSet::::new()).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `BinaryHeap` --> tests/ui/into_iter_on_ref.rs:37:41 | LL | let _ = (&BinaryHeap::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&BinaryHeap::::new()).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `HashSet` --> tests/ui/into_iter_on_ref.rs:38:38 | LL | let _ = (&HashSet::::new()).into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&HashSet::::new()).iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Path` --> tests/ui/into_iter_on_ref.rs:39:43 | LL | let _ = std::path::Path::new("12/34").into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = std::path::Path::new("12/34").iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `PathBuf` --> tests/ui/into_iter_on_ref.rs:40:47 | LL | let _ = std::path::PathBuf::from("12/34").into_iter(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = std::path::PathBuf::from("12/34").iter(); + | ~~~~ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `array` --> tests/ui/into_iter_on_ref.rs:42:26 | LL | let _ = (&[1, 2, 3]).into_iter().next(); - | ^^^^^^^^^ help: call directly: `iter` + | ^^^^^^^^^ + | +help: call directly + | +LL | let _ = (&[1, 2, 3]).iter().next(); + | ~~~~ error: aborting due to 26 previous errors diff --git a/src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr b/src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr index 54d79ba1aeb4f..4823104c676ff 100644 --- a/src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr +++ b/src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr @@ -2,153 +2,277 @@ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:3:59 | LL | let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null(), 0); - | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^ | = note: `#[deny(clippy::invalid_null_ptr_usage)]` on by default +help: change this to + | +LL | let _slice: &[usize] = std::slice::from_raw_parts(core::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:4:59 | LL | let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null_mut(), 0); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _slice: &[usize] = std::slice::from_raw_parts(core::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:6:63 | LL | let _slice: &[usize] = std::slice::from_raw_parts_mut(std::ptr::null_mut(), 0); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _slice: &[usize] = std::slice::from_raw_parts_mut(core::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:8:33 | LL | std::ptr::copy::(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0); - | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::copy::(core::ptr::NonNull::dangling().as_ptr(), std::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:9:73 | LL | std::ptr::copy::(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::copy::(std::ptr::NonNull::dangling().as_ptr(), core::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:11:48 | LL | std::ptr::copy_nonoverlapping::(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0); - | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::copy_nonoverlapping::(core::ptr::NonNull::dangling().as_ptr(), std::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:12:88 | LL | std::ptr::copy_nonoverlapping::(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::copy_nonoverlapping::(std::ptr::NonNull::dangling().as_ptr(), core::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:17:36 | LL | let _a: A = std::ptr::read(std::ptr::null()); - | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _a: A = std::ptr::read(core::ptr::NonNull::dangling().as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:18:36 | LL | let _a: A = std::ptr::read(std::ptr::null_mut()); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _a: A = std::ptr::read(core::ptr::NonNull::dangling().as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:20:46 | LL | let _a: A = std::ptr::read_unaligned(std::ptr::null()); - | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _a: A = std::ptr::read_unaligned(core::ptr::NonNull::dangling().as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:21:46 | LL | let _a: A = std::ptr::read_unaligned(std::ptr::null_mut()); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _a: A = std::ptr::read_unaligned(core::ptr::NonNull::dangling().as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:23:45 | LL | let _a: A = std::ptr::read_volatile(std::ptr::null()); - | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _a: A = std::ptr::read_volatile(core::ptr::NonNull::dangling().as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:24:45 | LL | let _a: A = std::ptr::read_volatile(std::ptr::null_mut()); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _a: A = std::ptr::read_volatile(core::ptr::NonNull::dangling().as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:26:39 | LL | let _a: A = std::ptr::replace(std::ptr::null_mut(), A); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _a: A = std::ptr::replace(core::ptr::NonNull::dangling().as_ptr(), A); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:28:69 | LL | let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null(), 0); - | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _slice: *const [usize] = std::ptr::slice_from_raw_parts(core::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:29:69 | LL | let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null_mut(), 0); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _slice: *const [usize] = std::ptr::slice_from_raw_parts(core::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:31:73 | LL | let _slice: *const [usize] = std::ptr::slice_from_raw_parts_mut(std::ptr::null_mut(), 0); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _slice: *const [usize] = std::ptr::slice_from_raw_parts_mut(core::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:33:29 | LL | std::ptr::swap::(std::ptr::null_mut(), &mut A); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::swap::(core::ptr::NonNull::dangling().as_ptr(), &mut A); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:34:37 | LL | std::ptr::swap::(&mut A, std::ptr::null_mut()); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::swap::(&mut A, core::ptr::NonNull::dangling().as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:36:44 | LL | std::ptr::swap_nonoverlapping::(std::ptr::null_mut(), &mut A, 0); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::swap_nonoverlapping::(core::ptr::NonNull::dangling().as_ptr(), &mut A, 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:37:52 | LL | std::ptr::swap_nonoverlapping::(&mut A, std::ptr::null_mut(), 0); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::swap_nonoverlapping::(&mut A, core::ptr::NonNull::dangling().as_ptr(), 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:39:25 | LL | std::ptr::write(std::ptr::null_mut(), A); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::write(core::ptr::NonNull::dangling().as_ptr(), A); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:41:35 | LL | std::ptr::write_unaligned(std::ptr::null_mut(), A); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::write_unaligned(core::ptr::NonNull::dangling().as_ptr(), A); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:43:34 | LL | std::ptr::write_volatile(std::ptr::null_mut(), A); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::write_volatile(core::ptr::NonNull::dangling().as_ptr(), A); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: pointer must be non-null --> tests/ui/invalid_null_ptr_usage.rs:45:40 | LL | std::ptr::write_bytes::(std::ptr::null_mut(), 42, 0); - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | std::ptr::write_bytes::(core::ptr::NonNull::dangling().as_ptr(), 42, 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 25 previous errors diff --git a/src/tools/clippy/tests/ui/is_digit_ascii_radix.stderr b/src/tools/clippy/tests/ui/is_digit_ascii_radix.stderr index f26183ddab84d..37ef0714d1f4e 100644 --- a/src/tools/clippy/tests/ui/is_digit_ascii_radix.stderr +++ b/src/tools/clippy/tests/ui/is_digit_ascii_radix.stderr @@ -2,22 +2,36 @@ error: use of `char::is_digit` with literal radix of 10 --> tests/ui/is_digit_ascii_radix.rs:9:13 | LL | let _ = c.is_digit(10); - | ^^^^^^^^^^^^^^ help: try: `c.is_ascii_digit()` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::is-digit-ascii-radix` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::is_digit_ascii_radix)]` +help: try + | +LL | let _ = c.is_ascii_digit(); + | ~~~~~~~~~~~~~~~~~~ error: use of `char::is_digit` with literal radix of 16 --> tests/ui/is_digit_ascii_radix.rs:10:13 | LL | let _ = c.is_digit(16); - | ^^^^^^^^^^^^^^ help: try: `c.is_ascii_hexdigit()` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = c.is_ascii_hexdigit(); + | ~~~~~~~~~~~~~~~~~~~~~ error: use of `char::is_digit` with literal radix of 16 --> tests/ui/is_digit_ascii_radix.rs:11:13 | LL | let _ = c.is_digit(0x10); - | ^^^^^^^^^^^^^^^^ help: try: `c.is_ascii_hexdigit()` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = c.is_ascii_hexdigit(); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/issue_2356.stderr b/src/tools/clippy/tests/ui/issue_2356.stderr index eae2ce97fc6b1..08799c095ac6b 100644 --- a/src/tools/clippy/tests/ui/issue_2356.stderr +++ b/src/tools/clippy/tests/ui/issue_2356.stderr @@ -2,13 +2,17 @@ error: this loop could be written as a `for` loop --> tests/ui/issue_2356.rs:17:9 | LL | while let Some(e) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for e in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/issue_2356.rs:1:9 | LL | #![deny(clippy::while_let_on_iterator)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | for e in it { + | ~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/items_after_test_module/root_module.stderr b/src/tools/clippy/tests/ui/items_after_test_module/root_module.stderr index bed8d4bd5a00c..ad29cecdf14d2 100644 --- a/src/tools/clippy/tests/ui/items_after_test_module/root_module.stderr +++ b/src/tools/clippy/tests/ui/items_after_test_module/root_module.stderr @@ -14,7 +14,21 @@ LL | macro_rules! should_lint { | = note: `-D clippy::items-after-test-module` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::items_after_test_module)]` - = help: move the items to before the test module was defined +help: move the items to before the test module was defined + | +LL ~ fn should_not_lint() {} +LL + +LL + fn should_lint() {} +LL + +LL + const SHOULD_ALSO_LINT: usize = 1; +LL + macro_rules! should_lint { +LL + () => {}; +LL + } +LL | +... +LL | fn hi() {} +LL ~ } + | error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/iter_cloned_collect.stderr b/src/tools/clippy/tests/ui/iter_cloned_collect.stderr index e8d82ec2c1b39..02fc47a996fbd 100644 --- a/src/tools/clippy/tests/ui/iter_cloned_collect.stderr +++ b/src/tools/clippy/tests/ui/iter_cloned_collect.stderr @@ -2,16 +2,25 @@ error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling --> tests/ui/iter_cloned_collect.rs:8:27 | LL | let v2: Vec = v.iter().cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-cloned-collect` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_cloned_collect)]` +help: try + | +LL | let v2: Vec = v.to_vec(); + | ~~~~~~~~~ error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable --> tests/ui/iter_cloned_collect.rs:13:38 | LL | let _: Vec = vec![1, 2, 3].iter().cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: Vec = vec![1, 2, 3].to_vec(); + | ~~~~~~~~~ error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable --> tests/ui/iter_cloned_collect.rs:18:24 @@ -21,19 +30,34 @@ LL | .to_bytes() LL | | .iter() LL | | .cloned() LL | | .collect(); - | |______________________^ help: try: `.to_vec()` + | |______________________^ + | +help: try + | +LL | .to_bytes().to_vec(); + | ~~~~~~~~~ error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable --> tests/ui/iter_cloned_collect.rs:26:24 | LL | let _: Vec<_> = arr.iter().cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: Vec<_> = arr.to_vec(); + | ~~~~~~~~~ error: called `iter().copied().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable --> tests/ui/iter_cloned_collect.rs:29:26 | LL | let _: Vec = v.iter().copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: Vec = v.to_vec(); + | ~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/iter_count.stderr b/src/tools/clippy/tests/ui/iter_count.stderr index b703310731f34..6a68f9c8db6dc 100644 --- a/src/tools/clippy/tests/ui/iter_count.stderr +++ b/src/tools/clippy/tests/ui/iter_count.stderr @@ -2,154 +2,278 @@ error: called `.iter().count()` on a `slice` --> tests/ui/iter_count.rs:54:6 | LL | &vec[..].iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()` + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-count` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_count)]` +help: try + | +LL | &vec[..].len(); + | ~~~~~~~~~~~~~ error: called `.iter().count()` on a `Vec` --> tests/ui/iter_count.rs:55:5 | LL | vec.iter().count(); - | ^^^^^^^^^^^^^^^^^^ help: try: `vec.len()` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.len(); + | ~~~~~~~~~ error: called `.iter().count()` on a `slice` --> tests/ui/iter_count.rs:56:5 | LL | boxed_slice.iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `boxed_slice.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | boxed_slice.len(); + | ~~~~~~~~~~~~~~~~~ error: called `.iter().count()` on a `VecDeque` --> tests/ui/iter_count.rs:57:5 | LL | vec_deque.iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec_deque.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec_deque.len(); + | ~~~~~~~~~~~~~~~ error: called `.iter().count()` on a `HashSet` --> tests/ui/iter_count.rs:58:5 | LL | hash_set.iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_set.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | hash_set.len(); + | ~~~~~~~~~~~~~~ error: called `.iter().count()` on a `HashMap` --> tests/ui/iter_count.rs:59:5 | LL | hash_map.iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_map.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | hash_map.len(); + | ~~~~~~~~~~~~~~ error: called `.iter().count()` on a `BTreeMap` --> tests/ui/iter_count.rs:60:5 | LL | b_tree_map.iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_map.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | b_tree_map.len(); + | ~~~~~~~~~~~~~~~~ error: called `.iter().count()` on a `BTreeSet` --> tests/ui/iter_count.rs:61:5 | LL | b_tree_set.iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_set.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | b_tree_set.len(); + | ~~~~~~~~~~~~~~~~ error: called `.iter().count()` on a `LinkedList` --> tests/ui/iter_count.rs:62:5 | LL | linked_list.iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | linked_list.len(); + | ~~~~~~~~~~~~~~~~~ error: called `.iter().count()` on a `BinaryHeap` --> tests/ui/iter_count.rs:63:5 | LL | binary_heap.iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `binary_heap.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | binary_heap.len(); + | ~~~~~~~~~~~~~~~~~ error: called `.iter_mut().count()` on a `Vec` --> tests/ui/iter_count.rs:65:5 | LL | vec.iter_mut().count(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.len()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.len(); + | ~~~~~~~~~ error: called `.iter_mut().count()` on a `slice` --> tests/ui/iter_count.rs:66:6 | LL | &vec[..].iter_mut().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | &vec[..].len(); + | ~~~~~~~~~~~~~ error: called `.iter_mut().count()` on a `VecDeque` --> tests/ui/iter_count.rs:67:5 | LL | vec_deque.iter_mut().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec_deque.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec_deque.len(); + | ~~~~~~~~~~~~~~~ error: called `.iter_mut().count()` on a `HashMap` --> tests/ui/iter_count.rs:68:5 | LL | hash_map.iter_mut().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_map.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | hash_map.len(); + | ~~~~~~~~~~~~~~ error: called `.iter_mut().count()` on a `BTreeMap` --> tests/ui/iter_count.rs:69:5 | LL | b_tree_map.iter_mut().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_map.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | b_tree_map.len(); + | ~~~~~~~~~~~~~~~~ error: called `.iter_mut().count()` on a `LinkedList` --> tests/ui/iter_count.rs:70:5 | LL | linked_list.iter_mut().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | linked_list.len(); + | ~~~~~~~~~~~~~~~~~ error: called `.into_iter().count()` on a `slice` --> tests/ui/iter_count.rs:72:6 | LL | &vec[..].into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | &vec[..].len(); + | ~~~~~~~~~~~~~ error: called `.into_iter().count()` on a `Vec` --> tests/ui/iter_count.rs:73:5 | LL | vec.into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.len(); + | ~~~~~~~~~ error: called `.into_iter().count()` on a `VecDeque` --> tests/ui/iter_count.rs:74:5 | LL | vec_deque.into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec_deque.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec_deque.len(); + | ~~~~~~~~~~~~~~~ error: called `.into_iter().count()` on a `HashSet` --> tests/ui/iter_count.rs:75:5 | LL | hash_set.into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_set.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | hash_set.len(); + | ~~~~~~~~~~~~~~ error: called `.into_iter().count()` on a `HashMap` --> tests/ui/iter_count.rs:76:5 | LL | hash_map.into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_map.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | hash_map.len(); + | ~~~~~~~~~~~~~~ error: called `.into_iter().count()` on a `BTreeMap` --> tests/ui/iter_count.rs:77:5 | LL | b_tree_map.into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_map.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | b_tree_map.len(); + | ~~~~~~~~~~~~~~~~ error: called `.into_iter().count()` on a `BTreeSet` --> tests/ui/iter_count.rs:78:5 | LL | b_tree_set.into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_set.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | b_tree_set.len(); + | ~~~~~~~~~~~~~~~~ error: called `.into_iter().count()` on a `LinkedList` --> tests/ui/iter_count.rs:79:5 | LL | linked_list.into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | linked_list.len(); + | ~~~~~~~~~~~~~~~~~ error: called `.into_iter().count()` on a `BinaryHeap` --> tests/ui/iter_count.rs:80:5 | LL | binary_heap.into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `binary_heap.len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | binary_heap.len(); + | ~~~~~~~~~~~~~~~~~ error: aborting due to 25 previous errors diff --git a/src/tools/clippy/tests/ui/iter_filter_is_ok.stderr b/src/tools/clippy/tests/ui/iter_filter_is_ok.stderr index 0aff60224e0e0..eac62b52f169a 100644 --- a/src/tools/clippy/tests/ui/iter_filter_is_ok.stderr +++ b/src/tools/clippy/tests/ui/iter_filter_is_ok.stderr @@ -2,76 +2,135 @@ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:11:56 | LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(Result::is_ok); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-filter-is-ok` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_filter_is_ok)]` +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:13:56 | LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(|a| a.is_ok()); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:16:49 | LL | let _ = vec![Ok(1), Err(2)].into_iter().filter(|o| { o.is_ok() }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:21:56 | LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(|&a| a.is_ok()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:24:56 | LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(|&a| a.is_ok()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:28:49 | LL | let _ = vec![Ok(1), Err(2)].into_iter().filter(|&o| { o.is_ok() }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:35:14 | LL | .filter(std::result::Result::is_ok); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:40:14 | LL | .filter(|a| std::result::Result::is_ok(a)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:43:56 | LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(|a| { std::result::Result::is_ok(a) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:48:56 | LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(|ref a| a.is_ok()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:51:56 | LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(|ref a| a.is_ok()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_ok` on iterator over `Result`s --> tests/ui/iter_filter_is_ok.rs:55:49 | LL | let _ = vec![Ok(1), Err(2)].into_iter().filter(|ref o| { o.is_ok() }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Ok(1), Err(2)].into_iter().flatten(); + | ~~~~~~~~~ error: aborting due to 12 previous errors diff --git a/src/tools/clippy/tests/ui/iter_filter_is_some.stderr b/src/tools/clippy/tests/ui/iter_filter_is_some.stderr index 54aff892b1f0f..fb9b0c6809bfe 100644 --- a/src/tools/clippy/tests/ui/iter_filter_is_some.stderr +++ b/src/tools/clippy/tests/ui/iter_filter_is_some.stderr @@ -2,64 +2,113 @@ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:15:58 | LL | let _ = vec![Some(1), None, Some(3)].into_iter().filter(Option::is_some); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-filter-is-some` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_filter_is_some)]` +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1), None, Some(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:17:58 | LL | let _ = vec![Some(1), None, Some(3)].into_iter().filter(|a| a.is_some()); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1), None, Some(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:20:58 | LL | let _ = vec![Some(1), None, Some(3)].into_iter().filter(|o| { o.is_some() }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1), None, Some(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:27:14 | LL | .filter(std::option::Option::is_some); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:32:14 | LL | .filter(|a| std::option::Option::is_some(a)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:35:58 | LL | let _ = vec![Some(1), None, Some(3)].into_iter().filter(|a| { std::option::Option::is_some(a) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1), None, Some(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:40:58 | LL | let _ = vec![Some(1), None, Some(3)].into_iter().filter(|&a| a.is_some()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1), None, Some(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:44:58 | LL | let _ = vec![Some(1), None, Some(3)].into_iter().filter(|&o| { o.is_some() }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1), None, Some(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:49:58 | LL | let _ = vec![Some(1), None, Some(3)].into_iter().filter(|ref a| a.is_some()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1), None, Some(3)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `is_some` on iterator over `Option` --> tests/ui/iter_filter_is_some.rs:53:58 | LL | let _ = vec![Some(1), None, Some(3)].into_iter().filter(|ref o| { o.is_some() }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1), None, Some(3)].into_iter().flatten(); + | ~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/iter_kv_map.stderr b/src/tools/clippy/tests/ui/iter_kv_map.stderr index ad23dba55cb6a..0dbd1265aa504 100644 --- a/src/tools/clippy/tests/ui/iter_kv_map.stderr +++ b/src/tools/clippy/tests/ui/iter_kv_map.stderr @@ -2,76 +2,135 @@ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:14:13 | LL | let _ = map.iter().map(|(key, _)| key).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.keys()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-kv-map` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_kv_map)]` +help: try + | +LL | let _ = map.keys().collect::>(); + | ~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:15:13 | LL | let _ = map.iter().map(|(_, value)| value).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().collect::>(); + | ~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:16:13 | LL | let _ = map.iter().map(|(_, v)| v + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values().map(|v| v + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().map(|v| v + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:18:13 | LL | let _ = map.clone().into_iter().map(|(key, _)| key).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_keys()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_keys().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:19:13 | LL | let _ = map.clone().into_iter().map(|(key, _)| key + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_keys().map(|key| key + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_keys().map(|key| key + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:21:13 | LL | let _ = map.clone().into_iter().map(|(_, val)| val).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:22:13 | LL | let _ = map.clone().into_iter().map(|(_, val)| val + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values().map(|val| val + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().map(|val| val + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:24:13 | LL | let _ = map.clone().iter().map(|(_, val)| val).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().values().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:25:13 | LL | let _ = map.iter().map(|(key, _)| key).filter(|x| *x % 2 == 0).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.keys()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.keys().filter(|x| *x % 2 == 0).count(); + | ~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:35:13 | LL | let _ = map.iter().map(|(key, _value)| key * 9).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.keys().map(|key| key * 9)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.keys().map(|key| key * 9).count(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:36:13 | LL | let _ = map.iter().map(|(_key, value)| value * 17).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values().map(|value| value * 17)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().map(|value| value * 17).count(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:39:13 | LL | let _ = map.clone().into_iter().map(|(_, ref val)| ref_acceptor(val)).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values().map(|ref val| ref_acceptor(val))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().map(|ref val| ref_acceptor(val)).count(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:42:13 @@ -99,79 +158,144 @@ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:52:13 | LL | let _ = map.clone().into_iter().map(|(_, mut val)| val).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().count(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:56:13 | LL | let _ = map.iter().map(|(key, _)| key).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.keys()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.keys().collect::>(); + | ~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:57:13 | LL | let _ = map.iter().map(|(_, value)| value).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().collect::>(); + | ~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:58:13 | LL | let _ = map.iter().map(|(_, v)| v + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values().map(|v| v + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().map(|v| v + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:60:13 | LL | let _ = map.clone().into_iter().map(|(key, _)| key).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_keys()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_keys().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:61:13 | LL | let _ = map.clone().into_iter().map(|(key, _)| key + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_keys().map(|key| key + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_keys().map(|key| key + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:63:13 | LL | let _ = map.clone().into_iter().map(|(_, val)| val).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:64:13 | LL | let _ = map.clone().into_iter().map(|(_, val)| val + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values().map(|val| val + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().map(|val| val + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:66:13 | LL | let _ = map.clone().iter().map(|(_, val)| val).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().values().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:67:13 | LL | let _ = map.iter().map(|(key, _)| key).filter(|x| *x % 2 == 0).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.keys()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.keys().filter(|x| *x % 2 == 0).count(); + | ~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:77:13 | LL | let _ = map.iter().map(|(key, _value)| key * 9).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.keys().map(|key| key * 9)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.keys().map(|key| key * 9).count(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:78:13 | LL | let _ = map.iter().map(|(_key, value)| value * 17).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values().map(|value| value * 17)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().map(|value| value * 17).count(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:81:13 | LL | let _ = map.clone().into_iter().map(|(_, ref val)| ref_acceptor(val)).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values().map(|ref val| ref_acceptor(val))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().map(|ref val| ref_acceptor(val)).count(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:84:13 @@ -199,67 +323,122 @@ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:94:13 | LL | let _ = map.clone().into_iter().map(|(_, mut val)| val).count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().count(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:109:13 | LL | let _ = map.iter().map(|(key, _)| key).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.keys()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.keys().collect::>(); + | ~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:111:13 | LL | let _ = map.iter().map(|(_, value)| value).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().collect::>(); + | ~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:113:13 | LL | let _ = map.iter().map(|(_, v)| v + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values().map(|v| v + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().map(|v| v + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:122:13 | LL | let _ = map.clone().into_iter().map(|(key, _)| key).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_keys()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_keys().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:124:13 | LL | let _ = map.clone().into_iter().map(|(key, _)| key + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_keys().map(|key| key + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_keys().map(|key| key + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:127:13 | LL | let _ = map.clone().into_iter().map(|(_, val)| val).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:129:13 | LL | let _ = map.clone().into_iter().map(|(_, val)| val + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.clone().into_values().map(|val| val + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.clone().into_values().map(|val| val + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: iterating on a map's keys --> tests/ui/iter_kv_map.rs:132:13 | LL | let _ = map.iter().map(|(key, _)| key).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.keys()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.keys().collect::>(); + | ~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:134:13 | LL | let _ = map.iter().map(|(_, value)| value).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().collect::>(); + | ~~~~~~~~~~~~ error: iterating on a map's values --> tests/ui/iter_kv_map.rs:136:13 | LL | let _ = map.iter().map(|(_, v)| v + 2).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map.values().map(|v| v + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().map(|v| v + 2).collect::>(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 38 previous errors diff --git a/src/tools/clippy/tests/ui/iter_next_slice.stderr b/src/tools/clippy/tests/ui/iter_next_slice.stderr index 55cce2b9103da..2bd27b7e0297e 100644 --- a/src/tools/clippy/tests/ui/iter_next_slice.stderr +++ b/src/tools/clippy/tests/ui/iter_next_slice.stderr @@ -2,28 +2,47 @@ error: using `.iter().next()` on an array --> tests/ui/iter_next_slice.rs:9:13 | LL | let _ = s.iter().next(); - | ^^^^^^^^^^^^^^^ help: try calling: `s.first()` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-next-slice` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_next_slice)]` +help: try calling + | +LL | let _ = s.first(); + | ~~~~~~~~~ error: using `.iter().next()` on a Slice without end index --> tests/ui/iter_next_slice.rs:12:13 | LL | let _ = s[2..].iter().next(); - | ^^^^^^^^^^^^^^^^^^^^ help: try calling: `s.get(2)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try calling + | +LL | let _ = s.get(2); + | ~~~~~~~~ error: using `.iter().next()` on a Slice without end index --> tests/ui/iter_next_slice.rs:15:13 | LL | let _ = v[5..].iter().next(); - | ^^^^^^^^^^^^^^^^^^^^ help: try calling: `v.get(5)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try calling + | +LL | let _ = v.get(5); + | ~~~~~~~~ error: using `.iter().next()` on an array --> tests/ui/iter_next_slice.rs:18:13 | LL | let _ = v.iter().next(); - | ^^^^^^^^^^^^^^^ help: try calling: `v.first()` + | ^^^^^^^^^^^^^^^ + | +help: try calling + | +LL | let _ = v.first(); + | ~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/iter_nth_zero.stderr b/src/tools/clippy/tests/ui/iter_nth_zero.stderr index b5e5cf45c26bf..d0739fe2b767c 100644 --- a/src/tools/clippy/tests/ui/iter_nth_zero.stderr +++ b/src/tools/clippy/tests/ui/iter_nth_zero.stderr @@ -2,22 +2,36 @@ error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent --> tests/ui/iter_nth_zero.rs:18:14 | LL | let _x = s.iter().nth(0); - | ^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `s.iter().next()` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-nth-zero` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_nth_zero)]` +help: try calling `.next()` instead of `.nth(0)` + | +LL | let _x = s.iter().next(); + | ~~~~~~~~~~~~~~~ error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent --> tests/ui/iter_nth_zero.rs:23:14 | LL | let _y = iter.nth(0); - | ^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `iter.next()` + | ^^^^^^^^^^^ + | +help: try calling `.next()` instead of `.nth(0)` + | +LL | let _y = iter.next(); + | ~~~~~~~~~~~ error: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent --> tests/ui/iter_nth_zero.rs:28:22 | LL | let _unwrapped = iter2.nth(0).unwrap(); - | ^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `iter2.next()` + | ^^^^^^^^^^^^ + | +help: try calling `.next()` instead of `.nth(0)` + | +LL | let _unwrapped = iter2.next().unwrap(); + | ~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/iter_on_empty_collections.stderr b/src/tools/clippy/tests/ui/iter_on_empty_collections.stderr index da9caa6925bd9..59706397ab0be 100644 --- a/src/tools/clippy/tests/ui/iter_on_empty_collections.stderr +++ b/src/tools/clippy/tests/ui/iter_on_empty_collections.stderr @@ -2,46 +2,80 @@ error: `into_iter` call on an empty collection --> tests/ui/iter_on_empty_collections.rs:5:16 | LL | assert_eq!([].into_iter().next(), Option::::None); - | ^^^^^^^^^^^^^^ help: try: `std::iter::empty()` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::iter-on-empty-collections` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_on_empty_collections)]` +help: try + | +LL | assert_eq!(std::iter::empty().next(), Option::::None); + | ~~~~~~~~~~~~~~~~~~ error: `iter_mut` call on an empty collection --> tests/ui/iter_on_empty_collections.rs:6:16 | LL | assert_eq!([].iter_mut().next(), Option::<&mut i32>::None); - | ^^^^^^^^^^^^^ help: try: `std::iter::empty()` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::empty().next(), Option::<&mut i32>::None); + | ~~~~~~~~~~~~~~~~~~ error: `iter` call on an empty collection --> tests/ui/iter_on_empty_collections.rs:7:16 | LL | assert_eq!([].iter().next(), Option::<&i32>::None); - | ^^^^^^^^^ help: try: `std::iter::empty()` + | ^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::empty().next(), Option::<&i32>::None); + | ~~~~~~~~~~~~~~~~~~ error: `into_iter` call on an empty collection --> tests/ui/iter_on_empty_collections.rs:8:16 | LL | assert_eq!(None.into_iter().next(), Option::::None); - | ^^^^^^^^^^^^^^^^ help: try: `std::iter::empty()` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::empty().next(), Option::::None); + | ~~~~~~~~~~~~~~~~~~ error: `iter_mut` call on an empty collection --> tests/ui/iter_on_empty_collections.rs:9:16 | LL | assert_eq!(None.iter_mut().next(), Option::<&mut i32>::None); - | ^^^^^^^^^^^^^^^ help: try: `std::iter::empty()` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::empty().next(), Option::<&mut i32>::None); + | ~~~~~~~~~~~~~~~~~~ error: `iter` call on an empty collection --> tests/ui/iter_on_empty_collections.rs:10:16 | LL | assert_eq!(None.iter().next(), Option::<&i32>::None); - | ^^^^^^^^^^^ help: try: `std::iter::empty()` + | ^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::empty().next(), Option::<&i32>::None); + | ~~~~~~~~~~~~~~~~~~ error: `iter` call on an empty collection --> tests/ui/iter_on_empty_collections.rs:28:66 | LL | for i in smth.as_ref().map_or([].iter(), |s| s.iter()).chain([].iter()) { - | ^^^^^^^^^ help: try: `std::iter::empty()` + | ^^^^^^^^^ + | +help: try + | +LL | for i in smth.as_ref().map_or([].iter(), |s| s.iter()).chain(std::iter::empty()) { + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/iter_on_single_items.stderr b/src/tools/clippy/tests/ui/iter_on_single_items.stderr index 0252c859581b6..4801e048c5039 100644 --- a/src/tools/clippy/tests/ui/iter_on_single_items.stderr +++ b/src/tools/clippy/tests/ui/iter_on_single_items.stderr @@ -2,40 +2,69 @@ error: `into_iter` call on a collection with only one item --> tests/ui/iter_on_single_items.rs:5:16 | LL | assert_eq!([123].into_iter().next(), Some(123)); - | ^^^^^^^^^^^^^^^^^ help: try: `std::iter::once(123)` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-on-single-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_on_single_items)]` +help: try + | +LL | assert_eq!(std::iter::once(123).next(), Some(123)); + | ~~~~~~~~~~~~~~~~~~~~ error: `iter_mut` call on a collection with only one item --> tests/ui/iter_on_single_items.rs:6:16 | LL | assert_eq!([123].iter_mut().next(), Some(&mut 123)); - | ^^^^^^^^^^^^^^^^ help: try: `std::iter::once(&mut 123)` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::once(&mut 123).next(), Some(&mut 123)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: `iter` call on a collection with only one item --> tests/ui/iter_on_single_items.rs:7:16 | LL | assert_eq!([123].iter().next(), Some(&123)); - | ^^^^^^^^^^^^ help: try: `std::iter::once(&123)` + | ^^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::once(&123).next(), Some(&123)); + | ~~~~~~~~~~~~~~~~~~~~~ error: `into_iter` call on a collection with only one item --> tests/ui/iter_on_single_items.rs:8:16 | LL | assert_eq!(Some(123).into_iter().next(), Some(123)); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::once(123)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::once(123).next(), Some(123)); + | ~~~~~~~~~~~~~~~~~~~~ error: `iter_mut` call on a collection with only one item --> tests/ui/iter_on_single_items.rs:9:16 | LL | assert_eq!(Some(123).iter_mut().next(), Some(&mut 123)); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::once(&mut 123)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::once(&mut 123).next(), Some(&mut 123)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: `iter` call on a collection with only one item --> tests/ui/iter_on_single_items.rs:10:16 | LL | assert_eq!(Some(123).iter().next(), Some(&123)); - | ^^^^^^^^^^^^^^^^ help: try: `std::iter::once(&123)` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(std::iter::once(&123).next(), Some(&123)); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/iter_overeager_cloned.stderr b/src/tools/clippy/tests/ui/iter_overeager_cloned.stderr index 7a822a79494b7..d21e427d2bc05 100644 --- a/src/tools/clippy/tests/ui/iter_overeager_cloned.stderr +++ b/src/tools/clippy/tests/ui/iter_overeager_cloned.stderr @@ -2,55 +2,71 @@ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:7:29 | LL | let _: Option = vec.iter().cloned().last(); - | ^^^^^^^^^^---------------- - | | - | help: try: `.last().cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-overeager-cloned` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_overeager_cloned)]` +help: try + | +LL | let _: Option = vec.iter().last().cloned(); + | ~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:9:29 | LL | let _: Option = vec.iter().chain(vec.iter()).cloned().next(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------- - | | - | help: try: `.next().cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: Option = vec.iter().chain(vec.iter()).next().cloned(); + | ~~~~~~~~~~~~~~~~ error: unneeded cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:11:20 | LL | let _: usize = vec.iter().filter(|x| x == &"2").cloned().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------- - | | - | help: try: `.count()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::redundant-clone` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]` +help: try + | +LL | let _: usize = vec.iter().filter(|x| x == &"2").count(); + | ~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:13:21 | LL | let _: Vec<_> = vec.iter().cloned().take(2).collect(); - | ^^^^^^^^^^----------------- - | | - | help: try: `.take(2).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: Vec<_> = vec.iter().take(2).cloned().collect(); + | ~~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:15:21 | LL | let _: Vec<_> = vec.iter().cloned().skip(2).collect(); - | ^^^^^^^^^^----------------- - | | - | help: try: `.skip(2).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: Vec<_> = vec.iter().skip(2).cloned().collect(); + | ~~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:17:13 | LL | let _ = vec.iter().filter(|x| x == &"2").cloned().nth(2); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------- - | | - | help: try: `.nth(2).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().filter(|x| x == &"2").nth(2).cloned(); + | ~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:19:13 @@ -72,97 +88,133 @@ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:24:13 | LL | let _ = vec.iter().cloned().filter(|x| x.starts_with('2')); - | ^^^^^^^^^^---------------------------------------- - | | - | help: try: `.filter(|&x| x.starts_with('2')).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().filter(|&x| x.starts_with('2')).cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:26:13 | LL | let _ = vec.iter().cloned().find(|x| x == "2"); - | ^^^^^^^^^^---------------------------- - | | - | help: try: `.find(|&x| x == "2").cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().find(|&x| x == "2").cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:30:17 | LL | let _ = vec.iter().cloned().filter(f); - | ^^^^^^^^^^------------------- - | | - | help: try: `.filter(|&x| f(x)).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().filter(|&x| f(x)).cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:31:17 | LL | let _ = vec.iter().cloned().find(f); - | ^^^^^^^^^^----------------- - | | - | help: try: `.find(|&x| f(x)).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().find(|&x| f(x)).cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:37:17 | LL | let _ = vec.iter().cloned().filter(f); - | ^^^^^^^^^^------------------- - | | - | help: try: `.filter(|&x| f(x)).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().filter(|&x| f(x)).cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:38:17 | LL | let _ = vec.iter().cloned().find(f); - | ^^^^^^^^^^----------------- - | | - | help: try: `.find(|&x| f(x)).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().find(|&x| f(x)).cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:45:9 | LL | iter.cloned().filter(move |(&a, b)| a == 1 && b == &target) - | ^^^^------------------------------------------------------- - | | - | help: try: `.filter(move |&(&a, b)| a == 1 && b == &target).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter.filter(move |&(&a, b)| a == 1 && b == &target).cloned() + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessarily eager cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:56:13 | LL | iter.cloned().filter(move |S { a, b }| **a == 1 && b == &target) - | ^^^^------------------------------------------------------------ - | | - | help: try: `.filter(move |&S { a, b }| **a == 1 && b == &target).cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter.filter(move |&S { a, b }| **a == 1 && b == &target).cloned() + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unneeded cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:60:13 | LL | let _ = vec.iter().cloned().map(|x| x.len()); - | ^^^^^^^^^^-------------------------- - | | - | help: try: `.map(|x| x.len())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().map(|x| x.len()); + | ~~~~~~~~~~~~~~~~~ error: unneeded cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:65:13 | LL | let _ = vec.iter().cloned().for_each(|x| assert!(!x.is_empty())); - | ^^^^^^^^^^---------------------------------------------- - | | - | help: try: `.for_each(|x| assert!(!x.is_empty()))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().for_each(|x| assert!(!x.is_empty())); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unneeded cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:67:13 | LL | let _ = vec.iter().cloned().all(|x| x.len() == 1); - | ^^^^^^^^^^------------------------------- - | | - | help: try: `.all(|x| x.len() == 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().all(|x| x.len() == 1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: unneeded cloning of iterator items --> tests/ui/iter_overeager_cloned.rs:69:13 | LL | let _ = vec.iter().cloned().any(|x| x.len() == 1); - | ^^^^^^^^^^------------------------------- - | | - | help: try: `.any(|x| x.len() == 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = vec.iter().any(|x| x.len() == 1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 19 previous errors diff --git a/src/tools/clippy/tests/ui/iter_skip_next.stderr b/src/tools/clippy/tests/ui/iter_skip_next.stderr index 0fa04465ff156..749f595ec30d2 100644 --- a/src/tools/clippy/tests/ui/iter_skip_next.stderr +++ b/src/tools/clippy/tests/ui/iter_skip_next.stderr @@ -2,46 +2,80 @@ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next.rs:17:28 | LL | let _ = some_vec.iter().skip(42).next(); - | ^^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(42)` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-skip-next` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_skip_next)]` +help: use `nth` instead + | +LL | let _ = some_vec.iter().nth(42); + | ~~~~~~~~ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next.rs:18:36 | LL | let _ = some_vec.iter().cycle().skip(42).next(); - | ^^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(42)` + | ^^^^^^^^^^^^^^^^ + | +help: use `nth` instead + | +LL | let _ = some_vec.iter().cycle().nth(42); + | ~~~~~~~~ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next.rs:19:20 | LL | let _ = (1..10).skip(10).next(); - | ^^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(10)` + | ^^^^^^^^^^^^^^^^ + | +help: use `nth` instead + | +LL | let _ = (1..10).nth(10); + | ~~~~~~~~ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next.rs:20:33 | LL | let _ = &some_vec[..].iter().skip(3).next(); - | ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(3)` + | ^^^^^^^^^^^^^^^ + | +help: use `nth` instead + | +LL | let _ = &some_vec[..].iter().nth(3); + | ~~~~~~~ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next.rs:28:26 | LL | let _: Vec<&str> = sp.skip(1).next().unwrap().split(' ').collect(); - | ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)` + | ^^^^^^^^^^^^^^^ + | +help: use `nth` instead + | +LL | let _: Vec<&str> = sp.nth(1).unwrap().split(' ').collect(); + | ~~~~~~~ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next.rs:30:29 | LL | let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect(); - | ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)` + | ^^^^^^^^^^^^^^^ + | +help: use `nth` instead + | +LL | let _: Vec<&str> = s.nth(1).unwrap().split(' ').collect(); + | ~~~~~~~ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next.rs:36:29 | LL | let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect(); - | ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)` + | ^^^^^^^^^^^^^^^ + | +help: use `nth` instead + | +LL | let _: Vec<&str> = s.nth(1).unwrap().split(' ').collect(); + | ~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/iter_skip_next_unfixable.stderr b/src/tools/clippy/tests/ui/iter_skip_next_unfixable.stderr index 9bfffb07ca62d..387174622ce6d 100644 --- a/src/tools/clippy/tests/ui/iter_skip_next_unfixable.stderr +++ b/src/tools/clippy/tests/ui/iter_skip_next_unfixable.stderr @@ -2,7 +2,7 @@ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next_unfixable.rs:9:26 | LL | let _: Vec<&str> = sp.skip(1).next().unwrap().split(' ').collect(); - | ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)` + | ^^^^^^^^^^^^^^^ | help: for this change `sp` has to be mutable --> tests/ui/iter_skip_next_unfixable.rs:8:9 @@ -11,30 +11,42 @@ LL | let sp = test_string.split('|').map(|s| s.trim()); | ^^ = note: `-D clippy::iter-skip-next` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_skip_next)]` +help: use `nth` instead + | +LL | let _: Vec<&str> = sp.nth(1).unwrap().split(' ').collect(); + | ~~~~~~~ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next_unfixable.rs:12:29 | LL | let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect(); - | ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)` + | ^^^^^^^^^^^^^^^ | help: for this change `s` has to be mutable --> tests/ui/iter_skip_next_unfixable.rs:11:17 | LL | if let Some(s) = Some(test_string.split('|').map(|s| s.trim())) { | ^ +help: use `nth` instead + | +LL | let _: Vec<&str> = s.nth(1).unwrap().split(' ').collect(); + | ~~~~~~~ error: called `skip(..).next()` on an iterator --> tests/ui/iter_skip_next_unfixable.rs:19:29 | LL | let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect(); - | ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)` + | ^^^^^^^^^^^^^^^ | help: for this change `s` has to be mutable --> tests/ui/iter_skip_next_unfixable.rs:15:17 | LL | fn check(s: T) | ^ +help: use `nth` instead + | +LL | let _: Vec<&str> = s.nth(1).unwrap().split(' ').collect(); + | ~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/iter_skip_zero.stderr b/src/tools/clippy/tests/ui/iter_skip_zero.stderr index ef46db8433778..3cd8fcfc98af7 100644 --- a/src/tools/clippy/tests/ui/iter_skip_zero.stderr +++ b/src/tools/clippy/tests/ui/iter_skip_zero.stderr @@ -2,43 +2,63 @@ error: usage of `.skip(0)` --> tests/ui/iter_skip_zero.rs:11:35 | LL | let _ = [1, 2, 3].iter().skip(0); - | ^ help: if you meant to skip the first element, use: `1` + | ^ | = note: this call to `skip` does nothing and is useless; remove it = note: `-D clippy::iter-skip-zero` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_skip_zero)]` +help: if you meant to skip the first element, use + | +LL | let _ = [1, 2, 3].iter().skip(1); + | ~ error: usage of `.skip(0)` --> tests/ui/iter_skip_zero.rs:12:39 | LL | let _ = vec![1, 2, 3].iter().skip(0); - | ^ help: if you meant to skip the first element, use: `1` + | ^ | = note: this call to `skip` does nothing and is useless; remove it +help: if you meant to skip the first element, use + | +LL | let _ = vec![1, 2, 3].iter().skip(1); + | ~ error: usage of `.skip(0)` --> tests/ui/iter_skip_zero.rs:13:34 | LL | let _ = once([1, 2, 3]).skip(0); - | ^ help: if you meant to skip the first element, use: `1` + | ^ | = note: this call to `skip` does nothing and is useless; remove it +help: if you meant to skip the first element, use + | +LL | let _ = once([1, 2, 3]).skip(1); + | ~ error: usage of `.skip(0)` --> tests/ui/iter_skip_zero.rs:14:71 | LL | let _ = vec![1, 2, 3].iter().chain([1, 2, 3].iter().skip(0)).skip(0); - | ^ help: if you meant to skip the first element, use: `1` + | ^ | = note: this call to `skip` does nothing and is useless; remove it +help: if you meant to skip the first element, use + | +LL | let _ = vec![1, 2, 3].iter().chain([1, 2, 3].iter().skip(0)).skip(1); + | ~ error: usage of `.skip(0)` --> tests/ui/iter_skip_zero.rs:14:62 | LL | let _ = vec![1, 2, 3].iter().chain([1, 2, 3].iter().skip(0)).skip(0); - | ^ help: if you meant to skip the first element, use: `1` + | ^ | = note: this call to `skip` does nothing and is useless; remove it +help: if you meant to skip the first element, use + | +LL | let _ = vec![1, 2, 3].iter().chain([1, 2, 3].iter().skip(1)).skip(0); + | ~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/iter_with_drain.stderr b/src/tools/clippy/tests/ui/iter_with_drain.stderr index 265e18c263be8..1023e589e7981 100644 --- a/src/tools/clippy/tests/ui/iter_with_drain.stderr +++ b/src/tools/clippy/tests/ui/iter_with_drain.stderr @@ -2,40 +2,69 @@ error: `drain(..)` used on a `Vec` --> tests/ui/iter_with_drain.rs:10:34 | LL | let mut a: BinaryHeap<_> = a.drain(..).collect(); - | ^^^^^^^^^ help: try: `into_iter()` + | ^^^^^^^^^ | = note: `-D clippy::iter-with-drain` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::iter_with_drain)]` +help: try + | +LL | let mut a: BinaryHeap<_> = a.into_iter().collect(); + | ~~~~~~~~~~~ error: `drain(..)` used on a `VecDeque` --> tests/ui/iter_with_drain.rs:13:27 | LL | let mut a: Vec<_> = a.drain(..).collect(); - | ^^^^^^^^^ help: try: `into_iter()` + | ^^^^^^^^^ + | +help: try + | +LL | let mut a: Vec<_> = a.into_iter().collect(); + | ~~~~~~~~~~~ error: `drain(..)` used on a `Vec` --> tests/ui/iter_with_drain.rs:14:34 | LL | let mut a: HashMap<_, _> = a.drain(..).map(|x| (x.clone(), x)).collect(); - | ^^^^^^^^^ help: try: `into_iter()` + | ^^^^^^^^^ + | +help: try + | +LL | let mut a: HashMap<_, _> = a.into_iter().map(|x| (x.clone(), x)).collect(); + | ~~~~~~~~~~~ error: `drain(..)` used on a `Vec` --> tests/ui/iter_with_drain.rs:20:34 | LL | let mut a: BinaryHeap<_> = a.drain(0..).collect(); - | ^^^^^^^^^^ help: try: `into_iter()` + | ^^^^^^^^^^ + | +help: try + | +LL | let mut a: BinaryHeap<_> = a.into_iter().collect(); + | ~~~~~~~~~~~ error: `drain(..)` used on a `VecDeque` --> tests/ui/iter_with_drain.rs:23:27 | LL | let mut a: Vec<_> = a.drain(..a.len()).collect(); - | ^^^^^^^^^^^^^^^^ help: try: `into_iter()` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let mut a: Vec<_> = a.into_iter().collect(); + | ~~~~~~~~~~~ error: `drain(..)` used on a `Vec` --> tests/ui/iter_with_drain.rs:24:34 | LL | let mut a: HashMap<_, _> = a.drain(0..a.len()).map(|x| (x.clone(), x)).collect(); - | ^^^^^^^^^^^^^^^^^ help: try: `into_iter()` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let mut a: HashMap<_, _> = a.into_iter().map(|x| (x.clone(), x)).collect(); + | ~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/large_const_arrays.stderr b/src/tools/clippy/tests/ui/large_const_arrays.stderr index 88f921b81f721..42d31fbc3290e 100644 --- a/src/tools/clippy/tests/ui/large_const_arrays.stderr +++ b/src/tools/clippy/tests/ui/large_const_arrays.stderr @@ -2,76 +2,102 @@ error: large array defined as const --> tests/ui/large_const_arrays.rs:10:1 | LL | pub(crate) const FOO_PUB_CRATE: [u32; 1_000_000] = [0u32; 1_000_000]; - | ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::large-const-arrays` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_const_arrays)]` +help: make this a static item + | +LL | pub(crate) static FOO_PUB_CRATE: [u32; 1_000_000] = [0u32; 1_000_000]; + | ~~~~~~ error: large array defined as const --> tests/ui/large_const_arrays.rs:11:1 | LL | pub const FOO_PUB: [u32; 1_000_000] = [0u32; 1_000_000]; - | ^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: make this a static item + | +LL | pub static FOO_PUB: [u32; 1_000_000] = [0u32; 1_000_000]; + | ~~~~~~ error: large array defined as const --> tests/ui/large_const_arrays.rs:12:1 | LL | const FOO: [u32; 1_000_000] = [0u32; 1_000_000]; - | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: make this a static item + | +LL | static FOO: [u32; 1_000_000] = [0u32; 1_000_000]; + | ~~~~~~ error: large array defined as const --> tests/ui/large_const_arrays.rs:21:5 | LL | pub const BAR_PUB: [u32; 1_000_000] = [0u32; 1_000_000]; - | ^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: make this a static item + | +LL | pub static BAR_PUB: [u32; 1_000_000] = [0u32; 1_000_000]; + | ~~~~~~ error: large array defined as const --> tests/ui/large_const_arrays.rs:22:5 | LL | const BAR: [u32; 1_000_000] = [0u32; 1_000_000]; - | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: make this a static item + | +LL | static BAR: [u32; 1_000_000] = [0u32; 1_000_000]; + | ~~~~~~ error: large array defined as const --> tests/ui/large_const_arrays.rs:23:5 | LL | pub const BAR_STRUCT_PUB: [S; 5_000] = [S { data: [0; 32] }; 5_000]; - | ^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: make this a static item + | +LL | pub static BAR_STRUCT_PUB: [S; 5_000] = [S { data: [0; 32] }; 5_000]; + | ~~~~~~ error: large array defined as const --> tests/ui/large_const_arrays.rs:24:5 | LL | const BAR_STRUCT: [S; 5_000] = [S { data: [0; 32] }; 5_000]; - | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: make this a static item + | +LL | static BAR_STRUCT: [S; 5_000] = [S { data: [0; 32] }; 5_000]; + | ~~~~~~ error: large array defined as const --> tests/ui/large_const_arrays.rs:25:5 | LL | pub const BAR_S_PUB: [Option<&str>; 200_000] = [Some("str"); 200_000]; - | ^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: make this a static item + | +LL | pub static BAR_S_PUB: [Option<&str>; 200_000] = [Some("str"); 200_000]; + | ~~~~~~ error: large array defined as const --> tests/ui/large_const_arrays.rs:26:5 | LL | const BAR_S: [Option<&str>; 200_000] = [Some("str"); 200_000]; - | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: make this a static item: `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: make this a static item + | +LL | static BAR_S: [Option<&str>; 200_000] = [Some("str"); 200_000]; + | ~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/large_digit_groups.stderr b/src/tools/clippy/tests/ui/large_digit_groups.stderr index da34a91bc3bcf..86b6a72361d67 100644 --- a/src/tools/clippy/tests/ui/large_digit_groups.stderr +++ b/src/tools/clippy/tests/ui/large_digit_groups.stderr @@ -2,37 +2,60 @@ error: digits of hex, binary or octal literal not in groups of equal size --> tests/ui/large_digit_groups.rs:22:9 | LL | 0xd_e_adbee_f_usize, - | ^^^^^^^^^^^^^^^^^^^ help: consider: `0xdead_beef_usize` + | ^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unusual-byte-groupings` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unusual_byte_groupings)]` +help: consider + | +LL | 0xdead_beef_usize, + | ~~~~~~~~~~~~~~~~~ error: digit groups should be smaller --> tests/ui/large_digit_groups.rs:23:9 | LL | 1_23456_f32, - | ^^^^^^^^^^^ help: consider: `123_456_f32` + | ^^^^^^^^^^^ | = note: `-D clippy::large-digit-groups` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_digit_groups)]` +help: consider + | +LL | 123_456_f32, + | ~~~~~~~~~~~ error: digit groups should be smaller --> tests/ui/large_digit_groups.rs:24:9 | LL | 1_23456.12_f32, - | ^^^^^^^^^^^^^^ help: consider: `123_456.12_f32` + | ^^^^^^^^^^^^^^ + | +help: consider + | +LL | 123_456.12_f32, + | ~~~~~~~~~~~~~~ error: digit groups should be smaller --> tests/ui/large_digit_groups.rs:25:9 | LL | 1_23456.12345_f64, - | ^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_45_f64` + | ^^^^^^^^^^^^^^^^^ + | +help: consider + | +LL | 123_456.123_45_f64, + | ~~~~~~~~~~~~~~~~~~ error: digit groups should be smaller --> tests/ui/large_digit_groups.rs:26:9 | LL | 1_23456.12345_6_f64, - | ^^^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_456_f64` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider + | +LL | 123_456.123_456_f64, + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/large_futures.stderr b/src/tools/clippy/tests/ui/large_futures.stderr index 00082e579c597..9642b7e2cee3e 100644 --- a/src/tools/clippy/tests/ui/large_futures.stderr +++ b/src/tools/clippy/tests/ui/large_futures.stderr @@ -2,40 +2,69 @@ error: large future with a size of 16385 bytes --> tests/ui/large_futures.rs:10:9 | LL | big_fut([0u8; 1024 * 16]).await; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(big_fut([0u8; 1024 * 16]))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::large-futures` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_futures)]` +help: consider `Box::pin` on it + | +LL | Box::pin(big_fut([0u8; 1024 * 16])).await; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: large future with a size of 16386 bytes --> tests/ui/large_futures.rs:14:5 | LL | f.await - | ^ help: consider `Box::pin` on it: `Box::pin(f)` + | ^ + | +help: consider `Box::pin` on it + | +LL | Box::pin(f).await + | ~~~~~~~~~~~ error: large future with a size of 16387 bytes --> tests/ui/large_futures.rs:19:9 | LL | wait().await; - | ^^^^^^ help: consider `Box::pin` on it: `Box::pin(wait())` + | ^^^^^^ + | +help: consider `Box::pin` on it + | +LL | Box::pin(wait()).await; + | ~~~~~~~~~~~~~~~~ error: large future with a size of 16387 bytes --> tests/ui/large_futures.rs:24:13 | LL | wait().await; - | ^^^^^^ help: consider `Box::pin` on it: `Box::pin(wait())` + | ^^^^^^ + | +help: consider `Box::pin` on it + | +LL | Box::pin(wait()).await; + | ~~~~~~~~~~~~~~~~ error: large future with a size of 65540 bytes --> tests/ui/large_futures.rs:32:5 | LL | foo().await; - | ^^^^^ help: consider `Box::pin` on it: `Box::pin(foo())` + | ^^^^^ + | +help: consider `Box::pin` on it + | +LL | Box::pin(foo()).await; + | ~~~~~~~~~~~~~~~ error: large future with a size of 49159 bytes --> tests/ui/large_futures.rs:34:5 | LL | calls_fut(fut).await; - | ^^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(calls_fut(fut))` + | ^^^^^^^^^^^^^^ + | +help: consider `Box::pin` on it + | +LL | Box::pin(calls_fut(fut)).await; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: large future with a size of 65540 bytes --> tests/ui/large_futures.rs:47:5 diff --git a/src/tools/clippy/tests/ui/large_types_passed_by_value.stderr b/src/tools/clippy/tests/ui/large_types_passed_by_value.stderr index 5b42ab9e02ac4..b7e9c49443bb0 100644 --- a/src/tools/clippy/tests/ui/large_types_passed_by_value.stderr +++ b/src/tools/clippy/tests/ui/large_types_passed_by_value.stderr @@ -2,52 +2,91 @@ error: this argument (N byte) is passed by value, but might be more efficient if --> tests/ui/large_types_passed_by_value.rs:20:11 | LL | fn bad(a: LargeAndCopy) {} - | ^^^^^^^^^^^^ help: consider passing by reference instead: `&LargeAndCopy` + | ^^^^^^^^^^^^ | = note: `-D clippy::large-types-passed-by-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::large_types_passed_by_value)]` +help: consider passing by reference instead + | +LL | fn bad(a: &LargeAndCopy) {} + | ~~~~~~~~~~~~~ error: this argument (N byte) is passed by value, but might be more efficient if passed by reference (limit: N byte) --> tests/ui/large_types_passed_by_value.rs:25:37 | LL | fn other_is_not_ok(self, other: LargeAndCopy) {} - | ^^^^^^^^^^^^ help: consider passing by reference instead: `&LargeAndCopy` + | ^^^^^^^^^^^^ + | +help: consider passing by reference instead + | +LL | fn other_is_not_ok(self, other: &LargeAndCopy) {} + | ~~~~~~~~~~~~~ error: this argument (N byte) is passed by value, but might be more efficient if passed by reference (limit: N byte) --> tests/ui/large_types_passed_by_value.rs:31:36 | LL | fn devoure_array(&self, array: [u8; 6666]); - | ^^^^^^^^^^ help: consider passing by reference instead: `&[u8; 6666]` + | ^^^^^^^^^^ + | +help: consider passing by reference instead + | +LL | fn devoure_array(&self, array: &[u8; 6666]); + | ~~~~~~~~~~~ error: this argument (N byte) is passed by value, but might be more efficient if passed by reference (limit: N byte) --> tests/ui/large_types_passed_by_value.rs:32:34 | LL | fn devoure_tuple(&self, tup: (LargeAndCopy, LargeAndCopy)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider passing by reference instead: `&(LargeAndCopy, LargeAndCopy)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider passing by reference instead + | +LL | fn devoure_tuple(&self, tup: &(LargeAndCopy, LargeAndCopy)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this argument (N byte) is passed by value, but might be more efficient if passed by reference (limit: N byte) --> tests/ui/large_types_passed_by_value.rs:33:50 | LL | fn devoure_array_and_tuple_wow(&self, array: [u8; 6666], tup: (LargeAndCopy, LargeAndCopy)); - | ^^^^^^^^^^ help: consider passing by reference instead: `&[u8; 6666]` + | ^^^^^^^^^^ + | +help: consider passing by reference instead + | +LL | fn devoure_array_and_tuple_wow(&self, array: &[u8; 6666], tup: (LargeAndCopy, LargeAndCopy)); + | ~~~~~~~~~~~ error: this argument (N byte) is passed by value, but might be more efficient if passed by reference (limit: N byte) --> tests/ui/large_types_passed_by_value.rs:33:67 | LL | fn devoure_array_and_tuple_wow(&self, array: [u8; 6666], tup: (LargeAndCopy, LargeAndCopy)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider passing by reference instead: `&(LargeAndCopy, LargeAndCopy)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider passing by reference instead + | +LL | fn devoure_array_and_tuple_wow(&self, array: [u8; 6666], tup: &(LargeAndCopy, LargeAndCopy)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this argument (N byte) is passed by value, but might be more efficient if passed by reference (limit: N byte) --> tests/ui/large_types_passed_by_value.rs:58:17 | LL | fn foo_never(x: LargeAndCopy) { - | ^^^^^^^^^^^^ help: consider passing by reference instead: `&LargeAndCopy` + | ^^^^^^^^^^^^ + | +help: consider passing by reference instead + | +LL | fn foo_never(x: &LargeAndCopy) { + | ~~~~~~~~~~~~~ error: this argument (N byte) is passed by value, but might be more efficient if passed by reference (limit: N byte) --> tests/ui/large_types_passed_by_value.rs:62:11 | LL | fn foo(x: LargeAndCopy) { - | ^^^^^^^^^^^^ help: consider passing by reference instead: `&LargeAndCopy` + | ^^^^^^^^^^^^ + | +help: consider passing by reference instead + | +LL | fn foo(x: &LargeAndCopy) { + | ~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/len_zero.stderr b/src/tools/clippy/tests/ui/len_zero.stderr index 5c849a2aca646..b90eb5a54c76c 100644 --- a/src/tools/clippy/tests/ui/len_zero.stderr +++ b/src/tools/clippy/tests/ui/len_zero.stderr @@ -2,163 +2,291 @@ error: length comparison to zero --> tests/ui/len_zero.rs:88:8 | LL | if x.len() == 0 { - | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `x.is_empty()` + | ^^^^^^^^^^^^ | = note: `-D clippy::len-zero` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::len_zero)]` +help: using `is_empty` is clearer and more explicit + | +LL | if x.is_empty() { + | ~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:92:8 | LL | if "".len() == 0 {} - | ^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `"".is_empty()` + | ^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if "".is_empty() {} + | ~~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/len_zero.rs:101:20 | LL | println!("{}", *s1 == ""); - | ^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s1.is_empty()` + | ^^^^^^^^^ | = note: `-D clippy::comparison-to-empty` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::comparison_to_empty)]` +help: using `is_empty` is clearer and more explicit + | +LL | println!("{}", s1.is_empty()); + | ~~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/len_zero.rs:102:20 | LL | println!("{}", **s2 == ""); - | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s2.is_empty()` + | ^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | println!("{}", s2.is_empty()); + | ~~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/len_zero.rs:103:20 | LL | println!("{}", ***s3 == ""); - | ^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s3.is_empty()` + | ^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | println!("{}", s3.is_empty()); + | ~~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/len_zero.rs:104:20 | LL | println!("{}", ****s4 == ""); - | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s4.is_empty()` + | ^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | println!("{}", s4.is_empty()); + | ~~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/len_zero.rs:105:20 | LL | println!("{}", *****s5 == ""); - | ^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s5.is_empty()` + | ^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | println!("{}", s5.is_empty()); + | ~~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/len_zero.rs:106:20 | LL | println!("{}", ******(s6) == ""); - | ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `(s6).is_empty()` + | ^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | println!("{}", (s6).is_empty()); + | ~~~~~~~~~~~~~~~ error: comparison to empty slice --> tests/ui/len_zero.rs:109:20 | LL | println!("{}", &**d2s == ""); - | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `(**d2s).is_empty()` + | ^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | println!("{}", (**d2s).is_empty()); + | ~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:124:8 | LL | if has_is_empty.len() == 0 { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:127:8 | LL | if has_is_empty.len() != 0 { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | if !has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:130:8 | LL | if has_is_empty.len() > 0 { - | ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | if !has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to one --> tests/ui/len_zero.rs:133:8 | LL | if has_is_empty.len() < 1 { - | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to one --> tests/ui/len_zero.rs:136:8 | LL | if has_is_empty.len() >= 1 { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | if !has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:147:8 | LL | if 0 == has_is_empty.len() { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:150:8 | LL | if 0 != has_is_empty.len() { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | if !has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:153:8 | LL | if 0 < has_is_empty.len() { - | ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | if !has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to one --> tests/ui/len_zero.rs:156:8 | LL | if 1 <= has_is_empty.len() { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | if !has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to one --> tests/ui/len_zero.rs:159:8 | LL | if 1 > has_is_empty.len() { - | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if has_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:173:8 | LL | if with_is_empty.len() == 0 { - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `with_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if with_is_empty.is_empty() { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:185:6 | LL | (has_is_empty.len() > 0).then(|| println!("This can happen.")); - | ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | (!has_is_empty.is_empty()).then(|| println!("This can happen.")); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:186:6 | LL | (has_is_empty.len() == 0).then(|| println!("Or this!")); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | (has_is_empty.is_empty()).then(|| println!("Or this!")); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:190:8 | LL | if b.len() != 0 {} - | ^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!b.is_empty()` + | ^^^^^^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | if !b.is_empty() {} + | ~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:224:8 | LL | if has_is_empty.len() == compare_to!(0) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if has_is_empty.is_empty() {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:225:8 | LL | if has_is_empty.len() == zero!() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | if has_is_empty.is_empty() {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero.rs:227:6 | LL | (compare_to!(0) < has_is_empty.len()).then(|| println!("This can happen.")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `!is_empty` is clearer and more explicit + | +LL | (!has_is_empty.is_empty()).then(|| println!("This can happen.")); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 26 previous errors diff --git a/src/tools/clippy/tests/ui/len_zero_ranges.stderr b/src/tools/clippy/tests/ui/len_zero_ranges.stderr index 0b2991e15ea32..0c3edf7af6321 100644 --- a/src/tools/clippy/tests/ui/len_zero_ranges.stderr +++ b/src/tools/clippy/tests/ui/len_zero_ranges.stderr @@ -2,16 +2,25 @@ error: length comparison to zero --> tests/ui/len_zero_ranges.rs:7:17 | LL | let _ = (0..42).len() == 0; - | ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `(0..42).is_empty()` + | ^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::len-zero` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::len_zero)]` +help: using `is_empty` is clearer and more explicit + | +LL | let _ = (0..42).is_empty(); + | ~~~~~~~~~~~~~~~~~~ error: length comparison to zero --> tests/ui/len_zero_ranges.rs:11:17 | LL | let _ = (0_u8..=42).len() == 0; - | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `(0_u8..=42).is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: using `is_empty` is clearer and more explicit + | +LL | let _ = (0_u8..=42).is_empty(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/let_if_seq.stderr b/src/tools/clippy/tests/ui/let_if_seq.stderr index 41930108fb1ab..4d1c835d771bb 100644 --- a/src/tools/clippy/tests/ui/let_if_seq.stderr +++ b/src/tools/clippy/tests/ui/let_if_seq.stderr @@ -7,11 +7,15 @@ LL | | LL | | if f() { LL | | foo = 42; LL | | } - | |_____^ help: it is more idiomatic to write: `let foo = if f() { 42 } else { 0 };` + | |_____^ | = note: you might not need `mut` at all = note: `-D clippy::useless-let-if-seq` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::useless_let_if_seq)]` +help: it is more idiomatic to write + | +LL | let foo = if f() { 42 } else { 0 }; + | error: `if _ { .. } else { .. }` is an expression --> tests/ui/let_if_seq.rs:84:5 @@ -23,9 +27,13 @@ LL | | if f() { ... | LL | | f(); LL | | } - | |_____^ help: it is more idiomatic to write: `let bar = if f() { ..; 42 } else { ..; 0 };` + | |_____^ | = note: you might not need `mut` at all +help: it is more idiomatic to write + | +LL | let bar = if f() { ..; 42 } else { ..; 0 }; + | error: `if _ { .. } else { .. }` is an expression --> tests/ui/let_if_seq.rs:94:5 @@ -37,7 +45,12 @@ LL | | quz = 42; LL | | } else { LL | | quz = 0; LL | | } - | |_____^ help: it is more idiomatic to write: `let quz = if f() { 42 } else { 0 };` + | |_____^ + | +help: it is more idiomatic to write + | +LL | let quz = if f() { 42 } else { 0 }; + | error: `if _ { .. } else { .. }` is an expression --> tests/ui/let_if_seq.rs:124:5 @@ -48,9 +61,13 @@ LL | | LL | | if f() { LL | | baz = 42; LL | | } - | |_____^ help: it is more idiomatic to write: `let baz = if f() { 42 } else { 0 };` + | |_____^ | = note: you might not need `mut` at all +help: it is more idiomatic to write + | +LL | let baz = if f() { 42 } else { 0 }; + | error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/let_unit.stderr b/src/tools/clippy/tests/ui/let_unit.stderr index 2f62c33c88730..ae5834bd6ea4d 100644 --- a/src/tools/clippy/tests/ui/let_unit.stderr +++ b/src/tools/clippy/tests/ui/let_unit.stderr @@ -2,10 +2,14 @@ error: this let-binding has unit value --> tests/ui/let_unit.rs:11:5 | LL | let _x = println!("x"); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `println!("x");` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::let-unit-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]` +help: omit the `let` binding + | +LL | println!("x"); + | error: this let-binding has unit value --> tests/ui/let_unit.rs:59:5 diff --git a/src/tools/clippy/tests/ui/lines_filter_map_ok.stderr b/src/tools/clippy/tests/ui/lines_filter_map_ok.stderr index 558c0532be95a..a09c4f77e446b 100644 --- a/src/tools/clippy/tests/ui/lines_filter_map_ok.stderr +++ b/src/tools/clippy/tests/ui/lines_filter_map_ok.stderr @@ -2,7 +2,7 @@ error: `filter_map()` will run forever if the iterator repeatedly produces an `E --> tests/ui/lines_filter_map_ok.rs:9:31 | LL | BufReader::new(f).lines().filter_map(Result::ok).for_each(|_| ()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `map_while(Result::ok)` + | ^^^^^^^^^^^^^^^^^^^^^^ | note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error --> tests/ui/lines_filter_map_ok.rs:9:5 @@ -11,66 +11,90 @@ LL | BufReader::new(f).lines().filter_map(Result::ok).for_each(|_| ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: `-D clippy::lines-filter-map-ok` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::lines_filter_map_ok)]` +help: replace with + | +LL | BufReader::new(f).lines().map_while(Result::ok).for_each(|_| ()); + | ~~~~~~~~~~~~~~~~~~~~~ error: `flat_map()` will run forever if the iterator repeatedly produces an `Err` --> tests/ui/lines_filter_map_ok.rs:12:31 | LL | BufReader::new(f).lines().flat_map(Result::ok).for_each(|_| ()); - | ^^^^^^^^^^^^^^^^^^^^ help: replace with: `map_while(Result::ok)` + | ^^^^^^^^^^^^^^^^^^^^ | note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error --> tests/ui/lines_filter_map_ok.rs:12:5 | LL | BufReader::new(f).lines().flat_map(Result::ok).for_each(|_| ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: replace with + | +LL | BufReader::new(f).lines().map_while(Result::ok).for_each(|_| ()); + | ~~~~~~~~~~~~~~~~~~~~~ error: `flatten()` will run forever if the iterator repeatedly produces an `Err` --> tests/ui/lines_filter_map_ok.rs:15:31 | LL | BufReader::new(f).lines().flatten().for_each(|_| ()); - | ^^^^^^^^^ help: replace with: `map_while(Result::ok)` + | ^^^^^^^^^ | note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error --> tests/ui/lines_filter_map_ok.rs:15:5 | LL | BufReader::new(f).lines().flatten().for_each(|_| ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: replace with + | +LL | BufReader::new(f).lines().map_while(Result::ok).for_each(|_| ()); + | ~~~~~~~~~~~~~~~~~~~~~ error: `filter_map()` will run forever if the iterator repeatedly produces an `Err` --> tests/ui/lines_filter_map_ok.rs:19:25 | LL | io::stdin().lines().filter_map(Result::ok).for_each(|_| ()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `map_while(Result::ok)` + | ^^^^^^^^^^^^^^^^^^^^^^ | note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error --> tests/ui/lines_filter_map_ok.rs:19:5 | LL | io::stdin().lines().filter_map(Result::ok).for_each(|_| ()); | ^^^^^^^^^^^^^^^^^^^ +help: replace with + | +LL | io::stdin().lines().map_while(Result::ok).for_each(|_| ()); + | ~~~~~~~~~~~~~~~~~~~~~ error: `filter_map()` will run forever if the iterator repeatedly produces an `Err` --> tests/ui/lines_filter_map_ok.rs:21:25 | LL | io::stdin().lines().filter_map(|x| x.ok()).for_each(|_| ()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `map_while(Result::ok)` + | ^^^^^^^^^^^^^^^^^^^^^^ | note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error --> tests/ui/lines_filter_map_ok.rs:21:5 | LL | io::stdin().lines().filter_map(|x| x.ok()).for_each(|_| ()); | ^^^^^^^^^^^^^^^^^^^ +help: replace with + | +LL | io::stdin().lines().map_while(Result::ok).for_each(|_| ()); + | ~~~~~~~~~~~~~~~~~~~~~ error: `flatten()` will run forever if the iterator repeatedly produces an `Err` --> tests/ui/lines_filter_map_ok.rs:23:25 | LL | io::stdin().lines().flatten().for_each(|_| ()); - | ^^^^^^^^^ help: replace with: `map_while(Result::ok)` + | ^^^^^^^^^ | note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error --> tests/ui/lines_filter_map_ok.rs:23:5 | LL | io::stdin().lines().flatten().for_each(|_| ()); | ^^^^^^^^^^^^^^^^^^^ +help: replace with + | +LL | io::stdin().lines().map_while(Result::ok).for_each(|_| ()); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/literals.stderr b/src/tools/clippy/tests/ui/literals.stderr index 564e0bc4f7472..8d0e606baccac 100644 --- a/src/tools/clippy/tests/ui/literals.stderr +++ b/src/tools/clippy/tests/ui/literals.stderr @@ -2,22 +2,36 @@ error: integer type suffix should not be separated by an underscore --> tests/ui/literals.rs:13:15 | LL | let ok4 = 0xab_cd_i32; - | ^^^^^^^^^^^ help: remove the underscore: `0xab_cdi32` + | ^^^^^^^^^^^ | = note: `-D clippy::separated-literal-suffix` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::separated_literal_suffix)]` +help: remove the underscore + | +LL | let ok4 = 0xab_cdi32; + | ~~~~~~~~~~ error: integer type suffix should not be separated by an underscore --> tests/ui/literals.rs:16:15 | LL | let ok5 = 0xAB_CD_u32; - | ^^^^^^^^^^^ help: remove the underscore: `0xAB_CDu32` + | ^^^^^^^^^^^ + | +help: remove the underscore + | +LL | let ok5 = 0xAB_CDu32; + | ~~~~~~~~~~ error: integer type suffix should not be separated by an underscore --> tests/ui/literals.rs:18:15 | LL | let ok5 = 0xAB_CD_isize; - | ^^^^^^^^^^^^^ help: remove the underscore: `0xAB_CDisize` + | ^^^^^^^^^^^^^ + | +help: remove the underscore + | +LL | let ok5 = 0xAB_CDisize; + | ~~~~~~~~~~~~ error: inconsistent casing in hexadecimal literal --> tests/ui/literals.rs:20:17 @@ -32,7 +46,12 @@ error: integer type suffix should not be separated by an underscore --> tests/ui/literals.rs:23:17 | LL | let fail2 = 0xabCD_u32; - | ^^^^^^^^^^ help: remove the underscore: `0xabCDu32` + | ^^^^^^^^^^ + | +help: remove the underscore + | +LL | let fail2 = 0xabCDu32; + | ~~~~~~~~~ error: inconsistent casing in hexadecimal literal --> tests/ui/literals.rs:23:17 @@ -44,7 +63,12 @@ error: integer type suffix should not be separated by an underscore --> tests/ui/literals.rs:26:17 | LL | let fail2 = 0xabCD_isize; - | ^^^^^^^^^^^^ help: remove the underscore: `0xabCDisize` + | ^^^^^^^^^^^^ + | +help: remove the underscore + | +LL | let fail2 = 0xabCDisize; + | ~~~~~~~~~~~ error: inconsistent casing in hexadecimal literal --> tests/ui/literals.rs:26:17 @@ -56,10 +80,14 @@ error: integer type suffix should be separated by an underscore --> tests/ui/literals.rs:29:27 | LL | let fail_multi_zero = 000_123usize; - | ^^^^^^^^^^^^ help: add an underscore: `000_123_usize` + | ^^^^^^^^^^^^ | = note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unseparated_literal_suffix)]` +help: add an underscore + | +LL | let fail_multi_zero = 000_123_usize; + | ~~~~~~~~~~~~~ error: this is a decimal constant --> tests/ui/literals.rs:29:27 @@ -82,7 +110,12 @@ error: integer type suffix should not be separated by an underscore --> tests/ui/literals.rs:36:16 | LL | let ok10 = 0_i64; - | ^^^^^ help: remove the underscore: `0i64` + | ^^^^^ + | +help: remove the underscore + | +LL | let ok10 = 0i64; + | ~~~~ error: this is a decimal constant --> tests/ui/literals.rs:38:17 @@ -103,37 +136,60 @@ error: integer type suffix should not be separated by an underscore --> tests/ui/literals.rs:48:16 | LL | let ok17 = 0x123_4567_8901_usize; - | ^^^^^^^^^^^^^^^^^^^^^ help: remove the underscore: `0x123_4567_8901usize` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the underscore + | +LL | let ok17 = 0x123_4567_8901usize; + | ~~~~~~~~~~~~~~~~~~~~ error: digits grouped inconsistently by underscores --> tests/ui/literals.rs:52:18 | LL | let fail19 = 12_3456_21; - | ^^^^^^^^^^ help: consider: `12_345_621` + | ^^^^^^^^^^ | = note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::inconsistent_digit_grouping)]` +help: consider + | +LL | let fail19 = 12_345_621; + | ~~~~~~~~~~ error: digits grouped inconsistently by underscores --> tests/ui/literals.rs:55:18 | LL | let fail22 = 3__4___23; - | ^^^^^^^^^ help: consider: `3_423` + | ^^^^^^^^^ + | +help: consider + | +LL | let fail22 = 3_423; + | ~~~~~ error: digits grouped inconsistently by underscores --> tests/ui/literals.rs:57:18 | LL | let fail23 = 3__16___23; - | ^^^^^^^^^^ help: consider: `31_623` + | ^^^^^^^^^^ + | +help: consider + | +LL | let fail23 = 31_623; + | ~~~~~~ error: digits of hex, binary or octal literal not in groups of equal size --> tests/ui/literals.rs:60:18 | LL | let fail24 = 0xAB_ABC_AB; - | ^^^^^^^^^^^ help: consider: `0x0ABA_BCAB` + | ^^^^^^^^^^^ | = note: `-D clippy::unusual-byte-groupings` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unusual_byte_groupings)]` +help: consider + | +LL | let fail24 = 0x0ABA_BCAB; + | ~~~~~~~~~~~ error: this is a decimal constant --> tests/ui/literals.rs:70:13 diff --git a/src/tools/clippy/tests/ui/lossy_float_literal.stderr b/src/tools/clippy/tests/ui/lossy_float_literal.stderr index b5a07418734c9..3026854e317ae 100644 --- a/src/tools/clippy/tests/ui/lossy_float_literal.stderr +++ b/src/tools/clippy/tests/ui/lossy_float_literal.stderr @@ -2,70 +2,124 @@ error: literal cannot be represented as the underlying type without loss of prec --> tests/ui/lossy_float_literal.rs:14:18 | LL | let _: f32 = 16_777_217.0; - | ^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_216.0` + | ^^^^^^^^^^^^ | = note: `-D clippy::lossy-float-literal` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::lossy_float_literal)]` +help: consider changing the type or replacing it with + | +LL | let _: f32 = 16_777_216.0; + | ~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:15:18 | LL | let _: f32 = 16_777_219.0; - | ^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220.0` + | ^^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _: f32 = 16_777_220.0; + | ~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:16:18 | LL | let _: f32 = 16_777_219.; - | ^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220.0` + | ^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _: f32 = 16_777_220.0; + | ~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:17:18 | LL | let _: f32 = 16_777_219.000; - | ^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220.0` + | ^^^^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _: f32 = 16_777_220.0; + | ~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:18:13 | LL | let _ = 16_777_219f32; - | ^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220_f32` + | ^^^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _ = 16_777_220_f32; + | ~~~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:19:19 | LL | let _: f32 = -16_777_219.0; - | ^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220.0` + | ^^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _: f32 = -16_777_220.0; + | ~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:21:18 | LL | let _: f64 = 9_007_199_254_740_993.0; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992.0` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _: f64 = 9_007_199_254_740_992.0; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:22:18 | LL | let _: f64 = 9_007_199_254_740_993.; - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992.0` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _: f64 = 9_007_199_254_740_992.0; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:23:18 | LL | let _: f64 = 9_007_199_254_740_993.00; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992.0` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _: f64 = 9_007_199_254_740_992.0; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:24:13 | LL | let _ = 9_007_199_254_740_993f64; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992_f64` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _ = 9_007_199_254_740_992_f64; + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: literal cannot be represented as the underlying type without loss of precision --> tests/ui/lossy_float_literal.rs:25:19 | LL | let _: f64 = -9_007_199_254_740_993.0; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992.0` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing the type or replacing it with + | +LL | let _: f64 = -9_007_199_254_740_992.0; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/macro_use_imports.stderr b/src/tools/clippy/tests/ui/macro_use_imports.stderr index ea0670d366675..cb07adfb5cacb 100644 --- a/src/tools/clippy/tests/ui/macro_use_imports.stderr +++ b/src/tools/clippy/tests/ui/macro_use_imports.stderr @@ -2,28 +2,47 @@ error: `macro_use` attributes are no longer needed in the Rust 2018 edition --> tests/ui/macro_use_imports.rs:18:5 | LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{pub_macro, inner_mod_macro, function_macro, ty_macro, pub_in_private_macro};` + | ^^^^^^^^^^^^ | = note: `-D clippy::macro-use-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::macro_use_imports)]` +help: remove the attribute and import the macro directly, try + | +LL | use mac::{pub_macro, inner_mod_macro, function_macro, ty_macro, pub_in_private_macro}; + | error: `macro_use` attributes are no longer needed in the Rust 2018 edition --> tests/ui/macro_use_imports.rs:22:5 | LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{inner::mut_mut, inner::try_err};` + | ^^^^^^^^^^^^ + | +help: remove the attribute and import the macro directly, try + | +LL | use mac::{inner::mut_mut, inner::try_err}; + | error: `macro_use` attributes are no longer needed in the Rust 2018 edition --> tests/ui/macro_use_imports.rs:24:5 | LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::inner::nested::string_add;` + | ^^^^^^^^^^^^ + | +help: remove the attribute and import the macro directly, try + | +LL | use mac::inner::nested::string_add; + | error: `macro_use` attributes are no longer needed in the Rust 2018 edition --> tests/ui/macro_use_imports.rs:20:5 | LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mini_mac::ClippyMiniMacroTest;` + | ^^^^^^^^^^^^ + | +help: remove the attribute and import the macro directly, try + | +LL | use mini_mac::ClippyMiniMacroTest; + | error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr b/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr index 1eebe1bfe1771..2f88000bb7d22 100644 --- a/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr +++ b/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr @@ -4,10 +4,14 @@ error: only a `panic!` in `if`-then statement LL | / if !a.is_empty() { LL | | panic!("qaqaq{:?}", a); LL | | } - | |_____^ help: try instead: `assert!(a.is_empty(), "qaqaq{:?}", a);` + | |_____^ | = note: `-D clippy::manual-assert` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_assert)]` +help: try instead + | +LL | assert!(a.is_empty(), "qaqaq{:?}", a); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:33:5 @@ -15,7 +19,12 @@ error: only a `panic!` in `if`-then statement LL | / if !a.is_empty() { LL | | panic!("qwqwq"); LL | | } - | |_____^ help: try instead: `assert!(a.is_empty(), "qwqwq");` + | |_____^ + | +help: try instead + | +LL | assert!(a.is_empty(), "qwqwq"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:50:5 @@ -23,7 +32,12 @@ error: only a `panic!` in `if`-then statement LL | / if b.is_empty() { LL | | panic!("panic1"); LL | | } - | |_____^ help: try instead: `assert!(!b.is_empty(), "panic1");` + | |_____^ + | +help: try instead + | +LL | assert!(!b.is_empty(), "panic1"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:53:5 @@ -31,7 +45,12 @@ error: only a `panic!` in `if`-then statement LL | / if b.is_empty() && a.is_empty() { LL | | panic!("panic2"); LL | | } - | |_____^ help: try instead: `assert!(!(b.is_empty() && a.is_empty()), "panic2");` + | |_____^ + | +help: try instead + | +LL | assert!(!(b.is_empty() && a.is_empty()), "panic2"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:56:5 @@ -39,7 +58,12 @@ error: only a `panic!` in `if`-then statement LL | / if a.is_empty() && !b.is_empty() { LL | | panic!("panic3"); LL | | } - | |_____^ help: try instead: `assert!(!(a.is_empty() && !b.is_empty()), "panic3");` + | |_____^ + | +help: try instead + | +LL | assert!(!(a.is_empty() && !b.is_empty()), "panic3"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:59:5 @@ -47,7 +71,12 @@ error: only a `panic!` in `if`-then statement LL | / if b.is_empty() || a.is_empty() { LL | | panic!("panic4"); LL | | } - | |_____^ help: try instead: `assert!(!(b.is_empty() || a.is_empty()), "panic4");` + | |_____^ + | +help: try instead + | +LL | assert!(!(b.is_empty() || a.is_empty()), "panic4"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:62:5 @@ -55,7 +84,12 @@ error: only a `panic!` in `if`-then statement LL | / if a.is_empty() || !b.is_empty() { LL | | panic!("panic5"); LL | | } - | |_____^ help: try instead: `assert!(!(a.is_empty() || !b.is_empty()), "panic5");` + | |_____^ + | +help: try instead + | +LL | assert!(!(a.is_empty() || !b.is_empty()), "panic5"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:65:5 @@ -63,7 +97,12 @@ error: only a `panic!` in `if`-then statement LL | / if a.is_empty() { LL | | panic!("with expansion {}", one!()) LL | | } - | |_____^ help: try instead: `assert!(!a.is_empty(), "with expansion {}", one!());` + | |_____^ + | +help: try instead + | +LL | assert!(!a.is_empty(), "with expansion {}", one!()); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:77:5 @@ -89,7 +128,12 @@ LL | const BAR: () = if N == 0 { | _________________________^ LL | | panic!() LL | | }; - | |_________^ help: try instead: `assert!(!(N == 0), )` + | |_________^ + | +help: try instead + | +LL | const BAR: () = assert!(!(N == 0), ); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr b/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr index 1eebe1bfe1771..2f88000bb7d22 100644 --- a/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr +++ b/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr @@ -4,10 +4,14 @@ error: only a `panic!` in `if`-then statement LL | / if !a.is_empty() { LL | | panic!("qaqaq{:?}", a); LL | | } - | |_____^ help: try instead: `assert!(a.is_empty(), "qaqaq{:?}", a);` + | |_____^ | = note: `-D clippy::manual-assert` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_assert)]` +help: try instead + | +LL | assert!(a.is_empty(), "qaqaq{:?}", a); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:33:5 @@ -15,7 +19,12 @@ error: only a `panic!` in `if`-then statement LL | / if !a.is_empty() { LL | | panic!("qwqwq"); LL | | } - | |_____^ help: try instead: `assert!(a.is_empty(), "qwqwq");` + | |_____^ + | +help: try instead + | +LL | assert!(a.is_empty(), "qwqwq"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:50:5 @@ -23,7 +32,12 @@ error: only a `panic!` in `if`-then statement LL | / if b.is_empty() { LL | | panic!("panic1"); LL | | } - | |_____^ help: try instead: `assert!(!b.is_empty(), "panic1");` + | |_____^ + | +help: try instead + | +LL | assert!(!b.is_empty(), "panic1"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:53:5 @@ -31,7 +45,12 @@ error: only a `panic!` in `if`-then statement LL | / if b.is_empty() && a.is_empty() { LL | | panic!("panic2"); LL | | } - | |_____^ help: try instead: `assert!(!(b.is_empty() && a.is_empty()), "panic2");` + | |_____^ + | +help: try instead + | +LL | assert!(!(b.is_empty() && a.is_empty()), "panic2"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:56:5 @@ -39,7 +58,12 @@ error: only a `panic!` in `if`-then statement LL | / if a.is_empty() && !b.is_empty() { LL | | panic!("panic3"); LL | | } - | |_____^ help: try instead: `assert!(!(a.is_empty() && !b.is_empty()), "panic3");` + | |_____^ + | +help: try instead + | +LL | assert!(!(a.is_empty() && !b.is_empty()), "panic3"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:59:5 @@ -47,7 +71,12 @@ error: only a `panic!` in `if`-then statement LL | / if b.is_empty() || a.is_empty() { LL | | panic!("panic4"); LL | | } - | |_____^ help: try instead: `assert!(!(b.is_empty() || a.is_empty()), "panic4");` + | |_____^ + | +help: try instead + | +LL | assert!(!(b.is_empty() || a.is_empty()), "panic4"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:62:5 @@ -55,7 +84,12 @@ error: only a `panic!` in `if`-then statement LL | / if a.is_empty() || !b.is_empty() { LL | | panic!("panic5"); LL | | } - | |_____^ help: try instead: `assert!(!(a.is_empty() || !b.is_empty()), "panic5");` + | |_____^ + | +help: try instead + | +LL | assert!(!(a.is_empty() || !b.is_empty()), "panic5"); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:65:5 @@ -63,7 +97,12 @@ error: only a `panic!` in `if`-then statement LL | / if a.is_empty() { LL | | panic!("with expansion {}", one!()) LL | | } - | |_____^ help: try instead: `assert!(!a.is_empty(), "with expansion {}", one!());` + | |_____^ + | +help: try instead + | +LL | assert!(!a.is_empty(), "with expansion {}", one!()); + | error: only a `panic!` in `if`-then statement --> tests/ui/manual_assert.rs:77:5 @@ -89,7 +128,12 @@ LL | const BAR: () = if N == 0 { | _________________________^ LL | | panic!() LL | | }; - | |_________^ help: try instead: `assert!(!(N == 0), )` + | |_________^ + | +help: try instead + | +LL | const BAR: () = assert!(!(N == 0), ); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/manual_bits.stderr b/src/tools/clippy/tests/ui/manual_bits.stderr index 4383aa49df9b4..2e6ac2cd73d99 100644 --- a/src/tools/clippy/tests/ui/manual_bits.stderr +++ b/src/tools/clippy/tests/ui/manual_bits.stderr @@ -2,178 +2,322 @@ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:14:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `i8::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-bits` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_bits)]` +help: consider using + | +LL | i8::BITS as usize; + | ~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:15:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `i16::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | i16::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:16:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `i32::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | i32::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:17:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `i64::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | i64::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:18:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `i128::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | i128::BITS as usize; + | ~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:19:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `isize::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | isize::BITS as usize; + | ~~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:21:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `u8::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u8::BITS as usize; + | ~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:22:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `u16::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u16::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:23:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `u32::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u32::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:24:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `u64::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u64::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:25:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `u128::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u128::BITS as usize; + | ~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:26:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `usize::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | usize::BITS as usize; + | ~~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:28:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `i8::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | i8::BITS as usize; + | ~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:29:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `i16::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | i16::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:30:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `i32::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | i32::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:31:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `i64::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | i64::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:32:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `i128::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | i128::BITS as usize; + | ~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:33:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `isize::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | isize::BITS as usize; + | ~~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:35:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `u8::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u8::BITS as usize; + | ~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:36:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `u16::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u16::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:37:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `u32::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u32::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:38:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `u64::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u64::BITS as usize; + | ~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:39:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `u128::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | u128::BITS as usize; + | ~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:40:5 | LL | 8 * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `usize::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | usize::BITS as usize; + | ~~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:50:5 | LL | size_of::() * 8; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `Word::BITS as usize` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | Word::BITS as usize; + | ~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:54:18 | LL | let _: u32 = (size_of::() * 8) as u32; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `u128::BITS` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: u32 = u128::BITS as u32; + | ~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:55:18 | LL | let _: u32 = (size_of::() * 8).try_into().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `u128::BITS` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: u32 = u128::BITS.try_into().unwrap(); + | ~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:56:13 | LL | let _ = (size_of::() * 8).pow(5); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(u128::BITS as usize)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (u128::BITS as usize).pow(5); + | ~~~~~~~~~~~~~~~~~~~~~ error: usage of `mem::size_of::()` to obtain the size of `T` in bits --> tests/ui/manual_bits.rs:57:14 | LL | let _ = &(size_of::() * 8); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(u128::BITS as usize)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = &(u128::BITS as usize); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 29 previous errors diff --git a/src/tools/clippy/tests/ui/manual_c_str_literals.stderr b/src/tools/clippy/tests/ui/manual_c_str_literals.stderr index 9c70bddb81c18..f91b52e4b6527 100644 --- a/src/tools/clippy/tests/ui/manual_c_str_literals.stderr +++ b/src/tools/clippy/tests/ui/manual_c_str_literals.stderr @@ -2,82 +2,146 @@ error: calling `CStr::new` with a byte string literal --> tests/ui/manual_c_str_literals.rs:31:5 | LL | CStr::from_bytes_with_nul(b"foo\0"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-c-str-literals` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_c_str_literals)]` +help: use a `c""` literal + | +LL | c"foo"; + | ~~~~~~ error: calling `CStr::new` with a byte string literal --> tests/ui/manual_c_str_literals.rs:35:5 | LL | CStr::from_bytes_with_nul(b"foo\0"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use a `c""` literal + | +LL | c"foo"; + | ~~~~~~ error: calling `CStr::new` with a byte string literal --> tests/ui/manual_c_str_literals.rs:36:5 | LL | CStr::from_bytes_with_nul(b"foo\x00"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use a `c""` literal + | +LL | c"foo"; + | ~~~~~~ error: calling `CStr::new` with a byte string literal --> tests/ui/manual_c_str_literals.rs:37:5 | LL | CStr::from_bytes_with_nul(b"foo\0").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use a `c""` literal + | +LL | c"foo"; + | ~~~~~~ error: calling `CStr::new` with a byte string literal --> tests/ui/manual_c_str_literals.rs:38:5 | LL | CStr::from_bytes_with_nul(b"foo\\0sdsd\0").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo\\0sdsd"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use a `c""` literal + | +LL | c"foo\\0sdsd"; + | ~~~~~~~~~~~~~ error: calling `CStr::from_ptr` with a byte string literal --> tests/ui/manual_c_str_literals.rs:43:14 | LL | unsafe { CStr::from_ptr(b"foo\0".as_ptr().cast()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use a `c""` literal + | +LL | unsafe { c"foo" }; + | ~~~~~~ error: calling `CStr::from_ptr` with a byte string literal --> tests/ui/manual_c_str_literals.rs:44:14 | LL | unsafe { CStr::from_ptr(b"foo\0".as_ptr() as *const _) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use a `c""` literal + | +LL | unsafe { c"foo" }; + | ~~~~~~ error: manually constructing a nul-terminated string --> tests/ui/manual_c_str_literals.rs:45:23 | LL | let _: *const _ = b"foo\0".as_ptr(); - | ^^^^^^^^ help: use a `c""` literal: `c"foo"` + | ^^^^^^^^ + | +help: use a `c""` literal + | +LL | let _: *const _ = c"foo".as_ptr(); + | ~~~~~~ error: manually constructing a nul-terminated string --> tests/ui/manual_c_str_literals.rs:46:23 | LL | let _: *const _ = "foo\0".as_ptr(); - | ^^^^^^^ help: use a `c""` literal: `c"foo"` + | ^^^^^^^ + | +help: use a `c""` literal + | +LL | let _: *const _ = c"foo".as_ptr(); + | ~~~~~~ error: manually constructing a nul-terminated string --> tests/ui/manual_c_str_literals.rs:49:23 | LL | let _: *const _ = b"foo\0".as_ptr().cast::(); - | ^^^^^^^^ help: use a `c""` literal: `c"foo"` + | ^^^^^^^^ + | +help: use a `c""` literal + | +LL | let _: *const _ = c"foo".as_ptr().cast::(); + | ~~~~~~ error: manually constructing a nul-terminated string --> tests/ui/manual_c_str_literals.rs:52:13 | LL | let _ = "电脑\\\0".as_ptr(); - | ^^^^^^^^^^ help: use a `c""` literal: `c"电脑\\"` + | ^^^^^^^^^^ + | +help: use a `c""` literal + | +LL | let _ = c"电脑\\".as_ptr(); + | ~~~~~~~~~ error: manually constructing a nul-terminated string --> tests/ui/manual_c_str_literals.rs:53:13 | LL | let _ = "电脑\0".as_ptr(); - | ^^^^^^^^ help: use a `c""` literal: `c"电脑"` + | ^^^^^^^^ + | +help: use a `c""` literal + | +LL | let _ = c"电脑".as_ptr(); + | ~~~~~~~ error: manually constructing a nul-terminated string --> tests/ui/manual_c_str_literals.rs:54:13 | LL | let _ = "电脑\x00".as_ptr(); - | ^^^^^^^^^^ help: use a `c""` literal: `c"电脑"` + | ^^^^^^^^^^ + | +help: use a `c""` literal + | +LL | let _ = c"电脑".as_ptr(); + | ~~~~~~~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/manual_clamp.stderr b/src/tools/clippy/tests/ui/manual_clamp.stderr index 459d46796d875..37858bd8d01cf 100644 --- a/src/tools/clippy/tests/ui/manual_clamp.stderr +++ b/src/tools/clippy/tests/ui/manual_clamp.stderr @@ -8,11 +8,15 @@ LL | | x9 = CONST_MIN; ... | LL | | x9 = CONST_MAX; LL | | } - | |_____^ help: replace with clamp: `x9 = x9.clamp(CONST_MIN, CONST_MAX);` + | |_____^ | = note: clamp will panic if max < min = note: `-D clippy::manual-clamp` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_clamp)]` +help: replace with clamp + | +LL | x9 = x9.clamp(CONST_MIN, CONST_MAX); + | error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:236:5 @@ -24,9 +28,13 @@ LL | | x11 = CONST_MAX; ... | LL | | x11 = CONST_MIN; LL | | } - | |_____^ help: replace with clamp: `x11 = x11.clamp(CONST_MIN, CONST_MAX);` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | x11 = x11.clamp(CONST_MIN, CONST_MAX); + | error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:246:5 @@ -38,9 +46,13 @@ LL | | x12 = CONST_MIN; ... | LL | | x12 = CONST_MAX; LL | | } - | |_____^ help: replace with clamp: `x12 = x12.clamp(CONST_MIN, CONST_MAX);` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | x12 = x12.clamp(CONST_MIN, CONST_MAX); + | error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:256:5 @@ -52,9 +64,13 @@ LL | | x13 = CONST_MAX; ... | LL | | x13 = CONST_MIN; LL | | } - | |_____^ help: replace with clamp: `x13 = x13.clamp(CONST_MIN, CONST_MAX);` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | x13 = x13.clamp(CONST_MIN, CONST_MAX); + | error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:370:5 @@ -66,9 +82,13 @@ LL | | x35 = CONST_MAX; ... | LL | | x35 = CONST_MIN; LL | | } - | |_____^ help: replace with clamp: `x35 = x35.clamp(CONST_MIN, CONST_MAX);` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | x35 = x35.clamp(CONST_MIN, CONST_MAX); + | error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:144:14 @@ -81,9 +101,13 @@ LL | | CONST_MAX ... | LL | | input LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x0 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:154:14 @@ -96,9 +120,13 @@ LL | | CONST_MAX ... | LL | | input LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x1 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:164:14 @@ -111,9 +139,13 @@ LL | | CONST_MIN ... | LL | | input LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x2 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:174:14 @@ -126,25 +158,37 @@ LL | | CONST_MIN ... | LL | | input LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x3 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:184:14 | LL | let x4 = input.max(CONST_MIN).min(CONST_MAX); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x4 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:188:14 | LL | let x5 = input.min(CONST_MAX).max(CONST_MIN); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x5 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:192:14 @@ -157,9 +201,13 @@ LL | | x if x > CONST_MAX => CONST_MAX, LL | | x if x < CONST_MIN => CONST_MIN, LL | | x => x, LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x6 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:200:14 @@ -172,9 +220,13 @@ LL | | x if x < CONST_MIN => CONST_MIN, LL | | x if x > CONST_MAX => CONST_MAX, LL | | x => x, LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x7 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:208:14 @@ -187,9 +239,13 @@ LL | | x if CONST_MAX < x => CONST_MAX, LL | | x if CONST_MIN > x => CONST_MIN, LL | | x => x, LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x8 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:226:15 @@ -202,9 +258,13 @@ LL | | x if CONST_MIN > x => CONST_MIN, LL | | x if CONST_MAX < x => CONST_MAX, LL | | x => x, LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x10 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:265:15 @@ -217,9 +277,13 @@ LL | | CONST_MAX ... | LL | | input LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x14 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:276:19 @@ -232,146 +296,214 @@ LL | | CONST_F64_MAX ... | LL | | input LL | | }; - | |_________^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)` + | |_________^ | = note: clamp will panic if max < min, min.is_nan(), or max.is_nan() = note: clamp returns NaN if the input is NaN +help: replace with clamp + | +LL | let x15 = input.clamp(CONST_F64_MIN, CONST_F64_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:289:19 | LL | let x16 = cmp_max(cmp_min(input, CONST_MAX), CONST_MIN); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x16 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:292:19 | LL | let x17 = cmp_min(cmp_max(input, CONST_MIN), CONST_MAX); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x17 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:295:19 | LL | let x18 = cmp_max(CONST_MIN, cmp_min(input, CONST_MAX)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x18 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:298:19 | LL | let x19 = cmp_min(CONST_MAX, cmp_max(input, CONST_MIN)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x19 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:301:19 | LL | let x20 = cmp_max(cmp_min(CONST_MAX, input), CONST_MIN); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x20 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:304:19 | LL | let x21 = cmp_min(cmp_max(CONST_MIN, input), CONST_MAX); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x21 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:307:19 | LL | let x22 = cmp_max(CONST_MIN, cmp_min(CONST_MAX, input)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x22 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:310:19 | LL | let x23 = cmp_min(CONST_MAX, cmp_max(CONST_MIN, input)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let x23 = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:314:19 | LL | let x24 = f64::max(f64::min(input, CONST_F64_MAX), CONST_F64_MIN); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min, min.is_nan(), or max.is_nan() = note: clamp returns NaN if the input is NaN +help: replace with clamp + | +LL | let x24 = input.clamp(CONST_F64_MIN, CONST_F64_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:317:19 | LL | let x25 = f64::min(f64::max(input, CONST_F64_MIN), CONST_F64_MAX); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min, min.is_nan(), or max.is_nan() = note: clamp returns NaN if the input is NaN +help: replace with clamp + | +LL | let x25 = input.clamp(CONST_F64_MIN, CONST_F64_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:320:19 | LL | let x26 = f64::max(CONST_F64_MIN, f64::min(input, CONST_F64_MAX)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min, min.is_nan(), or max.is_nan() = note: clamp returns NaN if the input is NaN +help: replace with clamp + | +LL | let x26 = input.clamp(CONST_F64_MIN, CONST_F64_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:323:19 | LL | let x27 = f64::min(CONST_F64_MAX, f64::max(input, CONST_F64_MIN)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min, min.is_nan(), or max.is_nan() = note: clamp returns NaN if the input is NaN +help: replace with clamp + | +LL | let x27 = input.clamp(CONST_F64_MIN, CONST_F64_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:326:19 | LL | let x28 = f64::max(f64::min(CONST_F64_MAX, input), CONST_F64_MIN); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min, min.is_nan(), or max.is_nan() = note: clamp returns NaN if the input is NaN +help: replace with clamp + | +LL | let x28 = input.clamp(CONST_F64_MIN, CONST_F64_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:329:19 | LL | let x29 = f64::min(f64::max(CONST_F64_MIN, input), CONST_F64_MAX); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min, min.is_nan(), or max.is_nan() = note: clamp returns NaN if the input is NaN +help: replace with clamp + | +LL | let x29 = input.clamp(CONST_F64_MIN, CONST_F64_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:332:19 | LL | let x30 = f64::max(CONST_F64_MIN, f64::min(CONST_F64_MAX, input)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min, min.is_nan(), or max.is_nan() = note: clamp returns NaN if the input is NaN +help: replace with clamp + | +LL | let x30 = input.clamp(CONST_F64_MIN, CONST_F64_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:335:19 | LL | let x31 = f64::min(CONST_F64_MAX, f64::max(CONST_F64_MIN, input)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: clamp will panic if max < min, min.is_nan(), or max.is_nan() = note: clamp returns NaN if the input is NaN +help: replace with clamp + | +LL | let x31 = input.clamp(CONST_F64_MIN, CONST_F64_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:340:5 @@ -383,9 +515,13 @@ LL | | x32 = CONST_MIN; LL | | } else if x32 > CONST_MAX { LL | | x32 = CONST_MAX; LL | | } - | |_____^ help: replace with clamp: `x32 = x32.clamp(CONST_MIN, CONST_MAX);` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | x32 = x32.clamp(CONST_MIN, CONST_MAX); + | error: clamp-like pattern without using clamp function --> tests/ui/manual_clamp.rs:532:13 @@ -398,9 +534,13 @@ LL | | CONST_MAX ... | LL | | input LL | | }; - | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)` + | |_____^ | = note: clamp will panic if max < min +help: replace with clamp + | +LL | let _ = input.clamp(CONST_MIN, CONST_MAX); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 35 previous errors diff --git a/src/tools/clippy/tests/ui/manual_filter.stderr b/src/tools/clippy/tests/ui/manual_filter.stderr index 3add706d7f73c..73f24f48ef985 100644 --- a/src/tools/clippy/tests/ui/manual_filter.stderr +++ b/src/tools/clippy/tests/ui/manual_filter.stderr @@ -8,10 +8,14 @@ LL | | if x > 0 { ... | LL | | }, LL | | }; - | |_____^ help: try: `Some(0).filter(|&x| x <= 0)` + | |_____^ | = note: `-D clippy::manual-filter` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_filter)]` +help: try + | +LL | Some(0).filter(|&x| x <= 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:16:5 @@ -23,7 +27,12 @@ LL | | None ... | LL | | None => None, LL | | }; - | |_____^ help: try: `Some(1).filter(|&x| x <= 0)` + | |_____^ + | +help: try + | +LL | Some(1).filter(|&x| x <= 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:27:5 @@ -35,7 +44,12 @@ LL | | None ... | LL | | _ => None, LL | | }; - | |_____^ help: try: `Some(2).filter(|&x| x <= 0)` + | |_____^ + | +help: try + | +LL | Some(2).filter(|&x| x <= 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:38:5 @@ -47,7 +61,12 @@ LL | | Some(x) ... | LL | | None => None, LL | | }; - | |_____^ help: try: `Some(3).filter(|&x| x > 0)` + | |_____^ + | +help: try + | +LL | Some(3).filter(|&x| x > 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:50:5 @@ -59,7 +78,12 @@ LL | | Some(x) => { ... | LL | | }, LL | | }; - | |_____^ help: try: `y.filter(|&x| x <= 0)` + | |_____^ + | +help: try + | +LL | y.filter(|&x| x <= 0); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:62:5 @@ -71,7 +95,12 @@ LL | | Some(x) ... | LL | | _ => None, LL | | }; - | |_____^ help: try: `Some(5).filter(|&x| x > 0)` + | |_____^ + | +help: try + | +LL | Some(5).filter(|&x| x > 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:73:5 @@ -83,7 +112,12 @@ LL | | Some(x) ... | LL | | _ => None, LL | | }; - | |_____^ help: try: `Some(6).as_ref().filter(|&x| x > &0)` + | |_____^ + | +help: try + | +LL | Some(6).as_ref().filter(|&x| x > &0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:85:5 @@ -95,7 +129,12 @@ LL | | Some(x) ... | LL | | _ => None, LL | | }; - | |_____^ help: try: `Some(String::new()).filter(|x| external_cond)` + | |_____^ + | +help: try + | +LL | Some(String::new()).filter(|x| external_cond); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:96:5 @@ -105,7 +144,12 @@ LL | | if external_cond { Some(x) } else { None } LL | | } else { LL | | None LL | | }; - | |_____^ help: try: `Some(7).filter(|&x| external_cond)` + | |_____^ + | +help: try + | +LL | Some(7).filter(|&x| external_cond); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:102:5 @@ -117,7 +161,12 @@ LL | | Some(x) ... | LL | | _ => None, LL | | }; - | |_____^ help: try: `Some(8).filter(|&x| x != 0)` + | |_____^ + | +help: try + | +LL | Some(8).filter(|&x| x != 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:113:5 @@ -129,7 +178,12 @@ LL | | Some(x) ... | LL | | None => None, LL | | }; - | |_____^ help: try: `Some(9).filter(|&x| x > 10 && x < 100)` + | |_____^ + | +help: try + | +LL | Some(9).filter(|&x| x > 10 && x < 100); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:139:5 @@ -162,7 +216,12 @@ LL | | Some(x) ... | LL | | None => None, LL | | }; - | |_____^ help: try: `Some(14).filter(|&x| unsafe { f(x) })` + | |_____^ + | +help: try + | +LL | let _ = Some(14).filter(|&x| unsafe { f(x) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:193:13 @@ -172,7 +231,12 @@ LL | let _ = match Some(15) { LL | | Some(x) => unsafe { if f(x) { Some(x) } else { None } }, LL | | None => None, LL | | }; - | |_____^ help: try: `Some(15).filter(|&x| unsafe { f(x) })` + | |_____^ + | +help: try + | +LL | let _ = Some(15).filter(|&x| unsafe { f(x) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::filter` --> tests/ui/manual_filter.rs:201:12 @@ -184,7 +248,12 @@ LL | | if x % 2 == 0 { Some(x) } else { None } LL | | } else { LL | | None LL | | }; - | |_____^ help: try: `{ Some(16).filter(|&x| x % 2 == 0) }` + | |_____^ + | +help: try + | +LL | } else { Some(16).filter(|&x| x % 2 == 0) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/manual_filter_map.stderr b/src/tools/clippy/tests/ui/manual_filter_map.stderr index 2e50567278319..cc7bd7c930da6 100644 --- a/src/tools/clippy/tests/ui/manual_filter_map.stderr +++ b/src/tools/clippy/tests/ui/manual_filter_map.stderr @@ -2,7 +2,7 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:9:19 | LL | let _ = (0..).filter(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `filter_map(|a| to_opt(a))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_filter_map.rs:9:30 @@ -11,30 +11,42 @@ LL | let _ = (0..).filter(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap | ^^^^^^^^^^ = note: `-D clippy::manual-filter-map` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_filter_map)]` +help: try + | +LL | let _ = (0..).filter_map(|a| to_opt(a)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:12:19 | LL | let _ = (0..).filter(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `filter_map(|a| to_opt(a))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_filter_map.rs:12:31 | LL | let _ = (0..).filter(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi")); | ^^^^^^^^^ +help: try + | +LL | let _ = (0..).filter_map(|a| to_opt(a)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:15:19 | LL | let _ = (0..).filter(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `filter_map(|a| to_res(a).ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_filter_map.rs:15:31 | LL | let _ = (0..).filter(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1)); | ^^^^^^^^^ +help: try + | +LL | let _ = (0..).filter_map(|a| to_res(a).ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:18:10 @@ -42,13 +54,17 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|&x| to_ref(to_opt(x)).is_some()) | __________^ LL | | .map(|y| to_ref(to_opt(y)).unwrap()); - | |____________________________________________^ help: try: `filter_map(|y| *to_ref(to_opt(y)))` + | |____________________________________________^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_filter_map.rs:18:22 | LL | .filter(|&x| to_ref(to_opt(x)).is_some()) | ^^^^^^^^^^^^^^^^^ +help: try + | +LL | .filter_map(|y| *to_ref(to_opt(y))); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:21:10 @@ -56,13 +72,17 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|x| to_ref(to_opt(*x)).is_some()) | __________^ LL | | .map(|y| to_ref(to_opt(y)).unwrap()); - | |____________________________________________^ help: try: `filter_map(|y| *to_ref(to_opt(y)))` + | |____________________________________________^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_filter_map.rs:21:21 | LL | .filter(|x| to_ref(to_opt(*x)).is_some()) | ^^^^^^^^^^^^^^^^^^ +help: try + | +LL | .filter_map(|y| *to_ref(to_opt(y))); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:25:10 @@ -70,13 +90,17 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|&x| to_ref(to_res(x)).is_ok()) | __________^ LL | | .map(|y| to_ref(to_res(y)).unwrap()); - | |____________________________________________^ help: try: `filter_map(|y| to_ref(to_res(y)).ok())` + | |____________________________________________^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_filter_map.rs:25:22 | LL | .filter(|&x| to_ref(to_res(x)).is_ok()) | ^^^^^^^^^^^^^^^^^ +help: try + | +LL | .filter_map(|y| to_ref(to_res(y)).ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:28:10 @@ -84,94 +108,150 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|x| to_ref(to_res(*x)).is_ok()) | __________^ LL | | .map(|y| to_ref(to_res(y)).unwrap()); - | |____________________________________________^ help: try: `filter_map(|y| to_ref(to_res(y)).ok())` + | |____________________________________________^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_filter_map.rs:28:21 | LL | .filter(|x| to_ref(to_res(*x)).is_ok()) | ^^^^^^^^^^^^^^^^^^ +help: try + | +LL | .filter_map(|y| to_ref(to_res(y)).ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:34:27 | LL | iter::>().find(|x| x.is_some()).map(|x| x.cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-find-map` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_find_map)]` +help: try + | +LL | iter::>().find_map(|x| x.cloned()); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:35:28 | LL | iter::<&Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Option<&u8>>().find_map(|x| x.cloned()); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:36:31 | LL | iter::<&Option>().find(|x| x.is_some()).map(|x| x.as_deref().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Option>().find_map(|x| x.as_deref()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:37:31 | LL | iter::>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_filter_map.rs:37:41 | LL | iter::>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap()); | ^^^^^^^^^ +help: try + | +LL | iter::>().find_map(|y| to_ref(y).cloned()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:39:30 | LL | iter::>().find(|x| x.is_ok()).map(|x| x.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::>().find_map(|x| x.ok()); + | ~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:40:31 | LL | iter::<&Result>().find(|x| x.is_ok()).map(|x| x.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Result>().find_map(|x| x.ok()); + | ~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:41:32 | LL | iter::<&&Result>().find(|x| x.is_ok()).map(|x| x.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&&Result>().find_map(|x| x.ok()); + | ~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:42:31 | LL | iter::>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::>().find_map(|x| x.cloned().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:43:32 | LL | iter::<&Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Result<&u8, ()>>().find_map(|x| x.cloned().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:44:35 | LL | iter::<&Result>().find(|x| x.is_ok()).map(|x| x.as_deref().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Result>().find_map(|x| x.as_deref().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_filter_map.rs:45:35 | LL | iter::>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_filter_map.rs:45:45 | LL | iter::>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap()); | ^^^^^^^^^ +help: try + | +LL | iter::>().find_map(|y| to_ref(y).cloned().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:93:10 @@ -179,7 +259,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|f| f.option_field.is_some()) | __________^ LL | | .map(|f| f.option_field.clone().unwrap()); - | |_________________________________________________^ help: try: `filter_map(|f| f.option_field.clone())` + | |_________________________________________________^ + | +help: try + | +LL | .filter_map(|f| f.option_field.clone()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:98:10 @@ -187,7 +272,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|f| f.ref_field.is_some()) | __________^ LL | | .map(|f| f.ref_field.cloned().unwrap()); - | |_______________________________________________^ help: try: `filter_map(|f| f.ref_field.cloned())` + | |_______________________________________________^ + | +help: try + | +LL | .filter_map(|f| f.ref_field.cloned()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:103:10 @@ -195,7 +285,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|f| f.ref_field.is_some()) | __________^ LL | | .map(|f| f.ref_field.copied().unwrap()); - | |_______________________________________________^ help: try: `filter_map(|f| f.ref_field.copied())` + | |_______________________________________________^ + | +help: try + | +LL | .filter_map(|f| f.ref_field.copied()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:108:10 @@ -203,7 +298,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.clone().unwrap()); - | |_________________________________________________^ help: try: `filter_map(|f| f.result_field.clone().ok())` + | |_________________________________________________^ + | +help: try + | +LL | .filter_map(|f| f.result_field.clone().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:113:10 @@ -211,7 +311,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.as_ref().unwrap()); - | |__________________________________________________^ help: try: `filter_map(|f| f.result_field.as_ref().ok())` + | |__________________________________________________^ + | +help: try + | +LL | .filter_map(|f| f.result_field.as_ref().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:118:10 @@ -219,7 +324,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.as_deref().unwrap()); - | |____________________________________________________^ help: try: `filter_map(|f| f.result_field.as_deref().ok())` + | |____________________________________________________^ + | +help: try + | +LL | .filter_map(|f| f.result_field.as_deref().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:123:10 @@ -227,7 +337,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.as_mut().unwrap()); - | |__________________________________________________^ help: try: `filter_map(|f| f.result_field.as_mut().ok())` + | |__________________________________________________^ + | +help: try + | +LL | .filter_map(|f| f.result_field.as_mut().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:128:10 @@ -235,7 +350,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.as_deref_mut().unwrap()); - | |________________________________________________________^ help: try: `filter_map(|f| f.result_field.as_deref_mut().ok())` + | |________________________________________________________^ + | +help: try + | +LL | .filter_map(|f| f.result_field.as_deref_mut().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:133:10 @@ -243,7 +363,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.to_owned().unwrap()); - | |____________________________________________________^ help: try: `filter_map(|f| f.result_field.to_owned().ok())` + | |____________________________________________________^ + | +help: try + | +LL | .filter_map(|f| f.result_field.to_owned().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:146:27 @@ -253,7 +378,12 @@ LL | let _x = iter.clone().filter(|x| matches!(x, Enum::A(_))).map(|x| mat LL | | Enum::A(s) => s, LL | | _ => unreachable!(), LL | | }); - | |______^ help: try: `filter_map(|x| match x { Enum::A(s) => Some(s), _ => None })` + | |______^ + | +help: try + | +LL | let _x = iter.clone().filter_map(|x| match x { Enum::A(s) => Some(s), _ => None }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `filter(..).map(..)` can be simplified as `filter_map(..)` --> tests/ui/manual_filter_map.rs:156:10 @@ -261,7 +391,12 @@ error: `filter(..).map(..)` can be simplified as `filter_map(..)` LL | .filter(|x| matches!(x, Enum::A(_))) | __________^ LL | | .map(|x| if let Enum::A(s) = x { s } else { unreachable!() }); - | |_____________________________________________________________________^ help: try: `filter_map(|x| match x { Enum::A(s) => Some(s), _ => None })` + | |_____________________________________________________________________^ + | +help: try + | +LL | .filter_map(|x| match x { Enum::A(s) => Some(s), _ => None }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 29 previous errors diff --git a/src/tools/clippy/tests/ui/manual_find.stderr b/src/tools/clippy/tests/ui/manual_find.stderr index eb55a0c11f244..029b2756e2aae 100644 --- a/src/tools/clippy/tests/ui/manual_find.stderr +++ b/src/tools/clippy/tests/ui/manual_find.stderr @@ -8,11 +8,15 @@ LL | | if s == String::new() { ... | LL | | } LL | | None - | |________^ help: replace with an iterator: `strings.into_iter().find(|s| s == String::new())` + | |________^ | = note: you may need to dereference some variables = note: `-D clippy::manual-find` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_find)]` +help: replace with an iterator + | +LL | strings.into_iter().find(|s| s == String::new()) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find.rs:16:5 @@ -24,9 +28,13 @@ LL | | if s == String::new() { ... | LL | | } LL | | None - | |________^ help: replace with an iterator: `arr.into_iter().map(|(s, _)| s).find(|s| s == String::new())` + | |________^ | = note: you may need to dereference some variables +help: replace with an iterator + | +LL | arr.into_iter().map(|(s, _)| s).find(|s| s == String::new()) + | error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/manual_find_fixable.stderr b/src/tools/clippy/tests/ui/manual_find_fixable.stderr index c3f48fb9f98a3..45859c8335577 100644 --- a/src/tools/clippy/tests/ui/manual_find_fixable.stderr +++ b/src/tools/clippy/tests/ui/manual_find_fixable.stderr @@ -7,10 +7,14 @@ LL | | return Some(v); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `ARRAY.iter().find(|&&v| v == n).copied()` + | |________^ | = note: `-D clippy::manual-find` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_find)]` +help: replace with an iterator + | +LL | ARRAY.iter().find(|&&v| v == n).copied() + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:19:5 @@ -21,7 +25,12 @@ LL | | return Some(a); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `arr.into_iter().map(|(a, _)| a).find(|&a| a % 2 == 0)` + | |________^ + | +help: replace with an iterator + | +LL | arr.into_iter().map(|(a, _)| a).find(|&a| a % 2 == 0) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:32:5 @@ -32,9 +41,13 @@ LL | | return Some(el); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.name.len() == 10)` + | |________^ | = note: you may need to dereference some variables +help: replace with an iterator + | +LL | arr.into_iter().find(|el| el.name.len() == 10) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:42:5 @@ -45,7 +58,12 @@ LL | | return Some(a); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `arr.into_iter().map(|Tuple(a, _)| a).find(|&a| a >= 3)` + | |________^ + | +help: replace with an iterator + | +LL | arr.into_iter().map(|Tuple(a, _)| a).find(|&a| a >= 3) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:57:5 @@ -56,9 +74,13 @@ LL | | return Some(el); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.should_keep())` + | |________^ | = note: you may need to dereference some variables +help: replace with an iterator + | +LL | arr.into_iter().find(|el| el.should_keep()) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:67:5 @@ -69,7 +91,12 @@ LL | | return Some(el); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `arr.into_iter().find(|&el| f(el) == 20)` + | |________^ + | +help: replace with an iterator + | +LL | arr.into_iter().find(|&el| f(el) == 20) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:77:5 @@ -80,7 +107,12 @@ LL | | return Some(el); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `arr.values().find(|&&el| f(el)).copied()` + | |________^ + | +help: replace with an iterator + | +LL | arr.values().find(|&&el| f(el)).copied() + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:86:5 @@ -91,9 +123,13 @@ LL | | return Some(el); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.is_true)` + | |________^ | = note: you may need to dereference some variables +help: replace with an iterator + | +LL | arr.into_iter().find(|el| el.is_true) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:116:5 @@ -104,7 +140,12 @@ LL | | return Some(x); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `v.into_iter().map(|(_, &x)| x).find(|&x| x > 10)` + | |________^ + | +help: replace with an iterator + | +LL | v.into_iter().map(|(_, &x)| x).find(|&x| x > 10) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:125:5 @@ -115,7 +156,12 @@ LL | | return Some(x); LL | | } LL | | } LL | | None - | |________^ help: replace with an iterator: `v.iter().map(|&(_, &x)| x).find(|&x| x > 10)` + | |________^ + | +help: replace with an iterator + | +LL | v.iter().map(|&(_, &x)| x).find(|&x| x > 10) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:134:5 @@ -126,7 +172,12 @@ LL | | return Some(x); LL | | } LL | | } LL | | return None; - | |________________^ help: replace with an iterator: `arr.into_iter().find(|&x| x >= 5)` + | |________________^ + | +help: replace with an iterator + | +LL | arr.into_iter().find(|&x| x >= 5) + | error: manual implementation of `Iterator::find` --> tests/ui/manual_find_fixable.rs:189:9 @@ -137,7 +188,12 @@ LL | | return Some(x); LL | | } LL | | } LL | | None - | |____________^ help: replace with an iterator: `arr.into_iter().find(|&x| x < 1)` + | |____________^ + | +help: replace with an iterator + | +LL | arr.into_iter().find(|&x| x < 1) + | error: aborting due to 12 previous errors diff --git a/src/tools/clippy/tests/ui/manual_find_map.stderr b/src/tools/clippy/tests/ui/manual_find_map.stderr index 2722d59f52a90..bb0478cab832e 100644 --- a/src/tools/clippy/tests/ui/manual_find_map.stderr +++ b/src/tools/clippy/tests/ui/manual_find_map.stderr @@ -2,7 +2,7 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:9:19 | LL | let _ = (0..).find(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_find_map.rs:9:28 @@ -11,30 +11,42 @@ LL | let _ = (0..).find(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap() | ^^^^^^^^^^ = note: `-D clippy::manual-find-map` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_find_map)]` +help: try + | +LL | let _ = (0..).find_map(|a| to_opt(a)); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:12:19 | LL | let _ = (0..).find(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_find_map.rs:12:29 | LL | let _ = (0..).find(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi")); | ^^^^^^^^^ +help: try + | +LL | let _ = (0..).find_map(|a| to_opt(a)); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:15:19 | LL | let _ = (0..).find(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_res(a).ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_find_map.rs:15:29 | LL | let _ = (0..).find(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1)); | ^^^^^^^^^ +help: try + | +LL | let _ = (0..).find_map(|a| to_res(a).ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:18:10 @@ -42,13 +54,17 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|&x| to_ref(to_opt(x)).is_some()) | __________^ LL | | .map(|y| to_ref(to_opt(y)).unwrap()); - | |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))` + | |____________________________________________^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_find_map.rs:18:20 | LL | .find(|&x| to_ref(to_opt(x)).is_some()) | ^^^^^^^^^^^^^^^^^ +help: try + | +LL | .find_map(|y| *to_ref(to_opt(y))); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:21:10 @@ -56,13 +72,17 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|x| to_ref(to_opt(*x)).is_some()) | __________^ LL | | .map(|y| to_ref(to_opt(y)).unwrap()); - | |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))` + | |____________________________________________^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_find_map.rs:21:19 | LL | .find(|x| to_ref(to_opt(*x)).is_some()) | ^^^^^^^^^^^^^^^^^^ +help: try + | +LL | .find_map(|y| *to_ref(to_opt(y))); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:25:10 @@ -70,13 +90,17 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|&x| to_ref(to_res(x)).is_ok()) | __________^ LL | | .map(|y| to_ref(to_res(y)).unwrap()); - | |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())` + | |____________________________________________^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_find_map.rs:25:20 | LL | .find(|&x| to_ref(to_res(x)).is_ok()) | ^^^^^^^^^^^^^^^^^ +help: try + | +LL | .find_map(|y| to_ref(to_res(y)).ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:28:10 @@ -84,109 +108,181 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|x| to_ref(to_res(*x)).is_ok()) | __________^ LL | | .map(|y| to_ref(to_res(y)).unwrap()); - | |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())` + | |____________________________________________^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_find_map.rs:28:19 | LL | .find(|x| to_ref(to_res(*x)).is_ok()) | ^^^^^^^^^^^^^^^^^^ +help: try + | +LL | .find_map(|y| to_ref(to_res(y)).ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:34:26 | LL | iter::>().find(|x| x.is_some()).map(|x| x.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::>().find_map(|x| x); + | ~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:35:27 | LL | iter::<&Option>().find(|x| x.is_some()).map(|x| x.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| *x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Option>().find_map(|x| *x); + | ~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:36:28 | LL | iter::<&&Option>().find(|x| x.is_some()).map(|x| x.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| **x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&&Option>().find_map(|x| **x); + | ~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:37:27 | LL | iter::>().find(|x| x.is_some()).map(|x| x.cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::>().find_map(|x| x.cloned()); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:38:28 | LL | iter::<&Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Option<&u8>>().find_map(|x| x.cloned()); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:39:31 | LL | iter::<&Option>().find(|x| x.is_some()).map(|x| x.as_deref().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Option>().find_map(|x| x.as_deref()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:40:31 | LL | iter::>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_find_map.rs:40:41 | LL | iter::>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap()); | ^^^^^^^^^ +help: try + | +LL | iter::>().find_map(|y| to_ref(y).cloned()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:42:30 | LL | iter::>().find(|x| x.is_ok()).map(|x| x.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::>().find_map(|x| x.ok()); + | ~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:43:31 | LL | iter::<&Result>().find(|x| x.is_ok()).map(|x| x.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Result>().find_map(|x| x.ok()); + | ~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:44:32 | LL | iter::<&&Result>().find(|x| x.is_ok()).map(|x| x.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&&Result>().find_map(|x| x.ok()); + | ~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:45:31 | LL | iter::>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::>().find_map(|x| x.cloned().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:46:32 | LL | iter::<&Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Result<&u8, ()>>().find_map(|x| x.cloned().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:47:35 | LL | iter::<&Result>().find(|x| x.is_ok()).map(|x| x.as_deref().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | iter::<&Result>().find_map(|x| x.as_deref().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:48:35 | LL | iter::>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned().ok())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once --> tests/ui/manual_find_map.rs:48:45 | LL | iter::>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap()); | ^^^^^^^^^ +help: try + | +LL | iter::>().find_map(|y| to_ref(y).cloned().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:96:10 @@ -194,7 +290,12 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|f| f.option_field.is_some()) | __________^ LL | | .map(|f| f.option_field.clone().unwrap()); - | |_________________________________________________^ help: try: `find_map(|f| f.option_field.clone())` + | |_________________________________________________^ + | +help: try + | +LL | .find_map(|f| f.option_field.clone()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:101:10 @@ -202,7 +303,12 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|f| f.ref_field.is_some()) | __________^ LL | | .map(|f| f.ref_field.cloned().unwrap()); - | |_______________________________________________^ help: try: `find_map(|f| f.ref_field.cloned())` + | |_______________________________________________^ + | +help: try + | +LL | .find_map(|f| f.ref_field.cloned()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:106:10 @@ -210,7 +316,12 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|f| f.ref_field.is_some()) | __________^ LL | | .map(|f| f.ref_field.copied().unwrap()); - | |_______________________________________________^ help: try: `find_map(|f| f.ref_field.copied())` + | |_______________________________________________^ + | +help: try + | +LL | .find_map(|f| f.ref_field.copied()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:111:10 @@ -218,7 +329,12 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.clone().unwrap()); - | |_________________________________________________^ help: try: `find_map(|f| f.result_field.clone().ok())` + | |_________________________________________________^ + | +help: try + | +LL | .find_map(|f| f.result_field.clone().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:116:10 @@ -226,7 +342,12 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.as_ref().unwrap()); - | |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_ref().ok())` + | |__________________________________________________^ + | +help: try + | +LL | .find_map(|f| f.result_field.as_ref().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:121:10 @@ -234,7 +355,12 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.as_deref().unwrap()); - | |____________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref().ok())` + | |____________________________________________________^ + | +help: try + | +LL | .find_map(|f| f.result_field.as_deref().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:126:10 @@ -242,7 +368,12 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.as_mut().unwrap()); - | |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_mut().ok())` + | |__________________________________________________^ + | +help: try + | +LL | .find_map(|f| f.result_field.as_mut().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:131:10 @@ -250,7 +381,12 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.as_deref_mut().unwrap()); - | |________________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref_mut().ok())` + | |________________________________________________________^ + | +help: try + | +LL | .find_map(|f| f.result_field.as_deref_mut().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `find(..).map(..)` can be simplified as `find_map(..)` --> tests/ui/manual_find_map.rs:136:10 @@ -258,7 +394,12 @@ error: `find(..).map(..)` can be simplified as `find_map(..)` LL | .find(|f| f.result_field.is_ok()) | __________^ LL | | .map(|f| f.result_field.to_owned().unwrap()); - | |____________________________________________________^ help: try: `find_map(|f| f.result_field.to_owned().ok())` + | |____________________________________________________^ + | +help: try + | +LL | .find_map(|f| f.result_field.to_owned().ok()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 30 previous errors diff --git a/src/tools/clippy/tests/ui/manual_flatten.stderr b/src/tools/clippy/tests/ui/manual_flatten.stderr index 3b64d9ef859d6..91e5a1ad4f1ec 100644 --- a/src/tools/clippy/tests/ui/manual_flatten.stderr +++ b/src/tools/clippy/tests/ui/manual_flatten.stderr @@ -1,10 +1,7 @@ error: unnecessary `if let` since only the `Some` variant of the iterator element is used --> tests/ui/manual_flatten.rs:7:5 | -LL | for n in x { - | ^ - help: try: `x.into_iter().flatten()` - | _____| - | | +LL | / for n in x { LL | | LL | | if let Some(y) = n { LL | | println!("{}", y); @@ -21,14 +18,15 @@ LL | | } | |_________^ = note: `-D clippy::manual-flatten` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_flatten)]` +help: try + | +LL | for n in x.into_iter().flatten() { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary `if let` since only the `Ok` variant of the iterator element is used --> tests/ui/manual_flatten.rs:16:5 | -LL | for n in y.clone() { - | ^ --------- help: try: `y.clone().into_iter().flatten()` - | _____| - | | +LL | / for n in y.clone() { LL | | LL | | if let Ok(n) = n { LL | | println!("{}", n); @@ -43,14 +41,15 @@ LL | / if let Ok(n) = n { LL | | println!("{}", n); LL | | }; | |_________^ +help: try + | +LL | for n in y.clone().into_iter().flatten() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary `if let` since only the `Ok` variant of the iterator element is used --> tests/ui/manual_flatten.rs:24:5 | -LL | for n in &y { - | ^ -- help: try: `y.iter().flatten()` - | _____| - | | +LL | / for n in &y { LL | | LL | | if let Ok(n) = n { LL | | println!("{}", n); @@ -65,14 +64,15 @@ LL | / if let Ok(n) = n { LL | | println!("{}", n); LL | | } | |_________^ +help: try + | +LL | for n in y.iter().flatten() { + | ~~~~~~~~~~~~~~~~~~ error: unnecessary `if let` since only the `Ok` variant of the iterator element is used --> tests/ui/manual_flatten.rs:33:5 | -LL | for n in z { - | ^ - help: try: `z.iter().flatten()` - | _____| - | | +LL | / for n in z { LL | | LL | | if let Ok(n) = n { LL | | println!("{}", n); @@ -87,14 +87,15 @@ LL | / if let Ok(n) = n { LL | | println!("{}", n); LL | | } | |_________^ +help: try + | +LL | for n in z.iter().flatten() { + | ~~~~~~~~~~~~~~~~~~ error: unnecessary `if let` since only the `Some` variant of the iterator element is used --> tests/ui/manual_flatten.rs:43:5 | -LL | for n in z { - | ^ - help: try: `z.flatten()` - | _____| - | | +LL | / for n in z { LL | | LL | | if let Some(m) = n { LL | | println!("{}", m); @@ -109,14 +110,15 @@ LL | / if let Some(m) = n { LL | | println!("{}", m); LL | | } | |_________^ +help: try + | +LL | for n in z.flatten() { + | ~~~~~~~~~~~ error: unnecessary `if let` since only the `Some` variant of the iterator element is used --> tests/ui/manual_flatten.rs:77:5 | -LL | for n in &vec_of_ref { - | ^ ----------- help: try: `vec_of_ref.iter().copied().flatten()` - | _____| - | | +LL | / for n in &vec_of_ref { LL | | LL | | if let Some(n) = n { LL | | println!("{:?}", n); @@ -131,14 +133,15 @@ LL | / if let Some(n) = n { LL | | println!("{:?}", n); LL | | } | |_________^ +help: try + | +LL | for n in vec_of_ref.iter().copied().flatten() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary `if let` since only the `Some` variant of the iterator element is used --> tests/ui/manual_flatten.rs:85:5 | -LL | for n in vec_of_ref { - | ^ ---------- help: try: `vec_of_ref.iter().copied().flatten()` - | _____| - | | +LL | / for n in vec_of_ref { LL | | LL | | if let Some(n) = n { LL | | println!("{:?}", n); @@ -153,14 +156,15 @@ LL | / if let Some(n) = n { LL | | println!("{:?}", n); LL | | } | |_________^ +help: try + | +LL | for n in vec_of_ref.iter().copied().flatten() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary `if let` since only the `Some` variant of the iterator element is used --> tests/ui/manual_flatten.rs:93:5 | -LL | for n in slice_of_ref { - | ^ ------------ help: try: `slice_of_ref.iter().copied().flatten()` - | _____| - | | +LL | / for n in slice_of_ref { LL | | LL | | if let Some(n) = n { LL | | println!("{:?}", n); @@ -175,6 +179,10 @@ LL | / if let Some(n) = n { LL | | println!("{:?}", n); LL | | } | |_________^ +help: try + | +LL | for n in slice_of_ref.iter().copied().flatten() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary `if let` since only the `Some` variant of the iterator element is used --> tests/ui/manual_flatten.rs:124:5 diff --git a/src/tools/clippy/tests/ui/manual_float_methods.stderr b/src/tools/clippy/tests/ui/manual_float_methods.stderr index 70057620a4a82..59b198ecca634 100644 --- a/src/tools/clippy/tests/ui/manual_float_methods.stderr +++ b/src/tools/clippy/tests/ui/manual_float_methods.stderr @@ -2,10 +2,14 @@ error: manually checking if a float is infinite --> tests/ui/manual_float_methods.rs:24:8 | LL | if x == f32::INFINITY || x == f32::NEG_INFINITY {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the dedicated method instead: `x.is_infinite()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-is-infinite` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_is_infinite)]` +help: use the dedicated method instead + | +LL | if x.is_infinite() {} + | ~~~~~~~~~~~~~~~ error: manually checking if a float is finite --> tests/ui/manual_float_methods.rs:25:8 @@ -32,7 +36,12 @@ error: manually checking if a float is infinite --> tests/ui/manual_float_methods.rs:26:8 | LL | if x == INFINITE || x == NEG_INFINITE {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the dedicated method instead: `x.is_infinite()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the dedicated method instead + | +LL | if x.is_infinite() {} + | ~~~~~~~~~~~~~~~ error: manually checking if a float is finite --> tests/ui/manual_float_methods.rs:27:8 @@ -57,7 +66,12 @@ error: manually checking if a float is infinite --> tests/ui/manual_float_methods.rs:29:8 | LL | if x == f64::INFINITY || x == f64::NEG_INFINITY {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the dedicated method instead: `x.is_infinite()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the dedicated method instead + | +LL | if x.is_infinite() {} + | ~~~~~~~~~~~~~~~ error: manually checking if a float is finite --> tests/ui/manual_float_methods.rs:30:8 diff --git a/src/tools/clippy/tests/ui/manual_instant_elapsed.stderr b/src/tools/clippy/tests/ui/manual_instant_elapsed.stderr index e8ffeb5f8ca3e..25ab5f179ed22 100644 --- a/src/tools/clippy/tests/ui/manual_instant_elapsed.stderr +++ b/src/tools/clippy/tests/ui/manual_instant_elapsed.stderr @@ -2,16 +2,25 @@ error: manual implementation of `Instant::elapsed` --> tests/ui/manual_instant_elapsed.rs:17:20 | LL | let duration = Instant::now() - prev_instant; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `prev_instant.elapsed()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-instant-elapsed` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_instant_elapsed)]` +help: try + | +LL | let duration = prev_instant.elapsed(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Instant::elapsed` --> tests/ui/manual_instant_elapsed.rs:26:5 | LL | Instant::now() - *ref_to_instant; // to ensure parens are added correctly - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(*ref_to_instant).elapsed()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | (*ref_to_instant).elapsed(); // to ensure parens are added correctly + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/manual_is_ascii_check.stderr b/src/tools/clippy/tests/ui/manual_is_ascii_check.stderr index a93ccace28a6e..13a6a126bbf6d 100644 --- a/src/tools/clippy/tests/ui/manual_is_ascii_check.stderr +++ b/src/tools/clippy/tests/ui/manual_is_ascii_check.stderr @@ -2,148 +2,267 @@ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:5:13 | LL | assert!(matches!('x', 'a'..='z')); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'x'.is_ascii_lowercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-is-ascii-check` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_is_ascii_check)]` +help: try + | +LL | assert!('x'.is_ascii_lowercase()); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:6:13 | LL | assert!(matches!('X', 'A'..='Z')); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'X'.is_ascii_uppercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!('X'.is_ascii_uppercase()); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:7:13 | LL | assert!(matches!(b'x', b'a'..=b'z')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'x'.is_ascii_lowercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!(b'x'.is_ascii_lowercase()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:8:13 | LL | assert!(matches!(b'X', b'A'..=b'Z')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'X'.is_ascii_uppercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!(b'X'.is_ascii_uppercase()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:11:13 | LL | assert!(matches!(num, '0'..='9')); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.is_ascii_digit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!(num.is_ascii_digit()); + | ~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:12:13 | LL | assert!(matches!(b'1', b'0'..=b'9')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'1'.is_ascii_digit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!(b'1'.is_ascii_digit()); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:13:13 | LL | assert!(matches!('x', 'A'..='Z' | 'a'..='z')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'x'.is_ascii_alphabetic()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!('x'.is_ascii_alphabetic()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:17:5 | LL | (b'0'..=b'9').contains(&b'0'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'0'.is_ascii_digit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | b'0'.is_ascii_digit(); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:18:5 | LL | (b'a'..=b'z').contains(&b'a'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'a'.is_ascii_lowercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | b'a'.is_ascii_lowercase(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:19:5 | LL | (b'A'..=b'Z').contains(&b'A'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'A'.is_ascii_uppercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | b'A'.is_ascii_uppercase(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:21:5 | LL | ('0'..='9').contains(&'0'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'0'.is_ascii_digit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | '0'.is_ascii_digit(); + | ~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:22:5 | LL | ('a'..='z').contains(&'a'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'a'.is_ascii_lowercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 'a'.is_ascii_lowercase(); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:23:5 | LL | ('A'..='Z').contains(&'A'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'A'.is_ascii_uppercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 'A'.is_ascii_uppercase(); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:26:5 | LL | ('0'..='9').contains(cool_letter); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cool_letter.is_ascii_digit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | cool_letter.is_ascii_digit(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:27:5 | LL | ('a'..='z').contains(cool_letter); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cool_letter.is_ascii_lowercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | cool_letter.is_ascii_lowercase(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:28:5 | LL | ('A'..='Z').contains(cool_letter); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cool_letter.is_ascii_uppercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | cool_letter.is_ascii_uppercase(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:41:13 | LL | assert!(matches!(b'1', b'0'..=b'9')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'1'.is_ascii_digit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!(b'1'.is_ascii_digit()); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:42:13 | LL | assert!(matches!('X', 'A'..='Z')); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'X'.is_ascii_uppercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!('X'.is_ascii_uppercase()); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:43:13 | LL | assert!(matches!('x', 'A'..='Z' | 'a'..='z')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'x'.is_ascii_alphabetic()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!('x'.is_ascii_alphabetic()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:44:13 | LL | assert!(matches!('x', '0'..='9' | 'a'..='f' | 'A'..='F')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'x'.is_ascii_hexdigit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert!('x'.is_ascii_hexdigit()); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:55:23 | LL | const FOO: bool = matches!('x', '0'..='9'); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'x'.is_ascii_digit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | const FOO: bool = 'x'.is_ascii_digit(); + | ~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:56:23 | LL | const BAR: bool = matches!('x', '0'..='9' | 'a'..='f' | 'A'..='F'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'x'.is_ascii_hexdigit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | const BAR: bool = 'x'.is_ascii_hexdigit(); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:62:5 | LL | ('0'..='9').contains(&&cool_letter); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cool_letter.is_ascii_digit()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | cool_letter.is_ascii_digit(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:63:5 | LL | ('a'..='z').contains(*cool_letter); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cool_letter.is_ascii_lowercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | cool_letter.is_ascii_lowercase(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:81:20 @@ -171,7 +290,12 @@ error: manual check for common ascii range --> tests/ui/manual_is_ascii_check.rs:83:26 | LL | take_while(|c: char| ('A'..='Z').contains(&c)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `c.is_ascii_uppercase()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | take_while(|c: char| c.is_ascii_uppercase()); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 27 previous errors diff --git a/src/tools/clippy/tests/ui/manual_is_variant_and.stderr b/src/tools/clippy/tests/ui/manual_is_variant_and.stderr index d3ff7cf8b316a..c78a6d2ab565a 100644 --- a/src/tools/clippy/tests/ui/manual_is_variant_and.stderr +++ b/src/tools/clippy/tests/ui/manual_is_variant_and.stderr @@ -5,10 +5,14 @@ LL | let _ = opt.map(|x| x > 1) | _________________^ LL | | // Should lint even though this call is on a separate line. LL | | .unwrap_or_default(); - | |____________________________^ help: use: `is_some_and(|x| x > 1)` + | |____________________________^ | = note: `-D clippy::manual-is-variant-and` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_is_variant_and)]` +help: use + | +LL | let _ = opt.is_some_and(|x| x > 1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `map().unwrap_or_default()` on an `Option` value --> tests/ui/manual_is_variant_and.rs:17:17 @@ -31,7 +35,12 @@ error: called `map().unwrap_or_default()` on an `Option` value --> tests/ui/manual_is_variant_and.rs:21:17 | LL | let _ = opt.map(|x| x > 1).unwrap_or_default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `is_some_and(|x| x > 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = opt.is_some_and(|x| x > 1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `map().unwrap_or_default()` on an `Option` value --> tests/ui/manual_is_variant_and.rs:23:10 @@ -39,13 +48,23 @@ error: called `map().unwrap_or_default()` on an `Option` value LL | .map(|x| x > 1) | __________^ LL | | .unwrap_or_default(); - | |____________________________^ help: use: `is_some_and(|x| x > 1)` + | |____________________________^ + | +help: use + | +LL | .is_some_and(|x| x > 1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `map().unwrap_or_default()` on an `Option` value --> tests/ui/manual_is_variant_and.rs:30:18 | LL | let _ = opt2.map(char::is_alphanumeric).unwrap_or_default(); // should lint - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `is_some_and(char::is_alphanumeric)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = opt2.is_some_and(char::is_alphanumeric); // should lint + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `map().unwrap_or_default()` on a `Result` value --> tests/ui/manual_is_variant_and.rs:39:17 @@ -70,13 +89,23 @@ error: called `map().unwrap_or_default()` on a `Result` value LL | let _ = res.map(|x| x > 1) | _________________^ LL | | .unwrap_or_default(); - | |____________________________^ help: use: `is_ok_and(|x| x > 1)` + | |____________________________^ + | +help: use + | +LL | let _ = res.is_ok_and(|x| x > 1); + | ~~~~~~~~~~~~~~~~~~~~ error: called `map().unwrap_or_default()` on a `Result` value --> tests/ui/manual_is_variant_and.rs:50:18 | LL | let _ = res2.map(char::is_alphanumeric).unwrap_or_default(); // should lint - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `is_ok_and(char::is_alphanumeric)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = res2.is_ok_and(char::is_alphanumeric); // should lint + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/manual_let_else.stderr b/src/tools/clippy/tests/ui/manual_let_else.stderr index 55a410982adfd..091e6382934bd 100644 --- a/src/tools/clippy/tests/ui/manual_let_else.stderr +++ b/src/tools/clippy/tests/ui/manual_let_else.stderr @@ -2,10 +2,14 @@ error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:29:5 | LL | let v = if let Some(v_some) = g() { v_some } else { return }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { return };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-let-else` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_let_else)]` +help: consider writing + | +LL | let Some(v) = g() else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:32:5 @@ -50,19 +54,34 @@ error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:51:9 | LL | let v = if let Some(v_some) = g() { v_some } else { continue }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { continue };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let Some(v) = g() else { continue }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:53:9 | LL | let v = if let Some(v_some) = g() { v_some } else { break }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { break };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let Some(v) = g() else { break }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:58:5 | LL | let v = if let Some(v_some) = g() { v_some } else { panic!() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { panic!() };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let Some(v) = g() else { panic!() }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:62:5 @@ -367,24 +386,38 @@ error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:214:13 | LL | let $n = if let Some(v) = $e { v } else { return }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some($n) = g() else { return };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | create_binding_if_some!(w, g()); | ------------------------------- in this macro invocation | = note: this error originates in the macro `create_binding_if_some` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider writing + | +LL | let Some($n) = g() else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:223:5 | LL | let v = if let Variant::A(a, 0) = e() { a } else { return }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::A(v, 0) = e() else { return };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let Variant::A(v, 0) = e() else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:227:5 | LL | let mut v = if let Variant::B(b) = e() { b } else { return }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::B(mut v) = e() else { return };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let Variant::B(mut v) = e() else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:232:5 @@ -408,13 +441,23 @@ error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:239:5 | LL | let v = if let Variant::A(.., a) = e() { a } else { return }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::A(.., v) = e() else { return };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let Variant::A(.., v) = e() else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:243:5 | LL | let w = if let (Some(v), ()) = (g(), ()) { v } else { return }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let (Some(w), ()) = (g(), ()) else { return };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let (Some(w), ()) = (g(), ()) else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:247:5 @@ -478,13 +521,23 @@ LL | | LL | | Some(value) => value, LL | | _ => macro_call!(), LL | | }; - | |______^ help: consider writing: `let Some(_) = ff else { macro_call!() };` + | |______^ + | +help: consider writing + | +LL | let Some(_) = ff else { macro_call!() }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else.rs:457:9 | LL | let v = if let Some(v_some) = g() { v_some } else { return }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { return };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let Some(v) = g() else { return }; + | error: aborting due to 31 previous errors diff --git a/src/tools/clippy/tests/ui/manual_let_else_match.stderr b/src/tools/clippy/tests/ui/manual_let_else_match.stderr index 3c0065f64033f..93a1866c46959 100644 --- a/src/tools/clippy/tests/ui/manual_let_else_match.stderr +++ b/src/tools/clippy/tests/ui/manual_let_else_match.stderr @@ -7,10 +7,14 @@ LL | | LL | | Some(v_some) => v_some, LL | | None => return, LL | | }; - | |______^ help: consider writing: `let Some(v) = g() else { return };` + | |______^ | = note: `-D clippy::manual-let-else` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_let_else)]` +help: consider writing + | +LL | let Some(v) = g() else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_match.rs:43:5 @@ -20,7 +24,12 @@ LL | | LL | | Some(v_some) => v_some, LL | | _ => return, LL | | }; - | |______^ help: consider writing: `let Some(v) = g() else { return };` + | |______^ + | +help: consider writing + | +LL | let Some(v) = g() else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_match.rs:51:9 @@ -30,7 +39,12 @@ LL | | LL | | (Some(v), None) | (None, Some(v)) => v, LL | | (Some(_), Some(_)) | (None, None) => continue, LL | | }; - | |__________^ help: consider writing: `let ((Some(v), None) | (None, Some(v))) = h() else { continue };` + | |__________^ + | +help: consider writing + | +LL | let ((Some(v), None) | (None, Some(v))) = h() else { continue }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_match.rs:57:9 @@ -40,7 +54,12 @@ LL | | LL | | Variant::Bar(v) | Variant::Baz(v) => v, LL | | _ => continue, LL | | }; - | |__________^ help: consider writing: `let (Variant::Bar(v) | Variant::Baz(v)) = build_enum() else { continue };` + | |__________^ + | +help: consider writing + | +LL | let (Variant::Bar(v) | Variant::Baz(v)) = build_enum() else { continue }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_match.rs:66:5 @@ -50,7 +69,12 @@ LL | | LL | | Ok(v) => v, LL | | Err(_) => return, LL | | }; - | |______^ help: consider writing: `let Ok(v) = f() else { return };` + | |______^ + | +help: consider writing + | +LL | let Ok(v) = f() else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_match.rs:73:5 @@ -60,7 +84,12 @@ LL | | LL | | Ok(v) => v, LL | | Err(()) => return, LL | | }; - | |______^ help: consider writing: `let Ok(v) = f().map_err(|_| ()) else { return };` + | |______^ + | +help: consider writing + | +LL | let Ok(v) = f().map_err(|_| ()) else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_match.rs:81:5 @@ -70,7 +99,12 @@ LL | | LL | | Variant::Bar(v) | Variant::Baz(v) => v, LL | | _ => return, LL | | }; - | |______^ help: consider writing: `let (Variant::Bar(_value) | Variant::Baz(_value)) = f else { return };` + | |______^ + | +help: consider writing + | +LL | let (Variant::Bar(_value) | Variant::Baz(_value)) = f else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_match.rs:87:5 @@ -80,7 +114,12 @@ LL | | LL | | Some(Variant::Bar(v) | Variant::Baz(v)) => v, LL | | _ => return, LL | | }; - | |______^ help: consider writing: `let Some(Variant::Bar(_value) | Variant::Baz(_value)) = Some(build_enum()) else { return };` + | |______^ + | +help: consider writing + | +LL | let Some(Variant::Bar(_value) | Variant::Baz(_value)) = Some(build_enum()) else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_match.rs:94:5 @@ -90,7 +129,12 @@ LL | | LL | | [data @ .., 0, 0, 0, 0] | [data @ .., 0, 0] | [data @ .., 0] => data, LL | | _ => return, LL | | }; - | |______^ help: consider writing: `let ([data @ .., 0, 0, 0, 0] | [data @ .., 0, 0] | [data @ .., 0]) = data.as_slice() else { return };` + | |______^ + | +help: consider writing + | +LL | let ([data @ .., 0, 0, 0, 0] | [data @ .., 0, 0] | [data @ .., 0]) = data.as_slice() else { return }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_match.rs:175:5 @@ -100,7 +144,12 @@ LL | | LL | | Some(m) => m, LL | | _ => unreachable!("can't happen"), LL | | }; - | |______^ help: consider writing: `let Some(msg) = Some("hi") else { unreachable!("can't happen") };` + | |______^ + | +help: consider writing + | +LL | let Some(msg) = Some("hi") else { unreachable!("can't happen") }; + | error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/manual_let_else_question_mark.stderr b/src/tools/clippy/tests/ui/manual_let_else_question_mark.stderr index 434872ca26777..19663802dfb6e 100644 --- a/src/tools/clippy/tests/ui/manual_let_else_question_mark.stderr +++ b/src/tools/clippy/tests/ui/manual_let_else_question_mark.stderr @@ -2,22 +2,36 @@ error: this `let...else` may be rewritten with the `?` operator --> tests/ui/manual_let_else_question_mark.rs:29:5 | LL | let Some(v) = g() else { return None }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `let v = g()?;` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::question-mark` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::question_mark)]` +help: replace it with + | +LL | let v = g()?; + | error: this `let...else` may be rewritten with the `?` operator --> tests/ui/manual_let_else_question_mark.rs:35:5 | LL | let Some((v, w)) = g() else { return None }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `let (v, w) = g()?;` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let (v, w) = g()?; + | error: this block may be rewritten with the `?` operator --> tests/ui/manual_let_else_question_mark.rs:38:13 | LL | let v = if let Some(v_some) = g() { v_some } else { return None }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `g()?` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let v = g()?; + | ~~~~ error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_question_mark.rs:42:5 @@ -45,13 +59,23 @@ LL | / let v = match g() { LL | | Some(v_some) => v_some, LL | | _ => return None, LL | | }; - | |__________^ help: consider writing: `let Some(v) = g() else { return None };` + | |__________^ + | +help: consider writing + | +LL | let Some(v) = g() else { return None }; + | error: this could be rewritten as `let...else` --> tests/ui/manual_let_else_question_mark.rs:63:9 | LL | let v = if let Some(v_some) = g() { v_some } else { return None }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { return None };` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider writing + | +LL | let Some(v) = g() else { return None }; + | error: this `let...else` may be rewritten with the `?` operator --> tests/ui/manual_let_else_question_mark.rs:71:5 @@ -59,7 +83,12 @@ error: this `let...else` may be rewritten with the `?` operator LL | / let Some(x) = y else { LL | | return None; LL | | }; - | |______^ help: replace it with: `let x = y?;` + | |______^ + | +help: replace it with + | +LL | let x = y?; + | error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/manual_main_separator_str.stderr b/src/tools/clippy/tests/ui/manual_main_separator_str.stderr index 78395eb7d6648..5c36e7147be45 100644 --- a/src/tools/clippy/tests/ui/manual_main_separator_str.stderr +++ b/src/tools/clippy/tests/ui/manual_main_separator_str.stderr @@ -2,28 +2,47 @@ error: taking a reference on `std::path::MAIN_SEPARATOR` conversion to `String` --> tests/ui/manual_main_separator_str.rs:21:19 | LL | let _: &str = &MAIN_SEPARATOR.to_string(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `std::path::MAIN_SEPARATOR_STR` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-main-separator-str` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_main_separator_str)]` +help: replace with + | +LL | let _: &str = std::path::MAIN_SEPARATOR_STR; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: taking a reference on `std::path::MAIN_SEPARATOR` conversion to `String` --> tests/ui/manual_main_separator_str.rs:22:17 | LL | let _ = len(&MAIN_SEPARATOR.to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `std::path::MAIN_SEPARATOR_STR` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = len(std::path::MAIN_SEPARATOR_STR); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: taking a reference on `std::path::MAIN_SEPARATOR` conversion to `String` --> tests/ui/manual_main_separator_str.rs:23:23 | LL | let _: Vec = MAIN_SEPARATOR.to_string().encode_utf16().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `std::path::MAIN_SEPARATOR_STR` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _: Vec = std::path::MAIN_SEPARATOR_STR.encode_utf16().collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: taking a reference on `std::path::MAIN_SEPARATOR` conversion to `String` --> tests/ui/manual_main_separator_str.rs:27:12 | LL | f: &MAIN_SEPARATOR.to_string(), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `std::path::MAIN_SEPARATOR_STR` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | f: std::path::MAIN_SEPARATOR_STR, + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/manual_map_option.stderr b/src/tools/clippy/tests/ui/manual_map_option.stderr index 47cc18303ba57..116a00894b2dd 100644 --- a/src/tools/clippy/tests/ui/manual_map_option.stderr +++ b/src/tools/clippy/tests/ui/manual_map_option.stderr @@ -5,10 +5,14 @@ LL | / match Some(0) { LL | | Some(_) => Some(2), LL | | None:: => None, LL | | }; - | |_____^ help: try: `Some(0).map(|_| 2)` + | |_____^ | = note: `-D clippy::manual-map` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_map)]` +help: try + | +LL | Some(0).map(|_| 2); + | ~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:19:5 @@ -17,7 +21,12 @@ LL | / match Some(0) { LL | | Some(x) => Some(x + 1), LL | | _ => None, LL | | }; - | |_____^ help: try: `Some(0).map(|x| x + 1)` + | |_____^ + | +help: try + | +LL | Some(0).map(|x| x + 1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:24:5 @@ -26,7 +35,12 @@ LL | / match Some("") { LL | | Some(x) => Some(x.is_empty()), LL | | None => None, LL | | }; - | |_____^ help: try: `Some("").map(|x| x.is_empty())` + | |_____^ + | +help: try + | +LL | Some("").map(|x| x.is_empty()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:29:5 @@ -36,7 +50,12 @@ LL | | Some(!x) LL | | } else { LL | | None LL | | }; - | |_____^ help: try: `Some(0).map(|x| !x)` + | |_____^ + | +help: try + | +LL | Some(0).map(|x| !x); + | ~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:36:5 @@ -45,7 +64,12 @@ LL | / match Some(0) { LL | | Some(x) => { Some(std::convert::identity(x)) } LL | | None => { None } LL | | }; - | |_____^ help: try: `Some(0).map(std::convert::identity)` + | |_____^ + | +help: try + | +LL | Some(0).map(std::convert::identity); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:41:5 @@ -54,7 +78,12 @@ LL | / match Some(&String::new()) { LL | | Some(x) => Some(str::len(x)), LL | | None => None, LL | | }; - | |_____^ help: try: `Some(&String::new()).map(|x| str::len(x))` + | |_____^ + | +help: try + | +LL | Some(&String::new()).map(|x| str::len(x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:51:5 @@ -63,7 +92,12 @@ LL | / match &Some([0, 1]) { LL | | Some(x) => Some(x[0]), LL | | &None => None, LL | | }; - | |_____^ help: try: `Some([0, 1]).as_ref().map(|x| x[0])` + | |_____^ + | +help: try + | +LL | Some([0, 1]).as_ref().map(|x| x[0]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:56:5 @@ -72,7 +106,12 @@ LL | / match &Some(0) { LL | | &Some(x) => Some(x * 2), LL | | None => None, LL | | }; - | |_____^ help: try: `Some(0).map(|x| x * 2)` + | |_____^ + | +help: try + | +LL | Some(0).map(|x| x * 2); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:61:5 @@ -81,7 +120,12 @@ LL | / match Some(String::new()) { LL | | Some(ref x) => Some(x.is_empty()), LL | | _ => None, LL | | }; - | |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.is_empty())` + | |_____^ + | +help: try + | +LL | Some(String::new()).as_ref().map(|x| x.is_empty()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:66:5 @@ -90,7 +134,12 @@ LL | / match &&Some(String::new()) { LL | | Some(x) => Some(x.len()), LL | | _ => None, LL | | }; - | |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.len())` + | |_____^ + | +help: try + | +LL | Some(String::new()).as_ref().map(|x| x.len()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:71:5 @@ -99,7 +148,12 @@ LL | / match &&Some(0) { LL | | &&Some(x) => Some(x + x), LL | | &&_ => None, LL | | }; - | |_____^ help: try: `Some(0).map(|x| x + x)` + | |_____^ + | +help: try + | +LL | Some(0).map(|x| x + x); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:84:9 @@ -108,7 +162,12 @@ LL | / match &mut Some(String::new()) { LL | | Some(x) => Some(x.push_str("")), LL | | None => None, LL | | }; - | |_________^ help: try: `Some(String::new()).as_mut().map(|x| x.push_str(""))` + | |_________^ + | +help: try + | +LL | Some(String::new()).as_mut().map(|x| x.push_str("")); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:90:5 @@ -117,7 +176,12 @@ LL | / match &mut Some(String::new()) { LL | | Some(ref x) => Some(x.len()), LL | | None => None, LL | | }; - | |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.len())` + | |_____^ + | +help: try + | +LL | Some(String::new()).as_ref().map(|x| x.len()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:95:5 @@ -126,7 +190,12 @@ LL | / match &mut &Some(String::new()) { LL | | Some(x) => Some(x.is_empty()), LL | | &mut _ => None, LL | | }; - | |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.is_empty())` + | |_____^ + | +help: try + | +LL | Some(String::new()).as_ref().map(|x| x.is_empty()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:100:5 @@ -135,7 +204,12 @@ LL | / match Some((0, 1, 2)) { LL | | Some((x, y, z)) => Some(x + y + z), LL | | None => None, LL | | }; - | |_____^ help: try: `Some((0, 1, 2)).map(|(x, y, z)| x + y + z)` + | |_____^ + | +help: try + | +LL | Some((0, 1, 2)).map(|(x, y, z)| x + y + z); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:105:5 @@ -144,7 +218,12 @@ LL | / match Some([1, 2, 3]) { LL | | Some([first, ..]) => Some(first), LL | | None => None, LL | | }; - | |_____^ help: try: `Some([1, 2, 3]).map(|[first, ..]| first)` + | |_____^ + | +help: try + | +LL | Some([1, 2, 3]).map(|[first, ..]| first); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:110:5 @@ -153,7 +232,12 @@ LL | / match &Some((String::new(), "test")) { LL | | Some((x, y)) => Some((y, x)), LL | | None => None, LL | | }; - | |_____^ help: try: `Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x))` + | |_____^ + | +help: try + | +LL | Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:168:5 @@ -162,7 +246,12 @@ LL | / match Some(0) { LL | | Some(x) => Some(vec![x]), LL | | None => None, LL | | }; - | |_____^ help: try: `Some(0).map(|x| vec![x])` + | |_____^ + | +help: try + | +LL | Some(0).map(|x| vec![x]); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:173:5 @@ -171,7 +260,12 @@ LL | / match option_env!("") { LL | | Some(x) => Some(String::from(x)), LL | | None => None, LL | | }; - | |_____^ help: try: `option_env!("").map(String::from)` + | |_____^ + | +help: try + | +LL | option_env!("").map(String::from); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:193:12 @@ -182,7 +276,12 @@ LL | | Some(x + 1) LL | | } else { LL | | None LL | | }; - | |_____^ help: try: `{ Some(0).map(|x| x + 1) }` + | |_____^ + | +help: try + | +LL | } else { Some(0).map(|x| x + 1) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option.rs:201:12 @@ -193,7 +292,12 @@ LL | | Some(x + 1) LL | | } else { LL | | None LL | | }; - | |_____^ help: try: `{ Some(0).map(|x| x + 1) }` + | |_____^ + | +help: try + | +LL | } else { Some(0).map(|x| x + 1) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 21 previous errors diff --git a/src/tools/clippy/tests/ui/manual_map_option_2.stderr b/src/tools/clippy/tests/ui/manual_map_option_2.stderr index 78e4677544bc8..d196ffd3a1d3d 100644 --- a/src/tools/clippy/tests/ui/manual_map_option_2.stderr +++ b/src/tools/clippy/tests/ui/manual_map_option_2.stderr @@ -29,7 +29,12 @@ LL | let _ = match &s { LL | | Some(x) => Some({ if let Some(ref s) = s { (x.clone(), s) } else { panic!() } }), LL | | None => None, LL | | }; - | |_____^ help: try: `s.as_ref().map(|x| { if let Some(ref s) = s { (x.clone(), s) } else { panic!() } })` + | |_____^ + | +help: try + | +LL | let _ = s.as_ref().map(|x| { if let Some(ref s) = s { (x.clone(), s) } else { panic!() } }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option_2.rs:58:17 @@ -39,7 +44,12 @@ LL | let _ = match Some(0) { LL | | Some(x) => Some(f(x)), LL | | None => None, LL | | }; - | |_________^ help: try: `Some(0).map(|x| f(x))` + | |_________^ + | +help: try + | +LL | let _ = Some(0).map(|x| f(x)); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option_2.rs:63:13 @@ -49,7 +59,12 @@ LL | let _ = match Some(0) { LL | | Some(x) => unsafe { Some(f(x)) }, LL | | None => None, LL | | }; - | |_____^ help: try: `Some(0).map(|x| unsafe { f(x) })` + | |_____^ + | +help: try + | +LL | let _ = Some(0).map(|x| unsafe { f(x) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `Option::map` --> tests/ui/manual_map_option_2.rs:67:13 @@ -59,7 +74,12 @@ LL | let _ = match Some(0) { LL | | Some(x) => Some(unsafe { f(x) }), LL | | None => None, LL | | }; - | |_____^ help: try: `Some(0).map(|x| unsafe { f(x) })` + | |_____^ + | +help: try + | +LL | let _ = Some(0).map(|x| unsafe { f(x) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/manual_memcpy/with_loop_counters.stderr b/src/tools/clippy/tests/ui/manual_memcpy/with_loop_counters.stderr index 41a991e9688f5..2420a64a6d124 100644 --- a/src/tools/clippy/tests/ui/manual_memcpy/with_loop_counters.stderr +++ b/src/tools/clippy/tests/ui/manual_memcpy/with_loop_counters.stderr @@ -7,10 +7,14 @@ LL | | LL | | dst[i] = src[count]; LL | | count += 1; LL | | } - | |_____^ help: try replacing the loop by: `dst[3..src.len()].copy_from_slice(&src[..(src.len() - 3)]);` + | |_____^ | = note: `-D clippy::manual-memcpy` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_memcpy)]` +help: try replacing the loop by + | +LL | dst[3..src.len()].copy_from_slice(&src[..(src.len() - 3)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/with_loop_counters.rs:13:5 @@ -20,7 +24,12 @@ LL | | LL | | dst[count] = src[i]; LL | | count += 1; LL | | } - | |_____^ help: try replacing the loop by: `dst[..(src.len() - 3)].copy_from_slice(&src[3..]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[..(src.len() - 3)].copy_from_slice(&src[3..]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/with_loop_counters.rs:20:5 @@ -30,7 +39,12 @@ LL | | LL | | dst[count] = src[i]; LL | | count += 1; LL | | } - | |_____^ help: try replacing the loop by: `dst[3..(src.len() + 3)].copy_from_slice(&src[..]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[3..(src.len() + 3)].copy_from_slice(&src[..]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/with_loop_counters.rs:27:5 @@ -40,7 +54,12 @@ LL | | LL | | dst[i] = src[count]; LL | | count += 1; LL | | } - | |_____^ help: try replacing the loop by: `dst[..src.len()].copy_from_slice(&src[3..(src.len() + 3)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[..src.len()].copy_from_slice(&src[3..(src.len() + 3)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/with_loop_counters.rs:34:5 @@ -50,7 +69,12 @@ LL | | LL | | dst[i] = src[count]; LL | | count += 1; LL | | } - | |_____^ help: try replacing the loop by: `dst[3..(3 + src.len())].copy_from_slice(&src[..(3 + src.len() - 3)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[3..(3 + src.len())].copy_from_slice(&src[..(3 + src.len() - 3)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/with_loop_counters.rs:41:5 @@ -60,7 +84,12 @@ LL | | LL | | dst[i] = src[count - 2]; LL | | count += 1; LL | | } - | |_____^ help: try replacing the loop by: `dst[5..src.len()].copy_from_slice(&src[(3 - 2)..((src.len() - 2) + 3 - 5)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[5..src.len()].copy_from_slice(&src[(3 - 2)..((src.len() - 2) + 3 - 5)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/with_loop_counters.rs:48:5 @@ -70,7 +99,12 @@ LL | | LL | | dst[i] = src[count]; LL | | count += 1; LL | | } - | |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[2..(dst.len() + 2)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst.copy_from_slice(&src[2..(dst.len() + 2)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/with_loop_counters.rs:55:5 @@ -80,7 +114,12 @@ LL | | LL | | dst[i] = src[count]; LL | | count += 1; LL | | } - | |_____^ help: try replacing the loop by: `dst[3..10].copy_from_slice(&src[5..(10 + 5 - 3)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[3..10].copy_from_slice(&src[5..(10 + 5 - 3)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/with_loop_counters.rs:63:5 @@ -108,7 +147,12 @@ LL | | LL | | dst[count] = src[i + 2]; LL | | count += 1; LL | | } - | |_____^ help: try replacing the loop by: `dst[(0 << 1)..((1 << 1) + (0 << 1))].copy_from_slice(&src[2..((1 << 1) + 2)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[(0 << 1)..((1 << 1) + (0 << 1))].copy_from_slice(&src[2..((1 << 1) + 2)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/with_loop_counters.rs:82:5 @@ -118,7 +162,12 @@ LL | | LL | | dst[i] = src[count]; LL | | count += 1 LL | | } - | |_____^ help: try replacing the loop by: `dst[3..src.len()].copy_from_slice(&src[..(src.len() - 3)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[3..src.len()].copy_from_slice(&src[..(src.len() - 3)]); + | error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/manual_memcpy/without_loop_counters.stderr b/src/tools/clippy/tests/ui/manual_memcpy/without_loop_counters.stderr index 803053b2db2ef..39bd93008d7ac 100644 --- a/src/tools/clippy/tests/ui/manual_memcpy/without_loop_counters.stderr +++ b/src/tools/clippy/tests/ui/manual_memcpy/without_loop_counters.stderr @@ -6,10 +6,14 @@ LL | | LL | | LL | | dst[i] = src[i]; LL | | } - | |_____^ help: try replacing the loop by: `dst[..src.len()].copy_from_slice(&src[..]);` + | |_____^ | = note: `-D clippy::manual-memcpy` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_memcpy)]` +help: try replacing the loop by + | +LL | dst[..src.len()].copy_from_slice(&src[..]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:16:5 @@ -18,7 +22,12 @@ LL | / for i in 0..src.len() { LL | | LL | | dst[i + 10] = src[i]; LL | | } - | |_____^ help: try replacing the loop by: `dst[10..(src.len() + 10)].copy_from_slice(&src[..]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[10..(src.len() + 10)].copy_from_slice(&src[..]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:22:5 @@ -27,7 +36,12 @@ LL | / for i in 0..src.len() { LL | | LL | | dst[i] = src[i + 10]; LL | | } - | |_____^ help: try replacing the loop by: `dst[..src.len()].copy_from_slice(&src[10..(src.len() + 10)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[..src.len()].copy_from_slice(&src[10..(src.len() + 10)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:28:5 @@ -36,7 +50,12 @@ LL | / for i in 11..src.len() { LL | | LL | | dst[i] = src[i - 10]; LL | | } - | |_____^ help: try replacing the loop by: `dst[11..src.len()].copy_from_slice(&src[(11 - 10)..(src.len() - 10)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[11..src.len()].copy_from_slice(&src[(11 - 10)..(src.len() - 10)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:34:5 @@ -45,7 +64,12 @@ LL | / for i in 0..dst.len() { LL | | LL | | dst[i] = src[i]; LL | | } - | |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[..dst.len()]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst.copy_from_slice(&src[..dst.len()]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:48:5 @@ -70,7 +94,12 @@ LL | / for i in 10..LOOP_OFFSET { LL | | LL | | dst[i + LOOP_OFFSET] = src[i - some_var]; LL | | } - | |_____^ help: try replacing the loop by: `dst[(10 + LOOP_OFFSET)..(LOOP_OFFSET + LOOP_OFFSET)].copy_from_slice(&src[(10 - some_var)..(LOOP_OFFSET - some_var)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[(10 + LOOP_OFFSET)..(LOOP_OFFSET + LOOP_OFFSET)].copy_from_slice(&src[(10 - some_var)..(LOOP_OFFSET - some_var)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:75:5 @@ -79,7 +108,12 @@ LL | / for i in 0..src_vec.len() { LL | | LL | | dst_vec[i] = src_vec[i]; LL | | } - | |_____^ help: try replacing the loop by: `dst_vec[..src_vec.len()].copy_from_slice(&src_vec[..]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst_vec[..src_vec.len()].copy_from_slice(&src_vec[..]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:105:5 @@ -88,7 +122,12 @@ LL | / for i in from..from + src.len() { LL | | LL | | dst[i] = src[i - from]; LL | | } - | |_____^ help: try replacing the loop by: `dst[from..(from + src.len())].copy_from_slice(&src[..(from + src.len() - from)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[from..(from + src.len())].copy_from_slice(&src[..(from + src.len() - from)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:110:5 @@ -97,7 +136,12 @@ LL | / for i in from..from + 3 { LL | | LL | | dst[i] = src[i - from]; LL | | } - | |_____^ help: try replacing the loop by: `dst[from..(from + 3)].copy_from_slice(&src[..(from + 3 - from)]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[from..(from + 3)].copy_from_slice(&src[..(from + 3 - from)]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:116:5 @@ -106,7 +150,12 @@ LL | / for i in 0..5 { LL | | LL | | dst[i - 0] = src[i]; LL | | } - | |_____^ help: try replacing the loop by: `dst[..5].copy_from_slice(&src);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[..5].copy_from_slice(&src); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:122:5 @@ -115,7 +164,12 @@ LL | / for i in 0..0 { LL | | LL | | dst[i] = src[i]; LL | | } - | |_____^ help: try replacing the loop by: `dst[..0].copy_from_slice(&src[..0]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[..0].copy_from_slice(&src[..0]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:146:5 @@ -124,7 +178,12 @@ LL | / for i in 0..4 { LL | | LL | | dst[i] = src[i]; LL | | } - | |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[..4]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst.copy_from_slice(&src[..4]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:152:5 @@ -133,7 +192,12 @@ LL | / for i in 0..5 { LL | | LL | | dst[i] = src[i]; LL | | } - | |_____^ help: try replacing the loop by: `dst[..5].copy_from_slice(&src);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[..5].copy_from_slice(&src); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:158:5 @@ -142,7 +206,12 @@ LL | / for i in 0..5 { LL | | LL | | dst[i] = src[i]; LL | | } - | |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst.copy_from_slice(&src); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:205:5 @@ -151,7 +220,12 @@ LL | / for i in 0..5 { LL | | LL | | dst[i] = src[0][i]; LL | | } - | |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[0]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst.copy_from_slice(&src[0]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:211:5 @@ -160,7 +234,12 @@ LL | / for i in 0..5 { LL | | LL | | dst[i] = src[0][1][i]; LL | | } - | |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[0][1]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst.copy_from_slice(&src[0][1]); + | error: it looks like you're manually copying between slices --> tests/ui/manual_memcpy/without_loop_counters.rs:219:5 @@ -169,7 +248,12 @@ LL | / for i in 0..src.len() { LL | | LL | | dst[i] = src[i].clone(); LL | | } - | |_____^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..]);` + | |_____^ + | +help: try replacing the loop by + | +LL | dst[..src.len()].clone_from_slice(&src[..]); + | error: aborting due to 18 previous errors diff --git a/src/tools/clippy/tests/ui/manual_next_back.stderr b/src/tools/clippy/tests/ui/manual_next_back.stderr index c7e1ceca437cc..c5ca8278ab0fe 100644 --- a/src/tools/clippy/tests/ui/manual_next_back.stderr +++ b/src/tools/clippy/tests/ui/manual_next_back.stderr @@ -2,16 +2,25 @@ error: manual backwards iteration --> tests/ui/manual_next_back.rs:32:20 | LL | let _ = (0..10).rev().next().unwrap(); - | ^^^^^^^^^^^^^ help: use: `.next_back()` + | ^^^^^^^^^^^^^ | = note: `-D clippy::manual-next-back` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_next_back)]` +help: use + | +LL | let _ = (0..10).next_back().unwrap(); + | ~~~~~~~~~~~~ error: manual backwards iteration --> tests/ui/manual_next_back.rs:33:32 | LL | let _ = "something".bytes().rev().next(); - | ^^^^^^^^^^^^^ help: use: `.next_back()` + | ^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = "something".bytes().next_back(); + | ~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.stderr b/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.stderr index dc669568dd2d4..b8d64437e12e3 100644 --- a/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.stderr +++ b/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.stderr @@ -1,11 +1,7 @@ error: this seems like a manual implementation of the non-exhaustive pattern --> tests/ui/manual_non_exhaustive_enum.rs:4:1 | -LL | enum E { - | ^----- - | | - | _help: add the attribute: `#[non_exhaustive] enum E` - | | +LL | / enum E { LL | | LL | | A, LL | | B, @@ -21,15 +17,15 @@ LL | _C, | ^^ = note: `-D clippy::manual-non-exhaustive` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_non_exhaustive)]` +help: add the attribute + | +LL | #[non_exhaustive] enum E { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: this seems like a manual implementation of the non-exhaustive pattern --> tests/ui/manual_non_exhaustive_enum.rs:29:1 | -LL | enum NoUnderscore { - | ^---------------- - | | - | _help: add the attribute: `#[non_exhaustive] enum NoUnderscore` - | | +LL | / enum NoUnderscore { LL | | A, LL | | B, LL | | #[doc(hidden)] @@ -42,6 +38,10 @@ help: remove this variant | LL | C, | ^ +help: add the attribute + | +LL | #[non_exhaustive] enum NoUnderscore { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/manual_non_exhaustive_struct.stderr b/src/tools/clippy/tests/ui/manual_non_exhaustive_struct.stderr index 1cab812988a34..165cfe73e0509 100644 --- a/src/tools/clippy/tests/ui/manual_non_exhaustive_struct.stderr +++ b/src/tools/clippy/tests/ui/manual_non_exhaustive_struct.stderr @@ -1,11 +1,7 @@ error: this seems like a manual implementation of the non-exhaustive pattern --> tests/ui/manual_non_exhaustive_struct.rs:5:5 | -LL | struct S { - | ^------- - | | - | _____help: add the attribute: `#[non_exhaustive] struct S` - | | +LL | / struct S { LL | | LL | | pub a: i32, LL | | pub b: i32, @@ -20,6 +16,10 @@ LL | _c: (), | ^^^^^^ = note: `-D clippy::manual-non-exhaustive` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_non_exhaustive)]` +help: add the attribute + | +LL | #[non_exhaustive] struct S { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this seems like a manual implementation of the non-exhaustive pattern --> tests/ui/manual_non_exhaustive_struct.rs:14:5 @@ -41,11 +41,7 @@ LL | _c: (), error: this seems like a manual implementation of the non-exhaustive pattern --> tests/ui/manual_non_exhaustive_struct.rs:29:5 | -LL | struct NoUnderscore { - | ^------------------ - | | - | _____help: add the attribute: `#[non_exhaustive] struct NoUnderscore` - | | +LL | / struct NoUnderscore { LL | | pub a: i32, LL | | pub b: i32, LL | | c: (), @@ -57,20 +53,26 @@ help: remove this field | LL | c: (), | ^^^^^ +help: add the attribute + | +LL | #[non_exhaustive] struct NoUnderscore { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this seems like a manual implementation of the non-exhaustive pattern --> tests/ui/manual_non_exhaustive_struct.rs:56:5 | LL | struct T(pub i32, pub i32, ()); - | --------^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: add the attribute: `#[non_exhaustive] struct T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove this field --> tests/ui/manual_non_exhaustive_struct.rs:56:32 | LL | struct T(pub i32, pub i32, ()); | ^^ +help: add the attribute + | +LL | #[non_exhaustive] struct T(pub i32, pub i32, ()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this seems like a manual implementation of the non-exhaustive pattern --> tests/ui/manual_non_exhaustive_struct.rs:61:5 diff --git a/src/tools/clippy/tests/ui/manual_ok_or.stderr b/src/tools/clippy/tests/ui/manual_ok_or.stderr index 2441a75b5c46e..1d319830855e6 100644 --- a/src/tools/clippy/tests/ui/manual_ok_or.stderr +++ b/src/tools/clippy/tests/ui/manual_ok_or.stderr @@ -2,31 +2,49 @@ error: this pattern reimplements `Option::ok_or` --> tests/ui/manual_ok_or.rs:11:5 | LL | foo.map_or(Err("error"), |v| Ok(v)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `foo.ok_or("error")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-ok-or` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_ok_or)]` +help: replace with + | +LL | foo.ok_or("error"); + | ~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Option::ok_or` --> tests/ui/manual_ok_or.rs:14:5 | LL | foo.map_or(Err("error"), Ok); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `foo.ok_or("error")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | foo.ok_or("error"); + | ~~~~~~~~~~~~~~~~~~ error: called `map_or(Err(_), Ok)` on an `Option` value --> tests/ui/manual_ok_or.rs:14:5 | LL | foo.map_or(Err("error"), Ok); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `ok_or`: `foo.ok_or("error")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::option-map-or-err-ok` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::option_map_or_err_ok)]` +help: consider using `ok_or` + | +LL | foo.ok_or("error"); + | ~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Option::ok_or` --> tests/ui/manual_ok_or.rs:17:5 | LL | None::.map_or(Err("error"), |v| Ok(v)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `None::.ok_or("error")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | None::.ok_or("error"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Option::ok_or` --> tests/ui/manual_ok_or.rs:21:5 diff --git a/src/tools/clippy/tests/ui/manual_pattern_char_comparison.stderr b/src/tools/clippy/tests/ui/manual_pattern_char_comparison.stderr index f185d7c8f6767..a1d03bce03a16 100644 --- a/src/tools/clippy/tests/ui/manual_pattern_char_comparison.stderr +++ b/src/tools/clippy/tests/ui/manual_pattern_char_comparison.stderr @@ -2,64 +2,113 @@ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:11:31 | LL | sentence.trim_end_matches(|c: char| c == '.' || c == ',' || c == '!' || c == '?'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['.', ',', '!', '?']` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-pattern-char-comparison` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_pattern_char_comparison)]` +help: consider using an array of `char` + | +LL | sentence.trim_end_matches(['.', ',', '!', '?']); + | ~~~~~~~~~~~~~~~~~~~~ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:12:20 | LL | sentence.split(|c: char| c == '\n' || c == 'X'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['\n', 'X']` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using an array of `char` + | +LL | sentence.split(['\n', 'X']); + | ~~~~~~~~~~~ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:13:20 | LL | sentence.split(|c| c == '\n' || c == 'X'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['\n', 'X']` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using an array of `char` + | +LL | sentence.split(['\n', 'X']); + | ~~~~~~~~~~~ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:14:24 | LL | sentence.splitn(3, |c: char| c == 'X'); - | ^^^^^^^^^^^^^^^^^^ help: consider using a `char`: `'X'` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider using a `char` + | +LL | sentence.splitn(3, 'X'); + | ~~~ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:17:24 | LL | sentence.splitn(3, |c: char| c == char_compare); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a `char`: `char_compare` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a `char` + | +LL | sentence.splitn(3, char_compare); + | ~~~~~~~~~~~~ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:18:20 | LL | sentence.split(|c: char| matches!(c, '\n' | 'X' | 'Y')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['\n', 'X', 'Y']` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using an array of `char` + | +LL | sentence.split(['\n', 'X', 'Y']); + | ~~~~~~~~~~~~~~~~ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:19:24 | LL | sentence.splitn(3, |c: char| matches!(c, 'X')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a `char`: `'X'` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a `char` + | +LL | sentence.splitn(3, 'X'); + | ~~~ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:20:24 | LL | sentence.splitn(3, |c: char| matches!(c, 'X' | 'W')); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['X', 'W']` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using an array of `char` + | +LL | sentence.splitn(3, ['X', 'W']); + | ~~~~~~~~~~ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:21:19 | LL | sentence.find(|c| c == '🎈'); - | ^^^^^^^^^^^^^ help: consider using a `char`: `'🎈'` + | ^^^^^^^^^^^^^ + | +help: consider using a `char` + | +LL | sentence.find('🎈'); + | ~~~~ error: this manual char comparison can be written more succinctly --> tests/ui/manual_pattern_char_comparison.rs:60:31 | LL | sentence.trim_end_matches(|c: char| c == '.' || c == ',' || c == '!' || c == '?'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['.', ',', '!', '?']` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using an array of `char` + | +LL | sentence.trim_end_matches(['.', ',', '!', '?']); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/manual_range_patterns.stderr b/src/tools/clippy/tests/ui/manual_range_patterns.stderr index 7c19fdd475f19..17b62361cb4a1 100644 --- a/src/tools/clippy/tests/ui/manual_range_patterns.stderr +++ b/src/tools/clippy/tests/ui/manual_range_patterns.stderr @@ -2,123 +2,216 @@ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:8:25 | LL | let _ = matches!(f, 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-range-patterns` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_range_patterns)]` +help: try + | +LL | let _ = matches!(f, 1..=10); + | ~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:9:25 | LL | let _ = matches!(f, 4 | 2 | 3 | 1 | 5 | 6 | 9 | 7 | 8 | 10); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = matches!(f, 1..=10); + | ~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:16:25 | LL | let _ = matches!(f, 1 | (2..=4)); - | ^^^^^^^^^^^ help: try: `1..=4` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = matches!(f, 1..=4); + | ~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:17:25 | LL | let _ = matches!(f, 1 | (2..4)); - | ^^^^^^^^^^ help: try: `1..4` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = matches!(f, 1..4); + | ~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:18:25 | LL | let _ = matches!(f, (1..=10) | (2..=13) | (14..=48324728) | 48324729); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=48324729` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = matches!(f, 1..=48324729); + | ~~~~~~~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:19:25 | LL | let _ = matches!(f, 0 | (1..=10) | 48324730 | (2..=13) | (14..=48324728) | 48324729); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `0..=48324730` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = matches!(f, 0..=48324730); + | ~~~~~~~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:20:25 | LL | let _ = matches!(f, 0..=1 | 0..=2 | 0..=3); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `0..=3` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = matches!(f, 0..=3); + | ~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:23:9 | LL | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 => true, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 1..=10 => true, + | ~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:26:25 | LL | let _ = matches!(f, -1 | -5 | 3 | -2 | -4 | -3 | 0 | 1 | 2); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-5..=3` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = matches!(f, -5..=3); + | ~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:28:25 | LL | let _ = matches!(f, -1_000_000..=1_000_000 | -1_000_001 | 1_000_001); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-1_000_001..=1_000_001` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = matches!(f, -1_000_001..=1_000_001); + | ~~~~~~~~~~~~~~~~~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:31:17 | LL | matches!(f, 0x00 | 0x01 | 0x02 | 0x03); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `0x00..=0x03` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | matches!(f, 0x00..=0x03); + | ~~~~~~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:32:17 | LL | matches!(f, 0x00..=0x05 | 0x06 | 0x07); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `0x00..=0x07` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | matches!(f, 0x00..=0x07); + | ~~~~~~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:33:17 | LL | matches!(f, -0x09 | -0x08 | -0x07..=0x00); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-0x09..=0x00` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | matches!(f, -0x09..=0x00); + | ~~~~~~~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:35:17 | LL | matches!(f, 0..5 | 5); - | ^^^^^^^^ help: try: `0..=5` + | ^^^^^^^^ + | +help: try + | +LL | matches!(f, 0..=5); + | ~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:36:17 | LL | matches!(f, 0 | 1..5); - | ^^^^^^^^ help: try: `0..5` + | ^^^^^^^^ + | +help: try + | +LL | matches!(f, 0..5); + | ~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:38:17 | LL | matches!(f, 0..=5 | 6..10); - | ^^^^^^^^^^^^^ help: try: `0..10` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | matches!(f, 0..10); + | ~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:39:17 | LL | matches!(f, 0..5 | 5..=10); - | ^^^^^^^^^^^^^ help: try: `0..=10` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | matches!(f, 0..=10); + | ~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:40:17 | LL | matches!(f, 5..=10 | 0..5); - | ^^^^^^^^^^^^^ help: try: `0..=10` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | matches!(f, 0..=10); + | ~~~~~~ error: this OR pattern can be rewritten using a range --> tests/ui/manual_range_patterns.rs:44:26 | LL | matches!($e, 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | mac!(f); | ------- in this macro invocation | = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try + | +LL | matches!($e, 1..=10) + | ~~~~~~ error: aborting due to 19 previous errors diff --git a/src/tools/clippy/tests/ui/manual_rem_euclid.stderr b/src/tools/clippy/tests/ui/manual_rem_euclid.stderr index a19fdadb1c9bd..ee6a555cf57ee 100644 --- a/src/tools/clippy/tests/ui/manual_rem_euclid.stderr +++ b/src/tools/clippy/tests/ui/manual_rem_euclid.stderr @@ -2,66 +2,114 @@ error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:13:18 | LL | let _: i32 = ((value % 4) + 4) % 4; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `value.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-rem-euclid` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_rem_euclid)]` +help: consider using + | +LL | let _: i32 = value.rem_euclid(4); + | ~~~~~~~~~~~~~~~~~~~ error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:14:18 | LL | let _: i32 = (4 + (value % 4)) % 4; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `value.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: i32 = value.rem_euclid(4); + | ~~~~~~~~~~~~~~~~~~~ error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:15:18 | LL | let _: i32 = (value % 4 + 4) % 4; - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `value.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: i32 = value.rem_euclid(4); + | ~~~~~~~~~~~~~~~~~~~ error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:16:18 | LL | let _: i32 = (4 + value % 4) % 4; - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `value.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: i32 = value.rem_euclid(4); + | ~~~~~~~~~~~~~~~~~~~ error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:17:22 | LL | let _: i32 = 1 + (4 + value % 4) % 4; - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `value.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: i32 = 1 + value.rem_euclid(4); + | ~~~~~~~~~~~~~~~~~~~ error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:37:22 | LL | let _: i32 = ((value % 4) + 4) % 4; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `value.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using + | +LL | let _: i32 = value.rem_euclid(4); + | ~~~~~~~~~~~~~~~~~~~ error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:49:5 | LL | ((num % 4) + 4) % 4 - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `num.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | num.rem_euclid(4) + | error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:54:5 | LL | ((num % 4) + 4) % 4 - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `num.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | num.rem_euclid(4) + | error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:66:18 | LL | let _: i32 = ((x % 4) + 4) % 4; - | ^^^^^^^^^^^^^^^^^ help: consider using: `x.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: i32 = x.rem_euclid(4); + | ~~~~~~~~~~~~~~~ error: manual `rem_euclid` implementation --> tests/ui/manual_rem_euclid.rs:79:18 | LL | let _: i32 = ((x % 4) + 4) % 4; - | ^^^^^^^^^^^^^^^^^ help: consider using: `x.rem_euclid(4)` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: i32 = x.rem_euclid(4); + | ~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/manual_retain.stderr b/src/tools/clippy/tests/ui/manual_retain.stderr index c25c804df7581..2732c96e53169 100644 --- a/src/tools/clippy/tests/ui/manual_retain.stderr +++ b/src/tools/clippy/tests/ui/manual_retain.stderr @@ -2,46 +2,80 @@ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:25:5 | LL | binary_heap = binary_heap.into_iter().filter(|x| x % 2 == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-retain` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_retain)]` +help: consider calling `.retain()` instead + | +LL | binary_heap.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:26:5 | LL | binary_heap = binary_heap.iter().filter(|&x| x % 2 == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | binary_heap.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:27:5 | LL | binary_heap = binary_heap.iter().filter(|&x| x % 2 == 0).cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | binary_heap.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:31:5 | LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | tuples.retain(|(ref x, ref y)| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:32:5 | LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | tuples.retain(|(x, y)| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:62:5 | LL | btree_map = btree_map.into_iter().filter(|(k, _)| k % 2 == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|k, _| k % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | btree_map.retain(|k, _| k % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:63:5 | LL | btree_map = btree_map.into_iter().filter(|(_, v)| v % 2 == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|_, &mut v| v % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | btree_map.retain(|_, &mut v| v % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:64:5 @@ -50,49 +84,89 @@ LL | / btree_map = btree_map LL | | .into_iter() LL | | .filter(|(k, v)| (k % 2 == 0) && (v % 2 == 0)) LL | | .collect(); - | |__________________^ help: consider calling `.retain()` instead: `btree_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))` + | |__________________^ + | +help: consider calling `.retain()` instead + | +LL | btree_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:89:5 | LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | btree_set.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:90:5 | LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | btree_set.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:91:5 | LL | btree_set = btree_set.into_iter().filter(|x| x % 2 == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | btree_set.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:95:5 | LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | tuples.retain(|(ref x, ref y)| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:96:5 | LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | tuples.retain(|(x, y)| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:126:5 | LL | hash_map = hash_map.into_iter().filter(|(k, _)| k % 2 == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|k, _| k % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | hash_map.retain(|k, _| k % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:127:5 | LL | hash_map = hash_map.into_iter().filter(|(_, v)| v % 2 == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|_, &mut v| v % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | hash_map.retain(|_, &mut v| v % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:128:5 @@ -101,139 +175,254 @@ LL | / hash_map = hash_map LL | | .into_iter() LL | | .filter(|(k, v)| (k % 2 == 0) && (v % 2 == 0)) LL | | .collect(); - | |__________________^ help: consider calling `.retain()` instead: `hash_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))` + | |__________________^ + | +help: consider calling `.retain()` instead + | +LL | hash_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:152:5 | LL | hash_set = hash_set.into_iter().filter(|x| x % 2 == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | hash_set.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:153:5 | LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | hash_set.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:154:5 | LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | hash_set.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:158:5 | LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | tuples.retain(|(ref x, ref y)| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:159:5 | LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | tuples.retain(|(x, y)| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:188:5 | LL | s = s.chars().filter(|&c| c != 'o').to_owned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `s.retain(|c| c != 'o')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | s.retain(|c| c != 'o'); + | ~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:200:5 | LL | vec = vec.iter().filter(|&x| x % 2 == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:201:5 | LL | vec = vec.iter().filter(|&x| x % 2 == 0).cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:202:5 | LL | vec = vec.into_iter().filter(|x| x % 2 == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:206:5 | LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | tuples.retain(|(ref x, ref y)| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:207:5 | LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | tuples.retain(|(x, y)| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:229:5 | LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec_deque.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:230:5 | LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec_deque.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:231:5 | LL | vec_deque = vec_deque.into_iter().filter(|x| x % 2 == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec_deque.retain(|x| x % 2 == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:288:5 | LL | vec = vec.into_iter().filter(|(x, y)| *x == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|(x, y)| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|(x, y)| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:292:5 | LL | tuples = tuples.into_iter().filter(|(_, n)| *n > 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(_, n)| *n > 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | tuples.retain(|(_, n)| *n > 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:309:5 | LL | vec = vec.iter().filter(|&&x| x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|&x| x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:310:5 | LL | vec = vec.iter().filter(|&&x| x == 0).cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|&x| x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:311:5 | LL | vec = vec.into_iter().filter(|&x| x == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|&x| x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:314:5 | LL | vec = vec.iter().filter(|&x| *x == 0).copied().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|x| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:315:5 | LL | vec = vec.iter().filter(|&x| *x == 0).cloned().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|x| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this expression can be written more simply using `.retain()` --> tests/ui/manual_retain.rs:316:5 | LL | vec = vec.into_iter().filter(|x| *x == 0).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling `.retain()` instead + | +LL | vec.retain(|x| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 38 previous errors diff --git a/src/tools/clippy/tests/ui/manual_saturating_arithmetic.stderr b/src/tools/clippy/tests/ui/manual_saturating_arithmetic.stderr index b6a8df0f84e13..1f68fa9409b51 100644 --- a/src/tools/clippy/tests/ui/manual_saturating_arithmetic.stderr +++ b/src/tools/clippy/tests/ui/manual_saturating_arithmetic.stderr @@ -2,22 +2,36 @@ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:6:13 | LL | let _ = 1u32.checked_add(1).unwrap_or(u32::max_value()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1u32.saturating_add(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-saturating-arithmetic` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_saturating_arithmetic)]` +help: consider using `saturating_add` + | +LL | let _ = 1u32.saturating_add(1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:7:13 | LL | let _ = 1u32.checked_add(1).unwrap_or(u32::MAX); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1u32.saturating_add(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_add` + | +LL | let _ = 1u32.saturating_add(1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:8:13 | LL | let _ = 1u8.checked_add(1).unwrap_or(255); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1u8.saturating_add(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_add` + | +LL | let _ = 1u8.saturating_add(1); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:9:13 @@ -26,49 +40,89 @@ LL | let _ = 1u128 | _____________^ LL | | .checked_add(1) LL | | .unwrap_or(340_282_366_920_938_463_463_374_607_431_768_211_455); - | |_______________________________________________________________________^ help: consider using `saturating_add`: `1u128.saturating_add(1)` + | |_______________________________________________________________________^ + | +help: consider using `saturating_add` + | +LL | let _ = 1u128.saturating_add(1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:14:13 | LL | let _ = 1u32.checked_mul(1).unwrap_or(u32::MAX); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_mul`: `1u32.saturating_mul(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_mul` + | +LL | let _ = 1u32.saturating_mul(1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:16:13 | LL | let _ = 1u32.checked_sub(1).unwrap_or(u32::min_value()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1u32.saturating_sub(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1u32.saturating_sub(1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:17:13 | LL | let _ = 1u32.checked_sub(1).unwrap_or(u32::MIN); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1u32.saturating_sub(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1u32.saturating_sub(1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:18:13 | LL | let _ = 1u8.checked_sub(1).unwrap_or(0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1u8.saturating_sub(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1u8.saturating_sub(1); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:22:13 | LL | let _ = 1i32.checked_add(1).unwrap_or(i32::max_value()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i32.saturating_add(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_add` + | +LL | let _ = 1i32.saturating_add(1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:23:13 | LL | let _ = 1i32.checked_add(1).unwrap_or(i32::MAX); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i32.saturating_add(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_add` + | +LL | let _ = 1i32.saturating_add(1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:24:13 | LL | let _ = 1i8.checked_add(1).unwrap_or(127); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i8.saturating_add(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_add` + | +LL | let _ = 1i8.saturating_add(1); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:25:13 @@ -77,25 +131,45 @@ LL | let _ = 1i128 | _____________^ LL | | .checked_add(1) LL | | .unwrap_or(170_141_183_460_469_231_731_687_303_715_884_105_727); - | |_______________________________________________________________________^ help: consider using `saturating_add`: `1i128.saturating_add(1)` + | |_______________________________________________________________________^ + | +help: consider using `saturating_add` + | +LL | let _ = 1i128.saturating_add(1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:28:13 | LL | let _ = 1i32.checked_add(-1).unwrap_or(i32::min_value()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i32.saturating_add(-1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_add` + | +LL | let _ = 1i32.saturating_add(-1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:29:13 | LL | let _ = 1i32.checked_add(-1).unwrap_or(i32::MIN); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i32.saturating_add(-1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_add` + | +LL | let _ = 1i32.saturating_add(-1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:30:13 | LL | let _ = 1i8.checked_add(-1).unwrap_or(-128); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_add`: `1i8.saturating_add(-1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_add` + | +LL | let _ = 1i8.saturating_add(-1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:31:13 @@ -104,25 +178,45 @@ LL | let _ = 1i128 | _____________^ LL | | .checked_add(-1) LL | | .unwrap_or(-170_141_183_460_469_231_731_687_303_715_884_105_728); - | |________________________________________________________________________^ help: consider using `saturating_add`: `1i128.saturating_add(-1)` + | |________________________________________________________________________^ + | +help: consider using `saturating_add` + | +LL | let _ = 1i128.saturating_add(-1); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:38:13 | LL | let _ = 1i32.checked_sub(1).unwrap_or(i32::min_value()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i32.saturating_sub(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1i32.saturating_sub(1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:39:13 | LL | let _ = 1i32.checked_sub(1).unwrap_or(i32::MIN); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i32.saturating_sub(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1i32.saturating_sub(1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:40:13 | LL | let _ = 1i8.checked_sub(1).unwrap_or(-128); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i8.saturating_sub(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1i8.saturating_sub(1); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:41:13 @@ -131,25 +225,45 @@ LL | let _ = 1i128 | _____________^ LL | | .checked_sub(1) LL | | .unwrap_or(-170_141_183_460_469_231_731_687_303_715_884_105_728); - | |________________________________________________________________________^ help: consider using `saturating_sub`: `1i128.saturating_sub(1)` + | |________________________________________________________________________^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1i128.saturating_sub(1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:44:13 | LL | let _ = 1i32.checked_sub(-1).unwrap_or(i32::max_value()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i32.saturating_sub(-1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1i32.saturating_sub(-1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:45:13 | LL | let _ = 1i32.checked_sub(-1).unwrap_or(i32::MAX); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i32.saturating_sub(-1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1i32.saturating_sub(-1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:46:13 | LL | let _ = 1i8.checked_sub(-1).unwrap_or(127); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `1i8.saturating_sub(-1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1i8.saturating_sub(-1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual saturating arithmetic --> tests/ui/manual_saturating_arithmetic.rs:47:13 @@ -158,7 +272,12 @@ LL | let _ = 1i128 | _____________^ LL | | .checked_sub(-1) LL | | .unwrap_or(170_141_183_460_469_231_731_687_303_715_884_105_727); - | |_______________________________________________________________________^ help: consider using `saturating_sub`: `1i128.saturating_sub(-1)` + | |_______________________________________________________________________^ + | +help: consider using `saturating_sub` + | +LL | let _ = 1i128.saturating_sub(-1); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 24 previous errors diff --git a/src/tools/clippy/tests/ui/manual_slice_size_calculation.stderr b/src/tools/clippy/tests/ui/manual_slice_size_calculation.stderr index 4bd8a4fdf17b7..9abf52a6b3180 100644 --- a/src/tools/clippy/tests/ui/manual_slice_size_calculation.stderr +++ b/src/tools/clippy/tests/ui/manual_slice_size_calculation.stderr @@ -2,46 +2,80 @@ error: manual slice size calculation --> tests/ui/manual_slice_size_calculation.rs:15:13 | LL | let _ = s_i32.len() * size_of::(); // WARNING - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-slice-size-calculation` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_slice_size_calculation)]` +help: try + | +LL | let _ = std::mem::size_of_val(s_i32); // WARNING + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual slice size calculation --> tests/ui/manual_slice_size_calculation.rs:16:13 | LL | let _ = size_of::() * s_i32.len(); // WARNING - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = std::mem::size_of_val(s_i32); // WARNING + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual slice size calculation --> tests/ui/manual_slice_size_calculation.rs:17:13 | LL | let _ = size_of::() * s_i32.len() * 5; // WARNING - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = std::mem::size_of_val(s_i32) * 5; // WARNING + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual slice size calculation --> tests/ui/manual_slice_size_calculation.rs:21:13 | LL | let _ = len * size_of::(); // WARNING - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = std::mem::size_of_val(s_i32); // WARNING + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual slice size calculation --> tests/ui/manual_slice_size_calculation.rs:22:13 | LL | let _ = s_i32.len() * size; // WARNING - | ^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = std::mem::size_of_val(s_i32); // WARNING + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual slice size calculation --> tests/ui/manual_slice_size_calculation.rs:23:13 | LL | let _ = len * size; // WARNING - | ^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = std::mem::size_of_val(s_i32); // WARNING + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual slice size calculation --> tests/ui/manual_slice_size_calculation.rs:25:13 | LL | let _ = external!(&[1u64][..]).len() * size_of::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(external!(&[1u64][..]))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = std::mem::size_of_val(external!(&[1u64][..])); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/manual_split_once.stderr b/src/tools/clippy/tests/ui/manual_split_once.stderr index c5c9be3ac63df..11367c8caffda 100644 --- a/src/tools/clippy/tests/ui/manual_split_once.stderr +++ b/src/tools/clippy/tests/ui/manual_split_once.stderr @@ -2,82 +2,146 @@ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:11:13 | LL | let _ = "key=value".splitn(2, '=').nth(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"key=value".split_once('=').unwrap().1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-split-once` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_split_once)]` +help: try + | +LL | let _ = "key=value".split_once('=').unwrap().1; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:12:13 | LL | let _ = "key=value".splitn(2, '=').skip(1).next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"key=value".split_once('=').unwrap().1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = "key=value".split_once('=').unwrap().1; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:13:18 | LL | let (_, _) = "key=value".splitn(2, '=').next_tuple().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"key=value".split_once('=')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let (_, _) = "key=value".split_once('=').unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:16:13 | LL | let _ = s.splitn(2, '=').nth(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.split_once('=').unwrap().1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.split_once('=').unwrap().1; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:19:13 | LL | let _ = s.splitn(2, '=').nth(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.split_once('=').unwrap().1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.split_once('=').unwrap().1; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:22:13 | LL | let _ = s.splitn(2, '=').skip(1).next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.split_once('=').unwrap().1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.split_once('=').unwrap().1; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:25:17 | LL | let _ = s.splitn(2, '=').nth(1)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.split_once('=')?.1` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.split_once('=')?.1; + | ~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:26:17 | LL | let _ = s.splitn(2, '=').skip(1).next()?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.split_once('=')?.1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.split_once('=')?.1; + | ~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `rsplit_once` --> tests/ui/manual_split_once.rs:27:17 | LL | let _ = s.rsplitn(2, '=').nth(1)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.rsplit_once('=')?.0` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.rsplit_once('=')?.0; + | ~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `rsplit_once` --> tests/ui/manual_split_once.rs:28:17 | LL | let _ = s.rsplitn(2, '=').skip(1).next()?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.rsplit_once('=')?.0` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.rsplit_once('=')?.0; + | ~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `rsplit_once` --> tests/ui/manual_split_once.rs:36:13 | LL | let _ = "key=value".rsplitn(2, '=').nth(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"key=value".rsplit_once('=').unwrap().0` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = "key=value".rsplit_once('=').unwrap().0; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `rsplit_once` --> tests/ui/manual_split_once.rs:37:18 | LL | let (_, _) = "key=value".rsplitn(2, '=').next_tuple().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"key=value".rsplit_once('=').map(|(x, y)| (y, x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let (_, _) = "key=value".rsplit_once('=').map(|(x, y)| (y, x)).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `rsplit_once` --> tests/ui/manual_split_once.rs:38:13 | LL | let _ = s.rsplitn(2, '=').nth(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.rsplit_once('=').map(|x| x.0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.rsplit_once('=').map(|x| x.0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:42:5 @@ -175,7 +239,12 @@ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:139:13 | LL | let _ = "key=value".splitn(2, '=').nth(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"key=value".split_once('=').unwrap().1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = "key=value".split_once('=').unwrap().1; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `split_once` --> tests/ui/manual_split_once.rs:141:5 diff --git a/src/tools/clippy/tests/ui/manual_str_repeat.stderr b/src/tools/clippy/tests/ui/manual_str_repeat.stderr index d4f8786fb5f10..ca474cd2ba9b7 100644 --- a/src/tools/clippy/tests/ui/manual_str_repeat.stderr +++ b/src/tools/clippy/tests/ui/manual_str_repeat.stderr @@ -2,64 +2,113 @@ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:8:21 | LL | let _: String = std::iter::repeat("test").take(10).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"test".repeat(10)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-str-repeat` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_str_repeat)]` +help: try + | +LL | let _: String = "test".repeat(10); + | ~~~~~~~~~~~~~~~~~ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:9:21 | LL | let _: String = std::iter::repeat('x').take(10).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"x".repeat(10)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: String = "x".repeat(10); + | ~~~~~~~~~~~~~~ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:10:21 | LL | let _: String = std::iter::repeat('\'').take(10).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"'".repeat(10)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: String = "'".repeat(10); + | ~~~~~~~~~~~~~~ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:11:21 | LL | let _: String = std::iter::repeat('"').take(10).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"\"".repeat(10)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: String = "\"".repeat(10); + | ~~~~~~~~~~~~~~~ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:15:13 | LL | let _ = repeat(x).take(count + 2).collect::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.repeat(count + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x.repeat(count + 2); + | ~~~~~~~~~~~~~~~~~~~ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:24:21 | LL | let _: String = repeat(*x).take(count).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(*x).repeat(count)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: String = (*x).repeat(count); + | ~~~~~~~~~~~~~~~~~~ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:33:21 | LL | let _: String = repeat(x).take(count).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.repeat(count)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: String = x.repeat(count); + | ~~~~~~~~~~~~~~~ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:45:21 | LL | let _: String = repeat(Cow::Borrowed("test")).take(count).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Cow::Borrowed("test").repeat(count)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: String = Cow::Borrowed("test").repeat(count); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:48:21 | LL | let _: String = repeat(x).take(count).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.repeat(count)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: String = x.repeat(count); + | ~~~~~~~~~~~~~~~ error: manual implementation of `str::repeat` using iterators --> tests/ui/manual_str_repeat.rs:63:21 | LL | let _: String = std::iter::repeat("test").take(10).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"test".repeat(10)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: String = "test".repeat(10); + | ~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/manual_string_new.stderr b/src/tools/clippy/tests/ui/manual_string_new.stderr index 6b434f405d31c..65ad8f68b6712 100644 --- a/src/tools/clippy/tests/ui/manual_string_new.stderr +++ b/src/tools/clippy/tests/ui/manual_string_new.stderr @@ -2,58 +2,102 @@ error: empty String is being created manually --> tests/ui/manual_string_new.rs:14:13 | LL | let _ = "".to_string(); - | ^^^^^^^^^^^^^^ help: consider using: `String::new()` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::manual-string-new` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_string_new)]` +help: consider using + | +LL | let _ = String::new(); + | ~~~~~~~~~~~~~ error: empty String is being created manually --> tests/ui/manual_string_new.rs:17:13 | LL | let _ = "".to_owned(); - | ^^^^^^^^^^^^^ help: consider using: `String::new()` + | ^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = String::new(); + | ~~~~~~~~~~~~~ error: empty String is being created manually --> tests/ui/manual_string_new.rs:20:21 | LL | let _: String = "".into(); - | ^^^^^^^^^ help: consider using: `String::new()` + | ^^^^^^^^^ + | +help: consider using + | +LL | let _: String = String::new(); + | ~~~~~~~~~~~~~ error: empty String is being created manually --> tests/ui/manual_string_new.rs:27:13 | LL | let _ = String::from(""); - | ^^^^^^^^^^^^^^^^ help: consider using: `String::new()` + | ^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = String::new(); + | ~~~~~~~~~~~~~ error: empty String is being created manually --> tests/ui/manual_string_new.rs:28:13 | LL | let _ = ::from(""); - | ^^^^^^^^^^^^^^^^^^ help: consider using: `String::new()` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = String::new(); + | ~~~~~~~~~~~~~ error: empty String is being created manually --> tests/ui/manual_string_new.rs:33:13 | LL | let _ = String::try_from("").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `String::new()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = String::new(); + | ~~~~~~~~~~~~~ error: empty String is being created manually --> tests/ui/manual_string_new.rs:39:21 | LL | let _: String = From::from(""); - | ^^^^^^^^^^^^^^ help: consider using: `String::new()` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: String = String::new(); + | ~~~~~~~~~~~~~ error: empty String is being created manually --> tests/ui/manual_string_new.rs:44:21 | LL | let _: String = TryFrom::try_from("").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `String::new()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: String = String::new(); + | ~~~~~~~~~~~~~ error: empty String is being created manually --> tests/ui/manual_string_new.rs:47:21 | LL | let _: String = TryFrom::try_from("").expect("this should warn"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `String::new()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: String = String::new(); + | ~~~~~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/manual_swap_auto_fix.stderr b/src/tools/clippy/tests/ui/manual_swap_auto_fix.stderr index eecfcd3977beb..4adb48924406a 100644 --- a/src/tools/clippy/tests/ui/manual_swap_auto_fix.stderr +++ b/src/tools/clippy/tests/ui/manual_swap_auto_fix.stderr @@ -35,7 +35,12 @@ error: this looks like you are swapping elements of `v` manually LL | / let temp = v[i1]; LL | | v[i1] = v[i2]; LL | | v[i2] = temp; - | |_________________^ help: try: `v.swap(i1, i2);` + | |_________________^ + | +help: try + | +LL | v.swap(i1, i2); + | error: this looks like you are swapping elements of `v` manually --> tests/ui/manual_swap_auto_fix.rs:34:5 @@ -43,7 +48,12 @@ error: this looks like you are swapping elements of `v` manually LL | / let temp = v[i1]; LL | | v[i1] = v[i2 + 1]; LL | | v[i2 + 1] = temp; - | |_____________________^ help: try: `v.swap(i1, i2 + 1);` + | |_____________________^ + | +help: try + | +LL | v.swap(i1, i2 + 1); + | error: this looks like you are swapping elements of `v` manually --> tests/ui/manual_swap_auto_fix.rs:43:5 @@ -51,7 +61,12 @@ error: this looks like you are swapping elements of `v` manually LL | / let temp = v[i1]; LL | | v[i1] = v[i2 + 1]; LL | | v[i2 + 1] = temp; - | |_____________________^ help: try: `v.swap(i1, i2 + 1);` + | |_____________________^ + | +help: try + | +LL | v.swap(i1, i2 + 1); + | error: this looks like you are swapping elements of `v` manually --> tests/ui/manual_swap_auto_fix.rs:50:5 @@ -74,7 +89,12 @@ error: this looks like you are swapping elements of `v` manually LL | / let tmp = v[i1 * 3]; LL | | v[i1 * 3] = v[i2 / 2]; LL | | v[i2 / 2] = tmp; - | |____________________^ help: try: `v.swap(i1 * 3, i2 / 2);` + | |____________________^ + | +help: try + | +LL | v.swap(i1 * 3, i2 / 2); + | error: this looks like you are swapping elements of `v` manually --> tests/ui/manual_swap_auto_fix.rs:69:5 @@ -82,7 +102,12 @@ error: this looks like you are swapping elements of `v` manually LL | / let tmp = v[i1 + i2]; LL | | v[i1 + i2] = v[i2]; LL | | v[i2] = tmp; - | |________________^ help: try: `v.swap(i1 + i2, i2);` + | |________________^ + | +help: try + | +LL | v.swap(i1 + i2, i2); + | error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/manual_try_fold.stderr b/src/tools/clippy/tests/ui/manual_try_fold.stderr index bc075e87d71f5..3383a72e4b050 100644 --- a/src/tools/clippy/tests/ui/manual_try_fold.stderr +++ b/src/tools/clippy/tests/ui/manual_try_fold.stderr @@ -2,28 +2,47 @@ error: usage of `Iterator::fold` on a type that implements `Try` --> tests/ui/manual_try_fold.rs:59:10 | LL | .fold(Some(0i32), |sum, i| sum?.checked_add(*i)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i| ...)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-try-fold` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_try_fold)]` +help: use `try_fold` instead + | +LL | .try_fold(0i32, |sum, i| ...) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `Iterator::fold` on a type that implements `Try` --> tests/ui/manual_try_fold.rs:63:10 | LL | .fold(NotOption(0i32, 0i32), |sum, i| NotOption(0i32, 0i32)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(..., |sum, i| ...)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `try_fold` instead + | +LL | .try_fold(..., |sum, i| ...); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `Iterator::fold` on a type that implements `Try` --> tests/ui/manual_try_fold.rs:66:10 | LL | .fold(NotOptionButWorse(0i32), |sum, i| NotOptionButWorse(0i32)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i| ...)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `try_fold` instead + | +LL | .try_fold(0i32, |sum, i| ...); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of `Iterator::fold` on a type that implements `Try` --> tests/ui/manual_try_fold.rs:96:10 | LL | .fold(Some(0i32), |sum, i| sum?.checked_add(*i)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i| ...)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `try_fold` instead + | +LL | .try_fold(0i32, |sum, i| ...) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/manual_unwrap_or.stderr b/src/tools/clippy/tests/ui/manual_unwrap_or.stderr index c93a8952a0805..be128b318912f 100644 --- a/src/tools/clippy/tests/ui/manual_unwrap_or.stderr +++ b/src/tools/clippy/tests/ui/manual_unwrap_or.stderr @@ -5,10 +5,14 @@ LL | / match Some(1) { LL | | Some(i) => i, LL | | None => 42, LL | | }; - | |_____^ help: replace with: `Some(1).unwrap_or(42)` + | |_____^ | = note: `-D clippy::manual-unwrap-or` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or)]` +help: replace with + | +LL | Some(1).unwrap_or(42); + | ~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Option::unwrap_or` --> tests/ui/manual_unwrap_or.rs:17:5 @@ -17,7 +21,12 @@ LL | / match Some(1) { LL | | None => 42, LL | | Some(i) => i, LL | | }; - | |_____^ help: replace with: `Some(1).unwrap_or(42)` + | |_____^ + | +help: replace with + | +LL | Some(1).unwrap_or(42); + | ~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Option::unwrap_or` --> tests/ui/manual_unwrap_or.rs:23:5 @@ -26,7 +35,12 @@ LL | / match Some(1) { LL | | Some(i) => i, LL | | None => 1 + 42, LL | | }; - | |_____^ help: replace with: `Some(1).unwrap_or(1 + 42)` + | |_____^ + | +help: replace with + | +LL | Some(1).unwrap_or(1 + 42); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Option::unwrap_or` --> tests/ui/manual_unwrap_or.rs:30:5 @@ -56,7 +70,12 @@ LL | / match Some("Bob") { LL | | Some(i) => i, LL | | None => "Alice", LL | | }; - | |_____^ help: replace with: `Some("Bob").unwrap_or("Alice")` + | |_____^ + | +help: replace with + | +LL | Some("Bob").unwrap_or("Alice"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Option::unwrap_or` --> tests/ui/manual_unwrap_or.rs:87:5 @@ -66,7 +85,12 @@ LL | | x LL | | } else { LL | | 42 LL | | }; - | |_____^ help: replace with: `Some(1).unwrap_or(42)` + | |_____^ + | +help: replace with + | +LL | Some(1).unwrap_or(42); + | ~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Result::unwrap_or` --> tests/ui/manual_unwrap_or.rs:120:5 @@ -75,7 +99,12 @@ LL | / match Ok::(1) { LL | | Ok(i) => i, LL | | Err(_) => 42, LL | | }; - | |_____^ help: replace with: `Ok::(1).unwrap_or(42)` + | |_____^ + | +help: replace with + | +LL | Ok::(1).unwrap_or(42); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Result::unwrap_or` --> tests/ui/manual_unwrap_or.rs:127:5 @@ -84,7 +113,12 @@ LL | / match a { LL | | Ok(i) => i, LL | | Err(_) => 42, LL | | }; - | |_____^ help: replace with: `a.unwrap_or(42)` + | |_____^ + | +help: replace with + | +LL | a.unwrap_or(42); + | ~~~~~~~~~~~~~~~ error: this pattern reimplements `Result::unwrap_or` --> tests/ui/manual_unwrap_or.rs:133:5 @@ -93,7 +127,12 @@ LL | / match Ok(1) as Result { LL | | Ok(i) => i, LL | | Err(_) => 42, LL | | }; - | |_____^ help: replace with: `(Ok(1) as Result).unwrap_or(42)` + | |_____^ + | +help: replace with + | +LL | (Ok(1) as Result).unwrap_or(42); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Option::unwrap_or` --> tests/ui/manual_unwrap_or.rs:146:5 @@ -102,7 +141,12 @@ LL | / match s.method() { LL | | Some(i) => i, LL | | None => 42, LL | | }; - | |_____^ help: replace with: `s.method().unwrap_or(42)` + | |_____^ + | +help: replace with + | +LL | s.method().unwrap_or(42); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Result::unwrap_or` --> tests/ui/manual_unwrap_or.rs:152:5 @@ -111,7 +155,12 @@ LL | / match Ok::(1) { LL | | Err(_) => 42, LL | | Ok(i) => i, LL | | }; - | |_____^ help: replace with: `Ok::(1).unwrap_or(42)` + | |_____^ + | +help: replace with + | +LL | Ok::(1).unwrap_or(42); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Result::unwrap_or` --> tests/ui/manual_unwrap_or.rs:158:5 @@ -120,7 +169,12 @@ LL | / match Ok::(1) { LL | | Ok(i) => i, LL | | Err(_) => 1 + 42, LL | | }; - | |_____^ help: replace with: `Ok::(1).unwrap_or(1 + 42)` + | |_____^ + | +help: replace with + | +LL | Ok::(1).unwrap_or(1 + 42); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Result::unwrap_or` --> tests/ui/manual_unwrap_or.rs:165:5 @@ -150,7 +204,12 @@ LL | / match Ok::<&str, &str>("Bob") { LL | | Ok(i) => i, LL | | Err(_) => "Alice", LL | | }; - | |_____^ help: replace with: `Ok::<&str, &str>("Bob").unwrap_or("Alice")` + | |_____^ + | +help: replace with + | +LL | Ok::<&str, &str>("Bob").unwrap_or("Alice"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Result::unwrap_or` --> tests/ui/manual_unwrap_or.rs:211:5 @@ -160,7 +219,12 @@ LL | | x LL | | } else { LL | | 42 LL | | }; - | |_____^ help: replace with: `Ok::(1).unwrap_or(42)` + | |_____^ + | +help: replace with + | +LL | Ok::(1).unwrap_or(42); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this pattern reimplements `Option::unwrap_or` --> tests/ui/manual_unwrap_or.rs:265:17 @@ -170,7 +234,12 @@ LL | let _ = match some_macro!() { LL | | Some(val) => val, LL | | None => 0, LL | | }; - | |_________^ help: replace with: `some_macro!().unwrap_or(0)` + | |_________^ + | +help: replace with + | +LL | let _ = some_macro!().unwrap_or(0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/manual_unwrap_or_default.stderr b/src/tools/clippy/tests/ui/manual_unwrap_or_default.stderr index 9e3b1be5cb9be..4e6932333996b 100644 --- a/src/tools/clippy/tests/ui/manual_unwrap_or_default.stderr +++ b/src/tools/clippy/tests/ui/manual_unwrap_or_default.stderr @@ -6,10 +6,14 @@ LL | | LL | | Some(v) => v, LL | | None => Vec::default(), LL | | }; - | |_____^ help: replace it with: `x.unwrap_or_default()` + | |_____^ | = note: `-D clippy::manual-unwrap-or-default` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or_default)]` +help: replace it with + | +LL | x.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~~~ error: match can be simplified with `.unwrap_or_default()` --> tests/ui/manual_unwrap_or_default.rs:13:5 @@ -19,7 +23,12 @@ LL | | LL | | Some(v) => v, LL | | _ => Vec::default(), LL | | }; - | |_____^ help: replace it with: `x.unwrap_or_default()` + | |_____^ + | +help: replace it with + | +LL | x.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~~~ error: match can be simplified with `.unwrap_or_default()` --> tests/ui/manual_unwrap_or_default.rs:20:5 @@ -29,7 +38,12 @@ LL | | LL | | Some(v) => v, LL | | None => String::new(), LL | | }; - | |_____^ help: replace it with: `x.unwrap_or_default()` + | |_____^ + | +help: replace it with + | +LL | x.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~~~ error: match can be simplified with `.unwrap_or_default()` --> tests/ui/manual_unwrap_or_default.rs:27:5 @@ -39,7 +53,12 @@ LL | | LL | | None => Vec::default(), LL | | Some(v) => v, LL | | }; - | |_____^ help: replace it with: `x.unwrap_or_default()` + | |_____^ + | +help: replace it with + | +LL | x.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~~~ error: if let can be simplified with `.unwrap_or_default()` --> tests/ui/manual_unwrap_or_default.rs:34:5 @@ -50,7 +69,12 @@ LL | | v LL | | } else { LL | | Vec::default() LL | | }; - | |_____^ help: replace it with: `x.unwrap_or_default()` + | |_____^ + | +help: replace it with + | +LL | x.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~~~ error: match can be simplified with `.unwrap_or_default()` --> tests/ui/manual_unwrap_or_default.rs:52:5 @@ -60,7 +84,12 @@ LL | | LL | | Ok(v) => v, LL | | Err(_) => String::new(), LL | | }; - | |_____^ help: replace it with: `x.unwrap_or_default()` + | |_____^ + | +help: replace it with + | +LL | x.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~~~ error: if let can be simplified with `.unwrap_or_default()` --> tests/ui/manual_unwrap_or_default.rs:59:5 @@ -71,7 +100,12 @@ LL | | v LL | | } else { LL | | String::new() LL | | }; - | |_____^ help: replace it with: `x.unwrap_or_default()` + | |_____^ + | +help: replace it with + | +LL | x.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~~~ error: match can be simplified with `.unwrap_or_default()` --> tests/ui/manual_unwrap_or_default.rs:71:20 @@ -81,7 +115,12 @@ LL | Some(_) => match *b { LL | | Some(v) => v, LL | | _ => 0, LL | | }, - | |_________^ help: replace it with: `(*b).unwrap_or_default()` + | |_________^ + | +help: replace it with + | +LL | Some(_) => (*b).unwrap_or_default(), + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/map_clone.stderr b/src/tools/clippy/tests/ui/map_clone.stderr index d9e025de4abe9..06e4c1272bb7f 100644 --- a/src/tools/clippy/tests/ui/map_clone.stderr +++ b/src/tools/clippy/tests/ui/map_clone.stderr @@ -2,94 +2,169 @@ error: you are using an explicit closure for copying elements --> tests/ui/map_clone.rs:14:22 | LL | let _: Vec = vec![5_i8; 6].iter().map(|x| *x).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![5_i8; 6].iter().copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::map-clone` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::map_clone)]` +help: consider calling the dedicated `copied` method + | +LL | let _: Vec = vec![5_i8; 6].iter().copied().collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: you are using an explicit closure for cloning elements --> tests/ui/map_clone.rs:15:26 | LL | let _: Vec = vec![String::new()].iter().map(|x| x.clone()).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `cloned` method + | +LL | let _: Vec = vec![String::new()].iter().cloned().collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: you are using an explicit closure for copying elements --> tests/ui/map_clone.rs:16:23 | LL | let _: Vec = vec![42, 43].iter().map(|&x| x).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![42, 43].iter().copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `copied` method + | +LL | let _: Vec = vec![42, 43].iter().copied().collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: you are using an explicit closure for copying elements --> tests/ui/map_clone.rs:18:26 | LL | let _: Option = Some(&16).map(|b| *b); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&16).copied()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `copied` method + | +LL | let _: Option = Some(&16).copied(); + | ~~~~~~~~~~~~~~~~~~ error: you are using an explicit closure for copying elements --> tests/ui/map_clone.rs:19:25 | LL | let _: Option = Some(&1).map(|x| x.clone()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&1).copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `copied` method + | +LL | let _: Option = Some(&1).copied(); + | ~~~~~~~~~~~~~~~~~ error: you are needlessly cloning iterator elements --> tests/ui/map_clone.rs:30:29 | LL | let _ = std::env::args().map(|v| v.clone()); - | ^^^^^^^^^^^^^^^^^^^ help: remove the `map` call + | ^^^^^^^^^^^^^^^^^^^ + | +help: remove the `map` call + | +LL - let _ = std::env::args().map(|v| v.clone()); +LL + let _ = std::env::args(); + | error: you are explicitly cloning with `.map()` --> tests/ui/map_clone.rs:69:13 | LL | let y = x.map(|x| String::clone(x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `cloned` method + | +LL | let y = x.cloned(); + | ~~~~~~~~~~ error: you are explicitly cloning with `.map()` --> tests/ui/map_clone.rs:71:13 | LL | let y = x.map(Clone::clone); - | ^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `cloned` method + | +LL | let y = x.cloned(); + | ~~~~~~~~~~ error: you are explicitly cloning with `.map()` --> tests/ui/map_clone.rs:74:13 | LL | let y = x.map(String::clone); - | ^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `cloned` method + | +LL | let y = x.cloned(); + | ~~~~~~~~~~ error: you are explicitly cloning with `.map()` --> tests/ui/map_clone.rs:80:13 | LL | let y = x.map(|x| u32::clone(x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `copied` method + | +LL | let y = x.copied(); + | ~~~~~~~~~~ error: you are explicitly cloning with `.map()` --> tests/ui/map_clone.rs:83:13 | LL | let y = x.map(|x| Clone::clone(x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `copied` method + | +LL | let y = x.copied(); + | ~~~~~~~~~~ error: you are explicitly cloning with `.map()` --> tests/ui/map_clone.rs:95:13 | LL | let y = x.map(|x| String::clone(x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `cloned` method + | +LL | let y = x.cloned(); + | ~~~~~~~~~~ error: you are explicitly cloning with `.map()` --> tests/ui/map_clone.rs:98:13 | LL | let y = x.map(|x| Clone::clone(x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `cloned` method + | +LL | let y = x.cloned(); + | ~~~~~~~~~~ error: you are explicitly cloning with `.map()` --> tests/ui/map_clone.rs:104:13 | LL | let y = x.map(|x| u32::clone(x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `copied` method + | +LL | let y = x.copied(); + | ~~~~~~~~~~ error: you are explicitly cloning with `.map()` --> tests/ui/map_clone.rs:107:13 | LL | let y = x.map(|x| Clone::clone(x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider calling the dedicated `copied` method + | +LL | let y = x.copied(); + | ~~~~~~~~~~ error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/map_collect_result_unit.stderr b/src/tools/clippy/tests/ui/map_collect_result_unit.stderr index 8d147340e16aa..1733693983bec 100644 --- a/src/tools/clippy/tests/ui/map_collect_result_unit.stderr +++ b/src/tools/clippy/tests/ui/map_collect_result_unit.stderr @@ -2,16 +2,25 @@ error: `.map().collect()` can be replaced with `.try_for_each()` --> tests/ui/map_collect_result_unit.rs:5:17 | LL | let _ = (0..3).map(|t| Err(t + 1)).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(0..3).try_for_each(|t| Err(t + 1))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::map-collect-result-unit` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::map_collect_result_unit)]` +help: try + | +LL | let _ = (0..3).try_for_each(|t| Err(t + 1)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `.map().collect()` can be replaced with `.try_for_each()` --> tests/ui/map_collect_result_unit.rs:6:32 | LL | let _: Result<(), _> = (0..3).map(|t| Err(t + 1)).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(0..3).try_for_each(|t| Err(t + 1))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: Result<(), _> = (0..3).try_for_each(|t| Err(t + 1)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/map_flatten_fixable.stderr b/src/tools/clippy/tests/ui/map_flatten_fixable.stderr index 128c95146aa2c..aa21f32109035 100644 --- a/src/tools/clippy/tests/ui/map_flatten_fixable.stderr +++ b/src/tools/clippy/tests/ui/map_flatten_fixable.stderr @@ -2,46 +2,80 @@ error: called `map(..).flatten()` on `Iterator` --> tests/ui/map_flatten_fixable.rs:16:47 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::map-flatten` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::map_flatten)]` +help: try replacing `map` with `filter_map` and remove the `.flatten()` + | +LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id).collect(); + | ~~~~~~~~~~~~~~~~~~~~~ error: called `map(..).flatten()` on `Iterator` --> tests/ui/map_flatten_fixable.rs:17:47 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_ref)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try replacing `map` with `filter_map` and remove the `.flatten()` + | +LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id_ref).collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `map(..).flatten()` on `Iterator` --> tests/ui/map_flatten_fixable.rs:18:47 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_closure)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try replacing `map` with `filter_map` and remove the `.flatten()` + | +LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id_closure).collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `map(..).flatten()` on `Iterator` --> tests/ui/map_flatten_fixable.rs:19:47 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(|x| x.checked_add(1))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try replacing `map` with `filter_map` and remove the `.flatten()` + | +LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(|x| x.checked_add(1)).collect(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `map(..).flatten()` on `Iterator` --> tests/ui/map_flatten_fixable.rs:22:47 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|x| 0..x)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try replacing `map` with `flat_map` and remove the `.flatten()` + | +LL | let _: Vec<_> = vec![5_i8; 6].into_iter().flat_map(|x| 0..x).collect(); + | ~~~~~~~~~~~~~~~~~~ error: called `map(..).flatten()` on `Option` --> tests/ui/map_flatten_fixable.rs:25:40 | LL | let _: Option<_> = (Some(Some(1))).map(|x| x).flatten(); - | ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try replacing `map` with `and_then` and remove the `.flatten()` + | +LL | let _: Option<_> = (Some(Some(1))).and_then(|x| x); + | ~~~~~~~~~~~~~~~ error: called `map(..).flatten()` on `Result` --> tests/ui/map_flatten_fixable.rs:28:42 | LL | let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten(); - | ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try replacing `map` with `and_then` and remove the `.flatten()` + | +LL | let _: Result<_, &str> = (Ok(Ok(1))).and_then(|x| x); + | ~~~~~~~~~~~~~~~ error: called `map(..).flatten()` on `Iterator` --> tests/ui/map_flatten_fixable.rs:37:10 diff --git a/src/tools/clippy/tests/ui/map_identity.stderr b/src/tools/clippy/tests/ui/map_identity.stderr index 0a0dc9c8f075b..e21484420c89e 100644 --- a/src/tools/clippy/tests/ui/map_identity.stderr +++ b/src/tools/clippy/tests/ui/map_identity.stderr @@ -2,28 +2,51 @@ error: unnecessary map of the identity function --> tests/ui/map_identity.rs:7:47 | LL | let _: Vec<_> = x.iter().map(not_identity).map(|x| return x).collect(); - | ^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + | ^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::map-identity` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::map_identity)]` +help: remove the call to `map` + | +LL - let _: Vec<_> = x.iter().map(not_identity).map(|x| return x).collect(); +LL + let _: Vec<_> = x.iter().map(not_identity).collect(); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:8:57 | LL | let _: Vec<_> = x.iter().map(std::convert::identity).map(|y| y).collect(); - | ^^^^^^^^^^^ help: remove the call to `map` + | ^^^^^^^^^^^ + | +help: remove the call to `map` + | +LL - let _: Vec<_> = x.iter().map(std::convert::identity).map(|y| y).collect(); +LL + let _: Vec<_> = x.iter().map(std::convert::identity).collect(); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:8:29 | LL | let _: Vec<_> = x.iter().map(std::convert::identity).map(|y| y).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the call to `map` + | +LL - let _: Vec<_> = x.iter().map(std::convert::identity).map(|y| y).collect(); +LL + let _: Vec<_> = x.iter().map(|y| y).collect(); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:9:32 | LL | let _: Option = Some(3).map(|x| x); - | ^^^^^^^^^^^ help: remove the call to `map` + | ^^^^^^^^^^^ + | +help: remove the call to `map` + | +LL - let _: Option = Some(3).map(|x| x); +LL + let _: Option = Some(3); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:10:36 @@ -32,19 +55,39 @@ LL | let _: Result = Ok(-3).map(|x| { | ____________________________________^ LL | | return x; LL | | }); - | |______^ help: remove the call to `map` + | |______^ + | +help: remove the call to `map` + | +LL - let _: Result = Ok(-3).map(|x| { +LL - return x; +LL - }); +LL + let _: Result = Ok(-3); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:20:36 | LL | let _: Result = Ok(1).map_err(|a| a); - | ^^^^^^^^^^^^^^^ help: remove the call to `map_err` + | ^^^^^^^^^^^^^^^ + | +help: remove the call to `map_err` + | +LL - let _: Result = Ok(1).map_err(|a| a); +LL + let _: Result = Ok(1); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:30:22 | LL | let _ = x.clone().map(|(x, y)| (x, y)); - | ^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the call to `map` + | +LL - let _ = x.clone().map(|(x, y)| (x, y)); +LL + let _ = x.clone(); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:31:22 @@ -53,25 +96,51 @@ LL | let _ = x.clone().map(|(x, y)| { | ______________________^ LL | | return (x, y); LL | | }); - | |______^ help: remove the call to `map` + | |______^ + | +help: remove the call to `map` + | +LL - let _ = x.clone().map(|(x, y)| { +LL - return (x, y); +LL - }); +LL + let _ = x.clone(); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:34:22 | LL | let _ = x.clone().map(|(x, y)| return (x, y)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the call to `map` + | +LL - let _ = x.clone().map(|(x, y)| return (x, y)); +LL + let _ = x.clone(); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:37:22 | LL | let _ = y.clone().map(|(x, y, (z, (w,)))| (x, y, (z, (w,)))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the call to `map` + | +LL - let _ = y.clone().map(|(x, y, (z, (w,)))| (x, y, (z, (w,)))); +LL + let _ = y.clone(); + | error: unnecessary map of the identity function --> tests/ui/map_identity.rs:66:30 | LL | let _ = x.iter().copied().map(|(x, y)| (x, y)); - | ^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the call to `map` + | +LL - let _ = x.iter().copied().map(|(x, y)| (x, y)); +LL + let _ = x.iter().copied(); + | error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/map_unwrap_or.stderr b/src/tools/clippy/tests/ui/map_unwrap_or.stderr index d6ddd09c188c6..a7187eea872ed 100644 --- a/src/tools/clippy/tests/ui/map_unwrap_or.stderr +++ b/src/tools/clippy/tests/ui/map_unwrap_or.stderr @@ -163,7 +163,12 @@ error: called `map().unwrap_or_else()` on a `Result` value --> tests/ui/map_unwrap_or.rs:99:13 | LL | let _ = res.map(|x| x + 1).unwrap_or_else(|_e| 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or_else(|_e| 0, |x| x + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = res.map_or_else(|_e| 0, |x| x + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `map().unwrap_or()` on an `Option` value --> tests/ui/map_unwrap_or.rs:106:13 diff --git a/src/tools/clippy/tests/ui/map_unwrap_or_fixable.stderr b/src/tools/clippy/tests/ui/map_unwrap_or_fixable.stderr index 89a7c979f6e92..e3a877a5ba6a8 100644 --- a/src/tools/clippy/tests/ui/map_unwrap_or_fixable.stderr +++ b/src/tools/clippy/tests/ui/map_unwrap_or_fixable.stderr @@ -5,10 +5,14 @@ LL | let _ = opt.map(|x| x + 1) | _____________^ LL | | // Should lint even though this call is on a separate line. LL | | .unwrap_or_else(|| 0); - | |_____________________________^ help: try: `opt.map_or_else(|| 0, |x| x + 1)` + | |_____________________________^ | = note: `-D clippy::map-unwrap-or` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::map_unwrap_or)]` +help: try + | +LL | let _ = opt.map_or_else(|| 0, |x| x + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `map().unwrap_or_else()` on a `Result` value --> tests/ui/map_unwrap_or_fixable.rs:46:13 @@ -17,7 +21,12 @@ LL | let _ = res.map(|x| x + 1) | _____________^ LL | | // should lint even though this call is on a separate line LL | | .unwrap_or_else(|_e| 0); - | |_______________________________^ help: try: `res.map_or_else(|_e| 0, |x| x + 1)` + | |_______________________________^ + | +help: try + | +LL | let _ = res.map_or_else(|_e| 0, |x| x + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/match_as_ref.stderr b/src/tools/clippy/tests/ui/match_as_ref.stderr index 97b121424d932..f98f978e3c228 100644 --- a/src/tools/clippy/tests/ui/match_as_ref.stderr +++ b/src/tools/clippy/tests/ui/match_as_ref.stderr @@ -6,10 +6,14 @@ LL | let borrowed: Option<&()> = match owned { LL | | None => None, LL | | Some(ref v) => Some(v), LL | | }; - | |_____^ help: try: `owned.as_ref()` + | |_____^ | = note: `-D clippy::match-as-ref` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::match_as_ref)]` +help: try + | +LL | let borrowed: Option<&()> = owned.as_ref(); + | ~~~~~~~~~~~~~~ error: use `as_mut()` instead --> tests/ui/match_as_ref.rs:12:39 @@ -19,7 +23,12 @@ LL | let borrow_mut: Option<&mut ()> = match mut_owned { LL | | None => None, LL | | Some(ref mut v) => Some(v), LL | | }; - | |_____^ help: try: `mut_owned.as_mut()` + | |_____^ + | +help: try + | +LL | let borrow_mut: Option<&mut ()> = mut_owned.as_mut(); + | ~~~~~~~~~~~~~~~~~~ error: use `as_ref()` instead --> tests/ui/match_as_ref.rs:30:13 @@ -28,7 +37,12 @@ LL | / match self.source { LL | | Some(ref s) => Some(s), LL | | None => None, LL | | } - | |_____________^ help: try: `self.source.as_ref().map(|x| x as _)` + | |_____________^ + | +help: try + | +LL | self.source.as_ref().map(|x| x as _) + | error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/match_bool.stderr b/src/tools/clippy/tests/ui/match_bool.stderr index 1303e082daf2f..cd93ad38efb40 100644 --- a/src/tools/clippy/tests/ui/match_bool.stderr +++ b/src/tools/clippy/tests/ui/match_bool.stderr @@ -2,10 +2,14 @@ error: this boolean expression can be simplified --> tests/ui/match_bool.rs:36:11 | LL | match test && test { - | ^^^^^^^^^^^^ help: try: `test` + | ^^^^^^^^^^^^ | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]` +help: try + | +LL | match test { + | ~~~~ error: you seem to be trying to match on a boolean expression --> tests/ui/match_bool.rs:7:5 @@ -15,13 +19,17 @@ LL | | LL | | true => 0, LL | | false => 42, LL | | }; - | |_____^ help: consider using an `if`/`else` expression: `if test { 0 } else { 42 }` + | |_____^ | note: the lint level is defined here --> tests/ui/match_bool.rs:2:9 | LL | #![deny(clippy::match_bool)] | ^^^^^^^^^^^^^^^^^^ +help: consider using an `if`/`else` expression + | +LL | if test { 0 } else { 42 }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to match on a boolean expression --> tests/ui/match_bool.rs:14:5 @@ -31,7 +39,12 @@ LL | | LL | | true => 1, LL | | false => 0, LL | | }; - | |_____^ help: consider using an `if`/`else` expression: `if option == 1 { 1 } else { 0 }` + | |_____^ + | +help: consider using an `if`/`else` expression + | +LL | if option == 1 { 1 } else { 0 }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to match on a boolean expression --> tests/ui/match_bool.rs:20:5 diff --git a/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr b/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr index 201b977e558eb..a5e57e1024116 100644 --- a/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr +++ b/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr @@ -6,10 +6,14 @@ LL | let _y = match x { LL | | Some(0) => true, LL | | _ => false, LL | | }; - | |_____^ help: try: `matches!(x, Some(0))` + | |_____^ | = note: `-D clippy::match-like-matches-macro` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::match_like_matches_macro)]` +help: try + | +LL | let _y = matches!(x, Some(0)); + | ~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/match_expr_like_matches_macro.rs:20:14 @@ -19,10 +23,14 @@ LL | let _w = match x { LL | | Some(_) => true, LL | | _ => false, LL | | }; - | |_____^ help: try: `x.is_some()` + | |_____^ | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` +help: try + | +LL | let _w = x.is_some(); + | ~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/match_expr_like_matches_macro.rs:26:14 @@ -32,7 +40,12 @@ LL | let _z = match x { LL | | Some(_) => false, LL | | None => true, LL | | }; - | |_____^ help: try: `x.is_none()` + | |_____^ + | +help: try + | +LL | let _z = x.is_none(); + | ~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:32:15 @@ -42,13 +55,23 @@ LL | let _zz = match x { LL | | Some(r) if r == 0 => false, LL | | _ => true, LL | | }; - | |_____^ help: try: `!matches!(x, Some(r) if r == 0)` + | |_____^ + | +help: try + | +LL | let _zz = !matches!(x, Some(r) if r == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: if let .. else expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:38:16 | LL | let _zzz = if let Some(5) = x { true } else { false }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(x, Some(5))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _zzz = matches!(x, Some(5)); + | ~~~~~~~~~~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:62:20 @@ -59,7 +82,12 @@ LL | | E::A(_) => true, LL | | E::B(_) => true, LL | | _ => false, LL | | }; - | |_________^ help: try: `matches!(x, E::A(_) | E::B(_))` + | |_________^ + | +help: try + | +LL | let _ans = matches!(x, E::A(_) | E::B(_)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:72:20 @@ -72,7 +100,12 @@ LL | | } LL | | E::B(_) => true, LL | | _ => false, LL | | }; - | |_________^ help: try: `matches!(x, E::A(_) | E::B(_))` + | |_________^ + | +help: try + | +LL | let _ans = matches!(x, E::A(_) | E::B(_)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:82:20 @@ -83,7 +116,12 @@ LL | | E::B(_) => false, LL | | E::C => false, LL | | _ => true, LL | | }; - | |_________^ help: try: `!matches!(x, E::B(_) | E::C)` + | |_________^ + | +help: try + | +LL | let _ans = !matches!(x, E::B(_) | E::C); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:142:18 @@ -93,7 +131,12 @@ LL | let _z = match &z { LL | | Some(3) => true, LL | | _ => false, LL | | }; - | |_________^ help: try: `matches!(z, Some(3))` + | |_________^ + | +help: try + | +LL | let _z = matches!(z, Some(3)); + | ~~~~~~~~~~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:151:18 @@ -103,7 +146,12 @@ LL | let _z = match &z { LL | | Some(3) => true, LL | | _ => false, LL | | }; - | |_________^ help: try: `matches!(&z, Some(3))` + | |_________^ + | +help: try + | +LL | let _z = matches!(&z, Some(3)); + | ~~~~~~~~~~~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:168:21 @@ -113,7 +161,12 @@ LL | let _ = match &z { LL | | AnEnum::X => true, LL | | _ => false, LL | | }; - | |_____________^ help: try: `matches!(&z, AnEnum::X)` + | |_____________^ + | +help: try + | +LL | let _ = matches!(&z, AnEnum::X); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:182:20 @@ -123,7 +176,12 @@ LL | let _res = match &val { LL | | &Some(ref _a) => true, LL | | _ => false, LL | | }; - | |_________^ help: try: `matches!(&val, &Some(ref _a))` + | |_________^ + | +help: try + | +LL | let _res = matches!(&val, &Some(ref _a)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:194:20 @@ -133,7 +191,12 @@ LL | let _res = match &val { LL | | &Some(ref _a) => true, LL | | _ => false, LL | | }; - | |_________^ help: try: `matches!(&val, &Some(ref _a))` + | |_________^ + | +help: try + | +LL | let _res = matches!(&val, &Some(ref _a)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match expression looks like `matches!` macro --> tests/ui/match_expr_like_matches_macro.rs:252:14 @@ -143,7 +206,12 @@ LL | let _y = match Some(5) { LL | | Some(0) => true, LL | | _ => false, LL | | }; - | |_____^ help: try: `matches!(Some(5), Some(0))` + | |_____^ + | +help: try + | +LL | let _y = matches!(Some(5), Some(0)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 14 previous errors diff --git a/src/tools/clippy/tests/ui/match_on_vec_items.stderr b/src/tools/clippy/tests/ui/match_on_vec_items.stderr index e31db37841379..b761429eca26e 100644 --- a/src/tools/clippy/tests/ui/match_on_vec_items.stderr +++ b/src/tools/clippy/tests/ui/match_on_vec_items.stderr @@ -2,52 +2,91 @@ error: indexing into a vector may panic --> tests/ui/match_on_vec_items.rs:10:11 | LL | match arr[idx] { - | ^^^^^^^^ help: try: `arr.get(idx)` + | ^^^^^^^^ | = note: `-D clippy::match-on-vec-items` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::match_on_vec_items)]` +help: try + | +LL | match arr.get(idx) { + | ~~~~~~~~~~~~ error: indexing into a vector may panic --> tests/ui/match_on_vec_items.rs:19:11 | LL | match arr[range] { - | ^^^^^^^^^^ help: try: `arr.get(range)` + | ^^^^^^^^^^ + | +help: try + | +LL | match arr.get(range) { + | ~~~~~~~~~~~~~~ error: indexing into a vector may panic --> tests/ui/match_on_vec_items.rs:33:11 | LL | match arr[idx] { - | ^^^^^^^^ help: try: `arr.get(idx)` + | ^^^^^^^^ + | +help: try + | +LL | match arr.get(idx) { + | ~~~~~~~~~~~~ error: indexing into a vector may panic --> tests/ui/match_on_vec_items.rs:41:11 | LL | match arr[range] { - | ^^^^^^^^^^ help: try: `arr.get(range)` + | ^^^^^^^^^^ + | +help: try + | +LL | match arr.get(range) { + | ~~~~~~~~~~~~~~ error: indexing into a vector may panic --> tests/ui/match_on_vec_items.rs:55:11 | LL | match arr[idx] { - | ^^^^^^^^ help: try: `arr.get(idx)` + | ^^^^^^^^ + | +help: try + | +LL | match arr.get(idx) { + | ~~~~~~~~~~~~ error: indexing into a vector may panic --> tests/ui/match_on_vec_items.rs:63:11 | LL | match arr[range] { - | ^^^^^^^^^^ help: try: `arr.get(range)` + | ^^^^^^^^^^ + | +help: try + | +LL | match arr.get(range) { + | ~~~~~~~~~~~~~~ error: indexing into a vector may panic --> tests/ui/match_on_vec_items.rs:77:11 | LL | match arr[idx] { - | ^^^^^^^^ help: try: `arr.get(idx)` + | ^^^^^^^^ + | +help: try + | +LL | match arr.get(idx) { + | ~~~~~~~~~~~~ error: indexing into a vector may panic --> tests/ui/match_on_vec_items.rs:85:11 | LL | match arr[range] { - | ^^^^^^^^^^ help: try: `arr.get(range)` + | ^^^^^^^^^^ + | +help: try + | +LL | match arr.get(range) { + | ~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/match_ref_pats.stderr b/src/tools/clippy/tests/ui/match_ref_pats.stderr index fc01ab0a919a1..3319eb7bfe9a2 100644 --- a/src/tools/clippy/tests/ui/match_ref_pats.stderr +++ b/src/tools/clippy/tests/ui/match_ref_pats.stderr @@ -36,16 +36,25 @@ error: redundant pattern matching, consider using `is_none()` --> tests/ui/match_ref_pats.rs:37:12 | LL | if let &None = a { - | -------^^^^^---- help: try: `if a.is_none()` + | ^^^^^ | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` +help: try + | +LL | if a.is_none() { + | ~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/match_ref_pats.rs:42:12 | LL | if let &None = &b { - | -------^^^^^----- help: try: `if b.is_none()` + | ^^^^^ + | +help: try + | +LL | if b.is_none() { + | ~~~~~~~~~~~~~~ error: you don't need to add `&` to all patterns --> tests/ui/match_ref_pats.rs:102:9 diff --git a/src/tools/clippy/tests/ui/match_same_arms.stderr b/src/tools/clippy/tests/ui/match_same_arms.stderr index 3c0382767c3fc..b5b4353df8b8b 100644 --- a/src/tools/clippy/tests/ui/match_same_arms.stderr +++ b/src/tools/clippy/tests/ui/match_same_arms.stderr @@ -2,7 +2,7 @@ error: this match arm has an identical body to the `_` wildcard arm --> tests/ui/match_same_arms.rs:12:9 | LL | Abc::A => 0, - | ^^^^^^^^^^^^^ help: try removing the arm + | ^^^^^^^^^^^^^ | = help: or try changing either arm body note: `_` wildcard arm here @@ -12,6 +12,11 @@ LL | _ => 0, | ^^^^^^ = note: `-D clippy::match-same-arms` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::match_same_arms)]` +help: try removing the arm + | +LL - Abc::A => 0, +LL + + | error: this match arm has an identical body to another arm --> tests/ui/match_same_arms.rs:18:9 diff --git a/src/tools/clippy/tests/ui/match_same_arms2.stderr b/src/tools/clippy/tests/ui/match_same_arms2.stderr index a5d137c658b79..679f16859ff14 100644 --- a/src/tools/clippy/tests/ui/match_same_arms2.stderr +++ b/src/tools/clippy/tests/ui/match_same_arms2.stderr @@ -8,7 +8,7 @@ LL | | if true { ... | LL | | }, LL | | _ => { - | |________^ help: try removing the arm + | |________^ | = help: or try changing either arm body note: `_` wildcard arm here @@ -24,6 +24,18 @@ LL | | }, | |_________^ = note: `-D clippy::match-same-arms` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::match_same_arms)]` +help: try removing the arm + | +LL - 42 => { +LL - foo(); +LL - let mut a = 42 + [23].len() as i32; +LL - if true { +LL - a += 7; +LL - } +LL - a = -31 - a; +LL - a +LL - }, + | error: this match arm has an identical body to another arm --> tests/ui/match_same_arms2.rs:39:9 diff --git a/src/tools/clippy/tests/ui/match_same_arms_non_exhaustive.stderr b/src/tools/clippy/tests/ui/match_same_arms_non_exhaustive.stderr index aa7f8c95dce84..297579e8c76f5 100644 --- a/src/tools/clippy/tests/ui/match_same_arms_non_exhaustive.stderr +++ b/src/tools/clippy/tests/ui/match_same_arms_non_exhaustive.stderr @@ -3,7 +3,7 @@ error: this match arm has an identical body to the `_` wildcard arm | LL | / Ordering::AcqRel | Ordering::SeqCst => repeat(), LL | | - | |________^ help: try removing the arm + | |________^ | = help: or try changing either arm body note: `_` wildcard arm here @@ -13,13 +13,17 @@ LL | _ => repeat(), | ^^^^^^^^^^^^^ = note: `-D clippy::match-same-arms` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::match_same_arms)]` +help: try removing the arm + | +LL - Ordering::AcqRel | Ordering::SeqCst => repeat(), + | error: this match arm has an identical body to the `_` wildcard arm --> tests/ui/match_same_arms_non_exhaustive.rs:58:13 | LL | / Ordering::AcqRel | Ordering::SeqCst => repeat(), LL | | - | |____________^ help: try removing the arm + | |____________^ | = help: or try changing either arm body note: `_` wildcard arm here @@ -27,6 +31,10 @@ note: `_` wildcard arm here | LL | _ => repeat(), | ^^^^^^^^^^^^^ +help: try removing the arm + | +LL - Ordering::AcqRel | Ordering::SeqCst => repeat(), + | error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/match_single_binding.stderr b/src/tools/clippy/tests/ui/match_single_binding.stderr index 19ab85180ad28..de89513772603 100644 --- a/src/tools/clippy/tests/ui/match_single_binding.stderr +++ b/src/tools/clippy/tests/ui/match_single_binding.stderr @@ -38,7 +38,12 @@ error: this match could be replaced by its body itself LL | / match a { LL | | _ => println!("whatever"), LL | | } - | |_____^ help: consider using the match body instead: `println!("whatever");` + | |_____^ + | +help: consider using the match body instead + | +LL | println!("whatever"); + | error: this match could be replaced by its body itself --> tests/ui/match_single_binding.rs:60:5 @@ -175,7 +180,12 @@ LL | / match x { LL | | // => LL | | _ => println!("Not an array index start"), LL | | } - | |_____^ help: consider using the match body instead: `println!("Not an array index start")` + | |_____^ + | +help: consider using the match body instead + | +LL | println!("Not an array index start") + | error: this assignment could be simplified --> tests/ui/match_single_binding.rs:138:5 @@ -245,7 +255,12 @@ error: this match could be replaced by its body itself LL | / match 1 { LL | | _ => (), LL | | } - | |_____^ help: consider using the match body instead: `();` + | |_____^ + | +help: consider using the match body instead + | +LL | (); + | error: this match could be replaced by its body itself --> tests/ui/match_single_binding.rs:174:13 @@ -254,7 +269,12 @@ LL | let a = match 1 { | _____________^ LL | | _ => (), LL | | }; - | |_____^ help: consider using the match body instead: `()` + | |_____^ + | +help: consider using the match body instead + | +LL | let a = (); + | ~~ error: this match could be replaced by its body itself --> tests/ui/match_single_binding.rs:178:5 @@ -262,7 +282,12 @@ error: this match could be replaced by its body itself LL | / match 1 { LL | | _ => side_effects(), LL | | } - | |_____^ help: consider using the match body instead: `side_effects();` + | |_____^ + | +help: consider using the match body instead + | +LL | side_effects(); + | error: this match could be replaced by its body itself --> tests/ui/match_single_binding.rs:182:13 @@ -271,7 +296,12 @@ LL | let b = match 1 { | _____________^ LL | | _ => side_effects(), LL | | }; - | |_____^ help: consider using the match body instead: `side_effects()` + | |_____^ + | +help: consider using the match body instead + | +LL | let b = side_effects(); + | ~~~~~~~~~~~~~~ error: this match could be replaced by its body itself --> tests/ui/match_single_binding.rs:186:5 @@ -279,7 +309,12 @@ error: this match could be replaced by its body itself LL | / match 1 { LL | | _ => println!("1"), LL | | } - | |_____^ help: consider using the match body instead: `println!("1");` + | |_____^ + | +help: consider using the match body instead + | +LL | println!("1"); + | error: this match could be replaced by its body itself --> tests/ui/match_single_binding.rs:190:13 @@ -288,7 +323,12 @@ LL | let c = match 1 { | _____________^ LL | | _ => println!("1"), LL | | }; - | |_____^ help: consider using the match body instead: `println!("1")` + | |_____^ + | +help: consider using the match body instead + | +LL | let c = println!("1"); + | ~~~~~~~~~~~~~ error: this match could be replaced by its body itself --> tests/ui/match_single_binding.rs:195:9 @@ -296,7 +336,12 @@ error: this match could be replaced by its body itself LL | / match 1 { LL | | _ => (), LL | | }, - | |_________^ help: consider using the match body instead: `()` + | |_________^ + | +help: consider using the match body instead + | +LL | (), + | ~~ error: this match could be replaced by its body itself --> tests/ui/match_single_binding.rs:198:9 @@ -304,7 +349,12 @@ error: this match could be replaced by its body itself LL | / match 1 { LL | | _ => side_effects(), LL | | }, - | |_________^ help: consider using the match body instead: `side_effects()` + | |_________^ + | +help: consider using the match body instead + | +LL | side_effects(), + | ~~~~~~~~~~~~~~ error: this match could be replaced by its body itself --> tests/ui/match_single_binding.rs:201:9 @@ -312,7 +362,12 @@ error: this match could be replaced by its body itself LL | / match 1 { LL | | _ => println!("1"), LL | | }, - | |_________^ help: consider using the match body instead: `println!("1")` + | |_________^ + | +help: consider using the match body instead + | +LL | println!("1"), + | ~~~~~~~~~~~~~ error: aborting due to 24 previous errors diff --git a/src/tools/clippy/tests/ui/match_wildcard_for_single_variants.stderr b/src/tools/clippy/tests/ui/match_wildcard_for_single_variants.stderr index 5cc50c823b2ca..186daa0cb5773 100644 --- a/src/tools/clippy/tests/ui/match_wildcard_for_single_variants.stderr +++ b/src/tools/clippy/tests/ui/match_wildcard_for_single_variants.stderr @@ -2,64 +2,113 @@ error: wildcard matches only a single variant and will also match any future add --> tests/ui/match_wildcard_for_single_variants.rs:22:13 | LL | _ => (), - | ^ help: try: `Self::Rgb(..)` + | ^ | = note: `-D clippy::match-wildcard-for-single-variants` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::match_wildcard_for_single_variants)]` +help: try + | +LL | Self::Rgb(..) => (), + | ~~~~~~~~~~~~~ error: wildcard matches only a single variant and will also match any future added variants --> tests/ui/match_wildcard_for_single_variants.rs:32:9 | LL | _ => {}, - | ^ help: try: `Foo::C` + | ^ + | +help: try + | +LL | Foo::C => {}, + | ~~~~~~ error: wildcard matches only a single variant and will also match any future added variants --> tests/ui/match_wildcard_for_single_variants.rs:42:9 | LL | _ => {}, - | ^ help: try: `Color::Blue` + | ^ + | +help: try + | +LL | Color::Blue => {}, + | ~~~~~~~~~~~ error: wildcard matches only a single variant and will also match any future added variants --> tests/ui/match_wildcard_for_single_variants.rs:50:9 | LL | _ => {}, - | ^ help: try: `Color::Blue` + | ^ + | +help: try + | +LL | Color::Blue => {}, + | ~~~~~~~~~~~ error: wildcard matches only a single variant and will also match any future added variants --> tests/ui/match_wildcard_for_single_variants.rs:56:9 | LL | _ => {}, - | ^ help: try: `Color::Blue` + | ^ + | +help: try + | +LL | Color::Blue => {}, + | ~~~~~~~~~~~ error: wildcard matches only a single variant and will also match any future added variants --> tests/ui/match_wildcard_for_single_variants.rs:73:9 | LL | &_ => (), - | ^^ help: try: `Color::Blue` + | ^^ + | +help: try + | +LL | Color::Blue => (), + | ~~~~~~~~~~~ error: wildcard matches only a single variant and will also match any future added variants --> tests/ui/match_wildcard_for_single_variants.rs:82:9 | LL | _ => (), - | ^ help: try: `C::Blue` + | ^ + | +help: try + | +LL | C::Blue => (), + | ~~~~~~~ error: wildcard matches only a single variant and will also match any future added variants --> tests/ui/match_wildcard_for_single_variants.rs:89:9 | LL | _ => (), - | ^ help: try: `Color::Blue` + | ^ + | +help: try + | +LL | Color::Blue => (), + | ~~~~~~~~~~~ error: wildcard matches only a single variant and will also match any future added variants --> tests/ui/match_wildcard_for_single_variants.rs:124:13 | LL | _ => (), - | ^ help: try: `Enum::__Private` + | ^ + | +help: try + | +LL | Enum::__Private => (), + | ~~~~~~~~~~~~~~~ error: wildcard matches only a single variant and will also match any future added variants --> tests/ui/match_wildcard_for_single_variants.rs:151:13 | LL | _ => 2, - | ^ help: try: `Foo::B` + | ^ + | +help: try + | +LL | Foo::B => 2, + | ~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/mem_replace.stderr b/src/tools/clippy/tests/ui/mem_replace.stderr index 44be2c9b63d75..48d908bb1083f 100644 --- a/src/tools/clippy/tests/ui/mem_replace.stderr +++ b/src/tools/clippy/tests/ui/mem_replace.stderr @@ -2,151 +2,269 @@ error: replacing an `Option` with `None` --> tests/ui/mem_replace.rs:14:13 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::mem_replace_option_with_none)]` +help: consider `Option::take()` instead + | +LL | let _ = an_option.take(); + | ~~~~~~~~~~~~~~~~ error: replacing an `Option` with `None` --> tests/ui/mem_replace.rs:16:13 | LL | let _ = mem::replace(an_option, None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider `Option::take()` instead + | +LL | let _ = an_option.take(); + | ~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:21:13 | LL | let _ = std::mem::replace(&mut s, String::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::mem-replace-with-default` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::mem_replace_with_default)]` +help: consider using + | +LL | let _ = std::mem::take(&mut s); + | ~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:24:13 | LL | let _ = std::mem::replace(s, String::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(s); + | ~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:25:13 | LL | let _ = std::mem::replace(s, Default::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(s); + | ~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:28:13 | LL | let _ = std::mem::replace(&mut v, Vec::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut v); + | ~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:29:13 | LL | let _ = std::mem::replace(&mut v, Default::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut v); + | ~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:30:13 | LL | let _ = std::mem::replace(&mut v, Vec::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut v); + | ~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:31:13 | LL | let _ = std::mem::replace(&mut v, vec![]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut v); + | ~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:34:13 | LL | let _ = std::mem::replace(&mut hash_map, HashMap::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut hash_map)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut hash_map); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:37:13 | LL | let _ = std::mem::replace(&mut btree_map, BTreeMap::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut btree_map)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut btree_map); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:40:13 | LL | let _ = std::mem::replace(&mut vd, VecDeque::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut vd)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut vd); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:43:13 | LL | let _ = std::mem::replace(&mut hash_set, HashSet::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut hash_set)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut hash_set); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:46:13 | LL | let _ = std::mem::replace(&mut btree_set, BTreeSet::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut btree_set)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut btree_set); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:49:13 | LL | let _ = std::mem::replace(&mut list, LinkedList::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut list)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut list); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:52:13 | LL | let _ = std::mem::replace(&mut binary_heap, BinaryHeap::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut binary_heap)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut binary_heap); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:55:13 | LL | let _ = std::mem::replace(&mut tuple, (vec![], BinaryHeap::new())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut tuple)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut tuple); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:58:13 | LL | let _ = std::mem::replace(&mut refstr, ""); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut refstr)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut refstr); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:61:13 | LL | let _ = std::mem::replace(&mut slice, &[]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut slice)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut slice); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:97:13 | LL | let _ = std::mem::replace(&mut s, String::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut s); + | ~~~~~~~~~~~~~~~~~~~~~~ error: replacing an `Option` with `None` --> tests/ui/mem_replace.rs:127:13 | LL | let _ = std::mem::replace(&mut f.0, None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `f.0.take()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider `Option::take()` instead + | +LL | let _ = f.0.take(); + | ~~~~~~~~~~ error: replacing an `Option` with `None` --> tests/ui/mem_replace.rs:128:13 | LL | let _ = std::mem::replace(&mut *f, None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `(*f).take()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider `Option::take()` instead + | +LL | let _ = (*f).take(); + | ~~~~~~~~~~~ error: replacing an `Option` with `None` --> tests/ui/mem_replace.rs:129:13 | LL | let _ = std::mem::replace(&mut b.opt, None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `b.opt.take()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider `Option::take()` instead + | +LL | let _ = b.opt.take(); + | ~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> tests/ui/mem_replace.rs:131:13 | LL | let _ = std::mem::replace(&mut b.val, String::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut b.val)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = std::mem::take(&mut b.val); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 24 previous errors diff --git a/src/tools/clippy/tests/ui/mem_replace_no_std.stderr b/src/tools/clippy/tests/ui/mem_replace_no_std.stderr index eea538da4277a..d2dc01e12f1fa 100644 --- a/src/tools/clippy/tests/ui/mem_replace_no_std.stderr +++ b/src/tools/clippy/tests/ui/mem_replace_no_std.stderr @@ -2,49 +2,82 @@ error: replacing an `Option` with `None` --> tests/ui/mem_replace_no_std.rs:24:13 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::mem_replace_option_with_none)]` +help: consider `Option::take()` instead + | +LL | let _ = an_option.take(); + | ~~~~~~~~~~~~~~~~ error: replacing an `Option` with `None` --> tests/ui/mem_replace_no_std.rs:26:13 | LL | let _ = mem::replace(an_option, None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider `Option::take()` instead + | +LL | let _ = an_option.take(); + | ~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `core::mem::take` --> tests/ui/mem_replace_no_std.rs:31:13 | LL | let _ = mem::replace(&mut refstr, ""); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `core::mem::take(&mut refstr)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::mem-replace-with-default` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::mem_replace_with_default)]` +help: consider using + | +LL | let _ = core::mem::take(&mut refstr); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing a value of type `T` with `T::default()` is better expressed using `core::mem::take` --> tests/ui/mem_replace_no_std.rs:34:13 | LL | let _ = mem::replace(&mut slice, &[]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `core::mem::take(&mut slice)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = core::mem::take(&mut slice); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: replacing an `Option` with `None` --> tests/ui/mem_replace_no_std.rs:77:13 | LL | let _ = mem::replace(&mut f.0, None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `f.0.take()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider `Option::take()` instead + | +LL | let _ = f.0.take(); + | ~~~~~~~~~~ error: replacing an `Option` with `None` --> tests/ui/mem_replace_no_std.rs:78:13 | LL | let _ = mem::replace(&mut *f, None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `(*f).take()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider `Option::take()` instead + | +LL | let _ = (*f).take(); + | ~~~~~~~~~~~ error: replacing an `Option` with `None` --> tests/ui/mem_replace_no_std.rs:79:13 | LL | let _ = mem::replace(&mut b.opt, None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `b.opt.take()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider `Option::take()` instead + | +LL | let _ = b.opt.take(); + | ~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/methods_fixable.stderr b/src/tools/clippy/tests/ui/methods_fixable.stderr index 852e7a224a6e3..e9cde79a4bc62 100644 --- a/src/tools/clippy/tests/ui/methods_fixable.stderr +++ b/src/tools/clippy/tests/ui/methods_fixable.stderr @@ -2,10 +2,14 @@ error: called `filter(..).next()` on an `Iterator`. This is more succinctly expr --> tests/ui/methods_fixable.rs:9:13 | LL | let _ = v.iter().filter(|&x| *x < 0).next(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `v.iter().find(|&x| *x < 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::filter-next` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::filter_next)]` +help: try + | +LL | let _ = v.iter().find(|&x| *x < 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/methods_unfixable.stderr b/src/tools/clippy/tests/ui/methods_unfixable.stderr index 76691860f819d..7b930e5f73fae 100644 --- a/src/tools/clippy/tests/ui/methods_unfixable.stderr +++ b/src/tools/clippy/tests/ui/methods_unfixable.stderr @@ -2,7 +2,7 @@ error: called `filter(..).next()` on an `Iterator`. This is more succinctly expr --> tests/ui/methods_unfixable.rs:9:13 | LL | let _ = iter.filter(|_| true).next(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `iter.find(|_| true)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: you will also need to make `iter` mutable, because `find` takes `&mut self` --> tests/ui/methods_unfixable.rs:8:9 @@ -11,6 +11,10 @@ LL | let iter = (0..10); | ^^^^ = note: `-D clippy::filter-next` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::filter_next)]` +help: try + | +LL | let _ = iter.find(|_| true); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/misnamed_getters.stderr b/src/tools/clippy/tests/ui/misnamed_getters.stderr index 056fa2be92151..f3963d8467963 100644 --- a/src/tools/clippy/tests/ui/misnamed_getters.stderr +++ b/src/tools/clippy/tests/ui/misnamed_getters.stderr @@ -5,12 +5,15 @@ LL | / fn a(&self) -> &u8 { LL | | LL | | LL | | &self.b - | | ------- help: consider using: `&self.a` LL | | } | |_____^ | = note: `-D clippy::misnamed-getters` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::misnamed_getters)]` +help: consider using + | +LL | &self.a + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:17:5 @@ -18,9 +21,13 @@ error: getter function appears to return the wrong field LL | / fn a_mut(&mut self) -> &mut u8 { LL | | LL | | &mut self.b - | | ----------- help: consider using: `&mut self.a` LL | | } | |_____^ + | +help: consider using + | +LL | &mut self.a + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:22:5 @@ -28,9 +35,13 @@ error: getter function appears to return the wrong field LL | / fn b(self) -> u8 { LL | | LL | | self.a - | | ------ help: consider using: `self.b` LL | | } | |_____^ + | +help: consider using + | +LL | self.b + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:27:5 @@ -38,9 +49,13 @@ error: getter function appears to return the wrong field LL | / fn b_mut(&mut self) -> &mut u8 { LL | | LL | | &mut self.a - | | ----------- help: consider using: `&mut self.b` LL | | } | |_____^ + | +help: consider using + | +LL | &mut self.b + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:32:5 @@ -48,9 +63,13 @@ error: getter function appears to return the wrong field LL | / fn c(&self) -> &u8 { LL | | LL | | &self.b - | | ------- help: consider using: `&self.c` LL | | } | |_____^ + | +help: consider using + | +LL | &self.c + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:37:5 @@ -58,9 +77,13 @@ error: getter function appears to return the wrong field LL | / fn c_mut(&mut self) -> &mut u8 { LL | | LL | | &mut self.a - | | ----------- help: consider using: `&mut self.c` LL | | } | |_____^ + | +help: consider using + | +LL | &mut self.c + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:49:5 @@ -68,9 +91,13 @@ error: getter function appears to return the wrong field LL | / unsafe fn a(&self) -> &u8 { LL | | LL | | &self.b - | | ------- help: consider using: `&self.a` LL | | } | |_____^ + | +help: consider using + | +LL | &self.a + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:53:5 @@ -78,9 +105,13 @@ error: getter function appears to return the wrong field LL | / unsafe fn a_mut(&mut self) -> &mut u8 { LL | | LL | | &mut self.b - | | ----------- help: consider using: `&mut self.a` LL | | } | |_____^ + | +help: consider using + | +LL | &mut self.a + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:58:5 @@ -88,9 +119,13 @@ error: getter function appears to return the wrong field LL | / unsafe fn b(self) -> u8 { LL | | LL | | self.a - | | ------ help: consider using: `self.b` LL | | } | |_____^ + | +help: consider using + | +LL | self.b + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:63:5 @@ -98,9 +133,13 @@ error: getter function appears to return the wrong field LL | / unsafe fn b_mut(&mut self) -> &mut u8 { LL | | LL | | &mut self.a - | | ----------- help: consider using: `&mut self.b` LL | | } | |_____^ + | +help: consider using + | +LL | &mut self.b + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:76:5 @@ -108,9 +147,13 @@ error: getter function appears to return the wrong field LL | / unsafe fn a_unchecked(&self) -> &u8 { LL | | LL | | &self.b - | | ------- help: consider using: `&self.a` LL | | } | |_____^ + | +help: consider using + | +LL | &self.a + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:80:5 @@ -118,9 +161,13 @@ error: getter function appears to return the wrong field LL | / unsafe fn a_unchecked_mut(&mut self) -> &mut u8 { LL | | LL | | &mut self.b - | | ----------- help: consider using: `&mut self.a` LL | | } | |_____^ + | +help: consider using + | +LL | &mut self.a + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:85:5 @@ -128,9 +175,13 @@ error: getter function appears to return the wrong field LL | / unsafe fn b_unchecked(self) -> u8 { LL | | LL | | self.a - | | ------ help: consider using: `self.b` LL | | } | |_____^ + | +help: consider using + | +LL | self.b + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:90:5 @@ -138,9 +189,13 @@ error: getter function appears to return the wrong field LL | / unsafe fn b_unchecked_mut(&mut self) -> &mut u8 { LL | | LL | | &mut self.a - | | ----------- help: consider using: `&mut self.b` LL | | } | |_____^ + | +help: consider using + | +LL | &mut self.b + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:123:5 @@ -148,9 +203,13 @@ error: getter function appears to return the wrong field LL | / fn a(&self) -> &u8 { LL | | LL | | &self.b - | | ------- help: consider using: `&self.a` LL | | } | |_____^ + | +help: consider using + | +LL | &self.a + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:127:5 @@ -158,9 +217,13 @@ error: getter function appears to return the wrong field LL | / fn a_mut(&mut self) -> &mut u8 { LL | | LL | | &mut self.b - | | ----------- help: consider using: `&mut self.a` LL | | } | |_____^ + | +help: consider using + | +LL | &mut self.a + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:132:5 @@ -168,9 +231,13 @@ error: getter function appears to return the wrong field LL | / fn d(&self) -> &u8 { LL | | LL | | &self.b - | | ------- help: consider using: `&self.d` LL | | } | |_____^ + | +help: consider using + | +LL | &self.d + | error: getter function appears to return the wrong field --> tests/ui/misnamed_getters.rs:136:5 @@ -178,9 +245,13 @@ error: getter function appears to return the wrong field LL | / fn d_mut(&mut self) -> &mut u8 { LL | | LL | | &mut self.b - | | ----------- help: consider using: `&mut self.d` LL | | } | |_____^ + | +help: consider using + | +LL | &mut self.d + | error: aborting due to 18 previous errors diff --git a/src/tools/clippy/tests/ui/missing_asserts_for_indexing.stderr b/src/tools/clippy/tests/ui/missing_asserts_for_indexing.stderr index 2e63cd4a0e503..d0ce5f54d3430 100644 --- a/src/tools/clippy/tests/ui/missing_asserts_for_indexing.stderr +++ b/src/tools/clippy/tests/ui/missing_asserts_for_indexing.stderr @@ -1,8 +1,6 @@ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:30:5 | -LL | assert!(v.len() < 5); - | -------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)` LL | v[0] + v[1] + v[2] + v[3] + v[4] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -34,12 +32,14 @@ LL | v[0] + v[1] + v[2] + v[3] + v[4] = note: asserting the length before indexing will elide bounds checks = note: `-D clippy::missing-asserts-for-indexing` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::missing_asserts_for_indexing)]` +help: provide the highest index that is indexed with + | +LL | assert!(v.len() > 4); + | ~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:36:5 | -LL | assert!(v.len() <= 5); - | --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)` LL | v[0] + v[1] + v[2] + v[3] + v[4] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -69,12 +69,14 @@ note: slice indexed here LL | v[0] + v[1] + v[2] + v[3] + v[4] | ^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v.len() > 4); + | ~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:42:5 | -LL | assert!(v.len() > 3); - | -------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)` LL | v[0] + v[1] + v[2] + v[3] + v[4] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -104,12 +106,14 @@ note: slice indexed here LL | v[0] + v[1] + v[2] + v[3] + v[4] | ^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v.len() > 4); + | ~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:48:5 | -LL | assert!(v.len() >= 4); - | --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)` LL | v[0] + v[1] + v[2] + v[3] + v[4] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -139,12 +143,14 @@ note: slice indexed here LL | v[0] + v[1] + v[2] + v[3] + v[4] | ^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v.len() > 4); + | ~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:66:13 | -LL | assert!(v.len() >= 3); - | --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 3)` LL | let _ = v[0]; | _____________^ LL | | @@ -162,12 +168,14 @@ note: slice indexed here LL | let _ = v[1..4]; | ^^^^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v.len() > 3); + | ~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:80:13 | -LL | assert!(v.len() >= 4); - | --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)` LL | let _ = v[0]; | _____________^ LL | | @@ -185,13 +193,14 @@ note: slice indexed here LL | let _ = v[1..=4]; | ^^^^^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v.len() > 4); + | ~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:95:13 | -LL | assert!(v1.len() >= 12); - | ----------------------- help: provide the highest index that is indexed with: `assert!(v1.len() > 12)` -LL | assert!(v2.len() >= 15); LL | let _ = v1[0] + v1[12]; | ^^^^^^^^^^^^^^ | @@ -206,13 +215,14 @@ note: slice indexed here LL | let _ = v1[0] + v1[12]; | ^^^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v1.len() > 12); + | ~~~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:97:13 | -LL | assert!(v2.len() >= 15); - | ----------------------- help: provide the highest index that is indexed with: `assert!(v2.len() > 15)` -... LL | let _ = v2[5] + v2[15]; | ^^^^^^^^^^^^^^ | @@ -227,13 +237,14 @@ note: slice indexed here LL | let _ = v2[5] + v2[15]; | ^^^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v2.len() > 15); + | ~~~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:103:13 | -LL | assert!(v1.len() >= 12); - | ----------------------- help: provide the highest index that is indexed with: `assert!(v1.len() > 12)` -LL | assert!(v2.len() > 15); LL | let _ = v1[0] + v1[12]; | ^^^^^^^^^^^^^^ | @@ -248,13 +259,14 @@ note: slice indexed here LL | let _ = v1[0] + v1[12]; | ^^^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v1.len() > 12); + | ~~~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:127:13 | -LL | assert!(v1.len() == 2); - | ---------------------- help: provide the highest index that is indexed with: `assert!(v1.len() == 3)` -... LL | let _ = v1[0] + v1[1] + v1[2]; | ^^^^^^^^^^^^^^^^^^^^^ | @@ -274,13 +286,14 @@ note: slice indexed here LL | let _ = v1[0] + v1[1] + v1[2]; | ^^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v1.len() == 3); + | ~~~~~~~~~~~~~~~~~~~~~~ error: indexing into a slice multiple times with an `assert` that does not cover the highest index --> tests/ui/missing_asserts_for_indexing.rs:131:13 | -LL | assert!(2 == v3.len()); - | ---------------------- help: provide the highest index that is indexed with: `assert!(v3.len() == 3)` -... LL | let _ = v3[0] + v3[1] + v3[2]; | ^^^^^^^^^^^^^^^^^^^^^ | @@ -300,6 +313,10 @@ note: slice indexed here LL | let _ = v3[0] + v3[1] + v3[2]; | ^^^^^ = note: asserting the length before indexing will elide bounds checks +help: provide the highest index that is indexed with + | +LL | assert!(v3.len() == 3); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/missing_spin_loop.stderr b/src/tools/clippy/tests/ui/missing_spin_loop.stderr index 12f4b53a3d187..9c6971c261567 100644 --- a/src/tools/clippy/tests/ui/missing_spin_loop.stderr +++ b/src/tools/clippy/tests/ui/missing_spin_loop.stderr @@ -2,40 +2,69 @@ error: busy-waiting loop should at least have a spin loop hint --> tests/ui/missing_spin_loop.rs:10:37 | LL | while b.load(Ordering::Acquire) {} - | ^^ help: try: `{ std::hint::spin_loop() }` + | ^^ | = note: `-D clippy::missing-spin-loop` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::missing_spin_loop)]` +help: try + | +LL | while b.load(Ordering::Acquire) { std::hint::spin_loop() } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: busy-waiting loop should at least have a spin loop hint --> tests/ui/missing_spin_loop.rs:12:37 | LL | while !b.load(Ordering::SeqCst) {} - | ^^ help: try: `{ std::hint::spin_loop() }` + | ^^ + | +help: try + | +LL | while !b.load(Ordering::SeqCst) { std::hint::spin_loop() } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: busy-waiting loop should at least have a spin loop hint --> tests/ui/missing_spin_loop.rs:14:46 | LL | while b.load(Ordering::Acquire) == false {} - | ^^ help: try: `{ std::hint::spin_loop() }` + | ^^ + | +help: try + | +LL | while b.load(Ordering::Acquire) == false { std::hint::spin_loop() } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: busy-waiting loop should at least have a spin loop hint --> tests/ui/missing_spin_loop.rs:16:49 | LL | while { true == b.load(Ordering::Acquire) } {} - | ^^ help: try: `{ std::hint::spin_loop() }` + | ^^ + | +help: try + | +LL | while { true == b.load(Ordering::Acquire) } { std::hint::spin_loop() } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: busy-waiting loop should at least have a spin loop hint --> tests/ui/missing_spin_loop.rs:18:93 | LL | while b.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed) != Ok(true) {} - | ^^ help: try: `{ std::hint::spin_loop() }` + | ^^ + | +help: try + | +LL | while b.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed) != Ok(true) { std::hint::spin_loop() } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: busy-waiting loop should at least have a spin loop hint --> tests/ui/missing_spin_loop.rs:20:94 | LL | while Ok(false) != b.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) {} - | ^^ help: try: `{ std::hint::spin_loop() }` + | ^^ + | +help: try + | +LL | while Ok(false) != b.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) { std::hint::spin_loop() } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/missing_spin_loop_no_std.stderr b/src/tools/clippy/tests/ui/missing_spin_loop_no_std.stderr index 7911620d32c50..d75a5020f4a89 100644 --- a/src/tools/clippy/tests/ui/missing_spin_loop_no_std.stderr +++ b/src/tools/clippy/tests/ui/missing_spin_loop_no_std.stderr @@ -2,10 +2,14 @@ error: busy-waiting loop should at least have a spin loop hint --> tests/ui/missing_spin_loop_no_std.rs:12:37 | LL | while b.load(Ordering::Acquire) {} - | ^^ help: try: `{ core::hint::spin_loop() }` + | ^^ | = note: `-D clippy::missing-spin-loop` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::missing_spin_loop)]` +help: try + | +LL | while b.load(Ordering::Acquire) { core::hint::spin_loop() } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/missing_transmute_annotations.stderr b/src/tools/clippy/tests/ui/missing_transmute_annotations.stderr index 5903ed488ef18..748fdf1b157d0 100644 --- a/src/tools/clippy/tests/ui/missing_transmute_annotations.stderr +++ b/src/tools/clippy/tests/ui/missing_transmute_annotations.stderr @@ -2,75 +2,128 @@ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:35:19 | LL | i = std::mem::transmute([1u16, 2u16]); - | ^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>` + | ^^^^^^^^^ | = note: `-D clippy::missing-transmute-annotations` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::missing_transmute_annotations)]` +help: consider adding missing annotations + | +LL | i = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:37:19 | LL | i = std::mem::transmute::<_, _>([1u16, 2u16]); - | ^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>` + | ^^^^^^^^^^^^^^^^^ + | +help: consider adding missing annotations + | +LL | i = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:39:19 | LL | i = std::mem::transmute::<_, i32>([1u16, 2u16]); - | ^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider adding missing annotations + | +LL | i = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:41:19 | LL | i = std::mem::transmute::<[u16; 2], _>([1u16, 2u16]); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider adding missing annotations + | +LL | i = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:44:32 | LL | let x: i32 = bar(std::mem::transmute::<[u16; 2], _>([1u16, 2u16])); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider adding missing annotations + | +LL | let x: i32 = bar(std::mem::transmute::<[u16; 2], i32>([1u16, 2u16])); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:46:19 | LL | bar(std::mem::transmute::<[u16; 2], _>([1u16, 2u16])); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider adding missing annotations + | +LL | bar(std::mem::transmute::<[u16; 2], i32>([1u16, 2u16])); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:11:19 | LL | std::mem::transmute($e) - | ^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>` + | ^^^^^^^^^ ... LL | i = local_bad_transmute!([1u16, 2u16]); | ---------------------------------- in this macro invocation | = note: this error originates in the macro `local_bad_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider adding missing annotations + | +LL | std::mem::transmute::<[u16; 2], i32>($e) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:54:19 | LL | i = std::mem::transmute([0i16, 0i16]); - | ^^^^^^^^^ help: consider adding missing annotations: `transmute::<[i16; 2], i32>` + | ^^^^^^^^^ + | +help: consider adding missing annotations + | +LL | i = std::mem::transmute::<[i16; 2], i32>([0i16, 0i16]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:57:19 | LL | i = std::mem::transmute(Foo::A); - | ^^^^^^^^^ help: consider adding missing annotations: `transmute::` + | ^^^^^^^^^ + | +help: consider adding missing annotations + | +LL | i = std::mem::transmute::(Foo::A); + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:64:35 | LL | let x: _ = unsafe { std::mem::transmute::<_, i32>([1u16, 2u16]) }; - | ^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider adding missing annotations + | +LL | let x: _ = unsafe { std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute used without annotations --> tests/ui/missing_transmute_annotations.rs:67:30 | LL | let x: _ = std::mem::transmute::<_, i32>([1u16, 2u16]); - | ^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider adding missing annotations + | +LL | let x: _ = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/mistyped_literal_suffix.stderr b/src/tools/clippy/tests/ui/mistyped_literal_suffix.stderr index 56bfb06d8e669..6318737f383ee 100644 --- a/src/tools/clippy/tests/ui/mistyped_literal_suffix.stderr +++ b/src/tools/clippy/tests/ui/mistyped_literal_suffix.stderr @@ -2,99 +2,178 @@ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:16:18 | LL | let fail14 = 2_32; - | ^^^^ help: did you mean to write: `2_i32` + | ^^^^ | = note: `#[deny(clippy::mistyped_literal_suffixes)]` on by default +help: did you mean to write + | +LL | let fail14 = 2_i32; + | ~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:17:18 | LL | let fail15 = 4_64; - | ^^^^ help: did you mean to write: `4_i64` + | ^^^^ + | +help: did you mean to write + | +LL | let fail15 = 4_i64; + | ~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:18:18 | LL | let fail16 = 7_8; // - | ^^^ help: did you mean to write: `7_i8` + | ^^^ + | +help: did you mean to write + | +LL | let fail16 = 7_i8; // + | ~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:19:18 | LL | let fail17 = 23_16; // - | ^^^^^ help: did you mean to write: `23_i16` + | ^^^^^ + | +help: did you mean to write + | +LL | let fail17 = 23_i16; // + | ~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:22:18 | LL | let fail20 = 2__8; // - | ^^^^ help: did you mean to write: `2_i8` + | ^^^^ + | +help: did you mean to write + | +LL | let fail20 = 2_i8; // + | ~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:23:18 | LL | let fail21 = 4___16; // - | ^^^^^^ help: did you mean to write: `4_i16` + | ^^^^^^ + | +help: did you mean to write + | +LL | let fail21 = 4_i16; // + | ~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:26:18 | LL | let fail25 = 1E2_32; - | ^^^^^^ help: did you mean to write: `1E2_f32` + | ^^^^^^ + | +help: did you mean to write + | +LL | let fail25 = 1E2_f32; + | ~~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:27:18 | LL | let fail26 = 43E7_64; - | ^^^^^^^ help: did you mean to write: `43E7_f64` + | ^^^^^^^ + | +help: did you mean to write + | +LL | let fail26 = 43E7_f64; + | ~~~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:28:18 | LL | let fail27 = 243E17_32; - | ^^^^^^^^^ help: did you mean to write: `243E17_f32` + | ^^^^^^^^^ + | +help: did you mean to write + | +LL | let fail27 = 243E17_f32; + | ~~~~~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:29:18 | LL | let fail28 = 241251235E723_64; - | ^^^^^^^^^^^^^^^^ help: did you mean to write: `241_251_235E723_f64` + | ^^^^^^^^^^^^^^^^ + | +help: did you mean to write + | +LL | let fail28 = 241_251_235E723_f64; + | ~~~~~~~~~~~~~~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:33:18 | LL | let fail30 = 127_8; // should be i8 - | ^^^^^ help: did you mean to write: `127_i8` + | ^^^^^ + | +help: did you mean to write + | +LL | let fail30 = 127_i8; // should be i8 + | ~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:34:18 | LL | let fail31 = 240_8; // should be u8 - | ^^^^^ help: did you mean to write: `240_u8` + | ^^^^^ + | +help: did you mean to write + | +LL | let fail31 = 240_u8; // should be u8 + | ~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:36:18 | LL | let fail33 = 0x1234_16; - | ^^^^^^^^^ help: did you mean to write: `0x1234_i16` + | ^^^^^^^^^ + | +help: did you mean to write + | +LL | let fail33 = 0x1234_i16; + | ~~~~~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:37:18 | LL | let fail34 = 0xABCD_16; - | ^^^^^^^^^ help: did you mean to write: `0xABCD_u16` + | ^^^^^^^^^ + | +help: did you mean to write + | +LL | let fail34 = 0xABCD_u16; + | ~~~~~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:39:18 | LL | let fail36 = 0xFFFF_FFFF_FFFF_FFFF_64; // u64 - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean to write: `0xFFFF_FFFF_FFFF_FFFF_u64` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean to write + | +LL | let fail36 = 0xFFFF_FFFF_FFFF_FFFF_u64; // u64 + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: mistyped literal suffix --> tests/ui/mistyped_literal_suffix.rs:45:13 | LL | let _ = 1.12345E1_32; - | ^^^^^^^^^^^^ help: did you mean to write: `1.123_45E1_f32` + | ^^^^^^^^^^^^ + | +help: did you mean to write + | +LL | let _ = 1.123_45E1_f32; + | ~~~~~~~~~~~~~~ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/must_use_candidates.stderr b/src/tools/clippy/tests/ui/must_use_candidates.stderr index c64636ba44258..c8d107b72e85a 100644 --- a/src/tools/clippy/tests/ui/must_use_candidates.stderr +++ b/src/tools/clippy/tests/ui/must_use_candidates.stderr @@ -2,34 +2,58 @@ error: this function could have a `#[must_use]` attribute --> tests/ui/must_use_candidates.rs:11:1 | LL | pub fn pure(i: u8) -> u8 { - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pure(i: u8) -> u8` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::must-use-candidate` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::must_use_candidate)]` +help: add the attribute + | +LL | #[must_use] pub fn pure(i: u8) -> u8 { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this method could have a `#[must_use]` attribute --> tests/ui/must_use_candidates.rs:16:5 | LL | pub fn inherent_pure(&self) -> u8 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn inherent_pure(&self) -> u8` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add the attribute + | +LL | #[must_use] pub fn inherent_pure(&self) -> u8 { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this function could have a `#[must_use]` attribute --> tests/ui/must_use_candidates.rs:47:1 | LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add the attribute + | +LL | #[must_use] pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this function could have a `#[must_use]` attribute --> tests/ui/must_use_candidates.rs:59:1 | LL | pub fn rcd(_x: Rc) -> bool { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn rcd(_x: Rc) -> bool` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add the attribute + | +LL | #[must_use] pub fn rcd(_x: Rc) -> bool { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this function could have a `#[must_use]` attribute --> tests/ui/must_use_candidates.rs:67:1 | LL | pub fn arcd(_x: Arc) -> bool { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn arcd(_x: Arc) -> bool` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add the attribute + | +LL | #[must_use] pub fn arcd(_x: Arc) -> bool { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/must_use_unit.stderr b/src/tools/clippy/tests/ui/must_use_unit.stderr index c2ee2edda7dc5..e077fb4547336 100644 --- a/src/tools/clippy/tests/ui/must_use_unit.stderr +++ b/src/tools/clippy/tests/ui/must_use_unit.stderr @@ -1,29 +1,37 @@ error: this unit-returning function has a `#[must_use]` attribute --> tests/ui/must_use_unit.rs:10:1 | -LL | #[must_use] - | ----------- help: remove the attribute LL | pub fn must_use_default() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::must-use-unit` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::must_use_unit)]` +help: remove the attribute + | +LL - #[must_use] + | error: this unit-returning function has a `#[must_use]` attribute --> tests/ui/must_use_unit.rs:13:1 | -LL | #[must_use] - | ----------- help: remove the attribute LL | pub fn must_use_unit() -> () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the attribute + | +LL - #[must_use] + | error: this unit-returning function has a `#[must_use]` attribute --> tests/ui/must_use_unit.rs:16:1 | -LL | #[must_use = "With note"] - | ------------------------- help: remove the attribute LL | pub fn must_use_with_note() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the attribute + | +LL - #[must_use = "With note"] + | error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/mut_mutex_lock.stderr b/src/tools/clippy/tests/ui/mut_mutex_lock.stderr index a3d4905c04cb7..a30e2df9588f1 100644 --- a/src/tools/clippy/tests/ui/mut_mutex_lock.stderr +++ b/src/tools/clippy/tests/ui/mut_mutex_lock.stderr @@ -2,10 +2,14 @@ error: calling `&mut Mutex::lock` unnecessarily locks an exclusive (mutable) ref --> tests/ui/mut_mutex_lock.rs:10:33 | LL | let mut value = value_mutex.lock().unwrap(); - | ^^^^ help: change this to: `get_mut` + | ^^^^ | = note: `-D clippy::mut-mutex-lock` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::mut_mutex_lock)]` +help: change this to + | +LL | let mut value = value_mutex.get_mut().unwrap(); + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/needless_arbitrary_self_type.stderr b/src/tools/clippy/tests/ui/needless_arbitrary_self_type.stderr index c653267f7525b..953cafc2069ec 100644 --- a/src/tools/clippy/tests/ui/needless_arbitrary_self_type.stderr +++ b/src/tools/clippy/tests/ui/needless_arbitrary_self_type.stderr @@ -2,40 +2,69 @@ error: the type of the `self` parameter does not need to be arbitrary --> tests/ui/needless_arbitrary_self_type.rs:10:16 | LL | pub fn bad(self: Self) { - | ^^^^^^^^^^ help: consider to change this parameter to: `self` + | ^^^^^^^^^^ | = note: `-D clippy::needless-arbitrary-self-type` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_arbitrary_self_type)]` +help: consider to change this parameter to + | +LL | pub fn bad(self) { + | ~~~~ error: the type of the `self` parameter does not need to be arbitrary --> tests/ui/needless_arbitrary_self_type.rs:18:20 | LL | pub fn mut_bad(mut self: Self) { - | ^^^^^^^^^^^^^^ help: consider to change this parameter to: `mut self` + | ^^^^^^^^^^^^^^ + | +help: consider to change this parameter to + | +LL | pub fn mut_bad(mut self) { + | ~~~~~~~~ error: the type of the `self` parameter does not need to be arbitrary --> tests/ui/needless_arbitrary_self_type.rs:26:20 | LL | pub fn ref_bad(self: &Self) { - | ^^^^^^^^^^^ help: consider to change this parameter to: `&self` + | ^^^^^^^^^^^ + | +help: consider to change this parameter to + | +LL | pub fn ref_bad(&self) { + | ~~~~~ error: the type of the `self` parameter does not need to be arbitrary --> tests/ui/needless_arbitrary_self_type.rs:34:38 | LL | pub fn ref_bad_with_lifetime<'a>(self: &'a Self) { - | ^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'a self` + | ^^^^^^^^^^^^^^ + | +help: consider to change this parameter to + | +LL | pub fn ref_bad_with_lifetime<'a>(&'a self) { + | ~~~~~~~~ error: the type of the `self` parameter does not need to be arbitrary --> tests/ui/needless_arbitrary_self_type.rs:42:24 | LL | pub fn mut_ref_bad(self: &mut Self) { - | ^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&mut self` + | ^^^^^^^^^^^^^^^ + | +help: consider to change this parameter to + | +LL | pub fn mut_ref_bad(&mut self) { + | ~~~~~~~~~ error: the type of the `self` parameter does not need to be arbitrary --> tests/ui/needless_arbitrary_self_type.rs:50:42 | LL | pub fn mut_ref_bad_with_lifetime<'a>(self: &'a mut Self) { - | ^^^^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'a mut self` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider to change this parameter to + | +LL | pub fn mut_ref_bad_with_lifetime<'a>(&'a mut self) { + | ~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/needless_arbitrary_self_type_unfixable.stderr b/src/tools/clippy/tests/ui/needless_arbitrary_self_type_unfixable.stderr index b50e005756290..88d50e2a6a4e2 100644 --- a/src/tools/clippy/tests/ui/needless_arbitrary_self_type_unfixable.stderr +++ b/src/tools/clippy/tests/ui/needless_arbitrary_self_type_unfixable.stderr @@ -2,10 +2,14 @@ error: the type of the `self` parameter does not need to be arbitrary --> tests/ui/needless_arbitrary_self_type_unfixable.rs:42:31 | LL | fn call_with_mut_self(self: &mut Self) {} - | ^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&mut self` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::needless-arbitrary-self-type` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_arbitrary_self_type)]` +help: consider to change this parameter to + | +LL | fn call_with_mut_self(&mut self) {} + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/needless_bitwise_bool.stderr b/src/tools/clippy/tests/ui/needless_bitwise_bool.stderr index 9f14646c3e5ae..db72891322c4b 100644 --- a/src/tools/clippy/tests/ui/needless_bitwise_bool.stderr +++ b/src/tools/clippy/tests/ui/needless_bitwise_bool.stderr @@ -2,10 +2,14 @@ error: use of bitwise operator instead of lazy operator between booleans --> tests/ui/needless_bitwise_bool.rs:23:8 | LL | if y & !x { - | ^^^^^^ help: try: `y && !x` + | ^^^^^^ | = note: `-D clippy::needless-bitwise-bool` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_bitwise_bool)]` +help: try + | +LL | if y && !x { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/needless_bool/fixable.stderr b/src/tools/clippy/tests/ui/needless_bool/fixable.stderr index 99b5b99834486..69b2da8c3da3c 100644 --- a/src/tools/clippy/tests/ui/needless_bool/fixable.stderr +++ b/src/tools/clippy/tests/ui/needless_bool/fixable.stderr @@ -6,10 +6,14 @@ LL | | true LL | | } else { LL | | false LL | | }; - | |_____^ help: you can reduce it to: `x` + | |_____^ | = note: `-D clippy::needless-bool` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_bool)]` +help: you can reduce it to + | +LL | x; + | ~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:46:5 @@ -19,7 +23,12 @@ LL | | false LL | | } else { LL | | true LL | | }; - | |_____^ help: you can reduce it to: `!x` + | |_____^ + | +help: you can reduce it to + | +LL | !x; + | ~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:51:5 @@ -29,7 +38,12 @@ LL | | false LL | | } else { LL | | true LL | | }; - | |_____^ help: you can reduce it to: `!(x && y)` + | |_____^ + | +help: you can reduce it to + | +LL | !(x && y); + | ~~~~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:59:5 @@ -39,7 +53,12 @@ LL | | false LL | | } else { LL | | true LL | | }; - | |_____^ help: you can reduce it to: `a != b` + | |_____^ + | +help: you can reduce it to + | +LL | a != b; + | ~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:64:5 @@ -49,7 +68,12 @@ LL | | false LL | | } else { LL | | true LL | | }; - | |_____^ help: you can reduce it to: `a == b` + | |_____^ + | +help: you can reduce it to + | +LL | a == b; + | ~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:69:5 @@ -59,7 +83,12 @@ LL | | false LL | | } else { LL | | true LL | | }; - | |_____^ help: you can reduce it to: `a >= b` + | |_____^ + | +help: you can reduce it to + | +LL | a >= b; + | ~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:74:5 @@ -69,7 +98,12 @@ LL | | false LL | | } else { LL | | true LL | | }; - | |_____^ help: you can reduce it to: `a > b` + | |_____^ + | +help: you can reduce it to + | +LL | a > b; + | ~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:79:5 @@ -79,7 +113,12 @@ LL | | false LL | | } else { LL | | true LL | | }; - | |_____^ help: you can reduce it to: `a <= b` + | |_____^ + | +help: you can reduce it to + | +LL | a <= b; + | ~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:84:5 @@ -89,7 +128,12 @@ LL | | false LL | | } else { LL | | true LL | | }; - | |_____^ help: you can reduce it to: `a < b` + | |_____^ + | +help: you can reduce it to + | +LL | a < b; + | ~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:112:5 @@ -99,7 +143,12 @@ LL | | return true; LL | | } else { LL | | return false; LL | | }; - | |_____^ help: you can reduce it to: `return x` + | |_____^ + | +help: you can reduce it to + | +LL | return x; + | ~~~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:120:5 @@ -109,7 +158,12 @@ LL | | return false; LL | | } else { LL | | return true; LL | | }; - | |_____^ help: you can reduce it to: `return !x` + | |_____^ + | +help: you can reduce it to + | +LL | return !x; + | ~~~~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:128:5 @@ -119,7 +173,12 @@ LL | | return true; LL | | } else { LL | | return false; LL | | }; - | |_____^ help: you can reduce it to: `return x && y` + | |_____^ + | +help: you can reduce it to + | +LL | return x && y; + | ~~~~~~~~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:136:5 @@ -129,34 +188,58 @@ LL | | return false; LL | | } else { LL | | return true; LL | | }; - | |_____^ help: you can reduce it to: `return !(x && y)` + | |_____^ + | +help: you can reduce it to + | +LL | return !(x && y); + | ~~~~~~~~~~~~~~~~ error: equality checks against true are unnecessary --> tests/ui/needless_bool/fixable.rs:144:8 | LL | if x == true {}; - | ^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^ | = note: `-D clippy::bool-comparison` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]` +help: try simplifying it as shown + | +LL | if x {}; + | ~ error: equality checks against false can be replaced by a negation --> tests/ui/needless_bool/fixable.rs:148:8 | LL | if x == false {}; - | ^^^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !x {}; + | ~~ error: equality checks against true are unnecessary --> tests/ui/needless_bool/fixable.rs:158:8 | LL | if x == true {}; - | ^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if x {}; + | ~ error: equality checks against false can be replaced by a negation --> tests/ui/needless_bool/fixable.rs:159:8 | LL | if x == false {}; - | ^^^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !x {}; + | ~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:168:12 @@ -167,7 +250,12 @@ LL | | false LL | | } else { LL | | true LL | | }; - | |_____^ help: you can reduce it to: `{ !returns_bool() }` + | |_____^ + | +help: you can reduce it to + | +LL | } else { !returns_bool() }; + | ~~~~~~~~~~~~~~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:181:5 @@ -177,37 +265,67 @@ LL | | true LL | | } else { LL | | false LL | | }; - | |_____^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)` + | |_____^ + | +help: you can reduce it to + | +LL | (unsafe { no(4) } & 1 != 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:186:30 | LL | let _brackets_unneeded = if unsafe { no(4) } & 1 != 0 { true } else { false }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `unsafe { no(4) } & 1 != 0` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | let _brackets_unneeded = unsafe { no(4) } & 1 != 0; + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:189:9 | LL | if unsafe { no(4) } & 1 != 0 { true } else { false } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | (unsafe { no(4) } & 1 != 0) + | error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:200:14 | LL | let _x = if a && b { true } else { false }.then(|| todo!()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(a && b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | let _x = (a && b).then(|| todo!()); + | ~~~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:201:14 | LL | let _x = if a && b { true } else { false } as u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(a && b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | let _x = (a && b) as u8; + | ~~~~~~~~ error: this if-then-else expression returns a bool literal --> tests/ui/needless_bool/fixable.rs:204:14 | LL | let _x = if a { true } else { false }.then(|| todo!()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `a` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | let _x = a.then(|| todo!()); + | ~ error: aborting due to 24 previous errors diff --git a/src/tools/clippy/tests/ui/needless_bool_assign.stderr b/src/tools/clippy/tests/ui/needless_bool_assign.stderr index 2d80dded39c31..a1fe6f6bcb059 100644 --- a/src/tools/clippy/tests/ui/needless_bool_assign.stderr +++ b/src/tools/clippy/tests/ui/needless_bool_assign.stderr @@ -6,10 +6,14 @@ LL | | a.field = true; LL | | } else { LL | | a.field = false LL | | } - | |_____^ help: you can reduce it to: `a.field = random() && random();` + | |_____^ | = note: `-D clippy::needless-bool-assign` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_bool_assign)]` +help: you can reduce it to + | +LL | a.field = random() && random(); + | error: this if-then-else expression assigns a bool literal --> tests/ui/needless_bool_assign.rs:18:5 @@ -19,7 +23,12 @@ LL | | a.field = false; LL | | } else { LL | | a.field = true LL | | } - | |_____^ help: you can reduce it to: `a.field = !(random() && random());` + | |_____^ + | +help: you can reduce it to + | +LL | a.field = !(random() && random()); + | error: this if-then-else expression assigns a bool literal --> tests/ui/needless_bool_assign.rs:32:5 @@ -29,7 +38,12 @@ LL | | a.field = true; LL | | } else { LL | | a.field = true; LL | | } - | |_____^ help: you can reduce it to: `random(); a.field = true;` + | |_____^ + | +help: you can reduce it to + | +LL | random(); a.field = true; + | error: this `if` has identical blocks --> tests/ui/needless_bool_assign.rs:32:17 diff --git a/src/tools/clippy/tests/ui/needless_borrow.stderr b/src/tools/clippy/tests/ui/needless_borrow.stderr index bf0e265c25030..df32a38b18665 100644 --- a/src/tools/clippy/tests/ui/needless_borrow.stderr +++ b/src/tools/clippy/tests/ui/needless_borrow.stderr @@ -2,172 +2,311 @@ error: this expression creates a reference which is immediately dereferenced by --> tests/ui/needless_borrow.rs:15:15 | LL | let _ = x(&&a); // warn - | ^^^ help: change this to: `&a` + | ^^^ | = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` +help: change this to + | +LL | let _ = x(&a); // warn + | ~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:19:13 | LL | mut_ref(&mut &mut b); // warn - | ^^^^^^^^^^^ help: change this to: `&mut b` + | ^^^^^^^^^^^ + | +help: change this to + | +LL | mut_ref(&mut b); // warn + | ~~~~~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:31:13 | LL | &&a - | ^^^ help: change this to: `&a` + | ^^^ + | +help: change this to + | +LL | &a + | error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:33:15 | LL | 46 => &&a, - | ^^^ help: change this to: `&a` + | ^^^ + | +help: change this to + | +LL | 46 => &a, + | ~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:39:27 | LL | break &ref_a; - | ^^^^^^ help: change this to: `ref_a` + | ^^^^^^ + | +help: change this to + | +LL | break ref_a; + | ~~~~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:46:15 | LL | let _ = x(&&&a); - | ^^^^ help: change this to: `&a` + | ^^^^ + | +help: change this to + | +LL | let _ = x(&a); + | ~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:47:15 | LL | let _ = x(&mut &&a); - | ^^^^^^^^ help: change this to: `&a` + | ^^^^^^^^ + | +help: change this to + | +LL | let _ = x(&a); + | ~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:48:15 | LL | let _ = x(&&&mut b); - | ^^^^^^^^ help: change this to: `&mut b` + | ^^^^^^^^ + | +help: change this to + | +LL | let _ = x(&mut b); + | ~~~~~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:49:15 | LL | let _ = x(&&ref_a); - | ^^^^^^^ help: change this to: `ref_a` + | ^^^^^^^ + | +help: change this to + | +LL | let _ = x(ref_a); + | ~~~~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:52:11 | LL | x(&b); - | ^^ help: change this to: `b` + | ^^ + | +help: change this to + | +LL | x(b); + | ~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:59:13 | LL | mut_ref(&mut x); - | ^^^^^^ help: change this to: `x` + | ^^^^^^ + | +help: change this to + | +LL | mut_ref(x); + | ~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:60:13 | LL | mut_ref(&mut &mut x); - | ^^^^^^^^^^^ help: change this to: `x` + | ^^^^^^^^^^^ + | +help: change this to + | +LL | mut_ref(x); + | ~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:61:23 | LL | let y: &mut i32 = &mut x; - | ^^^^^^ help: change this to: `x` + | ^^^^^^ + | +help: change this to + | +LL | let y: &mut i32 = x; + | ~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:62:23 | LL | let y: &mut i32 = &mut &mut x; - | ^^^^^^^^^^^ help: change this to: `x` + | ^^^^^^^^^^^ + | +help: change this to + | +LL | let y: &mut i32 = x; + | ~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:71:14 | LL | 0 => &mut x, - | ^^^^^^ help: change this to: `x` + | ^^^^^^ + | +help: change this to + | +LL | 0 => x, + | ~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:77:14 | LL | 0 => &mut x, - | ^^^^^^ help: change this to: `x` + | ^^^^^^ + | +help: change this to + | +LL | 0 => x, + | ~ error: this expression borrows a value the compiler would automatically borrow --> tests/ui/needless_borrow.rs:89:13 | LL | let _ = (&x).0; - | ^^^^ help: change this to: `x` + | ^^^^ + | +help: change this to + | +LL | let _ = x.0; + | ~ error: this expression borrows a value the compiler would automatically borrow --> tests/ui/needless_borrow.rs:91:22 | LL | let _ = unsafe { (&*x).0 }; - | ^^^^^ help: change this to: `(*x)` + | ^^^^^ + | +help: change this to + | +LL | let _ = unsafe { (*x).0 }; + | ~~~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:101:5 | LL | (&&()).foo(); - | ^^^^^^ help: change this to: `(&())` + | ^^^^^^ + | +help: change this to + | +LL | (&()).foo(); + | ~~~~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:110:5 | LL | (&&5).foo(); - | ^^^^^ help: change this to: `(&5)` + | ^^^^^ + | +help: change this to + | +LL | (&5).foo(); + | ~~~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:136:23 | LL | let x: (&str,) = (&"",); - | ^^^ help: change this to: `""` + | ^^^ + | +help: change this to + | +LL | let x: (&str,) = ("",); + | ~~ error: this expression borrows a value the compiler would automatically borrow --> tests/ui/needless_borrow.rs:178:13 | LL | (&self.f)() - | ^^^^^^^^^ help: change this to: `(self.f)` + | ^^^^^^^^^ + | +help: change this to + | +LL | (self.f)() + | ~~~~~~~~ error: this expression borrows a value the compiler would automatically borrow --> tests/ui/needless_borrow.rs:187:13 | LL | (&mut self.f)() - | ^^^^^^^^^^^^^ help: change this to: `(self.f)` + | ^^^^^^^^^^^^^ + | +help: change this to + | +LL | (self.f)() + | ~~~~~~~~ error: this expression borrows a value the compiler would automatically borrow --> tests/ui/needless_borrow.rs:224:22 | LL | let _ = &mut (&mut { x.u }).x; - | ^^^^^^^^^^^^^^ help: change this to: `{ x.u }` + | ^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _ = &mut { x.u }.x; + | ~~~~~~~ error: this expression borrows a value the compiler would automatically borrow --> tests/ui/needless_borrow.rs:231:22 | LL | let _ = &mut (&mut { x.u }).x; - | ^^^^^^^^^^^^^^ help: change this to: `{ x.u }` + | ^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _ = &mut { x.u }.x; + | ~~~~~~~ error: this expression borrows a value the compiler would automatically borrow --> tests/ui/needless_borrow.rs:235:22 | LL | let _ = &mut (&mut x.u).x; - | ^^^^^^^^^^ help: change this to: `x.u` + | ^^^^^^^^^^ + | +help: change this to + | +LL | let _ = &mut x.u.x; + | ~~~ error: this expression borrows a value the compiler would automatically borrow --> tests/ui/needless_borrow.rs:236:22 | LL | let _ = &mut (&mut { x.u }).x; - | ^^^^^^^^^^^^^^ help: change this to: `{ x.u }` + | ^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _ = &mut { x.u }.x; + | ~~~~~~~ error: this expression creates a reference which is immediately dereferenced by the compiler --> tests/ui/needless_borrow.rs:257:23 | LL | option.unwrap_or((&x.0,)); - | ^^^^ help: change this to: `x.0` + | ^^^^ + | +help: change this to + | +LL | option.unwrap_or((x.0,)); + | ~~~ error: aborting due to 28 previous errors diff --git a/src/tools/clippy/tests/ui/needless_borrow_pat.stderr b/src/tools/clippy/tests/ui/needless_borrow_pat.stderr index 2ad6944903967..5a6d1c32ef57d 100644 --- a/src/tools/clippy/tests/ui/needless_borrow_pat.stderr +++ b/src/tools/clippy/tests/ui/needless_borrow_pat.stderr @@ -2,10 +2,14 @@ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:59:14 | LL | Some(ref x) => x, - | ^^^^^ help: try: `x` + | ^^^^^ | = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` +help: try + | +LL | Some(x) => x, + | ~ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:67:14 @@ -36,13 +40,23 @@ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:85:14 | LL | Some(ref x) => m1!(x), - | ^^^^^ help: try: `x` + | ^^^^^ + | +help: try + | +LL | Some(x) => m1!(x), + | ~ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:91:15 | LL | let _ = |&ref x: &&String| { - | ^^^^^ help: try: `x` + | ^^^^^ + | +help: try + | +LL | let _ = |&x: &&String| { + | ~ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:97:10 @@ -61,7 +75,12 @@ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:108:14 | LL | Some(ref x) => x.0, - | ^^^^^ help: try: `x` + | ^^^^^ + | +help: try + | +LL | Some(x) => x.0, + | ~ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:119:14 @@ -78,7 +97,12 @@ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:126:21 | LL | if let Some(ref x) = Some(&String::new()); - | ^^^^^ help: try: `x` + | ^^^^^ + | +help: try + | +LL | if let Some(x) = Some(&String::new()); + | ~ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:135:12 @@ -98,7 +122,12 @@ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:143:11 | LL | fn f(&ref x: &&String) { - | ^^^^^ help: try: `x` + | ^^^^^ + | +help: try + | +LL | fn f(&x: &&String) { + | ~ error: this pattern creates a reference to a reference --> tests/ui/needless_borrow_pat.rs:152:11 diff --git a/src/tools/clippy/tests/ui/needless_borrows_for_generic_args.stderr b/src/tools/clippy/tests/ui/needless_borrows_for_generic_args.stderr index fba0755d14b5f..c4b0e179caf0c 100644 --- a/src/tools/clippy/tests/ui/needless_borrows_for_generic_args.stderr +++ b/src/tools/clippy/tests/ui/needless_borrows_for_generic_args.stderr @@ -2,70 +2,124 @@ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:16:37 | LL | let _ = Command::new("ls").args(&["-a", "-l"]).status().unwrap(); - | ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]` + | ^^^^^^^^^^^^^ | = note: `-D clippy::needless-borrows-for-generic-args` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrows_for_generic_args)]` +help: change this to + | +LL | let _ = Command::new("ls").args(["-a", "-l"]).status().unwrap(); + | ~~~~~~~~~~~~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:17:33 | LL | let _ = Path::new(".").join(&&"."); - | ^^^^^ help: change this to: `"."` + | ^^^^^ + | +help: change this to + | +LL | let _ = Path::new(".").join("."); + | ~~~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:21:33 | LL | let _ = std::fs::write("x", &"".to_string()); - | ^^^^^^^^^^^^^^^ help: change this to: `"".to_string()` + | ^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _ = std::fs::write("x", "".to_string()); + | ~~~~~~~~~~~~~~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:36:27 | LL | deref_target_is_x(&X); - | ^^ help: change this to: `X` + | ^^ + | +help: change this to + | +LL | deref_target_is_x(X); + | ~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:49:30 | LL | multiple_constraints(&[[""]]); - | ^^^^^^^ help: change this to: `[[""]]` + | ^^^^^^^ + | +help: change this to + | +LL | multiple_constraints([[""]]); + | ~~~~~~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:69:49 | LL | multiple_constraints_normalizes_to_same(&X, X); - | ^^ help: change this to: `X` + | ^^ + | +help: change this to + | +LL | multiple_constraints_normalizes_to_same(X, X); + | ~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:127:24 | LL | takes_iter(&mut x) - | ^^^^^^ help: change this to: `x` + | ^^^^^^ + | +help: change this to + | +LL | takes_iter(x) + | ~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:136:41 | LL | let _ = Command::new("ls").args(&["-a", "-l"]).status().unwrap(); - | ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]` + | ^^^^^^^^^^^^^ + | +help: change this to + | +LL | let _ = Command::new("ls").args(["-a", "-l"]).status().unwrap(); + | ~~~~~~~~~~~~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:247:13 | LL | foo(&a); - | ^^ help: change this to: `a` + | ^^ + | +help: change this to + | +LL | foo(a); + | ~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:331:11 | LL | f(&String::new()); // Lint, makes no difference - | ^^^^^^^^^^^^^^ help: change this to: `String::new()` + | ^^^^^^^^^^^^^^ + | +help: change this to + | +LL | f(String::new()); // Lint, makes no difference + | ~~~~~~~~~~~~~ error: the borrowed expression implements the required traits --> tests/ui/needless_borrows_for_generic_args.rs:334:11 | LL | f(&"".to_owned()); // Lint - | ^^^^^^^^^^^^^^ help: change this to: `"".to_owned()` + | ^^^^^^^^^^^^^^ + | +help: change this to + | +LL | f("".to_owned()); // Lint + | ~~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/needless_character_iteration.stderr b/src/tools/clippy/tests/ui/needless_character_iteration.stderr index 7966033555f5b..4844d6a02d368 100644 --- a/src/tools/clippy/tests/ui/needless_character_iteration.stderr +++ b/src/tools/clippy/tests/ui/needless_character_iteration.stderr @@ -2,40 +2,69 @@ error: checking if a string is ascii using iterators --> tests/ui/needless_character_iteration.rs:18:5 | LL | "foo".chars().all(|c| c.is_ascii()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"foo".is_ascii()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::needless-character-iteration` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_character_iteration)]` +help: try + | +LL | "foo".is_ascii(); + | ~~~~~~~~~~~~~~~~ error: checking if a string is ascii using iterators --> tests/ui/needless_character_iteration.rs:20:5 | LL | "foo".chars().any(|c| !c.is_ascii()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!"foo".is_ascii()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | !"foo".is_ascii(); + | ~~~~~~~~~~~~~~~~~ error: checking if a string is ascii using iterators --> tests/ui/needless_character_iteration.rs:22:5 | LL | "foo".chars().all(|c| char::is_ascii(&c)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"foo".is_ascii()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | "foo".is_ascii(); + | ~~~~~~~~~~~~~~~~ error: checking if a string is ascii using iterators --> tests/ui/needless_character_iteration.rs:24:5 | LL | "foo".chars().any(|c| !char::is_ascii(&c)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!"foo".is_ascii()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | !"foo".is_ascii(); + | ~~~~~~~~~~~~~~~~~ error: checking if a string is ascii using iterators --> tests/ui/needless_character_iteration.rs:28:5 | LL | s.chars().all(|c| c.is_ascii()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.is_ascii()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | s.is_ascii(); + | ~~~~~~~~~~~~ error: checking if a string is ascii using iterators --> tests/ui/needless_character_iteration.rs:30:5 | LL | "foo".to_string().chars().any(|c| !c.is_ascii()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!"foo".to_string().is_ascii()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | !"foo".to_string().is_ascii(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: checking if a string is ascii using iterators --> tests/ui/needless_character_iteration.rs:33:5 @@ -45,7 +74,12 @@ LL | | LL | | let x = c; LL | | x.is_ascii() LL | | }); - | |______^ help: try: `"foo".is_ascii()` + | |______^ + | +help: try + | +LL | "foo".is_ascii(); + | ~~~~~~~~~~~~~~~~ error: checking if a string is ascii using iterators --> tests/ui/needless_character_iteration.rs:38:5 @@ -55,13 +89,23 @@ LL | | LL | | let x = c; LL | | !x.is_ascii() LL | | }); - | |______^ help: try: `!"foo".is_ascii()` + | |______^ + | +help: try + | +LL | !"foo".is_ascii(); + | ~~~~~~~~~~~~~~~~~ error: checking if a string is ascii using iterators --> tests/ui/needless_character_iteration.rs:44:5 | LL | S::default().field().chars().all(|x| x.is_ascii()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `S::default().field().is_ascii()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | S::default().field().is_ascii(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/needless_collect.stderr b/src/tools/clippy/tests/ui/needless_collect.stderr index ea317896d3684..54650a72e6301 100644 --- a/src/tools/clippy/tests/ui/needless_collect.stderr +++ b/src/tools/clippy/tests/ui/needless_collect.stderr @@ -2,118 +2,216 @@ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:9:29 | LL | let len = sample.iter().collect::>().len(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::needless-collect` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_collect)]` +help: replace with + | +LL | let len = sample.iter().count(); + | ~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:10:22 | LL | if sample.iter().collect::>().is_empty() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | if sample.iter().next().is_none() { + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:13:28 | LL | sample.iter().cloned().collect::>().contains(&1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | sample.iter().cloned().any(|x| x == 1); + | ~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:18:35 | LL | sample.iter().map(|x| (x, x)).collect::>().is_empty(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | sample.iter().map(|x| (x, x)).next().is_none(); + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:19:35 | LL | sample.iter().map(|x| (x, x)).collect::>().is_empty(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | sample.iter().map(|x| (x, x)).next().is_none(); + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:26:19 | LL | sample.iter().collect::>().len(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | sample.iter().count(); + | ~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:27:19 | LL | sample.iter().collect::>().is_empty(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | sample.iter().next().is_none(); + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:28:28 | LL | sample.iter().cloned().collect::>().contains(&1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | sample.iter().cloned().any(|x| x == 1); + | ~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:29:19 | LL | sample.iter().collect::>().contains(&&1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | sample.iter().any(|x| x == &1); + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:32:19 | LL | sample.iter().collect::>().len(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | sample.iter().count(); + | ~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:33:19 | LL | sample.iter().collect::>().is_empty(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | sample.iter().next().is_none(); + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:38:27 | LL | let _ = sample.iter().collect::>().is_empty(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = sample.iter().next().is_none(); + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:39:27 | LL | let _ = sample.iter().collect::>().contains(&&0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = sample.iter().any(|x| x == &0); + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:61:27 | LL | let _ = sample.iter().collect::>().is_empty(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = sample.iter().next().is_none(); + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:62:27 | LL | let _ = sample.iter().collect::>().contains(&&0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | let _ = sample.iter().any(|x| x == &0); + | ~~~~~~~~~~~~~~~~ error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:66:40 | LL | Vec::::new().extend((0..10).collect::>()); - | ^^^^^^^^^^^^^^^^^^^^ help: remove this call + | ^^^^^^^^^^^^^^^^^^^^ + | +help: remove this call + | +LL - Vec::::new().extend((0..10).collect::>()); +LL + Vec::::new().extend((0..10)); + | error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:67:20 | LL | foo((0..10).collect::>()); - | ^^^^^^^^^^^^^^^^^^^^ help: remove this call + | ^^^^^^^^^^^^^^^^^^^^ + | +help: remove this call + | +LL - foo((0..10).collect::>()); +LL + foo((0..10)); + | error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:68:49 | LL | bar((0..10).collect::>(), (0..10).collect::>()); - | ^^^^^^^^^^^^^^^^^^^^ help: remove this call + | ^^^^^^^^^^^^^^^^^^^^ + | +help: remove this call + | +LL - bar((0..10).collect::>(), (0..10).collect::>()); +LL + bar((0..10).collect::>(), (0..10)); + | error: avoid using `collect()` when not needed --> tests/ui/needless_collect.rs:69:37 | LL | baz((0..10), (), ('a'..='z').collect::>()) - | ^^^^^^^^^^^^^^^^^^^^ help: remove this call + | ^^^^^^^^^^^^^^^^^^^^ + | +help: remove this call + | +LL - baz((0..10), (), ('a'..='z').collect::>()) +LL + baz((0..10), (), ('a'..='z')) + | error: aborting due to 19 previous errors diff --git a/src/tools/clippy/tests/ui/needless_else.stderr b/src/tools/clippy/tests/ui/needless_else.stderr index 77ead31b31cc9..27126b9415cad 100644 --- a/src/tools/clippy/tests/ui/needless_else.stderr +++ b/src/tools/clippy/tests/ui/needless_else.stderr @@ -4,10 +4,16 @@ error: this `else` branch is empty LL | } else { | _______^ LL | | } - | |_____^ help: you can remove it + | |_____^ | = note: `-D clippy::needless-else` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_else)]` +help: you can remove it + | +LL - } else { +LL - } +LL + } + | error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/needless_if.stderr b/src/tools/clippy/tests/ui/needless_if.stderr index 9beae596ee39d..0e5bae40bc70e 100644 --- a/src/tools/clippy/tests/ui/needless_if.stderr +++ b/src/tools/clippy/tests/ui/needless_if.stderr @@ -2,16 +2,25 @@ error: this `if` branch is empty --> tests/ui/needless_if.rs:27:5 | LL | if (true) {} - | ^^^^^^^^^^^^ help: you can remove it + | ^^^^^^^^^^^^ | = note: `-D clippy::needless-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_if)]` +help: you can remove it + | +LL - if (true) {} + | error: this `if` branch is empty --> tests/ui/needless_if.rs:29:5 | LL | if maybe_side_effect() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `maybe_side_effect();` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can remove it + | +LL | maybe_side_effect(); + | error: this `if` branch is empty --> tests/ui/needless_if.rs:34:5 @@ -57,19 +66,34 @@ error: this `if` branch is empty --> tests/ui/needless_if.rs:94:5 | LL | if { maybe_side_effect() } {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `({ maybe_side_effect() });` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can remove it + | +LL | ({ maybe_side_effect() }); + | error: this `if` branch is empty --> tests/ui/needless_if.rs:96:5 | LL | if { maybe_side_effect() } && true {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `({ maybe_side_effect() } && true);` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can remove it + | +LL | ({ maybe_side_effect() } && true); + | error: this `if` branch is empty --> tests/ui/needless_if.rs:100:5 | LL | if true {} - | ^^^^^^^^^^ help: you can remove it: `true;` + | ^^^^^^^^^^ + | +help: you can remove it + | +LL | true; + | error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/needless_match.stderr b/src/tools/clippy/tests/ui/needless_match.stderr index 5bcab467aeae3..f4378196226f2 100644 --- a/src/tools/clippy/tests/ui/needless_match.stderr +++ b/src/tools/clippy/tests/ui/needless_match.stderr @@ -8,10 +8,14 @@ LL | | 1 => 1, LL | | 2 => 2, LL | | _ => i, LL | | }; - | |_____^ help: replace it with: `i` + | |_____^ | = note: `-D clippy::needless-match` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_match)]` +help: replace it with + | +LL | let _: i32 = i; + | ~ error: this match expression is unnecessary --> tests/ui/needless_match.rs:22:19 @@ -22,7 +26,12 @@ LL | | "a" => "a", LL | | "b" => "b", LL | | s => s, LL | | }; - | |_____^ help: replace it with: `s` + | |_____^ + | +help: replace it with + | +LL | let _: &str = s; + | ~ error: this match expression is unnecessary --> tests/ui/needless_match.rs:31:21 @@ -34,7 +43,12 @@ LL | | Simple::B => Simple::B, LL | | Simple::C => Simple::C, LL | | Simple::D => Simple::D, LL | | }; - | |_____^ help: replace it with: `se` + | |_____^ + | +help: replace it with + | +LL | let _: Simple = se; + | ~~ error: this match expression is unnecessary --> tests/ui/needless_match.rs:53:26 @@ -44,7 +58,12 @@ LL | let _: Option = match x { LL | | Some(a) => Some(a), LL | | None => None, LL | | }; - | |_____^ help: replace it with: `x` + | |_____^ + | +help: replace it with + | +LL | let _: Option = x; + | ~ error: this match expression is unnecessary --> tests/ui/needless_match.rs:69:31 @@ -54,7 +73,12 @@ LL | let _: Result = match Ok(1) { LL | | Ok(a) => Ok(a), LL | | Err(err) => Err(err), LL | | }; - | |_____^ help: replace it with: `Ok(1)` + | |_____^ + | +help: replace it with + | +LL | let _: Result = Ok(1); + | ~~~~~ error: this match expression is unnecessary --> tests/ui/needless_match.rs:73:31 @@ -64,25 +88,45 @@ LL | let _: Result = match func_ret_err(0_i32) { LL | | Err(err) => Err(err), LL | | Ok(a) => Ok(a), LL | | }; - | |_____^ help: replace it with: `func_ret_err(0_i32)` + | |_____^ + | +help: replace it with + | +LL | let _: Result = func_ret_err(0_i32); + | ~~~~~~~~~~~~~~~~~~~ error: this if-let expression is unnecessary --> tests/ui/needless_match.rs:86:13 | LL | let _ = if let Some(a) = Some(1) { Some(a) } else { None }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `Some(1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = Some(1); + | ~~~~~~~ error: this if-let expression is unnecessary --> tests/ui/needless_match.rs:121:31 | LL | let _: Result = if let Err(e) = x { Err(e) } else { x }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _: Result = x; + | ~ error: this if-let expression is unnecessary --> tests/ui/needless_match.rs:122:31 | LL | let _: Result = if let Ok(val) = x { Ok(val) } else { x }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _: Result = x; + | ~ error: this if-let expression is unnecessary --> tests/ui/needless_match.rs:129:21 @@ -95,7 +139,12 @@ LL | | Simple::B ... | LL | | x LL | | }; - | |_____^ help: replace it with: `x` + | |_____^ + | +help: replace it with + | +LL | let _: Simple = x; + | ~ error: this match expression is unnecessary --> tests/ui/needless_match.rs:168:26 @@ -108,7 +157,12 @@ LL | | Complex::C(a, b, c) => Complex::C(a, b, c), LL | | Complex::D(E::VariantA(ea, eb), b) => Complex::D(E::VariantA(ea, eb), b), LL | | Complex::D(E::VariantB(ea, eb), b) => Complex::D(E::VariantB(ea, eb), b), LL | | }; - | |_________^ help: replace it with: `ce` + | |_________^ + | +help: replace it with + | +LL | let _: Complex = ce; + | ~~ error: this match expression is unnecessary --> tests/ui/needless_match.rs:252:17 @@ -118,7 +172,12 @@ LL | let _ = match e { LL | | _ if some_bool => e, LL | | _ => e, LL | | }; - | |_________^ help: replace it with: `e` + | |_________^ + | +help: replace it with + | +LL | let _ = e; + | ~ error: this match expression is unnecessary --> tests/ui/needless_match.rs:258:17 @@ -129,7 +188,12 @@ LL | | Some(i) => Some(i), LL | | _ if some_bool => e, LL | | _ => e, LL | | }; - | |_________^ help: replace it with: `e` + | |_________^ + | +help: replace it with + | +LL | let _ = e; + | ~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/needless_option_as_deref.stderr b/src/tools/clippy/tests/ui/needless_option_as_deref.stderr index a05d0aa9276ac..7107c89bef5ab 100644 --- a/src/tools/clippy/tests/ui/needless_option_as_deref.stderr +++ b/src/tools/clippy/tests/ui/needless_option_as_deref.stderr @@ -2,22 +2,36 @@ error: derefed type is same as origin --> tests/ui/needless_option_as_deref.rs:7:29 | LL | let _: Option<&usize> = Some(&1).as_deref(); - | ^^^^^^^^^^^^^^^^^^^ help: try: `Some(&1)` + | ^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::needless-option-as-deref` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_option_as_deref)]` +help: try + | +LL | let _: Option<&usize> = Some(&1); + | ~~~~~~~~ error: derefed type is same as origin --> tests/ui/needless_option_as_deref.rs:8:33 | LL | let _: Option<&mut usize> = Some(&mut 1).as_deref_mut(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(&mut 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: Option<&mut usize> = Some(&mut 1); + | ~~~~~~~~~~~~ error: derefed type is same as origin --> tests/ui/needless_option_as_deref.rs:12:13 | LL | let _ = x.as_deref_mut(); - | ^^^^^^^^^^^^^^^^ help: try: `x` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x; + | ~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/needless_option_take.stderr b/src/tools/clippy/tests/ui/needless_option_take.stderr index 4a73ccb86d081..d6eb51f5650bc 100644 --- a/src/tools/clippy/tests/ui/needless_option_take.stderr +++ b/src/tools/clippy/tests/ui/needless_option_take.stderr @@ -2,10 +2,14 @@ error: called `Option::take()` on a temporary value --> tests/ui/needless_option_take.rs:12:5 | LL | x.as_ref().take(); - | ^^^^^^^^^^^^^^^^^ help: try: `x.as_ref()` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::needless-option-take` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_option_take)]` +help: try + | +LL | x.as_ref(); + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/needless_parens_on_range_literals.stderr b/src/tools/clippy/tests/ui/needless_parens_on_range_literals.stderr index d293ecce69fbd..dc1fdaa2038a1 100644 --- a/src/tools/clippy/tests/ui/needless_parens_on_range_literals.stderr +++ b/src/tools/clippy/tests/ui/needless_parens_on_range_literals.stderr @@ -2,40 +2,69 @@ error: needless parenthesis on range literals can be removed --> tests/ui/needless_parens_on_range_literals.rs:7:13 | LL | let _ = ('a')..=('z'); - | ^^^^^ help: try: `'a'` + | ^^^^^ | = note: `-D clippy::needless-parens-on-range-literals` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_parens_on_range_literals)]` +help: try + | +LL | let _ = 'a'..=('z'); + | ~~~ error: needless parenthesis on range literals can be removed --> tests/ui/needless_parens_on_range_literals.rs:7:21 | LL | let _ = ('a')..=('z'); - | ^^^^^ help: try: `'z'` + | ^^^^^ + | +help: try + | +LL | let _ = ('a')..='z'; + | ~~~ error: needless parenthesis on range literals can be removed --> tests/ui/needless_parens_on_range_literals.rs:8:18 | LL | let _ = 'a'..('z'); - | ^^^^^ help: try: `'z'` + | ^^^^^ + | +help: try + | +LL | let _ = 'a'..'z'; + | ~~~ error: needless parenthesis on range literals can be removed --> tests/ui/needless_parens_on_range_literals.rs:10:19 | LL | let _ = (1.)..(2.); - | ^^^^ help: try: `2.` + | ^^^^ + | +help: try + | +LL | let _ = (1.)..2.; + | ~~ error: needless parenthesis on range literals can be removed --> tests/ui/needless_parens_on_range_literals.rs:11:13 | LL | let _ = ('a')..; - | ^^^^^ help: try: `'a'` + | ^^^^^ + | +help: try + | +LL | let _ = 'a'..; + | ~~~ error: needless parenthesis on range literals can be removed --> tests/ui/needless_parens_on_range_literals.rs:12:15 | LL | let _ = ..('z'); - | ^^^^^ help: try: `'z'` + | ^^^^^ + | +help: try + | +LL | let _ = ..'z'; + | ~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/needless_pass_by_ref_mut.stderr b/src/tools/clippy/tests/ui/needless_pass_by_ref_mut.stderr index 51e3ba37dede1..fb203f4e08c26 100644 --- a/src/tools/clippy/tests/ui/needless_pass_by_ref_mut.stderr +++ b/src/tools/clippy/tests/ui/needless_pass_by_ref_mut.stderr @@ -2,218 +2,382 @@ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:11:11 | LL | fn foo(s: &mut Vec, b: &u32, x: &mut u32) { - | ^^^^^^^^^^^^^ help: consider changing to: `&Vec` + | ^^^^^^^^^^^^^ | = note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]` +help: consider changing to + | +LL | fn foo(s: &Vec, b: &u32, x: &mut u32) { + | ~~~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:36:12 | LL | fn foo6(s: &mut Vec) { - | ^^^^^^^^^^^^^ help: consider changing to: `&Vec` + | ^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn foo6(s: &Vec) { + | ~~~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:46:12 | LL | fn bar(&mut self) {} - | ^^^^^^^^^ help: consider changing to: `&self` + | ^^^^^^^^^ + | +help: consider changing to + | +LL | fn bar(&self) {} + | ~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:49:29 | LL | fn mushroom(&self, vec: &mut Vec) -> usize { - | ^^^^^^^^^^^^^ help: consider changing to: `&Vec` + | ^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn mushroom(&self, vec: &Vec) -> usize { + | ~~~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:126:16 | LL | async fn a1(x: &mut i32) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn a1(x: &i32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:130:16 | LL | async fn a2(x: &mut i32, y: String) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn a2(x: &i32, y: String) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:134:16 | LL | async fn a3(x: &mut i32, y: String, z: String) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn a3(x: &i32, y: String, z: String) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:138:16 | LL | async fn a4(x: &mut i32, y: i32) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn a4(x: &i32, y: i32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:142:24 | LL | async fn a5(x: i32, y: &mut i32) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn a5(x: i32, y: &i32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:146:24 | LL | async fn a6(x: i32, y: &mut i32) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn a6(x: i32, y: &i32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:150:32 | LL | async fn a7(x: i32, y: i32, z: &mut i32) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn a7(x: i32, y: i32, z: &i32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:154:24 | LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn a8(x: i32, a: &i32, y: i32, z: &mut i32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:154:45 | LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &i32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:188:16 | LL | fn cfg_warn(s: &mut u32) {} - | ^^^^^^^^ help: consider changing to: `&u32` + | ^^^^^^^^ | = note: this is cfg-gated and may require further changes +help: consider changing to + | +LL | fn cfg_warn(s: &u32) {} + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:194:20 | LL | fn cfg_warn(s: &mut u32) {} - | ^^^^^^^^ help: consider changing to: `&u32` + | ^^^^^^^^ | = note: this is cfg-gated and may require further changes +help: consider changing to + | +LL | fn cfg_warn(s: &u32) {} + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:208:39 | LL | async fn inner_async2(x: &mut i32, y: &mut u32) { - | ^^^^^^^^ help: consider changing to: `&u32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn inner_async2(x: &mut i32, y: &u32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:216:26 | LL | async fn inner_async3(x: &mut i32, y: &mut u32) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn inner_async3(x: &i32, y: &mut u32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:235:34 | LL | pub async fn call_in_closure1(n: &mut str) { - | ^^^^^^^^ help: consider changing to: `&str` + | ^^^^^^^^ | = warning: changing this function will impact semver compatibility +help: consider changing to + | +LL | pub async fn call_in_closure1(n: &str) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:254:20 | LL | pub fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize { - | ^^^^^^^^^^ help: consider changing to: `&usize` + | ^^^^^^^^^^ | = warning: changing this function will impact semver compatibility +help: consider changing to + | +LL | pub fn closure2(n: &usize) -> impl '_ + FnMut() -> usize { + | ~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:265:26 | LL | pub async fn closure4(n: &mut usize) { - | ^^^^^^^^^^ help: consider changing to: `&usize` + | ^^^^^^^^^^ | = warning: changing this function will impact semver compatibility +help: consider changing to + | +LL | pub async fn closure4(n: &usize) { + | ~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:314:12 | LL | fn bar(&mut self) {} - | ^^^^^^^^^ help: consider changing to: `&self` + | ^^^^^^^^^ + | +help: consider changing to + | +LL | fn bar(&self) {} + | ~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:316:18 | LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) { - | ^^^^^^^^^ help: consider changing to: `&self` + | ^^^^^^^^^ + | +help: consider changing to + | +LL | async fn foo(&self, u: &mut i32, v: &mut u32) { + | ~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:316:45 | LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) { - | ^^^^^^^^ help: consider changing to: `&u32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn foo(&mut self, u: &mut i32, v: &u32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:324:46 | LL | async fn foo2(&mut self, u: &mut i32, v: &mut u32) { - | ^^^^^^^^ help: consider changing to: `&u32` + | ^^^^^^^^ + | +help: consider changing to + | +LL | async fn foo2(&mut self, u: &mut i32, v: &u32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:340:18 | LL | fn _empty_tup(x: &mut (())) {} - | ^^^^^^^^^ help: consider changing to: `&()` + | ^^^^^^^^^ + | +help: consider changing to + | +LL | fn _empty_tup(x: &()) {} + | ~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:341:19 | LL | fn _single_tup(x: &mut ((i32,))) {} - | ^^^^^^^^^^^^^ help: consider changing to: `&(i32,)` + | ^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn _single_tup(x: &(i32,)) {} + | ~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:342:18 | LL | fn _multi_tup(x: &mut ((i32, u32))) {} - | ^^^^^^^^^^^^^^^^^ help: consider changing to: `&(i32, u32)` + | ^^^^^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn _multi_tup(x: &(i32, u32)) {} + | ~~~~~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:343:11 | LL | fn _fn(x: &mut (fn())) {} - | ^^^^^^^^^^^ help: consider changing to: `&fn()` + | ^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn _fn(x: &fn()) {} + | ~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:345:23 | LL | fn _extern_rust_fn(x: &mut extern "Rust" fn()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "Rust" fn()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn _extern_rust_fn(x: &extern "Rust" fn()) {} + | ~~~~~~~~~~~~~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:346:20 | LL | fn _extern_c_fn(x: &mut extern "C" fn()) {} - | ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "C" fn()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn _extern_c_fn(x: &extern "C" fn()) {} + | ~~~~~~~~~~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:347:18 | LL | fn _unsafe_fn(x: &mut unsafe fn()) {} - | ^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe fn()` + | ^^^^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn _unsafe_fn(x: &unsafe fn()) {} + | ~~~~~~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:348:25 | LL | fn _unsafe_extern_fn(x: &mut unsafe extern "C" fn()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn _unsafe_extern_fn(x: &unsafe extern "C" fn()) {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:349:20 | LL | fn _fn_with_arg(x: &mut unsafe extern "C" fn(i32)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn(i32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn _fn_with_arg(x: &unsafe extern "C" fn(i32)) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut.rs:350:20 | LL | fn _fn_with_ret(x: &mut unsafe extern "C" fn() -> (i32)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn() -> (i32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider changing to + | +LL | fn _fn_with_ret(x: &unsafe extern "C" fn() -> (i32)) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 34 previous errors diff --git a/src/tools/clippy/tests/ui/needless_pass_by_ref_mut2.stderr b/src/tools/clippy/tests/ui/needless_pass_by_ref_mut2.stderr index c875360322568..fa5e0ed39c70c 100644 --- a/src/tools/clippy/tests/ui/needless_pass_by_ref_mut2.stderr +++ b/src/tools/clippy/tests/ui/needless_pass_by_ref_mut2.stderr @@ -2,19 +2,27 @@ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut2.rs:8:30 | LL | pub async fn inner_async3(x: &mut i32, y: &mut u32) { - | ^^^^^^^^ help: consider changing to: `&i32` + | ^^^^^^^^ | = warning: changing this function will impact semver compatibility = note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]` +help: consider changing to + | +LL | pub async fn inner_async3(x: &i32, y: &mut u32) { + | ~~~~ error: this argument is a mutable reference, but not used mutably --> tests/ui/needless_pass_by_ref_mut2.rs:16:43 | LL | pub async fn inner_async4(u: &mut i32, v: &mut u32) { - | ^^^^^^^^ help: consider changing to: `&u32` + | ^^^^^^^^ | = warning: changing this function will impact semver compatibility +help: consider changing to + | +LL | pub async fn inner_async4(u: &mut i32, v: &u32) { + | ~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/needless_pass_by_value.stderr b/src/tools/clippy/tests/ui/needless_pass_by_value.stderr index 827a200ba6819..e72ebc1710057 100644 --- a/src/tools/clippy/tests/ui/needless_pass_by_value.stderr +++ b/src/tools/clippy/tests/ui/needless_pass_by_value.stderr @@ -2,58 +2,102 @@ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:18:23 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_value)]` +help: consider changing the type to + | +LL | fn foo(v: &[T], w: Vec, mut x: Vec, y: Vec) -> Vec { + | ~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:34:11 | LL | fn bar(x: String, y: Wrapper) { - | ^^^^^^ help: consider changing the type to: `&str` + | ^^^^^^ + | +help: consider changing the type to + | +LL | fn bar(x: &str, y: Wrapper) { + | ~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:34:22 | LL | fn bar(x: String, y: Wrapper) { - | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` + | ^^^^^^^ + | +help: consider taking a reference instead + | +LL | fn bar(x: String, y: &Wrapper) { + | ~~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:42:71 | LL | fn test_borrow_trait, U: AsRef, V>(t: T, u: U, v: V) { - | ^ help: consider taking a reference instead: `&V` + | ^ + | +help: consider taking a reference instead + | +LL | fn test_borrow_trait, U: AsRef, V>(t: T, u: U, v: &V) { + | ~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:55:18 | LL | fn test_match(x: Option>, y: Option>) { - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&Option>` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider taking a reference instead + | +LL | fn test_match(x: &Option>, y: Option>) { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:69:24 | LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { - | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` + | ^^^^^^^ + | +help: consider taking a reference instead + | +LL | fn test_destructure(x: &Wrapper, y: Wrapper, z: Wrapper) { + | ~~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:69:36 | LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { - | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` + | ^^^^^^^ + | +help: consider taking a reference instead + | +LL | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) { + | ~~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:87:49 | LL | fn test_blanket_ref(_foo: T, _serializable: S) {} - | ^ help: consider taking a reference instead: `&T` + | ^ + | +help: consider taking a reference instead + | +LL | fn test_blanket_ref(_foo: &T, _serializable: S) {} + | ~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:90:18 | LL | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { - | ^^^^^^ help: consider taking a reference instead: `&String` + | ^^^^^^ + | +help: consider taking a reference instead + | +LL | fn issue_2114(s: &String, t: String, u: Vec, v: Vec) { + | ~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:90:29 @@ -74,7 +118,12 @@ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:90:40 | LL | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { - | ^^^^^^^^ help: consider taking a reference instead: `&Vec` + | ^^^^^^^^ + | +help: consider taking a reference instead + | +LL | fn issue_2114(s: String, t: String, u: &Vec, v: Vec) { + | ~~~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:90:53 @@ -95,85 +144,131 @@ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:107:12 | LL | s: String, - | ^^^^^^ help: consider changing the type to: `&str` + | ^^^^^^ + | +help: consider changing the type to + | +LL | s: &str, + | ~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:109:12 | LL | t: String, - | ^^^^^^ help: consider taking a reference instead: `&String` + | ^^^^^^ + | +help: consider taking a reference instead + | +LL | t: &String, + | ~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:119:23 | LL | fn baz(&self, _u: U, _s: Self) {} - | ^ help: consider taking a reference instead: `&U` + | ^ + | +help: consider taking a reference instead + | +LL | fn baz(&self, _u: &U, _s: Self) {} + | ~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:119:30 | LL | fn baz(&self, _u: U, _s: Self) {} - | ^^^^ help: consider taking a reference instead: `&Self` + | ^^^^ + | +help: consider taking a reference instead + | +LL | fn baz(&self, _u: U, _s: &Self) {} + | ~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:143:24 | LL | fn bar_copy(x: u32, y: CopyWrapper) { - | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` + | ^^^^^^^^^^^ | help: consider marking this type as `Copy` --> tests/ui/needless_pass_by_value.rs:141:1 | LL | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^ +help: consider taking a reference instead + | +LL | fn bar_copy(x: u32, y: &CopyWrapper) { + | ~~~~~~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:150:29 | LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { - | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` + | ^^^^^^^^^^^ | help: consider marking this type as `Copy` --> tests/ui/needless_pass_by_value.rs:141:1 | LL | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^ +help: consider taking a reference instead + | +LL | fn test_destructure_copy(x: &CopyWrapper, y: CopyWrapper, z: CopyWrapper) { + | ~~~~~~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:150:45 | LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { - | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` + | ^^^^^^^^^^^ | help: consider marking this type as `Copy` --> tests/ui/needless_pass_by_value.rs:141:1 | LL | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^ +help: consider taking a reference instead + | +LL | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) { + | ~~~~~~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:150:61 | LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { - | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` + | ^^^^^^^^^^^ | help: consider marking this type as `Copy` --> tests/ui/needless_pass_by_value.rs:141:1 | LL | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^ +help: consider taking a reference instead + | +LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) { + | ~~~~~~~~~~~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:165:40 | LL | fn some_fun<'b, S: Bar<'b, ()>>(_item: S) {} - | ^ help: consider taking a reference instead: `&S` + | ^ + | +help: consider taking a reference instead + | +LL | fn some_fun<'b, S: Bar<'b, ()>>(_item: &S) {} + | ~~ error: this argument is passed by value, but not consumed in the function body --> tests/ui/needless_pass_by_value.rs:171:20 | LL | fn more_fun(_item: impl Club<'static, i32>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&impl Club<'static, i32>` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider taking a reference instead + | +LL | fn more_fun(_item: &impl Club<'static, i32>) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 22 previous errors diff --git a/src/tools/clippy/tests/ui/needless_pub_self.stderr b/src/tools/clippy/tests/ui/needless_pub_self.stderr index 0bff2e4b8b71b..4156e68929868 100644 --- a/src/tools/clippy/tests/ui/needless_pub_self.stderr +++ b/src/tools/clippy/tests/ui/needless_pub_self.stderr @@ -2,22 +2,39 @@ error: unnecessary `pub(self)` --> tests/ui/needless_pub_self.rs:13:1 | LL | pub(self) fn a() {} - | ^^^^^^^^^ help: remove it + | ^^^^^^^^^ | = note: `-D clippy::needless-pub-self` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_pub_self)]` +help: remove it + | +LL - pub(self) fn a() {} +LL + fn a() {} + | error: unnecessary `pub(in self)` --> tests/ui/needless_pub_self.rs:14:1 | LL | pub(in self) fn b() {} - | ^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^ + | +help: remove it + | +LL - pub(in self) fn b() {} +LL + fn b() {} + | error: unnecessary `pub(self)` --> tests/ui/needless_pub_self.rs:20:5 | LL | pub(self) fn f() {} - | ^^^^^^^^^ help: remove it + | ^^^^^^^^^ + | +help: remove it + | +LL - pub(self) fn f() {} +LL + fn f() {} + | error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/needless_question_mark.stderr b/src/tools/clippy/tests/ui/needless_question_mark.stderr index 0a1cb59797086..ce3b12f8c0a77 100644 --- a/src/tools/clippy/tests/ui/needless_question_mark.stderr +++ b/src/tools/clippy/tests/ui/needless_question_mark.stderr @@ -2,99 +2,172 @@ error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:20:12 | LL | return Some(to.magic?); - | ^^^^^^^^^^^^^^^ help: try removing question mark and `Some()`: `to.magic` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::needless-question-mark` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_question_mark)]` +help: try removing question mark and `Some()` + | +LL | return to.magic; + | ~~~~~~~~ error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:28:12 | LL | return Some(to.magic?) - | ^^^^^^^^^^^^^^^ help: try removing question mark and `Some()`: `to.magic` + | ^^^^^^^^^^^^^^^ + | +help: try removing question mark and `Some()` + | +LL | return to.magic + | ~~~~~~~~ error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:33:5 | LL | Some(to.magic?) - | ^^^^^^^^^^^^^^^ help: try removing question mark and `Some()`: `to.magic` + | ^^^^^^^^^^^^^^^ + | +help: try removing question mark and `Some()` + | +LL | to.magic + | error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:38:21 | LL | to.and_then(|t| Some(t.magic?)) - | ^^^^^^^^^^^^^^ help: try removing question mark and `Some()`: `t.magic` + | ^^^^^^^^^^^^^^ + | +help: try removing question mark and `Some()` + | +LL | to.and_then(|t| t.magic) + | ~~~~~~~ error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:47:9 | LL | Some(t.magic?) - | ^^^^^^^^^^^^^^ help: try removing question mark and `Some()`: `t.magic` + | ^^^^^^^^^^^^^^ + | +help: try removing question mark and `Some()` + | +LL | t.magic + | error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:52:12 | LL | return Ok(tr.magic?); - | ^^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `tr.magic` + | ^^^^^^^^^^^^^ + | +help: try removing question mark and `Ok()` + | +LL | return tr.magic; + | ~~~~~~~~ error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:59:12 | LL | return Ok(tr.magic?) - | ^^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `tr.magic` + | ^^^^^^^^^^^^^ + | +help: try removing question mark and `Ok()` + | +LL | return tr.magic + | ~~~~~~~~ error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:63:5 | LL | Ok(tr.magic?) - | ^^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `tr.magic` + | ^^^^^^^^^^^^^ + | +help: try removing question mark and `Ok()` + | +LL | tr.magic + | error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:67:21 | LL | tr.and_then(|t| Ok(t.magic?)) - | ^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `t.magic` + | ^^^^^^^^^^^^ + | +help: try removing question mark and `Ok()` + | +LL | tr.and_then(|t| t.magic) + | ~~~~~~~ error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:75:9 | LL | Ok(t.magic?) - | ^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `t.magic` + | ^^^^^^^^^^^^ + | +help: try removing question mark and `Ok()` + | +LL | t.magic + | error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:82:16 | LL | return Ok(t.magic?); - | ^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `t.magic` + | ^^^^^^^^^^^^ + | +help: try removing question mark and `Ok()` + | +LL | return t.magic; + | ~~~~~~~ error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:117:27 | LL | || -> Option<_> { Some(Some($expr)?) }() - | ^^^^^^^^^^^^^^^^^^ help: try removing question mark and `Some()`: `Some($expr)` + | ^^^^^^^^^^^^^^^^^^ ... LL | let _x = some_and_qmark_in_macro!(x?); | ---------------------------- in this macro invocation | = note: this error originates in the macro `some_and_qmark_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try removing question mark and `Some()` + | +LL | || -> Option<_> { Some($expr) }() + | ~~~~~~~~~~~ error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:128:5 | LL | Some(to.magic?) - | ^^^^^^^^^^^^^^^ help: try removing question mark and `Some()`: `to.magic` + | ^^^^^^^^^^^^^^^ + | +help: try removing question mark and `Some()` + | +LL | to.magic + | error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:136:5 | LL | Ok(s.magic?) - | ^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `s.magic` + | ^^^^^^^^^^^^ + | +help: try removing question mark and `Ok()` + | +LL | s.magic + | error: question mark operator is useless here --> tests/ui/needless_question_mark.rs:140:7 | LL | { Some(a?) } - | ^^^^^^^^ help: try removing question mark and `Some()`: `a` + | ^^^^^^^^ + | +help: try removing question mark and `Some()` + | +LL | { a } + | ~ error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/needless_return_with_question_mark.stderr b/src/tools/clippy/tests/ui/needless_return_with_question_mark.stderr index 76dd5f953bc67..14d37645cc8aa 100644 --- a/src/tools/clippy/tests/ui/needless_return_with_question_mark.stderr +++ b/src/tools/clippy/tests/ui/needless_return_with_question_mark.stderr @@ -2,16 +2,27 @@ error: unneeded `return` statement with `?` operator --> tests/ui/needless_return_with_question_mark.rs:29:5 | LL | return Err(())?; - | ^^^^^^^ help: remove it + | ^^^^^^^ | = note: `-D clippy::needless-return-with-question-mark` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_return_with_question_mark)]` +help: remove it + | +LL - return Err(())?; +LL + Err(())?; + | error: unneeded `return` statement with `?` operator --> tests/ui/needless_return_with_question_mark.rs:69:9 | LL | return Err(())?; - | ^^^^^^^ help: remove it + | ^^^^^^^ + | +help: remove it + | +LL - return Err(())?; +LL + Err(())?; + | error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/needless_splitn.stderr b/src/tools/clippy/tests/ui/needless_splitn.stderr index ffd82c3fcb13a..a4b1bcbc0f3aa 100644 --- a/src/tools/clippy/tests/ui/needless_splitn.stderr +++ b/src/tools/clippy/tests/ui/needless_splitn.stderr @@ -2,82 +2,146 @@ error: unnecessary use of `splitn` --> tests/ui/needless_splitn.rs:13:13 | LL | let _ = str.splitn(2, '=').next(); - | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` + | ^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::needless-splitn` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_splitn)]` +help: try + | +LL | let _ = str.split('=').next(); + | ~~~~~~~~~~~~~~ error: unnecessary use of `splitn` --> tests/ui/needless_splitn.rs:14:13 | LL | let _ = str.splitn(2, '=').nth(0); - | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = str.split('=').nth(0); + | ~~~~~~~~~~~~~~ error: unnecessary use of `splitn` --> tests/ui/needless_splitn.rs:17:18 | LL | let (_, _) = str.splitn(3, '=').next_tuple().unwrap(); - | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let (_, _) = str.split('=').next_tuple().unwrap(); + | ~~~~~~~~~~~~~~ error: unnecessary use of `rsplitn` --> tests/ui/needless_splitn.rs:20:13 | LL | let _ = str.rsplitn(2, '=').next(); - | ^^^^^^^^^^^^^^^^^^^ help: try: `str.rsplit('=')` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = str.rsplit('=').next(); + | ~~~~~~~~~~~~~~~ error: unnecessary use of `rsplitn` --> tests/ui/needless_splitn.rs:21:13 | LL | let _ = str.rsplitn(2, '=').nth(0); - | ^^^^^^^^^^^^^^^^^^^ help: try: `str.rsplit('=')` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = str.rsplit('=').nth(0); + | ~~~~~~~~~~~~~~~ error: unnecessary use of `rsplitn` --> tests/ui/needless_splitn.rs:24:18 | LL | let (_, _) = str.rsplitn(3, '=').next_tuple().unwrap(); - | ^^^^^^^^^^^^^^^^^^^ help: try: `str.rsplit('=')` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let (_, _) = str.rsplit('=').next_tuple().unwrap(); + | ~~~~~~~~~~~~~~~ error: unnecessary use of `splitn` --> tests/ui/needless_splitn.rs:26:13 | LL | let _ = str.splitn(5, '=').next(); - | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = str.split('=').next(); + | ~~~~~~~~~~~~~~ error: unnecessary use of `splitn` --> tests/ui/needless_splitn.rs:27:13 | LL | let _ = str.splitn(5, '=').nth(3); - | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = str.split('=').nth(3); + | ~~~~~~~~~~~~~~ error: unnecessary use of `splitn` --> tests/ui/needless_splitn.rs:33:13 | LL | let _ = s.splitn(2, '=').next()?; - | ^^^^^^^^^^^^^^^^ help: try: `s.split('=')` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.split('=').next()?; + | ~~~~~~~~~~~~ error: unnecessary use of `splitn` --> tests/ui/needless_splitn.rs:34:13 | LL | let _ = s.splitn(2, '=').nth(0)?; - | ^^^^^^^^^^^^^^^^ help: try: `s.split('=')` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.split('=').nth(0)?; + | ~~~~~~~~~~~~ error: unnecessary use of `rsplitn` --> tests/ui/needless_splitn.rs:35:13 | LL | let _ = s.rsplitn(2, '=').next()?; - | ^^^^^^^^^^^^^^^^^ help: try: `s.rsplit('=')` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.rsplit('=').next()?; + | ~~~~~~~~~~~~~ error: unnecessary use of `rsplitn` --> tests/ui/needless_splitn.rs:36:13 | LL | let _ = s.rsplitn(2, '=').nth(0)?; - | ^^^^^^^^^^^^^^^^^ help: try: `s.rsplit('=')` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = s.rsplit('=').nth(0)?; + | ~~~~~~~~~~~~~ error: unnecessary use of `splitn` --> tests/ui/needless_splitn.rs:44:13 | LL | let _ = "key=value".splitn(2, '=').nth(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"key=value".split('=')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = "key=value".split('=').nth(0).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/neg_multiply.stderr b/src/tools/clippy/tests/ui/neg_multiply.stderr index 13226c7c37b3f..358123f17548c 100644 --- a/src/tools/clippy/tests/ui/neg_multiply.stderr +++ b/src/tools/clippy/tests/ui/neg_multiply.stderr @@ -2,52 +2,91 @@ error: this multiplication by -1 can be written more succinctly --> tests/ui/neg_multiply.rs:28:5 | LL | x * -1; - | ^^^^^^ help: consider using: `-x` + | ^^^^^^ | = note: `-D clippy::neg-multiply` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::neg_multiply)]` +help: consider using + | +LL | -x; + | ~~ error: this multiplication by -1 can be written more succinctly --> tests/ui/neg_multiply.rs:30:5 | LL | -1 * x; - | ^^^^^^ help: consider using: `-x` + | ^^^^^^ + | +help: consider using + | +LL | -x; + | ~~ error: this multiplication by -1 can be written more succinctly --> tests/ui/neg_multiply.rs:32:11 | LL | 100 + x * -1; - | ^^^^^^ help: consider using: `-x` + | ^^^^^^ + | +help: consider using + | +LL | 100 + -x; + | ~~ error: this multiplication by -1 can be written more succinctly --> tests/ui/neg_multiply.rs:34:5 | LL | (100 + x) * -1; - | ^^^^^^^^^^^^^^ help: consider using: `-(100 + x)` + | ^^^^^^^^^^^^^^ + | +help: consider using + | +LL | -(100 + x); + | ~~~~~~~~~~ error: this multiplication by -1 can be written more succinctly --> tests/ui/neg_multiply.rs:36:5 | LL | -1 * 17; - | ^^^^^^^ help: consider using: `-17` + | ^^^^^^^ + | +help: consider using + | +LL | -17; + | ~~~ error: this multiplication by -1 can be written more succinctly --> tests/ui/neg_multiply.rs:38:14 | LL | 0xcafe | 0xff00 * -1; - | ^^^^^^^^^^^ help: consider using: `-0xff00` + | ^^^^^^^^^^^ + | +help: consider using + | +LL | 0xcafe | -0xff00; + | ~~~~~~~ error: this multiplication by -1 can be written more succinctly --> tests/ui/neg_multiply.rs:40:5 | LL | 3_usize as i32 * -1; - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `-(3_usize as i32)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | -(3_usize as i32); + | ~~~~~~~~~~~~~~~~~ error: this multiplication by -1 can be written more succinctly --> tests/ui/neg_multiply.rs:41:5 | LL | (3_usize as i32) * -1; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `-(3_usize as i32)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | -(3_usize as i32); + | ~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/no_effect_return.stderr b/src/tools/clippy/tests/ui/no_effect_return.stderr index 3cfe375d034ad..5365ce19512f2 100644 --- a/src/tools/clippy/tests/ui/no_effect_return.stderr +++ b/src/tools/clippy/tests/ui/no_effect_return.stderr @@ -2,28 +2,36 @@ error: statement with no effect --> tests/ui/no_effect_return.rs:9:9 | LL | 0u32; - | -^^^^ - | | - | help: did you mean to return it?: `return` + | ^^^^^ | = note: `-D clippy::no-effect` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::no_effect)]` +help: did you mean to return it? + | +LL | return 0u32; + | ++++++ error: statement with no effect --> tests/ui/no_effect_return.rs:18:9 | LL | 0u32; - | -^^^^ - | | - | help: did you mean to return it?: `return` + | ^^^^^ + | +help: did you mean to return it? + | +LL | return 0u32; + | ++++++ error: statement with no effect --> tests/ui/no_effect_return.rs:27:9 | LL | 0i32 as C; - | -^^^^^^^^^ - | | - | help: did you mean to return it?: `return` + | ^^^^^^^^^^ + | +help: did you mean to return it? + | +LL | return 0i32 as C; + | ++++++ error: statement with no effect --> tests/ui/no_effect_return.rs:36:9 @@ -41,17 +49,23 @@ error: statement with no effect --> tests/ui/no_effect_return.rs:54:9 | LL | [1u16]; - | -^^^^^^ - | | - | help: did you mean to return it?: `return` + | ^^^^^^^ + | +help: did you mean to return it? + | +LL | return [1u16]; + | ++++++ error: statement with no effect --> tests/ui/no_effect_return.rs:62:9 | LL | ControlFlow::Break::<()>(()); - | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: did you mean to return it?: `return` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean to return it? + | +LL | return ControlFlow::Break::<()>(()); + | ++++++ error: statement with no effect --> tests/ui/no_effect_return.rs:80:9 diff --git a/src/tools/clippy/tests/ui/non_canonical_clone_impl.stderr b/src/tools/clippy/tests/ui/non_canonical_clone_impl.stderr index f7cad58150f7d..aee7aceaba0e4 100644 --- a/src/tools/clippy/tests/ui/non_canonical_clone_impl.stderr +++ b/src/tools/clippy/tests/ui/non_canonical_clone_impl.stderr @@ -5,10 +5,14 @@ LL | fn clone(&self) -> Self { | _____________________________^ LL | | Self(self.0) LL | | } - | |_____^ help: change this to: `{ *self }` + | |_____^ | = note: `-D clippy::non-canonical-clone-impl` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::non_canonical_clone_impl)]` +help: change this to + | +LL | fn clone(&self) -> Self { *self } + | ~~~~~~~~~ error: unnecessary implementation of `clone_from` on a `Copy` type --> tests/ui/non_canonical_clone_impl.rs:18:5 @@ -17,7 +21,15 @@ LL | / fn clone_from(&mut self, source: &Self) { LL | | source.clone(); LL | | *self = source.clone(); LL | | } - | |_____^ help: remove it + | |_____^ + | +help: remove it + | +LL - fn clone_from(&mut self, source: &Self) { +LL - source.clone(); +LL - *self = source.clone(); +LL - } + | error: non-canonical implementation of `clone` on a `Copy` type --> tests/ui/non_canonical_clone_impl.rs:85:29 @@ -26,7 +38,12 @@ LL | fn clone(&self) -> Self { | _____________________________^ LL | | Self(self.0) LL | | } - | |_____^ help: change this to: `{ *self }` + | |_____^ + | +help: change this to + | +LL | fn clone(&self) -> Self { *self } + | ~~~~~~~~~ error: unnecessary implementation of `clone_from` on a `Copy` type --> tests/ui/non_canonical_clone_impl.rs:89:5 @@ -35,7 +52,15 @@ LL | / fn clone_from(&mut self, source: &Self) { LL | | source.clone(); LL | | *self = source.clone(); LL | | } - | |_____^ help: remove it + | |_____^ + | +help: remove it + | +LL - fn clone_from(&mut self, source: &Self) { +LL - source.clone(); +LL - *self = source.clone(); +LL - } + | error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr index a15379c5b1a5e..d884546f1270d 100644 --- a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr +++ b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr @@ -1,17 +1,19 @@ error: non-canonical implementation of `partial_cmp` on an `Ord` type --> tests/ui/non_canonical_partial_ord_impl.rs:16:1 | -LL | / impl PartialOrd for A { -LL | | fn partial_cmp(&self, other: &Self) -> Option { - | | _____________________________________________________________- -LL | || todo!(); -LL | || } - | ||_____- help: change this to: `{ Some(self.cmp(other)) }` -LL | | } - | |__^ +LL | / impl PartialOrd for A { +LL | | fn partial_cmp(&self, other: &Self) -> Option { +LL | | todo!(); +LL | | } +LL | | } + | |_^ | = note: `-D clippy::non-canonical-partial-ord-impl` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::non_canonical_partial_ord_impl)]` +help: change this to + | +LL | fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: non-canonical implementation of `partial_cmp` on an `Ord` type --> tests/ui/non_canonical_partial_ord_impl.rs:50:1 diff --git a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl_fully_qual.stderr b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl_fully_qual.stderr index 8dd7face6ef4e..5ea78f63069a4 100644 --- a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl_fully_qual.stderr +++ b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl_fully_qual.stderr @@ -1,32 +1,37 @@ error: non-canonical implementation of `partial_cmp` on an `Ord` type --> tests/ui/non_canonical_partial_ord_impl_fully_qual.rs:23:1 | -LL | / impl PartialOrd for A { -LL | | fn partial_cmp(&self, other: &Self) -> Option { - | | _____________________________________________________________- -LL | || // NOTE: This suggestion is wrong, as `Ord` is not in scope. But this should be fine as it isn't -LL | || // automatically applied -LL | || todo!(); -LL | || } - | ||_____- help: change this to: `{ Some(self.cmp(other)) }` -LL | | } - | |__^ +LL | / impl PartialOrd for A { +LL | | fn partial_cmp(&self, other: &Self) -> Option { +LL | | // NOTE: This suggestion is wrong, as `Ord` is not in scope. But this should be fine as it isn't +LL | | // automatically applied +LL | | todo!(); +LL | | } +LL | | } + | |_^ | = note: `-D clippy::non-canonical-partial-ord-impl` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::non_canonical_partial_ord_impl)]` +help: change this to + | +LL | fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: non-canonical implementation of `partial_cmp` on an `Ord` type --> tests/ui/non_canonical_partial_ord_impl_fully_qual.rs:46:1 | -LL | / impl PartialOrd for B { -LL | | fn partial_cmp(&self, other: &Self) -> Option { - | | _____________________________________________________________- -LL | || // This calls `B.cmp`, not `Ord::cmp`! -LL | || Some(self.cmp(other)) -LL | || } - | ||_____- help: change this to: `{ Some(std::cmp::Ord::cmp(self, other)) }` -LL | | } - | |__^ +LL | / impl PartialOrd for B { +LL | | fn partial_cmp(&self, other: &Self) -> Option { +LL | | // This calls `B.cmp`, not `Ord::cmp`! +LL | | Some(self.cmp(other)) +LL | | } +LL | | } + | |_^ + | +help: change this to + | +LL | fn partial_cmp(&self, other: &Self) -> Option { Some(std::cmp::Ord::cmp(self, other)) } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/non_minimal_cfg.stderr b/src/tools/clippy/tests/ui/non_minimal_cfg.stderr index 707ff51d430c9..6e84b30481fe5 100644 --- a/src/tools/clippy/tests/ui/non_minimal_cfg.stderr +++ b/src/tools/clippy/tests/ui/non_minimal_cfg.stderr @@ -2,28 +2,47 @@ error: unneeded sub `cfg` when there is only one condition --> tests/ui/non_minimal_cfg.rs:3:7 | LL | #[cfg(all(windows))] - | ^^^^^^^^^^^^ help: try: `windows` + | ^^^^^^^^^^^^ | = note: `-D clippy::non-minimal-cfg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::non_minimal_cfg)]` +help: try + | +LL | #[cfg(windows)] + | ~~~~~~~ error: unneeded sub `cfg` when there is only one condition --> tests/ui/non_minimal_cfg.rs:6:7 | LL | #[cfg(any(windows))] - | ^^^^^^^^^^^^ help: try: `windows` + | ^^^^^^^^^^^^ + | +help: try + | +LL | #[cfg(windows)] + | ~~~~~~~ error: unneeded sub `cfg` when there is only one condition --> tests/ui/non_minimal_cfg.rs:9:11 | LL | #[cfg(all(any(unix), all(not(windows))))] - | ^^^^^^^^^ help: try: `unix` + | ^^^^^^^^^ + | +help: try + | +LL | #[cfg(all(unix, all(not(windows))))] + | ~~~~ error: unneeded sub `cfg` when there is only one condition --> tests/ui/non_minimal_cfg.rs:9:22 | LL | #[cfg(all(any(unix), all(not(windows))))] - | ^^^^^^^^^^^^^^^^^ help: try: `not(windows)` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | #[cfg(all(any(unix), not(windows)))] + | ~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/non_octal_unix_permissions.stderr b/src/tools/clippy/tests/ui/non_octal_unix_permissions.stderr index 890b308a1dc56..9e2bf8f39a38d 100644 --- a/src/tools/clippy/tests/ui/non_octal_unix_permissions.stderr +++ b/src/tools/clippy/tests/ui/non_octal_unix_permissions.stderr @@ -2,28 +2,47 @@ error: using a non-octal value to set unix file permissions --> tests/ui/non_octal_unix_permissions.rs:12:18 | LL | options.mode(440); - | ^^^ help: consider using an octal literal instead: `0o440` + | ^^^ | = note: `-D clippy::non-octal-unix-permissions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::non_octal_unix_permissions)]` +help: consider using an octal literal instead + | +LL | options.mode(0o440); + | ~~~~~ error: using a non-octal value to set unix file permissions --> tests/ui/non_octal_unix_permissions.rs:17:47 | LL | let _permissions = Permissions::from_mode(647); - | ^^^ help: consider using an octal literal instead: `0o647` + | ^^^ + | +help: consider using an octal literal instead + | +LL | let _permissions = Permissions::from_mode(0o647); + | ~~~~~ error: using a non-octal value to set unix file permissions --> tests/ui/non_octal_unix_permissions.rs:26:26 | LL | permissions.set_mode(644); - | ^^^ help: consider using an octal literal instead: `0o644` + | ^^^ + | +help: consider using an octal literal instead + | +LL | permissions.set_mode(0o644); + | ~~~~~ error: using a non-octal value to set unix file permissions --> tests/ui/non_octal_unix_permissions.rs:33:18 | LL | builder.mode(755); - | ^^^ help: consider using an octal literal instead: `0o755` + | ^^^ + | +help: consider using an octal literal instead + | +LL | builder.mode(0o755); + | ~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/nonminimal_bool.stderr b/src/tools/clippy/tests/ui/nonminimal_bool.stderr index eafffdaf8a638..d548a868bbd47 100644 --- a/src/tools/clippy/tests/ui/nonminimal_bool.stderr +++ b/src/tools/clippy/tests/ui/nonminimal_bool.stderr @@ -2,46 +2,80 @@ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:17:13 | LL | let _ = !true; - | ^^^^^ help: try: `false` + | ^^^^^ | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]` +help: try + | +LL | let _ = false; + | ~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:20:13 | LL | let _ = !false; - | ^^^^^^ help: try: `true` + | ^^^^^^ + | +help: try + | +LL | let _ = true; + | ~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:22:13 | LL | let _ = !!a; - | ^^^ help: try: `a` + | ^^^ + | +help: try + | +LL | let _ = a; + | ~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:24:13 | LL | let _ = false || a; - | ^^^^^^^^^^ help: try: `a` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = a; + | ~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:29:13 | LL | let _ = !(!a && b); - | ^^^^^^^^^^ help: try: `a || !b` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = a || !b; + | ~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:31:13 | LL | let _ = !(!a || b); - | ^^^^^^^^^^ help: try: `a && !b` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = a && !b; + | ~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:33:13 | LL | let _ = !a && !(b && c); - | ^^^^^^^^^^^^^^^ help: try: `!(a || b && c)` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = !(a || b && c); + | ~~~~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:42:13 @@ -112,106 +146,190 @@ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:81:8 | LL | if matches!(true, true) && true { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(true, true)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if matches!(true, true) { + | ~~~~~~~~~~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:161:8 | LL | if !(12 == a) {} - | ^^^^^^^^^^ help: try: `12 != a` + | ^^^^^^^^^^ + | +help: try + | +LL | if 12 != a {} + | ~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:162:8 | LL | if !(a == 12) {} - | ^^^^^^^^^^ help: try: `a != 12` + | ^^^^^^^^^^ + | +help: try + | +LL | if a != 12 {} + | ~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:163:8 | LL | if !(12 != a) {} - | ^^^^^^^^^^ help: try: `12 == a` + | ^^^^^^^^^^ + | +help: try + | +LL | if 12 == a {} + | ~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:164:8 | LL | if !(a != 12) {} - | ^^^^^^^^^^ help: try: `a == 12` + | ^^^^^^^^^^ + | +help: try + | +LL | if a == 12 {} + | ~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:168:8 | LL | if !b == true {} - | ^^^^^^^^^^ help: try: `b != true` + | ^^^^^^^^^^ + | +help: try + | +LL | if b != true {} + | ~~~~~~~~~ error: this comparison might be written more concisely --> tests/ui/nonminimal_bool.rs:168:8 | LL | if !b == true {} - | ^^^^^^^^^^ help: try simplifying it as shown: `b != true` + | ^^^^^^^^^^ | = note: `-D clippy::bool-comparison` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]` +help: try simplifying it as shown + | +LL | if b != true {} + | ~~~~~~~~~ error: equality checks against true are unnecessary --> tests/ui/nonminimal_bool.rs:168:8 | LL | if !b == true {} - | ^^^^^^^^^^ help: try simplifying it as shown: `!b` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !b {} + | ~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:169:8 | LL | if !b != true {} - | ^^^^^^^^^^ help: try: `b == true` + | ^^^^^^^^^^ + | +help: try + | +LL | if b == true {} + | ~~~~~~~~~ error: inequality checks against true can be replaced by a negation --> tests/ui/nonminimal_bool.rs:169:8 | LL | if !b != true {} - | ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !(!b) {} + | ~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:170:8 | LL | if true == !b {} - | ^^^^^^^^^^ help: try: `true != b` + | ^^^^^^^^^^ + | +help: try + | +LL | if true != b {} + | ~~~~~~~~~ error: this comparison might be written more concisely --> tests/ui/nonminimal_bool.rs:170:8 | LL | if true == !b {} - | ^^^^^^^^^^ help: try simplifying it as shown: `true != b` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if true != b {} + | ~~~~~~~~~ error: equality checks against true are unnecessary --> tests/ui/nonminimal_bool.rs:170:8 | LL | if true == !b {} - | ^^^^^^^^^^ help: try simplifying it as shown: `!b` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !b {} + | ~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:171:8 | LL | if true != !b {} - | ^^^^^^^^^^ help: try: `true == b` + | ^^^^^^^^^^ + | +help: try + | +LL | if true == b {} + | ~~~~~~~~~ error: inequality checks against true can be replaced by a negation --> tests/ui/nonminimal_bool.rs:171:8 | LL | if true != !b {} - | ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)` + | ^^^^^^^^^^ + | +help: try simplifying it as shown + | +LL | if !(!b) {} + | ~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:172:8 | LL | if !b == !c {} - | ^^^^^^^^ help: try: `b == c` + | ^^^^^^^^ + | +help: try + | +LL | if b == c {} + | ~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:173:8 | LL | if !b != !c {} - | ^^^^^^^^ help: try: `b != c` + | ^^^^^^^^ + | +help: try + | +LL | if b != c {} + | ~~~~~~ error: aborting due to 29 previous errors diff --git a/src/tools/clippy/tests/ui/nonminimal_bool_methods.stderr b/src/tools/clippy/tests/ui/nonminimal_bool_methods.stderr index d7adc0638b373..3ebf4cd126f00 100644 --- a/src/tools/clippy/tests/ui/nonminimal_bool_methods.stderr +++ b/src/tools/clippy/tests/ui/nonminimal_bool_methods.stderr @@ -2,100 +2,179 @@ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:8:13 | LL | let _ = !a.is_some(); - | ^^^^^^^^^^^^ help: try: `a.is_none()` + | ^^^^^^^^^^^^ | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]` +help: try + | +LL | let _ = a.is_none(); + | ~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:10:13 | LL | let _ = !a.is_none(); - | ^^^^^^^^^^^^ help: try: `a.is_some()` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = a.is_some(); + | ~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:12:13 | LL | let _ = !b.is_err(); - | ^^^^^^^^^^^ help: try: `b.is_ok()` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = b.is_ok(); + | ~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:14:13 | LL | let _ = !b.is_ok(); - | ^^^^^^^^^^ help: try: `b.is_err()` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = b.is_err(); + | ~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:16:13 | LL | let _ = !(a.is_some() && !c); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() || c` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = a.is_none() || c; + | ~~~~~~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:17:13 | LL | let _ = !(a.is_some() || !c); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() && c` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = a.is_none() && c; + | ~~~~~~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:18:26 | LL | let _ = !(!c ^ c) || !a.is_some(); - | ^^^^^^^^^^^^ help: try: `a.is_none()` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = !(!c ^ c) || a.is_none(); + | ~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:19:25 | LL | let _ = (!c ^ c) || !a.is_some(); - | ^^^^^^^^^^^^ help: try: `a.is_none()` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = (!c ^ c) || a.is_none(); + | ~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:20:23 | LL | let _ = !c ^ c || !a.is_some(); - | ^^^^^^^^^^^^ help: try: `a.is_none()` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = !c ^ c || a.is_none(); + | ~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:92:8 | LL | if !res.is_ok() {} - | ^^^^^^^^^^^^ help: try: `res.is_err()` + | ^^^^^^^^^^^^ + | +help: try + | +LL | if res.is_err() {} + | ~~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:93:8 | LL | if !res.is_err() {} - | ^^^^^^^^^^^^^ help: try: `res.is_ok()` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | if res.is_ok() {} + | ~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:96:8 | LL | if !res.is_some() {} - | ^^^^^^^^^^^^^^ help: try: `res.is_none()` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | if res.is_none() {} + | ~~~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:97:8 | LL | if !res.is_none() {} - | ^^^^^^^^^^^^^^ help: try: `res.is_some()` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | if res.is_some() {} + | ~~~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:113:8 | LL | if !(a as u64 >= b) {} - | ^^^^^^^^^^^^^^^^ help: try: `(a as u64) < b` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if (a as u64) < b {} + | ~~~~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:114:8 | LL | if !((a as u64) >= b) {} - | ^^^^^^^^^^^^^^^^^^ help: try: `(a as u64) < b` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if (a as u64) < b {} + | ~~~~~~~~~~~~~~ error: this boolean expression can be simplified --> tests/ui/nonminimal_bool_methods.rs:115:8 | LL | if !(a as u64 <= b) {} - | ^^^^^^^^^^^^^^^^ help: try: `a as u64 > b` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if a as u64 > b {} + | ~~~~~~~~~~~~ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/numbered_fields.stderr b/src/tools/clippy/tests/ui/numbered_fields.stderr index 9d3f59cd3769e..ea11701624418 100644 --- a/src/tools/clippy/tests/ui/numbered_fields.stderr +++ b/src/tools/clippy/tests/ui/numbered_fields.stderr @@ -7,10 +7,14 @@ LL | | 0: 1u32, LL | | 1: 42, LL | | 2: 23u8, LL | | }; - | |_____^ help: try: `TupleStruct(1u32, 42, 23u8)` + | |_____^ | = note: `-D clippy::init-numbered-fields` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::init_numbered_fields)]` +help: try + | +LL | let _ = TupleStruct(1u32, 42, 23u8); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: used a field initializer for a tuple struct --> tests/ui/numbered_fields.rs:24:13 @@ -21,13 +25,23 @@ LL | | 0: 1u32, LL | | 2: 2u8, LL | | 1: 3u32, LL | | }; - | |_____^ help: try: `TupleStruct(1u32, 3u32, 2u8)` + | |_____^ + | +help: try + | +LL | let _ = TupleStruct(1u32, 3u32, 2u8); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: used a field initializer for a tuple struct --> tests/ui/numbered_fields.rs:49:13 | LL | let _ = TupleStructVec { 0: vec![0, 1, 2, 3] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `TupleStructVec(vec![0, 1, 2, 3])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = TupleStructVec(vec![0, 1, 2, 3]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/obfuscated_if_else.stderr b/src/tools/clippy/tests/ui/obfuscated_if_else.stderr index d4c2f9b331a82..3ba7181024c6f 100644 --- a/src/tools/clippy/tests/ui/obfuscated_if_else.stderr +++ b/src/tools/clippy/tests/ui/obfuscated_if_else.stderr @@ -2,10 +2,14 @@ error: use of `.then_some(..).unwrap_or(..)` can be written more clearly with `i --> tests/ui/obfuscated_if_else.rs:4:5 | LL | true.then_some("a").unwrap_or("b"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `if true { "a" } else { "b" }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::obfuscated-if-else` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::obfuscated_if_else)]` +help: try + | +LL | if true { "a" } else { "b" }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/only_used_in_recursion.stderr b/src/tools/clippy/tests/ui/only_used_in_recursion.stderr index a3aee2697f380..397ea47b234cf 100644 --- a/src/tools/clippy/tests/ui/only_used_in_recursion.stderr +++ b/src/tools/clippy/tests/ui/only_used_in_recursion.stderr @@ -2,7 +2,7 @@ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:11:27 | LL | fn _one_unused(flag: u32, a: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:13:53 @@ -11,114 +11,154 @@ LL | if flag == 0 { 0 } else { _one_unused(flag - 1, a) } | ^ = note: `-D clippy::only-used-in-recursion` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::only_used_in_recursion)]` +help: if this is intentional, prefix it with an underscore + | +LL | fn _one_unused(flag: u32, _a: usize) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:16:27 | LL | fn _two_unused(flag: u32, a: u32, b: i32) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:19:53 | LL | if flag == 0 { 0 } else { _two_unused(flag - 1, a, b) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _two_unused(flag: u32, _a: u32, b: i32) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:16:35 | LL | fn _two_unused(flag: u32, a: u32, b: i32) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:19:56 | LL | if flag == 0 { 0 } else { _two_unused(flag - 1, a, b) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _two_unused(flag: u32, a: u32, _b: i32) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:22:26 | LL | fn _with_calc(flag: u32, a: i64) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:27:32 | LL | _with_calc(flag - 1, (-a + 10) * 5) | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _with_calc(flag: u32, _a: i64) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:36:33 | LL | fn _used_with_unused(flag: u32, a: i32, b: i32) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:42:38 | LL | _used_with_unused(flag - 1, -a, a + b) | ^ ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _used_with_unused(flag: u32, _a: i32, b: i32) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:36:41 | LL | fn _used_with_unused(flag: u32, a: i32, b: i32) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:42:45 | LL | _used_with_unused(flag - 1, -a, a + b) | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _used_with_unused(flag: u32, a: i32, _b: i32) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:46:35 | LL | fn _codependent_unused(flag: u32, a: i32, b: i32) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:52:39 | LL | _codependent_unused(flag - 1, a * b, a + b) | ^ ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _codependent_unused(flag: u32, _a: i32, b: i32) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:46:43 | LL | fn _codependent_unused(flag: u32, a: i32, b: i32) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:52:43 | LL | _codependent_unused(flag - 1, a * b, a + b) | ^ ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _codependent_unused(flag: u32, a: i32, _b: i32) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:56:30 | LL | fn _not_primitive(flag: u32, b: String) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:58:56 | LL | if flag == 0 { 0 } else { _not_primitive(flag - 1, b) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _not_primitive(flag: u32, _b: String) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:64:29 | LL | fn _method(flag: usize, a: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:66:59 | LL | if flag == 0 { 0 } else { Self::_method(flag - 1, a) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _method(flag: usize, _a: usize) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:69:22 @@ -136,61 +176,81 @@ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:69:41 | LL | fn _method_self(&self, flag: usize, a: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:72:63 | LL | if flag == 0 { 0 } else { self._method_self(flag - 1, a) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _method_self(&self, flag: usize, _a: usize) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:82:26 | LL | fn method(flag: u32, a: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:84:58 | LL | if flag == 0 { 0 } else { Self::method(flag - 1, a) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn method(flag: u32, _a: usize) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:87:38 | LL | fn method_self(&self, flag: u32, a: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:89:62 | LL | if flag == 0 { 0 } else { self.method_self(flag - 1, a) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn method_self(&self, flag: u32, _a: usize) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:114:26 | LL | fn method(flag: u32, a: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:116:58 | LL | if flag == 0 { 0 } else { Self::method(flag - 1, a) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn method(flag: u32, _a: usize) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion.rs:119:38 | LL | fn method_self(&self, flag: u32, a: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion.rs:121:62 | LL | if flag == 0 { 0 } else { self.method_self(flag - 1, a) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn method_self(&self, flag: u32, _a: usize) -> usize { + | ~~ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/only_used_in_recursion2.stderr b/src/tools/clippy/tests/ui/only_used_in_recursion2.stderr index e39460c7e8f3e..c0d406187b696 100644 --- a/src/tools/clippy/tests/ui/only_used_in_recursion2.stderr +++ b/src/tools/clippy/tests/ui/only_used_in_recursion2.stderr @@ -2,7 +2,7 @@ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion2.rs:3:35 | LL | fn _with_inner(flag: u32, a: u32, b: u32) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion2.rs:11:52 @@ -11,54 +11,74 @@ LL | if flag == 0 { 0 } else { _with_inner(flag, a, b + x) } | ^ = note: `-D clippy::only-used-in-recursion` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::only_used_in_recursion)]` +help: if this is intentional, prefix it with an underscore + | +LL | fn _with_inner(flag: u32, a: u32, _b: u32) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion2.rs:5:25 | LL | fn inner(flag: u32, a: u32) -> u32 { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion2.rs:7:47 | LL | if flag == 0 { 0 } else { inner(flag, a) } | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn inner(flag: u32, _a: u32) -> u32 { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion2.rs:14:34 | LL | fn _with_closure(a: Option, b: u32, f: impl Fn(u32, u32) -> Option) -> u32 { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion2.rs:17:32 | LL | _with_closure(Some(x), b, f) | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn _with_closure(a: Option, _b: u32, f: impl Fn(u32, u32) -> Option) -> u32 { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion2.rs:65:37 | LL | fn overwritten_param(flag: u32, mut a: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion2.rs:74:29 | LL | overwritten_param(flag, a) | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn overwritten_param(flag: u32, mut _a: usize) -> usize { + | ~~ error: parameter is only used in recursion --> tests/ui/only_used_in_recursion2.rs:77:32 | LL | fn field_direct(flag: u32, mut a: (usize,)) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: parameter used here --> tests/ui/only_used_in_recursion2.rs:83:32 | LL | field_direct(flag - 1, a) | ^ +help: if this is intentional, prefix it with an underscore + | +LL | fn field_direct(flag: u32, mut _a: (usize,)) -> usize { + | ~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/op_ref.stderr b/src/tools/clippy/tests/ui/op_ref.stderr index c5b68730a8f26..b1f3743fa7f38 100644 --- a/src/tools/clippy/tests/ui/op_ref.stderr +++ b/src/tools/clippy/tests/ui/op_ref.stderr @@ -15,25 +15,34 @@ error: taken reference of right operand --> tests/ui/op_ref.rs:58:13 | LL | let z = x & &y; - | ^^^^-- - | | - | help: use the right value directly: `y` + | ^^^^^^ + | +help: use the right value directly + | +LL | let z = x & y; + | ~ error: taken reference of right operand --> tests/ui/op_ref.rs:92:17 | LL | let _ = one * &self; - | ^^^^^^----- - | | - | help: use the right value directly: `self` + | ^^^^^^^^^^^ + | +help: use the right value directly + | +LL | let _ = one * self; + | ~~~~ error: taken reference of right operand --> tests/ui/op_ref.rs:94:17 | LL | let _ = two + &three; - | ^^^^^^------ - | | - | help: use the right value directly: `three` + | ^^^^^^^^^^^^ + | +help: use the right value directly + | +LL | let _ = two + three; + | ~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/open_options_fixable.stderr b/src/tools/clippy/tests/ui/open_options_fixable.stderr index fc54320fc07d3..192a4c13d5e4d 100644 --- a/src/tools/clippy/tests/ui/open_options_fixable.stderr +++ b/src/tools/clippy/tests/ui/open_options_fixable.stderr @@ -2,13 +2,17 @@ error: file opened with `create`, but `truncate` behavior not defined --> tests/ui/open_options_fixable.rs:5:24 | LL | OpenOptions::new().create(true).open("foo.txt"); - | ^^^^^^^^^^^^- help: add: `.truncate(true)` + | ^^^^^^^^^^^^ | = help: if you intend to overwrite an existing file entirely, call `.truncate(true)` = help: if you instead know that you may want to keep some parts of the old file, call `.truncate(false)` = help: alternatively, use `.append(true)` to append to the file instead of overwriting it = note: `-D clippy::suspicious-open-options` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suspicious_open_options)]` +help: add + | +LL | OpenOptions::new().create(true).truncate(true).open("foo.txt"); + | +++++++++++++++ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/option_as_ref_deref.stderr b/src/tools/clippy/tests/ui/option_as_ref_deref.stderr index 8b7f47a1b9af0..b1d88ef4f9a2c 100644 --- a/src/tools/clippy/tests/ui/option_as_ref_deref.stderr +++ b/src/tools/clippy/tests/ui/option_as_ref_deref.stderr @@ -2,10 +2,14 @@ error: called `.as_ref().map(Deref::deref)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:11:13 | LL | let _ = opt.clone().as_ref().map(Deref::deref).map(str::len); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.clone().as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::option-as-ref-deref` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::option_as_ref_deref)]` +help: consider using as_deref + | +LL | let _ = opt.clone().as_deref().map(str::len); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `.as_ref().map(Deref::deref)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:14:13 @@ -15,103 +19,188 @@ LL | let _ = opt.clone() LL | | .as_ref().map( LL | | Deref::deref LL | | ) - | |_________^ help: consider using as_deref: `opt.clone().as_deref()` + | |_________^ + | +help: consider using as_deref + | +LL | let _ = opt.clone().as_deref() + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `.as_mut().map(DerefMut::deref_mut)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:20:13 | LL | let _ = opt.as_mut().map(DerefMut::deref_mut); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.as_deref_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref_mut + | +LL | let _ = opt.as_deref_mut(); + | ~~~~~~~~~~~~~~~~~~ error: called `.as_ref().map(String::as_str)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:22:13 | LL | let _ = opt.as_ref().map(String::as_str); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = opt.as_deref(); + | ~~~~~~~~~~~~~~ error: called `.as_ref().map(|x| x.as_str())` on an `Option` value --> tests/ui/option_as_ref_deref.rs:23:13 | LL | let _ = opt.as_ref().map(|x| x.as_str()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = opt.as_deref(); + | ~~~~~~~~~~~~~~ error: called `.as_mut().map(String::as_mut_str)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:24:13 | LL | let _ = opt.as_mut().map(String::as_mut_str); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.as_deref_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref_mut + | +LL | let _ = opt.as_deref_mut(); + | ~~~~~~~~~~~~~~~~~~ error: called `.as_mut().map(|x| x.as_mut_str())` on an `Option` value --> tests/ui/option_as_ref_deref.rs:25:13 | LL | let _ = opt.as_mut().map(|x| x.as_mut_str()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.as_deref_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref_mut + | +LL | let _ = opt.as_deref_mut(); + | ~~~~~~~~~~~~~~~~~~ error: called `.as_ref().map(CString::as_c_str)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:26:13 | LL | let _ = Some(CString::new(vec![]).unwrap()).as_ref().map(CString::as_c_str); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `Some(CString::new(vec![]).unwrap()).as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = Some(CString::new(vec![]).unwrap()).as_deref(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `.as_ref().map(OsString::as_os_str)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:27:13 | LL | let _ = Some(OsString::new()).as_ref().map(OsString::as_os_str); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `Some(OsString::new()).as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = Some(OsString::new()).as_deref(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `.as_ref().map(PathBuf::as_path)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:28:13 | LL | let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `Some(PathBuf::new()).as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = Some(PathBuf::new()).as_deref(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `.as_ref().map(Vec::as_slice)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:29:13 | LL | let _ = Some(Vec::<()>::new()).as_ref().map(Vec::as_slice); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `Some(Vec::<()>::new()).as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = Some(Vec::<()>::new()).as_deref(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `.as_mut().map(Vec::as_mut_slice)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:30:13 | LL | let _ = Some(Vec::<()>::new()).as_mut().map(Vec::as_mut_slice); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `Some(Vec::<()>::new()).as_deref_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref_mut + | +LL | let _ = Some(Vec::<()>::new()).as_deref_mut(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `.as_ref().map(|x| x.deref())` on an `Option` value --> tests/ui/option_as_ref_deref.rs:32:13 | LL | let _ = opt.as_ref().map(|x| x.deref()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = opt.as_deref(); + | ~~~~~~~~~~~~~~ error: called `.as_mut().map(|x| x.deref_mut())` on an `Option` value --> tests/ui/option_as_ref_deref.rs:33:13 | LL | let _ = opt.clone().as_mut().map(|x| x.deref_mut()).map(|x| x.len()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.clone().as_deref_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref_mut + | +LL | let _ = opt.clone().as_deref_mut().map(|x| x.len()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `.as_ref().map(|x| &**x)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:40:13 | LL | let _ = opt.as_ref().map(|x| &**x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = opt.as_deref(); + | ~~~~~~~~~~~~~~ error: called `.as_mut().map(|x| &mut **x)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:41:13 | LL | let _ = opt.as_mut().map(|x| &mut **x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.as_deref_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref_mut + | +LL | let _ = opt.as_deref_mut(); + | ~~~~~~~~~~~~~~~~~~ error: called `.as_ref().map(std::ops::Deref::deref)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:44:13 | LL | let _ = opt.as_ref().map(std::ops::Deref::deref); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = opt.as_deref(); + | ~~~~~~~~~~~~~~ error: called `.as_ref().map(String::as_str)` on an `Option` value --> tests/ui/option_as_ref_deref.rs:56:13 | LL | let _ = opt.as_ref().map(String::as_str); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using as_deref + | +LL | let _ = opt.as_deref(); + | ~~~~~~~~~~~~~~ error: aborting due to 18 previous errors diff --git a/src/tools/clippy/tests/ui/option_filter_map.stderr b/src/tools/clippy/tests/ui/option_filter_map.stderr index 401ac2b2296da..54ec6de228003 100644 --- a/src/tools/clippy/tests/ui/option_filter_map.stderr +++ b/src/tools/clippy/tests/ui/option_filter_map.stderr @@ -2,40 +2,69 @@ error: `filter` for `Some` followed by `unwrap` --> tests/ui/option_filter_map.rs:5:27 | LL | let _ = Some(Some(1)).filter(Option::is_some).map(Option::unwrap); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::option-filter-map` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::option_filter_map)]` +help: consider using `flatten` instead + | +LL | let _ = Some(Some(1)).flatten(); + | ~~~~~~~~~ error: `filter` for `Some` followed by `unwrap` --> tests/ui/option_filter_map.rs:7:27 | LL | let _ = Some(Some(1)).filter(|o| o.is_some()).map(|o| o.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = Some(Some(1)).flatten(); + | ~~~~~~~~~ error: `filter` for `Some` followed by `unwrap` --> tests/ui/option_filter_map.rs:9:35 | LL | let _ = Some(1).map(odds_out).filter(Option::is_some).map(Option::unwrap); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = Some(1).map(odds_out).flatten(); + | ~~~~~~~~~ error: `filter` for `Some` followed by `unwrap` --> tests/ui/option_filter_map.rs:11:35 | LL | let _ = Some(1).map(odds_out).filter(|o| o.is_some()).map(|o| o.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = Some(1).map(odds_out).flatten(); + | ~~~~~~~~~ error: `filter` for `Some` followed by `unwrap` --> tests/ui/option_filter_map.rs:14:39 | LL | let _ = vec![Some(1)].into_iter().filter(Option::is_some).map(Option::unwrap); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `Some` followed by `unwrap` --> tests/ui/option_filter_map.rs:16:39 | LL | let _ = vec![Some(1)].into_iter().filter(|o| o.is_some()).map(|o| o.unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `flatten` instead + | +LL | let _ = vec![Some(1)].into_iter().flatten(); + | ~~~~~~~~~ error: `filter` for `Some` followed by `unwrap` --> tests/ui/option_filter_map.rs:21:10 @@ -44,7 +73,12 @@ LL | .filter(Option::is_some) | __________^ LL | | LL | | .map(Option::unwrap); - | |____________________________^ help: consider using `flatten` instead: `flatten()` + | |____________________________^ + | +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: `filter` for `Some` followed by `unwrap` --> tests/ui/option_filter_map.rs:27:10 @@ -53,7 +87,12 @@ LL | .filter(|o| o.is_some()) | __________^ LL | | LL | | .map(|o| o.unwrap()); - | |____________________________^ help: consider using `flatten` instead: `flatten()` + | |____________________________^ + | +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/option_if_let_else.stderr b/src/tools/clippy/tests/ui/option_if_let_else.stderr index 37ef791edb008..68d4f3199e3fa 100644 --- a/src/tools/clippy/tests/ui/option_if_let_else.stderr +++ b/src/tools/clippy/tests/ui/option_if_let_else.stderr @@ -6,22 +6,36 @@ LL | | (true, x) LL | | } else { LL | | (false, "hello") LL | | } - | |_____^ help: try: `string.map_or((false, "hello"), |x| (true, x))` + | |_____^ | = note: `-D clippy::option-if-let-else` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::option_if_let_else)]` +help: try + | +LL | string.map_or((false, "hello"), |x| (true, x)) + | error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:30:13 | LL | let _ = if let Some(s) = *string { s.len() } else { 0 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.map_or(0, |s| s.len())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = string.map_or(0, |s| s.len()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:31:13 | LL | let _ = if let Some(s) = &num { s } else { &0 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = num.as_ref().map_or(&0, |s| s); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:32:13 @@ -47,7 +61,12 @@ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:38:13 | LL | let _ = if let Some(ref s) = num { s } else { &0 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = num.as_ref().map_or(&0, |s| s); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:39:13 @@ -118,7 +137,12 @@ LL | | } else { LL | | // map_or_else must be suggested LL | | side_effect() LL | | }; - | |_____^ help: try: `arg.map_or_else(side_effect, |x| x)` + | |_____^ + | +help: try + | +LL | let _ = arg.map_or_else(side_effect, |x| x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or_else instead of an if let/else --> tests/ui/option_if_let_else.rs:76:13 @@ -151,7 +175,12 @@ LL | | vec![s[..idx].to_string(), s[idx..].to_string()] LL | | } else { LL | | vec![s.to_string()] LL | | } - | |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])` + | |_____________^ + | +help: try + | +LL | s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()]) + | error: use Option::map_or_else instead of an if let/else --> tests/ui/option_if_let_else.rs:120:5 @@ -180,7 +209,12 @@ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:144:13 | LL | let _ = if let Some(x) = optional { x + 2 } else { 5 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = optional.map_or(5, |x| x + 2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:154:13 @@ -208,7 +242,12 @@ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:182:13 | LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = Some(0).map_or(s.len(), |x| s.len() + x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:186:13 @@ -238,7 +277,12 @@ LL | let _ = match s { LL | | Some(string) => string.len(), LL | | None => 1, LL | | }; - | |_____^ help: try: `s.map_or(1, |string| string.len())` + | |_____^ + | +help: try + | +LL | let _ = s.map_or(1, |string| string.len()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:229:13 @@ -248,7 +292,12 @@ LL | let _ = match Some(10) { LL | | Some(a) => a + 1, LL | | None => 5, LL | | }; - | |_____^ help: try: `Some(10).map_or(5, |a| a + 1)` + | |_____^ + | +help: try + | +LL | let _ = Some(10).map_or(5, |a| a + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:235:13 @@ -258,7 +307,12 @@ LL | let _ = match res { LL | | Ok(a) => a + 1, LL | | _ => 1, LL | | }; - | |_____^ help: try: `res.map_or(1, |a| a + 1)` + | |_____^ + | +help: try + | +LL | let _ = res.map_or(1, |a| a + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:239:13 @@ -268,13 +322,23 @@ LL | let _ = match res { LL | | Err(_) => 1, LL | | Ok(a) => a + 1, LL | | }; - | |_____^ help: try: `res.map_or(1, |a| a + 1)` + | |_____^ + | +help: try + | +LL | let _ = res.map_or(1, |a| a + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:243:13 | LL | let _ = if let Ok(a) = res { a + 1 } else { 5 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = res.map_or(5, |a| a + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:260:17 @@ -284,7 +348,12 @@ LL | let _ = match initial { LL | | Some(value) => do_something(value), LL | | None => 42, LL | | }; - | |_________^ help: try: `initial.as_ref().map_or(42, |value| do_something(value))` + | |_________^ + | +help: try + | +LL | let _ = initial.as_ref().map_or(42, |value| do_something(value)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or instead of an if let/else --> tests/ui/option_if_let_else.rs:267:17 @@ -294,7 +363,12 @@ LL | let _ = match initial { LL | | Some(value) => do_something2(value), LL | | None => 42, LL | | }; - | |_________^ help: try: `initial.as_mut().map_or(42, |value| do_something2(value))` + | |_________^ + | +help: try + | +LL | let _ = initial.as_mut().map_or(42, |value| do_something2(value)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or_else instead of an if let/else --> tests/ui/option_if_let_else.rs:290:24 @@ -305,13 +379,23 @@ LL | | hm.clone() LL | | } else { LL | | HashMap::new() LL | | }; - | |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())` + | |_____^ + | +help: try + | +LL | let mut _hashmap = opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use Option::map_or_else instead of an if let/else --> tests/ui/option_if_let_else.rs:296:19 | LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let mut _hm = opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 25 previous errors diff --git a/src/tools/clippy/tests/ui/option_map_or_err_ok.stderr b/src/tools/clippy/tests/ui/option_map_or_err_ok.stderr index 1971af80aa8d4..cdb2c57e15f25 100644 --- a/src/tools/clippy/tests/ui/option_map_or_err_ok.stderr +++ b/src/tools/clippy/tests/ui/option_map_or_err_ok.stderr @@ -2,10 +2,14 @@ error: called `map_or(Err(_), Ok)` on an `Option` value --> tests/ui/option_map_or_err_ok.rs:5:13 | LL | let _ = x.map_or(Err("a"), Ok); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using `ok_or`: `x.ok_or("a")` + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::option-map-or-err-ok` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::option_map_or_err_ok)]` +help: consider using `ok_or` + | +LL | let _ = x.ok_or("a"); + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/option_map_or_none.stderr b/src/tools/clippy/tests/ui/option_map_or_none.stderr index cba29861296f3..a964d24436719 100644 --- a/src/tools/clippy/tests/ui/option_map_or_none.stderr +++ b/src/tools/clippy/tests/ui/option_map_or_none.stderr @@ -2,10 +2,14 @@ error: called `map_or(None, ..)` on an `Option` value --> tests/ui/option_map_or_none.rs:10:26 | LL | let _: Option = opt.map_or(None, |x| Some(x + 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `map`: `opt.map(|x| x + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::option-map-or-none` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::option_map_or_none)]` +help: consider using `map` + | +LL | let _: Option = opt.map(|x| x + 1); + | ~~~~~~~~~~~~~~~~~~ error: called `map_or(None, ..)` on an `Option` value --> tests/ui/option_map_or_none.rs:13:26 @@ -14,13 +18,23 @@ LL | let _: Option = opt.map_or(None, |x| { | __________________________^ LL | | Some(x + 1) LL | | }); - | |_________________________^ help: consider using `map`: `opt.map(|x| x + 1)` + | |_________________________^ + | +help: consider using `map` + | +LL | let _: Option = opt.map(|x| x + 1); + | ~~~~~~~~~~~~~~~~~~ error: called `map_or(None, ..)` on an `Option` value --> tests/ui/option_map_or_none.rs:17:26 | LL | let _: Option = opt.map_or(None, bar); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `and_then`: `opt.and_then(bar)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `and_then` + | +LL | let _: Option = opt.and_then(bar); + | ~~~~~~~~~~~~~~~~~ error: called `map_or(None, ..)` on an `Option` value --> tests/ui/option_map_or_none.rs:18:26 @@ -46,10 +60,14 @@ error: called `map_or(None, Some)` on a `Result` value --> tests/ui/option_map_or_none.rs:25:26 | LL | let _: Option = r.map_or(None, Some); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using `ok`: `r.ok()` + | ^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::result-map-or-into-option` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::result_map_or_into_option)]` +help: consider using `ok` + | +LL | let _: Option = r.ok(); + | ~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/option_map_unit_fn_fixable.stderr b/src/tools/clippy/tests/ui/option_map_unit_fn_fixable.stderr index 5fd3dfd071c2f..948e1ac0c316d 100644 --- a/src/tools/clippy/tests/ui/option_map_unit_fn_fixable.stderr +++ b/src/tools/clippy/tests/ui/option_map_unit_fn_fixable.stderr @@ -2,156 +2,212 @@ error: called `map(f)` on an `Option` value where `f` is a function that returns --> tests/ui/option_map_unit_fn_fixable.rs:37:5 | LL | x.field.map(do_nothing); - | ^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(x_field) = x.field { do_nothing(x_field) }` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::option-map-unit-fn` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::option_map_unit_fn)]` +help: try + | +LL | if let Some(x_field) = x.field { do_nothing(x_field) } + | error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:39:5 | LL | x.field.map(do_nothing); - | ^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(x_field) = x.field { do_nothing(x_field) }` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(x_field) = x.field { do_nothing(x_field) } + | error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:41:5 | LL | x.field.map(diverge); - | ^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(x_field) = x.field { diverge(x_field) }` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(x_field) = x.field { diverge(x_field) } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:47:5 | LL | x.field.map(|value| x.do_option_nothing(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { x.do_option_nothing(value + captured) } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:49:5 | LL | x.field.map(|value| { x.do_option_plus_one(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 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 closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:52:5 | LL | x.field.map(|value| do_nothing(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { do_nothing(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { do_nothing(value + captured) } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:54:5 | LL | x.field.map(|value| { do_nothing(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { do_nothing(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { do_nothing(value + captured) } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:56:5 | LL | x.field.map(|value| { do_nothing(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { do_nothing(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { do_nothing(value + captured); } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:58:5 | LL | x.field.map(|value| { { do_nothing(value + captured); } }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { do_nothing(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { do_nothing(value + captured); } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:61:5 | LL | x.field.map(|value| diverge(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { diverge(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { diverge(value + captured) } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:63:5 | LL | x.field.map(|value| { diverge(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { diverge(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { diverge(value + captured) } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:65:5 | LL | x.field.map(|value| { diverge(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { diverge(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { diverge(value + captured); } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:67:5 | LL | x.field.map(|value| { { diverge(value + captured); } }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { diverge(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { diverge(value + captured); } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:72:5 | LL | x.field.map(|value| { let y = plus_one(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { let y = plus_one(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { let y = plus_one(value + captured); } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:74:5 | LL | x.field.map(|value| { plus_one(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { plus_one(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { plus_one(value + captured); } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:76:5 | LL | x.field.map(|value| { { plus_one(value + captured); } }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = x.field { plus_one(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = x.field { plus_one(value + captured); } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:79:5 | LL | x.field.map(|ref value| { do_nothing(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(ref value) = x.field { do_nothing(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(ref value) = x.field { do_nothing(value + captured) } + | error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:81:5 | LL | option().map(do_nothing); - | ^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(a) = option() { do_nothing(a) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(a) = option() { do_nothing(a) } + | error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` --> tests/ui/option_map_unit_fn_fixable.rs:83:5 | LL | option().map(|value| println!("{:?}", value)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Some(value) = option() { println!("{:?}", value) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Some(value) = option() { println!("{:?}", value) } + | error: aborting due to 19 previous errors diff --git a/src/tools/clippy/tests/ui/or_fun_call.stderr b/src/tools/clippy/tests/ui/or_fun_call.stderr index b5a30f2992316..a515695bcfd1f 100644 --- a/src/tools/clippy/tests/ui/or_fun_call.stderr +++ b/src/tools/clippy/tests/ui/or_fun_call.stderr @@ -2,193 +2,346 @@ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:52:22 | LL | with_constructor.unwrap_or(make()); - | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(make)` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::or-fun-call` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::or_fun_call)]` +help: try + | +LL | with_constructor.unwrap_or_else(make); + | ~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` to construct default value --> tests/ui/or_fun_call.rs:55:14 | LL | with_new.unwrap_or(Vec::new()); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unwrap-or-default` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]` +help: try + | +LL | with_new.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:58:21 | LL | with_const_args.unwrap_or(Vec::with_capacity(12)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Vec::with_capacity(12))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_const_args.unwrap_or_else(|| Vec::with_capacity(12)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:61:14 | LL | with_err.unwrap_or(make()); - | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| make())` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_err.unwrap_or_else(|_| make()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:64:19 | LL | with_err_args.unwrap_or(Vec::with_capacity(12)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Vec::with_capacity(12))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_err_args.unwrap_or_else(|_| Vec::with_capacity(12)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` to construct default value --> tests/ui/or_fun_call.rs:67:24 | LL | with_default_trait.unwrap_or(Default::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_default_trait.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` to construct default value --> tests/ui/or_fun_call.rs:70:23 | LL | with_default_type.unwrap_or(u64::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_default_type.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:73:18 | LL | self_default.unwrap_or(::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(::default)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | self_default.unwrap_or_else(::default); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` to construct default value --> tests/ui/or_fun_call.rs:76:18 | LL | real_default.unwrap_or(::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | real_default.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` to construct default value --> tests/ui/or_fun_call.rs:79:14 | LL | with_vec.unwrap_or(vec![]); - | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_vec.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:82:21 | LL | without_default.unwrap_or(Foo::new()); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(Foo::new)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | without_default.unwrap_or_else(Foo::new); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `or_insert` to construct default value --> tests/ui/or_fun_call.rs:85:19 | LL | map.entry(42).or_insert(String::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | map.entry(42).or_default(); + | ~~~~~~~~~~~~ error: use of `or_insert` to construct default value --> tests/ui/or_fun_call.rs:88:23 | LL | map_vec.entry(42).or_insert(vec![]); - | ^^^^^^^^^^^^^^^^^ help: try: `or_default()` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | map_vec.entry(42).or_default(); + | ~~~~~~~~~~~~ error: use of `or_insert` to construct default value --> tests/ui/or_fun_call.rs:91:21 | LL | btree.entry(42).or_insert(String::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | btree.entry(42).or_default(); + | ~~~~~~~~~~~~ error: use of `or_insert` to construct default value --> tests/ui/or_fun_call.rs:94:25 | LL | btree_vec.entry(42).or_insert(vec![]); - | ^^^^^^^^^^^^^^^^^ help: try: `or_default()` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | btree_vec.entry(42).or_default(); + | ~~~~~~~~~~~~ error: use of `unwrap_or` to construct default value --> tests/ui/or_fun_call.rs:97:21 | LL | let _ = stringy.unwrap_or(String::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = stringy.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:105:21 | LL | let _ = Some(1).unwrap_or(map[&1]); - | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = Some(1).unwrap_or_else(|| map[&1]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:107:21 | LL | let _ = Some(1).unwrap_or(map[&1]); - | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = Some(1).unwrap_or_else(|| map[&1]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `or` followed by a function call --> tests/ui/or_fun_call.rs:131:35 | LL | let _ = Some("a".to_string()).or(Some("b".to_string())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_else(|| Some("b".to_string()))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = Some("a".to_string()).or_else(|| Some("b".to_string())); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:170:14 | LL | None.unwrap_or(ptr_to_ref(s)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| ptr_to_ref(s))` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | None.unwrap_or_else(|| ptr_to_ref(s)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:176:14 | LL | None.unwrap_or(unsafe { ptr_to_ref(s) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | None.unwrap_or_else(|| unsafe { ptr_to_ref(s) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/or_fun_call.rs:178:14 | LL | None.unwrap_or( unsafe { ptr_to_ref(s) } ); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | None.unwrap_or_else(|| unsafe { ptr_to_ref(s) }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `map_or` followed by a function call --> tests/ui/or_fun_call.rs:253:25 | LL | let _ = Some(4).map_or(g(), |v| v); - | ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(g, |v| v)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = Some(4).map_or_else(g, |v| v); + | ~~~~~~~~~~~~~~~~~~~~~ error: use of `map_or` followed by a function call --> tests/ui/or_fun_call.rs:254:25 | LL | let _ = Some(4).map_or(g(), f); - | ^^^^^^^^^^^^^^ help: try: `map_or_else(g, f)` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = Some(4).map_or_else(g, f); + | ~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/or_fun_call.rs:285:18 | LL | with_new.unwrap_or_else(Vec::new); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_new.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/or_fun_call.rs:288:28 | LL | with_default_trait.unwrap_or_else(Default::default); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_default_trait.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/or_fun_call.rs:291:27 | LL | with_default_type.unwrap_or_else(u64::default); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_default_type.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/or_fun_call.rs:294:22 | LL | real_default.unwrap_or_else(::default); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | real_default.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `or_insert_with` to construct default value --> tests/ui/or_fun_call.rs:297:23 | LL | map.entry(42).or_insert_with(String::new); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | map.entry(42).or_default(); + | ~~~~~~~~~~~~ error: use of `or_insert_with` to construct default value --> tests/ui/or_fun_call.rs:300:25 | LL | btree.entry(42).or_insert_with(String::new); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | btree.entry(42).or_default(); + | ~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/or_fun_call.rs:303:25 | LL | let _ = stringy.unwrap_or_else(String::new); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = stringy.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 31 previous errors diff --git a/src/tools/clippy/tests/ui/or_then_unwrap.stderr b/src/tools/clippy/tests/ui/or_then_unwrap.stderr index f454316068f26..6df5e9c6335d5 100644 --- a/src/tools/clippy/tests/ui/or_then_unwrap.stderr +++ b/src/tools/clippy/tests/ui/or_then_unwrap.stderr @@ -2,22 +2,36 @@ error: found `.or(Some(…)).unwrap()` --> tests/ui/or_then_unwrap.rs:22:20 | LL | let _ = option.or(Some("fallback")).unwrap(); // should trigger lint - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::or-then-unwrap` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::or_then_unwrap)]` +help: try + | +LL | let _ = option.unwrap_or("fallback"); // should trigger lint + | ~~~~~~~~~~~~~~~~~~~~~ error: found `.or(Ok(…)).unwrap()` --> tests/ui/or_then_unwrap.rs:25:20 | LL | let _ = result.or::<&str>(Ok("fallback")).unwrap(); // should trigger lint - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = result.unwrap_or("fallback"); // should trigger lint + | ~~~~~~~~~~~~~~~~~~~~~ error: found `.or(Some(…)).unwrap()` --> tests/ui/or_then_unwrap.rs:29:31 | LL | let _ = option.map(|v| v).or(Some("fallback")).unwrap().to_string().chars(); // should trigger lint - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = option.map(|v| v).unwrap_or("fallback").to_string().chars(); // should trigger lint + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/overly_complex_bool_expr.stderr b/src/tools/clippy/tests/ui/overly_complex_bool_expr.stderr index 5a754236fe4b2..c0509c8c13602 100644 --- a/src/tools/clippy/tests/ui/overly_complex_bool_expr.stderr +++ b/src/tools/clippy/tests/ui/overly_complex_bool_expr.stderr @@ -2,7 +2,7 @@ error: this boolean expression contains a logic bug --> tests/ui/overly_complex_bool_expr.rs:10:13 | LL | let _ = a && b || a; - | ^^^^^^^^^^^ help: it would look like the following: `a` + | ^^^^^^^^^^^ | help: this expression can be optimized out by applying boolean operations to the outer expression --> tests/ui/overly_complex_bool_expr.rs:10:18 @@ -11,54 +11,74 @@ LL | let _ = a && b || a; | ^ = note: `-D clippy::overly-complex-bool-expr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::overly_complex_bool_expr)]` +help: it would look like the following + | +LL | let _ = a; + | ~ error: this boolean expression contains a logic bug --> tests/ui/overly_complex_bool_expr.rs:13:13 | LL | 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 --> tests/ui/overly_complex_bool_expr.rs:13:22 | LL | let _ = false && a; | ^ +help: it would look like the following + | +LL | let _ = false; + | ~~~~~ error: this boolean expression contains a logic bug --> tests/ui/overly_complex_bool_expr.rs:24:13 | LL | 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 --> tests/ui/overly_complex_bool_expr.rs:24:13 | LL | let _ = a == b && a != b; | ^^^^^^ +help: it would look like the following + | +LL | let _ = false; + | ~~~~~ error: this boolean expression contains a logic bug --> tests/ui/overly_complex_bool_expr.rs:26:13 | LL | 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 --> tests/ui/overly_complex_bool_expr.rs:26:13 | LL | let _ = a < b && a >= b; | ^^^^^ +help: it would look like the following + | +LL | let _ = false; + | ~~~~~ error: this boolean expression contains a logic bug --> tests/ui/overly_complex_bool_expr.rs:28:13 | LL | 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 --> tests/ui/overly_complex_bool_expr.rs:28:13 | LL | let _ = a > b && a <= b; | ^^^^^ +help: it would look like the following + | +LL | let _ = false; + | ~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/partialeq_to_none.stderr b/src/tools/clippy/tests/ui/partialeq_to_none.stderr index b588fbf32b606..9d18dfae7bf4c 100644 --- a/src/tools/clippy/tests/ui/partialeq_to_none.stderr +++ b/src/tools/clippy/tests/ui/partialeq_to_none.stderr @@ -2,58 +2,102 @@ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:14:8 | LL | if f != None { "yay" } else { "nay" } - | ^^^^^^^^^ help: use `Option::is_some()` instead: `f.is_some()` + | ^^^^^^^^^ | = note: `-D clippy::partialeq-to-none` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::partialeq_to_none)]` +help: use `Option::is_some()` instead + | +LL | if f.is_some() { "yay" } else { "nay" } + | ~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:44:13 | LL | let _ = x == None; - | ^^^^^^^^^ help: use `Option::is_none()` instead: `x.is_none()` + | ^^^^^^^^^ + | +help: use `Option::is_none()` instead + | +LL | let _ = x.is_none(); + | ~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:45:13 | LL | let _ = x != None; - | ^^^^^^^^^ help: use `Option::is_some()` instead: `x.is_some()` + | ^^^^^^^^^ + | +help: use `Option::is_some()` instead + | +LL | let _ = x.is_some(); + | ~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:46:13 | LL | let _ = None == x; - | ^^^^^^^^^ help: use `Option::is_none()` instead: `x.is_none()` + | ^^^^^^^^^ + | +help: use `Option::is_none()` instead + | +LL | let _ = x.is_none(); + | ~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:47:13 | LL | let _ = None != x; - | ^^^^^^^^^ help: use `Option::is_some()` instead: `x.is_some()` + | ^^^^^^^^^ + | +help: use `Option::is_some()` instead + | +LL | let _ = x.is_some(); + | ~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:49:8 | LL | if foobar() == None {} - | ^^^^^^^^^^^^^^^^ help: use `Option::is_none()` instead: `foobar().is_none()` + | ^^^^^^^^^^^^^^^^ + | +help: use `Option::is_none()` instead + | +LL | if foobar().is_none() {} + | ~~~~~~~~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:51:8 | LL | if bar().ok() != None {} - | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `bar().ok().is_some()` + | ^^^^^^^^^^^^^^^^^^ + | +help: use `Option::is_some()` instead + | +LL | if bar().ok().is_some() {} + | ~~~~~~~~~~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:53:13 | LL | let _ = Some(1 + 2) != None; - | ^^^^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `Some(1 + 2).is_some()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: use `Option::is_some()` instead + | +LL | let _ = Some(1 + 2).is_some(); + | ~~~~~~~~~~~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:55:13 | LL | let _ = { Some(0) } == None; - | ^^^^^^^^^^^^^^^^^^^ help: use `Option::is_none()` instead: `{ Some(0) }.is_none()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: use `Option::is_none()` instead + | +LL | let _ = { Some(0) }.is_none(); + | ~~~~~~~~~~~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:57:13 @@ -81,31 +125,56 @@ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:67:13 | LL | let _ = optref() == &&None; - | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_none()` instead: `optref().is_none()` + | ^^^^^^^^^^^^^^^^^^ + | +help: use `Option::is_none()` instead + | +LL | let _ = optref().is_none(); + | ~~~~~~~~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:68:13 | LL | let _ = &&None != optref(); - | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `optref().is_some()` + | ^^^^^^^^^^^^^^^^^^ + | +help: use `Option::is_some()` instead + | +LL | let _ = optref().is_some(); + | ~~~~~~~~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:69:13 | LL | let _ = **optref() == None; - | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_none()` instead: `optref().is_none()` + | ^^^^^^^^^^^^^^^^^^ + | +help: use `Option::is_none()` instead + | +LL | let _ = optref().is_none(); + | ~~~~~~~~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:70:13 | LL | let _ = &None != *optref(); - | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `optref().is_some()` + | ^^^^^^^^^^^^^^^^^^ + | +help: use `Option::is_some()` instead + | +LL | let _ = optref().is_some(); + | ~~~~~~~~~~~~~~~~~~ error: binary comparison to literal `Option::None` --> tests/ui/partialeq_to_none.rs:73:13 | LL | let _ = None != *x; - | ^^^^^^^^^^ help: use `Option::is_some()` instead: `(*x).is_some()` + | ^^^^^^^^^^ + | +help: use `Option::is_some()` instead + | +LL | let _ = (*x).is_some(); + | ~~~~~~~~~~~~~~ error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/path_buf_push_overwrite.stderr b/src/tools/clippy/tests/ui/path_buf_push_overwrite.stderr index c9f36ecf48f60..eebc76ffaee88 100644 --- a/src/tools/clippy/tests/ui/path_buf_push_overwrite.stderr +++ b/src/tools/clippy/tests/ui/path_buf_push_overwrite.stderr @@ -2,10 +2,14 @@ error: calling `push` with '/' or '\' (file system root) will overwrite the prev --> tests/ui/path_buf_push_overwrite.rs:6:12 | LL | x.push("/bar"); - | ^^^^^^ help: try: `"bar"` + | ^^^^^^ | = note: `-D clippy::path-buf-push-overwrite` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::path_buf_push_overwrite)]` +help: try + | +LL | x.push("bar"); + | ~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/path_ends_with_ext.stderr b/src/tools/clippy/tests/ui/path_ends_with_ext.stderr index deab71ff76268..b3546907a0bc6 100644 --- a/src/tools/clippy/tests/ui/path_ends_with_ext.stderr +++ b/src/tools/clippy/tests/ui/path_ends_with_ext.stderr @@ -2,16 +2,25 @@ error: this looks like a failed attempt at checking for the file extension --> tests/ui/path_ends_with_ext.rs:11:5 | LL | path.ends_with(".md"); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `path.extension().is_some_and(|ext| ext == "md")` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::path-ends-with-ext` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::path_ends_with_ext)]` +help: try + | +LL | path.extension().is_some_and(|ext| ext == "md"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this looks like a failed attempt at checking for the file extension --> tests/ui/path_ends_with_ext.rs:32:5 | LL | path.ends_with(".md") - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `path.extension().map_or(false, |ext| ext == "md")` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | path.extension().map_or(false, |ext| ext == "md") + | error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/patterns.stderr b/src/tools/clippy/tests/ui/patterns.stderr index fa4cf7f835622..acefb97050d8e 100644 --- a/src/tools/clippy/tests/ui/patterns.stderr +++ b/src/tools/clippy/tests/ui/patterns.stderr @@ -2,22 +2,36 @@ error: the `y @ _` pattern can be written as just `y` --> tests/ui/patterns.rs:14:9 | LL | y @ _ => (), - | ^^^^^ help: try: `y` + | ^^^^^ | = note: `-D clippy::redundant-pattern` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern)]` +help: try + | +LL | y => (), + | ~ error: the `x @ _` pattern can be written as just `x` --> tests/ui/patterns.rs:29:9 | LL | ref mut x @ _ => { - | ^^^^^^^^^^^^^ help: try: `ref mut x` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | ref mut x => { + | ~~~~~~~~~ error: the `x @ _` pattern can be written as just `x` --> tests/ui/patterns.rs:37:9 | LL | ref x @ _ => println!("vec: {:?}", x), - | ^^^^^^^^^ help: try: `ref x` + | ^^^^^^^^^ + | +help: try + | +LL | ref x => println!("vec: {:?}", x), + | ~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/precedence.stderr b/src/tools/clippy/tests/ui/precedence.stderr index 47e61326219d9..dd816679630ae 100644 --- a/src/tools/clippy/tests/ui/precedence.stderr +++ b/src/tools/clippy/tests/ui/precedence.stderr @@ -2,76 +2,135 @@ error: operator precedence can trip the unwary --> tests/ui/precedence.rs:16:5 | LL | 1 << 2 + 3; - | ^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (2 + 3)` + | ^^^^^^^^^^ | = note: `-D clippy::precedence` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::precedence)]` +help: consider parenthesizing your expression + | +LL | 1 << (2 + 3); + | ~~~~~~~~~~~~ error: operator precedence can trip the unwary --> tests/ui/precedence.rs:17:5 | LL | 1 + 2 << 3; - | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 2) << 3` + | ^^^^^^^^^^ + | +help: consider parenthesizing your expression + | +LL | (1 + 2) << 3; + | ~~~~~~~~~~~~ error: operator precedence can trip the unwary --> tests/ui/precedence.rs:18:5 | LL | 4 >> 1 + 1; - | ^^^^^^^^^^ help: consider parenthesizing your expression: `4 >> (1 + 1)` + | ^^^^^^^^^^ + | +help: consider parenthesizing your expression + | +LL | 4 >> (1 + 1); + | ~~~~~~~~~~~~ error: operator precedence can trip the unwary --> tests/ui/precedence.rs:19:5 | LL | 1 + 3 >> 2; - | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 3) >> 2` + | ^^^^^^^^^^ + | +help: consider parenthesizing your expression + | +LL | (1 + 3) >> 2; + | ~~~~~~~~~~~~ error: operator precedence can trip the unwary --> tests/ui/precedence.rs:20:5 | LL | 1 ^ 1 - 1; - | ^^^^^^^^^ help: consider parenthesizing your expression: `1 ^ (1 - 1)` + | ^^^^^^^^^ + | +help: consider parenthesizing your expression + | +LL | 1 ^ (1 - 1); + | ~~~~~~~~~~~ error: operator precedence can trip the unwary --> tests/ui/precedence.rs:21:5 | LL | 3 | 2 - 1; - | ^^^^^^^^^ help: consider parenthesizing your expression: `3 | (2 - 1)` + | ^^^^^^^^^ + | +help: consider parenthesizing your expression + | +LL | 3 | (2 - 1); + | ~~~~~~~~~~~ error: operator precedence can trip the unwary --> tests/ui/precedence.rs:22:5 | LL | 3 & 5 - 2; - | ^^^^^^^^^ help: consider parenthesizing your expression: `3 & (5 - 2)` + | ^^^^^^^^^ + | +help: consider parenthesizing your expression + | +LL | 3 & (5 - 2); + | ~~~~~~~~~~~ error: unary minus has lower precedence than method call --> tests/ui/precedence.rs:23:5 | LL | -1i32.abs(); - | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1i32.abs())` + | ^^^^^^^^^^^ + | +help: consider adding parentheses to clarify your intent + | +LL | -(1i32.abs()); + | ~~~~~~~~~~~~~ error: unary minus has lower precedence than method call --> tests/ui/precedence.rs:24:5 | LL | -1f32.abs(); - | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1f32.abs())` + | ^^^^^^^^^^^ + | +help: consider adding parentheses to clarify your intent + | +LL | -(1f32.abs()); + | ~~~~~~~~~~~~~ error: unary minus has lower precedence than method call --> tests/ui/precedence.rs:51:13 | LL | let _ = -1.0_f64.cos().cos(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1.0_f64.cos().cos())` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider adding parentheses to clarify your intent + | +LL | let _ = -(1.0_f64.cos().cos()); + | ~~~~~~~~~~~~~~~~~~~~~~ error: unary minus has lower precedence than method call --> tests/ui/precedence.rs:52:13 | LL | let _ = -1.0_f64.cos().sin(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1.0_f64.cos().sin())` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider adding parentheses to clarify your intent + | +LL | let _ = -(1.0_f64.cos().sin()); + | ~~~~~~~~~~~~~~~~~~~~~~ error: unary minus has lower precedence than method call --> tests/ui/precedence.rs:53:13 | LL | let _ = -1.0_f64.sin().cos(); - | ^^^^^^^^^^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1.0_f64.sin().cos())` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider adding parentheses to clarify your intent + | +LL | let _ = -(1.0_f64.sin().cos()); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 12 previous errors diff --git a/src/tools/clippy/tests/ui/print_in_format_impl.stderr b/src/tools/clippy/tests/ui/print_in_format_impl.stderr index 3fb6b3f9c9110..ba08004febc35 100644 --- a/src/tools/clippy/tests/ui/print_in_format_impl.stderr +++ b/src/tools/clippy/tests/ui/print_in_format_impl.stderr @@ -2,46 +2,80 @@ error: use of `print!` in `Debug` impl --> tests/ui/print_in_format_impl.rs:20:9 | LL | print!("{}", 1); - | ^^^^^^^^^^^^^^^ help: replace with: `write!(f, ..)` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::print-in-format-impl` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::print_in_format_impl)]` +help: replace with + | +LL | write!(f, ..); + | ~~~~~~~~~~~~~ error: use of `println!` in `Debug` impl --> tests/ui/print_in_format_impl.rs:23:9 | LL | println!("{}", 2); - | ^^^^^^^^^^^^^^^^^ help: replace with: `writeln!(f, ..)` + | ^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | writeln!(f, ..); + | ~~~~~~~~~~~~~~~ error: use of `eprint!` in `Debug` impl --> tests/ui/print_in_format_impl.rs:25:9 | LL | eprint!("{}", 3); - | ^^^^^^^^^^^^^^^^ help: replace with: `write!(f, ..)` + | ^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | write!(f, ..); + | ~~~~~~~~~~~~~ error: use of `eprintln!` in `Debug` impl --> tests/ui/print_in_format_impl.rs:27:9 | LL | eprintln!("{}", 4); - | ^^^^^^^^^^^^^^^^^^ help: replace with: `writeln!(f, ..)` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | writeln!(f, ..); + | ~~~~~~~~~~~~~~~ error: use of `println!` in `Debug` impl --> tests/ui/print_in_format_impl.rs:30:13 | LL | println!("nested"); - | ^^^^^^^^^^^^^^^^^^ help: replace with: `writeln!(f, ..)` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | writeln!(f, ..); + | ~~~~~~~~~~~~~~~ error: use of `print!` in `Display` impl --> tests/ui/print_in_format_impl.rs:44:9 | LL | print!("Display"); - | ^^^^^^^^^^^^^^^^^ help: replace with: `write!(f, ..)` + | ^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | write!(f, ..); + | ~~~~~~~~~~~~~ error: use of `println!` in `Debug` impl --> tests/ui/print_in_format_impl.rs:55:9 | LL | println!("UnnamedFormatter"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `writeln!(..)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | writeln!(..); + | ~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/println_empty_string.stderr b/src/tools/clippy/tests/ui/println_empty_string.stderr index 17de05fa25a42..de478aded06de 100644 --- a/src/tools/clippy/tests/ui/println_empty_string.stderr +++ b/src/tools/clippy/tests/ui/println_empty_string.stderr @@ -2,36 +2,51 @@ error: empty string literal in `println!` --> tests/ui/println_empty_string.rs:5:5 | LL | println!(""); - | ^^^^^^^^^--^ - | | - | help: remove the empty string + | ^^^^^^^^^^^^ | = note: `-D clippy::println-empty-string` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::println_empty_string)]` +help: remove the empty string + | +LL - println!(""); +LL + println!(); + | error: empty string literal in `println!` --> tests/ui/println_empty_string.rs:8:14 | LL | _ => println!(""), - | ^^^^^^^^^--^ - | | - | help: remove the empty string + | ^^^^^^^^^^^^ + | +help: remove the empty string + | +LL - _ => println!(""), +LL + _ => println!(), + | error: empty string literal in `eprintln!` --> tests/ui/println_empty_string.rs:12:5 | LL | eprintln!(""); - | ^^^^^^^^^^--^ - | | - | help: remove the empty string + | ^^^^^^^^^^^^^ + | +help: remove the empty string + | +LL - eprintln!(""); +LL + eprintln!(); + | error: empty string literal in `eprintln!` --> tests/ui/println_empty_string.rs:15:14 | LL | _ => eprintln!(""), - | ^^^^^^^^^^--^ - | | - | help: remove the empty string + | ^^^^^^^^^^^^^ + | +help: remove the empty string + | +LL - _ => eprintln!(""), +LL + _ => eprintln!(), + | error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/ptr_arg.stderr b/src/tools/clippy/tests/ui/ptr_arg.stderr index 1848ef80fc495..9458fd6c58e23 100644 --- a/src/tools/clippy/tests/ui/ptr_arg.stderr +++ b/src/tools/clippy/tests/ui/ptr_arg.stderr @@ -2,52 +2,91 @@ error: writing `&Vec` instead of `&[_]` involves a new object where a slice will --> tests/ui/ptr_arg.rs:13:14 | LL | fn do_vec(x: &Vec) { - | ^^^^^^^^^ help: change this to: `&[i64]` + | ^^^^^^^^^ | = note: `-D clippy::ptr-arg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]` +help: change this to + | +LL | fn do_vec(x: &[i64]) { + | ~~~~~~ error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:19:18 | LL | fn do_vec_mut(x: &mut Vec) { - | ^^^^^^^^^^^^^ help: change this to: `&mut [i64]` + | ^^^^^^^^^^^^^ + | +help: change this to + | +LL | fn do_vec_mut(x: &mut [i64]) { + | ~~~~~~~~~~ error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:24:19 | LL | fn do_vec_mut2(x: &mut Vec) { - | ^^^^^^^^^^^^^ help: change this to: `&mut [i64]` + | ^^^^^^^^^^^^^ + | +help: change this to + | +LL | fn do_vec_mut2(x: &mut [i64]) { + | ~~~~~~~~~~ error: writing `&String` instead of `&str` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:30:14 | LL | fn do_str(x: &String) { - | ^^^^^^^ help: change this to: `&str` + | ^^^^^^^ + | +help: change this to + | +LL | fn do_str(x: &str) { + | ~~~~ error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:35:18 | LL | fn do_str_mut(x: &mut String) { - | ^^^^^^^^^^^ help: change this to: `&mut str` + | ^^^^^^^^^^^ + | +help: change this to + | +LL | fn do_str_mut(x: &mut str) { + | ~~~~~~~~ error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:40:15 | LL | fn do_path(x: &PathBuf) { - | ^^^^^^^^ help: change this to: `&Path` + | ^^^^^^^^ + | +help: change this to + | +LL | fn do_path(x: &Path) { + | ~~~~~ error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:45:19 | LL | fn do_path_mut(x: &mut PathBuf) { - | ^^^^^^^^^^^^ help: change this to: `&mut Path` + | ^^^^^^^^^^^^ + | +help: change this to + | +LL | fn do_path_mut(x: &mut Path) { + | ~~~~~~~~~ error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:54:18 | LL | fn do_vec(x: &Vec); - | ^^^^^^^^^ help: change this to: `&[i64]` + | ^^^^^^^^^ + | +help: change this to + | +LL | fn do_vec(x: &[i64]); + | ~~~~~~ error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:68:14 @@ -120,13 +159,23 @@ error: using a reference to `Cow` is not recommended --> tests/ui/ptr_arg.rs:111:25 | LL | fn test_cow_with_ref(c: &Cow<[i32]>) {} - | ^^^^^^^^^^^ help: change this to: `&[i32]` + | ^^^^^^^^^^^ + | +help: change this to + | +LL | fn test_cow_with_ref(c: &[i32]) {} + | ~~~~~~ error: writing `&String` instead of `&str` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:141:66 | LL | fn some_allowed(#[allow(clippy::ptr_arg)] _v: &Vec, _s: &String) {} - | ^^^^^^^ help: change this to: `&str` + | ^^^^^^^ + | +help: change this to + | +LL | fn some_allowed(#[allow(clippy::ptr_arg)] _v: &Vec, _s: &str) {} + | ~~~~ error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:171:21 @@ -174,43 +223,78 @@ error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a sl --> tests/ui/ptr_arg.rs:190:29 | LL | fn mut_vec_slice_methods(v: &mut Vec) { - | ^^^^^^^^^^^^^ help: change this to: `&mut [u32]` + | ^^^^^^^^^^^^^ + | +help: change this to + | +LL | fn mut_vec_slice_methods(v: &mut [u32]) { + | ~~~~~~~~~~ error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:253:17 | LL | fn dyn_trait(a: &mut Vec, b: &mut String, c: &mut PathBuf) { - | ^^^^^^^^^^^^^ help: change this to: `&mut [u32]` + | ^^^^^^^^^^^^^ + | +help: change this to + | +LL | fn dyn_trait(a: &mut [u32], b: &mut String, c: &mut PathBuf) { + | ~~~~~~~~~~ error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:253:35 | LL | fn dyn_trait(a: &mut Vec, b: &mut String, c: &mut PathBuf) { - | ^^^^^^^^^^^ help: change this to: `&mut str` + | ^^^^^^^^^^^ + | +help: change this to + | +LL | fn dyn_trait(a: &mut Vec, b: &mut str, c: &mut PathBuf) { + | ~~~~~~~~ error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do --> tests/ui/ptr_arg.rs:253:51 | LL | fn dyn_trait(a: &mut Vec, b: &mut String, c: &mut PathBuf) { - | ^^^^^^^^^^^^ help: change this to: `&mut Path` + | ^^^^^^^^^^^^ + | +help: change this to + | +LL | fn dyn_trait(a: &mut Vec, b: &mut String, c: &mut Path) { + | ~~~~~~~~~ error: using a reference to `Cow` is not recommended --> tests/ui/ptr_arg.rs:279:39 | LL | fn cow_elided_lifetime<'a>(input: &'a Cow) -> &'a str { - | ^^^^^^^^^^^^ help: change this to: `&str` + | ^^^^^^^^^^^^ + | +help: change this to + | +LL | fn cow_elided_lifetime<'a>(input: &str) -> &'a str { + | ~~~~ error: using a reference to `Cow` is not recommended --> tests/ui/ptr_arg.rs:285:36 | LL | fn cow_bad_ret_ty_1<'a>(input: &'a Cow<'a, str>) -> &'static str { - | ^^^^^^^^^^^^^^^^ help: change this to: `&str` + | ^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | fn cow_bad_ret_ty_1<'a>(input: &str) -> &'static str { + | ~~~~ error: using a reference to `Cow` is not recommended --> tests/ui/ptr_arg.rs:289:40 | LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &'a Cow<'a, str>) -> &'b str { - | ^^^^^^^^^^^^^^^^ help: change this to: `&str` + | ^^^^^^^^^^^^^^^^ + | +help: change this to + | +LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &str) -> &'b str { + | ~~~~ error: aborting due to 24 previous errors diff --git a/src/tools/clippy/tests/ui/ptr_as_ptr.stderr b/src/tools/clippy/tests/ui/ptr_as_ptr.stderr index e162f35baf551..ce0ceba8516e5 100644 --- a/src/tools/clippy/tests/ui/ptr_as_ptr.stderr +++ b/src/tools/clippy/tests/ui/ptr_as_ptr.stderr @@ -2,204 +2,367 @@ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:18:33 | LL | *unsafe { Box::from_raw(Box::into_raw(Box::new(o)) as *mut super::issue_11278_a::T) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `Box::into_raw(Box::new(o)).cast::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::ptr-as-ptr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_as_ptr)]` +help: try `pointer::cast`, a safer alternative + | +LL | *unsafe { Box::from_raw(Box::into_raw(Box::new(o)).cast::>()) } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:27:13 | LL | let _ = ptr as *const i32; - | ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::()` + | ^^^^^^^^^^^^^^^^^ + | +help: try `pointer::cast`, a safer alternative + | +LL | let _ = ptr.cast::(); + | ~~~~~~~~~~~~~~~~~ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:28:13 | LL | let _ = mut_ptr as *mut i32; - | ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try `pointer::cast`, a safer alternative + | +LL | let _ = mut_ptr.cast::(); + | ~~~~~~~~~~~~~~~~~~~~~ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:33:17 | LL | let _ = *ptr_ptr as *const i32; - | ^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `(*ptr_ptr).cast::()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try `pointer::cast`, a safer alternative + | +LL | let _ = (*ptr_ptr).cast::(); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:46:25 | LL | let _: *const i32 = ptr as *const _; - | ^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast()` + | ^^^^^^^^^^^^^^^ + | +help: try `pointer::cast`, a safer alternative + | +LL | let _: *const i32 = ptr.cast(); + | ~~~~~~~~~~ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:47:23 | LL | let _: *mut i32 = mut_ptr as _; - | ^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast()` + | ^^^^^^^^^^^^ + | +help: try `pointer::cast`, a safer alternative + | +LL | let _: *mut i32 = mut_ptr.cast(); + | ~~~~~~~~~~~~~~ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:50:21 | LL | let _ = inline!($ptr as *const i32); - | ^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `$ptr.cast::()` + | ^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try `pointer::cast`, a safer alternative + | +LL | let _ = inline!($ptr.cast::()); + | ~~~~~~~~~~~~~~~~~~ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:71:13 | LL | let _ = ptr as *const i32; - | ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::()` + | ^^^^^^^^^^^^^^^^^ + | +help: try `pointer::cast`, a safer alternative + | +LL | let _ = ptr.cast::(); + | ~~~~~~~~~~~~~~~~~ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:72:13 | LL | let _ = mut_ptr as *mut i32; - | ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try `pointer::cast`, a safer alternative + | +LL | let _ = mut_ptr.cast::(); + | ~~~~~~~~~~~~~~~~~~~~~ error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:79:9 | LL | ptr::null_mut() as *mut u32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null_mut::() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:83:9 | LL | std::ptr::null_mut() as *mut u32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | std::ptr::null_mut::() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:88:9 | LL | ptr::null_mut() as *mut u32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null_mut::() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:92:9 | LL | core::ptr::null_mut() as *mut u32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | core::ptr::null_mut::() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:97:9 | LL | ptr::null() as *const u32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null::() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:101:9 | LL | std::ptr::null() as *const u32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | std::ptr::null::() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:106:9 | LL | ptr::null() as *const u32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null::() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:110:9 | LL | core::ptr::null() as *const u32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | core::ptr::null::() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:117:9 | LL | ptr::null_mut() as *mut _ - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null_mut() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:121:9 | LL | std::ptr::null_mut() as *mut _ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | std::ptr::null_mut() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:126:9 | LL | ptr::null_mut() as *mut _ - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null_mut() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:130:9 | LL | core::ptr::null_mut() as *mut _ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | core::ptr::null_mut() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:135:9 | LL | ptr::null() as *const _ - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:139:9 | LL | std::ptr::null() as *const _ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | std::ptr::null() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:144:9 | LL | ptr::null() as *const _ - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:148:9 | LL | core::ptr::null() as *const _ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | core::ptr::null() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:155:9 | LL | ptr::null_mut() as _ - | ^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null_mut() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:159:9 | LL | std::ptr::null_mut() as _ - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | std::ptr::null_mut() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:164:9 | LL | ptr::null_mut() as _ - | ^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null_mut() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:168:9 | LL | core::ptr::null_mut() as _ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | core::ptr::null_mut() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:173:9 | LL | ptr::null() as _ - | ^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()` + | ^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:177:9 | LL | std::ptr::null() as _ - | ^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | std::ptr::null() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:182:9 | LL | ptr::null() as _ - | ^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()` + | ^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | ptr::null() + | error: `as` casting between raw pointers without changing its mutability --> tests/ui/ptr_as_ptr.rs:186:9 | LL | core::ptr::null() as _ - | ^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try call directly + | +LL | core::ptr::null() + | error: aborting due to 33 previous errors diff --git a/src/tools/clippy/tests/ui/ptr_cast_constness.stderr b/src/tools/clippy/tests/ui/ptr_cast_constness.stderr index 322c3585e62fe..2e900882347d2 100644 --- a/src/tools/clippy/tests/ui/ptr_cast_constness.stderr +++ b/src/tools/clippy/tests/ui/ptr_cast_constness.stderr @@ -2,46 +2,80 @@ error: `as` casting between raw pointers while changing only its constness --> tests/ui/ptr_cast_constness.rs:15:41 | LL | let _: &mut T = std::mem::transmute(p as *mut T); - | ^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `p.cast_mut()` + | ^^^^^^^^^^^ | = note: `-D clippy::ptr-cast-constness` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_cast_constness)]` +help: try `pointer::cast_mut`, a safer alternative + | +LL | let _: &mut T = std::mem::transmute(p.cast_mut()); + | ~~~~~~~~~~~~ error: `as` casting between raw pointers while changing only its constness --> tests/ui/ptr_cast_constness.rs:16:19 | LL | let _ = &mut *(p as *mut T); - | ^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `p.cast_mut()` + | ^^^^^^^^^^^^^ + | +help: try `pointer::cast_mut`, a safer alternative + | +LL | let _ = &mut *p.cast_mut(); + | ~~~~~~~~~~~~ error: `as` casting between raw pointers while changing only its constness --> tests/ui/ptr_cast_constness.rs:31:17 | LL | let _ = *ptr_ptr as *mut u32; - | ^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `(*ptr_ptr).cast_mut()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try `pointer::cast_mut`, a safer alternative + | +LL | let _ = (*ptr_ptr).cast_mut(); + | ~~~~~~~~~~~~~~~~~~~~~ error: `as` casting between raw pointers while changing only its constness --> tests/ui/ptr_cast_constness.rs:34:13 | LL | let _ = ptr as *mut u32; - | ^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `ptr.cast_mut()` + | ^^^^^^^^^^^^^^^ + | +help: try `pointer::cast_mut`, a safer alternative + | +LL | let _ = ptr.cast_mut(); + | ~~~~~~~~~~~~~~ error: `as` casting between raw pointers while changing only its constness --> tests/ui/ptr_cast_constness.rs:35:13 | LL | let _ = mut_ptr as *const u32; - | ^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_const`, a safer alternative: `mut_ptr.cast_const()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try `pointer::cast_const`, a safer alternative + | +LL | let _ = mut_ptr.cast_const(); + | ~~~~~~~~~~~~~~~~~~~~ error: `as` casting between raw pointers while changing only its constness --> tests/ui/ptr_cast_constness.rs:64:13 | LL | let _ = ptr as *mut u32; - | ^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `ptr.cast_mut()` + | ^^^^^^^^^^^^^^^ + | +help: try `pointer::cast_mut`, a safer alternative + | +LL | let _ = ptr.cast_mut(); + | ~~~~~~~~~~~~~~ error: `as` casting between raw pointers while changing only its constness --> tests/ui/ptr_cast_constness.rs:65:13 | LL | let _ = mut_ptr as *const u32; - | ^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_const`, a safer alternative: `mut_ptr.cast_const()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try `pointer::cast_const`, a safer alternative + | +LL | let _ = mut_ptr.cast_const(); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/ptr_eq.stderr b/src/tools/clippy/tests/ui/ptr_eq.stderr index bf8c2b5c08fb4..e9eea9ef2e522 100644 --- a/src/tools/clippy/tests/ui/ptr_eq.stderr +++ b/src/tools/clippy/tests/ui/ptr_eq.stderr @@ -2,16 +2,25 @@ error: use `std::ptr::eq` when comparing raw pointers --> tests/ui/ptr_eq.rs:19:13 | LL | let _ = a as *const _ as usize == b as *const _ as usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(a, b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::ptr-eq` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]` +help: try + | +LL | let _ = std::ptr::eq(a, b); + | ~~~~~~~~~~~~~~~~~~ error: use `std::ptr::eq` when comparing raw pointers --> tests/ui/ptr_eq.rs:20:13 | LL | let _ = a as *const _ == b as *const _; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(a, b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = std::ptr::eq(a, b); + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/ptr_eq_no_std.stderr b/src/tools/clippy/tests/ui/ptr_eq_no_std.stderr index 0463b75b720b9..9bcf7599ba5da 100644 --- a/src/tools/clippy/tests/ui/ptr_eq_no_std.stderr +++ b/src/tools/clippy/tests/ui/ptr_eq_no_std.stderr @@ -2,16 +2,25 @@ error: use `core::ptr::eq` when comparing raw pointers --> tests/ui/ptr_eq_no_std.rs:31:13 | LL | let _ = a as *const _ as usize == b as *const _ as usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(a, b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::ptr-eq` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]` +help: try + | +LL | let _ = core::ptr::eq(a, b); + | ~~~~~~~~~~~~~~~~~~~ error: use `core::ptr::eq` when comparing raw pointers --> tests/ui/ptr_eq_no_std.rs:32:13 | LL | let _ = a as *const _ == b as *const _; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(a, b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = core::ptr::eq(a, b); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/ptr_offset_with_cast.stderr b/src/tools/clippy/tests/ui/ptr_offset_with_cast.stderr index 87ff10adc9467..f2233d1213c60 100644 --- a/src/tools/clippy/tests/ui/ptr_offset_with_cast.stderr +++ b/src/tools/clippy/tests/ui/ptr_offset_with_cast.stderr @@ -2,16 +2,25 @@ error: use of `offset` with a `usize` casted to an `isize` --> tests/ui/ptr_offset_with_cast.rs:12:17 | LL | let _ = ptr.offset(offset_usize as isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.add(offset_usize)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::ptr-offset-with-cast` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_offset_with_cast)]` +help: try + | +LL | let _ = ptr.add(offset_usize); + | ~~~~~~~~~~~~~~~~~~~~~ error: use of `wrapping_offset` with a `usize` casted to an `isize` --> tests/ui/ptr_offset_with_cast.rs:16:17 | LL | let _ = ptr.wrapping_offset(offset_usize as isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.wrapping_add(offset_usize)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = ptr.wrapping_add(offset_usize); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/pub_with_shorthand.stderr b/src/tools/clippy/tests/ui/pub_with_shorthand.stderr index 8978244c4c04a..0eb86693ddc0c 100644 --- a/src/tools/clippy/tests/ui/pub_with_shorthand.stderr +++ b/src/tools/clippy/tests/ui/pub_with_shorthand.stderr @@ -2,28 +2,47 @@ error: usage of `pub` without `in` --> tests/ui/pub_with_shorthand.rs:13:1 | LL | pub(self) fn a() {} - | ^^^^^^^^^ help: add it: `pub(in self)` + | ^^^^^^^^^ | = note: `-D clippy::pub-with-shorthand` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::pub_with_shorthand)]` +help: add it + | +LL | pub(in self) fn a() {} + | ~~~~~~~~~~~~ error: usage of `pub` without `in` --> tests/ui/pub_with_shorthand.rs:19:5 | LL | pub(super) fn e() {} - | ^^^^^^^^^^ help: add it: `pub(in super)` + | ^^^^^^^^^^ + | +help: add it + | +LL | pub(in super) fn e() {} + | ~~~~~~~~~~~~~ error: usage of `pub` without `in` --> tests/ui/pub_with_shorthand.rs:20:5 | LL | pub(self) fn f() {} - | ^^^^^^^^^ help: add it: `pub(in self)` + | ^^^^^^^^^ + | +help: add it + | +LL | pub(in self) fn f() {} + | ~~~~~~~~~~~~ error: usage of `pub` without `in` --> tests/ui/pub_with_shorthand.rs:21:5 | LL | pub(crate) fn k() {} - | ^^^^^^^^^^ help: add it: `pub(in crate)` + | ^^^^^^^^^^ + | +help: add it + | +LL | pub(in crate) fn k() {} + | ~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/pub_without_shorthand.stderr b/src/tools/clippy/tests/ui/pub_without_shorthand.stderr index e37c731732ba5..5c3c117f7b16d 100644 --- a/src/tools/clippy/tests/ui/pub_without_shorthand.stderr +++ b/src/tools/clippy/tests/ui/pub_without_shorthand.stderr @@ -2,22 +2,36 @@ error: usage of `pub` with `in` --> tests/ui/pub_without_shorthand.rs:14:1 | LL | pub(in self) fn b() {} - | ^^^^^^^^^^^^ help: remove it: `pub(self)` + | ^^^^^^^^^^^^ | = note: `-D clippy::pub-without-shorthand` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::pub_without_shorthand)]` +help: remove it + | +LL | pub(self) fn b() {} + | ~~~~~~~~~ error: usage of `pub` with `in` --> tests/ui/pub_without_shorthand.rs:18:5 | LL | pub(in super) fn d() {} - | ^^^^^^^^^^^^^ help: remove it: `pub(super)` + | ^^^^^^^^^^^^^ + | +help: remove it + | +LL | pub(super) fn d() {} + | ~~~~~~~~~~ error: usage of `pub` with `in` --> tests/ui/pub_without_shorthand.rs:22:5 | LL | pub(in crate) fn m() {} - | ^^^^^^^^^^^^^ help: remove it: `pub(crate)` + | ^^^^^^^^^^^^^ + | +help: remove it + | +LL | pub(crate) fn m() {} + | ~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/question_mark.stderr b/src/tools/clippy/tests/ui/question_mark.stderr index 5f26a7ea2c3e3..08858ac2525b8 100644 --- a/src/tools/clippy/tests/ui/question_mark.stderr +++ b/src/tools/clippy/tests/ui/question_mark.stderr @@ -4,10 +4,14 @@ error: this block may be rewritten with the `?` operator LL | / if a.is_none() { LL | | return None; LL | | } - | |_____^ help: replace it with: `a?;` + | |_____^ | = note: `-D clippy::question-mark` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::question_mark)]` +help: replace it with + | +LL | a?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:52:9 @@ -15,7 +19,12 @@ error: this block may be rewritten with the `?` operator LL | / if (self.opt).is_none() { LL | | return None; LL | | } - | |_________^ help: replace it with: `(self.opt)?;` + | |_________^ + | +help: replace it with + | +LL | (self.opt)?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:56:9 @@ -23,7 +32,12 @@ error: this block may be rewritten with the `?` operator LL | / if self.opt.is_none() { LL | | return None LL | | } - | |_________^ help: replace it with: `self.opt?;` + | |_________^ + | +help: replace it with + | +LL | self.opt?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:60:17 @@ -34,7 +48,12 @@ LL | | return None; LL | | } else { LL | | self.opt LL | | }; - | |_________^ help: replace it with: `Some(self.opt?)` + | |_________^ + | +help: replace it with + | +LL | let _ = Some(self.opt?); + | ~~~~~~~~~~~~~~~ error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:66:17 @@ -45,7 +64,12 @@ LL | | x LL | | } else { LL | | return None; LL | | }; - | |_________^ help: replace it with: `self.opt?` + | |_________^ + | +help: replace it with + | +LL | let _ = self.opt?; + | ~~~~~~~~~ error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:83:9 @@ -53,7 +77,12 @@ error: this block may be rewritten with the `?` operator LL | / if self.opt.is_none() { LL | | return None; LL | | } - | |_________^ help: replace it with: `self.opt.as_ref()?;` + | |_________^ + | +help: replace it with + | +LL | self.opt.as_ref()?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:91:9 @@ -61,7 +90,12 @@ error: this block may be rewritten with the `?` operator LL | / if self.opt.is_none() { LL | | return None; LL | | } - | |_________^ help: replace it with: `self.opt.as_ref()?;` + | |_________^ + | +help: replace it with + | +LL | self.opt.as_ref()?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:99:9 @@ -69,7 +103,12 @@ error: this block may be rewritten with the `?` operator LL | / if self.opt.is_none() { LL | | return None; LL | | } - | |_________^ help: replace it with: `self.opt.as_ref()?;` + | |_________^ + | +help: replace it with + | +LL | self.opt.as_ref()?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:106:26 @@ -80,7 +119,12 @@ LL | | v LL | | } else { LL | | return None; LL | | }; - | |_________^ help: replace it with: `self.opt.as_ref()?` + | |_________^ + | +help: replace it with + | +LL | let v: &Vec<_> = self.opt.as_ref()?; + | ~~~~~~~~~~~~~~~~~~ error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:116:17 @@ -91,7 +135,12 @@ LL | | v LL | | } else { LL | | return None; LL | | }; - | |_________^ help: replace it with: `self.opt?` + | |_________^ + | +help: replace it with + | +LL | let v = self.opt?; + | ~~~~~~~~~ error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:131:5 @@ -99,13 +148,23 @@ error: this block may be rewritten with the `?` operator LL | / if f().is_none() { LL | | return None; LL | | } - | |_____^ help: replace it with: `f()?;` + | |_____^ + | +help: replace it with + | +LL | f()?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:143:13 | LL | let _ = if let Ok(x) = x { x } else { return x }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x?` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = x?; + | ~~ error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:145:5 @@ -113,7 +172,12 @@ error: this block may be rewritten with the `?` operator LL | / if x.is_err() { LL | | return x; LL | | } - | |_____^ help: replace it with: `x?;` + | |_____^ + | +help: replace it with + | +LL | x?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:213:5 @@ -121,7 +185,12 @@ error: this block may be rewritten with the `?` operator LL | / if let Err(err) = func_returning_result() { LL | | return Err(err); LL | | } - | |_____^ help: replace it with: `func_returning_result()?;` + | |_____^ + | +help: replace it with + | +LL | func_returning_result()?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:220:5 @@ -129,7 +198,12 @@ error: this block may be rewritten with the `?` operator LL | / if let Err(err) = func_returning_result() { LL | | return Err(err); LL | | } - | |_____^ help: replace it with: `func_returning_result()?;` + | |_____^ + | +help: replace it with + | +LL | func_returning_result()?; + | error: this block may be rewritten with the `?` operator --> tests/ui/question_mark.rs:297:13 @@ -139,7 +213,12 @@ LL | | return None; LL | | // do lint here, the outer `try` is not relevant here LL | | // https://github.com/rust-lang/rust-clippy/pull/11001#issuecomment-1610636867 LL | | } - | |_____________^ help: replace it with: `a?;` + | |_____________^ + | +help: replace it with + | +LL | a?; + | error: this `let...else` may be rewritten with the `?` operator --> tests/ui/question_mark.rs:357:5 @@ -147,7 +226,12 @@ error: this `let...else` may be rewritten with the `?` operator LL | / let Some(v) = bar.foo.owned.clone() else { LL | | return None; LL | | }; - | |______^ help: replace it with: `let v = bar.foo.owned.clone()?;` + | |______^ + | +help: replace it with + | +LL | let v = bar.foo.owned.clone()?; + | error: aborting due to 17 previous errors diff --git a/src/tools/clippy/tests/ui/range_contains.stderr b/src/tools/clippy/tests/ui/range_contains.stderr index 58ed1292ac7c9..ef7a144960941 100644 --- a/src/tools/clippy/tests/ui/range_contains.stderr +++ b/src/tools/clippy/tests/ui/range_contains.stderr @@ -2,130 +2,234 @@ error: manual `Range::contains` implementation --> tests/ui/range_contains.rs:13:5 | LL | x >= 8 && x < 12; - | ^^^^^^^^^^^^^^^^ help: use: `(8..12).contains(&x)` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-range-contains` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_range_contains)]` +help: use + | +LL | (8..12).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~ error: manual `Range::contains` implementation --> tests/ui/range_contains.rs:14:5 | LL | x < 42 && x >= 21; - | ^^^^^^^^^^^^^^^^^ help: use: `(21..42).contains(&x)` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (21..42).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual `Range::contains` implementation --> tests/ui/range_contains.rs:15:5 | LL | 100 > x && 1 <= x; - | ^^^^^^^^^^^^^^^^^ help: use: `(1..100).contains(&x)` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (1..100).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual `RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:18:5 | LL | x >= 9 && x <= 99; - | ^^^^^^^^^^^^^^^^^ help: use: `(9..=99).contains(&x)` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (9..=99).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual `RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:19:5 | LL | x <= 33 && x >= 1; - | ^^^^^^^^^^^^^^^^^ help: use: `(1..=33).contains(&x)` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (1..=33).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual `RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:20:5 | LL | 999 >= x && 1 <= x; - | ^^^^^^^^^^^^^^^^^^ help: use: `(1..=999).contains(&x)` + | ^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (1..=999).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual `!Range::contains` implementation --> tests/ui/range_contains.rs:23:5 | LL | x < 8 || x >= 12; - | ^^^^^^^^^^^^^^^^ help: use: `!(8..12).contains(&x)` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | !(8..12).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual `!Range::contains` implementation --> tests/ui/range_contains.rs:24:5 | LL | x >= 42 || x < 21; - | ^^^^^^^^^^^^^^^^^ help: use: `!(21..42).contains(&x)` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | !(21..42).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual `!Range::contains` implementation --> tests/ui/range_contains.rs:25:5 | LL | 100 <= x || 1 > x; - | ^^^^^^^^^^^^^^^^^ help: use: `!(1..100).contains(&x)` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | !(1..100).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual `!RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:28:5 | LL | x < 9 || x > 99; - | ^^^^^^^^^^^^^^^ help: use: `!(9..=99).contains(&x)` + | ^^^^^^^^^^^^^^^ + | +help: use + | +LL | !(9..=99).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual `!RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:29:5 | LL | x > 33 || x < 1; - | ^^^^^^^^^^^^^^^ help: use: `!(1..=33).contains(&x)` + | ^^^^^^^^^^^^^^^ + | +help: use + | +LL | !(1..=33).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual `!RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:30:5 | LL | 999 < x || 1 > x; - | ^^^^^^^^^^^^^^^^ help: use: `!(1..=999).contains(&x)` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | !(1..=999).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual `Range::contains` implementation --> tests/ui/range_contains.rs:45:5 | LL | y >= 0. && y < 1.; - | ^^^^^^^^^^^^^^^^^ help: use: `(0. ..1.).contains(&y)` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (0. ..1.).contains(&y); + | ~~~~~~~~~~~~~~~~~~~~~~ error: manual `!RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:46:5 | LL | y < 0. || y > 1.; - | ^^^^^^^^^^^^^^^^ help: use: `!(0. ..=1.).contains(&y)` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | !(0. ..=1.).contains(&y); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: manual `RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:49:5 | LL | x >= -10 && x <= 10; - | ^^^^^^^^^^^^^^^^^^^ help: use: `(-10..=10).contains(&x)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (-10..=10).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: manual `RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:51:5 | LL | y >= -3. && y <= 3.; - | ^^^^^^^^^^^^^^^^^^^ help: use: `(-3. ..=3.).contains(&y)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (-3. ..=3.).contains(&y); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: manual `RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:56:30 | LL | (x >= 0) && (x <= 10) && (z >= 0) && (z <= 10); - | ^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=10).contains(&z)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (x >= 0) && (x <= 10) && (0..=10).contains(&z); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual `RangeInclusive::contains` implementation --> tests/ui/range_contains.rs:56:5 | LL | (x >= 0) && (x <= 10) && (z >= 0) && (z <= 10); - | ^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=10).contains(&x)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (0..=10).contains(&x) && (z >= 0) && (z <= 10); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual `!Range::contains` implementation --> tests/ui/range_contains.rs:57:29 | LL | (x < 0) || (x >= 10) || (z < 0) || (z >= 10); - | ^^^^^^^^^^^^^^^^^^^^ help: use: `!(0..10).contains(&z)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (x < 0) || (x >= 10) || !(0..10).contains(&z); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual `!Range::contains` implementation --> tests/ui/range_contains.rs:57:5 | LL | (x < 0) || (x >= 10) || (z < 0) || (z >= 10); - | ^^^^^^^^^^^^^^^^^^^^ help: use: `!(0..10).contains(&x)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | !(0..10).contains(&x) || (z < 0) || (z >= 10); + | ~~~~~~~~~~~~~~~~~~~~~ error: manual `Range::contains` implementation --> tests/ui/range_contains.rs:76:5 | LL | x >= 8 && x < 35; - | ^^^^^^^^^^^^^^^^ help: use: `(8..35).contains(&x)` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | (8..35).contains(&x); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 21 previous errors diff --git a/src/tools/clippy/tests/ui/range_plus_minus_one.stderr b/src/tools/clippy/tests/ui/range_plus_minus_one.stderr index 0b1883bc5ff22..2dcbee95dbf27 100644 --- a/src/tools/clippy/tests/ui/range_plus_minus_one.stderr +++ b/src/tools/clippy/tests/ui/range_plus_minus_one.stderr @@ -2,61 +2,104 @@ error: an inclusive range would be more readable --> tests/ui/range_plus_minus_one.rs:29:14 | LL | for _ in 0..3 + 1 {} - | ^^^^^^^^ help: use: `0..=3` + | ^^^^^^^^ | = note: `-D clippy::range-plus-one` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::range_plus_one)]` +help: use + | +LL | for _ in 0..=3 {} + | ~~~~~ error: an inclusive range would be more readable --> tests/ui/range_plus_minus_one.rs:32:14 | LL | for _ in 0..1 + 5 {} - | ^^^^^^^^ help: use: `0..=5` + | ^^^^^^^^ + | +help: use + | +LL | for _ in 0..=5 {} + | ~~~~~ error: an inclusive range would be more readable --> tests/ui/range_plus_minus_one.rs:35:14 | LL | for _ in 1..1 + 1 {} - | ^^^^^^^^ help: use: `1..=1` + | ^^^^^^^^ + | +help: use + | +LL | for _ in 1..=1 {} + | ~~~~~ error: an inclusive range would be more readable --> tests/ui/range_plus_minus_one.rs:41:14 | LL | for _ in 0..(1 + f()) {} - | ^^^^^^^^^^^^ help: use: `0..=f()` + | ^^^^^^^^^^^^ + | +help: use + | +LL | for _ in 0..=f() {} + | ~~~~~~~ error: an exclusive range would be more readable --> tests/ui/range_plus_minus_one.rs:45:13 | LL | let _ = ..=11 - 1; - | ^^^^^^^^^ help: use: `..11` + | ^^^^^^^^^ | = note: `-D clippy::range-minus-one` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::range_minus_one)]` +help: use + | +LL | let _ = ..11; + | ~~~~ error: an exclusive range would be more readable --> tests/ui/range_plus_minus_one.rs:46:13 | LL | let _ = ..=(11 - 1); - | ^^^^^^^^^^^ help: use: `..11` + | ^^^^^^^^^^^ + | +help: use + | +LL | let _ = ..11; + | ~~~~ error: an inclusive range would be more readable --> tests/ui/range_plus_minus_one.rs:47:13 | LL | let _ = (1..11 + 1); - | ^^^^^^^^^^^ help: use: `(1..=11)` + | ^^^^^^^^^^^ + | +help: use + | +LL | let _ = (1..=11); + | ~~~~~~~~ error: an inclusive range would be more readable --> tests/ui/range_plus_minus_one.rs:48:13 | LL | let _ = (f() + 1)..(f() + 1); - | ^^^^^^^^^^^^^^^^^^^^ help: use: `((f() + 1)..=f())` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = ((f() + 1)..=f()); + | ~~~~~~~~~~~~~~~~~ error: an inclusive range would be more readable --> tests/ui/range_plus_minus_one.rs:52:14 | LL | for _ in 1..ONE + ONE {} - | ^^^^^^^^^^^^ help: use: `1..=ONE` + | ^^^^^^^^^^^^ + | +help: use + | +LL | for _ in 1..=ONE {} + | ~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/rc_buffer.stderr b/src/tools/clippy/tests/ui/rc_buffer.stderr index 922f09288bf38..e30c463a29075 100644 --- a/src/tools/clippy/tests/ui/rc_buffer.stderr +++ b/src/tools/clippy/tests/ui/rc_buffer.stderr @@ -2,52 +2,91 @@ error: usage of `Rc` when T is a buffer type --> tests/ui/rc_buffer.rs:11:11 | LL | bad1: Rc, - | ^^^^^^^^^^ help: try: `Rc` + | ^^^^^^^^^^ | = note: `-D clippy::rc-buffer` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::rc_buffer)]` +help: try + | +LL | bad1: Rc, + | ~~~~~~~ error: usage of `Rc` when T is a buffer type --> tests/ui/rc_buffer.rs:12:11 | LL | bad2: Rc, - | ^^^^^^^^^^^ help: try: `Rc` + | ^^^^^^^^^^^ + | +help: try + | +LL | bad2: Rc, + | ~~~~~~~~~~~~~~~~~~~ error: usage of `Rc` when T is a buffer type --> tests/ui/rc_buffer.rs:13:11 | LL | bad3: Rc>, - | ^^^^^^^^^^^ help: try: `Rc<[u8]>` + | ^^^^^^^^^^^ + | +help: try + | +LL | bad3: Rc<[u8]>, + | ~~~~~~~~ error: usage of `Rc` when T is a buffer type --> tests/ui/rc_buffer.rs:14:11 | LL | bad4: Rc, - | ^^^^^^^^^^^^ help: try: `Rc` + | ^^^^^^^^^^^^ + | +help: try + | +LL | bad4: Rc, + | ~~~~~~~~~~~~~~~~~~~ error: usage of `Rc` when T is a buffer type --> tests/ui/rc_buffer.rs:20:17 | LL | fn func_bad1(_: Rc) {} - | ^^^^^^^^^^ help: try: `Rc` + | ^^^^^^^^^^ + | +help: try + | +LL | fn func_bad1(_: Rc) {} + | ~~~~~~~ error: usage of `Rc` when T is a buffer type --> tests/ui/rc_buffer.rs:21:17 | LL | fn func_bad2(_: Rc) {} - | ^^^^^^^^^^^ help: try: `Rc` + | ^^^^^^^^^^^ + | +help: try + | +LL | fn func_bad2(_: Rc) {} + | ~~~~~~~~~~~~~~~~~~~ error: usage of `Rc` when T is a buffer type --> tests/ui/rc_buffer.rs:22:17 | LL | fn func_bad3(_: Rc>) {} - | ^^^^^^^^^^^ help: try: `Rc<[u8]>` + | ^^^^^^^^^^^ + | +help: try + | +LL | fn func_bad3(_: Rc<[u8]>) {} + | ~~~~~~~~ error: usage of `Rc` when T is a buffer type --> tests/ui/rc_buffer.rs:23:17 | LL | fn func_bad4(_: Rc) {} - | ^^^^^^^^^^^^ help: try: `Rc` + | ^^^^^^^^^^^^ + | +help: try + | +LL | fn func_bad4(_: Rc) {} + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/rc_buffer_arc.stderr b/src/tools/clippy/tests/ui/rc_buffer_arc.stderr index 5ef5da2f67f84..8ef2215582f04 100644 --- a/src/tools/clippy/tests/ui/rc_buffer_arc.stderr +++ b/src/tools/clippy/tests/ui/rc_buffer_arc.stderr @@ -2,52 +2,91 @@ error: usage of `Arc` when T is a buffer type --> tests/ui/rc_buffer_arc.rs:10:11 | LL | bad1: Arc, - | ^^^^^^^^^^^ help: try: `Arc` + | ^^^^^^^^^^^ | = note: `-D clippy::rc-buffer` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::rc_buffer)]` +help: try + | +LL | bad1: Arc, + | ~~~~~~~~ error: usage of `Arc` when T is a buffer type --> tests/ui/rc_buffer_arc.rs:11:11 | LL | bad2: Arc, - | ^^^^^^^^^^^^ help: try: `Arc` + | ^^^^^^^^^^^^ + | +help: try + | +LL | bad2: Arc, + | ~~~~~~~~~~~~~~~~~~~~ error: usage of `Arc` when T is a buffer type --> tests/ui/rc_buffer_arc.rs:12:11 | LL | bad3: Arc>, - | ^^^^^^^^^^^^ help: try: `Arc<[u8]>` + | ^^^^^^^^^^^^ + | +help: try + | +LL | bad3: Arc<[u8]>, + | ~~~~~~~~~ error: usage of `Arc` when T is a buffer type --> tests/ui/rc_buffer_arc.rs:13:11 | LL | bad4: Arc, - | ^^^^^^^^^^^^^ help: try: `Arc` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | bad4: Arc, + | ~~~~~~~~~~~~~~~~~~~~ error: usage of `Arc` when T is a buffer type --> tests/ui/rc_buffer_arc.rs:19:17 | LL | fn func_bad1(_: Arc) {} - | ^^^^^^^^^^^ help: try: `Arc` + | ^^^^^^^^^^^ + | +help: try + | +LL | fn func_bad1(_: Arc) {} + | ~~~~~~~~ error: usage of `Arc` when T is a buffer type --> tests/ui/rc_buffer_arc.rs:20:17 | LL | fn func_bad2(_: Arc) {} - | ^^^^^^^^^^^^ help: try: `Arc` + | ^^^^^^^^^^^^ + | +help: try + | +LL | fn func_bad2(_: Arc) {} + | ~~~~~~~~~~~~~~~~~~~~ error: usage of `Arc` when T is a buffer type --> tests/ui/rc_buffer_arc.rs:21:17 | LL | fn func_bad3(_: Arc>) {} - | ^^^^^^^^^^^^ help: try: `Arc<[u8]>` + | ^^^^^^^^^^^^ + | +help: try + | +LL | fn func_bad3(_: Arc<[u8]>) {} + | ~~~~~~~~~ error: usage of `Arc` when T is a buffer type --> tests/ui/rc_buffer_arc.rs:22:17 | LL | fn func_bad4(_: Arc) {} - | ^^^^^^^^^^^^^ help: try: `Arc` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | fn func_bad4(_: Arc) {} + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/read_line_without_trim.stderr b/src/tools/clippy/tests/ui/read_line_without_trim.stderr index b54229f762a32..37f6e2e71d5db 100644 --- a/src/tools/clippy/tests/ui/read_line_without_trim.stderr +++ b/src/tools/clippy/tests/ui/read_line_without_trim.stderr @@ -2,9 +2,7 @@ error: calling `.parse()` on a string without trimming the trailing newline char --> tests/ui/read_line_without_trim.rs:12:25 | LL | let _x: i32 = input.parse().unwrap(); - | ----- ^^^^^^^ - | | - | help: try: `input.trim_end()` + | ^^^^^^^ | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail --> tests/ui/read_line_without_trim.rs:11:5 @@ -13,90 +11,106 @@ LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: `-D clippy::read-line-without-trim` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::read_line_without_trim)]` +help: try + | +LL | let _x: i32 = input.trim_end().parse().unwrap(); + | ~~~~~~~~~~~~~~~~ error: calling `.parse()` on a string without trimming the trailing newline character --> tests/ui/read_line_without_trim.rs:16:20 | LL | let _x = input.parse::().unwrap(); - | ----- ^^^^^^^^^^^^^^ - | | - | help: try: `input.trim_end()` + | ^^^^^^^^^^^^^^ | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail --> tests/ui/read_line_without_trim.rs:15:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | let _x = input.trim_end().parse::().unwrap(); + | ~~~~~~~~~~~~~~~~ error: calling `.parse()` on a string without trimming the trailing newline character --> tests/ui/read_line_without_trim.rs:20:20 | LL | let _x = input.parse::().unwrap(); - | ----- ^^^^^^^^^^^^^^ - | | - | help: try: `input.trim_end()` + | ^^^^^^^^^^^^^^ | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail --> tests/ui/read_line_without_trim.rs:19:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | let _x = input.trim_end().parse::().unwrap(); + | ~~~~~~~~~~~~~~~~ error: calling `.parse()` on a string without trimming the trailing newline character --> tests/ui/read_line_without_trim.rs:24:20 | LL | let _x = input.parse::().unwrap(); - | ----- ^^^^^^^^^^^^^^ - | | - | help: try: `input.trim_end()` + | ^^^^^^^^^^^^^^ | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail --> tests/ui/read_line_without_trim.rs:23:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | let _x = input.trim_end().parse::().unwrap(); + | ~~~~~~~~~~~~~~~~ error: calling `.parse()` on a string without trimming the trailing newline character --> tests/ui/read_line_without_trim.rs:28:20 | LL | let _x = input.parse::().unwrap(); - | ----- ^^^^^^^^^^^^^^^ - | | - | help: try: `input.trim_end()` + | ^^^^^^^^^^^^^^^ | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail --> tests/ui/read_line_without_trim.rs:27:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | let _x = input.trim_end().parse::().unwrap(); + | ~~~~~~~~~~~~~~~~ error: comparing a string literal without trimming the trailing newline character --> tests/ui/read_line_without_trim.rs:38:8 | LL | if input == "foo" { - | -----^^^^^^^^^ - | | - | help: try: `input.trim_end()` + | ^^^^^^^^^^^^^^ | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the comparison to always fail --> tests/ui/read_line_without_trim.rs:37:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | if input.trim_end() == "foo" { + | ~~~~~~~~~~~~~~~~ error: checking the end of a string without trimming the trailing newline character --> tests/ui/read_line_without_trim.rs:44:8 | LL | if input.ends_with("foo") { - | -----^^^^^^^^^^^^^^^^^ - | | - | help: try: `input.trim_end()` + | ^^^^^^^^^^^^^^^^^^^^^^ | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the parsing to always fail --> tests/ui/read_line_without_trim.rs:43:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | if input.trim_end().ends_with("foo") { + | ~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/read_zero_byte_vec.stderr b/src/tools/clippy/tests/ui/read_zero_byte_vec.stderr index e2356f1cb56be..3fe0340dd517c 100644 --- a/src/tools/clippy/tests/ui/read_zero_byte_vec.stderr +++ b/src/tools/clippy/tests/ui/read_zero_byte_vec.stderr @@ -2,16 +2,25 @@ error: reading zero byte data to `Vec` --> tests/ui/read_zero_byte_vec.rs:21:5 | LL | f.read_exact(&mut data).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `data.resize(20, 0); f.read_exact(&mut data)` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::read-zero-byte-vec` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::read_zero_byte_vec)]` +help: try + | +LL | data.resize(20, 0); f.read_exact(&mut data).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reading zero byte data to `Vec` --> tests/ui/read_zero_byte_vec.rs:27:5 | LL | f.read_exact(&mut data2)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `data2.resize(cap, 0); f.read_exact(&mut data2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | data2.resize(cap, 0); f.read_exact(&mut data2)?; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reading zero byte data to `Vec` --> tests/ui/read_zero_byte_vec.rs:32:5 diff --git a/src/tools/clippy/tests/ui/readonly_write_lock.stderr b/src/tools/clippy/tests/ui/readonly_write_lock.stderr index 6b1ef3c4720f0..2b4ee2d190ac6 100644 --- a/src/tools/clippy/tests/ui/readonly_write_lock.stderr +++ b/src/tools/clippy/tests/ui/readonly_write_lock.stderr @@ -2,16 +2,25 @@ error: this write lock is used only for reading --> tests/ui/readonly_write_lock.rs:16:22 | LL | let writer = lock.write().unwrap(); - | ^^^^^^^^^^^^ help: consider using a read lock instead: `lock.read()` + | ^^^^^^^^^^^^ | = note: `-D clippy::readonly-write-lock` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::readonly_write_lock)]` +help: consider using a read lock instead + | +LL | let writer = lock.read().unwrap(); + | ~~~~~~~~~~~ error: this write lock is used only for reading --> tests/ui/readonly_write_lock.rs:23:22 | LL | let writer = lock.write().unwrap(); - | ^^^^^^^^^^^^ help: consider using a read lock instead: `lock.read()` + | ^^^^^^^^^^^^ + | +help: consider using a read lock instead + | +LL | let writer = lock.read().unwrap(); + | ~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_allocation_fixable.stderr b/src/tools/clippy/tests/ui/redundant_allocation_fixable.stderr index 34a1a21bdadcd..df46ae1a11bcd 100644 --- a/src/tools/clippy/tests/ui/redundant_allocation_fixable.stderr +++ b/src/tools/clippy/tests/ui/redundant_allocation_fixable.stderr @@ -2,99 +2,147 @@ error: usage of `Box<&T>` --> tests/ui/redundant_allocation_fixable.rs:23:30 | LL | pub fn box_test1(foo: Box<&T>) {} - | ^^^^^^^ help: try: `&T` + | ^^^^^^^ | = note: `&T` is already a pointer, `Box<&T>` allocates a pointer on the heap = note: `-D clippy::redundant-allocation` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_allocation)]` +help: try + | +LL | pub fn box_test1(foo: &T) {} + | ~~ error: usage of `Box<&MyStruct>` --> tests/ui/redundant_allocation_fixable.rs:25:27 | LL | pub fn box_test2(foo: Box<&MyStruct>) {} - | ^^^^^^^^^^^^^^ help: try: `&MyStruct` + | ^^^^^^^^^^^^^^ | = note: `&MyStruct` is already a pointer, `Box<&MyStruct>` allocates a pointer on the heap +help: try + | +LL | pub fn box_test2(foo: &MyStruct) {} + | ~~~~~~~~~ error: usage of `Box<&MyEnum>` --> tests/ui/redundant_allocation_fixable.rs:27:27 | LL | pub fn box_test3(foo: Box<&MyEnum>) {} - | ^^^^^^^^^^^^ help: try: `&MyEnum` + | ^^^^^^^^^^^^ | = note: `&MyEnum` is already a pointer, `Box<&MyEnum>` allocates a pointer on the heap +help: try + | +LL | pub fn box_test3(foo: &MyEnum) {} + | ~~~~~~~ error: usage of `Box>` --> tests/ui/redundant_allocation_fixable.rs:31:30 | LL | pub fn box_test5(foo: Box>) {} - | ^^^^^^^^^^^ help: try: `Box` + | ^^^^^^^^^^^ | = note: `Box` is already on the heap, `Box>` makes an extra allocation +help: try + | +LL | pub fn box_test5(foo: Box) {} + | ~~~~~~ error: usage of `Rc<&T>` --> tests/ui/redundant_allocation_fixable.rs:40:29 | LL | pub fn rc_test1(foo: Rc<&T>) {} - | ^^^^^^ help: try: `&T` + | ^^^^^^ | = note: `&T` is already a pointer, `Rc<&T>` allocates a pointer on the heap +help: try + | +LL | pub fn rc_test1(foo: &T) {} + | ~~ error: usage of `Rc<&MyStruct>` --> tests/ui/redundant_allocation_fixable.rs:42:26 | LL | pub fn rc_test2(foo: Rc<&MyStruct>) {} - | ^^^^^^^^^^^^^ help: try: `&MyStruct` + | ^^^^^^^^^^^^^ | = note: `&MyStruct` is already a pointer, `Rc<&MyStruct>` allocates a pointer on the heap +help: try + | +LL | pub fn rc_test2(foo: &MyStruct) {} + | ~~~~~~~~~ error: usage of `Rc<&MyEnum>` --> tests/ui/redundant_allocation_fixable.rs:44:26 | LL | pub fn rc_test3(foo: Rc<&MyEnum>) {} - | ^^^^^^^^^^^ help: try: `&MyEnum` + | ^^^^^^^^^^^ | = note: `&MyEnum` is already a pointer, `Rc<&MyEnum>` allocates a pointer on the heap +help: try + | +LL | pub fn rc_test3(foo: &MyEnum) {} + | ~~~~~~~ error: usage of `Rc>` --> tests/ui/redundant_allocation_fixable.rs:48:24 | LL | pub fn rc_test6(a: Rc>) {} - | ^^^^^^^^^^^^ help: try: `Rc` + | ^^^^^^^^^^^^ | = note: `Rc` is already on the heap, `Rc>` makes an extra allocation +help: try + | +LL | pub fn rc_test6(a: Rc) {} + | ~~~~~~~~ error: usage of `Arc<&T>` --> tests/ui/redundant_allocation_fixable.rs:57:30 | LL | pub fn arc_test1(foo: Arc<&T>) {} - | ^^^^^^^ help: try: `&T` + | ^^^^^^^ | = note: `&T` is already a pointer, `Arc<&T>` allocates a pointer on the heap +help: try + | +LL | pub fn arc_test1(foo: &T) {} + | ~~ error: usage of `Arc<&MyStruct>` --> tests/ui/redundant_allocation_fixable.rs:59:27 | LL | pub fn arc_test2(foo: Arc<&MyStruct>) {} - | ^^^^^^^^^^^^^^ help: try: `&MyStruct` + | ^^^^^^^^^^^^^^ | = note: `&MyStruct` is already a pointer, `Arc<&MyStruct>` allocates a pointer on the heap +help: try + | +LL | pub fn arc_test2(foo: &MyStruct) {} + | ~~~~~~~~~ error: usage of `Arc<&MyEnum>` --> tests/ui/redundant_allocation_fixable.rs:61:27 | LL | pub fn arc_test3(foo: Arc<&MyEnum>) {} - | ^^^^^^^^^^^^ help: try: `&MyEnum` + | ^^^^^^^^^^^^ | = note: `&MyEnum` is already a pointer, `Arc<&MyEnum>` allocates a pointer on the heap +help: try + | +LL | pub fn arc_test3(foo: &MyEnum) {} + | ~~~~~~~ error: usage of `Arc>` --> tests/ui/redundant_allocation_fixable.rs:65:25 | LL | pub fn arc_test7(a: Arc>) {} - | ^^^^^^^^^^^^^^ help: try: `Arc` + | ^^^^^^^^^^^^^^ | = note: `Arc` is already on the heap, `Arc>` makes an extra allocation +help: try + | +LL | pub fn arc_test7(a: Arc) {} + | ~~~~~~~~~ error: aborting due to 12 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_as_str.stderr b/src/tools/clippy/tests/ui/redundant_as_str.stderr index f5379d701db82..bc34206df9b80 100644 --- a/src/tools/clippy/tests/ui/redundant_as_str.stderr +++ b/src/tools/clippy/tests/ui/redundant_as_str.stderr @@ -2,16 +2,25 @@ error: this `as_str` is redundant and can be removed as the method immediately f --> tests/ui/redundant_as_str.rs:8:29 | LL | let _redundant = string.as_str().as_bytes(); - | ^^^^^^^^^^^^^^^^^ help: try: `as_bytes` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::redundant-as-str` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_as_str)]` +help: try + | +LL | let _redundant = string.as_bytes(); + | ~~~~~~~~ error: this `as_str` is redundant and can be removed as the method immediately following exists on `String` too --> tests/ui/redundant_as_str.rs:9:29 | LL | let _redundant = string.as_str().is_empty(); - | ^^^^^^^^^^^^^^^^^ help: try: `is_empty` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _redundant = string.is_empty(); + | ~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_async_block.stderr b/src/tools/clippy/tests/ui/redundant_async_block.stderr index c6a5e2f28adae..a128866bba877 100644 --- a/src/tools/clippy/tests/ui/redundant_async_block.stderr +++ b/src/tools/clippy/tests/ui/redundant_async_block.stderr @@ -2,74 +2,121 @@ error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:13:13 | LL | let x = async { f.await }; - | ^^^^^^^^^^^^^^^^^ help: you can reduce it to: `f` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::redundant-async-block` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_async_block)]` +help: you can reduce it to + | +LL | let x = f; + | ~ error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:20:16 | LL | let fut2 = async { fut1.await }; - | ^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `fut1` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | let fut2 = fut1; + | ~~~~ error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:24:16 | LL | let fut2 = async move { fut1.await }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `fut1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | let fut2 = fut1; + | ~~~~ error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:27:15 | LL | let fut = async { async { 42 }.await }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `async { 42 }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | let fut = async { 42 }; + | ~~~~~~~~~~~~ error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:43:5 | LL | async move { fut.await } - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `fut` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | fut + | error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:56:5 | LL | async move { fut.await } - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `fut` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | fut + | error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:61:5 | LL | async { f.await } - | ^^^^^^^^^^^^^^^^^ help: you can reduce it to: `f` + | ^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | f + | error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:84:5 | LL | async { async { f().await + 1 }.await } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `async { f().await + 1 }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can reduce it to + | +LL | async { f().await + 1 } + | error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:147:13 | LL | async { async { 42 }.await } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `async { 42 }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | mac!() | ------ in this macro invocation | = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you can reduce it to + | +LL | async { 42 } + | error: this async expression only awaits a single future --> tests/ui/redundant_async_block.rs:167:13 | LL | async { async { $e }.await } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `async { $e }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | mac!(42) | -------- in this macro invocation | = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you can reduce it to + | +LL | async { $e } + | error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_at_rest_pattern.stderr b/src/tools/clippy/tests/ui/redundant_at_rest_pattern.stderr index 012ba550ca113..95c80b8d8cb22 100644 --- a/src/tools/clippy/tests/ui/redundant_at_rest_pattern.stderr +++ b/src/tools/clippy/tests/ui/redundant_at_rest_pattern.stderr @@ -2,40 +2,69 @@ error: using a rest pattern to bind an entire slice to a local --> tests/ui/redundant_at_rest_pattern.rs:9:12 | LL | if let [a @ ..] = [()] {} - | ^^^^^^^^ help: this is better represented with just the binding: `a` + | ^^^^^^^^ | = note: `-D clippy::redundant-at-rest-pattern` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_at_rest_pattern)]` +help: this is better represented with just the binding + | +LL | if let a = [()] {} + | ~ error: using a rest pattern to bind an entire slice to a local --> tests/ui/redundant_at_rest_pattern.rs:10:12 | LL | if let [ref a @ ..] = [()] {} - | ^^^^^^^^^^^^ help: this is better represented with just the binding: `ref a` + | ^^^^^^^^^^^^ + | +help: this is better represented with just the binding + | +LL | if let ref a = [()] {} + | ~~~~~ error: using a rest pattern to bind an entire slice to a local --> tests/ui/redundant_at_rest_pattern.rs:11:12 | LL | if let [mut a @ ..] = [()] {} - | ^^^^^^^^^^^^ help: this is better represented with just the binding: `mut a` + | ^^^^^^^^^^^^ + | +help: this is better represented with just the binding + | +LL | if let mut a = [()] {} + | ~~~~~ error: using a rest pattern to bind an entire slice to a local --> tests/ui/redundant_at_rest_pattern.rs:12:12 | LL | if let [ref mut a @ ..] = [()] {} - | ^^^^^^^^^^^^^^^^ help: this is better represented with just the binding: `ref mut a` + | ^^^^^^^^^^^^^^^^ + | +help: this is better represented with just the binding + | +LL | if let ref mut a = [()] {} + | ~~~~~~~~~ error: using a rest pattern to bind an entire slice to a local --> tests/ui/redundant_at_rest_pattern.rs:14:12 | LL | if let [a @ ..] = &*v {} - | ^^^^^^^^ help: this is better represented with just the binding: `a` + | ^^^^^^^^ + | +help: this is better represented with just the binding + | +LL | if let a = &*v {} + | ~ error: using a rest pattern to bind an entire slice to a local --> tests/ui/redundant_at_rest_pattern.rs:16:12 | LL | if let [a @ ..] = s {} - | ^^^^^^^^ help: this is better represented with just the binding: `a` + | ^^^^^^^^ + | +help: this is better represented with just the binding + | +LL | if let a = s {} + | ~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_clone.stderr b/src/tools/clippy/tests/ui/redundant_clone.stderr index d66972bcb5b3a..2813d544a25f6 100644 --- a/src/tools/clippy/tests/ui/redundant_clone.stderr +++ b/src/tools/clippy/tests/ui/redundant_clone.stderr @@ -2,7 +2,7 @@ error: redundant clone --> tests/ui/redundant_clone.rs:14:42 | LL | let _s = ["lorem", "ipsum"].join(" ").to_string(); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:14:14 @@ -11,174 +11,249 @@ LL | let _s = ["lorem", "ipsum"].join(" ").to_string(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: `-D clippy::redundant-clone` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]` +help: remove this + | +LL - let _s = ["lorem", "ipsum"].join(" ").to_string(); +LL + let _s = ["lorem", "ipsum"].join(" "); + | error: redundant clone --> tests/ui/redundant_clone.rs:17:15 | LL | let _s = s.clone(); - | ^^^^^^^^ help: remove this + | ^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:17:14 | LL | let _s = s.clone(); | ^ +help: remove this + | +LL - let _s = s.clone(); +LL + let _s = s; + | error: redundant clone --> tests/ui/redundant_clone.rs:20:15 | LL | let _s = s.to_string(); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:20:14 | LL | let _s = s.to_string(); | ^ +help: remove this + | +LL - let _s = s.to_string(); +LL + let _s = s; + | error: redundant clone --> tests/ui/redundant_clone.rs:23:15 | LL | let _s = s.to_owned(); - | ^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:23:14 | LL | let _s = s.to_owned(); | ^ +help: remove this + | +LL - let _s = s.to_owned(); +LL + let _s = s; + | error: redundant clone --> tests/ui/redundant_clone.rs:25:42 | LL | let _s = Path::new("/a/b/").join("c").to_owned(); - | ^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:25:14 | LL | let _s = Path::new("/a/b/").join("c").to_owned(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this + | +LL - let _s = Path::new("/a/b/").join("c").to_owned(); +LL + let _s = Path::new("/a/b/").join("c"); + | error: redundant clone --> tests/ui/redundant_clone.rs:27:42 | LL | let _s = Path::new("/a/b/").join("c").to_path_buf(); - | ^^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:27:14 | LL | let _s = Path::new("/a/b/").join("c").to_path_buf(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this + | +LL - let _s = Path::new("/a/b/").join("c").to_path_buf(); +LL + let _s = Path::new("/a/b/").join("c"); + | error: redundant clone --> tests/ui/redundant_clone.rs:29:29 | LL | let _s = OsString::new().to_owned(); - | ^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:29:14 | LL | let _s = OsString::new().to_owned(); | ^^^^^^^^^^^^^^^ +help: remove this + | +LL - let _s = OsString::new().to_owned(); +LL + let _s = OsString::new(); + | error: redundant clone --> tests/ui/redundant_clone.rs:31:29 | LL | let _s = OsString::new().to_os_string(); - | ^^^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:31:14 | LL | let _s = OsString::new().to_os_string(); | ^^^^^^^^^^^^^^^ +help: remove this + | +LL - let _s = OsString::new().to_os_string(); +LL + let _s = OsString::new(); + | error: redundant clone --> tests/ui/redundant_clone.rs:42:19 | LL | let _t = tup.0.clone(); - | ^^^^^^^^ help: remove this + | ^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:42:14 | LL | let _t = tup.0.clone(); | ^^^^^ +help: remove this + | +LL - let _t = tup.0.clone(); +LL + let _t = tup.0; + | error: redundant clone --> tests/ui/redundant_clone.rs:74:25 | LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) } - | ^^^^^^^^ help: remove this + | ^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:74:24 | LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) } | ^ +help: remove this + | +LL - if b { (a.clone(), a.clone()) } else { (Alpha, a) } +LL + if b { (a.clone(), a) } else { (Alpha, a) } + | error: redundant clone --> tests/ui/redundant_clone.rs:131:15 | LL | let _s = s.clone(); - | ^^^^^^^^ help: remove this + | ^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:131:14 | LL | let _s = s.clone(); | ^ +help: remove this + | +LL - let _s = s.clone(); +LL + let _s = s; + | error: redundant clone --> tests/ui/redundant_clone.rs:132:15 | LL | let _t = t.clone(); - | ^^^^^^^^ help: remove this + | ^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:132:14 | LL | let _t = t.clone(); | ^ +help: remove this + | +LL - let _t = t.clone(); +LL + let _t = t; + | error: redundant clone --> tests/ui/redundant_clone.rs:142:19 | LL | let _f = f.clone(); - | ^^^^^^^^ help: remove this + | ^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:142:18 | LL | let _f = f.clone(); | ^ +help: remove this + | +LL - let _f = f.clone(); +LL + let _f = f; + | error: redundant clone --> tests/ui/redundant_clone.rs:154:14 | LL | let y = x.clone().join("matthias"); - | ^^^^^^^^ help: remove this + | ^^^^^^^^ | note: cloned value is neither consumed nor mutated --> tests/ui/redundant_clone.rs:154:13 | LL | let y = x.clone().join("matthias"); | ^^^^^^^^^ +help: remove this + | +LL - let y = x.clone().join("matthias"); +LL + let y = x.join("matthias"); + | error: redundant clone --> tests/ui/redundant_clone.rs:208:11 | LL | foo(&x.clone(), move || { - | ^^^^^^^^ help: remove this + | ^^^^^^^^ | note: this value is dropped without further use --> tests/ui/redundant_clone.rs:208:10 | LL | foo(&x.clone(), move || { | ^ +help: remove this + | +LL - foo(&x.clone(), move || { +LL + foo(&x, move || { + | error: aborting due to 15 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_closure_call_fixable.stderr b/src/tools/clippy/tests/ui/redundant_closure_call_fixable.stderr index 000d81f811f10..0d24ff1a8f4d0 100644 --- a/src/tools/clippy/tests/ui/redundant_closure_call_fixable.stderr +++ b/src/tools/clippy/tests/ui/redundant_closure_call_fixable.stderr @@ -2,10 +2,14 @@ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:16:13 | LL | let a = (|| 42)(); - | ^^^^^^^^^ help: try doing something like: `42` + | ^^^^^^^^^ | = note: `-D clippy::redundant-closure-call` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_closure_call)]` +help: try doing something like + | +LL | let a = 42; + | ~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:17:13 @@ -51,95 +55,163 @@ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:27:13 | LL | let d = (async || something().await)(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `async { something().await }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | let d = async { something().await }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:36:13 | LL | (|| m!())() - | ^^^^^^^^^^^ help: try doing something like: `m!()` + | ^^^^^^^^^^^ ... LL | m2!(); | ----- in this macro invocation | = note: this error originates in the macro `m2` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try doing something like + | +LL | m!() + | error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:31:13 | LL | (|| 0)() - | ^^^^^^^^ help: try doing something like: `0` + | ^^^^^^^^ ... LL | m2!(); | ----- in this macro invocation | = note: this error originates in the macro `m` which comes from the expansion of the macro `m2` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try doing something like + | +LL | 0 + | error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:44:16 | LL | assert_eq!((|| || 43)()(), 42); - | ^^^^^^^^^^^^^^ help: try doing something like: `43` + | ^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | assert_eq!(43, 42); + | ~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:53:10 | LL | dbg!((|| 42)()); - | ^^^^^^^^^ help: try doing something like: `42` + | ^^^^^^^^^ + | +help: try doing something like + | +LL | dbg!(42); + | ~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:56:13 | LL | let a = (|| || || 123)(); - | ^^^^^^^^^^^^^^^^ help: try doing something like: `(|| || 123)` + | ^^^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | let a = (|| || 123); + | ~~~~~~~~~~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:60:13 | LL | let a = (|| || || || async || 1)()()()()(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `async { 1 }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | let a = async { 1 }; + | ~~~~~~~~~~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:69:13 | LL | let a = (|| echo!(|| echo!(|| 1)))()()(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | let a = 1; + | ~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:71:13 | LL | let a = (|| echo!((|| 123)))()(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `123` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | let a = 123; + | ~~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:84:11 | LL | bar()((|| || 42)()(), 5); - | ^^^^^^^^^^^^^^ help: try doing something like: `42` + | ^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | bar()(42, 5); + | ~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:85:9 | LL | foo((|| || 42)()(), 5); - | ^^^^^^^^^^^^^^ help: try doing something like: `42` + | ^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | foo(42, 5); + | ~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:89:5 | LL | (|| async {})().await; - | ^^^^^^^^^^^^^^^ help: try doing something like: `async {}` + | ^^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | async {}.await; + | ~~~~~~~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:98:18 | LL | spawn_on((|| async move {})()); - | ^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `async move {}` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | spawn_on(async move {}); + | ~~~~~~~~~~~~~ error: try not to call a closure in the expression where it is declared --> tests/ui/redundant_closure_call_fixable.rs:103:28 | LL | std::convert::identity((|| 13_i32 + 36_i32)()).leading_zeros(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `13_i32 + 36_i32` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try doing something like + | +LL | std::convert::identity(13_i32 + 36_i32).leading_zeros(); + | ~~~~~~~~~~~~~~~ error: aborting due to 17 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_field_names.stderr b/src/tools/clippy/tests/ui/redundant_field_names.stderr index 38c021fdba370..7ba40e52f705b 100644 --- a/src/tools/clippy/tests/ui/redundant_field_names.stderr +++ b/src/tools/clippy/tests/ui/redundant_field_names.stderr @@ -2,63 +2,106 @@ error: redundant field names in struct initialization --> tests/ui/redundant_field_names.rs:33:9 | LL | gender: gender, - | ^^^^^^^^^^^^^^ help: replace it with: `gender` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::redundant-field-names` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_field_names)]` +help: replace it with + | +LL | gender, + | ~~~~~~ error: redundant field names in struct initialization --> tests/ui/redundant_field_names.rs:34:9 | LL | age: age, - | ^^^^^^^^ help: replace it with: `age` + | ^^^^^^^^ + | +help: replace it with + | +LL | age, + | ~~~ error: redundant field names in struct initialization --> tests/ui/redundant_field_names.rs:55:25 | LL | let _ = RangeFrom { start: start }; - | ^^^^^^^^^^^^ help: replace it with: `start` + | ^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = RangeFrom { start }; + | ~~~~~ error: redundant field names in struct initialization --> tests/ui/redundant_field_names.rs:56:23 | LL | let _ = RangeTo { end: end }; - | ^^^^^^^^ help: replace it with: `end` + | ^^^^^^^^ + | +help: replace it with + | +LL | let _ = RangeTo { end }; + | ~~~ error: redundant field names in struct initialization --> tests/ui/redundant_field_names.rs:57:21 | LL | let _ = Range { start: start, end: end }; - | ^^^^^^^^^^^^ help: replace it with: `start` + | ^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = Range { start, end: end }; + | ~~~~~ error: redundant field names in struct initialization --> tests/ui/redundant_field_names.rs:57:35 | LL | let _ = Range { start: start, end: end }; - | ^^^^^^^^ help: replace it with: `end` + | ^^^^^^^^ + | +help: replace it with + | +LL | let _ = Range { start: start, end }; + | ~~~ error: redundant field names in struct initialization --> tests/ui/redundant_field_names.rs:59:32 | LL | let _ = RangeToInclusive { end: end }; - | ^^^^^^^^ help: replace it with: `end` + | ^^^^^^^^ + | +help: replace it with + | +LL | let _ = RangeToInclusive { end }; + | ~~~ error: redundant field names in struct initialization --> tests/ui/redundant_field_names.rs:71:25 | LL | let _ = S { v: v }; - | ^^^^ help: replace it with: `v` + | ^^^^ ... LL | internal!(v); | ------------ in this macro invocation | = note: this error originates in the macro `internal` (in Nightly builds, run with -Z macro-backtrace for more info) +help: replace it with + | +LL | let _ = S { v }; + | ~ error: redundant field names in struct initialization --> tests/ui/redundant_field_names.rs:99:25 | LL | let _ = RangeFrom { start: start }; - | ^^^^^^^^^^^^ help: replace it with: `start` + | ^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = RangeFrom { start }; + | ~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_drop_order.stderr b/src/tools/clippy/tests/ui/redundant_pattern_matching_drop_order.stderr index 1a99cb9fc32b5..0d47b07a033dc 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_drop_order.stderr +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_drop_order.stderr @@ -2,171 +2,269 @@ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_drop_order.rs:15:12 | LL | if let Ok(_) = m.lock() {} - | -------^^^^^----------- help: try: `if m.lock().is_ok()` + | ^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` +help: try + | +LL | if m.lock().is_ok() {} + | ~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_drop_order.rs:16:12 | LL | if let Err(_) = Err::<(), _>(m.lock().unwrap().0) {} - | -------^^^^^^------------------------------------ help: try: `if Err::<(), _>(m.lock().unwrap().0).is_err()` + | ^^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if Err::<(), _>(m.lock().unwrap().0).is_err() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_drop_order.rs:19:16 | LL | if let Ok(_) = Ok::<_, std::sync::MutexGuard<()>>(()) {} - | -------^^^^^----------------------------------------- help: try: `if Ok::<_, std::sync::MutexGuard<()>>(()).is_ok()` + | ^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if Ok::<_, std::sync::MutexGuard<()>>(()).is_ok() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_drop_order.rs:21:12 | LL | if let Ok(_) = Ok::<_, std::sync::MutexGuard<()>>(()) { - | -------^^^^^----------------------------------------- help: try: `if Ok::<_, std::sync::MutexGuard<()>>(()).is_ok()` + | ^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if Ok::<_, std::sync::MutexGuard<()>>(()).is_ok() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_drop_order.rs:24:12 | LL | if let Ok(_) = Ok::<_, std::sync::MutexGuard<()>>(()) {} - | -------^^^^^----------------------------------------- help: try: `if Ok::<_, std::sync::MutexGuard<()>>(()).is_ok()` + | ^^^^^ + | +help: try + | +LL | if Ok::<_, std::sync::MutexGuard<()>>(()).is_ok() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_drop_order.rs:25:12 | LL | if let Err(_) = Err::, _>(()) {} - | -------^^^^^^------------------------------------------ help: try: `if Err::, _>(()).is_err()` + | ^^^^^^ + | +help: try + | +LL | if Err::, _>(()).is_err() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_drop_order.rs:27:12 | LL | if let Ok(_) = Ok::<_, ()>(String::new()) {} - | -------^^^^^----------------------------- help: try: `if Ok::<_, ()>(String::new()).is_ok()` + | ^^^^^ + | +help: try + | +LL | if Ok::<_, ()>(String::new()).is_ok() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_drop_order.rs:28:12 | LL | if let Err(_) = Err::<(), _>((String::new(), ())) {} - | -------^^^^^^------------------------------------ help: try: `if Err::<(), _>((String::new(), ())).is_err()` + | ^^^^^^ + | +help: try + | +LL | if Err::<(), _>((String::new(), ())).is_err() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_drop_order.rs:31:12 | LL | if let Some(_) = Some(m.lock()) {} - | -------^^^^^^^----------------- help: try: `if Some(m.lock()).is_some()` + | ^^^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if Some(m.lock()).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_drop_order.rs:32:12 | LL | if let Some(_) = Some(m.lock().unwrap().0) {} - | -------^^^^^^^---------------------------- help: try: `if Some(m.lock().unwrap().0).is_some()` + | ^^^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if Some(m.lock().unwrap().0).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_drop_order.rs:35:16 | LL | if let None = None::> {} - | -------^^^^------------------------------------ help: try: `if None::>.is_none()` + | ^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if None::>.is_none() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_drop_order.rs:37:12 | LL | if let None = None::> { - | -------^^^^------------------------------------ help: try: `if None::>.is_none()` + | ^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if None::>.is_none() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_drop_order.rs:41:12 | LL | if let None = None::> {} - | -------^^^^------------------------------------ help: try: `if None::>.is_none()` + | ^^^^ + | +help: try + | +LL | if None::>.is_none() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_drop_order.rs:43:12 | LL | if let Some(_) = Some(String::new()) {} - | -------^^^^^^^---------------------- help: try: `if Some(String::new()).is_some()` + | ^^^^^^^ + | +help: try + | +LL | if Some(String::new()).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_drop_order.rs:44:12 | LL | if let Some(_) = Some((String::new(), ())) {} - | -------^^^^^^^---------------------------- help: try: `if Some((String::new(), ())).is_some()` + | ^^^^^^^ + | +help: try + | +LL | if Some((String::new(), ())).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_drop_order.rs:47:12 | LL | if let Ready(_) = Ready(m.lock()) {} - | -------^^^^^^^^------------------ help: try: `if Ready(m.lock()).is_ready()` + | ^^^^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if Ready(m.lock()).is_ready() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_drop_order.rs:48:12 | LL | if let Ready(_) = Ready(m.lock().unwrap().0) {} - | -------^^^^^^^^----------------------------- help: try: `if Ready(m.lock().unwrap().0).is_ready()` + | ^^^^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if Ready(m.lock().unwrap().0).is_ready() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_drop_order.rs:51:16 | LL | if let Pending = Pending::> {} - | -------^^^^^^^--------------------------------------- help: try: `if Pending::>.is_pending()` + | ^^^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if Pending::>.is_pending() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_drop_order.rs:53:12 | LL | if let Pending = Pending::> { - | -------^^^^^^^--------------------------------------- help: try: `if Pending::>.is_pending()` + | ^^^^^^^ | = note: this will change drop order of the result, as well as all temporaries = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important +help: try + | +LL | if Pending::>.is_pending() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_drop_order.rs:57:12 | LL | if let Pending = Pending::> {} - | -------^^^^^^^--------------------------------------- help: try: `if Pending::>.is_pending()` + | ^^^^^^^ + | +help: try + | +LL | if Pending::>.is_pending() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_drop_order.rs:59:12 | LL | if let Ready(_) = Ready(String::new()) {} - | -------^^^^^^^^----------------------- help: try: `if Ready(String::new()).is_ready()` + | ^^^^^^^^ + | +help: try + | +LL | if Ready(String::new()).is_ready() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_drop_order.rs:60:12 | LL | if let Ready(_) = Ready((String::new(), ())) {} - | -------^^^^^^^^----------------------------- help: try: `if Ready((String::new(), ())).is_ready()` + | ^^^^^^^^ + | +help: try + | +LL | if Ready((String::new(), ())).is_ready() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 22 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_if_let_true.stderr b/src/tools/clippy/tests/ui/redundant_pattern_matching_if_let_true.stderr index 43d5cd07cec77..8a67919579d24 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_if_let_true.stderr +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_if_let_true.stderr @@ -2,46 +2,80 @@ error: using `if let` to pattern match a bool --> tests/ui/redundant_pattern_matching_if_let_true.rs:22:8 | LL | if let true = k > 1 {} - | ^^^^^^^^^^^^^^^^ help: consider using the condition directly: `k > 1` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` +help: consider using the condition directly + | +LL | if k > 1 {} + | ~~~~~ error: using `if let` to pattern match a bool --> tests/ui/redundant_pattern_matching_if_let_true.rs:23:8 | LL | if let false = k > 5 {} - | ^^^^^^^^^^^^^^^^^ help: consider using the condition directly: `!(k > 5)` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using the condition directly + | +LL | if !(k > 5) {} + | ~~~~~~~~ error: using `if let` to pattern match a bool --> tests/ui/redundant_pattern_matching_if_let_true.rs:24:8 | LL | if let (true) = k > 1 {} - | ^^^^^^^^^^^^^^^^^^ help: consider using the condition directly: `k > 1` + | ^^^^^^^^^^^^^^^^^^ + | +help: consider using the condition directly + | +LL | if k > 1 {} + | ~~~~~ error: using `if let` to pattern match a bool --> tests/ui/redundant_pattern_matching_if_let_true.rs:26:11 | LL | while let true = k > 1 { - | ^^^^^^^^^^^^^^^^ help: consider using the condition directly: `k > 1` + | ^^^^^^^^^^^^^^^^ + | +help: consider using the condition directly + | +LL | while k > 1 { + | ~~~~~ error: using `if let` to pattern match a bool --> tests/ui/redundant_pattern_matching_if_let_true.rs:29:11 | LL | while let true = condition!() { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using the condition directly: `condition!()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using the condition directly + | +LL | while condition!() { + | ~~~~~~~~~~~~ error: using `matches!` to pattern match a bool --> tests/ui/redundant_pattern_matching_if_let_true.rs:33:5 | LL | matches!(k > 5, true); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using the condition directly: `k > 5` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using the condition directly + | +LL | k > 5; + | ~~~~~ error: using `matches!` to pattern match a bool --> tests/ui/redundant_pattern_matching_if_let_true.rs:34:5 | LL | matches!(k > 5, false); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using the condition directly: `!(k > 5)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using the condition directly + | +LL | !(k > 5); + | ~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_ipaddr.stderr b/src/tools/clippy/tests/ui/redundant_pattern_matching_ipaddr.stderr index a4930ad839f91..1ff7b3b2b2240 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_ipaddr.stderr +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_ipaddr.stderr @@ -2,46 +2,80 @@ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:15:12 | LL | if let V4(_) = &ipaddr {} - | -------^^^^^---------- help: try: `if ipaddr.is_ipv4()` + | ^^^^^ | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` +help: try + | +LL | if ipaddr.is_ipv4() {} + | ~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:17:12 | LL | if let V4(_) = V4(Ipv4Addr::LOCALHOST) {} - | -------^^^^^-------------------------- help: try: `if V4(Ipv4Addr::LOCALHOST).is_ipv4()` + | ^^^^^ + | +help: try + | +LL | if V4(Ipv4Addr::LOCALHOST).is_ipv4() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv6()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:19:12 | LL | if let V6(_) = V6(Ipv6Addr::LOCALHOST) {} - | -------^^^^^-------------------------- help: try: `if V6(Ipv6Addr::LOCALHOST).is_ipv6()` + | ^^^^^ + | +help: try + | +LL | if V6(Ipv6Addr::LOCALHOST).is_ipv6() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:22:8 | LL | if matches!(V4(Ipv4Addr::LOCALHOST), V4(_)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `V4(Ipv4Addr::LOCALHOST).is_ipv4()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if V4(Ipv4Addr::LOCALHOST).is_ipv4() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv6()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:25:8 | LL | if matches!(V6(Ipv6Addr::LOCALHOST), V6(_)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `V6(Ipv6Addr::LOCALHOST).is_ipv6()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if V6(Ipv6Addr::LOCALHOST).is_ipv6() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:27:15 | LL | while let V4(_) = V4(Ipv4Addr::LOCALHOST) {} - | ----------^^^^^-------------------------- help: try: `while V4(Ipv4Addr::LOCALHOST).is_ipv4()` + | ^^^^^ + | +help: try + | +LL | while V4(Ipv4Addr::LOCALHOST).is_ipv4() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv6()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:29:15 | LL | while let V6(_) = V6(Ipv6Addr::LOCALHOST) {} - | ----------^^^^^-------------------------- help: try: `while V6(Ipv6Addr::LOCALHOST).is_ipv6()` + | ^^^^^ + | +help: try + | +LL | while V6(Ipv6Addr::LOCALHOST).is_ipv6() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:39:5 @@ -50,7 +84,12 @@ LL | / match V4(Ipv4Addr::LOCALHOST) { LL | | V4(_) => true, LL | | V6(_) => false, LL | | }; - | |_____^ help: try: `V4(Ipv4Addr::LOCALHOST).is_ipv4()` + | |_____^ + | +help: try + | +LL | V4(Ipv4Addr::LOCALHOST).is_ipv4(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv6()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:44:5 @@ -59,7 +98,12 @@ LL | / match V4(Ipv4Addr::LOCALHOST) { LL | | V4(_) => false, LL | | V6(_) => true, LL | | }; - | |_____^ help: try: `V4(Ipv4Addr::LOCALHOST).is_ipv6()` + | |_____^ + | +help: try + | +LL | V4(Ipv4Addr::LOCALHOST).is_ipv6(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv6()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:49:5 @@ -68,7 +112,12 @@ LL | / match V6(Ipv6Addr::LOCALHOST) { LL | | V4(_) => false, LL | | V6(_) => true, LL | | }; - | |_____^ help: try: `V6(Ipv6Addr::LOCALHOST).is_ipv6()` + | |_____^ + | +help: try + | +LL | V6(Ipv6Addr::LOCALHOST).is_ipv6(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:54:5 @@ -77,49 +126,89 @@ LL | / match V6(Ipv6Addr::LOCALHOST) { LL | | V4(_) => true, LL | | V6(_) => false, LL | | }; - | |_____^ help: try: `V6(Ipv6Addr::LOCALHOST).is_ipv4()` + | |_____^ + | +help: try + | +LL | V6(Ipv6Addr::LOCALHOST).is_ipv4(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:59:20 | LL | let _ = if let V4(_) = V4(Ipv4Addr::LOCALHOST) { - | -------^^^^^-------------------------- help: try: `if V4(Ipv4Addr::LOCALHOST).is_ipv4()` + | ^^^^^ + | +help: try + | +LL | let _ = if V4(Ipv4Addr::LOCALHOST).is_ipv4() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:67:20 | LL | let _ = if let V4(_) = gen_ipaddr() { - | -------^^^^^--------------- help: try: `if gen_ipaddr().is_ipv4()` + | ^^^^^ + | +help: try + | +LL | let _ = if gen_ipaddr().is_ipv4() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv6()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:69:19 | LL | } else if let V6(_) = gen_ipaddr() { - | -------^^^^^--------------- help: try: `if gen_ipaddr().is_ipv6()` + | ^^^^^ + | +help: try + | +LL | } else if gen_ipaddr().is_ipv6() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:81:12 | LL | if let V4(_) = V4(Ipv4Addr::LOCALHOST) {} - | -------^^^^^-------------------------- help: try: `if V4(Ipv4Addr::LOCALHOST).is_ipv4()` + | ^^^^^ + | +help: try + | +LL | if V4(Ipv4Addr::LOCALHOST).is_ipv4() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv6()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:83:12 | LL | if let V6(_) = V6(Ipv6Addr::LOCALHOST) {} - | -------^^^^^-------------------------- help: try: `if V6(Ipv6Addr::LOCALHOST).is_ipv6()` + | ^^^^^ + | +help: try + | +LL | if V6(Ipv6Addr::LOCALHOST).is_ipv6() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:85:15 | LL | while let V4(_) = V4(Ipv4Addr::LOCALHOST) {} - | ----------^^^^^-------------------------- help: try: `while V4(Ipv4Addr::LOCALHOST).is_ipv4()` + | ^^^^^ + | +help: try + | +LL | while V4(Ipv4Addr::LOCALHOST).is_ipv4() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv6()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:87:15 | LL | while let V6(_) = V6(Ipv6Addr::LOCALHOST) {} - | ----------^^^^^-------------------------- help: try: `while V6(Ipv6Addr::LOCALHOST).is_ipv6()` + | ^^^^^ + | +help: try + | +LL | while V6(Ipv6Addr::LOCALHOST).is_ipv6() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv4()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:89:5 @@ -128,7 +217,12 @@ LL | / match V4(Ipv4Addr::LOCALHOST) { LL | | V4(_) => true, LL | | V6(_) => false, LL | | }; - | |_____^ help: try: `V4(Ipv4Addr::LOCALHOST).is_ipv4()` + | |_____^ + | +help: try + | +LL | V4(Ipv4Addr::LOCALHOST).is_ipv4(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ipv6()` --> tests/ui/redundant_pattern_matching_ipaddr.rs:94:5 @@ -137,7 +231,12 @@ LL | / match V6(Ipv6Addr::LOCALHOST) { LL | | V4(_) => false, LL | | V6(_) => true, LL | | }; - | |_____^ help: try: `V6(Ipv6Addr::LOCALHOST).is_ipv6()` + | |_____^ + | +help: try + | +LL | V6(Ipv6Addr::LOCALHOST).is_ipv6(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 20 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.stderr b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.stderr index 575f199be42c5..fb66b68356bbf 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.stderr +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.stderr @@ -2,58 +2,102 @@ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:14:5 | LL | matches!(maybe_some, None if !boolean) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `maybe_some.is_none() && (!boolean)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` +help: try + | +LL | maybe_some.is_none() && (!boolean) + | error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:18:13 | LL | let _ = matches!(maybe_some, None if boolean || boolean2); // guard needs parentheses - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `maybe_some.is_none() && (boolean || boolean2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = maybe_some.is_none() && (boolean || boolean2); // guard needs parentheses + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:32:12 | LL | if let None = None::<()> {} - | -------^^^^------------- help: try: `if None::<()>.is_none()` + | ^^^^ + | +help: try + | +LL | if None::<()>.is_none() {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:34:12 | LL | if let Some(_) = Some(42) {} - | -------^^^^^^^----------- help: try: `if Some(42).is_some()` + | ^^^^^^^ + | +help: try + | +LL | if Some(42).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:36:12 | LL | if let Some(_) = Some(42) { - | -------^^^^^^^----------- help: try: `if Some(42).is_some()` + | ^^^^^^^ + | +help: try + | +LL | if Some(42).is_some() { + | ~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:42:15 | LL | while let Some(_) = Some(42) {} - | ----------^^^^^^^----------- help: try: `while Some(42).is_some()` + | ^^^^^^^ + | +help: try + | +LL | while Some(42).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:44:15 | LL | while let None = Some(42) {} - | ----------^^^^----------- help: try: `while Some(42).is_none()` + | ^^^^ + | +help: try + | +LL | while Some(42).is_none() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:46:15 | LL | while let None = None::<()> {} - | ----------^^^^------------- help: try: `while None::<()>.is_none()` + | ^^^^ + | +help: try + | +LL | while None::<()>.is_none() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:49:15 | LL | while let Some(_) = v.pop() { - | ----------^^^^^^^---------- help: try: `while v.pop().is_some()` + | ^^^^^^^ + | +help: try + | +LL | while v.pop().is_some() { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:57:5 @@ -62,7 +106,12 @@ LL | / match Some(42) { LL | | Some(_) => true, LL | | None => false, LL | | }; - | |_____^ help: try: `Some(42).is_some()` + | |_____^ + | +help: try + | +LL | Some(42).is_some(); + | ~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:62:5 @@ -71,7 +120,12 @@ LL | / match None::<()> { LL | | Some(_) => false, LL | | None => true, LL | | }; - | |_____^ help: try: `None::<()>.is_none()` + | |_____^ + | +help: try + | +LL | None::<()>.is_none(); + | ~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:67:13 @@ -81,55 +135,100 @@ LL | let _ = match None::<()> { LL | | Some(_) => false, LL | | None => true, LL | | }; - | |_____^ help: try: `None::<()>.is_none()` + | |_____^ + | +help: try + | +LL | let _ = None::<()>.is_none(); + | ~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:73:20 | LL | let _ = if let Some(_) = opt { true } else { false }; - | -------^^^^^^^------ help: try: `if opt.is_some()` + | ^^^^^^^ + | +help: try + | +LL | let _ = if opt.is_some() { true } else { false }; + | ~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:79:20 | LL | let _ = if let Some(_) = gen_opt() { - | -------^^^^^^^------------ help: try: `if gen_opt().is_some()` + | ^^^^^^^ + | +help: try + | +LL | let _ = if gen_opt().is_some() { + | ~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:81:19 | LL | } else if let None = gen_opt() { - | -------^^^^------------ help: try: `if gen_opt().is_none()` + | ^^^^ + | +help: try + | +LL | } else if gen_opt().is_none() { + | ~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:87:12 | LL | if let Some(..) = gen_opt() {} - | -------^^^^^^^^------------ help: try: `if gen_opt().is_some()` + | ^^^^^^^^ + | +help: try + | +LL | if gen_opt().is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:102:12 | LL | if let Some(_) = Some(42) {} - | -------^^^^^^^----------- help: try: `if Some(42).is_some()` + | ^^^^^^^ + | +help: try + | +LL | if Some(42).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:104:12 | LL | if let None = None::<()> {} - | -------^^^^------------- help: try: `if None::<()>.is_none()` + | ^^^^ + | +help: try + | +LL | if None::<()>.is_none() {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:106:15 | LL | while let Some(_) = Some(42) {} - | ----------^^^^^^^----------- help: try: `while Some(42).is_some()` + | ^^^^^^^ + | +help: try + | +LL | while Some(42).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:108:15 | LL | while let None = None::<()> {} - | ----------^^^^------------- help: try: `while None::<()>.is_none()` + | ^^^^ + | +help: try + | +LL | while None::<()>.is_none() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:110:5 @@ -138,7 +237,12 @@ LL | / match Some(42) { LL | | Some(_) => true, LL | | None => false, LL | | }; - | |_____^ help: try: `Some(42).is_some()` + | |_____^ + | +help: try + | +LL | Some(42).is_some(); + | ~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:115:5 @@ -147,19 +251,34 @@ LL | / match None::<()> { LL | | Some(_) => false, LL | | None => true, LL | | }; - | |_____^ help: try: `None::<()>.is_none()` + | |_____^ + | +help: try + | +LL | None::<()>.is_none(); + | ~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:123:12 | LL | if let None = *(&None::<()>) {} - | -------^^^^----------------- help: try: `if (&None::<()>).is_none()` + | ^^^^ + | +help: try + | +LL | if (&None::<()>).is_none() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:124:12 | LL | if let None = *&None::<()> {} - | -------^^^^--------------- help: try: `if (&None::<()>).is_none()` + | ^^^^ + | +help: try + | +LL | if (&None::<()>).is_none() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:130:5 @@ -168,7 +287,12 @@ LL | / match x { LL | | Some(_) => true, LL | | _ => false, LL | | }; - | |_____^ help: try: `x.is_some()` + | |_____^ + | +help: try + | +LL | x.is_some(); + | ~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:135:5 @@ -177,7 +301,12 @@ LL | / match x { LL | | None => true, LL | | _ => false, LL | | }; - | |_____^ help: try: `x.is_none()` + | |_____^ + | +help: try + | +LL | x.is_none(); + | ~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:140:5 @@ -186,7 +315,12 @@ LL | / match x { LL | | Some(_) => false, LL | | _ => true, LL | | }; - | |_____^ help: try: `x.is_none()` + | |_____^ + | +help: try + | +LL | x.is_none(); + | ~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:145:5 @@ -195,19 +329,34 @@ LL | / match x { LL | | None => false, LL | | _ => true, LL | | }; - | |_____^ help: try: `x.is_some()` + | |_____^ + | +help: try + | +LL | x.is_some(); + | ~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_option.rs:160:13 | LL | let _ = matches!(x, Some(_)); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `x.is_some()` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x.is_some(); + | ~~~~~~~~~~~ error: redundant pattern matching, consider using `is_none()` --> tests/ui/redundant_pattern_matching_option.rs:162:13 | LL | let _ = matches!(x, None); - | ^^^^^^^^^^^^^^^^^ help: try: `x.is_none()` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x.is_none(); + | ~~~~~~~~~~~ error: aborting due to 30 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_poll.stderr b/src/tools/clippy/tests/ui/redundant_pattern_matching_poll.stderr index 2b0f087fb9939..579608eaf1009 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_poll.stderr +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_poll.stderr @@ -2,52 +2,91 @@ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:15:12 | LL | if let Pending = Pending::<()> {} - | -------^^^^^^^---------------- help: try: `if Pending::<()>.is_pending()` + | ^^^^^^^ | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` +help: try + | +LL | if Pending::<()>.is_pending() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:17:12 | LL | if let Ready(_) = Ready(42) {} - | -------^^^^^^^^------------ help: try: `if Ready(42).is_ready()` + | ^^^^^^^^ + | +help: try + | +LL | if Ready(42).is_ready() {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:19:12 | LL | if let Ready(_) = Ready(42) { - | -------^^^^^^^^------------ help: try: `if Ready(42).is_ready()` + | ^^^^^^^^ + | +help: try + | +LL | if Ready(42).is_ready() { + | ~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:26:8 | LL | if matches!(Ready(42), Ready(_)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Ready(42).is_ready()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if Ready(42).is_ready() {} + | ~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:29:8 | LL | if matches!(Pending::<()>, Pending) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Pending::<()>.is_pending()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if Pending::<()>.is_pending() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:31:15 | LL | while let Ready(_) = Ready(42) {} - | ----------^^^^^^^^------------ help: try: `while Ready(42).is_ready()` + | ^^^^^^^^ + | +help: try + | +LL | while Ready(42).is_ready() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:33:15 | LL | while let Pending = Ready(42) {} - | ----------^^^^^^^------------ help: try: `while Ready(42).is_pending()` + | ^^^^^^^ + | +help: try + | +LL | while Ready(42).is_pending() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:35:15 | LL | while let Pending = Pending::<()> {} - | ----------^^^^^^^---------------- help: try: `while Pending::<()>.is_pending()` + | ^^^^^^^ + | +help: try + | +LL | while Pending::<()>.is_pending() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:41:5 @@ -56,7 +95,12 @@ LL | / match Ready(42) { LL | | Ready(_) => true, LL | | Pending => false, LL | | }; - | |_____^ help: try: `Ready(42).is_ready()` + | |_____^ + | +help: try + | +LL | Ready(42).is_ready(); + | ~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:46:5 @@ -65,7 +109,12 @@ LL | / match Pending::<()> { LL | | Ready(_) => false, LL | | Pending => true, LL | | }; - | |_____^ help: try: `Pending::<()>.is_pending()` + | |_____^ + | +help: try + | +LL | Pending::<()>.is_pending(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:51:13 @@ -75,49 +124,89 @@ LL | let _ = match Pending::<()> { LL | | Ready(_) => false, LL | | Pending => true, LL | | }; - | |_____^ help: try: `Pending::<()>.is_pending()` + | |_____^ + | +help: try + | +LL | let _ = Pending::<()>.is_pending(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:57:20 | LL | let _ = if let Ready(_) = poll { true } else { false }; - | -------^^^^^^^^------- help: try: `if poll.is_ready()` + | ^^^^^^^^ + | +help: try + | +LL | let _ = if poll.is_ready() { true } else { false }; + | ~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:61:20 | LL | let _ = if let Ready(_) = gen_poll() { - | -------^^^^^^^^------------- help: try: `if gen_poll().is_ready()` + | ^^^^^^^^ + | +help: try + | +LL | let _ = if gen_poll().is_ready() { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:63:19 | LL | } else if let Pending = gen_poll() { - | -------^^^^^^^------------- help: try: `if gen_poll().is_pending()` + | ^^^^^^^ + | +help: try + | +LL | } else if gen_poll().is_pending() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:79:12 | LL | if let Ready(_) = Ready(42) {} - | -------^^^^^^^^------------ help: try: `if Ready(42).is_ready()` + | ^^^^^^^^ + | +help: try + | +LL | if Ready(42).is_ready() {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:81:12 | LL | if let Pending = Pending::<()> {} - | -------^^^^^^^---------------- help: try: `if Pending::<()>.is_pending()` + | ^^^^^^^ + | +help: try + | +LL | if Pending::<()>.is_pending() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:83:15 | LL | while let Ready(_) = Ready(42) {} - | ----------^^^^^^^^------------ help: try: `while Ready(42).is_ready()` + | ^^^^^^^^ + | +help: try + | +LL | while Ready(42).is_ready() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:85:15 | LL | while let Pending = Pending::<()> {} - | ----------^^^^^^^---------------- help: try: `while Pending::<()>.is_pending()` + | ^^^^^^^ + | +help: try + | +LL | while Pending::<()>.is_pending() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ready()` --> tests/ui/redundant_pattern_matching_poll.rs:87:5 @@ -126,7 +215,12 @@ LL | / match Ready(42) { LL | | Ready(_) => true, LL | | Pending => false, LL | | }; - | |_____^ help: try: `Ready(42).is_ready()` + | |_____^ + | +help: try + | +LL | Ready(42).is_ready(); + | ~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_pending()` --> tests/ui/redundant_pattern_matching_poll.rs:92:5 @@ -135,7 +229,12 @@ LL | / match Pending::<()> { LL | | Ready(_) => false, LL | | Pending => true, LL | | }; - | |_____^ help: try: `Pending::<()>.is_pending()` + | |_____^ + | +help: try + | +LL | Pending::<()>.is_pending(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 20 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_result.stderr b/src/tools/clippy/tests/ui/redundant_pattern_matching_result.stderr index 991e6225ecb6d..2311558e0cd07 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_result.stderr +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_result.stderr @@ -2,34 +2,58 @@ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:15:12 | LL | if let Ok(_) = &result {} - | -------^^^^^---------- help: try: `if result.is_ok()` + | ^^^^^ | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` +help: try + | +LL | if result.is_ok() {} + | ~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:17:12 | LL | if let Ok(_) = Ok::(42) {} - | -------^^^^^--------------------- help: try: `if Ok::(42).is_ok()` + | ^^^^^ + | +help: try + | +LL | if Ok::(42).is_ok() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:19:12 | LL | if let Err(_) = Err::(42) {} - | -------^^^^^^---------------------- help: try: `if Err::(42).is_err()` + | ^^^^^^ + | +help: try + | +LL | if Err::(42).is_err() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:21:15 | LL | while let Ok(_) = Ok::(10) {} - | ----------^^^^^--------------------- help: try: `while Ok::(10).is_ok()` + | ^^^^^ + | +help: try + | +LL | while Ok::(10).is_ok() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:23:15 | LL | while let Err(_) = Ok::(10) {} - | ----------^^^^^^--------------------- help: try: `while Ok::(10).is_err()` + | ^^^^^^ + | +help: try + | +LL | while Ok::(10).is_err() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:33:5 @@ -38,7 +62,12 @@ LL | / match Ok::(42) { LL | | Ok(_) => true, LL | | Err(_) => false, LL | | }; - | |_____^ help: try: `Ok::(42).is_ok()` + | |_____^ + | +help: try + | +LL | Ok::(42).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:38:5 @@ -47,7 +76,12 @@ LL | / match Ok::(42) { LL | | Ok(_) => false, LL | | Err(_) => true, LL | | }; - | |_____^ help: try: `Ok::(42).is_err()` + | |_____^ + | +help: try + | +LL | Ok::(42).is_err(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:43:5 @@ -56,7 +90,12 @@ LL | / match Err::(42) { LL | | Ok(_) => false, LL | | Err(_) => true, LL | | }; - | |_____^ help: try: `Err::(42).is_err()` + | |_____^ + | +help: try + | +LL | Err::(42).is_err(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:48:5 @@ -65,73 +104,133 @@ LL | / match Err::(42) { LL | | Ok(_) => true, LL | | Err(_) => false, LL | | }; - | |_____^ help: try: `Err::(42).is_ok()` + | |_____^ + | +help: try + | +LL | Err::(42).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:53:20 | LL | let _ = if let Ok(_) = Ok::(4) { true } else { false }; - | -------^^^^^--------------------- help: try: `if Ok::(4).is_ok()` + | ^^^^^ + | +help: try + | +LL | let _ = if Ok::(4).is_ok() { true } else { false }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:61:20 | LL | let _ = if let Ok(_) = gen_res() { - | -------^^^^^------------ help: try: `if gen_res().is_ok()` + | ^^^^^ + | +help: try + | +LL | let _ = if gen_res().is_ok() { + | ~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:63:19 | LL | } else if let Err(_) = gen_res() { - | -------^^^^^^------------ help: try: `if gen_res().is_err()` + | ^^^^^^ + | +help: try + | +LL | } else if gen_res().is_err() { + | ~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_result.rs:86:19 | LL | while let Some(_) = r#try!(result_opt()) {} - | ----------^^^^^^^----------------------- help: try: `while r#try!(result_opt()).is_some()` + | ^^^^^^^ + | +help: try + | +LL | while r#try!(result_opt()).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_result.rs:87:16 | LL | if let Some(_) = r#try!(result_opt()) {} - | -------^^^^^^^----------------------- help: try: `if r#try!(result_opt()).is_some()` + | ^^^^^^^ + | +help: try + | +LL | if r#try!(result_opt()).is_some() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_result.rs:93:12 | LL | if let Some(_) = m!() {} - | -------^^^^^^^------- help: try: `if m!().is_some()` + | ^^^^^^^ + | +help: try + | +LL | if m!().is_some() {} + | ~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_some()` --> tests/ui/redundant_pattern_matching_result.rs:94:15 | LL | while let Some(_) = m!() {} - | ----------^^^^^^^------- help: try: `while m!().is_some()` + | ^^^^^^^ + | +help: try + | +LL | while m!().is_some() {} + | ~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:112:12 | LL | if let Ok(_) = Ok::(42) {} - | -------^^^^^--------------------- help: try: `if Ok::(42).is_ok()` + | ^^^^^ + | +help: try + | +LL | if Ok::(42).is_ok() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:114:12 | LL | if let Err(_) = Err::(42) {} - | -------^^^^^^---------------------- help: try: `if Err::(42).is_err()` + | ^^^^^^ + | +help: try + | +LL | if Err::(42).is_err() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:116:15 | LL | while let Ok(_) = Ok::(10) {} - | ----------^^^^^--------------------- help: try: `while Ok::(10).is_ok()` + | ^^^^^ + | +help: try + | +LL | while Ok::(10).is_ok() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:118:15 | LL | while let Err(_) = Ok::(10) {} - | ----------^^^^^^--------------------- help: try: `while Ok::(10).is_err()` + | ^^^^^^ + | +help: try + | +LL | while Ok::(10).is_err() {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:120:5 @@ -140,7 +239,12 @@ LL | / match Ok::(42) { LL | | Ok(_) => true, LL | | Err(_) => false, LL | | }; - | |_____^ help: try: `Ok::(42).is_ok()` + | |_____^ + | +help: try + | +LL | Ok::(42).is_ok(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:125:5 @@ -149,7 +253,12 @@ LL | / match Err::(42) { LL | | Ok(_) => false, LL | | Err(_) => true, LL | | }; - | |_____^ help: try: `Err::(42).is_err()` + | |_____^ + | +help: try + | +LL | Err::(42).is_err(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:135:5 @@ -158,7 +267,12 @@ LL | / match x { LL | | Ok(_) => true, LL | | _ => false, LL | | }; - | |_____^ help: try: `x.is_ok()` + | |_____^ + | +help: try + | +LL | x.is_ok(); + | ~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:140:5 @@ -167,7 +281,12 @@ LL | / match x { LL | | Ok(_) => false, LL | | _ => true, LL | | }; - | |_____^ help: try: `x.is_err()` + | |_____^ + | +help: try + | +LL | x.is_err(); + | ~~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:145:5 @@ -176,7 +295,12 @@ LL | / match x { LL | | Err(_) => true, LL | | _ => false, LL | | }; - | |_____^ help: try: `x.is_err()` + | |_____^ + | +help: try + | +LL | x.is_err(); + | ~~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:150:5 @@ -185,19 +309,34 @@ LL | / match x { LL | | Err(_) => false, LL | | _ => true, LL | | }; - | |_____^ help: try: `x.is_ok()` + | |_____^ + | +help: try + | +LL | x.is_ok(); + | ~~~~~~~~~ error: redundant pattern matching, consider using `is_ok()` --> tests/ui/redundant_pattern_matching_result.rs:171:13 | LL | let _ = matches!(x, Ok(_)); - | ^^^^^^^^^^^^^^^^^^ help: try: `x.is_ok()` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x.is_ok(); + | ~~~~~~~~~ error: redundant pattern matching, consider using `is_err()` --> tests/ui/redundant_pattern_matching_result.rs:173:13 | LL | let _ = matches!(x, Err(_)); - | ^^^^^^^^^^^^^^^^^^^ help: try: `x.is_err()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x.is_err(); + | ~~~~~~~~~~ error: aborting due to 28 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_pub_crate.stderr b/src/tools/clippy/tests/ui/redundant_pub_crate.stderr index 8f1005ab9b73c..8b5392d0b701d 100644 --- a/src/tools/clippy/tests/ui/redundant_pub_crate.stderr +++ b/src/tools/clippy/tests/ui/redundant_pub_crate.stderr @@ -2,132 +2,179 @@ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:6:5 | LL | pub(crate) fn g() {} // private due to m1 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::redundant-pub-crate` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_pub_crate)]` +help: consider using + | +LL | pub fn g() {} // private due to m1 + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:11:9 | LL | pub(crate) fn g() {} // private due to m1_1 and m1 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // private due to m1_1 and m1 + | ~~~ error: pub(crate) module inside private module --> tests/ui/redundant_pub_crate.rs:15:5 | LL | pub(crate) mod m1_2 { - | ----------^^^^^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub mod m1_2 { + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:18:9 | LL | pub(crate) fn g() {} // private due to m1_2 and m1 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // private due to m1_2 and m1 + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:24:9 | LL | pub(crate) fn g() {} // private due to m1 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // private due to m1 + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:31:5 | LL | pub(crate) fn g() {} // already crate visible due to m2 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // already crate visible due to m2 + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:36:9 | LL | pub(crate) fn g() {} // private due to m2_1 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // private due to m2_1 + | ~~~ error: pub(crate) module inside private module --> tests/ui/redundant_pub_crate.rs:40:5 | LL | pub(crate) mod m2_2 { - | ----------^^^^^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub mod m2_2 { + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:43:9 | LL | pub(crate) fn g() {} // already crate visible due to m2_2 and m2 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // already crate visible due to m2_2 and m2 + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:49:9 | LL | pub(crate) fn g() {} // already crate visible due to m2 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // already crate visible due to m2 + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:61:9 | LL | pub(crate) fn g() {} // private due to m3_1 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // private due to m3_1 + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:68:9 | LL | pub(crate) fn g() {} // already crate visible due to m3_2 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // already crate visible due to m3_2 + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:81:5 | LL | pub(crate) fn g() {} // private: not re-exported by `pub use m4::*` - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // private: not re-exported by `pub use m4::*` + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:86:9 | LL | pub(crate) fn g() {} // private due to m4_1 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // private due to m4_1 + | ~~~ error: pub(crate) module inside private module --> tests/ui/redundant_pub_crate.rs:90:5 | LL | pub(crate) mod m4_2 { - | ----------^^^^^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub mod m4_2 { + | ~~~ error: pub(crate) function inside private module --> tests/ui/redundant_pub_crate.rs:93:9 | LL | pub(crate) fn g() {} // private due to m4_2 - | ----------^^^^^ - | | - | help: consider using: `pub` + | ^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | pub fn g() {} // private due to m4_2 + | ~~~ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_slicing.stderr b/src/tools/clippy/tests/ui/redundant_slicing.stderr index 269a597b32267..6b523bb959c29 100644 --- a/src/tools/clippy/tests/ui/redundant_slicing.stderr +++ b/src/tools/clippy/tests/ui/redundant_slicing.stderr @@ -2,22 +2,36 @@ error: redundant slicing of the whole range --> tests/ui/redundant_slicing.rs:8:13 | LL | let _ = &slice[..]; // Redundant slice - | ^^^^^^^^^^ help: use the original value instead: `slice` + | ^^^^^^^^^^ | = note: `-D clippy::redundant-slicing` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_slicing)]` +help: use the original value instead + | +LL | let _ = slice; // Redundant slice + | ~~~~~ error: redundant slicing of the whole range --> tests/ui/redundant_slicing.rs:12:13 | LL | let _ = &(&*v)[..]; // Outer borrow is redundant - | ^^^^^^^^^^ help: use the original value instead: `(&*v)` + | ^^^^^^^^^^ + | +help: use the original value instead + | +LL | let _ = (&*v); // Outer borrow is redundant + | ~~~~~ error: redundant slicing of the whole range --> tests/ui/redundant_slicing.rs:29:13 | LL | let _ = &m!(slice)[..]; - | ^^^^^^^^^^^^^^ help: use the original value instead: `slice` + | ^^^^^^^^^^^^^^ + | +help: use the original value instead + | +LL | let _ = slice; + | ~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_static_lifetimes.stderr b/src/tools/clippy/tests/ui/redundant_static_lifetimes.stderr index 5c5e2f2a57360..848a758a2b17a 100644 --- a/src/tools/clippy/tests/ui/redundant_static_lifetimes.stderr +++ b/src/tools/clippy/tests/ui/redundant_static_lifetimes.stderr @@ -2,112 +2,201 @@ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:6:17 | LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR: Consider removing 'static. - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ | = note: `-D clippy::redundant-static-lifetimes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_static_lifetimes)]` +help: consider removing `'static` + | +LL | const VAR_ONE: &str = "Test constant #1"; // ERROR: Consider removing 'static. + | ~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:10:21 | LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_THREE: &[&str] = &["one", "two"]; // ERROR: Consider removing 'static + | ~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:12:32 | LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_FOUR: (&str, (&str, &str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static + | ~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:12:47 | LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_FOUR: (&str, (&str, &'static str), &str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static + | ~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:14:17 | LL | const VAR_SIX: &'static u8 = &5; - | -^^^^^^^--- help: consider removing `'static`: `&u8` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_SIX: &u8 = &5; + | ~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:16:20 | LL | const VAR_HEIGHT: &'static Foo = &Foo {}; - | -^^^^^^^---- help: consider removing `'static`: `&Foo` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_HEIGHT: &Foo = &Foo {}; + | ~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:18:19 | LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR: Consider removing 'static. - | -^^^^^^^----- help: consider removing `'static`: `&[u8]` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_SLICE: &[u8] = b"Test constant #1"; // ERROR: Consider removing 'static. + | ~~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:20:19 | LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static. - | -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_TUPLE: &(u8, u8) = &(1, 2); // ERROR: Consider removing 'static. + | ~~~~~~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:22:19 | LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static. - | -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_ARRAY: &[u8; 1] = b"T"; // ERROR: Consider removing 'static. + | ~~~~~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:24:25 | LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR: Consider removing 'static. - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_ONE: &str = "Test static #1"; // ERROR: Consider removing 'static. + | ~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:28:29 | LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_THREE: &[&str] = &["one", "two"]; // ERROR: Consider removing 'static + | ~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:30:25 | LL | static STATIC_VAR_SIX: &'static u8 = &5; - | -^^^^^^^--- help: consider removing `'static`: `&u8` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_SIX: &u8 = &5; + | ~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:32:28 | LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {}; - | -^^^^^^^---- help: consider removing `'static`: `&Foo` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_HEIGHT: &Foo = &Foo {}; + | ~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:34:27 | LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR: Consider removing 'static. - | -^^^^^^^----- help: consider removing `'static`: `&[u8]` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_SLICE: &[u8] = b"Test static #3"; // ERROR: Consider removing 'static. + | ~~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:36:27 | LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static. - | -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_TUPLE: &(u8, u8) = &(1, 2); // ERROR: Consider removing 'static. + | ~~~~~~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:38:27 | LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static. - | -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_ARRAY: &[u8; 1] = b"T"; // ERROR: Consider removing 'static. + | ~~~~~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:40:31 | LL | static mut STATIC_MUT_SLICE: &'static mut [u32] = &mut [0]; - | -^^^^^^^---------- help: consider removing `'static`: `&mut [u32]` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static mut STATIC_MUT_SLICE: &mut [u32] = &mut [0]; + | ~~~~~~~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes.rs:69:16 | LL | static V: &'static u8 = &17; - | -^^^^^^^--- help: consider removing `'static`: `&u8` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static V: &u8 = &17; + | ~~~ error: aborting due to 18 previous errors diff --git a/src/tools/clippy/tests/ui/redundant_static_lifetimes_multiple.stderr b/src/tools/clippy/tests/ui/redundant_static_lifetimes_multiple.stderr index 330703d9eff12..ce456df6863d2 100644 --- a/src/tools/clippy/tests/ui/redundant_static_lifetimes_multiple.stderr +++ b/src/tools/clippy/tests/ui/redundant_static_lifetimes_multiple.stderr @@ -2,64 +2,113 @@ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:4:18 | LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR: Consider removing 'static - | -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]` + | ^^^^^^^ | = note: `-D clippy::redundant-static-lifetimes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_static_lifetimes)]` +help: consider removing `'static` + | +LL | const VAR_FIVE: &[&[&'static str]] = &[&["test"], &["other one"]]; // ERROR: Consider removing 'static + | ~~~~~~~~~~~~~~~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:4:30 | LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR: Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_FIVE: &'static [&[&str]] = &[&["test"], &["other one"]]; // ERROR: Consider removing 'static + | ~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:9:29 | LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])]; - | -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_SEVEN: &[&(&str, &[&'static str])] = &[&("one", &["other one"])]; + | ~~~~~~~~~~~~~~~ error: constants have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:9:39 | LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])]; - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | const VAR_SEVEN: &[&(&str, &'static [&str])] = &[&("one", &["other one"])]; + | ~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:13:40 | LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_FOUR: (&str, (&str, &str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static + | ~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:13:55 | LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_FOUR: (&str, (&str, &'static str), &str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static + | ~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:17:26 | LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR: Consider removing 'static - | -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_FIVE: &[&[&'static str]] = &[&["test"], &["other one"]]; // ERROR: Consider removing 'static + | ~~~~~~~~~~~~~~~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:17:38 | LL | static STATIC_VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR: Consider removing 'static - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_FIVE: &'static [&[&str]] = &[&["test"], &["other one"]]; // ERROR: Consider removing 'static + | ~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:21:37 | LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])]; - | -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_SEVEN: &[&(&str, &[&'static str])] = &[&("one", &["other one"])]; + | ~~~~~~~~~~~~~~~ error: statics have by default a `'static` lifetime --> tests/ui/redundant_static_lifetimes_multiple.rs:21:47 | LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])]; - | -^^^^^^^---- help: consider removing `'static`: `&str` + | ^^^^^^^ + | +help: consider removing `'static` + | +LL | static STATIC_VAR_SEVEN: &[&(&str, &'static [&str])] = &[&("one", &["other one"])]; + | ~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/ref_as_ptr.stderr b/src/tools/clippy/tests/ui/ref_as_ptr.stderr index c5e9af38aea09..0dba18d024917 100644 --- a/src/tools/clippy/tests/ui/ref_as_ptr.stderr +++ b/src/tools/clippy/tests/ui/ref_as_ptr.stderr @@ -2,268 +2,487 @@ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:7:7 | LL | f(&1u8 as *const _); - | ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&1u8)` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::ref-as-ptr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ref_as_ptr)]` +help: try + | +LL | f(std::ptr::from_ref(&1u8)); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:8:7 | LL | f(&2u32 as *const u32); - | ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&2u32)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&2u32)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:9:7 | LL | f(&3.0f64 as *const f64); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&3.0f64)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&3.0f64)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:11:7 | LL | f(&4 as *const _ as *const f32); - | ^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&4)` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref(&4) as *const f32); + | ~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:12:7 | LL | f(&5.0f32 as *const f32 as *const u32); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&5.0f32)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&5.0f32) as *const u32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:14:7 | LL | f(&mut 6u8 as *const _); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut 6u8)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref(&mut 6u8)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:15:7 | LL | f(&mut 7u32 as *const u32); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&mut 7u32)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&mut 7u32)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:16:7 | LL | f(&mut 8.0f64 as *const f64); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&mut 8.0f64)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&mut 8.0f64)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:18:7 | LL | f(&mut 9 as *const _ as *const f32); - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut 9)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref(&mut 9) as *const f32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:19:7 | LL | f(&mut 10.0f32 as *const f32 as *const u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&mut 10.0f32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&mut 10.0f32) as *const u32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:21:7 | LL | f(&mut 11u8 as *mut _); - | ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(&mut 11u8)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut(&mut 11u8)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:22:7 | LL | f(&mut 12u32 as *mut u32); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::(&mut 12u32)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut::(&mut 12u32)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:23:7 | LL | f(&mut 13.0f64 as *mut f64); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::(&mut 13.0f64)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut::(&mut 13.0f64)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:25:7 | LL | f(&mut 14 as *mut _ as *const f32); - | ^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(&mut 14)` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut(&mut 14) as *const f32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:26:7 | LL | f(&mut 15.0f32 as *mut f32 as *const u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::(&mut 15.0f32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut::(&mut 15.0f32) as *const u32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:28:7 | LL | f(&1u8 as *const _); - | ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&1u8)` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref(&1u8)); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:29:7 | LL | f(&2u32 as *const u32); - | ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&2u32)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&2u32)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:30:7 | LL | f(&3.0f64 as *const f64); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&3.0f64)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&3.0f64)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:32:7 | LL | f(&4 as *const _ as *const f32); - | ^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&4)` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref(&4) as *const f32); + | ~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:33:7 | LL | f(&5.0f32 as *const f32 as *const u32); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&5.0f32)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&5.0f32) as *const u32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:36:7 | LL | f(&val as *const _); - | ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&val)` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref(&val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:37:7 | LL | f(&val as *const i32); - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&val)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:39:7 | LL | f(&val as *const _ as *const f32); - | ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&val)` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref(&val) as *const f32); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:40:7 | LL | f(&val as *const i32 as *const f64); - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&val)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&val) as *const f64); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:43:7 | LL | f(&mut val as *mut u8); - | ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::(&mut val)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut::(&mut val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:44:7 | LL | f(&mut val as *mut _); - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(&mut val)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut(&mut val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:46:7 | LL | f(&mut val as *const u8); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&mut val)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&mut val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:47:7 | LL | f(&mut val as *const _); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut val)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref(&mut val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:49:7 | LL | f(&mut val as *const u8 as *const f64); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(&mut val)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(&mut val) as *const f64); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:50:28 | LL | f::<*const Option>(&mut val as *const _ as *const _); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut val)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f::<*const Option>(std::ptr::from_ref(&mut val) as *const _); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:52:7 | LL | f(&std::array::from_fn(|i| i * i) as *const [usize; 7]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<[usize; 7]>(&std::array::from_fn(|i| i * i))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::<[usize; 7]>(&std::array::from_fn(|i| i * i))); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:53:7 | LL | f(&mut std::array::from_fn(|i| i * i) as *const [usize; 8]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<[usize; 8]>(&mut std::array::from_fn(|i| i * i))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::<[usize; 8]>(&mut std::array::from_fn(|i| i * i))); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:54:7 | LL | f(&mut std::array::from_fn(|i| i * i) as *mut [usize; 9]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<[usize; 9]>(&mut std::array::from_fn(|i| i * i))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut::<[usize; 9]>(&mut std::array::from_fn(|i| i * i))); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:76:7 | LL | f(val as *const i32); - | ^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::(val)` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::(val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:77:7 | LL | f(mut_val as *mut i32); - | ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::(mut_val)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut::(mut_val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:81:7 | LL | f(val as *const _); - | ^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(val)` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref(val)); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:82:7 | LL | f(val as *const [u8]); - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<[u8]>(val)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_ref::<[u8]>(val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:86:7 | LL | f(val as *mut _); - | ^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(val)` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut(val)); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:87:7 | LL | f(val as *mut str); - | ^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::(val)` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | f(std::ptr::from_mut::(val)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:94:9 | LL | self.0 as *const _ as *const _ - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | std::ptr::from_ref(self.0) as *const _ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:98:9 | LL | self.0 as *const _ as *const _ - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | std::ptr::from_ref(self.0) as *const _ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:106:9 | LL | self.0 as *const _ as *const _ - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | std::ptr::from_ref(self.0) as *const _ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:110:9 | LL | self.0 as *const _ as *const _ - | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)` + | ^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | std::ptr::from_ref(self.0) as *const _ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: reference as raw pointer --> tests/ui/ref_as_ptr.rs:114:9 | LL | self.0 as *mut _ as *mut _ - | ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(self.0)` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | std::ptr::from_mut(self.0) as *mut _ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 44 previous errors diff --git a/src/tools/clippy/tests/ui/ref_option_ref.stderr b/src/tools/clippy/tests/ui/ref_option_ref.stderr index 1cb64e1182a55..d2aa3f43abec5 100644 --- a/src/tools/clippy/tests/ui/ref_option_ref.stderr +++ b/src/tools/clippy/tests/ui/ref_option_ref.stderr @@ -2,70 +2,124 @@ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to --> tests/ui/ref_option_ref.rs:10:23 | LL | static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD); - | ^^^^^^^^^^^^^ help: try: `Option<&i32>` + | ^^^^^^^^^^^^^ | = note: `-D clippy::ref-option-ref` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ref_option_ref)]` +help: try + | +LL | static REF_THRESHOLD: Option<&i32> = &Some(&THRESHOLD); + | ~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:14:18 | LL | const REF_CONST: &Option<&i32> = &Some(CONST_THRESHOLD); - | ^^^^^^^^^^^^^ help: try: `Option<&i32>` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | const REF_CONST: Option<&i32> = &Some(CONST_THRESHOLD); + | ~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:17:25 | LL | type RefOptRefU32<'a> = &'a Option<&'a u32>; - | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | type RefOptRefU32<'a> = Option<&'a u32>; + | ~~~~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:19:25 | LL | type RefOptRef<'a, T> = &'a Option<&'a T>; - | ^^^^^^^^^^^^^^^^^ help: try: `Option<&'a T>` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | type RefOptRef<'a, T> = Option<&'a T>; + | ~~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:22:14 | LL | fn foo(data: &Option<&u32>) {} - | ^^^^^^^^^^^^^ help: try: `Option<&u32>` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | fn foo(data: Option<&u32>) {} + | ~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:25:23 | LL | fn bar(data: &u32) -> &Option<&u32> { - | ^^^^^^^^^^^^^ help: try: `Option<&u32>` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | fn bar(data: &u32) -> Option<&u32> { + | ~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:31:11 | LL | data: &'a Option<&'a u32>, - | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | data: Option<&'a u32>, + | ~~~~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:35:32 | LL | struct StructTupleRef<'a>(u32, &'a Option<&'a u32>); - | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | struct StructTupleRef<'a>(u32, Option<&'a u32>); + | ~~~~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:40:14 | LL | Variant2(&'a Option<&'a u32>), - | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Variant2(Option<&'a u32>), + | ~~~~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:50:14 | LL | type A = &'static Option<&'static Self>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'static Self>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | type A = Option<&'static Self>; + | ~~~~~~~~~~~~~~~~~~~~~ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` --> tests/ui/ref_option_ref.rs:57:12 | LL | let x: &Option<&u32> = &None; - | ^^^^^^^^^^^^^ help: try: `Option<&u32>` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let x: Option<&u32> = &None; + | ~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index 777ac20153da3..1b1503e2668a3 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -2,352 +2,641 @@ error: lint `clippy::almost_complete_letter_range` has been renamed to `clippy:: --> tests/ui/rename.rs:56:9 | LL | #![warn(clippy::almost_complete_letter_range)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::almost_complete_range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D renamed-and-removed-lints` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(renamed_and_removed_lints)]` +help: use the new name + | +LL | #![warn(clippy::almost_complete_range)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::blacklisted_name` has been renamed to `clippy::disallowed_names` --> tests/ui/rename.rs:57:9 | LL | #![warn(clippy::blacklisted_name)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_names` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::disallowed_names)] + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::block_in_if_condition_expr` has been renamed to `clippy::blocks_in_conditions` --> tests/ui/rename.rs:58:9 | LL | #![warn(clippy::block_in_if_condition_expr)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_conditions` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::blocks_in_conditions)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::block_in_if_condition_stmt` has been renamed to `clippy::blocks_in_conditions` --> tests/ui/rename.rs:59:9 | LL | #![warn(clippy::block_in_if_condition_stmt)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_conditions` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::blocks_in_conditions)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::blocks_in_if_conditions` has been renamed to `clippy::blocks_in_conditions` --> tests/ui/rename.rs:60:9 | LL | #![warn(clippy::blocks_in_if_conditions)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_conditions` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::blocks_in_conditions)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::box_vec` has been renamed to `clippy::box_collection` --> tests/ui/rename.rs:61:9 | LL | #![warn(clippy::box_vec)] - | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::box_collection` + | ^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::box_collection)] + | ~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redundant_static_lifetimes` --> tests/ui/rename.rs:62:9 | LL | #![warn(clippy::const_static_lifetime)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::redundant_static_lifetimes)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity` --> tests/ui/rename.rs:63:9 | LL | #![warn(clippy::cyclomatic_complexity)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::cognitive_complexity)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::derive_hash_xor_eq` has been renamed to `clippy::derived_hash_with_manual_eq` --> tests/ui/rename.rs:64:9 | LL | #![warn(clippy::derive_hash_xor_eq)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::derived_hash_with_manual_eq` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::derived_hash_with_manual_eq)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::disallowed_method` has been renamed to `clippy::disallowed_methods` --> tests/ui/rename.rs:65:9 | LL | #![warn(clippy::disallowed_method)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_methods` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::disallowed_methods)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::disallowed_type` has been renamed to `clippy::disallowed_types` --> tests/ui/rename.rs:66:9 | LL | #![warn(clippy::disallowed_type)] - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_types` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::disallowed_types)] + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::eval_order_dependence` has been renamed to `clippy::mixed_read_write_in_expression` --> tests/ui/rename.rs:67:9 | LL | #![warn(clippy::eval_order_dependence)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::mixed_read_write_in_expression` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::mixed_read_write_in_expression)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::identity_conversion` has been renamed to `clippy::useless_conversion` --> tests/ui/rename.rs:68:9 | LL | #![warn(clippy::identity_conversion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::useless_conversion` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::useless_conversion)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::if_let_some_result` has been renamed to `clippy::match_result_ok` --> tests/ui/rename.rs:69:9 | LL | #![warn(clippy::if_let_some_result)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::match_result_ok` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::match_result_ok)] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::incorrect_clone_impl_on_copy_type` has been renamed to `clippy::non_canonical_clone_impl` --> tests/ui/rename.rs:70:9 | LL | #![warn(clippy::incorrect_clone_impl_on_copy_type)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::non_canonical_clone_impl` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::non_canonical_clone_impl)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::incorrect_partial_ord_impl_on_ord_type` has been renamed to `clippy::non_canonical_partial_ord_impl` --> tests/ui/rename.rs:71:9 | LL | #![warn(clippy::incorrect_partial_ord_impl_on_ord_type)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::non_canonical_partial_ord_impl` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::non_canonical_partial_ord_impl)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::integer_arithmetic` has been renamed to `clippy::arithmetic_side_effects` --> tests/ui/rename.rs:72:9 | LL | #![warn(clippy::integer_arithmetic)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::arithmetic_side_effects` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::arithmetic_side_effects)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::logic_bug` has been renamed to `clippy::overly_complex_bool_expr` --> tests/ui/rename.rs:73:9 | LL | #![warn(clippy::logic_bug)] - | ^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::overly_complex_bool_expr` + | ^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::overly_complex_bool_expr)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::new_without_default_derive` has been renamed to `clippy::new_without_default` --> tests/ui/rename.rs:74:9 | LL | #![warn(clippy::new_without_default_derive)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::new_without_default)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::option_and_then_some` has been renamed to `clippy::bind_instead_of_map` --> tests/ui/rename.rs:75:9 | LL | #![warn(clippy::option_and_then_some)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::bind_instead_of_map` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::bind_instead_of_map)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::option_expect_used` has been renamed to `clippy::expect_used` --> tests/ui/rename.rs:76:9 | LL | #![warn(clippy::option_expect_used)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::expect_used)] + | ~~~~~~~~~~~~~~~~~~~ error: lint `clippy::option_map_unwrap_or` has been renamed to `clippy::map_unwrap_or` --> tests/ui/rename.rs:77:9 | LL | #![warn(clippy::option_map_unwrap_or)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::map_unwrap_or)] + | ~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::option_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or` --> tests/ui/rename.rs:78:9 | LL | #![warn(clippy::option_map_unwrap_or_else)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::map_unwrap_or)] + | ~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::option_unwrap_used` has been renamed to `clippy::unwrap_used` --> tests/ui/rename.rs:79:9 | LL | #![warn(clippy::option_unwrap_used)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::unwrap_used)] + | ~~~~~~~~~~~~~~~~~~~ error: lint `clippy::ref_in_deref` has been renamed to `clippy::needless_borrow` --> tests/ui/rename.rs:80:9 | LL | #![warn(clippy::ref_in_deref)] - | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::needless_borrow` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::needless_borrow)] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::result_expect_used` has been renamed to `clippy::expect_used` --> tests/ui/rename.rs:81:9 | LL | #![warn(clippy::result_expect_used)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::expect_used)] + | ~~~~~~~~~~~~~~~~~~~ error: lint `clippy::result_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or` --> tests/ui/rename.rs:82:9 | LL | #![warn(clippy::result_map_unwrap_or_else)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::map_unwrap_or)] + | ~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::result_unwrap_used` has been renamed to `clippy::unwrap_used` --> tests/ui/rename.rs:83:9 | LL | #![warn(clippy::result_unwrap_used)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::unwrap_used)] + | ~~~~~~~~~~~~~~~~~~~ error: lint `clippy::single_char_push_str` has been renamed to `clippy::single_char_add_str` --> tests/ui/rename.rs:84:9 | LL | #![warn(clippy::single_char_push_str)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::single_char_add_str` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::single_char_add_str)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions` --> tests/ui/rename.rs:85:9 | LL | #![warn(clippy::stutter)] - | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions` + | ^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::module_name_repetitions)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::to_string_in_display` has been renamed to `clippy::recursive_format_impl` --> tests/ui/rename.rs:86:9 | LL | #![warn(clippy::to_string_in_display)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::recursive_format_impl` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::recursive_format_impl)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::unwrap_or_else_default` has been renamed to `clippy::unwrap_or_default` --> tests/ui/rename.rs:87:9 | LL | #![warn(clippy::unwrap_or_else_default)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_or_default` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::unwrap_or_default)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::zero_width_space` has been renamed to `clippy::invisible_characters` --> tests/ui/rename.rs:88:9 | LL | #![warn(clippy::zero_width_space)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::invisible_characters` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(clippy::invisible_characters)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::cast_ref_to_mut` has been renamed to `invalid_reference_casting` --> tests/ui/rename.rs:89:9 | LL | #![warn(clippy::cast_ref_to_mut)] - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_reference_casting` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(invalid_reference_casting)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::clone_double_ref` has been renamed to `suspicious_double_ref_op` --> tests/ui/rename.rs:90:9 | LL | #![warn(clippy::clone_double_ref)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `suspicious_double_ref_op` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(suspicious_double_ref_op)] + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::cmp_nan` has been renamed to `invalid_nan_comparisons` --> tests/ui/rename.rs:91:9 | LL | #![warn(clippy::cmp_nan)] - | ^^^^^^^^^^^^^^^ help: use the new name: `invalid_nan_comparisons` + | ^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(invalid_nan_comparisons)] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::drop_bounds` has been renamed to `drop_bounds` --> tests/ui/rename.rs:92:9 | LL | #![warn(clippy::drop_bounds)] - | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds` + | ^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(drop_bounds)] + | ~~~~~~~~~~~ error: lint `clippy::drop_copy` has been renamed to `dropping_copy_types` --> tests/ui/rename.rs:93:9 | LL | #![warn(clippy::drop_copy)] - | ^^^^^^^^^^^^^^^^^ help: use the new name: `dropping_copy_types` + | ^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(dropping_copy_types)] + | ~~~~~~~~~~~~~~~~~~~ error: lint `clippy::drop_ref` has been renamed to `dropping_references` --> tests/ui/rename.rs:94:9 | LL | #![warn(clippy::drop_ref)] - | ^^^^^^^^^^^^^^^^ help: use the new name: `dropping_references` + | ^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(dropping_references)] + | ~~~~~~~~~~~~~~~~~~~ error: lint `clippy::fn_null_check` has been renamed to `useless_ptr_null_checks` --> tests/ui/rename.rs:95:9 | LL | #![warn(clippy::fn_null_check)] - | ^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `useless_ptr_null_checks` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(useless_ptr_null_checks)] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles` --> tests/ui/rename.rs:96:9 | LL | #![warn(clippy::for_loop_over_option)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(for_loops_over_fallibles)] + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::for_loop_over_result` has been renamed to `for_loops_over_fallibles` --> tests/ui/rename.rs:97:9 | LL | #![warn(clippy::for_loop_over_result)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(for_loops_over_fallibles)] + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_over_fallibles` --> tests/ui/rename.rs:98:9 | LL | #![warn(clippy::for_loops_over_fallibles)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(for_loops_over_fallibles)] + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::forget_copy` has been renamed to `forgetting_copy_types` --> tests/ui/rename.rs:99:9 | LL | #![warn(clippy::forget_copy)] - | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_copy_types` + | ^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(forgetting_copy_types)] + | ~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::forget_ref` has been renamed to `forgetting_references` --> tests/ui/rename.rs:100:9 | LL | #![warn(clippy::forget_ref)] - | ^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_references` + | ^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(forgetting_references)] + | ~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter` --> tests/ui/rename.rs:101:9 | LL | #![warn(clippy::into_iter_on_array)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `array_into_iter` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(array_into_iter)] + | ~~~~~~~~~~~~~~~ error: lint `clippy::invalid_atomic_ordering` has been renamed to `invalid_atomic_ordering` --> tests/ui/rename.rs:102:9 | LL | #![warn(clippy::invalid_atomic_ordering)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_atomic_ordering` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(invalid_atomic_ordering)] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::invalid_ref` has been renamed to `invalid_value` --> tests/ui/rename.rs:103:9 | LL | #![warn(clippy::invalid_ref)] - | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_value` + | ^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(invalid_value)] + | ~~~~~~~~~~~~~ error: lint `clippy::invalid_utf8_in_unchecked` has been renamed to `invalid_from_utf8_unchecked` --> tests/ui/rename.rs:104:9 | LL | #![warn(clippy::invalid_utf8_in_unchecked)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_from_utf8_unchecked` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(invalid_from_utf8_unchecked)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop` --> tests/ui/rename.rs:105:9 | LL | #![warn(clippy::let_underscore_drop)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(let_underscore_drop)] + | ~~~~~~~~~~~~~~~~~~~ error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums` --> tests/ui/rename.rs:106:9 | LL | #![warn(clippy::mem_discriminant_non_enum)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(enum_intrinsics_non_enums)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::panic_params` has been renamed to `non_fmt_panics` --> tests/ui/rename.rs:107:9 | LL | #![warn(clippy::panic_params)] - | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panics` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(non_fmt_panics)] + | ~~~~~~~~~~~~~~ error: lint `clippy::positional_named_format_parameters` has been renamed to `named_arguments_used_positionally` --> tests/ui/rename.rs:108:9 | LL | #![warn(clippy::positional_named_format_parameters)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `named_arguments_used_positionally` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(named_arguments_used_positionally)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `temporary_cstring_as_ptr` --> tests/ui/rename.rs:109:9 | LL | #![warn(clippy::temporary_cstring_as_ptr)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `temporary_cstring_as_ptr` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(temporary_cstring_as_ptr)] + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::undropped_manually_drops` has been renamed to `undropped_manually_drops` --> tests/ui/rename.rs:110:9 | LL | #![warn(clippy::undropped_manually_drops)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `undropped_manually_drops` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(undropped_manually_drops)] + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints` --> tests/ui/rename.rs:111:9 | LL | #![warn(clippy::unknown_clippy_lints)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(unknown_lints)] + | ~~~~~~~~~~~~~ error: lint `clippy::unused_label` has been renamed to `unused_labels` --> tests/ui/rename.rs:112:9 | LL | #![warn(clippy::unused_label)] - | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(unused_labels)] + | ~~~~~~~~~~~~~ error: lint `clippy::vtable_address_comparisons` has been renamed to `ambiguous_wide_pointer_comparisons` --> tests/ui/rename.rs:113:9 | LL | #![warn(clippy::vtable_address_comparisons)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `ambiguous_wide_pointer_comparisons` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![warn(ambiguous_wide_pointer_comparisons)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 58 previous errors diff --git a/src/tools/clippy/tests/ui/renamed_builtin_attr.stderr b/src/tools/clippy/tests/ui/renamed_builtin_attr.stderr index fb51313dab69a..2637181ee950e 100644 --- a/src/tools/clippy/tests/ui/renamed_builtin_attr.stderr +++ b/src/tools/clippy/tests/ui/renamed_builtin_attr.stderr @@ -2,7 +2,12 @@ error: usage of deprecated attribute --> tests/ui/renamed_builtin_attr.rs:3:11 | LL | #[clippy::cyclomatic_complexity = "1"] - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `cognitive_complexity` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | #[clippy::cognitive_complexity = "1"] + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/repeat_once.stderr b/src/tools/clippy/tests/ui/repeat_once.stderr index 6996dc5eee7d3..9e83ddcb3ab56 100644 --- a/src/tools/clippy/tests/ui/repeat_once.stderr +++ b/src/tools/clippy/tests/ui/repeat_once.stderr @@ -2,40 +2,69 @@ error: calling `repeat(1)` on slice --> tests/ui/repeat_once.rs:9:13 | LL | let a = [1; 5].repeat(1); - | ^^^^^^^^^^^^^^^^ help: consider using `.to_vec()` instead: `[1; 5].to_vec()` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::repeat-once` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::repeat_once)]` +help: consider using `.to_vec()` instead + | +LL | let a = [1; 5].to_vec(); + | ~~~~~~~~~~~~~~~ error: calling `repeat(1)` on slice --> tests/ui/repeat_once.rs:10:13 | LL | let b = slice.repeat(1); - | ^^^^^^^^^^^^^^^ help: consider using `.to_vec()` instead: `slice.to_vec()` + | ^^^^^^^^^^^^^^^ + | +help: consider using `.to_vec()` instead + | +LL | let b = slice.to_vec(); + | ~~~~~~~~~~~~~~ error: calling `repeat(1)` on str --> tests/ui/repeat_once.rs:11:13 | LL | let c = "hello".repeat(N); - | ^^^^^^^^^^^^^^^^^ help: consider using `.to_string()` instead: `"hello".to_string()` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` instead + | +LL | let c = "hello".to_string(); + | ~~~~~~~~~~~~~~~~~~~ error: calling `repeat(1)` on str --> tests/ui/repeat_once.rs:12:13 | LL | let d = "hi".repeat(1); - | ^^^^^^^^^^^^^^ help: consider using `.to_string()` instead: `"hi".to_string()` + | ^^^^^^^^^^^^^^ + | +help: consider using `.to_string()` instead + | +LL | let d = "hi".to_string(); + | ~~~~~~~~~~~~~~~~ error: calling `repeat(1)` on str --> tests/ui/repeat_once.rs:13:13 | LL | let e = s.repeat(1); - | ^^^^^^^^^^^ help: consider using `.to_string()` instead: `s.to_string()` + | ^^^^^^^^^^^ + | +help: consider using `.to_string()` instead + | +LL | let e = s.to_string(); + | ~~~~~~~~~~~~~ error: calling `repeat(1)` on a string literal --> tests/ui/repeat_once.rs:14:13 | LL | let f = string.repeat(1); - | ^^^^^^^^^^^^^^^^ help: consider using `.clone()` instead: `string.clone()` + | ^^^^^^^^^^^^^^^^ + | +help: consider using `.clone()` instead + | +LL | let f = string.clone(); + | ~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/repl_uninit.stderr b/src/tools/clippy/tests/ui/repl_uninit.stderr index 645c4a16a07eb..668cc9339fb39 100644 --- a/src/tools/clippy/tests/ui/repl_uninit.stderr +++ b/src/tools/clippy/tests/ui/repl_uninit.stderr @@ -2,16 +2,25 @@ error: replacing with `mem::uninitialized()` --> tests/ui/repl_uninit.rs:15:23 | LL | let taken_v = mem::replace(&mut v, mem::uninitialized()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::ptr::read(&mut v)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::mem-replace-with-uninit` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::mem_replace_with_uninit)]` +help: consider using + | +LL | let taken_v = std::ptr::read(&mut v); + | ~~~~~~~~~~~~~~~~~~~~~~ error: replacing with `mem::MaybeUninit::uninit().assume_init()` --> tests/ui/repl_uninit.rs:23:23 | LL | let taken_v = mem::replace(&mut v, mem::MaybeUninit::uninit().assume_init()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::ptr::read(&mut v)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let taken_v = std::ptr::read(&mut v); + | ~~~~~~~~~~~~~~~~~~~~~~ error: replacing with `mem::zeroed()` --> tests/ui/repl_uninit.rs:30:23 @@ -25,7 +34,12 @@ error: replacing with `mem::uninitialized()` --> tests/ui/repl_uninit.rs:43:28 | LL | let taken_u = unsafe { mem::replace(uref, mem::uninitialized()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::ptr::read(uref)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let taken_u = unsafe { std::ptr::read(uref) }; + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/reserve_after_initialization.stderr b/src/tools/clippy/tests/ui/reserve_after_initialization.stderr index b6dbebb3f14c2..2a4047e5dbd03 100644 --- a/src/tools/clippy/tests/ui/reserve_after_initialization.stderr +++ b/src/tools/clippy/tests/ui/reserve_after_initialization.stderr @@ -3,24 +3,38 @@ error: call to `reserve` immediately after creation | LL | / let mut v1: Vec = vec![]; LL | | v1.reserve(10); - | |___________________^ help: consider using `Vec::with_capacity(/* Space hint */)`: `let mut v1: Vec = Vec::with_capacity(10);` + | |___________________^ | = note: `-D clippy::reserve-after-initialization` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::reserve_after_initialization)]` +help: consider using `Vec::with_capacity(/* Space hint */)` + | +LL | let mut v1: Vec = Vec::with_capacity(10); + | error: call to `reserve` immediately after creation --> tests/ui/reserve_after_initialization.rs:17:5 | LL | / let mut v2: Vec = vec![]; LL | | v2.reserve(capacity); - | |_________________________^ help: consider using `Vec::with_capacity(/* Space hint */)`: `let mut v2: Vec = Vec::with_capacity(capacity);` + | |_________________________^ + | +help: consider using `Vec::with_capacity(/* Space hint */)` + | +LL | let mut v2: Vec = Vec::with_capacity(capacity); + | error: call to `reserve` immediately after creation --> tests/ui/reserve_after_initialization.rs:35:5 | LL | / v5 = Vec::new(); LL | | v5.reserve(10); - | |___________________^ help: consider using `Vec::with_capacity(/* Space hint */)`: `v5 = Vec::with_capacity(10);` + | |___________________^ + | +help: consider using `Vec::with_capacity(/* Space hint */)` + | +LL | v5 = Vec::with_capacity(10); + | error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/result_filter_map.stderr b/src/tools/clippy/tests/ui/result_filter_map.stderr index 12eb7083b5a82..b370f2b4431c0 100644 --- a/src/tools/clippy/tests/ui/result_filter_map.stderr +++ b/src/tools/clippy/tests/ui/result_filter_map.stderr @@ -5,10 +5,14 @@ LL | .filter(Result::is_ok) | __________^ LL | | LL | | .map(Result::unwrap); - | |____________________________^ help: consider using `flatten` instead: `flatten()` + | |____________________________^ | = note: `-D clippy::result-filter-map` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::result_filter_map)]` +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: `filter` for `Ok` followed by `unwrap` --> tests/ui/result_filter_map.rs:19:10 @@ -17,7 +21,12 @@ LL | .filter(|o| o.is_ok()) | __________^ LL | | LL | | .map(|o| o.unwrap()); - | |____________________________^ help: consider using `flatten` instead: `flatten()` + | |____________________________^ + | +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: `filter` for `Ok` followed by `unwrap` --> tests/ui/result_filter_map.rs:26:10 @@ -26,7 +35,12 @@ LL | .filter(Result::is_ok) | __________^ LL | | LL | | .map(Result::unwrap); - | |____________________________^ help: consider using `flatten` instead: `flatten()` + | |____________________________^ + | +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: `filter` for `Ok` followed by `unwrap` --> tests/ui/result_filter_map.rs:32:10 @@ -35,7 +49,12 @@ LL | .filter(|o| o.is_ok()) | __________^ LL | | LL | | .map(|o| o.unwrap()); - | |____________________________^ help: consider using `flatten` instead: `flatten()` + | |____________________________^ + | +help: consider using `flatten` instead + | +LL | .flatten(); + | ~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/result_map_or_into_option.stderr b/src/tools/clippy/tests/ui/result_map_or_into_option.stderr index 4cb510d77a060..4ae2ae3f9a228 100644 --- a/src/tools/clippy/tests/ui/result_map_or_into_option.stderr +++ b/src/tools/clippy/tests/ui/result_map_or_into_option.stderr @@ -2,22 +2,36 @@ error: called `map_or(None, Some)` on a `Result` value --> tests/ui/result_map_or_into_option.rs:5:13 | LL | let _ = opt.map_or(None, Some); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using `ok`: `opt.ok()` + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::result-map-or-into-option` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::result_map_or_into_option)]` +help: consider using `ok` + | +LL | let _ = opt.ok(); + | ~~~~~~~~ error: called `map_or_else(|_| None, Some)` on a `Result` value --> tests/ui/result_map_or_into_option.rs:7:13 | LL | let _ = opt.map_or_else(|_| None, Some); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `ok`: `opt.ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `ok` + | +LL | let _ = opt.ok(); + | ~~~~~~~~ error: called `map_or_else(|_| None, Some)` on a `Result` value --> tests/ui/result_map_or_into_option.rs:10:13 | LL | let _ = opt.map_or_else(|_| { None }, Some); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `ok`: `opt.ok()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `ok` + | +LL | let _ = opt.ok(); + | ~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/result_map_unit_fn_fixable.stderr b/src/tools/clippy/tests/ui/result_map_unit_fn_fixable.stderr index 4f3bc2e954495..cd54eb5fb5153 100644 --- a/src/tools/clippy/tests/ui/result_map_unit_fn_fixable.stderr +++ b/src/tools/clippy/tests/ui/result_map_unit_fn_fixable.stderr @@ -2,148 +2,201 @@ error: called `map(f)` on an `Result` value where `f` is a function that returns --> tests/ui/result_map_unit_fn_fixable.rs:34:5 | LL | x.field.map(do_nothing); - | ^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(x_field) = x.field { do_nothing(x_field) }` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::result-map-unit-fn` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::result_map_unit_fn)]` +help: try + | +LL | if let Ok(x_field) = x.field { do_nothing(x_field) } + | error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:36:5 | LL | x.field.map(do_nothing); - | ^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(x_field) = x.field { do_nothing(x_field) }` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(x_field) = x.field { do_nothing(x_field) } + | error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:38:5 | LL | x.field.map(diverge); - | ^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(x_field) = x.field { diverge(x_field) }` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(x_field) = x.field { diverge(x_field) } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:44:5 | LL | x.field.map(|value| x.do_result_nothing(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { x.do_result_nothing(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { x.do_result_nothing(value + captured) } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:46:5 | LL | x.field.map(|value| { x.do_result_plus_one(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { x.do_result_plus_one(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 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 closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:49:5 | LL | x.field.map(|value| do_nothing(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { do_nothing(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { do_nothing(value + captured) } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:51:5 | LL | x.field.map(|value| { do_nothing(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { do_nothing(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { do_nothing(value + captured) } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:53:5 | LL | x.field.map(|value| { do_nothing(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { do_nothing(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { do_nothing(value + captured); } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:55:5 | LL | x.field.map(|value| { { do_nothing(value + captured); } }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { do_nothing(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { do_nothing(value + captured); } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:58:5 | LL | x.field.map(|value| diverge(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { diverge(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { diverge(value + captured) } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:60:5 | LL | x.field.map(|value| { diverge(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { diverge(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { diverge(value + captured) } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:62:5 | LL | x.field.map(|value| { diverge(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { diverge(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { diverge(value + captured); } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:64:5 | LL | x.field.map(|value| { { diverge(value + captured); } }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { diverge(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { diverge(value + captured); } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:69:5 | LL | x.field.map(|value| { let y = plus_one(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { let y = plus_one(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { let y = plus_one(value + captured); } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:71:5 | LL | x.field.map(|value| { plus_one(value + captured); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { plus_one(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { plus_one(value + captured); } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:73:5 | LL | x.field.map(|value| { { plus_one(value + captured); } }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { plus_one(value + captured); }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { plus_one(value + captured); } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:76:5 | LL | x.field.map(|ref value| { do_nothing(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(ref value) = x.field { do_nothing(value + captured) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(ref value) = x.field { do_nothing(value + captured) } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_fixable.rs:78:5 | LL | x.field.map(|value| println!("{:?}", value)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { println!("{:?}", value) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { println!("{:?}", value) } + | error: aborting due to 18 previous errors diff --git a/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr b/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr index d69c86c70e291..5bba02e4f3e58 100644 --- a/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr +++ b/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr @@ -2,56 +2,73 @@ error: called `map(f)` on an `Result` value where `f` is a closure that returns --> tests/ui/result_map_unit_fn_unfixable.rs:23:5 | LL | x.field.map(|value| { do_nothing(value); do_nothing(value) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { ... }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::result-map-unit-fn` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::result_map_unit_fn)]` +help: try + | +LL | if let Ok(value) = x.field { ... } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_unfixable.rs:27:5 | LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { ... }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { ... } + | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_unfixable.rs:32:5 | -LL | // x.field.map(|value| { -LL | || -LL | || do_nothing(value); -LL | || do_nothing(value) -LL | || }); - | ||______^- help: try: `if let Ok(value) = x.field { ... }` - | |______| +LL | / x.field.map(|value| { +LL | | +LL | | do_nothing(value); +LL | | do_nothing(value) +LL | | }); + | |______^ + | +help: try + | +LL | if let Ok(value) = x.field { ... } | error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()` --> tests/ui/result_map_unit_fn_unfixable.rs:37:5 | LL | x.field.map(|value| { do_nothing(value); do_nothing(value); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(value) = x.field { ... }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(value) = x.field { ... } + | error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type `()` --> tests/ui/result_map_unit_fn_unfixable.rs:42:5 | LL | "12".parse::().map(diverge); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(a) = "12".parse::() { diverge(a) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(a) = "12".parse::() { diverge(a) } + | error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type `()` --> tests/ui/result_map_unit_fn_unfixable.rs:49:5 | LL | y.map(do_nothing); - | ^^^^^^^^^^^^^^^^^- - | | - | help: try: `if let Ok(_y) = y { do_nothing(_y) }` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | if let Ok(_y) = y { do_nothing(_y) } + | error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/search_is_some.stderr b/src/tools/clippy/tests/ui/search_is_some.stderr index b5ef553417701..9a114470f366a 100644 --- a/src/tools/clippy/tests/ui/search_is_some.stderr +++ b/src/tools/clippy/tests/ui/search_is_some.stderr @@ -40,7 +40,12 @@ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some.rs:43:20 | LL | let _ = (0..1).find(some_closure).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(some_closure)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (0..1).any(some_closure); + | ~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some.rs:53:13 @@ -82,7 +87,12 @@ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some.rs:80:13 | LL | let _ = (0..1).find(some_closure).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(0..1).any(some_closure)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !(0..1).any(some_closure); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/search_is_some_fixable_none.stderr b/src/tools/clippy/tests/ui/search_is_some_fixable_none.stderr index 2c858b9fb10ef..0a7a566162375 100644 --- a/src/tools/clippy/tests/ui/search_is_some_fixable_none.stderr +++ b/src/tools/clippy/tests/ui/search_is_some_fixable_none.stderr @@ -2,52 +2,91 @@ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:9:13 | LL | let _ = v.iter().find(|&x| *x < 0).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x < 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::search-is-some` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::search_is_some)]` +help: consider using + | +LL | let _ = !v.iter().any(|x| *x < 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:10:13 | LL | let _ = (0..1).find(|x| **y == *x).is_none(); // one dereference less - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(0..1).any(|x| **y == x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !(0..1).any(|x| **y == x); // one dereference less + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:11:13 | LL | let _ = (0..1).find(|x| *x == 0).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(0..1).any(|x| x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !(0..1).any(|x| x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:12:13 | LL | let _ = v.iter().find(|x| **x == 0).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|x| *x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:13:13 | LL | let _ = (4..5).find(|x| *x == 1 || *x == 3 || *x == 5).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(4..5).any(|x| x == 1 || x == 3 || x == 5)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !(4..5).any(|x| x == 1 || x == 3 || x == 5); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:14:13 | LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(1..3).any(|x| [1, 2, 3].contains(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !(1..3).any(|x| [1, 2, 3].contains(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:15:13 | LL | let _ = (1..3).find(|x| *x == 0 || [1, 2, 3].contains(x)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(1..3).any(|x| x == 0 || [1, 2, 3].contains(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !(1..3).any(|x| x == 0 || [1, 2, 3].contains(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:16:13 | LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x) || *x == 0).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(1..3).any(|x| [1, 2, 3].contains(&x) || x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !(1..3).any(|x| [1, 2, 3].contains(&x) || x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:17:13 @@ -56,91 +95,166 @@ LL | let _ = (1..3) | _____________^ LL | | .find(|x| [1, 2, 3].contains(x) || *x == 0 || [4, 5, 6].contains(x) || *x == -1) LL | | .is_none(); - | |__________________^ help: consider using: `!(1..3).any(|x| [1, 2, 3].contains(&x) || x == 0 || [4, 5, 6].contains(&x) || x == -1)` + | |__________________^ + | +help: consider using + | +LL | let _ = !(1..3).any(|x| [1, 2, 3].contains(&x) || x == 0 || [4, 5, 6].contains(&x) || x == -1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `position` --> tests/ui/search_is_some_fixable_none.rs:22:13 | LL | let _ = v.iter().position(|&x| x < 0).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|&x| x < 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|&x| x < 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `rposition` --> tests/ui/search_is_some_fixable_none.rs:25:13 | LL | let _ = v.iter().rposition(|&x| x < 0).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|&x| x < 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|&x| x < 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:31:13 | LL | let _ = "hello world".find("world").is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!"hello world".contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !"hello world".contains("world"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:32:13 | LL | let _ = "hello world".find(&s2).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!"hello world".contains(&s2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !"hello world".contains(&s2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:33:13 | LL | let _ = "hello world".find(&s2[2..]).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!"hello world".contains(&s2[2..])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !"hello world".contains(&s2[2..]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:35:13 | LL | let _ = s1.find("world").is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1.contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !s1.contains("world"); + | ~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:36:13 | LL | let _ = s1.find(&s2).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1.contains(&s2)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !s1.contains(&s2); + | ~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:37:13 | LL | let _ = s1.find(&s2[2..]).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1.contains(&s2[2..])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !s1.contains(&s2[2..]); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:39:13 | LL | let _ = s1[2..].find("world").is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1[2..].contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !s1[2..].contains("world"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:40:13 | LL | let _ = s1[2..].find(&s2).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1[2..].contains(&s2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !s1[2..].contains(&s2); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:41:13 | LL | let _ = s1[2..].find(&s2[2..]).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1[2..].contains(&s2[2..])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !s1[2..].contains(&s2[2..]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:57:25 | LL | .filter(|c| filter_hand.iter().find(|cc| c == cc).is_none()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!filter_hand.iter().any(|cc| c == &cc)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | .filter(|c| !filter_hand.iter().any(|cc| c == &cc)) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:73:30 | LL | .filter(|(c, _)| filter_hand.iter().find(|cc| c == *cc).is_none()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!filter_hand.iter().any(|cc| c == cc)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | .filter(|(c, _)| !filter_hand.iter().any(|cc| c == cc)) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:84:17 | LL | let _ = vfoo.iter().find(|v| v.foo == 1 && v.bar == 2).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|v| v.foo == 1 && v.bar == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !vfoo.iter().any(|v| v.foo == 1 && v.bar == 2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:87:17 @@ -162,49 +276,89 @@ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:95:17 | LL | let _ = vfoo.iter().find(|a| a[0] == 42).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|a| a[0] == 42)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !vfoo.iter().any(|a| a[0] == 42); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:101:17 | LL | let _ = vfoo.iter().find(|sub| sub[1..4].len() == 3).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|sub| sub[1..4].len() == 3)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !vfoo.iter().any(|sub| sub[1..4].len() == 3); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:119:17 | LL | let _ = [ppx].iter().find(|ppp_x: &&&u32| please(**ppp_x)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![ppx].iter().any(|ppp_x: &&u32| please(ppp_x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = ![ppx].iter().any(|ppp_x: &&u32| please(ppp_x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:120:17 | LL | let _ = [String::from("Hey hey")].iter().find(|s| s.len() == 2).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![String::from("Hey hey")].iter().any(|s| s.len() == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = ![String::from("Hey hey")].iter().any(|s| s.len() == 2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:123:17 | LL | let _ = v.iter().find(|x| deref_enough(**x)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| deref_enough(*x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|x| deref_enough(*x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:124:17 | LL | let _ = v.iter().find(|x: &&u32| deref_enough(**x)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x: &u32| deref_enough(*x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|x: &u32| deref_enough(*x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:127:17 | LL | let _ = v.iter().find(|x| arg_no_deref(x)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| arg_no_deref(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|x| arg_no_deref(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:129:17 | LL | let _ = v.iter().find(|x: &&u32| arg_no_deref(x)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x: &u32| arg_no_deref(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|x: &u32| arg_no_deref(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:149:17 @@ -226,133 +380,243 @@ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:165:17 | LL | let _ = vfoo.iter().find(|v| v.inner[0].bar == 2).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|v| v.inner[0].bar == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !vfoo.iter().any(|v| v.inner[0].bar == 2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:170:17 | LL | let _ = vfoo.iter().find(|x| (**x)[0] == 9).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|x| (**x)[0] == 9)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !vfoo.iter().any(|x| (**x)[0] == 9); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:183:17 | LL | let _ = vfoo.iter().find(|v| v.by_ref(&v.bar)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|v| v.by_ref(&v.bar))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !vfoo.iter().any(|v| v.by_ref(&v.bar)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:187:17 | LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|(&x, y)| x == *y).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![&(&1, 2), &(&3, 4), &(&5, 4)].iter().any(|(&x, y)| x == *y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = ![&(&1, 2), &(&3, 4), &(&5, 4)].iter().any(|(&x, y)| x == *y); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:188:17 | LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|&(&x, y)| x == *y).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![&(&1, 2), &(&3, 4), &(&5, 4)].iter().any(|(&x, y)| x == *y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = ![&(&1, 2), &(&3, 4), &(&5, 4)].iter().any(|(&x, y)| x == *y); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:207:17 | LL | let _ = v.iter().find(|s| s[0].is_empty()).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|s| s[0].is_empty())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|s| s[0].is_empty()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:208:17 | LL | let _ = v.iter().find(|s| test_string_1(&s[0])).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|s| test_string_1(&s[0]))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|s| test_string_1(&s[0])); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:217:17 | LL | let _ = v.iter().find(|fp| fp.field.is_power_of_two()).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|fp| fp.field.is_power_of_two())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|fp| fp.field.is_power_of_two()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:218:17 | LL | let _ = v.iter().find(|fp| test_u32_1(fp.field)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|fp| test_u32_1(fp.field))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|fp| test_u32_1(fp.field)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:219:17 | LL | let _ = v.iter().find(|fp| test_u32_2(*fp.field)).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|fp| test_u32_2(*fp.field))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|fp| test_u32_2(*fp.field)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:235:17 | LL | let _ = v.iter().find(|x| **x == 42).is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x == 42)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !v.iter().any(|x| *x == 42); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:236:17 | LL | Foo.bar(v.iter().find(|x| **x == 42).is_none()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x == 42)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | Foo.bar(!v.iter().any(|x| *x == 42)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:241:9 | LL | v.iter().find(|x| **x == 42).is_none().then(computations); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!v.iter().any(|x| *x == 42))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | (!v.iter().any(|x| *x == 42)).then(computations); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_none.rs:246:9 | LL | v.iter().find(|x| **x == 42).is_none().then_some(0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!v.iter().any(|x| *x == 42))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | (!v.iter().any(|x| *x == 42)).then_some(0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:251:17 | LL | let _ = s.find("world").is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s.contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !s.contains("world"); + | ~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:252:17 | LL | Foo.bar(s.find("world").is_none()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s.contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | Foo.bar(!s.contains("world")); + | ~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:254:17 | LL | let _ = s.find("world").is_none(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s.contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = !s.contains("world"); + | ~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:255:17 | LL | Foo.bar(s.find("world").is_none()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s.contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | Foo.bar(!s.contains("world")); + | ~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:260:17 | LL | let _ = s.find("world").is_none().then(computations); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!s.contains("world"))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (!s.contains("world")).then(computations); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:262:17 | LL | let _ = s.find("world").is_none().then(computations); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!s.contains("world"))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (!s.contains("world")).then(computations); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:267:17 | LL | let _ = s.find("world").is_none().then_some(0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!s.contains("world"))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (!s.contains("world")).then_some(0); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `is_none()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_none.rs:269:17 | LL | let _ = s.find("world").is_none().then_some(0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!s.contains("world"))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (!s.contains("world")).then_some(0); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 55 previous errors diff --git a/src/tools/clippy/tests/ui/search_is_some_fixable_some.stderr b/src/tools/clippy/tests/ui/search_is_some_fixable_some.stderr index af1de7f82f80c..ab748ce98e424 100644 --- a/src/tools/clippy/tests/ui/search_is_some_fixable_some.stderr +++ b/src/tools/clippy/tests/ui/search_is_some_fixable_some.stderr @@ -2,52 +2,91 @@ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:9:22 | LL | let _ = v.iter().find(|&x| *x < 0).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| *x < 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::search-is-some` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::search_is_some)]` +help: consider using + | +LL | let _ = v.iter().any(|x| *x < 0); + | ~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:10:20 | LL | let _ = (0..1).find(|x| **y == *x).is_some(); // one dereference less - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| **y == x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (0..1).any(|x| **y == x); // one dereference less + | ~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:11:20 | LL | let _ = (0..1).find(|x| *x == 0).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (0..1).any(|x| x == 0); + | ~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:12:22 | LL | let _ = v.iter().find(|x| **x == 0).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| *x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|x| *x == 0); + | ~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:13:20 | LL | let _ = (4..5).find(|x| *x == 1 || *x == 3 || *x == 5).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| x == 1 || x == 3 || x == 5)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (4..5).any(|x| x == 1 || x == 3 || x == 5); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:14:20 | LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| [1, 2, 3].contains(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (1..3).any(|x| [1, 2, 3].contains(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:15:20 | LL | let _ = (1..3).find(|x| *x == 0 || [1, 2, 3].contains(x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| x == 0 || [1, 2, 3].contains(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (1..3).any(|x| x == 0 || [1, 2, 3].contains(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:16:20 | LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x) || *x == 0).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| [1, 2, 3].contains(&x) || x == 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = (1..3).any(|x| [1, 2, 3].contains(&x) || x == 0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:18:10 @@ -55,91 +94,166 @@ error: called `is_some()` after searching an `Iterator` with `find` LL | .find(|x| [1, 2, 3].contains(x) || *x == 0 || [4, 5, 6].contains(x) || *x == -1) | __________^ LL | | .is_some(); - | |__________________^ help: consider using: `any(|x| [1, 2, 3].contains(&x) || x == 0 || [4, 5, 6].contains(&x) || x == -1)` + | |__________________^ + | +help: consider using + | +LL | .any(|x| [1, 2, 3].contains(&x) || x == 0 || [4, 5, 6].contains(&x) || x == -1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `position` --> tests/ui/search_is_some_fixable_some.rs:22:22 | LL | let _ = v.iter().position(|&x| x < 0).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|&x| x < 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|&x| x < 0); + | ~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `rposition` --> tests/ui/search_is_some_fixable_some.rs:25:22 | LL | let _ = v.iter().rposition(|&x| x < 0).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|&x| x < 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|&x| x < 0); + | ~~~~~~~~~~~~~~~ error: called `is_some()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_some.rs:30:27 | LL | let _ = "hello world".find("world").is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = "hello world".contains("world"); + | ~~~~~~~~~~~~~~~~~ error: called `is_some()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_some.rs:31:27 | LL | let _ = "hello world".find(&s2).is_some(); - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = "hello world".contains(&s2); + | ~~~~~~~~~~~~~ error: called `is_some()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_some.rs:32:27 | LL | let _ = "hello world".find(&s2[2..]).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2[2..])` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = "hello world".contains(&s2[2..]); + | ~~~~~~~~~~~~~~~~~~ error: called `is_some()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_some.rs:34:16 | LL | let _ = s1.find("world").is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = s1.contains("world"); + | ~~~~~~~~~~~~~~~~~ error: called `is_some()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_some.rs:35:16 | LL | let _ = s1.find(&s2).is_some(); - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = s1.contains(&s2); + | ~~~~~~~~~~~~~ error: called `is_some()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_some.rs:36:16 | LL | let _ = s1.find(&s2[2..]).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2[2..])` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = s1.contains(&s2[2..]); + | ~~~~~~~~~~~~~~~~~~ error: called `is_some()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_some.rs:38:21 | LL | let _ = s1[2..].find("world").is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains("world")` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = s1[2..].contains("world"); + | ~~~~~~~~~~~~~~~~~ error: called `is_some()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_some.rs:39:21 | LL | let _ = s1[2..].find(&s2).is_some(); - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2)` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = s1[2..].contains(&s2); + | ~~~~~~~~~~~~~ error: called `is_some()` after calling `find()` on a string --> tests/ui/search_is_some_fixable_some.rs:40:21 | LL | let _ = s1[2..].find(&s2[2..]).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2[2..])` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = s1[2..].contains(&s2[2..]); + | ~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:56:44 | LL | .filter(|c| filter_hand.iter().find(|cc| c == cc).is_some()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|cc| c == &cc)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | .filter(|c| filter_hand.iter().any(|cc| c == &cc)) + | ~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:72:49 | LL | .filter(|(c, _)| filter_hand.iter().find(|cc| c == *cc).is_some()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|cc| c == cc)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | .filter(|(c, _)| filter_hand.iter().any(|cc| c == cc)) + | ~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:83:29 | LL | let _ = vfoo.iter().find(|v| v.foo == 1 && v.bar == 2).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|v| v.foo == 1 && v.bar == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = vfoo.iter().any(|v| v.foo == 1 && v.bar == 2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:88:14 @@ -147,55 +261,100 @@ error: called `is_some()` after searching an `Iterator` with `find` LL | .find(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2) | ______________^ LL | | .is_some(); - | |______________________^ help: consider using: `any(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2)` + | |______________________^ + | +help: consider using + | +LL | .any(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:94:29 | LL | let _ = vfoo.iter().find(|a| a[0] == 42).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|a| a[0] == 42)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = vfoo.iter().any(|a| a[0] == 42); + | ~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:100:29 | LL | let _ = vfoo.iter().find(|sub| sub[1..4].len() == 3).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|sub| sub[1..4].len() == 3)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = vfoo.iter().any(|sub| sub[1..4].len() == 3); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:118:30 | LL | let _ = [ppx].iter().find(|ppp_x: &&&u32| please(**ppp_x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|ppp_x: &&u32| please(ppp_x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = [ppx].iter().any(|ppp_x: &&u32| please(ppp_x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:119:50 | LL | let _ = [String::from("Hey hey")].iter().find(|s| s.len() == 2).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|s| s.len() == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = [String::from("Hey hey")].iter().any(|s| s.len() == 2); + | ~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:122:26 | LL | let _ = v.iter().find(|x| deref_enough(**x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| deref_enough(*x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|x| deref_enough(*x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:123:26 | LL | let _ = v.iter().find(|x: &&u32| deref_enough(**x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| deref_enough(*x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|x: &u32| deref_enough(*x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:126:26 | LL | let _ = v.iter().find(|x| arg_no_deref(x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| arg_no_deref(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|x| arg_no_deref(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:128:26 | LL | let _ = v.iter().find(|x: &&u32| arg_no_deref(x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| arg_no_deref(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|x: &u32| arg_no_deref(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:150:14 @@ -203,91 +362,166 @@ error: called `is_some()` after searching an `Iterator` with `find` LL | .find(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] == 2) | ______________^ LL | | .is_some(); - | |______________________^ help: consider using: `any(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] == 2)` + | |______________________^ + | +help: consider using + | +LL | .any(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] == 2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:164:29 | LL | let _ = vfoo.iter().find(|v| v.inner[0].bar == 2).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|v| v.inner[0].bar == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = vfoo.iter().any(|v| v.inner[0].bar == 2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:169:29 | LL | let _ = vfoo.iter().find(|x| (**x)[0] == 9).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| (**x)[0] == 9)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = vfoo.iter().any(|x| (**x)[0] == 9); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:182:29 | LL | let _ = vfoo.iter().find(|v| v.by_ref(&v.bar)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|v| v.by_ref(&v.bar))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = vfoo.iter().any(|v| v.by_ref(&v.bar)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:186:55 | LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|(&x, y)| x == *y).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|(&x, y)| x == *y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().any(|(&x, y)| x == *y); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:187:55 | LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|&(&x, y)| x == *y).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|(&x, y)| x == *y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().any(|(&x, y)| x == *y); + | ~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:206:26 | LL | let _ = v.iter().find(|s| s[0].is_empty()).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|s| s[0].is_empty())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|s| s[0].is_empty()); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:207:26 | LL | let _ = v.iter().find(|s| test_string_1(&s[0])).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|s| test_string_1(&s[0]))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|s| test_string_1(&s[0])); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:216:26 | LL | let _ = v.iter().find(|fp| fp.field.is_power_of_two()).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|fp| fp.field.is_power_of_two())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|fp| fp.field.is_power_of_two()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:217:26 | LL | let _ = v.iter().find(|fp| test_u32_1(fp.field)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|fp| test_u32_1(fp.field))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|fp| test_u32_1(fp.field)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:218:26 | LL | let _ = v.iter().find(|fp| test_u32_2(*fp.field)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|fp| test_u32_2(*fp.field))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|fp| test_u32_2(*fp.field)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:233:18 | LL | v.iter().find(|x: &&u32| func(x)).is_some() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| func(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | v.iter().any(|x: &u32| func(&x)) + | ~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:242:26 | LL | let _ = v.iter().find(|x: &&u32| arg_no_deref_impl(x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| arg_no_deref_impl(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|x: &u32| arg_no_deref_impl(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:245:26 | LL | let _ = v.iter().find(|x: &&u32| arg_no_deref_dyn(x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| arg_no_deref_dyn(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|x: &u32| arg_no_deref_dyn(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: called `is_some()` after searching an `Iterator` with `find` --> tests/ui/search_is_some_fixable_some.rs:248:26 | LL | let _ = v.iter().find(|x: &&u32| (*arg_no_deref_dyn)(x)).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| (*arg_no_deref_dyn)(&x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = v.iter().any(|x: &u32| (*arg_no_deref_dyn)(&x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 47 previous errors diff --git a/src/tools/clippy/tests/ui/seek_from_current.stderr b/src/tools/clippy/tests/ui/seek_from_current.stderr index 23ba9968bfffa..ebb4b23b6f9bf 100644 --- a/src/tools/clippy/tests/ui/seek_from_current.stderr +++ b/src/tools/clippy/tests/ui/seek_from_current.stderr @@ -2,10 +2,14 @@ error: using `SeekFrom::Current` to start from current position --> tests/ui/seek_from_current.rs:19:5 | LL | f.seek(SeekFrom::Current(0))?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `f.stream_position()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::seek-from-current` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::seek_from_current)]` +help: replace with + | +LL | f.stream_position()?; + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/seek_to_start_instead_of_rewind.stderr b/src/tools/clippy/tests/ui/seek_to_start_instead_of_rewind.stderr index 2c3c45820e107..51957a4111c61 100644 --- a/src/tools/clippy/tests/ui/seek_to_start_instead_of_rewind.stderr +++ b/src/tools/clippy/tests/ui/seek_to_start_instead_of_rewind.stderr @@ -2,22 +2,36 @@ error: used `seek` to go to the start of the stream --> tests/ui/seek_to_start_instead_of_rewind.rs:52:7 | LL | t.seek(SeekFrom::Start(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::seek-to-start-instead-of-rewind` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::seek_to_start_instead_of_rewind)]` +help: replace with + | +LL | t.rewind(); + | ~~~~~~~~ error: used `seek` to go to the start of the stream --> tests/ui/seek_to_start_instead_of_rewind.rs:57:7 | LL | t.seek(SeekFrom::Start(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | t.rewind(); + | ~~~~~~~~ error: used `seek` to go to the start of the stream --> tests/ui/seek_to_start_instead_of_rewind.rs:136:7 | LL | f.seek(SeekFrom::Start(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | f.rewind(); + | ~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/semicolon_if_nothing_returned.stderr b/src/tools/clippy/tests/ui/semicolon_if_nothing_returned.stderr index 69e434b142cf4..96391f00a4217 100644 --- a/src/tools/clippy/tests/ui/semicolon_if_nothing_returned.stderr +++ b/src/tools/clippy/tests/ui/semicolon_if_nothing_returned.stderr @@ -2,34 +2,58 @@ error: consider adding a `;` to the last statement for consistent formatting --> tests/ui/semicolon_if_nothing_returned.rs:18:5 | LL | println!("Hello") - | ^^^^^^^^^^^^^^^^^ help: add a `;` here: `println!("Hello");` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::semicolon_if_nothing_returned)]` +help: add a `;` here + | +LL | println!("Hello"); + | error: consider adding a `;` to the last statement for consistent formatting --> tests/ui/semicolon_if_nothing_returned.rs:22:5 | LL | get_unit() - | ^^^^^^^^^^ help: add a `;` here: `get_unit();` + | ^^^^^^^^^^ + | +help: add a `;` here + | +LL | get_unit(); + | error: consider adding a `;` to the last statement for consistent formatting --> tests/ui/semicolon_if_nothing_returned.rs:27:5 | LL | y = x + 1 - | ^^^^^^^^^ help: add a `;` here: `y = x + 1;` + | ^^^^^^^^^ + | +help: add a `;` here + | +LL | y = x + 1; + | error: consider adding a `;` to the last statement for consistent formatting --> tests/ui/semicolon_if_nothing_returned.rs:33:9 | LL | hello() - | ^^^^^^^ help: add a `;` here: `hello();` + | ^^^^^^^ + | +help: add a `;` here + | +LL | hello(); + | error: consider adding a `;` to the last statement for consistent formatting --> tests/ui/semicolon_if_nothing_returned.rs:44:9 | LL | ptr::drop_in_place(s.as_mut_ptr()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `ptr::drop_in_place(s.as_mut_ptr());` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `;` here + | +LL | ptr::drop_in_place(s.as_mut_ptr()); + | error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/short_circuit_statement.stderr b/src/tools/clippy/tests/ui/short_circuit_statement.stderr index e7a8f2ca60ca1..4e2b29af1ec06 100644 --- a/src/tools/clippy/tests/ui/short_circuit_statement.stderr +++ b/src/tools/clippy/tests/ui/short_circuit_statement.stderr @@ -2,22 +2,36 @@ error: boolean short circuit operator in statement may be clearer using an expli --> tests/ui/short_circuit_statement.rs:5:5 | LL | f() && g(); - | ^^^^^^^^^^^ help: replace it with: `if f() { g(); }` + | ^^^^^^^^^^^ | = note: `-D clippy::short-circuit-statement` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::short_circuit_statement)]` +help: replace it with + | +LL | if f() { g(); } + | error: boolean short circuit operator in statement may be clearer using an explicit test --> tests/ui/short_circuit_statement.rs:6:5 | LL | f() || g(); - | ^^^^^^^^^^^ help: replace it with: `if !f() { g(); }` + | ^^^^^^^^^^^ + | +help: replace it with + | +LL | if !f() { g(); } + | error: boolean short circuit operator in statement may be clearer using an explicit test --> tests/ui/short_circuit_statement.rs:7:5 | LL | 1 == 2 || g(); - | ^^^^^^^^^^^^^^ help: replace it with: `if 1 != 2 { g(); }` + | ^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | if 1 != 2 { g(); } + | error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/should_panic_without_expect.stderr b/src/tools/clippy/tests/ui/should_panic_without_expect.stderr index 0b841b23848e7..1f11d842fbb2b 100644 --- a/src/tools/clippy/tests/ui/should_panic_without_expect.stderr +++ b/src/tools/clippy/tests/ui/should_panic_without_expect.stderr @@ -2,13 +2,17 @@ error: #[should_panic] attribute without a reason --> tests/ui/should_panic_without_expect.rs:5:1 | LL | #[should_panic] - | ^^^^^^^^^^^^^^^ help: consider specifying the expected panic: `#[should_panic(expected = /* panic message */)]` + | ^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/should_panic_without_expect.rs:2:9 | LL | #![deny(clippy::should_panic_without_expect)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider specifying the expected panic + | +LL | #[should_panic(expected = /* panic message */)] + | error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/single_char_add_str.stderr b/src/tools/clippy/tests/ui/single_char_add_str.stderr index 7791c67578aa2..ea695e524acc3 100644 --- a/src/tools/clippy/tests/ui/single_char_add_str.stderr +++ b/src/tools/clippy/tests/ui/single_char_add_str.stderr @@ -2,130 +2,234 @@ error: calling `push_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:14:5 | LL | string.push_str("R"); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('R')` + | ^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::single-char-add-str` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::single_char_add_str)]` +help: consider using `push` with a character literal + | +LL | string.push('R'); + | ~~~~~~~~~~~~~~~~ error: calling `push_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:15:5 | LL | string.push_str("'"); - | ^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\'')` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `push` with a character literal + | +LL | string.push('\''); + | ~~~~~~~~~~~~~~~~~ error: calling `push_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:20:5 | LL | string.push_str("\x52"); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\x52')` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `push` with a character literal + | +LL | string.push('\x52'); + | ~~~~~~~~~~~~~~~~~~~ error: calling `push_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:21:5 | LL | string.push_str("\u{0052}"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\u{0052}')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `push` with a character literal + | +LL | string.push('\u{0052}'); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: calling `push_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:22:5 | LL | string.push_str(r##"a"##); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('a')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `push` with a character literal + | +LL | string.push('a'); + | ~~~~~~~~~~~~~~~~ error: calling `push_str()` using a single-character converted to string --> tests/ui/single_char_add_str.rs:25:5 | LL | string.push_str(&c_ref.to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` without `to_string()`: `string.push(*c_ref)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `push` without `to_string()` + | +LL | string.push(*c_ref); + | ~~~~~~~~~~~~~~~~~~~ error: calling `push_str()` using a single-character converted to string --> tests/ui/single_char_add_str.rs:27:5 | LL | string.push_str(&c.to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` without `to_string()`: `string.push(c)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `push` without `to_string()` + | +LL | string.push(c); + | ~~~~~~~~~~~~~~ error: calling `push_str()` using a single-character converted to string --> tests/ui/single_char_add_str.rs:28:5 | LL | string.push_str(&'a'.to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` without `to_string()`: `string.push('a')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `push` without `to_string()` + | +LL | string.push('a'); + | ~~~~~~~~~~~~~~~~ error: calling `push_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:30:5 | LL | get_string!().push_str("ö"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `get_string!().push('ö')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `push` with a character literal + | +LL | get_string!().push('ö'); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:35:5 | LL | string.insert_str(0, "R"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, 'R')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` with a character literal + | +LL | string.insert(0, 'R'); + | ~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:36:5 | LL | string.insert_str(1, "'"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(1, '\'')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` with a character literal + | +LL | string.insert(1, '\''); + | ~~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:41:5 | LL | string.insert_str(0, "\x52"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '\x52')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` with a character literal + | +LL | string.insert(0, '\x52'); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:42:5 | LL | string.insert_str(0, "\u{0052}"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '\u{0052}')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` with a character literal + | +LL | string.insert(0, '\u{0052}'); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:44:5 | LL | string.insert_str(x, r##"a"##); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(x, 'a')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` with a character literal + | +LL | string.insert(x, 'a'); + | ~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:46:5 | LL | string.insert_str(Y, r##"a"##); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, 'a')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` with a character literal + | +LL | string.insert(Y, 'a'); + | ~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:47:5 | LL | string.insert_str(Y, r##"""##); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, '"')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` with a character literal + | +LL | string.insert(Y, '"'); + | ~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:48:5 | LL | string.insert_str(Y, r##"'"##); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, '\'')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` with a character literal + | +LL | string.insert(Y, '\''); + | ~~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character converted to string --> tests/ui/single_char_add_str.rs:50:5 | LL | string.insert_str(0, &c_ref.to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` without `to_string()`: `string.insert(0, *c_ref)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` without `to_string()` + | +LL | string.insert(0, *c_ref); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character converted to string --> tests/ui/single_char_add_str.rs:51:5 | LL | string.insert_str(0, &c.to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` without `to_string()`: `string.insert(0, c)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` without `to_string()` + | +LL | string.insert(0, c); + | ~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character converted to string --> tests/ui/single_char_add_str.rs:52:5 | LL | string.insert_str(0, &'a'.to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` without `to_string()`: `string.insert(0, 'a')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` without `to_string()` + | +LL | string.insert(0, 'a'); + | ~~~~~~~~~~~~~~~~~~~~~ error: calling `insert_str()` using a single-character string literal --> tests/ui/single_char_add_str.rs:54:5 | LL | get_string!().insert_str(1, "?"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `get_string!().insert(1, '?')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `insert` with a character literal + | +LL | get_string!().insert(1, '?'); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 21 previous errors diff --git a/src/tools/clippy/tests/ui/single_char_pattern.stderr b/src/tools/clippy/tests/ui/single_char_pattern.stderr index b2deed23cbd53..243218acd2c22 100644 --- a/src/tools/clippy/tests/ui/single_char_pattern.stderr +++ b/src/tools/clippy/tests/ui/single_char_pattern.stderr @@ -2,214 +2,388 @@ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:7:13 | LL | x.split("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ | = note: `-D clippy::single-char-pattern` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::single_char_pattern)]` +help: consider using a `char` + | +LL | x.split('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:18:23 | LL | x.split_inclusive("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.split_inclusive('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:19:16 | LL | x.contains("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.contains('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:20:19 | LL | x.starts_with("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.starts_with('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:21:17 | LL | x.ends_with("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.ends_with('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:22:12 | LL | x.find("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.find('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:23:13 | LL | x.rfind("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.rfind('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:24:14 | LL | x.rsplit("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.rsplit('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:25:24 | LL | x.split_terminator("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.split_terminator('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:26:25 | LL | x.rsplit_terminator("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.rsplit_terminator('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:27:17 | LL | x.splitn(2, "x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.splitn(2, 'x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:28:18 | LL | x.rsplitn(2, "x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.rsplitn(2, 'x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:29:18 | LL | x.split_once("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.split_once('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:30:19 | LL | x.rsplit_once("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.rsplit_once('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:31:15 | LL | x.matches("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.matches('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:32:16 | LL | x.rmatches("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.rmatches('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:33:21 | LL | x.match_indices("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.match_indices('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:34:22 | LL | x.rmatch_indices("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.rmatch_indices('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:35:26 | LL | x.trim_start_matches("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.trim_start_matches('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:36:24 | LL | x.trim_end_matches("x"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.trim_end_matches('x'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:37:15 | LL | x.replace("x", "y"); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.replace('x', "y"); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:38:16 | LL | x.replacen("x", "y", 3); - | ^^^ help: consider using a `char`: `'x'` + | ^^^ + | +help: consider using a `char` + | +LL | x.replacen('x', "y", 3); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:40:13 | LL | x.split("\n"); - | ^^^^ help: consider using a `char`: `'\n'` + | ^^^^ + | +help: consider using a `char` + | +LL | x.split('\n'); + | ~~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:41:13 | LL | x.split("'"); - | ^^^ help: consider using a `char`: `'\''` + | ^^^ + | +help: consider using a `char` + | +LL | x.split('\''); + | ~~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:42:13 | LL | x.split("\'"); - | ^^^^ help: consider using a `char`: `'\''` + | ^^^^ + | +help: consider using a `char` + | +LL | x.split('\''); + | ~~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:44:13 | LL | x.split("\""); - | ^^^^ help: consider using a `char`: `'"'` + | ^^^^ + | +help: consider using a `char` + | +LL | x.split('"'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:49:31 | LL | x.replace(';', ",").split(","); // issue #2978 - | ^^^ help: consider using a `char`: `','` + | ^^^ + | +help: consider using a `char` + | +LL | x.replace(';', ",").split(','); // issue #2978 + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:50:19 | LL | x.starts_with("\x03"); // issue #2996 - | ^^^^^^ help: consider using a `char`: `'\x03'` + | ^^^^^^ + | +help: consider using a `char` + | +LL | x.starts_with('\x03'); // issue #2996 + | ~~~~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:57:13 | LL | x.split(r"a"); - | ^^^^ help: consider using a `char`: `'a'` + | ^^^^ + | +help: consider using a `char` + | +LL | x.split('a'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:58:13 | LL | x.split(r#"a"#); - | ^^^^^^ help: consider using a `char`: `'a'` + | ^^^^^^ + | +help: consider using a `char` + | +LL | x.split('a'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:59:13 | LL | x.split(r###"a"###); - | ^^^^^^^^^^ help: consider using a `char`: `'a'` + | ^^^^^^^^^^ + | +help: consider using a `char` + | +LL | x.split('a'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:60:13 | LL | x.split(r###"'"###); - | ^^^^^^^^^^ help: consider using a `char`: `'\''` + | ^^^^^^^^^^ + | +help: consider using a `char` + | +LL | x.split('\''); + | ~~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:61:13 | LL | x.split(r###"#"###); - | ^^^^^^^^^^ help: consider using a `char`: `'#'` + | ^^^^^^^^^^ + | +help: consider using a `char` + | +LL | x.split('#'); + | ~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:63:13 | LL | x.split(r#"\"#); - | ^^^^^^ help: consider using a `char`: `'\\'` + | ^^^^^^ + | +help: consider using a `char` + | +LL | x.split('\\'); + | ~~~~ error: single-character string constant used as pattern --> tests/ui/single_char_pattern.rs:64:13 | LL | x.split(r"\"); - | ^^^^ help: consider using a `char`: `'\\'` + | ^^^^ + | +help: consider using a `char` + | +LL | x.split('\\'); + | ~~~~ error: aborting due to 35 previous errors diff --git a/src/tools/clippy/tests/ui/single_component_path_imports.stderr b/src/tools/clippy/tests/ui/single_component_path_imports.stderr index 95d7e4d85b7c3..6f341a41370d9 100644 --- a/src/tools/clippy/tests/ui/single_component_path_imports.stderr +++ b/src/tools/clippy/tests/ui/single_component_path_imports.stderr @@ -2,16 +2,25 @@ error: this import is redundant --> tests/ui/single_component_path_imports.rs:6:1 | LL | use regex; - | ^^^^^^^^^^ help: remove it entirely + | ^^^^^^^^^^ | = note: `-D clippy::single-component-path-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::single_component_path_imports)]` +help: remove it entirely + | +LL - use regex; + | error: this import is redundant --> tests/ui/single_component_path_imports.rs:32:5 | LL | use regex; - | ^^^^^^^^^^ help: remove it entirely + | ^^^^^^^^^^ + | +help: remove it entirely + | +LL - use regex; + | error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/single_component_path_imports_nested_first.stderr b/src/tools/clippy/tests/ui/single_component_path_imports_nested_first.stderr index 8eec877860e7e..45025e6c861b5 100644 --- a/src/tools/clippy/tests/ui/single_component_path_imports_nested_first.stderr +++ b/src/tools/clippy/tests/ui/single_component_path_imports_nested_first.stderr @@ -2,10 +2,14 @@ error: this import is redundant --> tests/ui/single_component_path_imports_nested_first.rs:4:1 | LL | use regex; - | ^^^^^^^^^^ help: remove it entirely + | ^^^^^^^^^^ | = note: `-D clippy::single-component-path-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::single_component_path_imports)]` +help: remove it entirely + | +LL - use regex; + | error: this import is redundant --> tests/ui/single_component_path_imports_nested_first.rs:17:10 diff --git a/src/tools/clippy/tests/ui/single_element_loop.stderr b/src/tools/clippy/tests/ui/single_element_loop.stderr index dfae5605b5715..2bd1168eb7aec 100644 --- a/src/tools/clippy/tests/ui/single_element_loop.stderr +++ b/src/tools/clippy/tests/ui/single_element_loop.stderr @@ -36,25 +36,45 @@ error: this loops only once with `item` being `0..5` --> tests/ui/single_element_loop.rs:16:17 | LL | for item in &[0..5] { - | ^^^^^^^ help: did you mean to iterate over the range instead?: `0..5` + | ^^^^^^^ + | +help: did you mean to iterate over the range instead? + | +LL | for item in 0..5 { + | ~~~~ error: this loops only once with `item` being `0..5` --> tests/ui/single_element_loop.rs:20:17 | LL | for item in [0..5].iter_mut() { - | ^^^^^^^^^^^^^^^^^ help: did you mean to iterate over the range instead?: `0..5` + | ^^^^^^^^^^^^^^^^^ + | +help: did you mean to iterate over the range instead? + | +LL | for item in 0..5 { + | ~~~~ error: this loops only once with `item` being `0..5` --> tests/ui/single_element_loop.rs:24:17 | LL | for item in [0..5] { - | ^^^^^^ help: did you mean to iterate over the range instead?: `0..5` + | ^^^^^^ + | +help: did you mean to iterate over the range instead? + | +LL | for item in 0..5 { + | ~~~~ error: this loops only once with `item` being `0..5` --> tests/ui/single_element_loop.rs:28:17 | LL | for item in [0..5].into_iter() { - | ^^^^^^^^^^^^^^^^^^ help: did you mean to iterate over the range instead?: `0..5` + | ^^^^^^^^^^^^^^^^^^ + | +help: did you mean to iterate over the range instead? + | +LL | for item in 0..5 { + | ~~~~ error: for loop over a single element --> tests/ui/single_element_loop.rs:47:5 diff --git a/src/tools/clippy/tests/ui/single_match.stderr b/src/tools/clippy/tests/ui/single_match.stderr index a249c120ee4a4..e5a22da37492a 100644 --- a/src/tools/clippy/tests/ui/single_match.stderr +++ b/src/tools/clippy/tests/ui/single_match.stderr @@ -28,7 +28,12 @@ LL | | // is expanded before we can do anything. LL | | Some(y) => println!("{:?}", y), LL | | _ => (), LL | | } - | |_____^ help: try: `if let Some(y) = x { println!("{:?}", y) }` + | |_____^ + | +help: try + | +LL | if let Some(y) = x { println!("{:?}", y) } + | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> tests/ui/single_match.rs:32:5 @@ -37,7 +42,12 @@ LL | / match z { LL | | (2..=3, 7..=9) => dummy(), LL | | _ => {}, LL | | }; - | |_____^ help: try: `if let (2..=3, 7..=9) = z { dummy() }` + | |_____^ + | +help: try + | +LL | 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` --> tests/ui/single_match.rs:61:5 @@ -46,7 +56,12 @@ LL | / match x { LL | | Some(y) => dummy(), LL | | None => (), LL | | }; - | |_____^ help: try: `if let Some(y) = x { dummy() }` + | |_____^ + | +help: try + | +LL | if let Some(y) = x { dummy() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> tests/ui/single_match.rs:66:5 @@ -55,7 +70,12 @@ LL | / match y { LL | | Ok(y) => dummy(), LL | | Err(..) => (), LL | | }; - | |_____^ help: try: `if let Ok(y) = y { dummy() }` + | |_____^ + | +help: try + | +LL | if let Ok(y) = y { dummy() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> tests/ui/single_match.rs:73:5 @@ -64,7 +84,12 @@ LL | / match c { LL | | Cow::Borrowed(..) => dummy(), LL | | Cow::Owned(..) => (), LL | | }; - | |_____^ help: try: `if let Cow::Borrowed(..) = c { dummy() }` + | |_____^ + | +help: try + | +LL | if let Cow::Borrowed(..) = c { dummy() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to use `match` for an equality check. Consider using `if` --> tests/ui/single_match.rs:94:5 @@ -73,7 +98,12 @@ LL | / match x { LL | | "test" => println!(), LL | | _ => (), LL | | } - | |_____^ help: try: `if x == "test" { println!() }` + | |_____^ + | +help: try + | +LL | if x == "test" { println!() } + | error: you seem to be trying to use `match` for an equality check. Consider using `if` --> tests/ui/single_match.rs:107:5 @@ -82,7 +112,12 @@ LL | / match x { LL | | Foo::A => println!(), LL | | _ => (), LL | | } - | |_____^ help: try: `if x == Foo::A { println!() }` + | |_____^ + | +help: try + | +LL | if x == Foo::A { println!() } + | error: you seem to be trying to use `match` for an equality check. Consider using `if` --> tests/ui/single_match.rs:113:5 @@ -91,7 +126,12 @@ LL | / match x { LL | | FOO_C => println!(), LL | | _ => (), LL | | } - | |_____^ help: try: `if x == FOO_C { println!() }` + | |_____^ + | +help: try + | +LL | if x == FOO_C { println!() } + | error: you seem to be trying to use `match` for an equality check. Consider using `if` --> tests/ui/single_match.rs:118:5 @@ -100,7 +140,12 @@ LL | / match &&x { LL | | Foo::A => println!(), LL | | _ => (), LL | | } - | |_____^ help: try: `if x == Foo::A { println!() }` + | |_____^ + | +help: try + | +LL | if x == Foo::A { println!() } + | error: you seem to be trying to use `match` for an equality check. Consider using `if` --> tests/ui/single_match.rs:124:5 @@ -109,7 +154,12 @@ LL | / match &x { LL | | Foo::A => println!(), LL | | _ => (), LL | | } - | |_____^ help: try: `if x == &Foo::A { println!() }` + | |_____^ + | +help: try + | +LL | if x == &Foo::A { println!() } + | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> tests/ui/single_match.rs:141:5 @@ -118,7 +168,12 @@ LL | / match x { LL | | Bar::A => println!(), LL | | _ => (), LL | | } - | |_____^ help: try: `if let Bar::A = x { println!() }` + | |_____^ + | +help: try + | +LL | if let Bar::A = x { println!() } + | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> tests/ui/single_match.rs:149:5 @@ -127,7 +182,12 @@ LL | / match x { LL | | None => println!(), LL | | _ => (), LL | | }; - | |_____^ help: try: `if let None = x { println!() }` + | |_____^ + | +help: try + | +LL | if let None = x { println!() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> tests/ui/single_match.rs:171:5 @@ -136,7 +196,12 @@ LL | / match x { LL | | (Some(_), _) => {}, LL | | (None, _) => {}, LL | | } - | |_____^ help: try: `if let (Some(_), _) = x {}` + | |_____^ + | +help: try + | +LL | if let (Some(_), _) = x {} + | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> tests/ui/single_match.rs:177:5 @@ -145,7 +210,12 @@ LL | / match x { LL | | (Some(E::V), _) => todo!(), LL | | (_, _) => {}, LL | | } - | |_____^ help: try: `if let (Some(E::V), _) = x { todo!() }` + | |_____^ + | +help: try + | +LL | if let (Some(E::V), _) = x { todo!() } + | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> tests/ui/single_match.rs:183:5 @@ -154,7 +224,12 @@ LL | / match (Some(42), Some(E::V), Some(42)) { LL | | (.., Some(E::V), _) => {}, LL | | (..) => {}, LL | | } - | |_____^ help: try: `if let (.., Some(E::V), _) = (Some(42), Some(E::V), Some(42)) {}` + | |_____^ + | +help: try + | +LL | if let (.., Some(E::V), _) = (Some(42), Some(E::V), Some(42)) {} + | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> tests/ui/single_match.rs:255:5 diff --git a/src/tools/clippy/tests/ui/slow_vector_initialization.stderr b/src/tools/clippy/tests/ui/slow_vector_initialization.stderr index 353c677097be7..524c10a5a4370 100644 --- a/src/tools/clippy/tests/ui/slow_vector_initialization.stderr +++ b/src/tools/clippy/tests/ui/slow_vector_initialization.stderr @@ -1,109 +1,147 @@ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:14:5 | -LL | let mut vec1 = Vec::with_capacity(len); - | ----------------------- help: consider replacing this with: `vec![0; len]` LL | vec1.extend(repeat(0).take(len)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::slow-vector-initialization` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::slow_vector_initialization)]` +help: consider replacing this with + | +LL | let mut vec1 = vec![0; len]; + | ~~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:20:5 | -LL | let mut vec2 = Vec::with_capacity(len - 10); - | ---------------------------- help: consider replacing this with: `vec![0; len - 10]` LL | vec2.extend(repeat(0).take(len - 10)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | let mut vec2 = vec![0; len - 10]; + | ~~~~~~~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:28:5 | -LL | let mut vec4 = Vec::with_capacity(len); - | ----------------------- help: consider replacing this with: `vec![0; len]` LL | vec4.extend(repeat(0).take(vec4.capacity())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | let mut vec4 = vec![0; len]; + | ~~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:39:5 | -LL | let mut resized_vec = Vec::with_capacity(30); - | ---------------------- help: consider replacing this with: `vec![0; 30]` LL | resized_vec.resize(30, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | let mut resized_vec = vec![0; 30]; + | ~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:43:5 | -LL | let mut extend_vec = Vec::with_capacity(30); - | ---------------------- help: consider replacing this with: `vec![0; 30]` LL | extend_vec.extend(repeat(0).take(30)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | let mut extend_vec = vec![0; 30]; + | ~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:51:5 | -LL | let mut vec1 = Vec::with_capacity(len); - | ----------------------- help: consider replacing this with: `vec![0; len]` LL | vec1.resize(len, 0); | ^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | let mut vec1 = vec![0; len]; + | ~~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:60:5 | -LL | let mut vec3 = Vec::with_capacity(len - 10); - | ---------------------------- help: consider replacing this with: `vec![0; len - 10]` LL | vec3.resize(len - 10, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | let mut vec3 = vec![0; len - 10]; + | ~~~~~~~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:64:5 | -LL | let mut vec4 = Vec::with_capacity(len); - | ----------------------- help: consider replacing this with: `vec![0; len]` LL | vec4.resize(vec4.capacity(), 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | let mut vec4 = vec![0; len]; + | ~~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:69:5 | -LL | vec1 = Vec::with_capacity(10); - | ---------------------- help: consider replacing this with: `vec![0; 10]` LL | vec1.resize(10, 0); | ^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | vec1 = vec![0; 10]; + | ~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:77:5 | -LL | let mut vec1 = Vec::new(); - | ---------- help: consider replacing this with: `vec![0; len]` LL | vec1.resize(len, 0); | ^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | let mut vec1 = vec![0; len]; + | ~~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:82:5 | -LL | let mut vec3 = Vec::new(); - | ---------- help: consider replacing this with: `vec![0; len - 10]` LL | vec3.resize(len - 10, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | let mut vec3 = vec![0; len - 10]; + | ~~~~~~~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:87:5 | -LL | vec1 = Vec::new(); - | ---------- help: consider replacing this with: `vec![0; 10]` LL | vec1.resize(10, 0); | ^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | vec1 = vec![0; 10]; + | ~~~~~~~~~~~ error: slow zero-filling initialization --> tests/ui/slow_vector_initialization.rs:91:5 | -LL | vec1 = vec![]; - | ------ help: consider replacing this with: `vec![0; 10]` LL | vec1.resize(10, 0); | ^^^^^^^^^^^^^^^^^^ + | +help: consider replacing this with + | +LL | vec1 = vec![0; 10]; + | ~~~~~~~~~~~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/stable_sort_primitive.stderr b/src/tools/clippy/tests/ui/stable_sort_primitive.stderr index 66bd4c79bb286..bdc46af43d937 100644 --- a/src/tools/clippy/tests/ui/stable_sort_primitive.stderr +++ b/src/tools/clippy/tests/ui/stable_sort_primitive.stderr @@ -2,59 +2,87 @@ error: used `sort` on primitive type `i32` --> tests/ui/stable_sort_primitive.rs:7:5 | LL | vec.sort(); - | ^^^^^^^^^^ help: try: `vec.sort_unstable()` + | ^^^^^^^^^^ | = note: an unstable sort typically performs faster without any observable difference for this data type = note: `-D clippy::stable-sort-primitive` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::stable_sort_primitive)]` +help: try + | +LL | vec.sort_unstable(); + | ~~~~~~~~~~~~~~~~~~~ error: used `sort` on primitive type `bool` --> tests/ui/stable_sort_primitive.rs:9:5 | LL | vec.sort(); - | ^^^^^^^^^^ help: try: `vec.sort_unstable()` + | ^^^^^^^^^^ | = note: an unstable sort typically performs faster without any observable difference for this data type +help: try + | +LL | vec.sort_unstable(); + | ~~~~~~~~~~~~~~~~~~~ error: used `sort` on primitive type `char` --> tests/ui/stable_sort_primitive.rs:11:5 | LL | vec.sort(); - | ^^^^^^^^^^ help: try: `vec.sort_unstable()` + | ^^^^^^^^^^ | = note: an unstable sort typically performs faster without any observable difference for this data type +help: try + | +LL | vec.sort_unstable(); + | ~~~~~~~~~~~~~~~~~~~ error: used `sort` on primitive type `str` --> tests/ui/stable_sort_primitive.rs:13:5 | LL | vec.sort(); - | ^^^^^^^^^^ help: try: `vec.sort_unstable()` + | ^^^^^^^^^^ | = note: an unstable sort typically performs faster without any observable difference for this data type +help: try + | +LL | vec.sort_unstable(); + | ~~~~~~~~~~~~~~~~~~~ error: used `sort` on primitive type `tuple` --> tests/ui/stable_sort_primitive.rs:15:5 | LL | vec.sort(); - | ^^^^^^^^^^ help: try: `vec.sort_unstable()` + | ^^^^^^^^^^ | = note: an unstable sort typically performs faster without any observable difference for this data type +help: try + | +LL | vec.sort_unstable(); + | ~~~~~~~~~~~~~~~~~~~ error: used `sort` on primitive type `array` --> tests/ui/stable_sort_primitive.rs:17:5 | LL | vec.sort(); - | ^^^^^^^^^^ help: try: `vec.sort_unstable()` + | ^^^^^^^^^^ | = note: an unstable sort typically performs faster without any observable difference for this data type +help: try + | +LL | vec.sort_unstable(); + | ~~~~~~~~~~~~~~~~~~~ error: used `sort` on primitive type `i32` --> tests/ui/stable_sort_primitive.rs:19:5 | LL | arr.sort(); - | ^^^^^^^^^^ help: try: `arr.sort_unstable()` + | ^^^^^^^^^^ | = note: an unstable sort typically performs faster without any observable difference for this data type +help: try + | +LL | arr.sort_unstable(); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/starts_ends_with.stderr b/src/tools/clippy/tests/ui/starts_ends_with.stderr index cee31f1e4cdd3..dfb8c01531059 100644 --- a/src/tools/clippy/tests/ui/starts_ends_with.stderr +++ b/src/tools/clippy/tests/ui/starts_ends_with.stderr @@ -2,103 +2,181 @@ error: you should use the `starts_with` method --> tests/ui/starts_ends_with.rs:7:5 | LL | "".chars().next() == Some(' '); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with(' ')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::chars-next-cmp` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::chars_next_cmp)]` +help: like this + | +LL | "".starts_with(' '); + | ~~~~~~~~~~~~~~~~~~~ error: you should use the `starts_with` method --> tests/ui/starts_ends_with.rs:8:5 | LL | Some(' ') != "".chars().next(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with(' ')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | !"".starts_with(' '); + | ~~~~~~~~~~~~~~~~~~~~ error: you should use the `starts_with` method --> tests/ui/starts_ends_with.rs:11:5 | LL | "".chars().next() == Some('\n'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with('\n')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | "".starts_with('\n'); + | ~~~~~~~~~~~~~~~~~~~~ error: you should use the `starts_with` method --> tests/ui/starts_ends_with.rs:12:5 | LL | Some('\n') != "".chars().next(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with('\n')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | !"".starts_with('\n'); + | ~~~~~~~~~~~~~~~~~~~~~ error: you should use the `starts_with` method --> tests/ui/starts_ends_with.rs:17:8 | LL | if s.chars().next().unwrap() == 'f' { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.starts_with('f')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | if s.starts_with('f') { + | ~~~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:21:8 | LL | if s.chars().next_back().unwrap() == 'o' { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.ends_with('o')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::chars-last-cmp` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::chars_last_cmp)]` +help: like this + | +LL | if s.ends_with('o') { + | ~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:25:8 | LL | if s.chars().last().unwrap() == 'o' { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.ends_with('o')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | if s.ends_with('o') { + | ~~~~~~~~~~~~~~~~ error: you should use the `starts_with` method --> tests/ui/starts_ends_with.rs:29:8 | LL | if s.chars().next().unwrap() != 'f' { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.starts_with('f')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | if !s.starts_with('f') { + | ~~~~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:33:8 | LL | if s.chars().next_back().unwrap() != 'o' { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('o')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | if !s.ends_with('o') { + | ~~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:37:8 | LL | if s.chars().last().unwrap() != '\n' { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('\n')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | if !s.ends_with('\n') { + | ~~~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:45:5 | LL | "".chars().last() == Some(' '); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | "".ends_with(' '); + | ~~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:46:5 | LL | Some(' ') != "".chars().last(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with(' ')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | !"".ends_with(' '); + | ~~~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:47:5 | LL | "".chars().next_back() == Some(' '); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | "".ends_with(' '); + | ~~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:48:5 | LL | Some(' ') != "".chars().next_back(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with(' ')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | !"".ends_with(' '); + | ~~~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:51:5 | LL | "".chars().last() == Some('\n'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with('\n')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | "".ends_with('\n'); + | ~~~~~~~~~~~~~~~~~~ error: you should use the `ends_with` method --> tests/ui/starts_ends_with.rs:52:5 | LL | Some('\n') != "".chars().last(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with('\n')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: like this + | +LL | !"".ends_with('\n'); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/std_instead_of_core.stderr b/src/tools/clippy/tests/ui/std_instead_of_core.stderr index 22cb9db7050b8..22cfd0cde5017 100644 --- a/src/tools/clippy/tests/ui/std_instead_of_core.stderr +++ b/src/tools/clippy/tests/ui/std_instead_of_core.stderr @@ -2,88 +2,150 @@ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:14:9 | LL | use std::hash::Hasher; - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ | = note: `-D clippy::std-instead-of-core` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::std_instead_of_core)]` +help: consider importing the item from `core` + | +LL | use core::hash::Hasher; + | ~~~~ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:17:11 | LL | use ::std::hash::Hash; - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ + | +help: consider importing the item from `core` + | +LL | use ::core::hash::Hash; + | ~~~~ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:23:9 | LL | use std::fmt::{Debug, Result}; - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ + | +help: consider importing the item from `core` + | +LL | use core::fmt::{Debug, Result}; + | ~~~~ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:28:9 | LL | use std::{ - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ + | +help: consider importing the item from `core` + | +LL | use core::{ + | ~~~~ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:35:15 | LL | let ptr = std::ptr::null::(); - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ + | +help: consider importing the item from `core` + | +LL | let ptr = core::ptr::null::(); + | ~~~~ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:37:21 | LL | let ptr_mut = ::std::ptr::null_mut::(); - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ + | +help: consider importing the item from `core` + | +LL | let ptr_mut = ::core::ptr::null_mut::(); + | ~~~~ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:41:16 | LL | let cell = std::cell::Cell::new(8u32); - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ + | +help: consider importing the item from `core` + | +LL | let cell = core::cell::Cell::new(8u32); + | ~~~~ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:43:27 | LL | let cell_absolute = ::std::cell::Cell::new(8u32); - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ + | +help: consider importing the item from `core` + | +LL | let cell_absolute = ::core::cell::Cell::new(8u32); + | ~~~~ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:48:9 | LL | use std::error::Error; - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ + | +help: consider importing the item from `core` + | +LL | use core::error::Error; + | ~~~~ error: used import from `std` instead of `core` --> tests/ui/std_instead_of_core.rs:52:9 | LL | use std::iter::Iterator; - | ^^^ help: consider importing the item from `core`: `core` + | ^^^ + | +help: consider importing the item from `core` + | +LL | use core::iter::Iterator; + | ~~~~ error: used import from `std` instead of `alloc` --> tests/ui/std_instead_of_core.rs:59:9 | LL | use std::vec; - | ^^^ help: consider importing the item from `alloc`: `alloc` + | ^^^ | = note: `-D clippy::std-instead-of-alloc` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::std_instead_of_alloc)]` +help: consider importing the item from `alloc` + | +LL | use alloc::vec; + | ~~~~~ error: used import from `std` instead of `alloc` --> tests/ui/std_instead_of_core.rs:61:9 | LL | use std::vec::Vec; - | ^^^ help: consider importing the item from `alloc`: `alloc` + | ^^^ + | +help: consider importing the item from `alloc` + | +LL | use alloc::vec::Vec; + | ~~~~~ error: used import from `alloc` instead of `core` --> tests/ui/std_instead_of_core.rs:67:9 | LL | use alloc::slice::from_ref; - | ^^^^^ help: consider importing the item from `core`: `core` + | ^^^^^ | = note: `-D clippy::alloc-instead-of-core` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::alloc_instead_of_core)]` +help: consider importing the item from `core` + | +LL | use core::slice::from_ref; + | ~~~~ error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/str_split.stderr b/src/tools/clippy/tests/ui/str_split.stderr index ebe0d4ef4d301..f260faaad5956 100644 --- a/src/tools/clippy/tests/ui/str_split.stderr +++ b/src/tools/clippy/tests/ui/str_split.stderr @@ -2,64 +2,113 @@ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:59:13 | LL | let _ = s1.trim().split('\n'); - | ^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `s1.lines()` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::str-split-at-newline` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::str_split_at_newline)]` +help: use `str.lines()` instead + | +LL | let _ = s1.lines(); + | ~~~~~~~~~~ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:61:13 | LL | let _ = s1.trim().split("\n"); - | ^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `s1.lines()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `str.lines()` instead + | +LL | let _ = s1.lines(); + | ~~~~~~~~~~ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:62:13 | LL | let _ = s1.trim().split("\r\n"); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `s1.lines()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `str.lines()` instead + | +LL | let _ = s1.lines(); + | ~~~~~~~~~~ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:65:13 | LL | let _ = s2.trim().split('\n'); - | ^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `s2.lines()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `str.lines()` instead + | +LL | let _ = s2.lines(); + | ~~~~~~~~~~ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:67:13 | LL | let _ = s2.trim().split("\n"); - | ^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `s2.lines()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `str.lines()` instead + | +LL | let _ = s2.lines(); + | ~~~~~~~~~~ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:68:13 | LL | let _ = s2.trim().split("\r\n"); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `s2.lines()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `str.lines()` instead + | +LL | let _ = s2.lines(); + | ~~~~~~~~~~ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:72:13 | LL | let _ = s3.trim().split('\n'); - | ^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `s3.lines()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `str.lines()` instead + | +LL | let _ = s3.lines(); + | ~~~~~~~~~~ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:74:13 | LL | let _ = s3.trim().split("\n"); - | ^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `s3.lines()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `str.lines()` instead + | +LL | let _ = s3.lines(); + | ~~~~~~~~~~ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:75:13 | LL | let _ = s3.trim().split("\r\n"); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `s3.lines()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `str.lines()` instead + | +LL | let _ = s3.lines(); + | ~~~~~~~~~~ error: using `str.trim().split()` with hard-coded newlines --> tests/ui/str_split.rs:78:13 | LL | let _ = make_str!(s1).trim().split('\n'); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `str.lines()` instead: `make_str!(s1).lines()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `str.lines()` instead + | +LL | let _ = make_str!(s1).lines(); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/str_to_string.stderr b/src/tools/clippy/tests/ui/str_to_string.stderr index a761d96cd6b12..b483c1f0e42fb 100644 --- a/src/tools/clippy/tests/ui/str_to_string.stderr +++ b/src/tools/clippy/tests/ui/str_to_string.stderr @@ -2,16 +2,25 @@ error: `to_string()` called on a `&str` --> tests/ui/str_to_string.rs:4:17 | LL | let hello = "hello world".to_string(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"hello world".to_owned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::str-to-string` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::str_to_string)]` +help: try + | +LL | let hello = "hello world".to_owned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: `to_string()` called on a `&str` --> tests/ui/str_to_string.rs:7:5 | LL | msg.to_string(); - | ^^^^^^^^^^^^^^^ help: try: `msg.to_owned()` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | msg.to_owned(); + | ~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/string_add.stderr b/src/tools/clippy/tests/ui/string_add.stderr index fe6849b894b53..689e2c72a41bb 100644 --- a/src/tools/clippy/tests/ui/string_add.stderr +++ b/src/tools/clippy/tests/ui/string_add.stderr @@ -2,10 +2,14 @@ error: manual implementation of an assign operation --> tests/ui/string_add.rs:13:9 | LL | x = x + "."; - | ^^^^^^^^^^^ help: replace it with: `x += "."` + | ^^^^^^^^^^^ | = note: `-D clippy::assign-op-pattern` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::assign_op_pattern)]` +help: replace it with + | +LL | x += "."; + | ~~~~~~~~ error: you added something to a string. Consider using `String::push_str()` instead --> tests/ui/string_add.rs:13:13 @@ -26,7 +30,12 @@ error: manual implementation of an assign operation --> tests/ui/string_add.rs:22:5 | LL | x = x + 1; - | ^^^^^^^^^ help: replace it with: `x += 1` + | ^^^^^^^^^ + | +help: replace it with + | +LL | x += 1; + | ~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/string_add_assign.stderr b/src/tools/clippy/tests/ui/string_add_assign.stderr index 50f970084e6b2..39696195248d3 100644 --- a/src/tools/clippy/tests/ui/string_add_assign.stderr +++ b/src/tools/clippy/tests/ui/string_add_assign.stderr @@ -11,16 +11,25 @@ error: manual implementation of an assign operation --> tests/ui/string_add_assign.rs:8:9 | LL | x = x + "."; - | ^^^^^^^^^^^ help: replace it with: `x += "."` + | ^^^^^^^^^^^ | = note: `-D clippy::assign-op-pattern` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::assign_op_pattern)]` +help: replace it with + | +LL | x += "."; + | ~~~~~~~~ error: manual implementation of an assign operation --> tests/ui/string_add_assign.rs:17:5 | LL | x = x + 1; - | ^^^^^^^^^ help: replace it with: `x += 1` + | ^^^^^^^^^ + | +help: replace it with + | +LL | x += 1; + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/string_extend.stderr b/src/tools/clippy/tests/ui/string_extend.stderr index fadda786aacb6..6bd7f3501324c 100644 --- a/src/tools/clippy/tests/ui/string_extend.stderr +++ b/src/tools/clippy/tests/ui/string_extend.stderr @@ -2,28 +2,47 @@ error: calling `.extend(_.chars())` --> tests/ui/string_extend.rs:16:5 | LL | s.extend(abc.chars()); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `s.push_str(abc)` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::string-extend-chars` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::string_extend_chars)]` +help: try + | +LL | s.push_str(abc); + | ~~~~~~~~~~~~~~~ error: calling `.extend(_.chars())` --> tests/ui/string_extend.rs:19:5 | LL | s.extend("abc".chars()); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.push_str("abc")` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | s.push_str("abc"); + | ~~~~~~~~~~~~~~~~~ error: calling `.extend(_.chars())` --> tests/ui/string_extend.rs:22:5 | LL | s.extend(def.chars()); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `s.push_str(&def)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | s.push_str(&def); + | ~~~~~~~~~~~~~~~~ error: calling `.extend(_.chars())` --> tests/ui/string_extend.rs:32:5 | LL | s.extend(abc[0..2].chars()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.push_str(&abc[0..2])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | s.push_str(&abc[0..2]); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/string_from_utf8_as_bytes.stderr b/src/tools/clippy/tests/ui/string_from_utf8_as_bytes.stderr index 99c8d8ae4eabc..d1c069613e8a4 100644 --- a/src/tools/clippy/tests/ui/string_from_utf8_as_bytes.stderr +++ b/src/tools/clippy/tests/ui/string_from_utf8_as_bytes.stderr @@ -2,10 +2,14 @@ error: calling a slice of `as_bytes()` with `from_utf8` should be not necessary --> tests/ui/string_from_utf8_as_bytes.rs:4:13 | LL | let _ = std::str::from_utf8(&"Hello World!".as_bytes()[6..11]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(&"Hello World!"[6..11])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::string-from-utf8-as-bytes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::string_from_utf8_as_bytes)]` +help: try + | +LL | let _ = Some(&"Hello World!"[6..11]); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/string_lit_as_bytes.stderr b/src/tools/clippy/tests/ui/string_lit_as_bytes.stderr index 66b3e6f9462db..858fc706217e1 100644 --- a/src/tools/clippy/tests/ui/string_lit_as_bytes.stderr +++ b/src/tools/clippy/tests/ui/string_lit_as_bytes.stderr @@ -2,51 +2,84 @@ error: calling `as_bytes()` on a string literal --> tests/ui/string_lit_as_bytes.rs:16:14 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::string_lit_as_bytes)]` +help: consider using a byte string literal instead + | +LL | let bs = b"hello there"; + | ~~~~~~~~~~~~~~ error: calling `as_bytes()` on a string literal --> tests/ui/string_lit_as_bytes.rs:18:14 | LL | let bs = r###"raw string with 3# plus " ""###.as_bytes(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `br###"raw string with 3# plus " ""###` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a byte string literal instead + | +LL | let bs = br###"raw string with 3# plus " ""###; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `into_bytes()` on a string literal --> tests/ui/string_lit_as_bytes.rs:20:14 | LL | let bs = "lit to string".to_string().into_bytes(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"lit to string".to_vec()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a byte string literal instead + | +LL | let bs = b"lit to string".to_vec(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `into_bytes()` on a string literal --> tests/ui/string_lit_as_bytes.rs:21:14 | LL | let bs = "lit to owned".to_owned().into_bytes(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"lit to owned".to_vec()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a byte string literal instead + | +LL | let bs = b"lit to owned".to_vec(); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `as_bytes()` on a string literal --> tests/ui/string_lit_as_bytes.rs:11:26 | LL | const B: &[u8] = $b.as_bytes(); - | ^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"warning"` + | ^^^^^^^^^^^^^ ... LL | b!("warning"); | ------------- in this macro invocation | = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using a byte string literal instead + | +LL | const B: &[u8] = b"warning"; + | ~~~~~~~~~~ error: calling `as_bytes()` on `include_str!(..)` --> tests/ui/string_lit_as_bytes.rs:38:22 | LL | let includestr = include_str!("string_lit_as_bytes.rs").as_bytes(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `include_bytes!(..)` instead: `include_bytes!("string_lit_as_bytes.rs")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `include_bytes!(..)` instead + | +LL | let includestr = include_bytes!("string_lit_as_bytes.rs"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: calling `as_bytes()` on a string literal --> tests/ui/string_lit_as_bytes.rs:40:13 | LL | let _ = "string with newline\t\n".as_bytes(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"string with newline\t\n"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a byte string literal instead + | +LL | let _ = b"string with newline\t\n"; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr b/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr index 8c2a7692659c4..6e3d37abe9cb5 100644 --- a/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr +++ b/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr @@ -2,46 +2,80 @@ error: using `libc::strlen` on a `CString` or `CStr` value --> tests/ui/strlen_on_c_strings.rs:13:13 | LL | let _ = unsafe { libc::strlen(cstring.as_ptr()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cstring.as_bytes().len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::strlen-on-c-strings` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::strlen_on_c_strings)]` +help: try + | +LL | let _ = cstring.as_bytes().len(); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: using `libc::strlen` on a `CString` or `CStr` value --> tests/ui/strlen_on_c_strings.rs:17:13 | LL | let _ = unsafe { libc::strlen(cstr.as_ptr()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cstr.to_bytes().len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = cstr.to_bytes().len(); + | ~~~~~~~~~~~~~~~~~~~~~ error: using `libc::strlen` on a `CString` or `CStr` value --> tests/ui/strlen_on_c_strings.rs:19:13 | LL | let _ = unsafe { strlen(cstr.as_ptr()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cstr.to_bytes().len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = cstr.to_bytes().len(); + | ~~~~~~~~~~~~~~~~~~~~~ error: using `libc::strlen` on a `CString` or `CStr` value --> tests/ui/strlen_on_c_strings.rs:22:22 | LL | let _ = unsafe { strlen((*pcstr).as_ptr()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(*pcstr).to_bytes().len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = unsafe { (*pcstr).to_bytes().len() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: using `libc::strlen` on a `CString` or `CStr` value --> tests/ui/strlen_on_c_strings.rs:27:22 | LL | let _ = unsafe { strlen(unsafe_identity(cstr).as_ptr()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unsafe_identity(cstr).to_bytes().len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = unsafe { unsafe_identity(cstr).to_bytes().len() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: using `libc::strlen` on a `CString` or `CStr` value --> tests/ui/strlen_on_c_strings.rs:28:13 | LL | let _ = unsafe { strlen(unsafe { unsafe_identity(cstr) }.as_ptr()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unsafe { unsafe_identity(cstr) }.to_bytes().len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = unsafe { unsafe_identity(cstr) }.to_bytes().len(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: using `libc::strlen` on a `CString` or `CStr` value --> tests/ui/strlen_on_c_strings.rs:31:22 | LL | let _ = unsafe { strlen(f(cstr).as_ptr()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `f(cstr).to_bytes().len()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = unsafe { f(cstr).to_bytes().len() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/suspicious_operation_groupings.stderr b/src/tools/clippy/tests/ui/suspicious_operation_groupings.stderr index 7cb066d57e75f..33730644f4239 100644 --- a/src/tools/clippy/tests/ui/suspicious_operation_groupings.stderr +++ b/src/tools/clippy/tests/ui/suspicious_operation_groupings.stderr @@ -2,160 +2,289 @@ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:17:9 | LL | self.x == other.y && self.y == other.y && self.z == other.z - | ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::suspicious-operation-groupings` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suspicious_operation_groupings)]` +help: did you mean + | +LL | self.x == other.x && self.y == other.y && self.z == other.z + | ~~~~~~~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:30:20 | LL | s1.a < s2.a && s1.a < s2.b - | ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a < s2.a && s1.b < s2.b + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:78:33 | LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d - | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.c + s1.d * s2.d + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:83:19 | LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c - | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.c + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:83:19 | LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c - | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.c + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:88:19 | LL | s1.a * s2.a + s2.b * s2.b + s1.c * s2.c - | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.c + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:93:19 | LL | s1.a * s2.a + s1.b * s1.b + s1.c * s2.c - | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.c + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:98:5 | LL | s1.a * s1.a + s1.b * s2.b + s1.c * s2.c - | ^^^^^^^^^^^ help: did you mean: `s1.a * s2.a` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.c + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:103:33 | LL | s1.a * s2.a + s1.b * s2.b + s1.c * s1.c - | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.c + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:116:20 | LL | (s1.a * s2.a + s1.b * s1.b) - | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | (s1.a * s2.a + s1.b * s2.b) + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:121:34 | LL | (s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d) - | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | (s1.a * s2.a + s1.b * s2.b + s1.c * s2.c + s1.d * s2.d) + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:126:38 | LL | (s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d) - | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | (s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.c) + (s1.d * s2.d) + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:131:39 | LL | ((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)) - | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | ((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.c) + (s1.d * s2.d)) + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:136:42 | LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d))) - | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.c) + (s1.d * s2.d))) + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:136:42 | LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d))) - | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.c) + (s1.d * s2.d))) + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:141:40 | LL | (((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b)) + (s1.d * s2.d)) - | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | (((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.c)) + (s1.d * s2.d)) + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:146:40 | LL | ((s1.a * s2.a) + ((s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d))) - | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | ((s1.a * s2.a) + ((s1.b * s2.b) + (s1.c * s2.c) + (s1.d * s2.d))) + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:151:20 | LL | (s1.a * s2.a + s2.b * s2.b) / 2 - | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | (s1.a * s2.a + s1.b * s2.b) / 2 + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:156:35 | LL | i32::swap_bytes(s1.a * s2.a + s2.b * s2.b) - | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | i32::swap_bytes(s1.a * s2.a + s1.b * s2.b) + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:161:29 | LL | s1.a > 0 && s1.b > 0 && s1.d == s2.c && s1.d == s2.d - | ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c` + | ^^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a > 0 && s1.b > 0 && s1.c == s2.c && s1.d == s2.d + | ~~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:166:17 | LL | s1.a > 0 && s1.d == s2.c && s1.b > 0 && s1.d == s2.d - | ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c` + | ^^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a > 0 && s1.c == s2.c && s1.b > 0 && s1.d == s2.d + | ~~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:175:77 | LL | (n1.inner.0).0 == (n2.inner.0).0 && (n1.inner.1).0 == (n2.inner.1).0 && (n1.inner.2).0 == (n2.inner.1).0 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `(n1.inner.2).0 == (n2.inner.2).0` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean + | +LL | (n1.inner.0).0 == (n2.inner.0).0 && (n1.inner.1).0 == (n2.inner.1).0 && (n1.inner.2).0 == (n2.inner.2).0 + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:189:25 | LL | s1.a <= s2.a && s1.a <= s2.b - | ^^^^^^^^^^^^ help: did you mean: `s1.b <= s2.b` + | ^^^^^^^^^^^^ + | +help: did you mean + | +LL | s1.a <= s2.a && s1.b <= s2.b + | ~~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:195:23 | LL | if s1.a < s2.a && s1.a < s2.b { - | ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | if s1.a < s2.a && s1.b < s2.b { + | ~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:202:48 | LL | -(-(-s1.a * -s2.a) + (-(-s1.b * -s2.b) + -(-s1.c * -s2.b) + -(-s1.d * -s2.d))) - | ^^^^^^^^^^^^^ help: did you mean: `-s1.c * -s2.c` + | ^^^^^^^^^^^^^ + | +help: did you mean + | +LL | -(-(-s1.a * -s2.a) + (-(-s1.b * -s2.b) + -(-s1.c * -s2.c) + -(-s1.d * -s2.d))) + | ~~~~~~~~~~~~~ error: this sequence of operators looks suspiciously like a bug --> tests/ui/suspicious_operation_groupings.rs:207:27 | LL | -(if -s1.a < -s2.a && -s1.a < -s2.b { s1.c } else { s2.a }) - | ^^^^^^^^^^^^^ help: did you mean: `-s1.b < -s2.b` + | ^^^^^^^^^^^^^ + | +help: did you mean + | +LL | -(if -s1.a < -s2.a && -s1.b < -s2.b { s1.c } else { s2.a }) + | ~~~~~~~~~~~~~ error: aborting due to 26 previous errors diff --git a/src/tools/clippy/tests/ui/suspicious_to_owned.stderr b/src/tools/clippy/tests/ui/suspicious_to_owned.stderr index 255f211e65509..f60dd9aef72d8 100644 --- a/src/tools/clippy/tests/ui/suspicious_to_owned.stderr +++ b/src/tools/clippy/tests/ui/suspicious_to_owned.stderr @@ -64,16 +64,25 @@ error: implicitly cloning a `String` by calling `to_owned` on its dereferenced t --> tests/ui/suspicious_to_owned.rs:66:13 | LL | let _ = String::from(moo).to_owned(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `String::from(moo).clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::implicit-clone` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::implicit_clone)]` +help: consider using + | +LL | let _ = String::from(moo).clone(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: implicitly cloning a `Vec` by calling `to_owned` on its dereferenced type --> tests/ui/suspicious_to_owned.rs:69:13 | LL | let _ = moos_vec.to_owned(); - | ^^^^^^^^^^^^^^^^^^^ help: consider using: `moos_vec.clone()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _ = moos_vec.clone(); + | ~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/suspicious_xor_used_as_pow.stderr b/src/tools/clippy/tests/ui/suspicious_xor_used_as_pow.stderr index 4faf0237c17ad..43b03676b1db5 100644 --- a/src/tools/clippy/tests/ui/suspicious_xor_used_as_pow.stderr +++ b/src/tools/clippy/tests/ui/suspicious_xor_used_as_pow.stderr @@ -2,51 +2,84 @@ error: `^` is not the exponentiation operator --> tests/ui/suspicious_xor_used_as_pow.rs:19:13 | LL | let _ = 2 ^ 5; - | ^^^^^ help: did you mean to write: `2.pow(5)` + | ^^^^^ | = note: `-D clippy::suspicious-xor-used-as-pow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::suspicious_xor_used_as_pow)]` +help: did you mean to write + | +LL | let _ = 2.pow(5); + | ~~~~~~~~ error: `^` is not the exponentiation operator --> tests/ui/suspicious_xor_used_as_pow.rs:22:13 | LL | let _ = 2i32 ^ 9i32; - | ^^^^^^^^^^^ help: did you mean to write: `2i32.pow(9i32)` + | ^^^^^^^^^^^ + | +help: did you mean to write + | +LL | let _ = 2i32.pow(9i32); + | ~~~~~~~~~~~~~~ error: `^` is not the exponentiation operator --> tests/ui/suspicious_xor_used_as_pow.rs:24:13 | LL | let _ = 2i32 ^ 2i32; - | ^^^^^^^^^^^ help: did you mean to write: `2i32.pow(2i32)` + | ^^^^^^^^^^^ + | +help: did you mean to write + | +LL | let _ = 2i32.pow(2i32); + | ~~~~~~~~~~~~~~ error: `^` is not the exponentiation operator --> tests/ui/suspicious_xor_used_as_pow.rs:26:13 | LL | let _ = 50i32 ^ 3i32; - | ^^^^^^^^^^^^ help: did you mean to write: `50i32.pow(3i32)` + | ^^^^^^^^^^^^ + | +help: did you mean to write + | +LL | let _ = 50i32.pow(3i32); + | ~~~~~~~~~~~~~~~ error: `^` is not the exponentiation operator --> tests/ui/suspicious_xor_used_as_pow.rs:28:13 | LL | let _ = 5i32 ^ 8i32; - | ^^^^^^^^^^^ help: did you mean to write: `5i32.pow(8i32)` + | ^^^^^^^^^^^ + | +help: did you mean to write + | +LL | let _ = 5i32.pow(8i32); + | ~~~~~~~~~~~~~~ error: `^` is not the exponentiation operator --> tests/ui/suspicious_xor_used_as_pow.rs:30:13 | LL | let _ = 2i32 ^ 32i32; - | ^^^^^^^^^^^^ help: did you mean to write: `2i32.pow(32i32)` + | ^^^^^^^^^^^^ + | +help: did you mean to write + | +LL | let _ = 2i32.pow(32i32); + | ~~~~~~~~~~~~~~~ error: `^` is not the exponentiation operator --> tests/ui/suspicious_xor_used_as_pow.rs:13:9 | LL | 1 ^ 2 // should warn even if inside macro - | ^^^^^ help: did you mean to write: `1.pow(2)` + | ^^^^^ ... LL | macro_test_inside!(); | -------------------- in this macro invocation | = note: this error originates in the macro `macro_test_inside` (in Nightly builds, run with -Z macro-backtrace for more info) +help: did you mean to write + | +LL | 1.pow(2) // should warn even if inside macro + | ~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/swap.stderr b/src/tools/clippy/tests/ui/swap.stderr index fad356782479b..5a03b8813a04a 100644 --- a/src/tools/clippy/tests/ui/swap.stderr +++ b/src/tools/clippy/tests/ui/swap.stderr @@ -4,11 +4,15 @@ error: this looks like you are swapping `bar.a` and `bar.b` manually LL | / let temp = bar.a; LL | | bar.a = bar.b; LL | | bar.b = temp; - | |_________________^ help: try: `std::mem::swap(&mut bar.a, &mut bar.b);` + | |_________________^ | = note: or maybe you should use `std::mem::replace`? = note: `-D clippy::manual-swap` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_swap)]` +help: try + | +LL | std::mem::swap(&mut bar.a, &mut bar.b); + | error: this looks like you are swapping elements of `foo` manually --> tests/ui/swap.rs:40:5 @@ -16,7 +20,12 @@ error: this looks like you are swapping elements of `foo` manually LL | / let temp = foo[0]; LL | | foo[0] = foo[1]; LL | | foo[1] = temp; - | |__________________^ help: try: `foo.swap(0, 1);` + | |__________________^ + | +help: try + | +LL | foo.swap(0, 1); + | error: this looks like you are swapping elements of `foo` manually --> tests/ui/swap.rs:49:5 @@ -24,7 +33,12 @@ error: this looks like you are swapping elements of `foo` manually LL | / let temp = foo[0]; LL | | foo[0] = foo[1]; LL | | foo[1] = temp; - | |__________________^ help: try: `foo.swap(0, 1);` + | |__________________^ + | +help: try + | +LL | foo.swap(0, 1); + | error: this looks like you are swapping elements of `foo` manually --> tests/ui/swap.rs:68:5 @@ -32,7 +46,12 @@ error: this looks like you are swapping elements of `foo` manually LL | / let temp = foo[0]; LL | | foo[0] = foo[1]; LL | | foo[1] = temp; - | |__________________^ help: try: `foo.swap(0, 1);` + | |__________________^ + | +help: try + | +LL | foo.swap(0, 1); + | error: this looks like you are swapping `a` and `b` manually --> tests/ui/swap.rs:79:5 @@ -40,7 +59,12 @@ error: this looks like you are swapping `a` and `b` manually LL | / a ^= b; LL | | b ^= a; LL | | a ^= b; - | |___________^ help: try: `std::mem::swap(&mut a, &mut b);` + | |___________^ + | +help: try + | +LL | std::mem::swap(&mut a, &mut b); + | error: this looks like you are swapping `bar.a` and `bar.b` manually --> tests/ui/swap.rs:87:5 @@ -48,7 +72,12 @@ error: this looks like you are swapping `bar.a` and `bar.b` manually LL | / bar.a ^= bar.b; LL | | bar.b ^= bar.a; LL | | bar.a ^= bar.b; - | |___________________^ help: try: `std::mem::swap(&mut bar.a, &mut bar.b);` + | |___________________^ + | +help: try + | +LL | std::mem::swap(&mut bar.a, &mut bar.b); + | error: this looks like you are swapping elements of `foo` manually --> tests/ui/swap.rs:95:5 @@ -56,7 +85,12 @@ error: this looks like you are swapping elements of `foo` manually LL | / foo[0] ^= foo[1]; LL | | foo[1] ^= foo[0]; LL | | foo[0] ^= foo[1]; - | |_____________________^ help: try: `foo.swap(0, 1);` + | |_____________________^ + | +help: try + | +LL | foo.swap(0, 1); + | error: this looks like you are swapping `foo[0][1]` and `bar[1][0]` manually --> tests/ui/swap.rs:124:5 @@ -64,9 +98,13 @@ error: this looks like you are swapping `foo[0][1]` and `bar[1][0]` manually LL | / let temp = foo[0][1]; LL | | foo[0][1] = bar[1][0]; LL | | bar[1][0] = temp; - | |_____________________^ help: try: `std::mem::swap(&mut foo[0][1], &mut bar[1][0]);` + | |_____________________^ | = note: or maybe you should use `std::mem::replace`? +help: try + | +LL | std::mem::swap(&mut foo[0][1], &mut bar[1][0]); + | error: this looks like you are swapping `a` and `b` manually --> tests/ui/swap.rs:138:7 @@ -75,9 +113,13 @@ LL | ; let t = a; | _______^ LL | | a = b; LL | | b = t; - | |__________^ help: try: `std::mem::swap(&mut a, &mut b);` + | |__________^ | = note: or maybe you should use `std::mem::replace`? +help: try + | +LL | ; std::mem::swap(&mut a, &mut b); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this looks like you are swapping `c.0` and `a` manually --> tests/ui/swap.rs:147:7 @@ -86,9 +128,13 @@ LL | ; let t = c.0; | _______^ LL | | c.0 = a; LL | | a = t; - | |__________^ help: try: `std::mem::swap(&mut c.0, &mut a);` + | |__________^ | = note: or maybe you should use `std::mem::replace`? +help: try + | +LL | ; std::mem::swap(&mut c.0, &mut a); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this looks like you are swapping `b` and `a` manually --> tests/ui/swap.rs:173:5 @@ -96,56 +142,80 @@ error: this looks like you are swapping `b` and `a` manually LL | / let t = b; LL | | b = a; LL | | a = t; - | |__________^ help: try: `std::mem::swap(&mut b, &mut a);` + | |__________^ | = note: or maybe you should use `std::mem::replace`? +help: try + | +LL | std::mem::swap(&mut b, &mut a); + | error: this looks like you are trying to swap `a` and `b` --> tests/ui/swap.rs:135:5 | LL | / a = b; LL | | b = a; - | |_________^ help: try: `std::mem::swap(&mut a, &mut b)` + | |_________^ | = note: or maybe you should use `std::mem::replace`? = note: `-D clippy::almost-swapped` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::almost_swapped)]` +help: try + | +LL | std::mem::swap(&mut a, &mut b); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this looks like you are trying to swap `c.0` and `a` --> tests/ui/swap.rs:144:5 | LL | / c.0 = a; LL | | a = c.0; - | |___________^ help: try: `std::mem::swap(&mut c.0, &mut a)` + | |___________^ | = note: or maybe you should use `std::mem::replace`? +help: try + | +LL | std::mem::swap(&mut c.0, &mut a); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this looks like you are trying to swap `a` and `b` --> tests/ui/swap.rs:151:5 | LL | / let a = b; LL | | let b = a; - | |_____________^ help: try: `std::mem::swap(&mut a, &mut b)` + | |_____________^ | = note: or maybe you should use `std::mem::replace`? +help: try + | +LL | std::mem::swap(&mut a, &mut b); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this looks like you are trying to swap `d` and `c` --> tests/ui/swap.rs:156:5 | LL | / d = c; LL | | c = d; - | |_________^ help: try: `std::mem::swap(&mut d, &mut c)` + | |_________^ | = note: or maybe you should use `std::mem::replace`? +help: try + | +LL | std::mem::swap(&mut d, &mut c); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this looks like you are trying to swap `a` and `b` --> tests/ui/swap.rs:160:5 | LL | / let a = b; LL | | b = a; - | |_________^ help: try: `std::mem::swap(&mut a, &mut b)` + | |_________^ | = note: or maybe you should use `std::mem::replace`? +help: try + | +LL | std::mem::swap(&mut a, &mut b); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this looks like you are swapping `s.0.x` and `s.0.y` manually --> tests/ui/swap.rs:208:5 @@ -153,9 +223,13 @@ error: this looks like you are swapping `s.0.x` and `s.0.y` manually LL | / let t = s.0.x; LL | | s.0.x = s.0.y; LL | | s.0.y = t; - | |______________^ help: try: `std::mem::swap(&mut s.0.x, &mut s.0.y);` + | |______________^ | = note: or maybe you should use `std::mem::replace`? +help: try + | +LL | std::mem::swap(&mut s.0.x, &mut s.0.y); + | error: aborting due to 17 previous errors diff --git a/src/tools/clippy/tests/ui/swap_ptr_to_ref.stderr b/src/tools/clippy/tests/ui/swap_ptr_to_ref.stderr index 019c2f91f0e9e..e7ec6438468b8 100644 --- a/src/tools/clippy/tests/ui/swap_ptr_to_ref.stderr +++ b/src/tools/clippy/tests/ui/swap_ptr_to_ref.stderr @@ -2,28 +2,47 @@ error: call to `core::mem::swap` with a parameter derived from a raw pointer --> tests/ui/swap_ptr_to_ref.rs:11:9 | LL | core::mem::swap(&mut *y, &mut *z); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use ptr::swap: `core::ptr::swap(y, z)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::swap-ptr-to-ref` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::swap_ptr_to_ref)]` +help: use ptr::swap + | +LL | core::ptr::swap(y, z); + | ~~~~~~~~~~~~~~~~~~~~~ error: call to `core::mem::swap` with a parameter derived from a raw pointer --> tests/ui/swap_ptr_to_ref.rs:12:9 | LL | core::mem::swap(&mut *y, &mut x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use ptr::swap: `core::ptr::swap(y, &mut x)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use ptr::swap + | +LL | core::ptr::swap(y, &mut x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: call to `core::mem::swap` with a parameter derived from a raw pointer --> tests/ui/swap_ptr_to_ref.rs:13:9 | LL | core::mem::swap(&mut x, &mut *y); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use ptr::swap: `core::ptr::swap(&mut x, y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use ptr::swap + | +LL | core::ptr::swap(&mut x, y); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: call to `core::mem::swap` with a parameter derived from a raw pointer --> tests/ui/swap_ptr_to_ref.rs:14:9 | LL | core::mem::swap(&mut *addr_of_mut!(x), &mut *addr_of_mut!(x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use ptr::swap: `core::ptr::swap(addr_of_mut!(x), addr_of_mut!(x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use ptr::swap + | +LL | core::ptr::swap(addr_of_mut!(x), addr_of_mut!(x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/tabs_in_doc_comments.stderr b/src/tools/clippy/tests/ui/tabs_in_doc_comments.stderr index aef6c39145263..de01a750bf6e6 100644 --- a/src/tools/clippy/tests/ui/tabs_in_doc_comments.stderr +++ b/src/tools/clippy/tests/ui/tabs_in_doc_comments.stderr @@ -2,52 +2,91 @@ error: using tabs in doc comments is not recommended --> tests/ui/tabs_in_doc_comments.rs:6:5 | LL | /// - first one - | ^^^^ help: consider using four spaces per tab + | ^^^^ | = note: `-D clippy::tabs-in-doc-comments` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::tabs_in_doc_comments)]` +help: consider using four spaces per tab + | +LL | /// - first one + | ++++ error: using tabs in doc comments is not recommended --> tests/ui/tabs_in_doc_comments.rs:6:13 | LL | /// - first one - | ^^^^^^^^ help: consider using four spaces per tab + | ^^^^^^^^ + | +help: consider using four spaces per tab + | +LL | /// - first one + | ++++++++ error: using tabs in doc comments is not recommended --> tests/ui/tabs_in_doc_comments.rs:7:5 | LL | /// - second one - | ^^^^ help: consider using four spaces per tab + | ^^^^ + | +help: consider using four spaces per tab + | +LL | /// - second one + | ++++ error: using tabs in doc comments is not recommended --> tests/ui/tabs_in_doc_comments.rs:7:14 | LL | /// - second one - | ^^^^ help: consider using four spaces per tab + | ^^^^ + | +help: consider using four spaces per tab + | +LL | /// - second one + | ++++ error: using tabs in doc comments is not recommended --> tests/ui/tabs_in_doc_comments.rs:10:9 | LL | /// - First String: - | ^^^^ help: consider using four spaces per tab + | ^^^^ + | +help: consider using four spaces per tab + | +LL | /// - First String: + | ++++ error: using tabs in doc comments is not recommended --> tests/ui/tabs_in_doc_comments.rs:11:9 | LL | /// - needs to be inside here - | ^^^^^^^^ help: consider using four spaces per tab + | ^^^^^^^^ + | +help: consider using four spaces per tab + | +LL | /// - needs to be inside here + | ++++++++ error: using tabs in doc comments is not recommended --> tests/ui/tabs_in_doc_comments.rs:14:9 | LL | /// - Second String: - | ^^^^ help: consider using four spaces per tab + | ^^^^ + | +help: consider using four spaces per tab + | +LL | /// - Second String: + | ++++ error: using tabs in doc comments is not recommended --> tests/ui/tabs_in_doc_comments.rs:15:9 | LL | /// - needs to be inside here - | ^^^^^^^^ help: consider using four spaces per tab + | ^^^^^^^^ + | +help: consider using four spaces per tab + | +LL | /// - needs to be inside here + | ++++++++ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/thread_local_initializer_can_be_made_const.stderr b/src/tools/clippy/tests/ui/thread_local_initializer_can_be_made_const.stderr index b4f8bd822b0de..59aa290f4e8c0 100644 --- a/src/tools/clippy/tests/ui/thread_local_initializer_can_be_made_const.stderr +++ b/src/tools/clippy/tests/ui/thread_local_initializer_can_be_made_const.stderr @@ -2,40 +2,69 @@ error: initializer for `thread_local` value can be made `const` --> tests/ui/thread_local_initializer_can_be_made_const.rs:8:41 | LL | static BUF_1: RefCell = RefCell::new(String::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { RefCell::new(String::new()) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::thread-local-initializer-can-be-made-const` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::thread_local_initializer_can_be_made_const)]` +help: replace with + | +LL | static BUF_1: RefCell = const { RefCell::new(String::new()) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: initializer for `thread_local` value can be made `const` --> tests/ui/thread_local_initializer_can_be_made_const.rs:18:29 | LL | static SIMPLE:i32 = 1; - | ^ help: replace with: `const { 1 }` + | ^ + | +help: replace with + | +LL | static SIMPLE:i32 = const { 1 }; + | ~~~~~~~~~~~ error: initializer for `thread_local` value can be made `const` --> tests/ui/thread_local_initializer_can_be_made_const.rs:24:59 | LL | static BUF_3_CAN_BE_MADE_CONST: RefCell = RefCell::new(String::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { RefCell::new(String::new()) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | static BUF_3_CAN_BE_MADE_CONST: RefCell = const { RefCell::new(String::new()) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: initializer for `thread_local` value can be made `const` --> tests/ui/thread_local_initializer_can_be_made_const.rs:26:59 | LL | static BUF_4_CAN_BE_MADE_CONST: RefCell = RefCell::new(String::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { RefCell::new(String::new()) }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | static BUF_4_CAN_BE_MADE_CONST: RefCell = const { RefCell::new(String::new()) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: initializer for `thread_local` value can be made `const` --> tests/ui/thread_local_initializer_can_be_made_const.rs:32:31 | LL | static PEEL_ME: i32 = { 1 }; - | ^^^^^ help: replace with: `const { 1 }` + | ^^^^^ + | +help: replace with + | +LL | static PEEL_ME: i32 = const { 1 }; + | ~~~~~~~~~~~ error: initializer for `thread_local` value can be made `const` --> tests/ui/thread_local_initializer_can_be_made_const.rs:34:36 | LL | static PEEL_ME_MANY: i32 = { let x = 1; x * x }; - | ^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { { let x = 1; x * x } }` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | static PEEL_ME_MANY: i32 = const { { let x = 1; x * x } }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/to_digit_is_some.stderr b/src/tools/clippy/tests/ui/to_digit_is_some.stderr index e44106b2e188b..c0a911b7eb8a3 100644 --- a/src/tools/clippy/tests/ui/to_digit_is_some.stderr +++ b/src/tools/clippy/tests/ui/to_digit_is_some.stderr @@ -2,16 +2,25 @@ error: use of `.to_digit(..).is_some()` --> tests/ui/to_digit_is_some.rs:7:13 | LL | let _ = d.to_digit(8).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `d.is_digit(8)` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::to-digit-is-some` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::to_digit_is_some)]` +help: try + | +LL | let _ = d.is_digit(8); + | ~~~~~~~~~~~~~ error: use of `.to_digit(..).is_some()` --> tests/ui/to_digit_is_some.rs:8:13 | LL | let _ = char::to_digit(c, 8).is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `char::is_digit(c, 8)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = char::is_digit(c, 8); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/toplevel_ref_arg.stderr b/src/tools/clippy/tests/ui/toplevel_ref_arg.stderr index 61f0fd4a6cd20..20cd727cf6142 100644 --- a/src/tools/clippy/tests/ui/toplevel_ref_arg.stderr +++ b/src/tools/clippy/tests/ui/toplevel_ref_arg.stderr @@ -2,42 +2,70 @@ error: `ref` on an entire `let` pattern is discouraged, take a reference with `& --> tests/ui/toplevel_ref_arg.rs:14:9 | LL | let ref _x = 1; - | ----^^^^^^----- help: try: `let _x = &1;` + | ^^^^^^ | = note: `-D clippy::toplevel-ref-arg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::toplevel_ref_arg)]` +help: try + | +LL | let _x = &1; + | error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead --> tests/ui/toplevel_ref_arg.rs:16:9 | LL | let ref _y: (&_, u8) = (&1, 2); - | ----^^^^^^--------------------- help: try: `let _y: &(&_, u8) = &(&1, 2);` + | ^^^^^^ + | +help: try + | +LL | let _y: &(&_, u8) = &(&1, 2); + | error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead --> tests/ui/toplevel_ref_arg.rs:18:9 | LL | let ref _z = 1 + 2; - | ----^^^^^^--------- help: try: `let _z = &(1 + 2);` + | ^^^^^^ + | +help: try + | +LL | let _z = &(1 + 2); + | error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead --> tests/ui/toplevel_ref_arg.rs:20:9 | LL | let ref mut _z = 1 + 2; - | ----^^^^^^^^^^--------- help: try: `let _z = &mut (1 + 2);` + | ^^^^^^^^^^ + | +help: try + | +LL | let _z = &mut (1 + 2); + | error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead --> tests/ui/toplevel_ref_arg.rs:25:9 | LL | let ref _x = vec![1, 2, 3]; - | ----^^^^^^----------------- help: try: `let _x = &vec![1, 2, 3];` + | ^^^^^^ + | +help: try + | +LL | let _x = &vec![1, 2, 3]; + | error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead --> tests/ui/toplevel_ref_arg.rs:35:17 | LL | inline!(let ref _y = 42;); - | ----^^^^^^------ help: try: `let _y = &42;` + | ^^^^^^ | = note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try + | +LL | inline!(let _y = &42;); + | ~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/trailing_zeros.stderr b/src/tools/clippy/tests/ui/trailing_zeros.stderr index 6f3e7aa1d762e..4293cf7ee2556 100644 --- a/src/tools/clippy/tests/ui/trailing_zeros.stderr +++ b/src/tools/clippy/tests/ui/trailing_zeros.stderr @@ -2,16 +2,25 @@ error: bit mask could be simplified with a call to `trailing_zeros` --> tests/ui/trailing_zeros.rs:6:13 | LL | let _ = (x & 0b1111 == 0); - | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 4` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::verbose-bit-mask` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::verbose_bit_mask)]` +help: try + | +LL | let _ = x.trailing_zeros() >= 4; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: bit mask could be simplified with a call to `trailing_zeros` --> tests/ui/trailing_zeros.rs:9:13 | LL | let _ = x & 0b1_1111 == 0; - | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 5` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x.trailing_zeros() >= 5; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/trait_duplication_in_bounds.stderr b/src/tools/clippy/tests/ui/trait_duplication_in_bounds.stderr index 78861fc16e817..9af354a19fceb 100644 --- a/src/tools/clippy/tests/ui/trait_duplication_in_bounds.stderr +++ b/src/tools/clippy/tests/ui/trait_duplication_in_bounds.stderr @@ -2,61 +2,105 @@ error: these bounds contain repeated elements --> tests/ui/trait_duplication_in_bounds.rs:6:15 | LL | fn bad_foo(arg0: T, argo1: U) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/trait_duplication_in_bounds.rs:1:9 | LL | #![deny(clippy::trait_duplication_in_bounds)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | fn bad_foo(arg0: T, argo1: U) { + | ~~~~~~~~~~~~ error: these where clauses contain repeated elements --> tests/ui/trait_duplication_in_bounds.rs:12:8 | LL | T: Clone + Clone + Clone + Copy, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | T: Clone + Copy, + | ~~~~~~~~~~~~ error: these bounds contain repeated elements --> tests/ui/trait_duplication_in_bounds.rs:40:26 | LL | trait BadSelfTraitBound: Clone + Clone + Clone { - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | trait BadSelfTraitBound: Clone { + | ~~~~~ error: these where clauses contain repeated elements --> tests/ui/trait_duplication_in_bounds.rs:47:15 | LL | Self: Clone + Clone + Clone; - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Self: Clone; + | ~~~~~ error: these bounds contain repeated elements --> tests/ui/trait_duplication_in_bounds.rs:61:24 | LL | trait BadTraitBound { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | trait BadTraitBound { + | ~~~~~~~~~~~~ error: these where clauses contain repeated elements --> tests/ui/trait_duplication_in_bounds.rs:68:12 | LL | T: Clone + Clone + Clone + Copy, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | T: Clone + Copy, + | ~~~~~~~~~~~~ error: these bounds contain repeated elements --> tests/ui/trait_duplication_in_bounds.rs:101:19 | LL | fn bad_generic + GenericTrait + GenericTrait>(arg0: T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `GenericTrait + GenericTrait` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | fn bad_generic + GenericTrait>(arg0: T) { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: these bounds contain repeated elements --> tests/ui/trait_duplication_in_bounds.rs:109:22 | LL | fn qualified_path(arg0: T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::clone::Clone + foo::Clone` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | fn qualified_path(arg0: T) { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this trait bound is already specified in trait declaration --> tests/ui/trait_duplication_in_bounds.rs:117:33 | LL | fn bad_trait_object(arg0: &(dyn Any + Send + Send)) { - | ^^^^^^^^^^^^^^^^^ help: try: `Any + Send` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | fn bad_trait_object(arg0: &(dyn Any + Send)) { + | ~~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/transmute.stderr b/src/tools/clippy/tests/ui/transmute.stderr index 0072f62962a7d..efb3e5f3bd2fa 100644 --- a/src/tools/clippy/tests/ui/transmute.stderr +++ b/src/tools/clippy/tests/ui/transmute.stderr @@ -2,22 +2,36 @@ error: transmute from a reference to a pointer --> tests/ui/transmute.rs:31:23 | LL | let _: *const T = core::intrinsics::transmute(t); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::useless-transmute` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::useless_transmute)]` +help: try + | +LL | let _: *const T = t as *const T; + | ~~~~~~~~~~~~~ error: transmute from a reference to a pointer --> tests/ui/transmute.rs:35:21 | LL | let _: *mut T = core::intrinsics::transmute(t); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *mut T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: *mut T = t as *const T as *mut T; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a pointer --> tests/ui/transmute.rs:38:23 | LL | let _: *const U = core::intrinsics::transmute(t); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *const U` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: *const U = t as *const T as *const U; + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a type (`std::vec::Vec`) to itself --> tests/ui/transmute.rs:45:27 @@ -53,13 +67,23 @@ error: transmute from an integer to a pointer --> tests/ui/transmute.rs:60:31 | LL | let _: *const usize = std::mem::transmute(5_isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `5_isize as *const usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: *const usize = 5_isize as *const usize; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from an integer to a pointer --> tests/ui/transmute.rs:65:31 | LL | let _: *const usize = std::mem::transmute(1 + 1usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(1 + 1usize) as *const usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: *const usize = (1 + 1usize) as *const usize; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a type (`*const Usize`) to the type that it points to (`Usize`) --> tests/ui/transmute.rs:97:24 @@ -92,181 +116,317 @@ error: transmute from a `u8` to a `bool` --> tests/ui/transmute.rs:114:28 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::transmute_int_to_bool)]` +help: consider using + | +LL | let _: bool = unsafe { 0_u8 != 0 }; + | ~~~~~~~~~ error: transmute from a `u16` to a `f16` --> tests/ui/transmute.rs:122:31 | LL | let _: f16 = unsafe { std::mem::transmute(0_u16) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f16::from_bits(0_u16)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::transmute-int-to-float` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::transmute_int_to_float)]` +help: consider using + | +LL | let _: f16 = unsafe { f16::from_bits(0_u16) }; + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i16` to a `f16` --> tests/ui/transmute.rs:125:31 | LL | let _: f16 = unsafe { std::mem::transmute(0_i16) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f16::from_bits(0_i16 as u16)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: f16 = unsafe { f16::from_bits(0_i16 as u16) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `u32` to a `f32` --> tests/ui/transmute.rs:127:31 | LL | let _: f32 = unsafe { std::mem::transmute(0_u32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_u32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: f32 = unsafe { f32::from_bits(0_u32) }; + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i32` to a `f32` --> tests/ui/transmute.rs:129:31 | LL | let _: f32 = unsafe { std::mem::transmute(0_i32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_i32 as u32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: f32 = unsafe { f32::from_bits(0_i32 as u32) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `u64` to a `f64` --> tests/ui/transmute.rs:131:31 | LL | let _: f64 = unsafe { std::mem::transmute(0_u64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f64::from_bits(0_u64)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: f64 = unsafe { f64::from_bits(0_u64) }; + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i64` to a `f64` --> tests/ui/transmute.rs:133:31 | LL | let _: f64 = unsafe { std::mem::transmute(0_i64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f64::from_bits(0_i64 as u64)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: f64 = unsafe { f64::from_bits(0_i64 as u64) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `u128` to a `f128` --> tests/ui/transmute.rs:135:32 | LL | let _: f128 = unsafe { std::mem::transmute(0_u128) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f128::from_bits(0_u128)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: f128 = unsafe { f128::from_bits(0_u128) }; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i128` to a `f128` --> tests/ui/transmute.rs:137:32 | LL | let _: f128 = unsafe { std::mem::transmute(0_i128) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f128::from_bits(0_i128 as u128)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: f128 = unsafe { f128::from_bits(0_i128 as u128) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `u8` to a `[u8; 1]` --> tests/ui/transmute.rs:168:30 | LL | let _: [u8; 1] = std::mem::transmute(0u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u8.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::transmute-num-to-bytes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::transmute_num_to_bytes)]` +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 1] = 0u8.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~ error: transmute from a `u32` to a `[u8; 4]` --> tests/ui/transmute.rs:171:30 | LL | let _: [u8; 4] = std::mem::transmute(0u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u32.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 4] = 0u32.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~ error: transmute from a `u128` to a `[u8; 16]` --> tests/ui/transmute.rs:173:31 | LL | let _: [u8; 16] = std::mem::transmute(0u128); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u128.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 16] = 0u128.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~~ error: transmute from a `i8` to a `[u8; 1]` --> tests/ui/transmute.rs:175:30 | LL | let _: [u8; 1] = std::mem::transmute(0i8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i8.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 1] = 0i8.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~ error: transmute from a `i32` to a `[u8; 4]` --> tests/ui/transmute.rs:177:30 | LL | let _: [u8; 4] = std::mem::transmute(0i32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i32.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 4] = 0i32.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~ error: transmute from a `i128` to a `[u8; 16]` --> tests/ui/transmute.rs:179:31 | LL | let _: [u8; 16] = std::mem::transmute(0i128); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i128.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 16] = 0i128.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~~ error: transmute from a `f16` to a `[u8; 2]` --> tests/ui/transmute.rs:182:30 | LL | let _: [u8; 2] = std::mem::transmute(0.0f16); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f16.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 2] = 0.0f16.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~~~ error: transmute from a `f32` to a `[u8; 4]` --> tests/ui/transmute.rs:184:30 | LL | let _: [u8; 4] = std::mem::transmute(0.0f32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f32.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 4] = 0.0f32.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~~~ error: transmute from a `f64` to a `[u8; 8]` --> tests/ui/transmute.rs:186:30 | LL | let _: [u8; 8] = std::mem::transmute(0.0f64); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f64.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 8] = 0.0f64.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~~~ error: transmute from a `f128` to a `[u8; 16]` --> tests/ui/transmute.rs:188:31 | LL | let _: [u8; 16] = std::mem::transmute(0.0f128); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f128.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 16] = 0.0f128.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `u8` to a `[u8; 1]` --> tests/ui/transmute.rs:194:30 | LL | let _: [u8; 1] = std::mem::transmute(0u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u8.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 1] = 0u8.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~ error: transmute from a `u32` to a `[u8; 4]` --> tests/ui/transmute.rs:196:30 | LL | let _: [u8; 4] = std::mem::transmute(0u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u32.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 4] = 0u32.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~ error: transmute from a `u128` to a `[u8; 16]` --> tests/ui/transmute.rs:198:31 | LL | let _: [u8; 16] = std::mem::transmute(0u128); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u128.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 16] = 0u128.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~~ error: transmute from a `i8` to a `[u8; 1]` --> tests/ui/transmute.rs:200:30 | LL | let _: [u8; 1] = std::mem::transmute(0i8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i8.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 1] = 0i8.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~ error: transmute from a `i32` to a `[u8; 4]` --> tests/ui/transmute.rs:202:30 | LL | let _: [u8; 4] = std::mem::transmute(0i32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i32.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 4] = 0i32.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~ error: transmute from a `i128` to a `[u8; 16]` --> tests/ui/transmute.rs:204:31 | LL | let _: [u8; 16] = std::mem::transmute(0i128); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i128.to_ne_bytes()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `to_ne_bytes()` + | +LL | let _: [u8; 16] = 0i128.to_ne_bytes(); + | ~~~~~~~~~~~~~~~~~~~ error: transmute from a `&[u8]` to a `&str` --> tests/ui/transmute.rs:218:28 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::transmute_bytes_to_str)]` +help: consider using + | +LL | let _: &str = unsafe { std::str::from_utf8(B).unwrap() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `&mut [u8]` to a `&mut str` --> tests/ui/transmute.rs:221:32 | LL | let _: &mut str = unsafe { std::mem::transmute(mb) }; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: &mut str = unsafe { std::str::from_utf8_mut(mb).unwrap() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `&[u8]` to a `&str` --> tests/ui/transmute.rs:223:30 | LL | const _: &str = unsafe { std::mem::transmute(B) }; - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_unchecked(B)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | const _: &str = unsafe { std::str::from_utf8_unchecked(B) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 42 previous errors diff --git a/src/tools/clippy/tests/ui/transmute_float_to_int.stderr b/src/tools/clippy/tests/ui/transmute_float_to_int.stderr index 9cac75f72cdd7..b5a58b1c40c39 100644 --- a/src/tools/clippy/tests/ui/transmute_float_to_int.stderr +++ b/src/tools/clippy/tests/ui/transmute_float_to_int.stderr @@ -2,40 +2,69 @@ error: transmute from a `f32` to a `u32` --> tests/ui/transmute_float_to_int.rs:7:27 | LL | let _: u32 = unsafe { std::mem::transmute(1f32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f32.to_bits()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::transmute-float-to-int` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::transmute_float_to_int)]` +help: consider using + | +LL | let _: u32 = unsafe { 1f32.to_bits() }; + | ~~~~~~~~~~~~~~ error: transmute from a `f32` to a `i32` --> tests/ui/transmute_float_to_int.rs:10:27 | LL | let _: i32 = unsafe { std::mem::transmute(1f32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f32.to_bits() as i32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: i32 = unsafe { 1f32.to_bits() as i32 }; + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `f64` to a `u64` --> tests/ui/transmute_float_to_int.rs:12:27 | LL | let _: u64 = unsafe { std::mem::transmute(1f64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f64.to_bits()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: u64 = unsafe { 1f64.to_bits() }; + | ~~~~~~~~~~~~~~ error: transmute from a `f64` to a `i64` --> tests/ui/transmute_float_to_int.rs:14:27 | LL | let _: i64 = unsafe { std::mem::transmute(1f64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f64.to_bits() as i64` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: i64 = unsafe { 1f64.to_bits() as i64 }; + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `f64` to a `u64` --> tests/ui/transmute_float_to_int.rs:16:27 | LL | let _: u64 = unsafe { std::mem::transmute(1.0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1.0f64.to_bits()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: u64 = unsafe { 1.0f64.to_bits() }; + | ~~~~~~~~~~~~~~~~ error: transmute from a `f64` to a `u64` --> tests/ui/transmute_float_to_int.rs:18:27 | LL | let _: u64 = unsafe { std::mem::transmute(-1.0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-1.0f64).to_bits()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: u64 = unsafe { (-1.0f64).to_bits() }; + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/transmute_int_to_char.stderr b/src/tools/clippy/tests/ui/transmute_int_to_char.stderr index e3a3620f28b75..109eca26565dd 100644 --- a/src/tools/clippy/tests/ui/transmute_int_to_char.stderr +++ b/src/tools/clippy/tests/ui/transmute_int_to_char.stderr @@ -2,16 +2,25 @@ error: transmute from a `u32` to a `char` --> tests/ui/transmute_int_to_char.rs:5:28 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::transmute_int_to_char)]` +help: consider using + | +LL | let _: char = unsafe { std::char::from_u32(0_u32).unwrap() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i32` to a `char` --> tests/ui/transmute_int_to_char.rs:8:28 | LL | let _: char = unsafe { std::mem::transmute(0_i32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_i32 as u32).unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: char = unsafe { std::char::from_u32(0_i32 as u32).unwrap() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/transmute_int_to_char_no_std.stderr b/src/tools/clippy/tests/ui/transmute_int_to_char_no_std.stderr index d94580a84d7a4..b4b07522b72c7 100644 --- a/src/tools/clippy/tests/ui/transmute_int_to_char_no_std.stderr +++ b/src/tools/clippy/tests/ui/transmute_int_to_char_no_std.stderr @@ -2,16 +2,25 @@ error: transmute from a `u32` to a `char` --> tests/ui/transmute_int_to_char_no_std.rs:17:28 | LL | let _: char = unsafe { core::mem::transmute(0_u32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `core::char::from_u32(0_u32).unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::transmute-int-to-char` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::transmute_int_to_char)]` +help: consider using + | +LL | let _: char = unsafe { core::char::from_u32(0_u32).unwrap() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i32` to a `char` --> tests/ui/transmute_int_to_char_no_std.rs:20:28 | LL | let _: char = unsafe { core::mem::transmute(0_i32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `core::char::from_u32(0_i32 as u32).unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: char = unsafe { core::char::from_u32(0_i32 as u32).unwrap() }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/transmute_int_to_non_zero.stderr b/src/tools/clippy/tests/ui/transmute_int_to_non_zero.stderr index 199b8ec59d092..04cb5b241f5cd 100644 --- a/src/tools/clippy/tests/ui/transmute_int_to_non_zero.stderr +++ b/src/tools/clippy/tests/ui/transmute_int_to_non_zero.stderr @@ -2,64 +2,113 @@ error: transmute from a `u8` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:19:35 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u8)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::transmute-int-to-non-zero` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::transmute_int_to_non_zero)]` +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_u8) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `u16` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:22:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u16) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u16)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_u16) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `u32` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:24:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_u32) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `u64` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:26:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u64)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_u64) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `u128` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:28:37 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u128) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u128)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_u128) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i8` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:31:35 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i8)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_i8) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i16` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:33:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i16) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i16)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_i16) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i32` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:35:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_i32) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i64` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:37:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i64)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_i64) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a `i128` to a `NonZero` --> tests/ui/transmute_int_to_non_zero.rs:39:37 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i128) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i128)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | let _: NonZero = unsafe { NonZero::new_unchecked(int_i128) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/transmute_ptr_to_ptr.stderr b/src/tools/clippy/tests/ui/transmute_ptr_to_ptr.stderr index cd1f1f398dc2d..72f6ecc1a56be 100644 --- a/src/tools/clippy/tests/ui/transmute_ptr_to_ptr.stderr +++ b/src/tools/clippy/tests/ui/transmute_ptr_to_ptr.stderr @@ -2,46 +2,80 @@ error: transmute from a pointer to a pointer --> tests/ui/transmute_ptr_to_ptr.rs:30:29 | LL | let _: *const f32 = std::mem::transmute(ptr); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr as *const f32` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]` +help: try + | +LL | let _: *const f32 = ptr as *const f32; + | ~~~~~~~~~~~~~~~~~ error: transmute from a pointer to a pointer --> tests/ui/transmute_ptr_to_ptr.rs:33:27 | LL | let _: *mut f32 = std::mem::transmute(mut_ptr); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `mut_ptr as *mut f32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: *mut f32 = mut_ptr as *mut f32; + | ~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a reference --> tests/ui/transmute_ptr_to_ptr.rs:36:23 | LL | let _: &f32 = std::mem::transmute(&1u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1u32 as *const u32 as *const f32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &f32 = &*(&1u32 as *const u32 as *const f32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a reference --> tests/ui/transmute_ptr_to_ptr.rs:38:23 | LL | let _: &f32 = std::mem::transmute(&1f64); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1f64 as *const f64 as *const f32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &f32 = &*(&1f64 as *const f64 as *const f32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a reference --> tests/ui/transmute_ptr_to_ptr.rs:42:27 | LL | let _: &mut f32 = std::mem::transmute(&mut 1u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(&mut 1u32 as *mut u32 as *mut f32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &mut f32 = &mut *(&mut 1u32 as *mut u32 as *mut f32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a reference --> tests/ui/transmute_ptr_to_ptr.rs:44:37 | LL | let _: &GenericParam = std::mem::transmute(&GenericParam { t: 1u32 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam as *const GenericParam)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &GenericParam = &*(&GenericParam { t: 1u32 } as *const GenericParam as *const GenericParam); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a reference --> tests/ui/transmute_ptr_to_ptr.rs:47:36 | LL | let u8_ref: &u8 = unsafe { std::mem::transmute(u64_ref) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(u64_ref as *const u64 as *const u8)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let u8_ref: &u8 = unsafe { &*(u64_ref as *const u64 as *const u8) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/transmute_ptr_to_ref.stderr b/src/tools/clippy/tests/ui/transmute_ptr_to_ref.stderr index 44cda254c3f7b..6754baa11d318 100644 --- a/src/tools/clippy/tests/ui/transmute_ptr_to_ref.stderr +++ b/src/tools/clippy/tests/ui/transmute_ptr_to_ref.stderr @@ -2,136 +2,245 @@ error: transmute from a pointer type (`*const T`) to a reference type (`&T`) --> tests/ui/transmute_ptr_to_ref.rs:9:17 | LL | let _: &T = std::mem::transmute(p); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p` + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::transmute-ptr-to-ref` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ref)]` +help: try + | +LL | let _: &T = &*p; + | ~~~ error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) --> tests/ui/transmute_ptr_to_ref.rs:12:21 | LL | let _: &mut T = std::mem::transmute(m); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *m` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &mut T = &mut *m; + | ~~~~~~~ error: transmute from a pointer type (`*mut T`) to a reference type (`&T`) --> tests/ui/transmute_ptr_to_ref.rs:15:17 | LL | let _: &T = std::mem::transmute(m); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*m` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &T = &*m; + | ~~~ error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) --> tests/ui/transmute_ptr_to_ref.rs:18:21 | LL | let _: &mut T = std::mem::transmute(p as *mut T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(p as *mut T)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &mut T = &mut *(p as *mut T); + | ~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const U`) to a reference type (`&T`) --> tests/ui/transmute_ptr_to_ref.rs:21:17 | LL | let _: &T = std::mem::transmute(o); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(o as *const T)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &T = &*(o as *const T); + | ~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`) --> tests/ui/transmute_ptr_to_ref.rs:24:21 | LL | let _: &mut T = std::mem::transmute(om); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(om as *mut T)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &mut T = &mut *(om as *mut T); + | ~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*mut U`) to a reference type (`&T`) --> tests/ui/transmute_ptr_to_ref.rs:27:17 | LL | let _: &T = std::mem::transmute(om); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &T = &*(om as *const T); + | ~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const i32`) to a reference type (`&_issue1231::Foo<'_, u8>`) --> tests/ui/transmute_ptr_to_ref.rs:37:32 | LL | let _: &Foo = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &Foo = unsafe { &*raw.cast::>() }; + | ~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const i32`) to a reference type (`&_issue1231::Foo<'_, &u8>`) --> tests/ui/transmute_ptr_to_ref.rs:39:33 | LL | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &Foo<&u8> = unsafe { &*raw.cast::>() }; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`) --> tests/ui/transmute_ptr_to_ref.rs:43:14 | LL | unsafe { std::mem::transmute::<_, Bar>(raw) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | unsafe { &*(raw as *const u8) }; + | ~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) --> tests/ui/transmute_ptr_to_ref.rs:48:14 | LL | 0 => std::mem::transmute(x), - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 0 => &*x.cast::<&u32>(), + | ~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) --> tests/ui/transmute_ptr_to_ref.rs:49:14 | LL | 1 => std::mem::transmute(y), - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&u32>()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 1 => &*y.cast::<&u32>(), + | ~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) --> tests/ui/transmute_ptr_to_ref.rs:50:14 | LL | 2 => std::mem::transmute::<_, &&'b u32>(x), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 2 => &*x.cast::<&'b u32>(), + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) --> tests/ui/transmute_ptr_to_ref.rs:51:14 | LL | _ => std::mem::transmute::<_, &&'b u32>(y), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&'b u32>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | _ => &*y.cast::<&'b u32>(), + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) --> tests/ui/transmute_ptr_to_ref.rs:59:19 | LL | let _: &u32 = std::mem::transmute(a); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &u32 = &*a; + | ~~~ error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) --> tests/ui/transmute_ptr_to_ref.rs:60:19 | LL | let _: &u32 = std::mem::transmute::<_, &u32>(a); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a.cast::()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &u32 = &*a.cast::(); + | ~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) --> tests/ui/transmute_ptr_to_ref.rs:62:14 | LL | 0 => std::mem::transmute(x), - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 0 => &*x.cast::<&u32>(), + | ~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) --> tests/ui/transmute_ptr_to_ref.rs:63:14 | LL | _ => std::mem::transmute::<_, &&'b u32>(x), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | _ => &*x.cast::<&'b u32>(), + | ~~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) --> tests/ui/transmute_ptr_to_ref.rs:71:19 | LL | let _: &u32 = std::mem::transmute(a); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &u32 = &*a; + | ~~~ error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) --> tests/ui/transmute_ptr_to_ref.rs:72:19 | LL | let _: &u32 = std::mem::transmute::<_, &u32>(a); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a as *const u32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: &u32 = &*(a as *const u32); + | ~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) --> tests/ui/transmute_ptr_to_ref.rs:74:14 | LL | 0 => std::mem::transmute(x), - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &u32)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 0 => &*(x as *const () as *const &u32), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) --> tests/ui/transmute_ptr_to_ref.rs:75:14 | LL | _ => std::mem::transmute::<_, &&'b u32>(x), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &'b u32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | _ => &*(x as *const () as *const &'b u32), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 22 previous errors diff --git a/src/tools/clippy/tests/ui/transmute_ref_to_ref.stderr b/src/tools/clippy/tests/ui/transmute_ref_to_ref.stderr index e2d04cea8959f..3ace08f2071a4 100644 --- a/src/tools/clippy/tests/ui/transmute_ref_to_ref.stderr +++ b/src/tools/clippy/tests/ui/transmute_ref_to_ref.stderr @@ -2,25 +2,39 @@ error: transmute from a reference to a reference --> tests/ui/transmute_ref_to_ref.rs:9:39 | LL | let bools: &[bool] = unsafe { std::mem::transmute(single_u64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(single_u64 as *const [u64] as *const [bool])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/transmute_ref_to_ref.rs:3:9 | LL | #![deny(clippy::transmute_ptr_to_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | let bools: &[bool] = unsafe { &*(single_u64 as *const [u64] as *const [bool]) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a reference --> tests/ui/transmute_ref_to_ref.rs:12:33 | LL | let b: &[u8] = unsafe { std::mem::transmute(a) }; - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a as *const [u32] as *const [u8])` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let b: &[u8] = unsafe { &*(a as *const [u32] as *const [u8]) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a reference --> tests/ui/transmute_ref_to_ref.rs:15:42 | LL | let alt_slice: &[u32] = unsafe { std::mem::transmute(bytes) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(bytes as *const [u8] as *const [u32])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let alt_slice: &[u32] = unsafe { &*(bytes as *const [u8] as *const [u32]) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/transmute_ref_to_ref_no_std.stderr b/src/tools/clippy/tests/ui/transmute_ref_to_ref_no_std.stderr index 6a76d6729d05b..35f521baa229f 100644 --- a/src/tools/clippy/tests/ui/transmute_ref_to_ref_no_std.stderr +++ b/src/tools/clippy/tests/ui/transmute_ref_to_ref_no_std.stderr @@ -2,25 +2,39 @@ error: transmute from a reference to a reference --> tests/ui/transmute_ref_to_ref_no_std.rs:21:39 | LL | let bools: &[bool] = unsafe { core::mem::transmute(single_u64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(single_u64 as *const [u64] as *const [bool])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/transmute_ref_to_ref_no_std.rs:3:9 | LL | #![deny(clippy::transmute_ptr_to_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | let bools: &[bool] = unsafe { &*(single_u64 as *const [u64] as *const [bool]) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a reference --> tests/ui/transmute_ref_to_ref_no_std.rs:24:33 | LL | let b: &[u8] = unsafe { core::mem::transmute(a) }; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a as *const [u32] as *const [u8])` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let b: &[u8] = unsafe { &*(a as *const [u32] as *const [u8]) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a reference --> tests/ui/transmute_ref_to_ref_no_std.rs:27:42 | LL | let alt_slice: &[u32] = unsafe { core::mem::transmute(bytes) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(bytes as *const [u8] as *const [u32])` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let alt_slice: &[u32] = unsafe { &*(bytes as *const [u8] as *const [u32]) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/transmutes_expressible_as_ptr_casts.stderr b/src/tools/clippy/tests/ui/transmutes_expressible_as_ptr_casts.stderr index 2ca44485826d7..548b933937e9b 100644 --- a/src/tools/clippy/tests/ui/transmutes_expressible_as_ptr_casts.stderr +++ b/src/tools/clippy/tests/ui/transmutes_expressible_as_ptr_casts.stderr @@ -2,70 +2,117 @@ error: transmute from an integer to a pointer --> tests/ui/transmutes_expressible_as_ptr_casts.rs:17:39 | LL | let _ptr_i32_transmute = unsafe { transmute::(usize::MAX) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `usize::MAX as *const i32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::useless-transmute` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::useless_transmute)]` +help: try + | +LL | let _ptr_i32_transmute = unsafe { usize::MAX as *const i32 }; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer to a pointer --> tests/ui/transmutes_expressible_as_ptr_casts.rs:21:38 | LL | let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr_i32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as *const i8` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]` +help: try + | +LL | let _ptr_i8_transmute = unsafe { ptr_i32 as *const i8 }; + | ~~~~~~~~~~~~~~~~~~~~ error: transmute from a pointer to a pointer --> tests/ui/transmutes_expressible_as_ptr_casts.rs:27:46 | LL | let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *const [u32]>(slice_ptr) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `slice_ptr as *const [u32]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ptr_to_unsized_transmute = unsafe { slice_ptr as *const [u32] }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from `*const i32` to `usize` which could be expressed as a pointer cast instead --> tests/ui/transmutes_expressible_as_ptr_casts.rs:33:50 | LL | let _usize_from_int_ptr_transmute = unsafe { transmute::<*const i32, usize>(ptr_i32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::transmutes-expressible-as-ptr-casts` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::transmutes_expressible_as_ptr_casts)]` +help: try + | +LL | let _usize_from_int_ptr_transmute = unsafe { ptr_i32 as usize }; + | ~~~~~~~~~~~~~~~~ error: transmute from a reference to a pointer --> tests/ui/transmutes_expressible_as_ptr_casts.rs:39:41 | LL | let _array_ptr_transmute = unsafe { transmute::<&[i32; 4], *const [i32; 4]>(array_ref) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `array_ref as *const [i32; 4]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _array_ptr_transmute = unsafe { array_ref as *const [i32; 4] }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from `fn(usize) -> u8` to `*const usize` which could be expressed as a pointer cast instead --> tests/ui/transmutes_expressible_as_ptr_casts.rs:47:41 | LL | let _usize_ptr_transmute = unsafe { transmute:: u8, *const usize>(foo) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as *const usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _usize_ptr_transmute = unsafe { foo as *const usize }; + | ~~~~~~~~~~~~~~~~~~~ error: transmute from `fn(usize) -> u8` to `usize` which could be expressed as a pointer cast instead --> tests/ui/transmutes_expressible_as_ptr_casts.rs:51:49 | LL | let _usize_from_fn_ptr_transmute = unsafe { transmute:: u8, usize>(foo) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _usize_from_fn_ptr_transmute = unsafe { foo as usize }; + | ~~~~~~~~~~~~ error: transmute from `*const u32` to `usize` which could be expressed as a pointer cast instead --> tests/ui/transmutes_expressible_as_ptr_casts.rs:54:36 | LL | let _usize_from_ref = unsafe { transmute::<*const u32, usize>(&1u32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&1u32 as *const u32 as usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _usize_from_ref = unsafe { &1u32 as *const u32 as usize }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from a reference to a pointer --> tests/ui/transmutes_expressible_as_ptr_casts.rs:65:14 | LL | unsafe { transmute::<&[i32; 1], *const u8>(in_param) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `in_param as *const [i32; 1] as *const u8` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | unsafe { in_param as *const [i32; 1] as *const u8 } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: transmute from `fn()` to `*const u8` which could be expressed as a pointer cast instead --> tests/ui/transmutes_expressible_as_ptr_casts.rs:83:28 | LL | let _x: u8 = unsafe { *std::mem::transmute::(f) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(f as *const u8)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _x: u8 = unsafe { *(f as *const u8) }; + | ~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/trim_split_whitespace.stderr b/src/tools/clippy/tests/ui/trim_split_whitespace.stderr index 6119d21a8e9ae..8063160210992 100644 --- a/src/tools/clippy/tests/ui/trim_split_whitespace.stderr +++ b/src/tools/clippy/tests/ui/trim_split_whitespace.stderr @@ -2,52 +2,99 @@ error: found call to `str::trim` before `str::split_whitespace` --> tests/ui/trim_split_whitespace.rs:61:23 | LL | let _ = " A B C ".trim().split_whitespace(); // should trigger lint - | ^^^^^^^ help: remove `trim()` + | ^^^^^^^ | = note: `-D clippy::trim-split-whitespace` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::trim_split_whitespace)]` +help: remove `trim()` + | +LL - let _ = " A B C ".trim().split_whitespace(); // should trigger lint +LL + let _ = " A B C ".split_whitespace(); // should trigger lint + | error: found call to `str::trim_start` before `str::split_whitespace` --> tests/ui/trim_split_whitespace.rs:62:23 | LL | let _ = " A B C ".trim_start().split_whitespace(); // should trigger lint - | ^^^^^^^^^^^^^ help: remove `trim_start()` + | ^^^^^^^^^^^^^ + | +help: remove `trim_start()` + | +LL - let _ = " A B C ".trim_start().split_whitespace(); // should trigger lint +LL + let _ = " A B C ".split_whitespace(); // should trigger lint + | error: found call to `str::trim_end` before `str::split_whitespace` --> tests/ui/trim_split_whitespace.rs:63:23 | LL | let _ = " A B C ".trim_end().split_whitespace(); // should trigger lint - | ^^^^^^^^^^^ help: remove `trim_end()` + | ^^^^^^^^^^^ + | +help: remove `trim_end()` + | +LL - let _ = " A B C ".trim_end().split_whitespace(); // should trigger lint +LL + let _ = " A B C ".split_whitespace(); // should trigger lint + | error: found call to `str::trim` before `str::split_whitespace` --> tests/ui/trim_split_whitespace.rs:66:37 | LL | let _ = (" A B C ").to_string().trim().split_whitespace(); // should trigger lint - | ^^^^^^^ help: remove `trim()` + | ^^^^^^^ + | +help: remove `trim()` + | +LL - let _ = (" A B C ").to_string().trim().split_whitespace(); // should trigger lint +LL + let _ = (" A B C ").to_string().split_whitespace(); // should trigger lint + | error: found call to `str::trim_start` before `str::split_whitespace` --> tests/ui/trim_split_whitespace.rs:67:37 | LL | let _ = (" A B C ").to_string().trim_start().split_whitespace(); // should trigger lint - | ^^^^^^^^^^^^^ help: remove `trim_start()` + | ^^^^^^^^^^^^^ + | +help: remove `trim_start()` + | +LL - let _ = (" A B C ").to_string().trim_start().split_whitespace(); // should trigger lint +LL + let _ = (" A B C ").to_string().split_whitespace(); // should trigger lint + | error: found call to `str::trim_end` before `str::split_whitespace` --> tests/ui/trim_split_whitespace.rs:68:37 | LL | let _ = (" A B C ").to_string().trim_end().split_whitespace(); // should trigger lint - | ^^^^^^^^^^^ help: remove `trim_end()` + | ^^^^^^^^^^^ + | +help: remove `trim_end()` + | +LL - let _ = (" A B C ").to_string().trim_end().split_whitespace(); // should trigger lint +LL + let _ = (" A B C ").to_string().split_whitespace(); // should trigger lint + | error: found call to `str::trim` before `str::split_whitespace` --> tests/ui/trim_split_whitespace.rs:75:15 | LL | let _ = s.trim().split_whitespace(); // should trigger lint - | ^^^^^^^ help: remove `trim()` + | ^^^^^^^ + | +help: remove `trim()` + | +LL - let _ = s.trim().split_whitespace(); // should trigger lint +LL + let _ = s.split_whitespace(); // should trigger lint + | error: found call to `str::trim` before `str::split_whitespace` --> tests/ui/trim_split_whitespace.rs:83:15 | LL | let _ = s.trim().split_whitespace(); // should trigger lint - | ^^^^^^^ help: remove `trim()` + | ^^^^^^^ + | +help: remove `trim()` + | +LL - let _ = s.trim().split_whitespace(); // should trigger lint +LL + let _ = s.split_whitespace(); // should trigger lint + | error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/trivially_copy_pass_by_ref.stderr b/src/tools/clippy/tests/ui/trivially_copy_pass_by_ref.stderr index 4887fb00e7425..9633fb2303c98 100644 --- a/src/tools/clippy/tests/ui/trivially_copy_pass_by_ref.stderr +++ b/src/tools/clippy/tests/ui/trivially_copy_pass_by_ref.stderr @@ -2,115 +2,204 @@ error: this argument (N byte) is passed by reference, but would be more efficien --> tests/ui/trivially_copy_pass_by_ref.rs:52:11 | LL | fn bad(x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `u32` + | ^^^^ | note: the lint level is defined here --> tests/ui/trivially_copy_pass_by_ref.rs:3:9 | LL | #![deny(clippy::trivially_copy_pass_by_ref)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider passing by value instead + | +LL | fn bad(x: u32, y: &Foo, z: &Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:52:20 | LL | fn bad(x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `Foo` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad(x: &u32, y: Foo, z: &Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:52:29 | LL | fn bad(x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `Baz` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad(x: &u32, y: &Foo, z: Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:61:12 | LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} - | ^^^^^ help: consider passing by value instead: `self` + | ^^^^^ + | +help: consider passing by value instead + | +LL | fn bad(self, x: &u32, y: &Foo, z: &Baz) {} + | ~~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:61:22 | LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `u32` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad(&self, x: u32, y: &Foo, z: &Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:61:31 | LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `Foo` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad(&self, x: &u32, y: Foo, z: &Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:61:40 | LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `Baz` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad(&self, x: &u32, y: &Foo, z: Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:67:16 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `u32` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad2(x: u32, y: &Foo, z: &Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:67:25 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `Foo` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad2(x: &u32, y: Foo, z: &Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:67:34 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `Baz` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad2(x: &u32, y: &Foo, z: Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:72:35 | LL | fn bad_issue7518(self, other: &Self) {} - | ^^^^^ help: consider passing by value instead: `Self` + | ^^^^^ + | +help: consider passing by value instead + | +LL | fn bad_issue7518(self, other: Self) {} + | ~~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:85:16 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `u32` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad2(x: u32, y: &Foo, z: &Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:85:25 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `Foo` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad2(x: &u32, y: Foo, z: &Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:85:34 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} - | ^^^^ help: consider passing by value instead: `Baz` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn bad2(x: &u32, y: &Foo, z: Baz) {} + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:92:34 | LL | fn trait_method(&self, _foo: &Foo); - | ^^^^ help: consider passing by value instead: `Foo` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn trait_method(&self, _foo: Foo); + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:125:21 | LL | fn foo_never(x: &i32) { - | ^^^^ help: consider passing by value instead: `i32` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn foo_never(x: i32) { + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:131:15 | LL | fn foo(x: &i32) { - | ^^^^ help: consider passing by value instead: `i32` + | ^^^^ + | +help: consider passing by value instead + | +LL | fn foo(x: i32) { + | ~~~ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> tests/ui/trivially_copy_pass_by_ref.rs:159:37 | LL | fn _unrelated_lifetimes<'a, 'b>(_x: &'a u32, y: &'b u32) -> &'b u32 { - | ^^^^^^^ help: consider passing by value instead: `u32` + | ^^^^^^^ + | +help: consider passing by value instead + | +LL | fn _unrelated_lifetimes<'a, 'b>(_x: u32, y: &'b u32) -> &'b u32 { + | ~~~ error: aborting due to 18 previous errors diff --git a/src/tools/clippy/tests/ui/try_err.stderr b/src/tools/clippy/tests/ui/try_err.stderr index fb563d4078660..fe27a1959ae96 100644 --- a/src/tools/clippy/tests/ui/try_err.stderr +++ b/src/tools/clippy/tests/ui/try_err.stderr @@ -2,77 +2,129 @@ error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:22:9 | LL | Err(err)?; - | ^^^^^^^^^ help: try: `return Err(err)` + | ^^^^^^^^^ | note: the lint level is defined here --> tests/ui/try_err.rs:3:9 | LL | #![deny(clippy::try_err)] | ^^^^^^^^^^^^^^^ +help: try + | +LL | return Err(err); + | ~~~~~~~~~~~~~~~ error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:32:9 | LL | Err(err)?; - | ^^^^^^^^^ help: try: `return Err(err.into())` + | ^^^^^^^^^ + | +help: try + | +LL | return Err(err.into()); + | ~~~~~~~~~~~~~~~~~~~~~~ error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:52:17 | LL | Err(err)?; - | ^^^^^^^^^ help: try: `return Err(err)` + | ^^^^^^^^^ + | +help: try + | +LL | return Err(err); + | ~~~~~~~~~~~~~~~ error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:71:17 | LL | Err(err)?; - | ^^^^^^^^^ help: try: `return Err(err.into())` + | ^^^^^^^^^ + | +help: try + | +LL | return Err(err.into()); + | ~~~~~~~~~~~~~~~~~~~~~~ error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:91:23 | LL | Err(_) => Err(1)?, - | ^^^^^^^ help: try: `return Err(1)` + | ^^^^^^^ | = note: this error originates in the macro `__inline_mac_fn_calling_macro` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try + | +LL | Err(_) => return Err(1), + | ~~~~~~~~~~~~~ error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:98:23 | LL | Err(_) => Err(inline!(1))?, - | ^^^^^^^^^^^^^^^^ help: try: `return Err(inline!(1))` + | ^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `__inline_mac_fn_calling_macro` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try + | +LL | Err(_) => return Err(inline!(1)), + | ~~~~~~~~~~~~~~~~~~~~~~ error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:125:9 | LL | Err(inline!(inline!(String::from("aasdfasdfasdfa"))))?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `return Err(inline!(inline!(String::from("aasdfasdfasdfa"))))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | return Err(inline!(inline!(String::from("aasdfasdfasdfa")))); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:132:9 | LL | Err(io::ErrorKind::WriteZero)? - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `return Poll::Ready(Err(io::ErrorKind::WriteZero.into()))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | return Poll::Ready(Err(io::ErrorKind::WriteZero.into())) + | error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:134:9 | LL | Err(io::Error::new(io::ErrorKind::InvalidInput, "error"))? - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `return Poll::Ready(Err(io::Error::new(io::ErrorKind::InvalidInput, "error")))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | return Poll::Ready(Err(io::Error::new(io::ErrorKind::InvalidInput, "error"))) + | error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:142:9 | LL | Err(io::ErrorKind::NotFound)? - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `return Poll::Ready(Some(Err(io::ErrorKind::NotFound.into())))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | return Poll::Ready(Some(Err(io::ErrorKind::NotFound.into()))) + | error: returning an `Err(_)` with the `?` operator --> tests/ui/try_err.rs:151:16 | LL | return Err(42)?; - | ^^^^^^^^ help: try: `Err(42)` + | ^^^^^^^^ + | +help: try + | +LL | return Err(42); + | ~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/type_id_on_box.stderr b/src/tools/clippy/tests/ui/type_id_on_box.stderr index 4528195607dad..473a243729273 100644 --- a/src/tools/clippy/tests/ui/type_id_on_box.stderr +++ b/src/tools/clippy/tests/ui/type_id_on_box.stderr @@ -2,47 +2,55 @@ error: calling `.type_id()` on `Box` --> tests/ui/type_id_on_box.rs:31:13 | LL | let _ = any_box.type_id(); - | -------^^^^^^^^^^ - | | - | help: consider dereferencing first: `(*any_box)` + | ^^^^^^^^^^^^^^^^^ | = note: this returns the type id of the literal type `Box<_>` instead of the type id of the boxed value, which is most likely not what you want = note: if this is intentional, use `TypeId::of::>()` instead, which makes it more clear = note: `-D clippy::type-id-on-box` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::type_id_on_box)]` +help: consider dereferencing first + | +LL | let _ = (*any_box).type_id(); + | ~~~~~~~~~~ error: calling `.type_id()` on `Box` --> tests/ui/type_id_on_box.rs:40:13 | LL | let _ = any_box.type_id(); - | -------^^^^^^^^^^ - | | - | help: consider dereferencing first: `(**any_box)` + | ^^^^^^^^^^^^^^^^^ | = note: this returns the type id of the literal type `Box<_>` instead of the type id of the boxed value, which is most likely not what you want = note: if this is intentional, use `TypeId::of::>()` instead, which makes it more clear +help: consider dereferencing first + | +LL | let _ = (**any_box).type_id(); + | ~~~~~~~~~~~ error: calling `.type_id()` on `Box` --> tests/ui/type_id_on_box.rs:47:13 | LL | let _ = b.type_id(); - | -^^^^^^^^^^ - | | - | help: consider dereferencing first: `(*b)` + | ^^^^^^^^^^^ | = note: this returns the type id of the literal type `Box<_>` instead of the type id of the boxed value, which is most likely not what you want = note: if this is intentional, use `TypeId::of::>()` instead, which makes it more clear +help: consider dereferencing first + | +LL | let _ = (*b).type_id(); + | ~~~~ error: calling `.type_id()` on `Box` --> tests/ui/type_id_on_box.rs:51:13 | LL | let _ = b.type_id(); - | -^^^^^^^^^^ - | | - | help: consider dereferencing first: `(*b)` + | ^^^^^^^^^^^ | = note: this returns the type id of the literal type `Box<_>` instead of the type id of the boxed value, which is most likely not what you want = note: if this is intentional, use `TypeId::of::>()` instead, which makes it more clear +help: consider dereferencing first + | +LL | let _ = (*b).type_id(); + | ~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/types.stderr b/src/tools/clippy/tests/ui/types.stderr index 02e75018129f4..e1af212044e87 100644 --- a/src/tools/clippy/tests/ui/types.stderr +++ b/src/tools/clippy/tests/ui/types.stderr @@ -2,10 +2,14 @@ error: casting `i32` to `i64` may become silently lossy if you later change the --> tests/ui/types.rs:12:22 | LL | let c_i64: i64 = c as i64; - | ^^^^^^^^ help: try: `i64::from(c)` + | ^^^^^^^^ | = note: `-D clippy::cast-lossless` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]` +help: try + | +LL | let c_i64: i64 = i64::from(c); + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/unchecked_duration_subtraction.stderr b/src/tools/clippy/tests/ui/unchecked_duration_subtraction.stderr index b5e9bab86b478..8f8b4ab718809 100644 --- a/src/tools/clippy/tests/ui/unchecked_duration_subtraction.stderr +++ b/src/tools/clippy/tests/ui/unchecked_duration_subtraction.stderr @@ -2,28 +2,47 @@ error: unchecked subtraction of a 'Duration' from an 'Instant' --> tests/ui/unchecked_duration_subtraction.rs:9:13 | LL | let _ = _first - second; - | ^^^^^^^^^^^^^^^ help: try: `_first.checked_sub(second).unwrap()` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::unchecked-duration-subtraction` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unchecked_duration_subtraction)]` +help: try + | +LL | let _ = _first.checked_sub(second).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unchecked subtraction of a 'Duration' from an 'Instant' --> tests/ui/unchecked_duration_subtraction.rs:11:13 | LL | let _ = Instant::now() - Duration::from_secs(5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(Duration::from_secs(5)).unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = Instant::now().checked_sub(Duration::from_secs(5)).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unchecked subtraction of a 'Duration' from an 'Instant' --> tests/ui/unchecked_duration_subtraction.rs:13:13 | LL | let _ = _first - Duration::from_secs(5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `_first.checked_sub(Duration::from_secs(5)).unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = _first.checked_sub(Duration::from_secs(5)).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unchecked subtraction of a 'Duration' from an 'Instant' --> tests/ui/unchecked_duration_subtraction.rs:15:13 | LL | let _ = Instant::now() - second; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(second).unwrap()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = Instant::now().checked_sub(second).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/unicode.stderr b/src/tools/clippy/tests/ui/unicode.stderr index b004493300eed..4b188db7827e7 100644 --- a/src/tools/clippy/tests/ui/unicode.stderr +++ b/src/tools/clippy/tests/ui/unicode.stderr @@ -2,67 +2,103 @@ error: invisible character detected --> tests/ui/unicode.rs:5:12 | LL | print!("Here >​< is a ZWS, and ​another"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{200B}< is a ZWS, and \u{200B}another"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::invisible-characters` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::invisible_characters)]` +help: consider replacing the string with + | +LL | print!("Here >\u{200B}< is a ZWS, and \u{200B}another"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: invisible character detected --> tests/ui/unicode.rs:7:12 | LL | print!("Here >­< is a SHY, and ­another"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{AD}< is a SHY, and \u{AD}another"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing the string with + | +LL | print!("Here >\u{AD}< is a SHY, and \u{AD}another"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: invisible character detected --> tests/ui/unicode.rs:9:12 | LL | print!("Here >⁠< is a WJ, and ⁠another"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{2060}< is a WJ, and \u{2060}another"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider replacing the string with + | +LL | print!("Here >\u{2060}< is a WJ, and \u{2060}another"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: non-NFC Unicode sequence detected --> tests/ui/unicode.rs:15:12 | LL | print!("̀àh?"); - | ^^^^^ help: consider replacing the string with: `"̀àh?"` + | ^^^^^ | = note: `-D clippy::unicode-not-nfc` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unicode_not_nfc)]` +help: consider replacing the string with + | +LL | print!("̀àh?"); + | ~~~~~ error: literal non-ASCII character detected --> tests/ui/unicode.rs:23:16 | LL | print!("Üben!"); - | ^^^^^^^ help: consider replacing the string with: `"\u{dc}ben!"` + | ^^^^^^^ | note: the lint level is defined here --> tests/ui/unicode.rs:20:13 | LL | #![deny(clippy::non_ascii_literal)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider replacing the string with + | +LL | print!("\u{dc}ben!"); + | ~~~~~~~~~~~~ error: literal non-ASCII character detected --> tests/ui/unicode.rs:29:36 | LL | const _EMPTY_BLOCK: char = '▱'; - | ^^^ help: consider replacing the string with: `'\u{25b1}'` + | ^^^ + | +help: consider replacing the string with + | +LL | const _EMPTY_BLOCK: char = '\u{25b1}'; + | ~~~~~~~~~~ error: literal non-ASCII character detected --> tests/ui/unicode.rs:30:35 | LL | const _FULL_BLOCK: char = '▰'; - | ^^^ help: consider replacing the string with: `'\u{25b0}'` + | ^^^ + | +help: consider replacing the string with + | +LL | const _FULL_BLOCK: char = '\u{25b0}'; + | ~~~~~~~~~~ error: literal non-ASCII character detected --> tests/ui/unicode.rs:50:21 | LL | let _ = "悲しいかな、ここに日本語を書くことはできない。"; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"\u{60b2}\u{3057}\u{3044}\u{304b}\u{306a}\u{3001}\u{3053}\u{3053}\u{306b}\u{65e5}\u{672c}\u{8a9e}\u{3092}\u{66f8}\u{304f}\u{3053}\u{3068}\u{306f}\u{3067}\u{304d}\u{306a}\u{3044}\u{3002}"` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/unicode.rs:39:17 | LL | #![deny(clippy::non_ascii_literal)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider replacing the string with + | +LL | let _ = "\u{60b2}\u{3057}\u{3044}\u{304b}\u{306a}\u{3001}\u{3053}\u{3053}\u{306b}\u{65e5}\u{672c}\u{8a9e}\u{3092}\u{66f8}\u{304f}\u{3053}\u{3068}\u{306f}\u{3067}\u{304d}\u{306a}\u{3044}\u{3002}"; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/unit_arg_empty_blocks.stderr b/src/tools/clippy/tests/ui/unit_arg_empty_blocks.stderr index d971195dda265..2e5993b71ad88 100644 --- a/src/tools/clippy/tests/ui/unit_arg_empty_blocks.stderr +++ b/src/tools/clippy/tests/ui/unit_arg_empty_blocks.stderr @@ -2,20 +2,25 @@ error: passing a unit value to a function --> tests/ui/unit_arg_empty_blocks.rs:16:5 | LL | foo({}); - | ^^^^--^ - | | - | help: use a unit literal instead: `()` + | ^^^^^^^ | = note: `-D clippy::unit-arg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unit_arg)]` +help: use a unit literal instead + | +LL | foo(()); + | ~~ error: passing a unit value to a function --> tests/ui/unit_arg_empty_blocks.rs:17:5 | LL | foo3({}, 2, 2); - | ^^^^^--^^^^^^^ - | | - | help: use a unit literal instead: `()` + | ^^^^^^^^^^^^^^ + | +help: use a unit literal instead + | +LL | foo3((), 2, 2); + | ~~ error: passing unit values to a function --> tests/ui/unit_arg_empty_blocks.rs:18:5 diff --git a/src/tools/clippy/tests/ui/unit_hash.stderr b/src/tools/clippy/tests/ui/unit_hash.stderr index b48f3a543b763..f9fa5e2701e58 100644 --- a/src/tools/clippy/tests/ui/unit_hash.stderr +++ b/src/tools/clippy/tests/ui/unit_hash.stderr @@ -2,27 +2,39 @@ error: this call to `hash` on the unit type will do nothing --> tests/ui/unit_hash.rs:19:23 | LL | Foo::Empty => ().hash(&mut state), - | ^^^^^^^^^^^^^^^^^^^ help: remove the call to `hash` or consider using: `0_u8.hash(&mut state)` + | ^^^^^^^^^^^^^^^^^^^ | = note: the implementation of `Hash` for `()` is a no-op = note: `-D clippy::unit-hash` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unit_hash)]` +help: remove the call to `hash` or consider using + | +LL | Foo::Empty => 0_u8.hash(&mut state), + | ~~~~~~~~~~~~~~~~~~~~~ error: this call to `hash` on the unit type will do nothing --> tests/ui/unit_hash.rs:26:5 | LL | res.hash(&mut state); - | ^^^^^^^^^^^^^^^^^^^^ help: remove the call to `hash` or consider using: `0_u8.hash(&mut state)` + | ^^^^^^^^^^^^^^^^^^^^ | = note: the implementation of `Hash` for `()` is a no-op +help: remove the call to `hash` or consider using + | +LL | 0_u8.hash(&mut state); + | ~~~~~~~~~~~~~~~~~~~~~ error: this call to `hash` on the unit type will do nothing --> tests/ui/unit_hash.rs:31:5 | LL | do_nothing().hash(&mut state); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `hash` or consider using: `0_u8.hash(&mut state)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the implementation of `Hash` for `()` is a no-op +help: remove the call to `hash` or consider using + | +LL | 0_u8.hash(&mut state); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr b/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr index aa2c2f3c0e202..2a5c6e4884f5c 100644 --- a/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr +++ b/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr @@ -2,34 +2,58 @@ error: unknown lint: `clippy::All` --> tests/ui/unknown_clippy_lints.rs:3:10 | LL | #![allow(clippy::All)] - | ^^^^^^^^^^^ help: did you mean: `clippy::all` + | ^^^^^^^^^^^ | = note: `-D unknown-lints` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unknown_lints)]` +help: did you mean + | +LL | #![allow(clippy::all)] + | ~~~~~~~~~~~ error: unknown lint: `clippy::CMP_OWNED` --> tests/ui/unknown_clippy_lints.rs:4:9 | LL | #![warn(clippy::CMP_OWNED)] - | ^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::cmp_owned` + | ^^^^^^^^^^^^^^^^^ + | +help: did you mean + | +LL | #![warn(clippy::cmp_owned)] + | ~~~~~~~~~~~~~~~~~ error: unknown lint: `clippy::if_not_els` --> tests/ui/unknown_clippy_lints.rs:7:8 | LL | #[warn(clippy::if_not_els)] - | ^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::if_not_else` + | ^^^^^^^^^^^^^^^^^^ + | +help: did you mean + | +LL | #[warn(clippy::if_not_else)] + | ~~~~~~~~~~~~~~~~~~~ error: unknown lint: `clippy::UNNecsaRy_cAst` --> tests/ui/unknown_clippy_lints.rs:8:8 | LL | #[warn(clippy::UNNecsaRy_cAst)] - | ^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::unnecessary_cast` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean + | +LL | #[warn(clippy::unnecessary_cast)] + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: unknown lint: `clippy::useles_transute` --> tests/ui/unknown_clippy_lints.rs:9:8 | LL | #[warn(clippy::useles_transute)] - | ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::useless_transmute` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean + | +LL | #[warn(clippy::useless_transmute)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: unknown lint: `clippy::dead_cod` --> tests/ui/unknown_clippy_lints.rs:11:8 @@ -46,13 +70,23 @@ error: unknown lint: `clippy::unused_colle` --> tests/ui/unknown_clippy_lints.rs:13:8 | LL | #[warn(clippy::unused_colle)] - | ^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::unused_self` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean + | +LL | #[warn(clippy::unused_self)] + | ~~~~~~~~~~~~~~~~~~~ error: unknown lint: `clippy::const_static_lifetim` --> tests/ui/unknown_clippy_lints.rs:15:8 | LL | #[warn(clippy::const_static_lifetim)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::redundant_static_lifetimes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean + | +LL | #[warn(clippy::redundant_static_lifetimes)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unknown lint: `clippy::missing_docs` --> tests/ui/unknown_clippy_lints.rs:17:8 diff --git a/src/tools/clippy/tests/ui/unnecessary_box_returns.stderr b/src/tools/clippy/tests/ui/unnecessary_box_returns.stderr index cb88ba1b0016d..d53cfc0e8a610 100644 --- a/src/tools/clippy/tests/ui/unnecessary_box_returns.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_box_returns.stderr @@ -2,35 +2,51 @@ error: boxed return of the sized type `usize` --> tests/ui/unnecessary_box_returns.rs:5:22 | LL | fn baz(&self) -> Box; - | ^^^^^^^^^^ help: try: `usize` + | ^^^^^^^^^^ | = help: changing this also requires a change to the return expressions in this function = note: `-D clippy::unnecessary-box-returns` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_box_returns)]` +help: try + | +LL | fn baz(&self) -> usize; + | ~~~~~ error: boxed return of the sized type `usize` --> tests/ui/unnecessary_box_returns.rs:19:22 | LL | fn baz(&self) -> Box { - | ^^^^^^^^^^ help: try: `usize` + | ^^^^^^^^^^ | = help: changing this also requires a change to the return expressions in this function +help: try + | +LL | fn baz(&self) -> usize { + | ~~~~~ error: boxed return of the sized type `usize` --> tests/ui/unnecessary_box_returns.rs:27:20 | LL | fn bxed_usize() -> Box { - | ^^^^^^^^^^ help: try: `usize` + | ^^^^^^^^^^ | = help: changing this also requires a change to the return expressions in this function +help: try + | +LL | fn bxed_usize() -> usize { + | ~~~~~ error: boxed return of the sized type `Foo` --> tests/ui/unnecessary_box_returns.rs:33:19 | LL | fn _bxed_foo() -> Box { - | ^^^^^^^^ help: try: `Foo` + | ^^^^^^^^ | = help: changing this also requires a change to the return expressions in this function +help: try + | +LL | fn _bxed_foo() -> Foo { + | ~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_cast.stderr b/src/tools/clippy/tests/ui/unnecessary_cast.stderr index 80fd5c13d8185..7a63ace7f0df8 100644 --- a/src/tools/clippy/tests/ui/unnecessary_cast.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_cast.stderr @@ -2,250 +2,454 @@ error: casting raw pointers to the same type and constness is unnecessary (`*con --> tests/ui/unnecessary_cast.rs:19:5 | LL | ptr as *const T - | ^^^^^^^^^^^^^^^ help: try: `ptr` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-cast` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_cast)]` +help: try + | +LL | ptr + | error: casting integer literal to `i32` is unnecessary --> tests/ui/unnecessary_cast.rs:54:5 | LL | 1i32 as i32; - | ^^^^^^^^^^^ help: try: `1_i32` + | ^^^^^^^^^^^ + | +help: try + | +LL | 1_i32; + | ~~~~~ error: casting float literal to `f32` is unnecessary --> tests/ui/unnecessary_cast.rs:55:5 | LL | 1f32 as f32; - | ^^^^^^^^^^^ help: try: `1_f32` + | ^^^^^^^^^^^ + | +help: try + | +LL | 1_f32; + | ~~~~~ error: casting to the same type is unnecessary (`bool` -> `bool`) --> tests/ui/unnecessary_cast.rs:56:5 | LL | false as bool; - | ^^^^^^^^^^^^^ help: try: `false` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | false; + | ~~~~~ error: casting integer literal to `i32` is unnecessary --> tests/ui/unnecessary_cast.rs:59:5 | LL | -1_i32 as i32; - | ^^^^^^^^^^^^^ help: try: `-1_i32` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | -1_i32; + | ~~~~~~ error: casting integer literal to `i32` is unnecessary --> tests/ui/unnecessary_cast.rs:60:5 | LL | - 1_i32 as i32; - | ^^^^^^^^^^^^^^ help: try: `- 1_i32` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | - 1_i32; + | ~~~~~~~ error: casting float literal to `f32` is unnecessary --> tests/ui/unnecessary_cast.rs:61:5 | LL | -1f32 as f32; - | ^^^^^^^^^^^^ help: try: `-1_f32` + | ^^^^^^^^^^^^ + | +help: try + | +LL | -1_f32; + | ~~~~~~ error: casting integer literal to `i32` is unnecessary --> tests/ui/unnecessary_cast.rs:62:5 | LL | 1_i32 as i32; - | ^^^^^^^^^^^^ help: try: `1_i32` + | ^^^^^^^^^^^^ + | +help: try + | +LL | 1_i32; + | ~~~~~ error: casting float literal to `f32` is unnecessary --> tests/ui/unnecessary_cast.rs:63:5 | LL | 1_f32 as f32; - | ^^^^^^^^^^^^ help: try: `1_f32` + | ^^^^^^^^^^^^ + | +help: try + | +LL | 1_f32; + | ~~~~~ error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`) --> tests/ui/unnecessary_cast.rs:65:22 | LL | let _: *mut u8 = [1u8, 2].as_ptr() as *const u8 as *mut u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: *mut u8 = [1u8, 2].as_ptr() as *mut u8; + | ~~~~~~~~~~~~~~~~~ error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`) --> tests/ui/unnecessary_cast.rs:67:5 | LL | [1u8, 2].as_ptr() as *const u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | [1u8, 2].as_ptr(); + | ~~~~~~~~~~~~~~~~~ error: casting raw pointers to the same type and constness is unnecessary (`*mut u8` -> `*mut u8`) --> tests/ui/unnecessary_cast.rs:69:5 | LL | [1u8, 2].as_mut_ptr() as *mut u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_mut_ptr()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | [1u8, 2].as_mut_ptr(); + | ~~~~~~~~~~~~~~~~~~~~~ error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`) --> tests/ui/unnecessary_cast.rs:80:5 | LL | owo::([1u32].as_ptr()) as *const u32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `owo::([1u32].as_ptr())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | owo::([1u32].as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`) --> tests/ui/unnecessary_cast.rs:81:5 | LL | uwu::([1u32].as_ptr()) as *const u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::([1u32].as_ptr())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | uwu::([1u32].as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`) --> tests/ui/unnecessary_cast.rs:83:5 | LL | uwu::([1u32].as_ptr()) as *const u32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::([1u32].as_ptr())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | uwu::([1u32].as_ptr()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: casting to the same type is unnecessary (`u32` -> `u32`) --> tests/ui/unnecessary_cast.rs:118:5 | LL | aaa() as u32; - | ^^^^^^^^^^^^ help: try: `aaa()` + | ^^^^^^^^^^^^ + | +help: try + | +LL | aaa(); + | ~~~~~ error: casting to the same type is unnecessary (`u32` -> `u32`) --> tests/ui/unnecessary_cast.rs:120:5 | LL | aaa() as u32; - | ^^^^^^^^^^^^ help: try: `aaa()` + | ^^^^^^^^^^^^ + | +help: try + | +LL | aaa(); + | ~~~~~ error: casting integer literal to `f32` is unnecessary --> tests/ui/unnecessary_cast.rs:156:9 | LL | 100 as f32; - | ^^^^^^^^^^ help: try: `100_f32` + | ^^^^^^^^^^ + | +help: try + | +LL | 100_f32; + | ~~~~~~~ error: casting integer literal to `f64` is unnecessary --> tests/ui/unnecessary_cast.rs:157:9 | LL | 100 as f64; - | ^^^^^^^^^^ help: try: `100_f64` + | ^^^^^^^^^^ + | +help: try + | +LL | 100_f64; + | ~~~~~~~ error: casting integer literal to `f64` is unnecessary --> tests/ui/unnecessary_cast.rs:158:9 | LL | 100_i32 as f64; - | ^^^^^^^^^^^^^^ help: try: `100_f64` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | 100_f64; + | ~~~~~~~ error: casting integer literal to `f32` is unnecessary --> tests/ui/unnecessary_cast.rs:159:17 | LL | let _ = -100 as f32; - | ^^^^^^^^^^^ help: try: `-100_f32` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = -100_f32; + | ~~~~~~~~ error: casting integer literal to `f64` is unnecessary --> tests/ui/unnecessary_cast.rs:160:17 | LL | let _ = -100 as f64; - | ^^^^^^^^^^^ help: try: `-100_f64` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = -100_f64; + | ~~~~~~~~ error: casting integer literal to `f64` is unnecessary --> tests/ui/unnecessary_cast.rs:161:17 | LL | let _ = -100_i32 as f64; - | ^^^^^^^^^^^^^^^ help: try: `-100_f64` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = -100_f64; + | ~~~~~~~~ error: casting float literal to `f32` is unnecessary --> tests/ui/unnecessary_cast.rs:162:9 | LL | 100. as f32; - | ^^^^^^^^^^^ help: try: `100_f32` + | ^^^^^^^^^^^ + | +help: try + | +LL | 100_f32; + | ~~~~~~~ error: casting float literal to `f64` is unnecessary --> tests/ui/unnecessary_cast.rs:163:9 | LL | 100. as f64; - | ^^^^^^^^^^^ help: try: `100_f64` + | ^^^^^^^^^^^ + | +help: try + | +LL | 100_f64; + | ~~~~~~~ error: casting integer literal to `u32` is unnecessary --> tests/ui/unnecessary_cast.rs:175:9 | LL | 1 as u32; - | ^^^^^^^^ help: try: `1_u32` + | ^^^^^^^^ + | +help: try + | +LL | 1_u32; + | ~~~~~ error: casting integer literal to `i32` is unnecessary --> tests/ui/unnecessary_cast.rs:176:9 | LL | 0x10 as i32; - | ^^^^^^^^^^^ help: try: `0x10_i32` + | ^^^^^^^^^^^ + | +help: try + | +LL | 0x10_i32; + | ~~~~~~~~ error: casting integer literal to `usize` is unnecessary --> tests/ui/unnecessary_cast.rs:177:9 | LL | 0b10 as usize; - | ^^^^^^^^^^^^^ help: try: `0b10_usize` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | 0b10_usize; + | ~~~~~~~~~~ error: casting integer literal to `u16` is unnecessary --> tests/ui/unnecessary_cast.rs:178:9 | LL | 0o73 as u16; - | ^^^^^^^^^^^ help: try: `0o73_u16` + | ^^^^^^^^^^^ + | +help: try + | +LL | 0o73_u16; + | ~~~~~~~~ error: casting integer literal to `u32` is unnecessary --> tests/ui/unnecessary_cast.rs:179:9 | LL | 1_000_000_000 as u32; - | ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | 1_000_000_000_u32; + | ~~~~~~~~~~~~~~~~~ error: casting float literal to `f64` is unnecessary --> tests/ui/unnecessary_cast.rs:181:9 | LL | 1.0 as f64; - | ^^^^^^^^^^ help: try: `1.0_f64` + | ^^^^^^^^^^ + | +help: try + | +LL | 1.0_f64; + | ~~~~~~~ error: casting float literal to `f32` is unnecessary --> tests/ui/unnecessary_cast.rs:182:9 | LL | 0.5 as f32; - | ^^^^^^^^^^ help: try: `0.5_f32` + | ^^^^^^^^^^ + | +help: try + | +LL | 0.5_f32; + | ~~~~~~~ error: casting integer literal to `i32` is unnecessary --> tests/ui/unnecessary_cast.rs:186:17 | LL | let _ = -1 as i32; - | ^^^^^^^^^ help: try: `-1_i32` + | ^^^^^^^^^ + | +help: try + | +LL | let _ = -1_i32; + | ~~~~~~ error: casting float literal to `f32` is unnecessary --> tests/ui/unnecessary_cast.rs:187:17 | LL | let _ = -1.0 as f32; - | ^^^^^^^^^^^ help: try: `-1.0_f32` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = -1.0_f32; + | ~~~~~~~~ error: casting to the same type is unnecessary (`i32` -> `i32`) --> tests/ui/unnecessary_cast.rs:193:18 | LL | let _ = &(x as i32); - | ^^^^^^^^^^ help: try: `{ x }` + | ^^^^^^^^^^ + | +help: try + | +LL | let _ = &{ x }; + | ~~~~~ error: casting integer literal to `i32` is unnecessary --> tests/ui/unnecessary_cast.rs:199:22 | LL | let _: i32 = -(1) as i32; - | ^^^^^^^^^^^ help: try: `-1_i32` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _: i32 = -1_i32; + | ~~~~~~ error: casting integer literal to `i64` is unnecessary --> tests/ui/unnecessary_cast.rs:201:22 | LL | let _: i64 = -(1) as i64; - | ^^^^^^^^^^^ help: try: `-1_i64` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _: i64 = -1_i64; + | ~~~~~~ error: casting float literal to `f64` is unnecessary --> tests/ui/unnecessary_cast.rs:208:22 | LL | let _: f64 = (-8.0 as f64).exp(); - | ^^^^^^^^^^^^^ help: try: `(-8.0_f64)` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let _: f64 = (-8.0_f64).exp(); + | ~~~~~~~~~~ error: casting float literal to `f64` is unnecessary --> tests/ui/unnecessary_cast.rs:210:23 | LL | let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior - | ^^^^^^^^^^^^ help: try: `8.0_f64` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _: f64 = -8.0_f64.exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior + | ~~~~~~~ error: casting to the same type is unnecessary (`f32` -> `f32`) --> tests/ui/unnecessary_cast.rs:218:20 | LL | let _num = foo() as f32; - | ^^^^^^^^^^^^ help: try: `foo()` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _num = foo(); + | ~~~~~ error: casting to the same type is unnecessary (`usize` -> `usize`) --> tests/ui/unnecessary_cast.rs:228:9 | LL | (*x as usize).pow(2) - | ^^^^^^^^^^^^^ help: try: `{ *x }` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | { *x }.pow(2) + | ~~~~~~ error: aborting due to 41 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_cast_unfixable.stderr b/src/tools/clippy/tests/ui/unnecessary_cast_unfixable.stderr index cafaffeae6c36..c24e63de80435 100644 --- a/src/tools/clippy/tests/ui/unnecessary_cast_unfixable.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_cast_unfixable.stderr @@ -2,16 +2,25 @@ error: casting raw pointers to the same type and constness is unnecessary (`*con --> tests/ui/unnecessary_cast_unfixable.rs:4:13 | LL | let _ = std::ptr::null() as *const u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::null()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-cast` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_cast)]` +help: try + | +LL | let _ = std::ptr::null(); + | ~~~~~~~~~~~~~~~~ error: casting raw pointers to the same type and constness is unnecessary (`*mut issue11113::Vtbl` -> `*mut issue11113::Vtbl`) --> tests/ui/unnecessary_cast_unfixable.rs:21:16 | LL | ((*(*(self.object as *mut *mut _) as *mut Vtbl)).query)() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `*(self.object as *mut *mut _)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | ((**(self.object as *mut *mut _)).query)() + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.stderr b/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.stderr index 01f842a657de5..b1e43fd550050 100644 --- a/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.stderr @@ -2,10 +2,14 @@ error: no need to put clippy lints behind a `clippy` cfg --> tests/ui/unnecessary_clippy_cfg.rs:4:1 | LL | #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#![deny(clippy::non_minimal_cfg)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-clippy-cfg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_clippy_cfg)]` +help: replace with + | +LL | #![deny(clippy::non_minimal_cfg)] + | error: no need to put clippy lints behind a `clippy` cfg --> tests/ui/unnecessary_clippy_cfg.rs:6:37 @@ -27,13 +31,23 @@ error: no need to put clippy lints behind a `clippy` cfg --> tests/ui/unnecessary_clippy_cfg.rs:10:1 | LL | #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#![deny(clippy::non_minimal_cfg)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | #![deny(clippy::non_minimal_cfg)] + | error: no need to put clippy lints behind a `clippy` cfg --> tests/ui/unnecessary_clippy_cfg.rs:13:1 | LL | #[cfg_attr(clippy, deny(clippy::non_minimal_cfg))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#[deny(clippy::non_minimal_cfg)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | #[deny(clippy::non_minimal_cfg)] + | error: no need to put clippy lints behind a `clippy` cfg --> tests/ui/unnecessary_clippy_cfg.rs:15:36 @@ -55,7 +69,12 @@ error: no need to put clippy lints behind a `clippy` cfg --> tests/ui/unnecessary_clippy_cfg.rs:19:1 | LL | #[cfg_attr(clippy, deny(clippy::non_minimal_cfg))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#[deny(clippy::non_minimal_cfg)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | #[deny(clippy::non_minimal_cfg)] + | error: duplicated attribute --> tests/ui/unnecessary_clippy_cfg.rs:8:26 diff --git a/src/tools/clippy/tests/ui/unnecessary_clone.stderr b/src/tools/clippy/tests/ui/unnecessary_clone.stderr index e34a387c77e2e..293a3fd72ce50 100644 --- a/src/tools/clippy/tests/ui/unnecessary_clone.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_clone.stderr @@ -2,61 +2,104 @@ error: using `.clone()` on a ref-counted pointer --> tests/ui/unnecessary_clone.rs:23:5 | LL | rc.clone(); - | ^^^^^^^^^^ help: try: `Rc::::clone(&rc)` + | ^^^^^^^^^^ | = note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::clone_on_ref_ptr)]` +help: try + | +LL | Rc::::clone(&rc); + | ~~~~~~~~~~~~~~~~~~~~~~ error: using `.clone()` on a ref-counted pointer --> tests/ui/unnecessary_clone.rs:28:5 | LL | arc.clone(); - | ^^^^^^^^^^^ help: try: `Arc::::clone(&arc)` + | ^^^^^^^^^^^ + | +help: try + | +LL | Arc::::clone(&arc); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: using `.clone()` on a ref-counted pointer --> tests/ui/unnecessary_clone.rs:32:5 | LL | rcweak.clone(); - | ^^^^^^^^^^^^^^ help: try: `Weak::::clone(&rcweak)` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | Weak::::clone(&rcweak); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: using `.clone()` on a ref-counted pointer --> tests/ui/unnecessary_clone.rs:36:5 | LL | arc_weak.clone(); - | ^^^^^^^^^^^^^^^^ help: try: `Weak::::clone(&arc_weak)` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Weak::::clone(&arc_weak); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: using `.clone()` on a ref-counted pointer --> tests/ui/unnecessary_clone.rs:41:33 | LL | let _: Arc = x.clone(); - | ^^^^^^^^^ help: try: `Arc::::clone(&x)` + | ^^^^^^^^^ + | +help: try + | +LL | let _: Arc = Arc::::clone(&x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: using `clone` on type `T` which implements the `Copy` trait --> tests/ui/unnecessary_clone.rs:46:5 | LL | t.clone(); - | ^^^^^^^^^ help: try removing the `clone` call: `t` + | ^^^^^^^^^ | = note: `-D clippy::clone-on-copy` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::clone_on_copy)]` +help: try removing the `clone` call + | +LL | t; + | ~ error: using `clone` on type `Option` which implements the `Copy` trait --> tests/ui/unnecessary_clone.rs:50:5 | LL | Some(t).clone(); - | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)` + | ^^^^^^^^^^^^^^^ + | +help: try removing the `clone` call + | +LL | Some(t); + | ~~~~~~~ error: using `clone` on type `E` which implements the `Copy` trait --> tests/ui/unnecessary_clone.rs:85:20 | LL | let _: E = a.clone(); - | ^^^^^^^^^ help: try dereferencing it: `*****a` + | ^^^^^^^^^ + | +help: try dereferencing it + | +LL | let _: E = *****a; + | ~~~~~~ error: using `.clone()` on a ref-counted pointer --> tests/ui/unnecessary_clone.rs:105:14 | LL | Some(try_opt!(Some(rc)).clone()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Rc::::clone(&try_opt!(Some(rc)))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Some(Rc::::clone(&try_opt!(Some(rc)))) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_fallible_conversions_unfixable.stderr b/src/tools/clippy/tests/ui/unnecessary_fallible_conversions_unfixable.stderr index 43d0cde9399f0..84c1af79cf4ae 100644 --- a/src/tools/clippy/tests/ui/unnecessary_fallible_conversions_unfixable.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_fallible_conversions_unfixable.stderr @@ -2,51 +2,75 @@ error: use of a fallible conversion when an infallible one could be used --> tests/ui/unnecessary_fallible_conversions_unfixable.rs:27:34 | LL | let _: Result = 0i64.try_into(); - | ^^^^^^^^ help: use: `into` + | ^^^^^^^^ | = note: converting `i64` to `Foo` cannot fail = note: `-D clippy::unnecessary-fallible-conversions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_fallible_conversions)]` +help: use + | +LL | let _: Result = 0i64.into(); + | ~~~~ error: use of a fallible conversion when an infallible one could be used --> tests/ui/unnecessary_fallible_conversions_unfixable.rs:29:29 | LL | let _: Result = i64::try_into(0i64); - | ^^^^^^^^^^^^^ help: use: `Into::into` + | ^^^^^^^^^^^^^ | = note: converting `i64` to `Foo` cannot fail +help: use + | +LL | let _: Result = Into::into(0i64); + | ~~~~~~~~~~ error: use of a fallible conversion when an infallible one could be used --> tests/ui/unnecessary_fallible_conversions_unfixable.rs:31:29 | LL | let _: Result = Foo::try_from(0i64); - | ^^^^^^^^^^^^^ help: use: `From::from` + | ^^^^^^^^^^^^^ | = note: converting `i64` to `Foo` cannot fail +help: use + | +LL | let _: Result = From::from(0i64); + | ~~~~~~~~~~ error: use of a fallible conversion when an infallible one could be used --> tests/ui/unnecessary_fallible_conversions_unfixable.rs:34:34 | LL | let _: Result = 0i32.try_into(); - | ^^^^^^^^ help: use: `into` + | ^^^^^^^^ | = note: converting `i32` to `i64` cannot fail +help: use + | +LL | let _: Result = 0i32.into(); + | ~~~~ error: use of a fallible conversion when an infallible one could be used --> tests/ui/unnecessary_fallible_conversions_unfixable.rs:36:29 | LL | let _: Result = i32::try_into(0i32); - | ^^^^^^^^^^^^^ help: use: `Into::into` + | ^^^^^^^^^^^^^ | = note: converting `i32` to `i64` cannot fail +help: use + | +LL | let _: Result = Into::into(0i32); + | ~~~~~~~~~~ error: use of a fallible conversion when an infallible one could be used --> tests/ui/unnecessary_fallible_conversions_unfixable.rs:38:29 | LL | let _: Result = <_>::try_from(0i32); - | ^^^^^^^^^^^^^ help: use: `From::from` + | ^^^^^^^^^^^^^ | = note: converting `i32` to `i64` cannot fail +help: use + | +LL | let _: Result = From::from(0i32); + | ~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_fold.stderr b/src/tools/clippy/tests/ui/unnecessary_fold.stderr index 31abab62f4c60..ced893c547800 100644 --- a/src/tools/clippy/tests/ui/unnecessary_fold.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_fold.stderr @@ -2,103 +2,181 @@ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:10:20 | LL | 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` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_fold)]` +help: try + | +LL | let _ = (0..3).any(|x| x > 2); + | ~~~~~~~~~~~~~~ error: redundant closure --> tests/ui/unnecessary_fold.rs:12:32 | LL | let _ = (0..3).fold(false, |acc, x| is_any(acc, x)); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `is_any` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::redundant-closure` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]` +help: replace the closure with the function itself + | +LL | let _ = (0..3).fold(false, is_any); + | ~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:14:20 | LL | let _ = (0..3).fold(true, |acc, x| acc && x > 2); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `all(|x| x > 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = (0..3).all(|x| x > 2); + | ~~~~~~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:16:25 | LL | let _: i32 = (0..3).fold(0, |acc, x| acc + x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: i32 = (0..3).sum(); + | ~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:18:25 | LL | let _: i32 = (0..3).fold(1, |acc, x| acc * x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: i32 = (0..3).product(); + | ~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:23:41 | LL | let _: bool = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: bool = (0..3).map(|x| 2 * x).any(|x| x > 2); + | ~~~~~~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:53:10 | LL | .fold(false, |acc, x| acc || x > 2); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | .any(|x| x > 2); + | ~~~~~~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:64:33 | LL | assert_eq!(map.values().fold(0, |x, y| x + y), 0); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | assert_eq!(map.values().sum::(), 0); + | ~~~~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:67:30 | LL | let _ = map.values().fold(0, |x, y| x + y); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().sum::(); + | ~~~~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:68:30 | LL | let _ = map.values().fold(1, |x, y| x * y); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = map.values().product::(); + | ~~~~~~~~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:69:35 | LL | let _: i32 = map.values().fold(0, |x, y| x + y); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: i32 = map.values().sum(); + | ~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:70:35 | LL | let _: i32 = map.values().fold(1, |x, y| x * y); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _: i32 = map.values().product(); + | ~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:71:31 | LL | anything(map.values().fold(0, |x, y| x + y)); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | anything(map.values().sum::()); + | ~~~~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:72:31 | LL | anything(map.values().fold(1, |x, y| x * y)); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | anything(map.values().product::()); + | ~~~~~~~~~~~~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:73:26 | LL | num(map.values().fold(0, |x, y| x + y)); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | num(map.values().sum()); + | ~~~~~ error: this `.fold` can be written more succinctly using another method --> tests/ui/unnecessary_fold.rs:74:26 | LL | num(map.values().fold(1, |x, y| x * y)); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | num(map.values().product()); + | ~~~~~~~~~ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_get_then_check.stderr b/src/tools/clippy/tests/ui/unnecessary_get_then_check.stderr index 0477c03d16dd9..1f856259423c0 100644 --- a/src/tools/clippy/tests/ui/unnecessary_get_then_check.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_get_then_check.stderr @@ -2,74 +2,113 @@ error: unnecessary use of `get("a").is_some()` --> tests/ui/unnecessary_get_then_check.rs:7:15 | LL | let _ = s.get("a").is_some(); - | ^^^^^^^^^^^^^^^^^^ help: replace it with: `contains("a")` + | ^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-get-then-check` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_get_then_check)]` +help: replace it with + | +LL | let _ = s.contains("a"); + | ~~~~~~~~~~~~~ error: unnecessary use of `get("a").is_none()` --> tests/ui/unnecessary_get_then_check.rs:8:15 | LL | let _ = s.get("a").is_none(); - | --^^^^^^^^^^^^^^^^^^ - | | - | help: replace it with: `!s.contains("a")` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = !s.contains("a"); + | ~~~~~~~~~~~~~~~~ error: unnecessary use of `get("a").is_some()` --> tests/ui/unnecessary_get_then_check.rs:11:15 | LL | let _ = s.get("a").is_some(); - | ^^^^^^^^^^^^^^^^^^ help: replace it with: `contains_key("a")` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = s.contains_key("a"); + | ~~~~~~~~~~~~~~~~~ error: unnecessary use of `get("a").is_none()` --> tests/ui/unnecessary_get_then_check.rs:12:15 | LL | let _ = s.get("a").is_none(); - | --^^^^^^^^^^^^^^^^^^ - | | - | help: replace it with: `!s.contains_key("a")` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = !s.contains_key("a"); + | ~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `get("a").is_some()` --> tests/ui/unnecessary_get_then_check.rs:15:15 | LL | let _ = s.get("a").is_some(); - | ^^^^^^^^^^^^^^^^^^ help: replace it with: `contains("a")` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = s.contains("a"); + | ~~~~~~~~~~~~~ error: unnecessary use of `get("a").is_none()` --> tests/ui/unnecessary_get_then_check.rs:16:15 | LL | let _ = s.get("a").is_none(); - | --^^^^^^^^^^^^^^^^^^ - | | - | help: replace it with: `!s.contains("a")` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = !s.contains("a"); + | ~~~~~~~~~~~~~~~~ error: unnecessary use of `get("a").is_some()` --> tests/ui/unnecessary_get_then_check.rs:19:15 | LL | let _ = s.get("a").is_some(); - | ^^^^^^^^^^^^^^^^^^ help: replace it with: `contains_key("a")` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = s.contains_key("a"); + | ~~~~~~~~~~~~~~~~~ error: unnecessary use of `get("a").is_none()` --> tests/ui/unnecessary_get_then_check.rs:20:15 | LL | let _ = s.get("a").is_none(); - | --^^^^^^^^^^^^^^^^^^ - | | - | help: replace it with: `!s.contains_key("a")` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = !s.contains_key("a"); + | ~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `get::("a").is_some()` --> tests/ui/unnecessary_get_then_check.rs:24:15 | LL | let _ = s.get::("a").is_some(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `contains::("a")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = s.contains::("a"); + | ~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `get::("a").is_none()` --> tests/ui/unnecessary_get_then_check.rs:25:15 | LL | let _ = s.get::("a").is_none(); - | --^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: replace it with: `!s.contains::("a")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | let _ = !s.contains::("a"); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_iter_cloned.stderr b/src/tools/clippy/tests/ui/unnecessary_iter_cloned.stderr index 0bdb37a521fca..c1ccda5dbe42d 100644 --- a/src/tools/clippy/tests/ui/unnecessary_iter_cloned.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_iter_cloned.stderr @@ -36,7 +36,12 @@ error: unnecessary use of `cloned` --> tests/ui/unnecessary_iter_cloned.rs:177:18 | LL | for c in v.iter().cloned() { - | ^^^^^^^^^^^^^^^^^ help: use: `v.iter()` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | for c in v.iter() { + | ~~~~~~~~ error: unnecessary use of `cloned` --> tests/ui/unnecessary_iter_cloned.rs:185:18 diff --git a/src/tools/clippy/tests/ui/unnecessary_join.stderr b/src/tools/clippy/tests/ui/unnecessary_join.stderr index a06a1059033b7..8e01653f2a198 100644 --- a/src/tools/clippy/tests/ui/unnecessary_join.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_join.stderr @@ -4,10 +4,14 @@ error: called `.collect::>().join("")` on an iterator LL | .collect::>() | __________^ LL | | .join(""); - | |_________________^ help: consider using: `collect::()` + | |_________________^ | = note: `-D clippy::unnecessary-join` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_join)]` +help: consider using + | +LL | .collect::(); + | ~~~~~~~~~~~~~~~~~~~ error: called `.collect::>().join("")` on an iterator --> tests/ui/unnecessary_join.rs:19:10 @@ -15,7 +19,12 @@ error: called `.collect::>().join("")` on an iterator LL | .collect::>() | __________^ LL | | .join(""); - | |_________________^ help: consider using: `collect::()` + | |_________________^ + | +help: consider using + | +LL | .collect::(); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr b/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr index fcd60f48bccdd..8b76ee75b93fe 100644 --- a/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr @@ -2,316 +2,432 @@ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:83:13 | LL | let _ = opt.unwrap_or_else(|| 2); - | ^^^^-------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_lazy_evaluations)]` +help: use `unwrap_or(..)` instead + | +LL | let _ = opt.unwrap_or(2); + | ~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:84:13 | LL | let _ = opt.unwrap_or_else(|| astronomers_pi); - | ^^^^--------------------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(astronomers_pi)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = opt.unwrap_or(astronomers_pi); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:85:13 | LL | let _ = opt.unwrap_or_else(|| ext_str.some_field); - | ^^^^------------------------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(ext_str.some_field)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = opt.unwrap_or(ext_str.some_field); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:87:13 | LL | let _ = opt.and_then(|_| ext_opt); - | ^^^^--------------------- - | | - | help: use `and(..)` instead: `and(ext_opt)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `and(..)` instead + | +LL | let _ = opt.and(ext_opt); + | ~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:88:13 | LL | let _ = opt.or_else(|| ext_opt); - | ^^^^------------------- - | | - | help: use `or(..)` instead: `or(ext_opt)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _ = opt.or(ext_opt); + | ~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:89:13 | LL | let _ = opt.or_else(|| None); - | ^^^^---------------- - | | - | help: use `or(..)` instead: `or(None)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _ = opt.or(None); + | ~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:90:13 | LL | let _ = opt.get_or_insert_with(|| 2); - | ^^^^------------------------ - | | - | help: use `get_or_insert(..)` instead: `get_or_insert(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `get_or_insert(..)` instead + | +LL | let _ = opt.get_or_insert(2); + | ~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:91:13 | LL | let _ = opt.ok_or_else(|| 2); - | ^^^^---------------- - | | - | help: use `ok_or(..)` instead: `ok_or(2)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use `ok_or(..)` instead + | +LL | let _ = opt.ok_or(2); + | ~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:92:13 | LL | let _ = nested_tuple_opt.unwrap_or_else(|| Some((1, 2))); - | ^^^^^^^^^^^^^^^^^------------------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(Some((1, 2)))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = nested_tuple_opt.unwrap_or(Some((1, 2))); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:93:13 | LL | let _ = cond.then(|| astronomers_pi); - | ^^^^^----------------------- - | | - | help: use `then_some(..)` instead: `then_some(astronomers_pi)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _ = cond.then_some(astronomers_pi); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:94:13 | LL | let _ = true.then(|| -> _ {}); - | ^^^^^---------------- - | | - | help: use `then_some(..)` instead: `then_some({})` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _ = true.then_some({}); + | ~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:95:13 | LL | let _ = true.then(|| {}); - | ^^^^^----------- - | | - | help: use `then_some(..)` instead: `then_some({})` + | ^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _ = true.then_some({}); + | ~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:99:13 | LL | let _ = Some(1).unwrap_or_else(|| *r); - | ^^^^^^^^--------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(*r)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = Some(1).unwrap_or(*r); + | ~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:101:13 | LL | let _ = Some(1).unwrap_or_else(|| *b); - | ^^^^^^^^--------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(*b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = Some(1).unwrap_or(*b); + | ~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:103:13 | LL | let _ = Some(1).as_ref().unwrap_or_else(|| &r); - | ^^^^^^^^^^^^^^^^^--------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(&r)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = Some(1).as_ref().unwrap_or(&r); + | ~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:104:13 | LL | let _ = Some(1).as_ref().unwrap_or_else(|| &b); - | ^^^^^^^^^^^^^^^^^--------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(&b)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = Some(1).as_ref().unwrap_or(&b); + | ~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:107:13 | LL | let _ = Some(10).unwrap_or_else(|| 2); - | ^^^^^^^^^-------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = Some(10).unwrap_or(2); + | ~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:108:13 | LL | let _ = Some(10).and_then(|_| ext_opt); - | ^^^^^^^^^--------------------- - | | - | help: use `and(..)` instead: `and(ext_opt)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `and(..)` instead + | +LL | let _ = Some(10).and(ext_opt); + | ~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:109:28 | LL | let _: Option = None.or_else(|| ext_opt); - | ^^^^^------------------- - | | - | help: use `or(..)` instead: `or(ext_opt)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _: Option = None.or(ext_opt); + | ~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:110:13 | LL | let _ = None.get_or_insert_with(|| 2); - | ^^^^^------------------------ - | | - | help: use `get_or_insert(..)` instead: `get_or_insert(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `get_or_insert(..)` instead + | +LL | let _ = None.get_or_insert(2); + | ~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:111:35 | LL | let _: Result = None.ok_or_else(|| 2); - | ^^^^^---------------- - | | - | help: use `ok_or(..)` instead: `ok_or(2)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `ok_or(..)` instead + | +LL | let _: Result = None.ok_or(2); + | ~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:112:28 | LL | let _: Option = None.or_else(|| None); - | ^^^^^---------------- - | | - | help: use `or(..)` instead: `or(None)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _: Option = None.or(None); + | ~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:115:13 | LL | let _ = deep.0.unwrap_or_else(|| 2); - | ^^^^^^^-------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = deep.0.unwrap_or(2); + | ~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:116:13 | LL | let _ = deep.0.and_then(|_| ext_opt); - | ^^^^^^^--------------------- - | | - | help: use `and(..)` instead: `and(ext_opt)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `and(..)` instead + | +LL | let _ = deep.0.and(ext_opt); + | ~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:117:13 | LL | let _ = deep.0.or_else(|| None); - | ^^^^^^^---------------- - | | - | help: use `or(..)` instead: `or(None)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _ = deep.0.or(None); + | ~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:118:13 | LL | let _ = deep.0.get_or_insert_with(|| 2); - | ^^^^^^^------------------------ - | | - | help: use `get_or_insert(..)` instead: `get_or_insert(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `get_or_insert(..)` instead + | +LL | let _ = deep.0.get_or_insert(2); + | ~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:119:13 | LL | let _ = deep.0.ok_or_else(|| 2); - | ^^^^^^^---------------- - | | - | help: use `ok_or(..)` instead: `ok_or(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `ok_or(..)` instead + | +LL | let _ = deep.0.ok_or(2); + | ~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:150:28 | LL | let _: Option = None.or_else(|| Some(3)); - | ^^^^^------------------- - | | - | help: use `or(..)` instead: `or(Some(3))` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _: Option = None.or(Some(3)); + | ~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:151:13 | LL | let _ = deep.0.or_else(|| Some(3)); - | ^^^^^^^------------------- - | | - | help: use `or(..)` instead: `or(Some(3))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _ = deep.0.or(Some(3)); + | ~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Option::None` --> tests/ui/unnecessary_lazy_eval.rs:152:13 | LL | let _ = opt.or_else(|| Some(3)); - | ^^^^------------------- - | | - | help: use `or(..)` instead: `or(Some(3))` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _ = opt.or(Some(3)); + | ~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:158:13 | LL | let _ = res2.unwrap_or_else(|_| 2); - | ^^^^^--------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = res2.unwrap_or(2); + | ~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:159:13 | LL | let _ = res2.unwrap_or_else(|_| astronomers_pi); - | ^^^^^---------------------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(astronomers_pi)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = res2.unwrap_or(astronomers_pi); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:160:13 | LL | let _ = res2.unwrap_or_else(|_| ext_str.some_field); - | ^^^^^-------------------------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(ext_str.some_field)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = res2.unwrap_or(ext_str.some_field); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:182:35 | LL | let _: Result = res.and_then(|_| Err(2)); - | ^^^^-------------------- - | | - | help: use `and(..)` instead: `and(Err(2))` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `and(..)` instead + | +LL | let _: Result = res.and(Err(2)); + | ~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:183:35 | LL | let _: Result = res.and_then(|_| Err(astronomers_pi)); - | ^^^^--------------------------------- - | | - | help: use `and(..)` instead: `and(Err(astronomers_pi))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `and(..)` instead + | +LL | let _: Result = res.and(Err(astronomers_pi)); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:184:35 | LL | let _: Result = res.and_then(|_| Err(ext_str.some_field)); - | ^^^^------------------------------------- - | | - | help: use `and(..)` instead: `and(Err(ext_str.some_field))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `and(..)` instead + | +LL | let _: Result = res.and(Err(ext_str.some_field)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:186:35 | LL | let _: Result = res.or_else(|_| Ok(2)); - | ^^^^------------------ - | | - | help: use `or(..)` instead: `or(Ok(2))` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _: Result = res.or(Ok(2)); + | ~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:187:35 | LL | let _: Result = res.or_else(|_| Ok(astronomers_pi)); - | ^^^^------------------------------- - | | - | help: use `or(..)` instead: `or(Ok(astronomers_pi))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _: Result = res.or(Ok(astronomers_pi)); + | ~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:188:35 | LL | let _: Result = res.or_else(|_| Ok(ext_str.some_field)); - | ^^^^----------------------------------- - | | - | help: use `or(..)` instead: `or(Ok(ext_str.some_field))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `or(..)` instead + | +LL | let _: Result = res.or(Ok(ext_str.some_field)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval.rs:189:35 @@ -324,193 +440,265 @@ LL | | // some lines ... | LL | | // some lines LL | | or_else(|_| Ok(ext_str.some_field)); - | |_____----------------------------------^ - | | - | help: use `or(..)` instead: `or(Ok(ext_str.some_field))` + | |_______________________________________^ + | +help: use `or(..)` instead + | +LL | or(Ok(ext_str.some_field)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:219:14 | LL | let _x = false.then(|| i32::MAX + 1); - | ^^^^^^--------------------- - | | - | help: use `then_some(..)` instead: `then_some(i32::MAX + 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(i32::MAX + 1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:221:14 | LL | let _x = false.then(|| i32::MAX * 2); - | ^^^^^^--------------------- - | | - | help: use `then_some(..)` instead: `then_some(i32::MAX * 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(i32::MAX * 2); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:223:14 | LL | let _x = false.then(|| i32::MAX - 1); - | ^^^^^^--------------------- - | | - | help: use `then_some(..)` instead: `then_some(i32::MAX - 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(i32::MAX - 1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:225:14 | LL | let _x = false.then(|| i32::MIN - 1); - | ^^^^^^--------------------- - | | - | help: use `then_some(..)` instead: `then_some(i32::MIN - 1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(i32::MIN - 1); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:227:14 | LL | let _x = false.then(|| (1 + 2 * 3 - 2 / 3 + 9) << 2); - | ^^^^^^------------------------------------- - | | - | help: use `then_some(..)` instead: `then_some((1 + 2 * 3 - 2 / 3 + 9) << 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some((1 + 2 * 3 - 2 / 3 + 9) << 2); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:229:14 | LL | let _x = false.then(|| 255u8 << 7); - | ^^^^^^------------------- - | | - | help: use `then_some(..)` instead: `then_some(255u8 << 7)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(255u8 << 7); + | ~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:231:14 | LL | let _x = false.then(|| 255u8 << 8); - | ^^^^^^------------------- - | | - | help: use `then_some(..)` instead: `then_some(255u8 << 8)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(255u8 << 8); + | ~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:233:14 | LL | let _x = false.then(|| 255u8 >> 8); - | ^^^^^^------------------- - | | - | help: use `then_some(..)` instead: `then_some(255u8 >> 8)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(255u8 >> 8); + | ~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:236:14 | LL | let _x = false.then(|| i32::MAX + -1); - | ^^^^^^---------------------- - | | - | help: use `then_some(..)` instead: `then_some(i32::MAX + -1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(i32::MAX + -1); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:238:14 | LL | let _x = false.then(|| -i32::MAX); - | ^^^^^^------------------ - | | - | help: use `then_some(..)` instead: `then_some(-i32::MAX)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(-i32::MAX); + | ~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:240:14 | LL | let _x = false.then(|| -i32::MIN); - | ^^^^^^------------------ - | | - | help: use `then_some(..)` instead: `then_some(-i32::MIN)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(-i32::MIN); + | ~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:243:14 | LL | let _x = false.then(|| 255 >> -7); - | ^^^^^^------------------ - | | - | help: use `then_some(..)` instead: `then_some(255 >> -7)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(255 >> -7); + | ~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:245:14 | LL | let _x = false.then(|| 255 << -1); - | ^^^^^^------------------ - | | - | help: use `then_some(..)` instead: `then_some(255 << -1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(255 << -1); + | ~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:247:14 | LL | let _x = false.then(|| 1 / 0); - | ^^^^^^-------------- - | | - | help: use `then_some(..)` instead: `then_some(1 / 0)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(1 / 0); + | ~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:249:14 | LL | let _x = false.then(|| x << -1); - | ^^^^^^---------------- - | | - | help: use `then_some(..)` instead: `then_some(x << -1)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(x << -1); + | ~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:251:14 | LL | let _x = false.then(|| x << 2); - | ^^^^^^--------------- - | | - | help: use `then_some(..)` instead: `then_some(x << 2)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(x << 2); + | ~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:261:14 | LL | let _x = false.then(|| x / 0); - | ^^^^^^-------------- - | | - | help: use `then_some(..)` instead: `then_some(x / 0)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(x / 0); + | ~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:263:14 | LL | let _x = false.then(|| x % 0); - | ^^^^^^-------------- - | | - | help: use `then_some(..)` instead: `then_some(x % 0)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(x % 0); + | ~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:266:14 | LL | let _x = false.then(|| 1 / -1); - | ^^^^^^--------------- - | | - | help: use `then_some(..)` instead: `then_some(1 / -1)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(1 / -1); + | ~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:268:14 | LL | let _x = false.then(|| i32::MIN / -1); - | ^^^^^^---------------------- - | | - | help: use `then_some(..)` instead: `then_some(i32::MIN / -1)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(i32::MIN / -1); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:271:14 | LL | let _x = false.then(|| i32::MIN / 0); - | ^^^^^^--------------------- - | | - | help: use `then_some(..)` instead: `then_some(i32::MIN / 0)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(i32::MIN / 0); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:273:14 | LL | let _x = false.then(|| 4 / 2); - | ^^^^^^-------------- - | | - | help: use `then_some(..)` instead: `then_some(4 / 2)` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(4 / 2); + | ~~~~~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval.rs:281:14 | LL | let _x = false.then(|| f1 + f2); - | ^^^^^^---------------- - | | - | help: use `then_some(..)` instead: `then_some(f1 + f2)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _x = false.then_some(f1 + f2); + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 63 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.stderr b/src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.stderr index b566b119571cb..3fc13a10f13ee 100644 --- a/src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.stderr @@ -2,36 +2,47 @@ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval_unfixable.rs:13:13 | LL | let _ = Ok(1).unwrap_or_else(|()| 2); - | ^^^^^^---------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_lazy_evaluations)]` +help: use `unwrap_or(..)` instead + | +LL | let _ = Ok(1).unwrap_or(2); + | ~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval_unfixable.rs:19:13 | LL | let _ = Ok(1).unwrap_or_else(|e::E| 2); - | ^^^^^^------------------------ - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = Ok(1).unwrap_or(2); + | ~~~~~~~~~~~~ error: unnecessary closure used to substitute value for `Result::Err` --> tests/ui/unnecessary_lazy_eval_unfixable.rs:21:13 | LL | let _ = Ok(1).unwrap_or_else(|SomeStruct { .. }| 2); - | ^^^^^^------------------------------------- - | | - | help: use `unwrap_or(..)` instead: `unwrap_or(2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `unwrap_or(..)` instead + | +LL | let _ = Ok(1).unwrap_or(2); + | ~~~~~~~~~~~~ error: unnecessary closure used with `bool::then` --> tests/ui/unnecessary_lazy_eval_unfixable.rs:31:13 | LL | let _ = true.then(|| -> &[u8] { &[] }); - | ^^^^^------------------------- - | | - | help: use `then_some(..)` instead: `then_some({ &[] })` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `then_some(..)` instead + | +LL | let _ = true.then_some({ &[] }); + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr index 15708090361ed..66a0f0429f55d 100644 --- a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr @@ -52,7 +52,12 @@ error: used `unwrap()` on `None` value --> tests/ui/unnecessary_literal_unwrap.rs:20:16 | LL | let _val = None::<()>.unwrap(); - | ^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap()`: `panic!()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: remove the `None` and `unwrap()` + | +LL | let _val = panic!(); + | ~~~~~~~~ error: used `expect()` on `None` value --> tests/ui/unnecessary_literal_unwrap.rs:21:16 @@ -69,7 +74,12 @@ error: used `unwrap_or_default()` on `None` value --> tests/ui/unnecessary_literal_unwrap.rs:22:24 | LL | let _val: String = None.unwrap_or_default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap_or_default()`: `String::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the `None` and `unwrap_or_default()` + | +LL | let _val: String = String::default(); + | ~~~~~~~~~~~~~~~~~ error: used `unwrap_or()` on `None` value --> tests/ui/unnecessary_literal_unwrap.rs:23:21 @@ -123,7 +133,12 @@ error: used `unwrap()` on `None` value --> tests/ui/unnecessary_literal_unwrap.rs:28:5 | LL | None::<()>.unwrap(); - | ^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap()`: `panic!()` + | ^^^^^^^^^^^^^^^^^^^ + | +help: remove the `None` and `unwrap()` + | +LL | panic!(); + | ~~~~~~~~ error: used `expect()` on `None` value --> tests/ui/unnecessary_literal_unwrap.rs:29:5 @@ -140,7 +155,12 @@ error: used `unwrap_or_default()` on `None` value --> tests/ui/unnecessary_literal_unwrap.rs:30:5 | LL | None::.unwrap_or_default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap_or_default()`: `String::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the `None` and `unwrap_or_default()` + | +LL | String::default(); + | ~~~~~~~~~~~~~~~~~ error: used `unwrap_or()` on `None` value --> tests/ui/unnecessary_literal_unwrap.rs:31:5 diff --git a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap_unfixable.stderr b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap_unfixable.stderr index b7dd7ae729fd9..512c2cd0b4de0 100644 --- a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap_unfixable.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap_unfixable.stderr @@ -100,13 +100,23 @@ error: used `unwrap_or_default()` on `None` value --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:32:21 | LL | let _val3: u8 = None.unwrap_or_default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap_or_default()`: `Default::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the `None` and `unwrap_or_default()` + | +LL | let _val3: u8 = Default::default(); + | ~~~~~~~~~~~~~~~~~~ error: used `unwrap_or_default()` on `None` value --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:34:5 | LL | None::<()>.unwrap_or_default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap_or_default()`: `Default::default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the `None` and `unwrap_or_default()` + | +LL | Default::default(); + | ~~~~~~~~~~~~~~~~~~ error: used `unwrap()` on `Ok` value --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:40:17 diff --git a/src/tools/clippy/tests/ui/unnecessary_map_on_constructor.stderr b/src/tools/clippy/tests/ui/unnecessary_map_on_constructor.stderr index ecbf652441549..598f71c8a64b6 100644 --- a/src/tools/clippy/tests/ui/unnecessary_map_on_constructor.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_map_on_constructor.stderr @@ -2,52 +2,91 @@ error: unnecessary map on constructor Some(_) --> tests/ui/unnecessary_map_on_constructor.rs:32:13 | LL | let a = Some(x).map(fun); - | ^^^^^^^^^^^^^^^^ help: try: `Some(fun(x))` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-map-on-constructor` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_on_constructor)]` +help: try + | +LL | let a = Some(fun(x)); + | ~~~~~~~~~~~~ error: unnecessary map on constructor Ok(_) --> tests/ui/unnecessary_map_on_constructor.rs:33:27 | LL | let b: SimpleResult = Ok(x).map(fun); - | ^^^^^^^^^^^^^^ help: try: `Ok(fun(x))` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | let b: SimpleResult = Ok(fun(x)); + | ~~~~~~~~~~ error: unnecessary map_err on constructor Err(_) --> tests/ui/unnecessary_map_on_constructor.rs:34:27 | LL | let c: SimpleResult = Err(err).map_err(notfun); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Err(notfun(err))` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let c: SimpleResult = Err(notfun(err)); + | ~~~~~~~~~~~~~~~~ error: unnecessary map on constructor Option::Some(_) --> tests/ui/unnecessary_map_on_constructor.rs:36:13 | LL | let a = Option::Some(x).map(fun); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Option::Some(fun(x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let a = Option::Some(fun(x)); + | ~~~~~~~~~~~~~~~~~~~~ error: unnecessary map on constructor SimpleResult::Ok(_) --> tests/ui/unnecessary_map_on_constructor.rs:37:27 | LL | let b: SimpleResult = SimpleResult::Ok(x).map(fun); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `SimpleResult::Ok(fun(x))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let b: SimpleResult = SimpleResult::Ok(fun(x)); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary map_err on constructor SimpleResult::Err(_) --> tests/ui/unnecessary_map_on_constructor.rs:38:27 | LL | let c: SimpleResult = SimpleResult::Err(err).map_err(notfun); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `SimpleResult::Err(notfun(err))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let c: SimpleResult = SimpleResult::Err(notfun(err)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary map on constructor Ok(_) --> tests/ui/unnecessary_map_on_constructor.rs:39:52 | LL | let b: std::result::Result = Ok(x).map(fun); - | ^^^^^^^^^^^^^^ help: try: `Ok(fun(x))` + | ^^^^^^^^^^^^^^ + | +help: try + | +LL | let b: std::result::Result = Ok(fun(x)); + | ~~~~~~~~~~ error: unnecessary map_err on constructor Err(_) --> tests/ui/unnecessary_map_on_constructor.rs:40:52 | LL | let c: std::result::Result = Err(err).map_err(notfun); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Err(notfun(err))` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let c: std::result::Result = Err(notfun(err)); + | ~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_min_or_max.stderr b/src/tools/clippy/tests/ui/unnecessary_min_or_max.stderr index f5cd31fbaf24b..95adb1e19b527 100644 --- a/src/tools/clippy/tests/ui/unnecessary_min_or_max.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_min_or_max.stderr @@ -2,106 +2,190 @@ error: `(-6_i32)` is never greater than `9` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:13:13 | LL | let _ = (-6_i32).min(9); - | ^^^^^^^^^^^^^^^ help: try: `(-6_i32)` + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-min-or-max` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_min_or_max)]` +help: try + | +LL | let _ = (-6_i32); + | ~~~~~~~~ error: `(-6_i32)` is never greater than `9` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:14:13 | LL | let _ = (-6_i32).max(9); - | ^^^^^^^^^^^^^^^ help: try: `9` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = 9; + | ~ error: `9_u32` is never smaller than `6` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:15:13 | LL | let _ = 9_u32.min(6); - | ^^^^^^^^^^^^ help: try: `6` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = 6; + | ~ error: `9_u32` is never smaller than `6` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:16:13 | LL | let _ = 9_u32.max(6); - | ^^^^^^^^^^^^ help: try: `9_u32` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = 9_u32; + | ~~~~~ error: `6` is never greater than `7_u8` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:17:13 | LL | let _ = 6.min(7_u8); - | ^^^^^^^^^^^ help: try: `6` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = 6; + | ~ error: `6` is never greater than `7_u8` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:18:13 | LL | let _ = 6.max(7_u8); - | ^^^^^^^^^^^ help: try: `7_u8` + | ^^^^^^^^^^^ + | +help: try + | +LL | let _ = 7_u8; + | ~~~~ error: `0` is never greater than `x` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:22:13 | LL | let _ = 0.min(x); - | ^^^^^^^^ help: try: `0` + | ^^^^^^^^ + | +help: try + | +LL | let _ = 0; + | ~ error: `0` is never greater than `x` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:23:13 | LL | let _ = 0.max(x); - | ^^^^^^^^ help: try: `x` + | ^^^^^^^^ + | +help: try + | +LL | let _ = x; + | ~ error: `x` is never smaller than `0_u32` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:24:13 | LL | let _ = x.min(0_u32); - | ^^^^^^^^^^^^ help: try: `0_u32` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = 0_u32; + | ~~~~~ error: `x` is never smaller than `0_u32` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:25:13 | LL | let _ = x.max(0_u32); - | ^^^^^^^^^^^^ help: try: `x` + | ^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x; + | ~ error: `i32::MIN` is never greater than `x` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:29:13 | LL | let _ = i32::MIN.min(x); - | ^^^^^^^^^^^^^^^ help: try: `i32::MIN` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::MIN; + | ~~~~~~~~ error: `i32::MIN` is never greater than `x` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:30:13 | LL | let _ = i32::MIN.max(x); - | ^^^^^^^^^^^^^^^ help: try: `x` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x; + | ~ error: `x` is never smaller than `i32::MIN` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:31:13 | LL | let _ = x.min(i32::MIN); - | ^^^^^^^^^^^^^^^ help: try: `i32::MIN` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::MIN; + | ~~~~~~~~ error: `x` is never smaller than `i32::MIN` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:32:13 | LL | let _ = x.max(i32::MIN); - | ^^^^^^^^^^^^^^^ help: try: `x` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x; + | ~ error: `x` is never smaller than `i32::MIN - 0` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:34:13 | LL | let _ = x.min(i32::MIN - 0); - | ^^^^^^^^^^^^^^^^^^^ help: try: `i32::MIN - 0` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::MIN - 0; + | ~~~~~~~~~~~~ error: `x` is never smaller than `i32::MIN` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:35:13 | LL | let _ = x.max(i32::MIN); - | ^^^^^^^^^^^^^^^ help: try: `x` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = x; + | ~ error: `x` is never smaller than `i32::MIN - 0` and has therefore no effect --> tests/ui/unnecessary_min_or_max.rs:37:13 | LL | let _ = x.min(i32::MIN - 0); - | ^^^^^^^^^^^^^^^^^^^ help: try: `i32::MIN - 0` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = i32::MIN - 0; + | ~~~~~~~~~~~~ error: aborting due to 17 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_operation.stderr b/src/tools/clippy/tests/ui/unnecessary_operation.stderr index 27be5e6f4b922..956a19789cfb9 100644 --- a/src/tools/clippy/tests/ui/unnecessary_operation.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_operation.stderr @@ -2,106 +2,190 @@ error: unnecessary operation --> tests/ui/unnecessary_operation.rs:70:5 | LL | Tuple(get_number()); - | ^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` + | ^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-operation` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_operation)]` +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:71:5 | LL | Struct { field: get_number() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:72:5 | LL | Struct { ..get_struct() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_struct();` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | get_struct(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:73:5 | LL | Enum::Tuple(get_number()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:74:5 | LL | Enum::Struct { field: get_number() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:75:5 | LL | 5 + get_number(); - | ^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5;get_number();` + | ^^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | 5;get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:76:5 | LL | *&get_number(); - | ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` + | ^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:77:5 | LL | &get_number(); - | ^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` + | ^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:78:5 | LL | (5, 6, get_number()); - | ^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5;6;get_number();` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | 5;6;get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:79:5 | LL | get_number()..; - | ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` + | ^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:80:5 | LL | ..get_number(); - | ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` + | ^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:81:5 | LL | 5..get_number(); - | ^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5;get_number();` + | ^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | 5;get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:82:5 | LL | [42, get_number()]; - | ^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `42;get_number();` + | ^^^^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | 42;get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:83:5 | LL | [42, 55][get_usize()]; - | ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42, 55].len() > get_usize());` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: statement can be written as + | +LL | assert!([42, 55].len() > get_usize()); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:84:5 | LL | (42, get_number()).1; - | ^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `42;get_number();` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | 42;get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:85:5 | LL | [get_number(); 55]; - | ^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` + | ^^^^^^^^^^^^^^^^^^^ + | +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:86:5 | LL | [42; 55][get_usize()]; - | ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42; 55].len() > get_usize());` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: statement can be written as + | +LL | assert!([42; 55].len() > get_usize()); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:87:5 @@ -109,7 +193,12 @@ error: unnecessary operation LL | / { LL | | get_number() LL | | }; - | |______^ help: statement can be reduced to: `get_number();` + | |______^ + | +help: statement can be reduced to + | +LL | get_number(); + | error: unnecessary operation --> tests/ui/unnecessary_operation.rs:90:5 @@ -117,7 +206,12 @@ error: unnecessary operation LL | / FooString { LL | | s: String::from("blah"), LL | | }; - | |______^ help: statement can be reduced to: `String::from("blah");` + | |______^ + | +help: statement can be reduced to + | +LL | String::from("blah"); + | error: aborting due to 19 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_owned_empty_strings.stderr b/src/tools/clippy/tests/ui/unnecessary_owned_empty_strings.stderr index 1820ea4ef5d85..868664050bdba 100644 --- a/src/tools/clippy/tests/ui/unnecessary_owned_empty_strings.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_owned_empty_strings.stderr @@ -2,16 +2,25 @@ error: usage of `&String::new()` for a function expecting a `&str` argument --> tests/ui/unnecessary_owned_empty_strings.rs:10:22 | LL | ref_str_argument(&String::new()); - | ^^^^^^^^^^^^^^ help: try: `""` + | ^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-owned-empty-strings` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_owned_empty_strings)]` +help: try + | +LL | ref_str_argument(""); + | ~~ error: usage of `&String::from("")` for a function expecting a `&str` argument --> tests/ui/unnecessary_owned_empty_strings.rs:14:22 | LL | ref_str_argument(&String::from("")); - | ^^^^^^^^^^^^^^^^^ help: try: `""` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | ref_str_argument(""); + | ~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_result_map_or_else.stderr b/src/tools/clippy/tests/ui/unnecessary_result_map_or_else.stderr index e3a6dbf8ecd8b..e98a53b98b1da 100644 --- a/src/tools/clippy/tests/ui/unnecessary_result_map_or_else.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_result_map_or_else.stderr @@ -2,22 +2,36 @@ error: unused "map closure" when calling `Result::map_or_else` value --> tests/ui/unnecessary_result_map_or_else.rs:6:5 | LL | x.map_or_else(|err| err, |n| n); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `unwrap_or_else`: `x.unwrap_or_else(|err| err)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-result-map-or-else` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_result_map_or_else)]` +help: consider using `unwrap_or_else` + | +LL | x.unwrap_or_else(|err| err); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unused "map closure" when calling `Result::map_or_else` value --> tests/ui/unnecessary_result_map_or_else.rs:10:5 | LL | x.map_or_else(|err: ()| err, |n: ()| n); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `unwrap_or_else`: `x.unwrap_or_else(|err: ()| err)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `unwrap_or_else` + | +LL | x.unwrap_or_else(|err: ()| err); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unused "map closure" when calling `Result::map_or_else` value --> tests/ui/unnecessary_result_map_or_else.rs:15:19 | LL | let y: &str = x.map_or_else(|err| err, |n| n); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `unwrap_or_else`: `x.unwrap_or_else(|err| err)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using `unwrap_or_else` + | +LL | let y: &str = x.unwrap_or_else(|err| err); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unused "map closure" when calling `Result::map_or_else` value --> tests/ui/unnecessary_result_map_or_else.rs:19:5 @@ -29,7 +43,12 @@ LL | | |n| { ... | LL | | }, LL | | ); - | |_____^ help: consider using `unwrap_or_else`: `x.unwrap_or_else(|err| err)` + | |_____^ + | +help: consider using `unwrap_or_else` + | +LL | x.unwrap_or_else(|err| err); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_self_imports.stderr b/src/tools/clippy/tests/ui/unnecessary_self_imports.stderr index 9b143b48c9a6e..04abe7fb4e2ec 100644 --- a/src/tools/clippy/tests/ui/unnecessary_self_imports.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_self_imports.stderr @@ -2,23 +2,27 @@ error: import ending with `::{self}` --> tests/ui/unnecessary_self_imports.rs:5:1 | LL | use std::fs::{self as alias}; - | ^^^^^^^^^-------------------- - | | - | help: consider omitting `::{self}`: `fs as alias;` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this will slightly change semantics; any non-module items at the same path will also be imported = note: `-D clippy::unnecessary-self-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_self_imports)]` +help: consider omitting `::{self}` + | +LL | use std::fs as alias; + | ~~~~~~~~~~~~ error: import ending with `::{self}` --> tests/ui/unnecessary_self_imports.rs:7:1 | LL | use std::rc::{self}; - | ^^^^^^^^^----------- - | | - | help: consider omitting `::{self}`: `rc;` + | ^^^^^^^^^^^^^^^^^^^^ | = note: this will slightly change semantics; any non-module items at the same path will also be imported +help: consider omitting `::{self}` + | +LL | use std::rc; + | ~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_sort_by.stderr b/src/tools/clippy/tests/ui/unnecessary_sort_by.stderr index e2013a4e6f9d2..6c70de4f255ac 100644 --- a/src/tools/clippy/tests/ui/unnecessary_sort_by.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_sort_by.stderr @@ -2,76 +2,135 @@ error: consider using `sort` --> tests/ui/unnecessary_sort_by.rs:12:5 | LL | vec.sort_by(|a, b| a.cmp(b)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-sort-by` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_sort_by)]` +help: try + | +LL | vec.sort(); + | ~~~~~~~~~~ error: consider using `sort` --> tests/ui/unnecessary_sort_by.rs:13:5 | LL | vec.sort_unstable_by(|a, b| a.cmp(b)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.sort_unstable(); + | ~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:14:5 | LL | vec.sort_by(|a, b| (a + 5).abs().cmp(&(b + 5).abs())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (a + 5).abs())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.sort_by_key(|a| (a + 5).abs()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:15:5 | LL | vec.sort_unstable_by(|a, b| id(-a).cmp(&id(-b))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|a| id(-a))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.sort_unstable_by_key(|a| id(-a)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:18:5 | LL | vec.sort_by(|a, b| (b + 5).abs().cmp(&(a + 5).abs())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|b| std::cmp::Reverse((b + 5).abs()))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.sort_by_key(|b| std::cmp::Reverse((b + 5).abs())); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:19:5 | LL | vec.sort_unstable_by(|a, b| id(-b).cmp(&id(-a))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|b| std::cmp::Reverse(id(-b)))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.sort_unstable_by_key(|b| std::cmp::Reverse(id(-b))); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:29:5 | LL | vec.sort_by(|a, b| (***a).abs().cmp(&(***b).abs())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (***a).abs())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.sort_by_key(|a| (***a).abs()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:30:5 | LL | vec.sort_unstable_by(|a, b| (***a).abs().cmp(&(***b).abs())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|a| (***a).abs())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | vec.sort_unstable_by_key(|a| (***a).abs()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:89:9 | LL | args.sort_by(|a, b| a.name().cmp(&b.name())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|a| a.name())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | args.sort_by_key(|a| a.name()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:90:9 | LL | args.sort_unstable_by(|a, b| a.name().cmp(&b.name())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_unstable_by_key(|a| a.name())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | args.sort_unstable_by_key(|a| a.name()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:92:9 | LL | args.sort_by(|a, b| b.name().cmp(&a.name())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|b| std::cmp::Reverse(b.name()))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | args.sort_by_key(|b| std::cmp::Reverse(b.name())); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: consider using `sort_by_key` --> tests/ui/unnecessary_sort_by.rs:93:9 | LL | args.sort_unstable_by(|a, b| b.name().cmp(&a.name())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_unstable_by_key(|b| std::cmp::Reverse(b.name()))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | args.sort_unstable_by_key(|b| std::cmp::Reverse(b.name())); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 12 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_struct_initialization.stderr b/src/tools/clippy/tests/ui/unnecessary_struct_initialization.stderr index 8bc308c7567b5..cdb72dc3d769f 100644 --- a/src/tools/clippy/tests/ui/unnecessary_struct_initialization.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_struct_initialization.stderr @@ -2,28 +2,47 @@ error: unnecessary struct building --> tests/ui/unnecessary_struct_initialization.rs:32:9 | LL | Self { ..*self } - | ^^^^^^^^^^^^^^^^ help: replace with: `*self` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-struct-initialization` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_struct_initialization)]` +help: replace with + | +LL | *self + | error: unnecessary struct building --> tests/ui/unnecessary_struct_initialization.rs:39:17 | LL | let mut b = S { ..a }; - | ^^^^^^^^^ help: replace with: `a` + | ^^^^^^^^^ + | +help: replace with + | +LL | let mut b = a; + | ~ error: unnecessary struct building --> tests/ui/unnecessary_struct_initialization.rs:42:18 | LL | let c = &mut S { ..b }; - | ^^^^^^^^^ help: replace with: `b` + | ^^^^^^^^^ + | +help: replace with + | +LL | let c = &mut b; + | ~ error: unnecessary struct building --> tests/ui/unnecessary_struct_initialization.rs:50:14 | LL | let g = &S { ..f }; - | ^^^^^^^^^ help: replace with: `f` + | ^^^^^^^^^ + | +help: replace with + | +LL | let g = &f; + | ~ error: unnecessary struct building --> tests/ui/unnecessary_struct_initialization.rs:53:18 @@ -32,7 +51,12 @@ LL | let h = &mut S { | __________________^ LL | | ..*Box::new(S { f: String::from("foo") }) LL | | }; - | |_____^ help: replace with: `*Box::new(S { f: String::from("foo") })` + | |_____^ + | +help: replace with + | +LL | let h = &mut *Box::new(S { f: String::from("foo") }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary struct building --> tests/ui/unnecessary_struct_initialization.rs:72:18 @@ -41,7 +65,12 @@ LL | let p = &mut T { | __________________^ LL | | ..*Box::new(T { f: 5 }) LL | | }; - | |_____^ help: replace with: `*Box::new(T { f: 5 })` + | |_____^ + | +help: replace with + | +LL | let p = &mut *Box::new(T { f: 5 }); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_to_owned.stderr b/src/tools/clippy/tests/ui/unnecessary_to_owned.stderr index 2829f3cd6e980..42bb9c410b2f2 100644 --- a/src/tools/clippy/tests/ui/unnecessary_to_owned.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_to_owned.stderr @@ -2,7 +2,7 @@ error: redundant clone --> tests/ui/unnecessary_to_owned.rs:155:64 | LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned()); - | ^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/unnecessary_to_owned.rs:155:20 @@ -11,471 +11,846 @@ LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: `-D clippy::redundant-clone` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]` +help: remove this + | +LL - require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned()); +LL + require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap()); + | error: redundant clone --> tests/ui/unnecessary_to_owned.rs:156:40 | LL | require_os_str(&OsString::from("x").to_os_string()); - | ^^^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/unnecessary_to_owned.rs:156:21 | LL | require_os_str(&OsString::from("x").to_os_string()); | ^^^^^^^^^^^^^^^^^^^ +help: remove this + | +LL - require_os_str(&OsString::from("x").to_os_string()); +LL + require_os_str(&OsString::from("x")); + | error: redundant clone --> tests/ui/unnecessary_to_owned.rs:157:48 | LL | require_path(&std::path::PathBuf::from("x").to_path_buf()); - | ^^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/unnecessary_to_owned.rs:157:19 | LL | require_path(&std::path::PathBuf::from("x").to_path_buf()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this + | +LL - require_path(&std::path::PathBuf::from("x").to_path_buf()); +LL + require_path(&std::path::PathBuf::from("x")); + | error: redundant clone --> tests/ui/unnecessary_to_owned.rs:158:35 | LL | require_str(&String::from("x").to_string()); - | ^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/unnecessary_to_owned.rs:158:18 | LL | require_str(&String::from("x").to_string()); | ^^^^^^^^^^^^^^^^^ +help: remove this + | +LL - require_str(&String::from("x").to_string()); +LL + require_str(&String::from("x")); + | error: redundant clone --> tests/ui/unnecessary_to_owned.rs:159:39 | LL | require_slice(&[String::from("x")].to_owned()); - | ^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^ | note: this value is dropped without further use --> tests/ui/unnecessary_to_owned.rs:159:20 | LL | require_slice(&[String::from("x")].to_owned()); | ^^^^^^^^^^^^^^^^^^^ +help: remove this + | +LL - require_slice(&[String::from("x")].to_owned()); +LL + require_slice(&[String::from("x")]); + | error: unnecessary use of `into_owned` --> tests/ui/unnecessary_to_owned.rs:64:36 | LL | require_c_str(&Cow::from(c_str).into_owned()); - | ^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-to-owned` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_to_owned)]` +help: remove this + | +LL - require_c_str(&Cow::from(c_str).into_owned()); +LL + require_c_str(&Cow::from(c_str)); + | error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:65:19 | LL | require_c_str(&c_str.to_owned()); - | ^^^^^^^^^^^^^^^^^ help: use: `c_str` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_c_str(c_str); + | ~~~~~ error: unnecessary use of `to_os_string` --> tests/ui/unnecessary_to_owned.rs:67:20 | LL | require_os_str(&os_str.to_os_string()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: use: `os_str` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_os_str(os_str); + | ~~~~~~ error: unnecessary use of `into_owned` --> tests/ui/unnecessary_to_owned.rs:68:38 | LL | require_os_str(&Cow::from(os_str).into_owned()); - | ^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^ + | +help: remove this + | +LL - require_os_str(&Cow::from(os_str).into_owned()); +LL + require_os_str(&Cow::from(os_str)); + | error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:69:20 | LL | require_os_str(&os_str.to_owned()); - | ^^^^^^^^^^^^^^^^^^ help: use: `os_str` + | ^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_os_str(os_str); + | ~~~~~~ error: unnecessary use of `to_path_buf` --> tests/ui/unnecessary_to_owned.rs:71:18 | LL | require_path(&path.to_path_buf()); - | ^^^^^^^^^^^^^^^^^^^ help: use: `path` + | ^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_path(path); + | ~~~~ error: unnecessary use of `into_owned` --> tests/ui/unnecessary_to_owned.rs:72:34 | LL | require_path(&Cow::from(path).into_owned()); - | ^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^ + | +help: remove this + | +LL - require_path(&Cow::from(path).into_owned()); +LL + require_path(&Cow::from(path)); + | error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:73:18 | LL | require_path(&path.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `path` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_path(path); + | ~~~~ error: unnecessary use of `to_string` --> tests/ui/unnecessary_to_owned.rs:75:17 | LL | require_str(&s.to_string()); - | ^^^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^^^ + | +help: use + | +LL | require_str(s); + | ~ error: unnecessary use of `into_owned` --> tests/ui/unnecessary_to_owned.rs:76:30 | LL | require_str(&Cow::from(s).into_owned()); - | ^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^ + | +help: remove this + | +LL - require_str(&Cow::from(s).into_owned()); +LL + require_str(&Cow::from(s)); + | error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:77:17 | LL | require_str(&s.to_owned()); - | ^^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^^ + | +help: use + | +LL | require_str(s); + | ~ error: unnecessary use of `to_string` --> tests/ui/unnecessary_to_owned.rs:78:17 | LL | require_str(&x_ref.to_string()); - | ^^^^^^^^^^^^^^^^^^ help: use: `x_ref.as_ref()` + | ^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_str(x_ref.as_ref()); + | ~~~~~~~~~~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:80:19 | LL | require_slice(&slice.to_vec()); - | ^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_slice(slice); + | ~~~~~ error: unnecessary use of `into_owned` --> tests/ui/unnecessary_to_owned.rs:81:36 | LL | require_slice(&Cow::from(slice).into_owned()); - | ^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^ + | +help: remove this + | +LL - require_slice(&Cow::from(slice).into_owned()); +LL + require_slice(&Cow::from(slice)); + | error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:82:19 | LL | require_slice(&array.to_owned()); - | ^^^^^^^^^^^^^^^^^ help: use: `array.as_ref()` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_slice(array.as_ref()); + | ~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:83:19 | LL | require_slice(&array_ref.to_owned()); - | ^^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref.as_ref()` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_slice(array_ref.as_ref()); + | ~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:84:19 | LL | require_slice(&slice.to_owned()); - | ^^^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_slice(slice); + | ~~~~~ error: unnecessary use of `into_owned` --> tests/ui/unnecessary_to_owned.rs:87:42 | LL | require_x(&Cow::::Owned(x.clone()).into_owned()); - | ^^^^^^^^^^^^^ help: remove this + | ^^^^^^^^^^^^^ + | +help: remove this + | +LL - require_x(&Cow::::Owned(x.clone()).into_owned()); +LL + require_x(&Cow::::Owned(x.clone())); + | error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:90:25 | LL | require_deref_c_str(c_str.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `c_str` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_deref_c_str(c_str); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:91:26 | LL | require_deref_os_str(os_str.to_owned()); - | ^^^^^^^^^^^^^^^^^ help: use: `os_str` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_deref_os_str(os_str); + | ~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:92:24 | LL | require_deref_path(path.to_owned()); - | ^^^^^^^^^^^^^^^ help: use: `path` + | ^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_deref_path(path); + | ~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:93:23 | LL | require_deref_str(s.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_deref_str(s); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:94:25 | LL | require_deref_slice(slice.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_deref_slice(slice); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:96:30 | LL | require_impl_deref_c_str(c_str.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `c_str` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_deref_c_str(c_str); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:97:31 | LL | require_impl_deref_os_str(os_str.to_owned()); - | ^^^^^^^^^^^^^^^^^ help: use: `os_str` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_deref_os_str(os_str); + | ~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:98:29 | LL | require_impl_deref_path(path.to_owned()); - | ^^^^^^^^^^^^^^^ help: use: `path` + | ^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_deref_path(path); + | ~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:99:28 | LL | require_impl_deref_str(s.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_deref_str(s); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:100:30 | LL | require_impl_deref_slice(slice.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_deref_slice(slice); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:102:29 | LL | require_deref_str_slice(s.to_owned(), slice.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_deref_str_slice(s, slice.to_owned()); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:102:43 | LL | require_deref_str_slice(s.to_owned(), slice.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_deref_str_slice(s.to_owned(), slice); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:103:29 | LL | require_deref_slice_str(slice.to_owned(), s.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_deref_slice_str(slice, s.to_owned()); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:103:47 | LL | require_deref_slice_str(slice.to_owned(), s.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_deref_slice_str(slice.to_owned(), s); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:105:26 | LL | require_as_ref_c_str(c_str.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `c_str` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_c_str(c_str); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:106:27 | LL | require_as_ref_os_str(os_str.to_owned()); - | ^^^^^^^^^^^^^^^^^ help: use: `os_str` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_os_str(os_str); + | ~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:107:25 | LL | require_as_ref_path(path.to_owned()); - | ^^^^^^^^^^^^^^^ help: use: `path` + | ^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_path(path); + | ~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:108:24 | LL | require_as_ref_str(s.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_str(s); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:109:24 | LL | require_as_ref_str(x.to_owned()); - | ^^^^^^^^^^^^ help: use: `&x` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_str(&x); + | ~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:110:26 | LL | require_as_ref_slice(array.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `array` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_slice(array); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:111:26 | LL | require_as_ref_slice(array_ref.to_owned()); - | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_slice(array_ref); + | ~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:112:26 | LL | require_as_ref_slice(slice.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_slice(slice); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:114:31 | LL | require_impl_as_ref_c_str(c_str.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `c_str` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_as_ref_c_str(c_str); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:115:32 | LL | require_impl_as_ref_os_str(os_str.to_owned()); - | ^^^^^^^^^^^^^^^^^ help: use: `os_str` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_as_ref_os_str(os_str); + | ~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:116:30 | LL | require_impl_as_ref_path(path.to_owned()); - | ^^^^^^^^^^^^^^^ help: use: `path` + | ^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_as_ref_path(path); + | ~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:117:29 | LL | require_impl_as_ref_str(s.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_as_ref_str(s); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:118:29 | LL | require_impl_as_ref_str(x.to_owned()); - | ^^^^^^^^^^^^ help: use: `&x` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_as_ref_str(&x); + | ~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:119:31 | LL | require_impl_as_ref_slice(array.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `array` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_as_ref_slice(array); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:120:31 | LL | require_impl_as_ref_slice(array_ref.to_owned()); - | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_as_ref_slice(array_ref); + | ~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:121:31 | LL | require_impl_as_ref_slice(slice.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_impl_as_ref_slice(slice); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:123:30 | LL | require_as_ref_str_slice(s.to_owned(), array.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_str_slice(s, array.to_owned()); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:123:44 | LL | require_as_ref_str_slice(s.to_owned(), array.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `array` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_str_slice(s.to_owned(), array); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:124:30 | LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_str_slice(s, array_ref.to_owned()); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:124:44 | LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned()); - | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_str_slice(s.to_owned(), array_ref); + | ~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:125:30 | LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_str_slice(s, slice.to_owned()); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:125:44 | LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_str_slice(s.to_owned(), slice); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:126:30 | LL | require_as_ref_slice_str(array.to_owned(), s.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `array` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_slice_str(array, s.to_owned()); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:126:48 | LL | require_as_ref_slice_str(array.to_owned(), s.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_slice_str(array.to_owned(), s); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:127:30 | LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned()); - | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_slice_str(array_ref, s.to_owned()); + | ~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:127:52 | LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_slice_str(array_ref.to_owned(), s); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:128:30 | LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned()); - | ^^^^^^^^^^^^^^^^ help: use: `slice` + | ^^^^^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_slice_str(slice, s.to_owned()); + | ~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:128:48 | LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned()); - | ^^^^^^^^^^^^ help: use: `s` + | ^^^^^^^^^^^^ + | +help: use + | +LL | require_as_ref_slice_str(slice.to_owned(), s); + | ~ error: unnecessary use of `to_string` --> tests/ui/unnecessary_to_owned.rs:130:20 | LL | let _ = x.join(&x_ref.to_string()); - | ^^^^^^^^^^^^^^^^^^ help: use: `x_ref` + | ^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = x.join(x_ref); + | ~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:132:13 | LL | let _ = slice.to_vec().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = slice.iter().copied(); + | ~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:133:13 | LL | let _ = slice.to_owned().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = slice.iter().copied(); + | ~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:134:13 | LL | let _ = [std::path::PathBuf::new()][..].to_vec().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = [std::path::PathBuf::new()][..].iter().cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:135:13 | LL | let _ = [std::path::PathBuf::new()][..].to_owned().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = [std::path::PathBuf::new()][..].iter().cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:137:13 | LL | let _ = IntoIterator::into_iter(slice.to_vec()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = slice.iter().copied(); + | ~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:138:13 | LL | let _ = IntoIterator::into_iter(slice.to_owned()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = slice.iter().copied(); + | ~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:139:13 | LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_vec()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = [std::path::PathBuf::new()][..].iter().cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:140:13 | LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_owned()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = [std::path::PathBuf::new()][..].iter().cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:202:14 @@ -497,61 +872,111 @@ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:225:14 | LL | let _ = &["x"][..].to_vec().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().cloned()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = &["x"][..].iter().cloned(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:230:14 | LL | let _ = &["x"][..].to_vec().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().copied()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = &["x"][..].iter().copied(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_string` --> tests/ui/unnecessary_to_owned.rs:278:24 | LL | Box::new(build(y.to_string())) - | ^^^^^^^^^^^^^ help: use: `y` + | ^^^^^^^^^^^^^ + | +help: use + | +LL | Box::new(build(y)) + | ~ error: unnecessary use of `to_string` --> tests/ui/unnecessary_to_owned.rs:387:12 | LL | id("abc".to_string()) - | ^^^^^^^^^^^^^^^^^ help: use: `"abc"` + | ^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | id("abc") + | ~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:530:37 | LL | IntoFuture::into_future(foo([].to_vec(), &0)); - | ^^^^^^^^^^^ help: use: `[]` + | ^^^^^^^^^^^ + | +help: use + | +LL | IntoFuture::into_future(foo([], &0)); + | ~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:540:18 | LL | s.remove(&a.to_vec()); - | ^^^^^^^^^^^ help: replace it with: `a` + | ^^^^^^^^^^^ + | +help: replace it with + | +LL | s.remove(a); + | ~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned.rs:544:14 | LL | s.remove(&"b".to_owned()); - | ^^^^^^^^^^^^^^^ help: replace it with: `"b"` + | ^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | s.remove("b"); + | ~~~ error: unnecessary use of `to_string` --> tests/ui/unnecessary_to_owned.rs:545:14 | LL | s.remove(&"b".to_string()); - | ^^^^^^^^^^^^^^^^ help: replace it with: `"b"` + | ^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | s.remove("b"); + | ~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:550:14 | LL | s.remove(&["b"].to_vec()); - | ^^^^^^^^^^^^^^^ help: replace it with: `["b"].as_slice()` + | ^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | s.remove(["b"].as_slice()); + | ~~~~~~~~~~~~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned.rs:551:14 | LL | s.remove(&(&["b"]).to_vec()); - | ^^^^^^^^^^^^^^^^^^ help: replace it with: `(&["b"]).as_slice()` + | ^^^^^^^^^^^^^^^^^^ + | +help: replace it with + | +LL | s.remove((&["b"]).as_slice()); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 85 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_to_owned_on_split.stderr b/src/tools/clippy/tests/ui/unnecessary_to_owned_on_split.stderr index cf5c964bcf3cd..83382f3eb65a5 100644 --- a/src/tools/clippy/tests/ui/unnecessary_to_owned_on_split.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_to_owned_on_split.stderr @@ -2,58 +2,102 @@ error: unnecessary use of `to_string` --> tests/ui/unnecessary_to_owned_on_split.rs:19:13 | LL | let _ = "a".to_string().split('a').next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split('a')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-to-owned` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_to_owned)]` +help: use + | +LL | let _ = "a".split('a').next().unwrap(); + | ~~~~~~~~~~~~~~ error: unnecessary use of `to_string` --> tests/ui/unnecessary_to_owned_on_split.rs:21:13 | LL | let _ = "a".to_string().split("a").next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split("a")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = "a".split("a").next().unwrap(); + | ~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned_on_split.rs:23:13 | LL | let _ = "a".to_owned().split('a').next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split('a')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = "a".split('a').next().unwrap(); + | ~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned_on_split.rs:25:13 | LL | let _ = "a".to_owned().split("a").next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split("a")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = "a".split("a").next().unwrap(); + | ~~~~~~~~~~~~~~ error: unnecessary use of `to_string` --> tests/ui/unnecessary_to_owned_on_split.rs:27:13 | LL | let _ = Issue12068.to_string().split('a').next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `Issue12068.as_ref().split('a')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = Issue12068.as_ref().split('a').next().unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned_on_split.rs:30:13 | LL | let _ = [1].to_vec().split(|x| *x == 2).next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = [1].split(|x| *x == 2).next().unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_vec` --> tests/ui/unnecessary_to_owned_on_split.rs:32:13 | LL | let _ = [1].to_vec().split(|x| *x == 2).next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = [1].split(|x| *x == 2).next().unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned_on_split.rs:34:13 | LL | let _ = [1].to_owned().split(|x| *x == 2).next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = [1].split(|x| *x == 2).next().unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: unnecessary use of `to_owned` --> tests/ui/unnecessary_to_owned_on_split.rs:36:13 | LL | let _ = [1].to_owned().split(|x| *x == 2).next().unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL | let _ = [1].split(|x| *x == 2).next().unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/unneeded_wildcard_pattern.stderr b/src/tools/clippy/tests/ui/unneeded_wildcard_pattern.stderr index ceb7d7fe9e09f..2ed961177e327 100644 --- a/src/tools/clippy/tests/ui/unneeded_wildcard_pattern.stderr +++ b/src/tools/clippy/tests/ui/unneeded_wildcard_pattern.stderr @@ -2,91 +2,174 @@ error: this pattern is unneeded as the `..` pattern can match that element --> tests/ui/unneeded_wildcard_pattern.rs:12:18 | LL | if let (0, .., _) = t {}; - | ^^^ help: remove it + | ^^^ | note: the lint level is defined here --> tests/ui/unneeded_wildcard_pattern.rs:3:9 | LL | #![deny(clippy::unneeded_wildcard_pattern)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove it + | +LL - if let (0, .., _) = t {}; +LL + if let (0, ..) = t {}; + | error: this pattern is unneeded as the `..` pattern can match that element --> tests/ui/unneeded_wildcard_pattern.rs:13:16 | LL | if let (0, _, ..) = t {}; - | ^^^ help: remove it + | ^^^ + | +help: remove it + | +LL - if let (0, _, ..) = t {}; +LL + if let (0, ..) = t {}; + | error: this pattern is unneeded as the `..` pattern can match that element --> tests/ui/unneeded_wildcard_pattern.rs:14:13 | LL | if let (_, .., 0) = t {}; - | ^^^ help: remove it + | ^^^ + | +help: remove it + | +LL - if let (_, .., 0) = t {}; +LL + if let (.., 0) = t {}; + | error: this pattern is unneeded as the `..` pattern can match that element --> tests/ui/unneeded_wildcard_pattern.rs:15:15 | LL | if let (.., _, 0) = t {}; - | ^^^ help: remove it + | ^^^ + | +help: remove it + | +LL - if let (.., _, 0) = t {}; +LL + if let (.., 0) = t {}; + | error: these patterns are unneeded as the `..` pattern can match those elements --> tests/ui/unneeded_wildcard_pattern.rs:16:16 | LL | if let (0, _, _, ..) = t {}; - | ^^^^^^ help: remove them + | ^^^^^^ + | +help: remove them + | +LL - if let (0, _, _, ..) = t {}; +LL + if let (0, ..) = t {}; + | error: these patterns are unneeded as the `..` pattern can match those elements --> tests/ui/unneeded_wildcard_pattern.rs:17:18 | LL | if let (0, .., _, _) = t {}; - | ^^^^^^ help: remove them + | ^^^^^^ + | +help: remove them + | +LL - if let (0, .., _, _) = t {}; +LL + if let (0, ..) = t {}; + | error: these patterns are unneeded as the `..` pattern can match those elements --> tests/ui/unneeded_wildcard_pattern.rs:26:22 | LL | if let (0, .., _, _,) = t {}; - | ^^^^^^ help: remove them + | ^^^^^^ + | +help: remove them + | +LL - if let (0, .., _, _,) = t {}; +LL + if let (0, ..,) = t {}; + | error: this pattern is unneeded as the `..` pattern can match that element --> tests/ui/unneeded_wildcard_pattern.rs:33:19 | LL | if let S(0, .., _) = s {}; - | ^^^ help: remove it + | ^^^ + | +help: remove it + | +LL - if let S(0, .., _) = s {}; +LL + if let S(0, ..) = s {}; + | error: this pattern is unneeded as the `..` pattern can match that element --> tests/ui/unneeded_wildcard_pattern.rs:34:17 | LL | if let S(0, _, ..) = s {}; - | ^^^ help: remove it + | ^^^ + | +help: remove it + | +LL - if let S(0, _, ..) = s {}; +LL + if let S(0, ..) = s {}; + | error: this pattern is unneeded as the `..` pattern can match that element --> tests/ui/unneeded_wildcard_pattern.rs:35:14 | LL | if let S(_, .., 0) = s {}; - | ^^^ help: remove it + | ^^^ + | +help: remove it + | +LL - if let S(_, .., 0) = s {}; +LL + if let S(.., 0) = s {}; + | error: this pattern is unneeded as the `..` pattern can match that element --> tests/ui/unneeded_wildcard_pattern.rs:36:16 | LL | if let S(.., _, 0) = s {}; - | ^^^ help: remove it + | ^^^ + | +help: remove it + | +LL - if let S(.., _, 0) = s {}; +LL + if let S(.., 0) = s {}; + | error: these patterns are unneeded as the `..` pattern can match those elements --> tests/ui/unneeded_wildcard_pattern.rs:37:17 | LL | if let S(0, _, _, ..) = s {}; - | ^^^^^^ help: remove them + | ^^^^^^ + | +help: remove them + | +LL - if let S(0, _, _, ..) = s {}; +LL + if let S(0, ..) = s {}; + | error: these patterns are unneeded as the `..` pattern can match those elements --> tests/ui/unneeded_wildcard_pattern.rs:38:19 | LL | if let S(0, .., _, _) = s {}; - | ^^^^^^ help: remove them + | ^^^^^^ + | +help: remove them + | +LL - if let S(0, .., _, _) = s {}; +LL + if let S(0, ..) = s {}; + | error: these patterns are unneeded as the `..` pattern can match those elements --> tests/ui/unneeded_wildcard_pattern.rs:47:23 | LL | if let S(0, .., _, _,) = s {}; - | ^^^^^^ help: remove them + | ^^^^^^ + | +help: remove them + | +LL - if let S(0, .., _, _,) = s {}; +LL + if let S(0, ..,) = s {}; + | error: aborting due to 14 previous errors diff --git a/src/tools/clippy/tests/ui/unreadable_literal.stderr b/src/tools/clippy/tests/ui/unreadable_literal.stderr index 5e350d760643a..77d55b2e930dd 100644 --- a/src/tools/clippy/tests/ui/unreadable_literal.stderr +++ b/src/tools/clippy/tests/ui/unreadable_literal.stderr @@ -2,64 +2,113 @@ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:31:17 | LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32); - | ^^^^^^^^^^^^ help: consider: `0b11_0110_i64` + | ^^^^^^^^^^^^ | = note: `-D clippy::unreadable-literal` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unreadable_literal)]` +help: consider + | +LL | let _bad = (0b11_0110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32); + | ~~~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:31:31 | LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32); - | ^^^^^^^^^^^^^^^^ help: consider: `0x1234_5678_usize` + | ^^^^^^^^^^^^^^^^ + | +help: consider + | +LL | let _bad = (0b110110_i64, 0x1234_5678_usize, 123456_f32, 1.234567_f32); + | ~~~~~~~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:31:49 | LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32); - | ^^^^^^^^^^ help: consider: `123_456_f32` + | ^^^^^^^^^^ + | +help: consider + | +LL | let _bad = (0b110110_i64, 0x12345678_usize, 123_456_f32, 1.234567_f32); + | ~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:31:61 | LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32); - | ^^^^^^^^^^^^ help: consider: `1.234_567_f32` + | ^^^^^^^^^^^^ + | +help: consider + | +LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234_567_f32); + | ~~~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:33:20 | LL | let _bad_sci = 1.123456e1; - | ^^^^^^^^^^ help: consider: `1.123_456e1` + | ^^^^^^^^^^ + | +help: consider + | +LL | let _bad_sci = 1.123_456e1; + | ~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:35:18 | LL | let _fail1 = 0xabcdef; - | ^^^^^^^^ help: consider: `0x00ab_cdef` + | ^^^^^^^^ + | +help: consider + | +LL | let _fail1 = 0x00ab_cdef; + | ~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:36:23 | LL | let _fail2: u32 = 0xBAFEBAFE; - | ^^^^^^^^^^ help: consider: `0xBAFE_BAFE` + | ^^^^^^^^^^ + | +help: consider + | +LL | let _fail2: u32 = 0xBAFE_BAFE; + | ~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:37:18 | LL | let _fail3 = 0xabcdeff; - | ^^^^^^^^^ help: consider: `0x0abc_deff` + | ^^^^^^^^^ + | +help: consider + | +LL | let _fail3 = 0x0abc_deff; + | ~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:38:24 | LL | let _fail4: i128 = 0xabcabcabcabcabcabc; - | ^^^^^^^^^^^^^^^^^^^^ help: consider: `0x00ab_cabc_abca_bcab_cabc` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider + | +LL | let _fail4: i128 = 0x00ab_cabc_abca_bcab_cabc; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: long literal lacking separators --> tests/ui/unreadable_literal.rs:39:18 | LL | let _fail5 = 1.100300400; - | ^^^^^^^^^^^ help: consider: `1.100_300_400` + | ^^^^^^^^^^^ + | +help: consider + | +LL | let _fail5 = 1.100_300_400; + | ~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/unseparated_prefix_literals.stderr b/src/tools/clippy/tests/ui/unseparated_prefix_literals.stderr index 1c51f7ada91f1..95e3f2512057e 100644 --- a/src/tools/clippy/tests/ui/unseparated_prefix_literals.stderr +++ b/src/tools/clippy/tests/ui/unseparated_prefix_literals.stderr @@ -2,63 +2,106 @@ error: integer type suffix should be separated by an underscore --> tests/ui/unseparated_prefix_literals.rs:23:18 | LL | let _fail1 = 1234i32; - | ^^^^^^^ help: add an underscore: `1234_i32` + | ^^^^^^^ | = note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unseparated_literal_suffix)]` +help: add an underscore + | +LL | let _fail1 = 1234_i32; + | ~~~~~~~~ error: integer type suffix should be separated by an underscore --> tests/ui/unseparated_prefix_literals.rs:24:18 | LL | let _fail2 = 1234u32; - | ^^^^^^^ help: add an underscore: `1234_u32` + | ^^^^^^^ + | +help: add an underscore + | +LL | let _fail2 = 1234_u32; + | ~~~~~~~~ error: integer type suffix should be separated by an underscore --> tests/ui/unseparated_prefix_literals.rs:25:18 | LL | let _fail3 = 1234isize; - | ^^^^^^^^^ help: add an underscore: `1234_isize` + | ^^^^^^^^^ + | +help: add an underscore + | +LL | let _fail3 = 1234_isize; + | ~~~~~~~~~~ error: integer type suffix should be separated by an underscore --> tests/ui/unseparated_prefix_literals.rs:26:18 | LL | let _fail4 = 1234usize; - | ^^^^^^^^^ help: add an underscore: `1234_usize` + | ^^^^^^^^^ + | +help: add an underscore + | +LL | let _fail4 = 1234_usize; + | ~~~~~~~~~~ error: integer type suffix should be separated by an underscore --> tests/ui/unseparated_prefix_literals.rs:27:18 | LL | let _fail5 = 0x123isize; - | ^^^^^^^^^^ help: add an underscore: `0x123_isize` + | ^^^^^^^^^^ + | +help: add an underscore + | +LL | let _fail5 = 0x123_isize; + | ~~~~~~~~~~~ error: float type suffix should be separated by an underscore --> tests/ui/unseparated_prefix_literals.rs:31:19 | LL | let _failf1 = 1.5f32; - | ^^^^^^ help: add an underscore: `1.5_f32` + | ^^^^^^ + | +help: add an underscore + | +LL | let _failf1 = 1.5_f32; + | ~~~~~~~ error: float type suffix should be separated by an underscore --> tests/ui/unseparated_prefix_literals.rs:32:19 | LL | let _failf2 = 1f32; - | ^^^^ help: add an underscore: `1_f32` + | ^^^^ + | +help: add an underscore + | +LL | let _failf2 = 1_f32; + | ~~~~~ error: integer type suffix should be separated by an underscore --> tests/ui/unseparated_prefix_literals.rs:15:9 | LL | 42usize - | ^^^^^^^ help: add an underscore: `42_usize` + | ^^^^^^^ ... LL | let _ = lit_from_macro!(); | ----------------- in this macro invocation | = note: this error originates in the macro `lit_from_macro` (in Nightly builds, run with -Z macro-backtrace for more info) +help: add an underscore + | +LL | 42_usize + | error: integer type suffix should be separated by an underscore --> tests/ui/unseparated_prefix_literals.rs:40:16 | LL | assert_eq!(4897u32, 32223); - | ^^^^^^^ help: add an underscore: `4897_u32` + | ^^^^^^^ + | +help: add an underscore + | +LL | assert_eq!(4897_u32, 32223); + | ~~~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/unused_rounding.stderr b/src/tools/clippy/tests/ui/unused_rounding.stderr index c5ae2da75f84e..c14922beda20e 100644 --- a/src/tools/clippy/tests/ui/unused_rounding.stderr +++ b/src/tools/clippy/tests/ui/unused_rounding.stderr @@ -2,34 +2,58 @@ error: used the `ceil` method with a whole number float --> tests/ui/unused_rounding.rs:6:13 | LL | let _ = 1f32.ceil(); - | ^^^^^^^^^^^ help: remove the `ceil` method call: `1f32` + | ^^^^^^^^^^^ | = note: `-D clippy::unused-rounding` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unused_rounding)]` +help: remove the `ceil` method call + | +LL | let _ = 1f32; + | ~~~~ error: used the `floor` method with a whole number float --> tests/ui/unused_rounding.rs:7:13 | LL | let _ = 1.0f64.floor(); - | ^^^^^^^^^^^^^^ help: remove the `floor` method call: `1.0f64` + | ^^^^^^^^^^^^^^ + | +help: remove the `floor` method call + | +LL | let _ = 1.0f64; + | ~~~~~~ error: used the `round` method with a whole number float --> tests/ui/unused_rounding.rs:8:13 | LL | let _ = 1.00f32.round(); - | ^^^^^^^^^^^^^^^ help: remove the `round` method call: `1.00f32` + | ^^^^^^^^^^^^^^^ + | +help: remove the `round` method call + | +LL | let _ = 1.00f32; + | ~~~~~~~ error: used the `round` method with a whole number float --> tests/ui/unused_rounding.rs:14:13 | LL | let _ = 3.0_f32.round(); - | ^^^^^^^^^^^^^^^ help: remove the `round` method call: `3.0_f32` + | ^^^^^^^^^^^^^^^ + | +help: remove the `round` method call + | +LL | let _ = 3.0_f32; + | ~~~~~~~ error: used the `round` method with a whole number float --> tests/ui/unused_rounding.rs:16:13 | LL | let _ = 3_3.0_0_f32.round(); - | ^^^^^^^^^^^^^^^^^^^ help: remove the `round` method call: `3_3.0_0_f32` + | ^^^^^^^^^^^^^^^^^^^ + | +help: remove the `round` method call + | +LL | let _ = 3_3.0_0_f32; + | ~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/unused_unit.stderr b/src/tools/clippy/tests/ui/unused_unit.stderr index 104159ad5fc63..01ec1c4061065 100644 --- a/src/tools/clippy/tests/ui/unused_unit.stderr +++ b/src/tools/clippy/tests/ui/unused_unit.stderr @@ -2,121 +2,233 @@ error: unneeded unit return type --> tests/ui/unused_unit.rs:20:58 | LL | pub fn get_unit (), G>(&self, f: F, _g: G) -> () - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ | note: the lint level is defined here --> tests/ui/unused_unit.rs:13:9 | LL | #![deny(clippy::unused_unit)] | ^^^^^^^^^^^^^^^^^^^ +help: remove the `-> ()` + | +LL - pub fn get_unit (), G>(&self, f: F, _g: G) -> () +LL + pub fn get_unit (), G>(&self, f: F, _g: G) + | error: unneeded unit return type --> tests/ui/unused_unit.rs:20:28 | LL | pub fn get_unit (), G>(&self, f: F, _g: G) -> () - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - pub fn get_unit (), G>(&self, f: F, _g: G) -> () +LL + pub fn get_unit(&self, f: F, _g: G) -> () + | error: unneeded unit return type --> tests/ui/unused_unit.rs:21:18 | LL | where G: Fn() -> () { - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - where G: Fn() -> () { +LL + where G: Fn() { + | error: unneeded unit return type --> tests/ui/unused_unit.rs:22:26 | LL | let _y: &dyn Fn() -> () = &f; - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - let _y: &dyn Fn() -> () = &f; +LL + let _y: &dyn Fn() = &f; + | error: unneeded unit return type --> tests/ui/unused_unit.rs:29:18 | LL | fn into(self) -> () { - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - fn into(self) -> () { +LL + fn into(self) { + | error: unneeded unit expression --> tests/ui/unused_unit.rs:30:9 | LL | () - | ^^ help: remove the final `()` + | ^^ + | +help: remove the final `()` + | +LL - () + | error: unneeded unit return type --> tests/ui/unused_unit.rs:35:29 | LL | fn redundant (), G, H>(&self, _f: F, _g: G, _h: H) - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - fn redundant (), G, H>(&self, _f: F, _g: G, _h: H) +LL + fn redundant(&self, _f: F, _g: G, _h: H) + | error: unneeded unit return type --> tests/ui/unused_unit.rs:37:19 | LL | G: FnMut() -> (), - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - G: FnMut() -> (), +LL + G: FnMut(), + | error: unneeded unit return type --> tests/ui/unused_unit.rs:38:16 | LL | H: Fn() -> (); - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - H: Fn() -> (); +LL + H: Fn(); + | error: unneeded unit return type --> tests/ui/unused_unit.rs:42:29 | LL | fn redundant (), G, H>(&self, _f: F, _g: G, _h: H) - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - fn redundant (), G, H>(&self, _f: F, _g: G, _h: H) +LL + fn redundant(&self, _f: F, _g: G, _h: H) + | error: unneeded unit return type --> tests/ui/unused_unit.rs:44:19 | LL | G: FnMut() -> (), - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - G: FnMut() -> (), +LL + G: FnMut(), + | error: unneeded unit return type --> tests/ui/unused_unit.rs:45:16 | LL | H: Fn() -> () {} - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - H: Fn() -> () {} +LL + H: Fn() {} + | error: unneeded unit return type --> tests/ui/unused_unit.rs:48:17 | LL | fn return_unit() -> () { () } - | ^^^^^^ help: remove the `-> ()` + | ^^^^^^ + | +help: remove the `-> ()` + | +LL - fn return_unit() -> () { () } +LL + fn return_unit() { () } + | error: unneeded unit expression --> tests/ui/unused_unit.rs:48:26 | LL | fn return_unit() -> () { () } - | ^^ help: remove the final `()` + | ^^ + | +help: remove the final `()` + | +LL - fn return_unit() -> () { () } +LL + fn return_unit() -> () { } + | error: unneeded `()` --> tests/ui/unused_unit.rs:58:14 | LL | break(); - | ^^ help: remove the `()` + | ^^ + | +help: remove the `()` + | +LL - break(); +LL + break; + | error: unneeded `()` --> tests/ui/unused_unit.rs:60:11 | LL | return(); - | ^^ help: remove the `()` + | ^^ + | +help: remove the `()` + | +LL - return(); +LL + return; + | error: unneeded unit return type --> tests/ui/unused_unit.rs:77:10 | LL | fn test()->(){} - | ^^^^ help: remove the `-> ()` + | ^^^^ + | +help: remove the `-> ()` + | +LL - fn test()->(){} +LL + fn test(){} + | error: unneeded unit return type --> tests/ui/unused_unit.rs:80:11 | LL | fn test2() ->(){} - | ^^^^^ help: remove the `-> ()` + | ^^^^^ + | +help: remove the `-> ()` + | +LL - fn test2() ->(){} +LL + fn test2(){} + | error: unneeded unit return type --> tests/ui/unused_unit.rs:83:11 | LL | fn test3()-> (){} - | ^^^^^ help: remove the `-> ()` + | ^^^^^ + | +help: remove the `-> ()` + | +LL - fn test3()-> (){} +LL + fn test3(){} + | error: aborting due to 19 previous errors diff --git a/src/tools/clippy/tests/ui/unwrap_or.stderr b/src/tools/clippy/tests/ui/unwrap_or.stderr index 6aa0b9df29b94..a9c9b0b22191b 100644 --- a/src/tools/clippy/tests/ui/unwrap_or.stderr +++ b/src/tools/clippy/tests/ui/unwrap_or.stderr @@ -2,16 +2,25 @@ error: use of `unwrap_or` followed by a function call --> tests/ui/unwrap_or.rs:5:47 | LL | let s = Some(String::from("test string")).unwrap_or("Fail".to_string()).len(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| "Fail".to_string())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::or-fun-call` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::or_fun_call)]` +help: try + | +LL | let s = Some(String::from("test string")).unwrap_or_else(|| "Fail".to_string()).len(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or` followed by a function call --> tests/ui/unwrap_or.rs:11:47 | LL | let s = Some(String::from("test string")).unwrap_or("Fail".to_string()).len(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| "Fail".to_string())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let s = Some(String::from("test string")).unwrap_or_else(|| "Fail".to_string()).len(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/unwrap_or_else_default.stderr b/src/tools/clippy/tests/ui/unwrap_or_else_default.stderr index e4b4a0a1f6aa7..aaef04dce7e79 100644 --- a/src/tools/clippy/tests/ui/unwrap_or_else_default.stderr +++ b/src/tools/clippy/tests/ui/unwrap_or_else_default.stderr @@ -2,100 +2,179 @@ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:46:14 | LL | with_new.unwrap_or_else(Vec::new); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unwrap-or-default` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]` +help: try + | +LL | with_new.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:60:23 | LL | with_real_default.unwrap_or_else(::default); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_real_default.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:63:24 | LL | with_default_trait.unwrap_or_else(Default::default); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_default_trait.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:66:23 | LL | with_default_type.unwrap_or_else(u64::default); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_default_type.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:69:23 | LL | with_default_type.unwrap_or_else(Vec::new); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | with_default_type.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:72:18 | LL | empty_string.unwrap_or_else(|| "".to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | empty_string.unwrap_or_default(); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:76:12 | LL | option.unwrap_or_else(Vec::new).push(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | option.unwrap_or_default().push(1); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:79:12 | LL | option.unwrap_or_else(Vec::new).push(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | option.unwrap_or_default().push(1); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:82:12 | LL | option.unwrap_or_else(Vec::new).push(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | option.unwrap_or_default().push(1); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:85:12 | LL | option.unwrap_or_else(Vec::new).push(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | option.unwrap_or_default().push(1); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:88:12 | LL | option.unwrap_or_else(Vec::new).push(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | option.unwrap_or_default().push(1); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:91:12 | LL | option.unwrap_or_else(Vec::new).push(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | option.unwrap_or_default().push(1); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:94:12 | LL | option.unwrap_or_else(Vec::new).push(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | option.unwrap_or_default().push(1); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:97:12 | LL | option.unwrap_or_else(Vec::new).push(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | option.unwrap_or_default().push(1); + | ~~~~~~~~~~~~~~~~~~~ error: use of `unwrap_or_else` to construct default value --> tests/ui/unwrap_or_else_default.rs:113:12 | LL | option.unwrap_or_else(Vec::new).push(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | option.unwrap_or_default().push(1); + | ~~~~~~~~~~~~~~~~~~~ error: use of `or_insert_with` to construct default value --> tests/ui/unwrap_or_else_default.rs:130:32 | LL | let _ = inner_map.entry(0).or_insert_with(Default::default); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = inner_map.entry(0).or_default(); + | ~~~~~~~~~~~~ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/upper_case_acronyms.stderr b/src/tools/clippy/tests/ui/upper_case_acronyms.stderr index 1f8046c8e841f..ca3929697fa3f 100644 --- a/src/tools/clippy/tests/ui/upper_case_acronyms.stderr +++ b/src/tools/clippy/tests/ui/upper_case_acronyms.stderr @@ -2,76 +2,135 @@ error: name `CWR` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:9:5 | LL | CWR, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Cwr` + | ^^^ | = note: `-D clippy::upper-case-acronyms` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::upper_case_acronyms)]` +help: consider making the acronym lowercase, except the initial letter + | +LL | Cwr, + | ~~~ error: name `ECE` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:12:5 | LL | ECE, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Ece` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Ece, + | ~~~ error: name `URG` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:14:5 | LL | URG, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Urg` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Urg, + | ~~~ error: name `ACK` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:16:5 | LL | ACK, - | ^^^ help: consider making the acronym lowercase, except the initial letter (notice the capitalization): `Ack` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter (notice the capitalization difference) + | +LL | Ack, + | ~~~ error: name `PSH` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:18:5 | LL | PSH, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Psh` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Psh, + | ~~~ error: name `RST` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:20:5 | LL | RST, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Rst` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Rst, + | ~~~ error: name `SYN` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:22:5 | LL | SYN, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Syn` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Syn, + | ~~~ error: name `FIN` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:24:5 | LL | FIN, - | ^^^ help: consider making the acronym lowercase, except the initial letter: `Fin` + | ^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Fin, + | ~~~ error: name `WASD` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:45:5 | LL | WASD(u8), - | ^^^^ help: consider making the acronym lowercase, except the initial letter: `Wasd` + | ^^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Wasd(u8), + | ~~~~ error: name `JSON` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:52:8 | LL | struct JSON; - | ^^^^ help: consider making the acronym lowercase, except the initial letter: `Json` + | ^^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | struct Json; + | ~~~~ error: name `YAML` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:56:6 | LL | enum YAML { - | ^^^^ help: consider making the acronym lowercase, except the initial letter: `Yaml` + | ^^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | enum Yaml { + | ~~~~ error: name `DISALLOW` contains a capitalized acronym --> tests/ui/upper_case_acronyms.rs:64:5 | LL | DISALLOW, - | ^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `Disallow` + | ^^^^^^^^ + | +help: consider making the acronym lowercase, except the initial letter + | +LL | Disallow, + | ~~~~~~~~ error: aborting due to 12 previous errors diff --git a/src/tools/clippy/tests/ui/use_self.stderr b/src/tools/clippy/tests/ui/use_self.stderr index bd5b685b45d54..d127021375583 100644 --- a/src/tools/clippy/tests/ui/use_self.stderr +++ b/src/tools/clippy/tests/ui/use_self.stderr @@ -2,262 +2,476 @@ error: unnecessary structure name repetition --> tests/ui/use_self.rs:23:21 | LL | fn new() -> Foo { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ | = note: `-D clippy::use-self` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::use_self)]` +help: use the applicable keyword + | +LL | fn new() -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:24:13 | LL | Foo {} - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | Self {} + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:26:22 | LL | fn test() -> Foo { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn test() -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:27:13 | LL | Foo::new() - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | Self::new() + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:32:25 | LL | fn default() -> Foo { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn default() -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:33:13 | LL | Foo::new() - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | Self::new() + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:74:28 | LL | fn clone(&self) -> Foo<'a> { - | ^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^ + | +help: use the applicable keyword + | +LL | fn clone(&self) -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:107:24 | LL | fn bad(foos: &[Foo]) -> impl Iterator { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn bad(foos: &[Self]) -> impl Iterator { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:107:55 | LL | fn bad(foos: &[Foo]) -> impl Iterator { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn bad(foos: &[Foo]) -> impl Iterator { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:122:13 | LL | TS(0) - | ^^ help: use the applicable keyword: `Self` + | ^^ + | +help: use the applicable keyword + | +LL | Self(0) + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:157:29 | LL | fn bar() -> Bar { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn bar() -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:158:21 | LL | Bar { foo: Foo {} } - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | Self { foo: Foo {} } + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:169:21 | LL | fn baz() -> Foo { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn baz() -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:170:13 | LL | Foo {} - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | Self {} + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:187:21 | LL | let _ = Enum::B(42); - | ^^^^ help: use the applicable keyword: `Self` + | ^^^^ + | +help: use the applicable keyword + | +LL | let _ = Self::B(42); + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:188:21 | LL | let _ = Enum::C { field: true }; - | ^^^^ help: use the applicable keyword: `Self` + | ^^^^ + | +help: use the applicable keyword + | +LL | let _ = Self::C { field: true }; + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:189:21 | LL | let _ = Enum::A; - | ^^^^ help: use the applicable keyword: `Self` + | ^^^^ + | +help: use the applicable keyword + | +LL | let _ = Self::A; + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:231:13 | LL | nested::A::fun_1(); - | ^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self::fun_1(); + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:232:13 | LL | nested::A::A; - | ^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self::A; + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:234:13 | LL | nested::A {}; - | ^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self {}; + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:253:13 | LL | TestStruct::from_something() - | ^^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self::from_something() + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:267:25 | LL | async fn g() -> S { - | ^ help: use the applicable keyword: `Self` + | ^ + | +help: use the applicable keyword + | +LL | async fn g() -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:268:13 | LL | S {} - | ^ help: use the applicable keyword: `Self` + | ^ + | +help: use the applicable keyword + | +LL | Self {} + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:272:16 | LL | &p[S::A..S::B] - | ^ help: use the applicable keyword: `Self` + | ^ + | +help: use the applicable keyword + | +LL | &p[Self::A..S::B] + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:272:22 | LL | &p[S::A..S::B] - | ^ help: use the applicable keyword: `Self` + | ^ + | +help: use the applicable keyword + | +LL | &p[S::A..Self::B] + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:295:29 | LL | fn foo(value: T) -> Foo { - | ^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^ + | +help: use the applicable keyword + | +LL | fn foo(value: T) -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:296:13 | LL | Foo:: { value } - | ^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self { value } + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:468:13 | LL | A::new::(submod::B {}) - | ^ help: use the applicable keyword: `Self` + | ^ + | +help: use the applicable keyword + | +LL | Self::new::(submod::B {}) + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:505:13 | LL | S2::new() - | ^^ help: use the applicable keyword: `Self` + | ^^ + | +help: use the applicable keyword + | +LL | Self::new() + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:542:17 | LL | Foo::Bar => unimplemented!(), - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | Self::Bar => unimplemented!(), + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:543:17 | LL | Foo::Baz => unimplemented!(), - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | Self::Baz => unimplemented!(), + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:549:20 | LL | if let Foo::Bar = self { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | if let Self::Bar = self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:573:17 | LL | Something::Num(n) => *n, - | ^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self::Num(n) => *n, + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:574:17 | LL | Something::TupleNums(n, _m) => *n, - | ^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self::TupleNums(n, _m) => *n, + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:575:17 | LL | Something::StructNums { one, two: _ } => *one, - | ^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self::StructNums { one, two: _ } => *one, + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:581:17 | LL | crate::issue8845::Something::Num(n) => *n, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self::Num(n) => *n, + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:582:17 | LL | crate::issue8845::Something::TupleNums(n, _m) => *n, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self::TupleNums(n, _m) => *n, + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:583:17 | LL | crate::issue8845::Something::StructNums { one, two: _ } => *one, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self::StructNums { one, two: _ } => *one, + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:599:17 | LL | let Foo(x) = self; - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | let Self(x) = self; + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:604:17 | LL | let crate::issue8845::Foo(x) = self; - | ^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use the applicable keyword + | +LL | let Self(x) = self; + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:611:17 | LL | let Bar { x, .. } = self; - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | let Self { x, .. } = self; + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:616:17 | LL | let crate::issue8845::Bar { x, .. } = self; - | ^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use the applicable keyword + | +LL | let Self { x, .. } = self; + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self.rs:655:17 | LL | E::A => {}, - | ^ help: use the applicable keyword: `Self` + | ^ + | +help: use the applicable keyword + | +LL | Self::A => {}, + | ~~~~ error: aborting due to 43 previous errors diff --git a/src/tools/clippy/tests/ui/use_self_trait.stderr b/src/tools/clippy/tests/ui/use_self_trait.stderr index 9cbb728ebe667..8ae66af8d0e11 100644 --- a/src/tools/clippy/tests/ui/use_self_trait.stderr +++ b/src/tools/clippy/tests/ui/use_self_trait.stderr @@ -2,100 +2,179 @@ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:19:18 | LL | fn refs(p1: &Bad) -> &Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ | = note: `-D clippy::use-self` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::use_self)]` +help: use the applicable keyword + | +LL | fn refs(p1: &Self) -> &Bad { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:19:27 | LL | fn refs(p1: &Bad) -> &Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn refs(p1: &Bad) -> &Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:23:33 | LL | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Bad { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:23:49 | LL | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:27:26 | LL | fn mut_refs(p1: &mut Bad) -> &mut Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn mut_refs(p1: &mut Self) -> &mut Bad { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:27:39 | LL | fn mut_refs(p1: &mut Bad) -> &mut Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn mut_refs(p1: &mut Bad) -> &mut Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:31:24 | LL | fn nested(_p1: Box, _p2: (&u8, &Bad)) {} - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn nested(_p1: Box, _p2: (&u8, &Bad)) {} + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:31:42 | LL | fn nested(_p1: Box, _p2: (&u8, &Bad)) {} - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn nested(_p1: Box, _p2: (&u8, &Self)) {} + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:33:16 | LL | fn vals(_: Bad) -> Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn vals(_: Self) -> Bad { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:33:24 | LL | fn vals(_: Bad) -> Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn vals(_: Bad) -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:34:9 | LL | Bad - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | Self + | error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:39:19 | LL | type Output = Bad; - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | type Output = Self; + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:41:23 | LL | fn mul(self, rhs: Bad) -> Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn mul(self, rhs: Self) -> Bad { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:41:31 | LL | fn mul(self, rhs: Bad) -> Bad { - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | fn mul(self, rhs: Bad) -> Self { + | ~~~~ error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:48:9 | LL | Bad - | ^^^ help: use the applicable keyword: `Self` + | ^^^ + | +help: use the applicable keyword + | +LL | Self + | error: unnecessary structure name repetition --> tests/ui/use_self_trait.rs:145:13 | LL | std::fmt::Error // Should lint - | ^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` + | ^^^^^^^^^^^^^^^ + | +help: use the applicable keyword + | +LL | Self // Should lint + | ~~~~ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/useless_asref.stderr b/src/tools/clippy/tests/ui/useless_asref.stderr index 5f495c396705c..9dfed09d87fd2 100644 --- a/src/tools/clippy/tests/ui/useless_asref.stderr +++ b/src/tools/clippy/tests/ui/useless_asref.stderr @@ -2,115 +2,204 @@ error: this call to `as_ref` does nothing --> tests/ui/useless_asref.rs:50:18 | LL | foo_rstr(rstr.as_ref()); - | ^^^^^^^^^^^^^ help: try: `rstr` + | ^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/useless_asref.rs:1:9 | LL | #![deny(clippy::useless_asref)] | ^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | foo_rstr(rstr); + | ~~~~ error: this call to `as_ref` does nothing --> tests/ui/useless_asref.rs:52:20 | LL | foo_rslice(rslice.as_ref()); - | ^^^^^^^^^^^^^^^ help: try: `rslice` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | foo_rslice(rslice); + | ~~~~~~ error: this call to `as_mut` does nothing --> tests/ui/useless_asref.rs:56:21 | LL | foo_mrslice(mrslice.as_mut()); - | ^^^^^^^^^^^^^^^^ help: try: `mrslice` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | foo_mrslice(mrslice); + | ~~~~~~~ error: this call to `as_ref` does nothing --> tests/ui/useless_asref.rs:58:20 | LL | foo_rslice(mrslice.as_ref()); - | ^^^^^^^^^^^^^^^^ help: try: `mrslice` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | foo_rslice(mrslice); + | ~~~~~~~ error: this call to `as_ref` does nothing --> tests/ui/useless_asref.rs:65:20 | LL | foo_rslice(rrrrrslice.as_ref()); - | ^^^^^^^^^^^^^^^^^^^ help: try: `rrrrrslice` + | ^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | foo_rslice(rrrrrslice); + | ~~~~~~~~~~ error: this call to `as_ref` does nothing --> tests/ui/useless_asref.rs:67:18 | LL | foo_rstr(rrrrrstr.as_ref()); - | ^^^^^^^^^^^^^^^^^ help: try: `rrrrrstr` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | foo_rstr(rrrrrstr); + | ~~~~~~~~ error: this call to `as_mut` does nothing --> tests/ui/useless_asref.rs:72:21 | LL | foo_mrslice(mrrrrrslice.as_mut()); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `mrrrrrslice` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | foo_mrslice(mrrrrrslice); + | ~~~~~~~~~~~ error: this call to `as_ref` does nothing --> tests/ui/useless_asref.rs:74:20 | LL | foo_rslice(mrrrrrslice.as_ref()); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `mrrrrrslice` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | foo_rslice(mrrrrrslice); + | ~~~~~~~~~~~ error: this call to `as_ref` does nothing --> tests/ui/useless_asref.rs:78:16 | LL | foo_rrrrmr((&&&&MoreRef).as_ref()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&&&&MoreRef)` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | foo_rrrrmr((&&&&MoreRef)); + | ~~~~~~~~~~~~~ error: this call to `as_mut` does nothing --> tests/ui/useless_asref.rs:128:13 | LL | foo_mrt(mrt.as_mut()); - | ^^^^^^^^^^^^ help: try: `mrt` + | ^^^^^^^^^^^^ + | +help: try + | +LL | foo_mrt(mrt); + | ~~~ error: this call to `as_ref` does nothing --> tests/ui/useless_asref.rs:130:12 | LL | foo_rt(mrt.as_ref()); - | ^^^^^^^^^^^^ help: try: `mrt` + | ^^^^^^^^^^^^ + | +help: try + | +LL | foo_rt(mrt); + | ~~~ error: this call to `as_ref.map(...)` does nothing --> tests/ui/useless_asref.rs:141:13 | LL | let z = x.as_ref().map(String::clone); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let z = x.clone(); + | ~~~~~~~~~ error: this call to `as_ref.map(...)` does nothing --> tests/ui/useless_asref.rs:143:13 | LL | let z = x.as_ref().map(|z| z.clone()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let z = x.clone(); + | ~~~~~~~~~ error: this call to `as_ref.map(...)` does nothing --> tests/ui/useless_asref.rs:145:13 | LL | let z = x.as_ref().map(|z| String::clone(z)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | let z = x.clone(); + | ~~~~~~~~~ error: this call to `as_ref.map(...)` does nothing --> tests/ui/useless_asref.rs:169:9 | LL | x.field.as_ref().map(|v| v.clone()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.field.clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | x.field.clone(); + | ~~~~~~~~~~~~~~~ error: this call to `as_ref.map(...)` does nothing --> tests/ui/useless_asref.rs:171:9 | LL | x.field.as_ref().map(Clone::clone); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.field.clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | x.field.clone(); + | ~~~~~~~~~~~~~~~ error: this call to `as_ref.map(...)` does nothing --> tests/ui/useless_asref.rs:173:9 | LL | x.field.as_ref().map(|v| Clone::clone(v)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.field.clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | x.field.clone(); + | ~~~~~~~~~~~~~~~ error: this call to `as_ref.map(...)` does nothing --> tests/ui/useless_asref.rs:178:9 | LL | Some(1).as_ref().map(|&x| x.clone()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(1).clone()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | Some(1).clone(); + | ~~~~~~~~~~~~~~~ error: aborting due to 18 previous errors diff --git a/src/tools/clippy/tests/ui/useless_attribute.stderr b/src/tools/clippy/tests/ui/useless_attribute.stderr index 19f0e02de6808..0188304cf5990 100644 --- a/src/tools/clippy/tests/ui/useless_attribute.stderr +++ b/src/tools/clippy/tests/ui/useless_attribute.stderr @@ -2,22 +2,36 @@ error: useless lint attribute --> tests/ui/useless_attribute.rs:8:1 | LL | #[allow(dead_code)] - | ^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(dead_code)]` + | ^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::useless-attribute` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::useless_attribute)]` +help: if you just forgot a `!`, use + | +LL | #![allow(dead_code)] + | error: useless lint attribute --> tests/ui/useless_attribute.rs:9:1 | LL | #[cfg_attr(clippy, allow(dead_code))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(clippy, allow(dead_code)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: if you just forgot a `!`, use + | +LL | #![cfg_attr(clippy, allow(dead_code))] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: useless lint attribute --> tests/ui/useless_attribute.rs:20:5 | LL | #[allow(clippy::almost_swapped)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(clippy::almost_swapped)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: if you just forgot a `!`, use + | +LL | #![allow(clippy::almost_swapped)] + | error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/useless_conversion.stderr b/src/tools/clippy/tests/ui/useless_conversion.stderr index 82f945c5e89f6..40d3295e15275 100644 --- a/src/tools/clippy/tests/ui/useless_conversion.stderr +++ b/src/tools/clippy/tests/ui/useless_conversion.stderr @@ -2,229 +2,359 @@ error: useless conversion to the same type: `T` --> tests/ui/useless_conversion.rs:5:13 | LL | let _ = T::from(val); - | ^^^^^^^^^^^^ help: consider removing `T::from()`: `val` + | ^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/useless_conversion.rs:1:9 | LL | #![deny(clippy::useless_conversion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider removing `T::from()` + | +LL | let _ = val; + | ~~~ error: useless conversion to the same type: `T` --> tests/ui/useless_conversion.rs:6:5 | LL | val.into() - | ^^^^^^^^^^ help: consider removing `.into()`: `val` + | ^^^^^^^^^^ + | +help: consider removing `.into()` + | +LL | val + | error: useless conversion to the same type: `i32` --> tests/ui/useless_conversion.rs:18:22 | LL | let _: i32 = 0i32.into(); - | ^^^^^^^^^^^ help: consider removing `.into()`: `0i32` + | ^^^^^^^^^^^ + | +help: consider removing `.into()` + | +LL | let _: i32 = 0i32; + | ~~~~ error: useless conversion to the same type: `std::str::Lines<'_>` --> tests/ui/useless_conversion.rs:48:22 | LL | if Some("ok") == lines.into_iter().next() {} - | ^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `lines` + | ^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into_iter()` + | +LL | if Some("ok") == lines.next() {} + | ~~~~~ error: useless conversion to the same type: `std::str::Lines<'_>` --> tests/ui/useless_conversion.rs:53:21 | LL | let mut lines = text.lines().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into_iter()` + | +LL | let mut lines = text.lines(); + | ~~~~~~~~~~~~ error: useless conversion to the same type: `std::str::Lines<'_>` --> tests/ui/useless_conversion.rs:59:22 | LL | if Some("ok") == text.lines().into_iter().next() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into_iter()` + | +LL | if Some("ok") == text.lines().next() {} + | ~~~~~~~~~~~~ error: useless conversion to the same type: `std::ops::Range` --> tests/ui/useless_conversion.rs:65:13 | LL | let _ = NUMBERS.into_iter().next(); - | ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into_iter()` + | +LL | let _ = NUMBERS.next(); + | ~~~~~~~ error: useless conversion to the same type: `std::ops::Range` --> tests/ui/useless_conversion.rs:70:17 | LL | let mut n = NUMBERS.into_iter(); - | ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS` + | ^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into_iter()` + | +LL | let mut n = NUMBERS; + | ~~~~~~~ error: useless conversion to the same type: `std::string::String` --> tests/ui/useless_conversion.rs:132:21 | LL | let _: String = "foo".to_string().into(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into()` + | +LL | let _: String = "foo".to_string(); + | ~~~~~~~~~~~~~~~~~ error: useless conversion to the same type: `std::string::String` --> tests/ui/useless_conversion.rs:133:21 | LL | let _: String = From::from("foo".to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `From::from()` + | +LL | let _: String = "foo".to_string(); + | ~~~~~~~~~~~~~~~~~ error: useless conversion to the same type: `std::string::String` --> tests/ui/useless_conversion.rs:134:13 | LL | let _ = String::from("foo".to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `String::from()` + | +LL | let _ = "foo".to_string(); + | ~~~~~~~~~~~~~~~~~ error: useless conversion to the same type: `std::string::String` --> tests/ui/useless_conversion.rs:135:13 | LL | let _ = String::from(format!("A: {:04}", 123)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `String::from()` + | +LL | let _ = format!("A: {:04}", 123); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: useless conversion to the same type: `std::str::Lines<'_>` --> tests/ui/useless_conversion.rs:136:13 | LL | let _ = "".lines().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into_iter()` + | +LL | let _ = "".lines(); + | ~~~~~~~~~~ error: useless conversion to the same type: `std::vec::IntoIter` --> tests/ui/useless_conversion.rs:137:13 | LL | let _ = vec![1, 2, 3].into_iter().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into_iter()` + | +LL | let _ = vec![1, 2, 3].into_iter(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: useless conversion to the same type: `std::string::String` --> tests/ui/useless_conversion.rs:138:21 | LL | let _: String = format!("Hello {}", "world").into(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into()` + | +LL | let _: String = format!("Hello {}", "world"); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: useless conversion to the same type: `i32` --> tests/ui/useless_conversion.rs:143:13 | LL | let _ = i32::from(a + b) * 3; - | ^^^^^^^^^^^^^^^^ help: consider removing `i32::from()`: `(a + b)` + | ^^^^^^^^^^^^^^^^ + | +help: consider removing `i32::from()` + | +LL | let _ = (a + b) * 3; + | ~~~~~~~ error: useless conversion to the same type: `Foo<'a'>` --> tests/ui/useless_conversion.rs:149:23 | LL | let _: Foo<'a'> = s2.into(); - | ^^^^^^^^^ help: consider removing `.into()`: `s2` + | ^^^^^^^^^ + | +help: consider removing `.into()` + | +LL | let _: Foo<'a'> = s2; + | ~~ error: useless conversion to the same type: `Foo<'a'>` --> tests/ui/useless_conversion.rs:151:13 | LL | let _ = Foo::<'a'>::from(s3); - | ^^^^^^^^^^^^^^^^^^^^ help: consider removing `Foo::<'a'>::from()`: `s3` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `Foo::<'a'>::from()` + | +LL | let _ = s3; + | ~~ error: useless conversion to the same type: `std::vec::IntoIter>` --> tests/ui/useless_conversion.rs:153:13 | LL | let _ = vec![s4, s4, s4].into_iter().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![s4, s4, s4].into_iter()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider removing `.into_iter()` + | +LL | let _ = vec![s4, s4, s4].into_iter(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> tests/ui/useless_conversion.rs:185:7 | LL | b(vec![1, 2].into_iter()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]` + | ^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> tests/ui/useless_conversion.rs:175:13 | LL | fn b>(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider removing the `.into_iter()` + | +LL | b(vec![1, 2]); + | ~~~~~~~~~~ error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> tests/ui/useless_conversion.rs:186:7 | LL | c(vec![1, 2].into_iter()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]` + | ^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> tests/ui/useless_conversion.rs:176:18 | LL | fn c(_: impl IntoIterator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider removing the `.into_iter()` + | +LL | c(vec![1, 2]); + | ~~~~~~~~~~ error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> tests/ui/useless_conversion.rs:187:7 | LL | d(vec![1, 2].into_iter()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]` + | ^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> tests/ui/useless_conversion.rs:179:12 | LL | T: IntoIterator, | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider removing the `.into_iter()` + | +LL | d(vec![1, 2]); + | ~~~~~~~~~~ error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> tests/ui/useless_conversion.rs:190:7 | LL | b(vec![1, 2].into_iter().into_iter()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> tests/ui/useless_conversion.rs:175:13 | LL | fn b>(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider removing the `.into_iter()`s + | +LL | b(vec![1, 2]); + | ~~~~~~~~~~ error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> tests/ui/useless_conversion.rs:191:7 | LL | b(vec![1, 2].into_iter().into_iter().into_iter()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> tests/ui/useless_conversion.rs:175:13 | LL | fn b>(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider removing the `.into_iter()`s + | +LL | b(vec![1, 2]); + | ~~~~~~~~~~ error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> tests/ui/useless_conversion.rs:237:24 | LL | foo2::([1, 2, 3].into_iter()); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]` + | ^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> tests/ui/useless_conversion.rs:216:12 | LL | I: IntoIterator + Helper, | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider removing the `.into_iter()` + | +LL | foo2::([1, 2, 3]); + | ~~~~~~~~~ error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> tests/ui/useless_conversion.rs:245:14 | LL | foo3([1, 2, 3].into_iter()); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]` + | ^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> tests/ui/useless_conversion.rs:225:12 | LL | I: IntoIterator, | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider removing the `.into_iter()` + | +LL | foo3([1, 2, 3]); + | ~~~~~~~~~ error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> tests/ui/useless_conversion.rs:254:16 | LL | S1.foo([1, 2].into_iter()); - | ^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2]` + | ^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> tests/ui/useless_conversion.rs:251:27 | LL | pub fn foo(&self, _: I) {} | ^^^^^^^^^^^^ +help: consider removing the `.into_iter()` + | +LL | S1.foo([1, 2]); + | ~~~~~~ error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> tests/ui/useless_conversion.rs:273:44 | LL | v0.into_iter().interleave_shortest(v1.into_iter()); - | ^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `v1` + | ^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> tests/ui/useless_conversion.rs:260:20 | LL | J: IntoIterator, | ^^^^^^^^^^^^ +help: consider removing the `.into_iter()` + | +LL | v0.into_iter().interleave_shortest(v1); + | ~~ error: aborting due to 28 previous errors diff --git a/src/tools/clippy/tests/ui/vec.stderr b/src/tools/clippy/tests/ui/vec.stderr index 3faea8033fe2c..1318f87237fc1 100644 --- a/src/tools/clippy/tests/ui/vec.stderr +++ b/src/tools/clippy/tests/ui/vec.stderr @@ -2,130 +2,234 @@ error: useless use of `vec!` --> tests/ui/vec.rs:30:14 | LL | on_slice(&vec![]); - | ^^^^^^^ help: you can use a slice directly: `&[]` + | ^^^^^^^ | = note: `-D clippy::useless-vec` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]` +help: you can use a slice directly + | +LL | on_slice(&[]); + | ~~~ error: useless use of `vec!` --> tests/ui/vec.rs:32:18 | LL | on_mut_slice(&mut vec![]); - | ^^^^^^^^^^^ help: you can use a slice directly: `&mut []` + | ^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | on_mut_slice(&mut []); + | ~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:34:14 | LL | on_slice(&vec![1, 2]); - | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` + | ^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | on_slice(&[1, 2]); + | ~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:36:18 | LL | on_mut_slice(&mut vec![1, 2]); - | ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1, 2]` + | ^^^^^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | on_mut_slice(&mut [1, 2]); + | ~~~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:38:14 | LL | on_slice(&vec![1, 2]); - | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` + | ^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | on_slice(&[1, 2]); + | ~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:40:18 | LL | on_mut_slice(&mut vec![1, 2]); - | ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1, 2]` + | ^^^^^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | on_mut_slice(&mut [1, 2]); + | ~~~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:42:14 | LL | on_slice(&vec!(1, 2)); - | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` + | ^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | on_slice(&[1, 2]); + | ~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:44:18 | LL | on_mut_slice(&mut vec![1, 2]); - | ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1, 2]` + | ^^^^^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | on_mut_slice(&mut [1, 2]); + | ~~~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:46:14 | LL | on_slice(&vec![1; 2]); - | ^^^^^^^^^^^ help: you can use a slice directly: `&[1; 2]` + | ^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | on_slice(&[1; 2]); + | ~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:48:18 | LL | on_mut_slice(&mut vec![1; 2]); - | ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1; 2]` + | ^^^^^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | on_mut_slice(&mut [1; 2]); + | ~~~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:74:19 | LL | let _x: i32 = vec![1, 2, 3].iter().sum(); - | ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]` + | ^^^^^^^^^^^^^ + | +help: you can use an array directly + | +LL | let _x: i32 = [1, 2, 3].iter().sum(); + | ~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:77:17 | LL | let mut x = vec![1, 2, 3]; - | ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]` + | ^^^^^^^^^^^^^ + | +help: you can use an array directly + | +LL | let mut x = [1, 2, 3]; + | ~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:83:22 | LL | let _x: &[i32] = &vec![1, 2, 3]; - | ^^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2, 3]` + | ^^^^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | let _x: &[i32] = &[1, 2, 3]; + | ~~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:85:14 | LL | for _ in vec![1, 2, 3] {} - | ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]` + | ^^^^^^^^^^^^^ + | +help: you can use an array directly + | +LL | for _ in [1, 2, 3] {} + | ~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:124:20 | LL | for _string in vec![repro!(true), repro!(null)] { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[repro!(true), repro!(null)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can use an array directly + | +LL | for _string in [repro!(true), repro!(null)] { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:141:18 | LL | in_macro!(1, vec![1, 2], vec![1; 2]); - | ^^^^^^^^^^ help: you can use an array directly: `[1, 2]` + | ^^^^^^^^^^ + | +help: you can use an array directly + | +LL | in_macro!(1, [1, 2], vec![1; 2]); + | ~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:141:30 | LL | in_macro!(1, vec![1, 2], vec![1; 2]); - | ^^^^^^^^^^ help: you can use an array directly: `[1; 2]` + | ^^^^^^^^^^ + | +help: you can use an array directly + | +LL | in_macro!(1, vec![1, 2], [1; 2]); + | ~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:160:14 | LL | for a in vec![1, 2, 3] { - | ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]` + | ^^^^^^^^^^^^^ + | +help: you can use an array directly + | +LL | for a in [1, 2, 3] { + | ~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:164:14 | LL | for a in vec![String::new(), String::new()] { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[String::new(), String::new()]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can use an array directly + | +LL | for a in [String::new(), String::new()] { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: useless use of `vec!` --> tests/ui/vec.rs:196:33 | LL | this_macro_doesnt_need_vec!(vec![1]); - | ^^^^^^^ help: you can use an array directly: `[1]` + | ^^^^^^^ + | +help: you can use an array directly + | +LL | this_macro_doesnt_need_vec!([1]); + | ~~~ error: useless use of `vec!` --> tests/ui/vec.rs:222:14 | LL | for a in &(vec![1, 2]) {} - | ^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` + | ^^^^^^^^^^^^^ + | +help: you can use a slice directly + | +LL | for a in &[1, 2] {} + | ~~~~~~~ error: aborting due to 21 previous errors diff --git a/src/tools/clippy/tests/ui/vec_box_sized.stderr b/src/tools/clippy/tests/ui/vec_box_sized.stderr index 0ffcc83143402..fa5580c323d31 100644 --- a/src/tools/clippy/tests/ui/vec_box_sized.stderr +++ b/src/tools/clippy/tests/ui/vec_box_sized.stderr @@ -2,58 +2,102 @@ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui/vec_box_sized.rs:26:14 | LL | const C: Vec> = Vec::new(); - | ^^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^^ | = note: `-D clippy::vec-box` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::vec_box)]` +help: try + | +LL | const C: Vec = Vec::new(); + | ~~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui/vec_box_sized.rs:27:15 | LL | static S: Vec> = Vec::new(); - | ^^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | static S: Vec = Vec::new(); + | ~~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui/vec_box_sized.rs:30:21 | LL | sized_type: Vec>, - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | sized_type: Vec, + | ~~~~~~~~~~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui/vec_box_sized.rs:33:14 | LL | struct A(Vec>); - | ^^^^^^^^^^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | struct A(Vec); + | ~~~~~~~~~~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui/vec_box_sized.rs:34:18 | LL | struct B(Vec>>); - | ^^^^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | struct B(Vec>); + | ~~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui/vec_box_sized.rs:36:42 | LL | fn allocator_global_defined_vec() -> Vec, std::alloc::Global> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | fn allocator_global_defined_vec() -> Vec { + | ~~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui/vec_box_sized.rs:39:42 | LL | fn allocator_global_defined_box() -> Vec> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | fn allocator_global_defined_box() -> Vec { + | ~~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui/vec_box_sized.rs:42:29 | LL | fn allocator_match() -> Vec, DummyAllocator> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | fn allocator_match() -> Vec { + | ~~~~~~~~ error: `Vec` is already on the heap, the boxing is unnecessary --> tests/ui/vec_box_sized.rs:79:23 | LL | pub fn f() -> Vec> { - | ^^^^^^^^^^^ help: try: `Vec` + | ^^^^^^^^^^^ + | +help: try + | +LL | pub fn f() -> Vec { + | ~~~~~~ error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/vec_init_then_push.stderr b/src/tools/clippy/tests/ui/vec_init_then_push.stderr index 58720c9a18135..0fe3251b24b53 100644 --- a/src/tools/clippy/tests/ui/vec_init_then_push.stderr +++ b/src/tools/clippy/tests/ui/vec_init_then_push.stderr @@ -5,10 +5,14 @@ LL | / let mut def_err: Vec = Default::default(); LL | | LL | | LL | | def_err.push(0); - | |____________________^ help: consider using the `vec![]` macro: `let def_err: Vec = vec![..];` + | |____________________^ | = note: `-D clippy::vec-init-then-push` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::vec_init_then_push)]` +help: consider using the `vec![]` macro + | +LL | let def_err: Vec = vec![..]; + | error: calls to `push` immediately after creation --> tests/ui/vec_init_then_push.rs:10:5 @@ -16,7 +20,12 @@ error: calls to `push` immediately after creation LL | / let mut new_err = Vec::::new(); LL | | LL | | new_err.push(1); - | |____________________^ help: consider using the `vec![]` macro: `let mut new_err = vec![..];` + | |____________________^ + | +help: consider using the `vec![]` macro + | +LL | let mut new_err = vec![..]; + | error: calls to `push` immediately after creation --> tests/ui/vec_init_then_push.rs:14:5 @@ -26,7 +35,12 @@ LL | | LL | | cap_err.push(0); LL | | cap_err.push(1); LL | | cap_err.push(2); - | |____________________^ help: consider using the `vec![]` macro: `let mut cap_err = vec![..];` + | |____________________^ + | +help: consider using the `vec![]` macro + | +LL | let mut cap_err = vec![..]; + | error: calls to `push` immediately after creation --> tests/ui/vec_init_then_push.rs:27:5 @@ -34,7 +48,12 @@ error: calls to `push` immediately after creation LL | / new_err = Vec::new(); LL | | LL | | new_err.push(0); - | |____________________^ help: consider using the `vec![]` macro: `new_err = vec![..];` + | |____________________^ + | +help: consider using the `vec![]` macro + | +LL | new_err = vec![..]; + | error: calls to `push` immediately after creation --> tests/ui/vec_init_then_push.rs:78:5 @@ -43,7 +62,12 @@ LL | / let mut v = Vec::new(); LL | | LL | | v.push(x); LL | | v.push(1); - | |______________^ help: consider using the `vec![]` macro: `let mut v = vec![..];` + | |______________^ + | +help: consider using the `vec![]` macro + | +LL | let mut v = vec![..]; + | error: calls to `push` immediately after creation --> tests/ui/vec_init_then_push.rs:87:5 @@ -55,7 +79,12 @@ LL | | v.push(1); ... | LL | | v.push(1); LL | | v.push(0); - | |______________^ help: consider using the `vec![]` macro: `let mut v = vec![..];` + | |______________^ + | +help: consider using the `vec![]` macro + | +LL | let mut v = vec![..]; + | error: calls to `push` immediately after creation --> tests/ui/vec_init_then_push.rs:101:5 @@ -67,7 +96,12 @@ LL | | v2.push(1); ... | LL | | v2.push(1); LL | | v2.push(0); - | |_______________^ help: consider using the `vec![]` macro: `let mut v2 = vec![..];` + | |_______________^ + | +help: consider using the `vec![]` macro + | +LL | let mut v2 = vec![..]; + | error: calls to `push` immediately after creation --> tests/ui/vec_init_then_push.rs:117:5 @@ -75,7 +109,12 @@ error: calls to `push` immediately after creation LL | / let mut v = Vec::new(); LL | | LL | | v.push((0i32, 0i32)); - | |_________________________^ help: consider using the `vec![]` macro: `let v = vec![..];` + | |_________________________^ + | +help: consider using the `vec![]` macro + | +LL | let v = vec![..]; + | error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/vec_resize_to_zero.stderr b/src/tools/clippy/tests/ui/vec_resize_to_zero.stderr index ee4efeb2009be..0166b40b2960a 100644 --- a/src/tools/clippy/tests/ui/vec_resize_to_zero.stderr +++ b/src/tools/clippy/tests/ui/vec_resize_to_zero.stderr @@ -2,13 +2,15 @@ error: emptying a vector with `resize` --> tests/ui/vec_resize_to_zero.rs:7:5 | LL | v.resize(0, 5); - | ^^------------ - | | - | help: ...or you can empty the vector with: `clear()` + | ^^^^^^^^^^^^^^ | = help: the arguments may be inverted... = note: `-D clippy::vec-resize-to-zero` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::vec_resize_to_zero)]` +help: ...or you can empty the vector with + | +LL | v.clear(); + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/waker_clone_wake.stderr b/src/tools/clippy/tests/ui/waker_clone_wake.stderr index bf2c02a76c9bb..e5916c0ee4122 100644 --- a/src/tools/clippy/tests/ui/waker_clone_wake.stderr +++ b/src/tools/clippy/tests/ui/waker_clone_wake.stderr @@ -2,16 +2,25 @@ error: cloning a `Waker` only to wake it --> tests/ui/waker_clone_wake.rs:15:5 | LL | cx.waker().clone().wake(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `cx.waker().wake_by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::waker-clone-wake` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::waker_clone_wake)]` +help: replace with + | +LL | cx.waker().wake_by_ref(); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: cloning a `Waker` only to wake it --> tests/ui/waker_clone_wake.rs:17:5 | LL | mac!(cx).clone().wake(); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `mac!(cx).wake_by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace with + | +LL | mac!(cx).wake_by_ref(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/while_let_loop.stderr b/src/tools/clippy/tests/ui/while_let_loop.stderr index 5212d4fdcc7b8..e2f6fd96c6471 100644 --- a/src/tools/clippy/tests/ui/while_let_loop.stderr +++ b/src/tools/clippy/tests/ui/while_let_loop.stderr @@ -8,10 +8,14 @@ LL | | if let Some(_x) = y { ... | LL | | } LL | | } - | |_____^ help: try: `while let Some(_x) = y { .. }` + | |_____^ | = note: `-D clippy::while-let-loop` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::while_let_loop)]` +help: try + | +LL | while let Some(_x) = y { .. } + | error: this loop could be written as a `while let` loop --> tests/ui/while_let_loop.rs:25:5 @@ -23,7 +27,12 @@ LL | | Some(_x) => true, LL | | None => break, LL | | }; LL | | } - | |_____^ help: try: `while let Some(_x) = y { .. }` + | |_____^ + | +help: try + | +LL | while let Some(_x) = y { .. } + | error: this loop could be written as a `while let` loop --> tests/ui/while_let_loop.rs:33:5 @@ -35,7 +44,12 @@ LL | | Some(x) => x, ... | LL | | let _str = "foo"; LL | | } - | |_____^ help: try: `while let Some(x) = y { .. }` + | |_____^ + | +help: try + | +LL | while let Some(x) = y { .. } + | error: this loop could be written as a `while let` loop --> tests/ui/while_let_loop.rs:43:5 @@ -47,7 +61,12 @@ LL | | Some(x) => x, ... | LL | | } LL | | } - | |_____^ help: try: `while let Some(x) = y { .. }` + | |_____^ + | +help: try + | +LL | while let Some(x) = y { .. } + | error: this loop could be written as a `while let` loop --> tests/ui/while_let_loop.rs:74:5 @@ -59,7 +78,12 @@ LL | | Some(word) => (word.is_empty(), word.len()), ... | LL | | let _ = (e, l); LL | | } - | |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }` + | |_____^ + | +help: try + | +LL | while let Some(word) = "".split_whitespace().next() { .. } + | error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/while_let_on_iterator.stderr b/src/tools/clippy/tests/ui/while_let_on_iterator.stderr index 8ff1f23644b16..d4944ea451fd0 100644 --- a/src/tools/clippy/tests/ui/while_let_on_iterator.stderr +++ b/src/tools/clippy/tests/ui/while_let_on_iterator.stderr @@ -2,166 +2,300 @@ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:15:5 | LL | while let Option::Some(x) = iter.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in iter` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::while-let-on-iterator` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::while_let_on_iterator)]` +help: try + | +LL | for x in iter { + | ~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:20:5 | LL | while let Some(x) = iter.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in iter` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in iter { + | ~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:25:5 | LL | while let Some(_) = iter.next() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in iter` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for _ in iter {} + | ~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:101:9 | LL | while let Some([..]) = it.next() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for [..] in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for [..] in it {} + | ~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:108:9 | LL | while let Some([_x]) = it.next() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for [_x] in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for [_x] in it {} + | ~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:121:9 | LL | while let Some(x @ [_]) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x @ [_] in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x @ [_] in it { + | ~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:141:9 | LL | while let Some(_) = y.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in y` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for _ in y { + | ~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:198:9 | LL | while let Some(m) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for m in it.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:209:5 | LL | while let Some(n) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for n in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for n in it { + | ~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:211:9 | LL | while let Some(m) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for m in it { + | ~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:220:9 | LL | while let Some(m) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for m in it { + | ~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:229:9 | LL | while let Some(m) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for m in it.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:246:9 | LL | while let Some(m) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for m in it.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:261:13 | LL | while let Some(i) = self.0.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for i in self.0.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for i in self.0.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:293:13 | LL | while let Some(i) = self.0.0.0.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for i in self.0.0.0.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for i in self.0.0.0.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:322:5 | LL | while let Some(n) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for n in it.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for n in it.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:334:9 | LL | while let Some(x) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in it.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:348:5 | LL | while let Some(x) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in it.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:359:5 | LL | while let Some(x) = it.0.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.0.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in it.0.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:394:5 | LL | while let Some(x) = s.x.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in s.x.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in s.x.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:401:5 | LL | while let Some(x) = x[0].next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in x[0].by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in x[0].by_ref() { + | ~~~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:409:9 | LL | while let Some(x) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in it.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:419:9 | LL | while let Some(x) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in it { + | ~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:429:9 | LL | while let Some(x) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.by_ref()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in it.by_ref() { + | ~~~~~~~~~~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:439:9 | LL | while let Some(x) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in it { + | ~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:451:9 | LL | while let Some(x) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for x in it { + | ~~~~~~~~~~~ error: this loop could be written as a `for` loop --> tests/ui/while_let_on_iterator.rs:461:5 | LL | while let Some(..) = it.next() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in it` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | for _ in it { + | ~~~~~~~~~~~ error: aborting due to 27 previous errors diff --git a/src/tools/clippy/tests/ui/wildcard_enum_match_arm.stderr b/src/tools/clippy/tests/ui/wildcard_enum_match_arm.stderr index 70ac768aaacdc..782919a4631c7 100644 --- a/src/tools/clippy/tests/ui/wildcard_enum_match_arm.stderr +++ b/src/tools/clippy/tests/ui/wildcard_enum_match_arm.stderr @@ -2,43 +2,72 @@ error: wildcard match will also match any future added variants --> tests/ui/wildcard_enum_match_arm.rs:39:9 | LL | _ => eprintln!("Not red"), - | ^ help: try: `Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan` + | ^ | note: the lint level is defined here --> tests/ui/wildcard_enum_match_arm.rs:2:9 | LL | #![deny(clippy::wildcard_enum_match_arm)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try + | +LL | Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan => eprintln!("Not red"), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: wildcard match will also match any future added variants --> tests/ui/wildcard_enum_match_arm.rs:43:9 | LL | _not_red => eprintln!("Not red"), - | ^^^^^^^^ help: try: `_not_red @ Color::Green | _not_red @ Color::Blue | _not_red @ Color::Rgb(..) | _not_red @ Color::Cyan` + | ^^^^^^^^ + | +help: try + | +LL | _not_red @ Color::Green | _not_red @ Color::Blue | _not_red @ Color::Rgb(..) | _not_red @ Color::Cyan => eprintln!("Not red"), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: wildcard match will also match any future added variants --> tests/ui/wildcard_enum_match_arm.rs:47:9 | LL | not_red => format!("{:?}", not_red), - | ^^^^^^^ help: try: `not_red @ Color::Green | not_red @ Color::Blue | not_red @ Color::Rgb(..) | not_red @ Color::Cyan` + | ^^^^^^^ + | +help: try + | +LL | not_red @ Color::Green | not_red @ Color::Blue | not_red @ Color::Rgb(..) | not_red @ Color::Cyan => format!("{:?}", not_red), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: wildcard match will also match any future added variants --> tests/ui/wildcard_enum_match_arm.rs:63:9 | LL | _ => "No red", - | ^ help: try: `Color::Red | Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan` + | ^ + | +help: try + | +LL | Color::Red | Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan => "No red", + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: wildcard matches known variants and will also match future added variants --> tests/ui/wildcard_enum_match_arm.rs:80:9 | LL | _ => {}, - | ^ help: try: `ErrorKind::PermissionDenied | _` + | ^ + | +help: try + | +LL | ErrorKind::PermissionDenied | _ => {}, + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: wildcard match will also match any future added variants --> tests/ui/wildcard_enum_match_arm.rs:98:13 | LL | _ => (), - | ^ help: try: `Enum::B | Enum::__Private` + | ^ + | +help: try + | +LL | Enum::B | Enum::__Private => (), + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/tools/clippy/tests/ui/wildcard_imports.stderr b/src/tools/clippy/tests/ui/wildcard_imports.stderr index 0c69d5262c26f..e0e86088f6dc6 100644 --- a/src/tools/clippy/tests/ui/wildcard_imports.stderr +++ b/src/tools/clippy/tests/ui/wildcard_imports.stderr @@ -2,94 +2,168 @@ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:15:5 | LL | use crate::fn_mod::*; - | ^^^^^^^^^^^^^^^^ help: try: `crate::fn_mod::foo` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::wildcard-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::wildcard_imports)]` +help: try + | +LL | use crate::fn_mod::foo; + | ~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:16:5 | LL | use crate::mod_mod::*; - | ^^^^^^^^^^^^^^^^^ help: try: `crate::mod_mod::inner_mod` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::mod_mod::inner_mod; + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:17:5 | LL | use crate::multi_fn_mod::*; - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:19:5 | LL | use crate::struct_mod::*; - | ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::struct_mod::{A, inner_struct_mod}` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::struct_mod::{A, inner_struct_mod}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:23:5 | LL | use wildcard_imports_helper::inner::inner_for_self_import::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:24:5 | LL | use wildcard_imports_helper::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::{ExternA, extern_foo}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:94:13 | LL | use self::exports_underscore_ish::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self::exports_underscore_ish::{_Deref, dummy}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use self::exports_underscore_ish::{_Deref, dummy}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:125:13 | LL | use crate::fn_mod::*; - | ^^^^^^^^^^^^^^^^ help: try: `crate::fn_mod::foo` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::fn_mod::foo; + | ~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:131:75 | LL | use wildcard_imports_helper::inner::inner_for_self_import::{self, *}; - | ^ help: try: `inner_extern_foo` + | ^ + | +help: try + | +LL | use wildcard_imports_helper::inner::inner_for_self_import::{self, inner_extern_foo}; + | ~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:132:13 | LL | use wildcard_imports_helper::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::{ExternA, extern_foo}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:144:20 | LL | use self::{inner::*, inner2::*}; - | ^^^^^^^^ help: try: `inner::inner_foo` + | ^^^^^^^^ + | +help: try + | +LL | use self::{inner::inner_foo, inner2::*}; + | ~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:144:30 | LL | use self::{inner::*, inner2::*}; - | ^^^^^^^^^ help: try: `inner2::inner_bar` + | ^^^^^^^^^ + | +help: try + | +LL | use self::{inner::*, inner2::inner_bar}; + | ~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:151:13 | LL | use wildcard_imports_helper::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:180:9 | LL | use crate::in_fn_test::*; - | ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:189:9 | LL | use crate:: in_fn_test:: * ; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate:: in_fn_test::exported` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate:: in_fn_test::exported; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:190:9 @@ -97,43 +171,78 @@ error: usage of wildcard import LL | use crate:: fn_mod:: | _________^ LL | | *; - | |_________^ help: try: `crate:: fn_mod::foo` + | |_________^ + | +help: try + | +LL | use crate:: fn_mod::foo; + | ~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:201:13 | LL | use super::*; - | ^^^^^^^^ help: try: `super::foofoo` + | ^^^^^^^^ + | +help: try + | +LL | use super::foofoo; + | ~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:236:17 | LL | use super::*; - | ^^^^^^^^ help: try: `super::insidefoo` + | ^^^^^^^^ + | +help: try + | +LL | use super::insidefoo; + | ~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:244:13 | LL | use crate::super_imports::*; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::super_imports::foofoo` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::super_imports::foofoo; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:253:17 | LL | use super::super::*; - | ^^^^^^^^^^^^^^^ help: try: `super::super::foofoo` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | use super::super::foofoo; + | ~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:262:13 | LL | use super::super::super_imports::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `super::super::super_imports::foofoo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use super::super::super_imports::foofoo; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports.rs:270:13 | LL | use super::*; - | ^^^^^^^^ help: try: `super::foofoo` + | ^^^^^^^^ + | +help: try + | +LL | use super::foofoo; + | ~~~~~~~~~~~~~ error: aborting due to 22 previous errors diff --git a/src/tools/clippy/tests/ui/wildcard_imports_2021.edition2018.stderr b/src/tools/clippy/tests/ui/wildcard_imports_2021.edition2018.stderr index 11e0bd377692d..564b1176fbf59 100644 --- a/src/tools/clippy/tests/ui/wildcard_imports_2021.edition2018.stderr +++ b/src/tools/clippy/tests/ui/wildcard_imports_2021.edition2018.stderr @@ -2,94 +2,168 @@ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:13:5 | LL | use crate::fn_mod::*; - | ^^^^^^^^^^^^^^^^ help: try: `crate::fn_mod::foo` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::wildcard-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::wildcard_imports)]` +help: try + | +LL | use crate::fn_mod::foo; + | ~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:14:5 | LL | use crate::mod_mod::*; - | ^^^^^^^^^^^^^^^^^ help: try: `crate::mod_mod::inner_mod` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::mod_mod::inner_mod; + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:15:5 | LL | use crate::multi_fn_mod::*; - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:16:5 | LL | use crate::struct_mod::*; - | ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::struct_mod::{A, inner_struct_mod}` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::struct_mod::{A, inner_struct_mod}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:19:5 | LL | use wildcard_imports_helper::inner::inner_for_self_import::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:21:5 | LL | use wildcard_imports_helper::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::{ExternA, extern_foo}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:89:13 | LL | use exports_underscore_ish::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `exports_underscore_ish::{_Deref, dummy}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use exports_underscore_ish::{_Deref, dummy}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:119:13 | LL | use crate::fn_mod::*; - | ^^^^^^^^^^^^^^^^ help: try: `crate::fn_mod::foo` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::fn_mod::foo; + | ~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:125:75 | LL | use wildcard_imports_helper::inner::inner_for_self_import::{self, *}; - | ^ help: try: `inner_extern_foo` + | ^ + | +help: try + | +LL | use wildcard_imports_helper::inner::inner_for_self_import::{self, inner_extern_foo}; + | ~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:126:13 | LL | use wildcard_imports_helper::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::{ExternA, extern_foo}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:138:20 | LL | use self::{inner::*, inner2::*}; - | ^^^^^^^^ help: try: `inner::inner_foo` + | ^^^^^^^^ + | +help: try + | +LL | use self::{inner::inner_foo, inner2::*}; + | ~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:138:30 | LL | use self::{inner::*, inner2::*}; - | ^^^^^^^^^ help: try: `inner2::inner_bar` + | ^^^^^^^^^ + | +help: try + | +LL | use self::{inner::*, inner2::inner_bar}; + | ~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:145:13 | LL | use wildcard_imports_helper::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:174:9 | LL | use crate::in_fn_test::*; - | ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:183:9 | LL | use crate:: in_fn_test:: * ; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate:: in_fn_test::exported` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate:: in_fn_test::exported; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:184:9 @@ -97,43 +171,78 @@ error: usage of wildcard import LL | use crate:: fn_mod:: | _________^ LL | | *; - | |_________^ help: try: `crate:: fn_mod::foo` + | |_________^ + | +help: try + | +LL | use crate:: fn_mod::foo; + | ~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:195:13 | LL | use super::*; - | ^^^^^^^^ help: try: `super::foofoo` + | ^^^^^^^^ + | +help: try + | +LL | use super::foofoo; + | ~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:230:17 | LL | use super::*; - | ^^^^^^^^ help: try: `super::insidefoo` + | ^^^^^^^^ + | +help: try + | +LL | use super::insidefoo; + | ~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:238:13 | LL | use crate::super_imports::*; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::super_imports::foofoo` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::super_imports::foofoo; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:247:17 | LL | use super::super::*; - | ^^^^^^^^^^^^^^^ help: try: `super::super::foofoo` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | use super::super::foofoo; + | ~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:256:13 | LL | use super::super::super_imports::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `super::super::super_imports::foofoo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use super::super::super_imports::foofoo; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:264:13 | LL | use super::*; - | ^^^^^^^^ help: try: `super::foofoo` + | ^^^^^^^^ + | +help: try + | +LL | use super::foofoo; + | ~~~~~~~~~~~~~ error: aborting due to 22 previous errors diff --git a/src/tools/clippy/tests/ui/wildcard_imports_2021.edition2021.stderr b/src/tools/clippy/tests/ui/wildcard_imports_2021.edition2021.stderr index 11e0bd377692d..564b1176fbf59 100644 --- a/src/tools/clippy/tests/ui/wildcard_imports_2021.edition2021.stderr +++ b/src/tools/clippy/tests/ui/wildcard_imports_2021.edition2021.stderr @@ -2,94 +2,168 @@ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:13:5 | LL | use crate::fn_mod::*; - | ^^^^^^^^^^^^^^^^ help: try: `crate::fn_mod::foo` + | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::wildcard-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::wildcard_imports)]` +help: try + | +LL | use crate::fn_mod::foo; + | ~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:14:5 | LL | use crate::mod_mod::*; - | ^^^^^^^^^^^^^^^^^ help: try: `crate::mod_mod::inner_mod` + | ^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::mod_mod::inner_mod; + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:15:5 | LL | use crate::multi_fn_mod::*; - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:16:5 | LL | use crate::struct_mod::*; - | ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::struct_mod::{A, inner_struct_mod}` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::struct_mod::{A, inner_struct_mod}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:19:5 | LL | use wildcard_imports_helper::inner::inner_for_self_import::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:21:5 | LL | use wildcard_imports_helper::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::{ExternA, extern_foo}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:89:13 | LL | use exports_underscore_ish::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `exports_underscore_ish::{_Deref, dummy}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use exports_underscore_ish::{_Deref, dummy}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:119:13 | LL | use crate::fn_mod::*; - | ^^^^^^^^^^^^^^^^ help: try: `crate::fn_mod::foo` + | ^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::fn_mod::foo; + | ~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:125:75 | LL | use wildcard_imports_helper::inner::inner_for_self_import::{self, *}; - | ^ help: try: `inner_extern_foo` + | ^ + | +help: try + | +LL | use wildcard_imports_helper::inner::inner_for_self_import::{self, inner_extern_foo}; + | ~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:126:13 | LL | use wildcard_imports_helper::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::{ExternA, extern_foo}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:138:20 | LL | use self::{inner::*, inner2::*}; - | ^^^^^^^^ help: try: `inner::inner_foo` + | ^^^^^^^^ + | +help: try + | +LL | use self::{inner::inner_foo, inner2::*}; + | ~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:138:30 | LL | use self::{inner::*, inner2::*}; - | ^^^^^^^^^ help: try: `inner2::inner_bar` + | ^^^^^^^^^ + | +help: try + | +LL | use self::{inner::*, inner2::inner_bar}; + | ~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:145:13 | LL | use wildcard_imports_helper::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:174:9 | LL | use crate::in_fn_test::*; - | ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:183:9 | LL | use crate:: in_fn_test:: * ; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate:: in_fn_test::exported` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate:: in_fn_test::exported; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:184:9 @@ -97,43 +171,78 @@ error: usage of wildcard import LL | use crate:: fn_mod:: | _________^ LL | | *; - | |_________^ help: try: `crate:: fn_mod::foo` + | |_________^ + | +help: try + | +LL | use crate:: fn_mod::foo; + | ~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:195:13 | LL | use super::*; - | ^^^^^^^^ help: try: `super::foofoo` + | ^^^^^^^^ + | +help: try + | +LL | use super::foofoo; + | ~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:230:17 | LL | use super::*; - | ^^^^^^^^ help: try: `super::insidefoo` + | ^^^^^^^^ + | +help: try + | +LL | use super::insidefoo; + | ~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:238:13 | LL | use crate::super_imports::*; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::super_imports::foofoo` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use crate::super_imports::foofoo; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:247:17 | LL | use super::super::*; - | ^^^^^^^^^^^^^^^ help: try: `super::super::foofoo` + | ^^^^^^^^^^^^^^^ + | +help: try + | +LL | use super::super::foofoo; + | ~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:256:13 | LL | use super::super::super_imports::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `super::super::super_imports::foofoo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try + | +LL | use super::super::super_imports::foofoo; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: usage of wildcard import --> tests/ui/wildcard_imports_2021.rs:264:13 | LL | use super::*; - | ^^^^^^^^ help: try: `super::foofoo` + | ^^^^^^^^ + | +help: try + | +LL | use super::foofoo; + | ~~~~~~~~~~~~~ error: aborting due to 22 previous errors diff --git a/src/tools/clippy/tests/ui/writeln_empty_string.stderr b/src/tools/clippy/tests/ui/writeln_empty_string.stderr index 20ece6a419264..3328d958fdde9 100644 --- a/src/tools/clippy/tests/ui/writeln_empty_string.stderr +++ b/src/tools/clippy/tests/ui/writeln_empty_string.stderr @@ -2,20 +2,27 @@ error: empty string literal in `writeln!` --> tests/ui/writeln_empty_string.rs:9:5 | LL | writeln!(v, ""); - | ^^^^^^^^^^----^ - | | - | help: remove the empty string + | ^^^^^^^^^^^^^^^ | = note: `-D clippy::writeln-empty-string` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::writeln_empty_string)]` +help: remove the empty string + | +LL - writeln!(v, ""); +LL + writeln!(v); + | error: empty string literal in `writeln!` --> tests/ui/writeln_empty_string.rs:12:5 | LL | writeln!(suggestion, ""); - | ^^^^^^^^^^^^^^^^^^^----^ - | | - | help: remove the empty string + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the empty string + | +LL - writeln!(suggestion, ""); +LL + writeln!(suggestion); + | error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/zero_ptr.stderr b/src/tools/clippy/tests/ui/zero_ptr.stderr index a580bebd5d3aa..dba92fcd44252 100644 --- a/src/tools/clippy/tests/ui/zero_ptr.stderr +++ b/src/tools/clippy/tests/ui/zero_ptr.stderr @@ -2,34 +2,58 @@ error: `0 as *const _` detected --> tests/ui/zero_ptr.rs:4:13 | LL | let _ = 0 as *const usize; - | ^^^^^^^^^^^^^^^^^ help: try: `std::ptr::null::()` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::zero-ptr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::zero_ptr)]` +help: try + | +LL | let _ = std::ptr::null::(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: `0 as *mut _` detected --> tests/ui/zero_ptr.rs:5:13 | LL | let _ = 0 as *mut f64; - | ^^^^^^^^^^^^^ help: try: `std::ptr::null_mut::()` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = std::ptr::null_mut::(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `0 as *const _` detected --> tests/ui/zero_ptr.rs:6:24 | LL | let _: *const u8 = 0 as *const _; - | ^^^^^^^^^^^^^ help: try: `std::ptr::null()` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let _: *const u8 = std::ptr::null(); + | ~~~~~~~~~~~~~~~~ error: `0 as *const _` detected --> tests/ui/zero_ptr.rs:9:9 | LL | foo(0 as *const _, 0 as *mut _); - | ^^^^^^^^^^^^^ help: try: `std::ptr::null()` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | foo(std::ptr::null(), 0 as *mut _); + | ~~~~~~~~~~~~~~~~ error: `0 as *mut _` detected --> tests/ui/zero_ptr.rs:9:24 | LL | foo(0 as *const _, 0 as *mut _); - | ^^^^^^^^^^^ help: try: `std::ptr::null_mut()` + | ^^^^^^^^^^^ + | +help: try + | +LL | foo(0 as *const _, std::ptr::null_mut()); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/zero_ptr_no_std.stderr b/src/tools/clippy/tests/ui/zero_ptr_no_std.stderr index 42a1a41ca94f4..220370cab9769 100644 --- a/src/tools/clippy/tests/ui/zero_ptr_no_std.stderr +++ b/src/tools/clippy/tests/ui/zero_ptr_no_std.stderr @@ -2,25 +2,39 @@ error: `0 as *const _` detected --> tests/ui/zero_ptr_no_std.rs:7:13 | LL | let _ = 0 as *const usize; - | ^^^^^^^^^^^^^^^^^ help: try: `core::ptr::null::()` + | ^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> tests/ui/zero_ptr_no_std.rs:3:9 | LL | #![deny(clippy::zero_ptr)] | ^^^^^^^^^^^^^^^^ +help: try + | +LL | let _ = core::ptr::null::(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `0 as *mut _` detected --> tests/ui/zero_ptr_no_std.rs:8:13 | LL | let _ = 0 as *mut f64; - | ^^^^^^^^^^^^^ help: try: `core::ptr::null_mut::()` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let _ = core::ptr::null_mut::(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `0 as *const _` detected --> tests/ui/zero_ptr_no_std.rs:9:24 | LL | let _: *const u8 = 0 as *const _; - | ^^^^^^^^^^^^^ help: try: `core::ptr::null()` + | ^^^^^^^^^^^^^ + | +help: try + | +LL | let _: *const u8 = core::ptr::null(); + | ~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/zero_repeat_side_effects.stderr b/src/tools/clippy/tests/ui/zero_repeat_side_effects.stderr index afdc60542534d..44af1fffc3d84 100644 --- a/src/tools/clippy/tests/ui/zero_repeat_side_effects.stderr +++ b/src/tools/clippy/tests/ui/zero_repeat_side_effects.stderr @@ -2,76 +2,135 @@ error: function or method calls as the initial value in zero-sized array initial --> tests/ui/zero_repeat_side_effects.rs:18:5 | LL | let a = [f(); 0]; - | ^^^^^^^^^^^^^^^^^ help: consider using: `f(); let a: [i32; 0] = [];` + | ^^^^^^^^^^^^^^^^^ | = note: `-D clippy::zero-repeat-side-effects` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::zero_repeat_side_effects)]` +help: consider using + | +LL | f(); let a: [i32; 0] = []; + | error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:19:5 | LL | let a = [f(); N]; - | ^^^^^^^^^^^^^^^^^ help: consider using: `f(); let a: [i32; 0] = [];` + | ^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | f(); let a: [i32; 0] = []; + | error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:21:5 | LL | b = [f(); 0]; - | ^^^^^^^^^^^^ help: consider using: `f(); b = [] as [i32; 0]` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | f(); b = [] as [i32; 0]; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:22:5 | LL | b = [f(); N]; - | ^^^^^^^^^^^^ help: consider using: `f(); b = [] as [i32; 0]` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | f(); b = [] as [i32; 0]; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:26:5 | LL | let c = vec![f(); 0]; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f(); let c: std::vec::Vec = vec![];` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | f(); let c: std::vec::Vec = vec![]; + | error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:28:5 | LL | d = vec![f(); 0]; - | ^^^^^^^^^^^^^^^^ help: consider using: `f(); d = vec![] as std::vec::Vec` + | ^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | f(); d = vec![] as std::vec::Vec; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:31:5 | LL | let e = [println!("side effect"); 0]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `println!("side effect"); let e: [(); 0] = [];` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | println!("side effect"); let e: [(); 0] = []; + | error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:34:5 | LL | let g = [{ f() }; 0]; - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `{ f() }; let g: [i32; 0] = [];` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using + | +LL | { f() }; let g: [i32; 0] = []; + | error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:37:10 | LL | drop(vec![f(); 0]); - | ^^^^^^^^^^^^ help: consider using: `{ f(); vec![] as std::vec::Vec }` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | drop({ f(); vec![] as std::vec::Vec }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:40:5 | LL | vec![f(); 0]; - | ^^^^^^^^^^^^ help: consider using: `{ f(); vec![] as std::vec::Vec }` + | ^^^^^^^^^^^^ + | +help: consider using + | +LL | { f(); vec![] as std::vec::Vec }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:41:5 | LL | [f(); 0]; - | ^^^^^^^^ help: consider using: `{ f(); [] as [i32; 0] }` + | ^^^^^^^^ + | +help: consider using + | +LL | { f(); [] as [i32; 0] }; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: function or method calls as the initial value in zero-sized array initializers may cause side effects --> tests/ui/zero_repeat_side_effects.rs:42:5 | LL | [f(); N]; - | ^^^^^^^^ help: consider using: `{ f(); [] as [i32; 0] }` + | ^^^^^^^^ + | +help: consider using + | +LL | { f(); [] as [i32; 0] }; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 12 previous errors diff --git a/tests/rustdoc-ui/check-cfg.stderr b/tests/rustdoc-ui/check-cfg.stderr index 6f026cee41e93..62e3430c03a66 100644 --- a/tests/rustdoc-ui/check-cfg.stderr +++ b/tests/rustdoc-ui/check-cfg.stderr @@ -2,11 +2,15 @@ warning: unexpected `cfg` condition name: `uniz` --> $DIR/check-cfg.rs:5:7 | LL | #[cfg(uniz)] - | ^^^^ help: there is a config with a similar name: `unix` + | ^^^^ | = help: to expect this configuration use `--check-cfg=cfg(uniz)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: there is a config with a similar name + | +LL | #[cfg(unix)] + | ~~~~ warning: 1 warning emitted diff --git a/tests/rustdoc-ui/doc-cfg.stderr b/tests/rustdoc-ui/doc-cfg.stderr index 14b7b17e04d3a..0bf07d97ac5e6 100644 --- a/tests/rustdoc-ui/doc-cfg.stderr +++ b/tests/rustdoc-ui/doc-cfg.stderr @@ -2,7 +2,12 @@ error: `cfg` predicate is not specified --> $DIR/doc-cfg.rs:3:7 | LL | #[doc(cfg(), cfg(foo, bar))] - | ^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^ + | +help: expected syntax is + | +LL | #[doc(cfg(/* predicate */), cfg(foo, bar))] + | ~~~~~~~~~~~~~~~~~~~~ error: multiple `cfg` predicates are specified --> $DIR/doc-cfg.rs:3:23 @@ -14,7 +19,12 @@ error: `cfg` predicate is not specified --> $DIR/doc-cfg.rs:7:7 | LL | #[doc(cfg())] - | ^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^ + | +help: expected syntax is + | +LL | #[doc(cfg(/* predicate */))] + | ~~~~~~~~~~~~~~~~~~~~ error: multiple `cfg` predicates are specified --> $DIR/doc-cfg.rs:8:16 diff --git a/tests/rustdoc-ui/doc-include-suggestion.stderr b/tests/rustdoc-ui/doc-include-suggestion.stderr index 1b4b78a8f2636..3613c09cba299 100644 --- a/tests/rustdoc-ui/doc-include-suggestion.stderr +++ b/tests/rustdoc-ui/doc-include-suggestion.stderr @@ -2,9 +2,13 @@ error: unknown `doc` attribute `include` --> $DIR/doc-include-suggestion.rs:1:7 | LL | #[doc(include = "external-cross-doc.md")] - | ------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- help: use `doc = include_str!` instead: `#[doc = include_str!("external-cross-doc.md")]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[deny(invalid_doc_attributes)]` on by default +help: use `doc = include_str!` instead + | +LL | #[doc = include_str!("external-cross-doc.md")] + | error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/doctest/display-output.stdout b/tests/rustdoc-ui/doctest/display-output.stdout index ad25d1ce54140..3bf97b9967980 100644 --- a/tests/rustdoc-ui/doctest/display-output.stdout +++ b/tests/rustdoc-ui/doctest/display-output.stdout @@ -9,7 +9,7 @@ warning: unused variable: `x` --> $DIR/display-output.rs:11:5 | LL | let x = 12; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/display-output.rs:9:9 @@ -17,12 +17,21 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 12; + | ~~ warning: unused variable: `x` --> $DIR/display-output.rs:13:8 | LL | fn foo(x: &dyn std::fmt::Display) {} - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | fn foo(_x: &dyn std::fmt::Display) {} + | ~~ warning: function `foo` is never used --> $DIR/display-output.rs:13:4 diff --git a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout index e288f8dfce652..9eb8b391e7809 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout +++ b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout @@ -9,9 +9,14 @@ error: expected item, found `;` --> $DIR/failed-doctest-extra-semicolon-on-item.rs:12:12 | LL | struct S {}; // unexpected semicolon after struct def - | ^ help: remove this semicolon + | ^ | = help: braced struct declarations are not followed by a semicolon +help: remove this semicolon + | +LL - struct S {}; // unexpected semicolon after struct def +LL + struct S {} // unexpected semicolon after struct def + | error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/doctest/non-local-defs-impl.stdout b/tests/rustdoc-ui/doctest/non-local-defs-impl.stdout index 27797e22f8ecb..d1bacc8b10084 100644 --- a/tests/rustdoc-ui/doctest/non-local-defs-impl.stdout +++ b/tests/rustdoc-ui/doctest/non-local-defs-impl.stdout @@ -13,7 +13,6 @@ LL | impl Trait for &Local {} | ^^^^^-----^^^^^------ | | | | | `&'_ Local` is not local - | | help: remove `&` to make the `impl` local | `Trait` is not local | = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type @@ -25,6 +24,11 @@ note: the lint level is defined here | LL | #![deny(non_local_definitions)] | ^^^^^^^^^^^^^^^^^^^^^ +help: remove `&` to make the `impl` local + | +LL - impl Trait for &Local {} +LL + impl Trait for Local {} + | error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/invalid-cfg.stderr b/tests/rustdoc-ui/invalid-cfg.stderr index dae238b052b8a..28bb0adcd1293 100644 --- a/tests/rustdoc-ui/invalid-cfg.stderr +++ b/tests/rustdoc-ui/invalid-cfg.stderr @@ -2,7 +2,12 @@ error: `cfg` is not followed by parentheses --> $DIR/invalid-cfg.rs:2:7 | LL | #[doc(cfg = "x")] - | ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^^^^^ + | +help: expected syntax is + | +LL | #[doc(cfg(/* predicate */))] + | ~~~~~~~~~~~~~~~~~~~~ error: multiple `cfg` predicates are specified --> $DIR/invalid-cfg.rs:3:14 diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr index 50d55284754e5..ff73d3d5ddd64 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr @@ -18,15 +18,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/invalid_const_in_lifetime_position.rs:2:10 | LL | type Y<'a>; | ^ +help: remove these generics + | +LL - fn f<'a>(arg : Box = &'a ()>>) {} +LL + fn f<'a>(arg : Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/invalid_const_in_lifetime_position.rs:4:26 @@ -49,9 +52,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/invalid_const_in_lifetime_position.rs:2:10 @@ -59,6 +60,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f<'a>(arg : Box = &'a ()>>) {} +LL + fn f<'a>(arg : Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/invalid_const_in_lifetime_position.rs:4:26 @@ -81,9 +87,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/invalid_const_in_lifetime_position.rs:2:10 @@ -91,6 +95,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f<'a>(arg : Box = &'a ()>>) {} +LL + fn f<'a>(arg : Box>) {} + | error[E0038]: the trait `X` cannot be made into an object --> $DIR/invalid_const_in_lifetime_position.rs:4:20 diff --git a/tests/rustdoc-ui/lints/doc-spotlight.stderr b/tests/rustdoc-ui/lints/doc-spotlight.stderr index 9682a3c0c8be5..820ff32630ff8 100644 --- a/tests/rustdoc-ui/lints/doc-spotlight.stderr +++ b/tests/rustdoc-ui/lints/doc-spotlight.stderr @@ -2,11 +2,15 @@ error: unknown `doc` attribute `spotlight` --> $DIR/doc-spotlight.rs:4:7 | LL | #[doc(spotlight)] - | ^^^^^^^^^ help: use `notable_trait` instead + | ^^^^^^^^^ | = note: `doc(spotlight)` was renamed to `doc(notable_trait)` = note: `doc(spotlight)` is now a no-op = note: `#[deny(invalid_doc_attributes)]` on by default +help: use `notable_trait` instead + | +LL | #[doc(notable_trait)] + | ~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr b/tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr index 88807dfb495d0..06a6898346992 100644 --- a/tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr +++ b/tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr @@ -2,15 +2,24 @@ warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intr --> $DIR/renamed-lint-still-applies.rs:2:9 | LL | #![deny(broken_intra_doc_links)] - | ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links` + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(renamed_and_removed_lints)]` on by default +help: use the new name + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: lint `rustdoc::non_autolinks` has been renamed to `rustdoc::bare_urls` --> $DIR/renamed-lint-still-applies.rs:7:9 | LL | #![deny(rustdoc::non_autolinks)] - | ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::bare_urls` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![deny(rustdoc::bare_urls)] + | ~~~~~~~~~~~~~~~~~~ error: unresolved link to `x` --> $DIR/renamed-lint-still-applies.rs:4:6 diff --git a/tests/rustdoc-ui/lints/unknown-renamed-lints.stderr b/tests/rustdoc-ui/lints/unknown-renamed-lints.stderr index bf529b9f8e263..62fed79874c75 100644 --- a/tests/rustdoc-ui/lints/unknown-renamed-lints.stderr +++ b/tests/rustdoc-ui/lints/unknown-renamed-lints.stderr @@ -14,37 +14,61 @@ error: unknown lint: `rustdoc::x` --> $DIR/unknown-renamed-lints.rs:7:9 | LL | #![deny(rustdoc::x)] - | ^^^^^^^^^^ help: did you mean: `rustdoc::all` + | ^^^^^^^^^^ + | +help: did you mean + | +LL | #![deny(rustdoc::all)] + | ~~~~~~~~~~~~ error: lint `intra_doc_link_resolution_failure` has been renamed to `rustdoc::broken_intra_doc_links` --> $DIR/unknown-renamed-lints.rs:9:9 | LL | #![deny(intra_doc_link_resolution_failure)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/unknown-renamed-lints.rs:3:9 | LL | #![deny(renamed_and_removed_lints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use the new name + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `non_autolinks` has been renamed to `rustdoc::bare_urls` --> $DIR/unknown-renamed-lints.rs:11:9 | LL | #![deny(non_autolinks)] - | ^^^^^^^^^^^^^ help: use the new name: `rustdoc::bare_urls` + | ^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![deny(rustdoc::bare_urls)] + | ~~~~~~~~~~~~~~~~~~ error: lint `rustdoc::non_autolinks` has been renamed to `rustdoc::bare_urls` --> $DIR/unknown-renamed-lints.rs:13:9 | LL | #![deny(rustdoc::non_autolinks)] - | ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::bare_urls` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![deny(rustdoc::bare_urls)] + | ~~~~~~~~~~~~~~~~~~ error: lint `private_doc_tests` has been renamed to `rustdoc::private_doc_tests` --> $DIR/unknown-renamed-lints.rs:16:9 | LL | #![deny(private_doc_tests)] - | ^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::private_doc_tests` + | ^^^^^^^^^^^^^^^^^ + | +help: use the new name + | +LL | #![deny(rustdoc::private_doc_tests)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lint `rustdoc` has been removed: use `rustdoc::all` instead --> $DIR/unknown-renamed-lints.rs:19:9 diff --git a/tests/rustdoc-ui/mismatched_arg_count.stderr b/tests/rustdoc-ui/mismatched_arg_count.stderr index 857bbda2ef471..c58ff7a14df4e 100644 --- a/tests/rustdoc-ui/mismatched_arg_count.stderr +++ b/tests/rustdoc-ui/mismatched_arg_count.stderr @@ -2,15 +2,18 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were --> $DIR/mismatched_arg_count.rs:7:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} - | ^^^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^ expected 1 lifetime argument | note: type alias defined here, with 1 lifetime parameter: `'a` --> $DIR/mismatched_arg_count.rs:5:6 | LL | type Alias<'a, T> = >::Assoc; | ^^^^^ -- +help: remove this lifetime argument + | +LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} +LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, , T>) {} + | error: aborting due to 1 previous error diff --git a/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr b/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr index a1056cf85d307..1c9300d58df47 100644 --- a/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr +++ b/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr @@ -2,19 +2,28 @@ error: usage of qualified `ty::Ty<'_>` --> $DIR/qualified_ty_ty_ctxt.rs:25:11 | LL | ty_q: ty::Ty<'_>, - | ^^^^^^^^^^ help: try importing it and using it unqualified: `Ty<'_>` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/qualified_ty_ty_ctxt.rs:4:9 | LL | #![deny(rustc::usage_of_qualified_ty)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try importing it and using it unqualified + | +LL | ty_q: Ty<'_>, + | ~~~~~~ error: usage of qualified `ty::TyCtxt<'_>` --> $DIR/qualified_ty_ty_ctxt.rs:27:16 | LL | ty_ctxt_q: ty::TyCtxt<'_>, - | ^^^^^^^^^^^^^^ help: try importing it and using it unqualified: `TyCtxt<'_>` + | ^^^^^^^^^^^^^^ + | +help: try importing it and using it unqualified + | +LL | ty_ctxt_q: TyCtxt<'_>, + | ~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.stderr b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.stderr index 69cf20656d7b1..05b79273af2ac 100644 --- a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.stderr +++ b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.stderr @@ -2,127 +2,226 @@ error: passing `Ty<'_>` by reference --> $DIR/rustc_pass_by_value.rs:14:13 | LL | ty_ref: &Ty<'_>, - | ^^^^^^^ help: try passing by value: `Ty<'_>` + | ^^^^^^^ | note: the lint level is defined here --> $DIR/rustc_pass_by_value.rs:5:9 | LL | #![deny(rustc::pass_by_value)] | ^^^^^^^^^^^^^^^^^^^^ +help: try passing by value + | +LL | ty_ref: Ty<'_>, + | ~~~~~~ error: passing `TyCtxt<'_>` by reference --> $DIR/rustc_pass_by_value.rs:16:18 | LL | ty_ctxt_ref: &TyCtxt<'_>, - | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>` + | ^^^^^^^^^^^ + | +help: try passing by value + | +LL | ty_ctxt_ref: TyCtxt<'_>, + | ~~~~~~~~~~ error: passing `Ty<'_>` by reference --> $DIR/rustc_pass_by_value.rs:20:28 | LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {} - | ^^^^^^^ help: try passing by value: `Ty<'_>` + | ^^^^^^^ + | +help: try passing by value + | +LL | fn ty_multi_ref(ty_multi: &Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {} + | ~~~~~~ error: passing `TyCtxt<'_>` by reference --> $DIR/rustc_pass_by_value.rs:20:55 | LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {} - | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>` + | ^^^^^^^^^^^ + | +help: try passing by value + | +LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&TyCtxt<'_>) {} + | ~~~~~~~~~~ error: passing `Ty<'_>` by reference --> $DIR/rustc_pass_by_value.rs:27:17 | LL | ty_ref: &Ty<'_>, - | ^^^^^^^ help: try passing by value: `Ty<'_>` + | ^^^^^^^ + | +help: try passing by value + | +LL | ty_ref: Ty<'_>, + | ~~~~~~ error: passing `TyCtxt<'_>` by reference --> $DIR/rustc_pass_by_value.rs:29:22 | LL | ty_ctxt_ref: &TyCtxt<'_>, - | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>` + | ^^^^^^^^^^^ + | +help: try passing by value + | +LL | ty_ctxt_ref: TyCtxt<'_>, + | ~~~~~~~~~~ error: passing `Ty<'_>` by reference --> $DIR/rustc_pass_by_value.rs:32:41 | LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>); - | ^^^^^^^ help: try passing by value: `Ty<'_>` + | ^^^^^^^ + | +help: try passing by value + | +LL | fn ty_multi_ref_in_trait(ty_multi: &Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>); + | ~~~~~~ error: passing `TyCtxt<'_>` by reference --> $DIR/rustc_pass_by_value.rs:32:68 | LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>); - | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>` + | ^^^^^^^^^^^ + | +help: try passing by value + | +LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&TyCtxt<'_>); + | ~~~~~~~~~~ error: passing `Ty<'_>` by reference --> $DIR/rustc_pass_by_value.rs:54:17 | LL | ty_ref: &Ty<'_>, - | ^^^^^^^ help: try passing by value: `Ty<'_>` + | ^^^^^^^ + | +help: try passing by value + | +LL | ty_ref: Ty<'_>, + | ~~~~~~ error: passing `TyCtxt<'_>` by reference --> $DIR/rustc_pass_by_value.rs:56:22 | LL | ty_ctxt_ref: &TyCtxt<'_>, - | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>` + | ^^^^^^^^^^^ + | +help: try passing by value + | +LL | ty_ctxt_ref: TyCtxt<'_>, + | ~~~~~~~~~~ error: passing `Ty<'_>` by reference --> $DIR/rustc_pass_by_value.rs:60:38 | LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {} - | ^^^^^^^ help: try passing by value: `Ty<'_>` + | ^^^^^^^ + | +help: try passing by value + | +LL | fn ty_multi_ref_assoc(ty_multi: &Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {} + | ~~~~~~ error: passing `TyCtxt<'_>` by reference --> $DIR/rustc_pass_by_value.rs:60:65 | LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {} - | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>` + | ^^^^^^^^^^^ + | +help: try passing by value + | +LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&TyCtxt<'_>) {} + | ~~~~~~~~~~ error: passing `CustomEnum` by reference --> $DIR/rustc_pass_by_value.rs:74:20 | LL | reference: &CustomEnum, - | ^^^^^^^^^^^ help: try passing by value: `CustomEnum` + | ^^^^^^^^^^^ + | +help: try passing by value + | +LL | reference: CustomEnum, + | ~~~~~~~~~~ error: passing `CustomStruct` by reference --> $DIR/rustc_pass_by_value.rs:85:24 | LL | type CustomAlias<'a> = &'a CustomStruct; - | ^^^^^^^^^^^^^^^^ help: try passing by value: `CustomStruct` + | ^^^^^^^^^^^^^^^^ + | +help: try passing by value + | +LL | type CustomAlias<'a> = CustomStruct; + | ~~~~~~~~~~~~ error: passing `CustomStruct` by reference --> $DIR/rustc_pass_by_value.rs:90:20 | LL | reference: &CustomStruct, - | ^^^^^^^^^^^^^ help: try passing by value: `CustomStruct` + | ^^^^^^^^^^^^^ + | +help: try passing by value + | +LL | reference: CustomStruct, + | ~~~~~~~~~~~~ error: passing `CustomAlias<'_>` by reference --> $DIR/rustc_pass_by_value.rs:96:20 | LL | reference: &CustomAlias, - | ^^^^^^^^^^^^ help: try passing by value: `CustomAlias<'_>` + | ^^^^^^^^^^^^ + | +help: try passing by value + | +LL | reference: CustomAlias<'_>, + | ~~~~~~~~~~~~~~~ error: passing `WithParameters` by reference --> $DIR/rustc_pass_by_value.rs:110:20 | LL | reference: &'a WithParameters, - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try passing by value: `WithParameters` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try passing by value + | +LL | reference: WithParameters, + | ~~~~~~~~~~~~~~~~~~~~ error: passing `WithParameters` by reference --> $DIR/rustc_pass_by_value.rs:111:27 | LL | reference_with_m: &WithParameters, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try passing by value: `WithParameters` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try passing by value + | +LL | reference_with_m: WithParameters, + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: passing `WithParameters` by reference --> $DIR/rustc_pass_by_value.rs:112:10 | LL | ) -> &'a WithParameters { - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try passing by value: `WithParameters` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try passing by value + | +LL | ) -> WithParameters { + | ~~~~~~~~~~~~~~~~~~~~ error: passing `WithParameters<_, 1>` by reference --> $DIR/rustc_pass_by_value.rs:114:22 | LL | reference as &WithParameters<_, 1> - | ^^^^^^^^^^^^^^^^^^^^^ help: try passing by value: `WithParameters<_, 1>` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: try passing by value + | +LL | reference as WithParameters<_, 1> + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 20 previous errors diff --git a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr index 53bf5cb1a8264..5585ab888a6fd 100644 --- a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr +++ b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr @@ -2,187 +2,336 @@ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:13:16 | LL | let kind = TyKind::Bool; - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ | note: the lint level is defined here --> $DIR/ty_tykind_usage.rs:11:8 | LL | #[deny(rustc::usage_of_ty_tykind)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try using `ty::` directly + | +LL | let kind = ty::Bool; + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:16:9 | LL | TyKind::Bool => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Bool => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:17:9 | LL | TyKind::Char => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Char => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:18:9 | LL | TyKind::Int(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Int(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:19:9 | LL | TyKind::Uint(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Uint(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:20:9 | LL | TyKind::Float(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Float(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:21:9 | LL | TyKind::Adt(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Adt(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:22:9 | LL | TyKind::Foreign(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Foreign(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:23:9 | LL | TyKind::Str => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Str => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:24:9 | LL | TyKind::Array(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Array(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:25:9 | LL | TyKind::Pat(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Pat(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:26:9 | LL | TyKind::Slice(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Slice(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:27:9 | LL | TyKind::RawPtr(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::RawPtr(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:28:9 | LL | TyKind::Ref(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Ref(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:29:9 | LL | TyKind::FnDef(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::FnDef(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:30:9 | LL | TyKind::FnPtr(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::FnPtr(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:31:9 | LL | TyKind::Dynamic(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Dynamic(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:32:9 | LL | TyKind::Closure(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Closure(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:33:9 | LL | TyKind::CoroutineClosure(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::CoroutineClosure(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:34:9 | LL | TyKind::Coroutine(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Coroutine(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:35:9 | LL | TyKind::CoroutineWitness(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::CoroutineWitness(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:36:9 | LL | TyKind::Never => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Never => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:37:9 | LL | TyKind::Tuple(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Tuple(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:38:9 | LL | TyKind::Alias(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Alias(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:39:9 | LL | TyKind::Param(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Param(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:40:9 | LL | TyKind::Bound(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Bound(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:41:9 | LL | TyKind::Placeholder(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Placeholder(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:42:9 | LL | TyKind::Infer(..) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Infer(..) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:43:9 | LL | TyKind::Error(_) => (), - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Error(_) => (), + | ~~ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:48:12 | LL | if let TyKind::Int(int_ty) = kind {} - | ^^^^^^ help: try using `ty::` directly: `ty` + | ^^^^^^ + | +help: try using `ty::` directly + | +LL | if let ty::Int(int_ty) = kind {} + | ~~ error: usage of `ty::TyKind` --> $DIR/ty_tykind_usage.rs:50:24 @@ -212,9 +361,12 @@ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:55:9 | LL | IrTyKind::Bool - | --------^^^^^^ - | | - | help: try using `ty::` directly: `ty` + | ^^^^^^^^^^^^^^ + | +help: try using `ty::` directly + | +LL | ty::Bool + | ~~ error: aborting due to 34 previous errors diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index 4f50837d5fe49..33b21b5634d56 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -217,9 +217,9 @@ struct LabelOnNonSpan { struct Suggest { #[suggestion(no_crate_suggestion, code = "This is the suggested code")] #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "normal")] - #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "short")] - #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "hidden")] - #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "verbose")] + #[suggestion(no_crate_suggestion, code = "This is the suggested code")] + #[suggestion(no_crate_suggestion, code = "This is the suggested code")] + #[suggestion(no_crate_suggestion, code = "This is the suggested code")] suggestion: (Span, Applicability), } @@ -816,7 +816,7 @@ struct SuggestionsInvalidLiteral { #[derive(Diagnostic)] #[diag(no_crate_example)] struct SuggestionStyleGood { - #[suggestion(code = "", style = "hidden")] + #[suggestion(code = "")] sub: Span, } diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index e36c6852d3b20..fa3281b7d3413 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -564,19 +564,34 @@ error: cannot find attribute `warn_` in this scope --> $DIR/diagnostic-derive.rs:590:3 | LL | #[warn_(no_crate_example, code = E0123)] - | ^^^^^ help: a built-in attribute with a similar name exists: `warn` + | ^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL | #[warn(no_crate_example, code = E0123)] + | ~~~~ error: cannot find attribute `lint` in this scope --> $DIR/diagnostic-derive.rs:597:3 | LL | #[lint(no_crate_example, code = E0123)] - | ^^^^ help: a built-in attribute with a similar name exists: `link` + | ^^^^ + | +help: a built-in attribute with a similar name exists + | +LL | #[link(no_crate_example, code = E0123)] + | ~~~~ error: cannot find attribute `lint` in this scope --> $DIR/diagnostic-derive.rs:604:3 | LL | #[lint(no_crate_example, code = E0123)] - | ^^^^ help: a built-in attribute with a similar name exists: `link` + | ^^^^ + | +help: a built-in attribute with a similar name exists + | +LL | #[link(no_crate_example, code = E0123)] + | ~~~~ error: cannot find attribute `multipart_suggestion` in this scope --> $DIR/diagnostic-derive.rs:644:3 diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs index 659ae54f7a3be..e190f5dbf7b46 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs @@ -732,21 +732,21 @@ struct SuggestionStyleDefault { } #[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "short")] +#[suggestion(no_crate_example, code = "")] struct SuggestionStyleShort { #[primary_span] sub: Span, } #[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "hidden")] +#[suggestion(no_crate_example, code = "")] struct SuggestionStyleHidden { #[primary_span] sub: Span, } #[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "verbose")] +#[suggestion(no_crate_example, code = "")] struct SuggestionStyleVerbose { #[primary_span] sub: Span, @@ -760,7 +760,7 @@ struct SuggestionStyleToolOnly { } #[derive(Subdiagnostic)] -#[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] +#[suggestion(no_crate_example, code = "", style = "normal", style = "tool-only")] //~^ ERROR specified multiple times //~| NOTE previously specified here struct SuggestionStyleTwice { diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr index fccf3757dbec6..d29a28ca0bd81 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr @@ -385,13 +385,13 @@ LL | #[suggestion_part(code())] error: specified multiple times --> $DIR/subdiagnostic-derive.rs:763:1 | -LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] +LL | #[suggestion(no_crate_example, code = "", style = "normal", style = "tool-only")] | ^ | note: previously specified here --> $DIR/subdiagnostic-derive.rs:763:1 | -LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] +LL | #[suggestion(no_crate_example, code = "", style = "normal", style = "tool-only")] | ^ error: `#[suggestion_hidden(...)]` is not a valid attribute @@ -399,16 +399,12 @@ error: `#[suggestion_hidden(...)]` is not a valid attribute | LL | #[suggestion_hidden(no_crate_example, code = "")] | ^ - | - = help: Use `#[suggestion(..., style = "hidden")]` instead error: `#[suggestion_hidden(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:780:1 | LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] | ^ - | - = help: Use `#[suggestion(..., style = "hidden")]` instead error: invalid suggestion style --> $DIR/subdiagnostic-derive.rs:788:51 diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr index e80411fda344e..649d36c464f4f 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr @@ -2,25 +2,27 @@ error[E0703]: invalid ABI: found `riscv-interrupt` --> $DIR/riscv-discoverability-guidance.rs:17:8 | LL | extern "riscv-interrupt" fn isr() {} - | ^^^^^^^^^^^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"riscv-interrupt-m"` + | ^^^^^^^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively +help: did you mean + | +LL | extern "riscv-interrupt-m" fn isr() {} + | ~~~~~~~~~~~~~~~~~~~ error[E0703]: invalid ABI: found `riscv-interrupt-u` --> $DIR/riscv-discoverability-guidance.rs:23:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} - | ^^^^^^^^^^^^^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"riscv-interrupt-m"` + | ^^^^^^^^^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 +help: did you mean + | +LL | extern "riscv-interrupt-m" fn isr_U() {} + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr index e80411fda344e..649d36c464f4f 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr @@ -2,25 +2,27 @@ error[E0703]: invalid ABI: found `riscv-interrupt` --> $DIR/riscv-discoverability-guidance.rs:17:8 | LL | extern "riscv-interrupt" fn isr() {} - | ^^^^^^^^^^^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"riscv-interrupt-m"` + | ^^^^^^^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively +help: did you mean + | +LL | extern "riscv-interrupt-m" fn isr() {} + | ~~~~~~~~~~~~~~~~~~~ error[E0703]: invalid ABI: found `riscv-interrupt-u` --> $DIR/riscv-discoverability-guidance.rs:23:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} - | ^^^^^^^^^^^^^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"riscv-interrupt-m"` + | ^^^^^^^^^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 +help: did you mean + | +LL | extern "riscv-interrupt-m" fn isr_U() {} + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/allocator/allocator-args.stderr b/tests/ui/allocator/allocator-args.stderr index ad640767fee10..37c0c48d8e6d7 100644 --- a/tests/ui/allocator/allocator-args.stderr +++ b/tests/ui/allocator/allocator-args.stderr @@ -2,7 +2,12 @@ error: malformed `global_allocator` attribute input --> $DIR/allocator-args.rs:10:1 | LL | #[global_allocator(malloc)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[global_allocator]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[global_allocator] + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/anon-params/anon-params-deprecated.stderr b/tests/ui/anon-params/anon-params-deprecated.stderr index 541cb004b5b2c..8893d309e05ce 100644 --- a/tests/ui/anon-params/anon-params-deprecated.stderr +++ b/tests/ui/anon-params/anon-params-deprecated.stderr @@ -2,7 +2,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edi --> $DIR/anon-params-deprecated.rs:10:12 | LL | fn foo(i32); - | ^^^ help: try naming the parameter or explicitly ignoring it: `_: i32` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 @@ -11,24 +11,36 @@ note: the lint level is defined here | LL | #![warn(anonymous_parameters)] | ^^^^^^^^^^^^^^^^^^^^ +help: try naming the parameter or explicitly ignoring it + | +LL | fn foo(_: i32); + | ~~~~~~ warning: anonymous parameters are deprecated and will be removed in the next edition --> $DIR/anon-params-deprecated.rs:13:30 | LL | fn bar_with_default_impl(String, String) {} - | ^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: String` + | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 +help: try naming the parameter or explicitly ignoring it + | +LL | fn bar_with_default_impl(_: String, String) {} + | ~~~~~~~~~ warning: anonymous parameters are deprecated and will be removed in the next edition --> $DIR/anon-params-deprecated.rs:13:38 | LL | fn bar_with_default_impl(String, String) {} - | ^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: String` + | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 +help: try naming the parameter or explicitly ignoring it + | +LL | fn bar_with_default_impl(String, _: String) {} + | ~~~~~~~~~ warning: 3 warnings emitted diff --git a/tests/ui/argument-suggestions/basic.stderr b/tests/ui/argument-suggestions/basic.stderr index c74186285f9f0..ea58ca97cfaf8 100644 --- a/tests/ui/argument-suggestions/basic.stderr +++ b/tests/ui/argument-suggestions/basic.stderr @@ -16,16 +16,18 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/basic.rs:21:5 | LL | extra(""); - | ^^^^^ -- - | | - | unexpected argument of type `&'static str` - | help: remove the extra argument + | ^^^^^ -- unexpected argument of type `&'static str` | note: function defined here --> $DIR/basic.rs:14:4 | LL | fn extra() {} | ^^^^^ +help: remove the extra argument + | +LL - extra(""); +LL + extra(); + | error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/basic.rs:22:5 diff --git a/tests/ui/argument-suggestions/exotic-calls.stderr b/tests/ui/argument-suggestions/exotic-calls.stderr index ff795b507f218..aca3b8a343343 100644 --- a/tests/ui/argument-suggestions/exotic-calls.stderr +++ b/tests/ui/argument-suggestions/exotic-calls.stderr @@ -2,61 +2,69 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/exotic-calls.rs:2:5 | LL | t(1i32); - | ^ ---- - | | - | unexpected argument of type `i32` - | help: remove the extra argument + | ^ ---- unexpected argument of type `i32` | note: callable defined here --> $DIR/exotic-calls.rs:1:11 | LL | fn foo(t: T) { | ^^^^ +help: remove the extra argument + | +LL - t(1i32); +LL + t(); + | error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/exotic-calls.rs:7:5 | LL | t(1i32); - | ^ ---- - | | - | unexpected argument of type `i32` - | help: remove the extra argument + | ^ ---- unexpected argument of type `i32` | note: type parameter defined here --> $DIR/exotic-calls.rs:6:11 | LL | fn bar(t: impl Fn()) { | ^^^^^^^^^ +help: remove the extra argument + | +LL - t(1i32); +LL + t(); + | error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/exotic-calls.rs:16:5 | LL | baz()(1i32) - | ^^^^^ ---- - | | - | unexpected argument of type `i32` - | help: remove the extra argument + | ^^^^^ ---- unexpected argument of type `i32` | note: opaque type defined here --> $DIR/exotic-calls.rs:11:13 | LL | fn baz() -> impl Fn() { | ^^^^^^^^^ +help: remove the extra argument + | +LL - baz()(1i32) +LL + baz()() + | error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/exotic-calls.rs:22:5 | LL | x(1i32); - | ^ ---- - | | - | unexpected argument of type `i32` - | help: remove the extra argument + | ^ ---- unexpected argument of type `i32` | note: closure defined here --> $DIR/exotic-calls.rs:21:13 | LL | let x = || {}; | ^^ +help: remove the extra argument + | +LL - x(1i32); +LL + x(); + | error: aborting due to 4 previous errors diff --git a/tests/ui/argument-suggestions/extra_arguments.stderr b/tests/ui/argument-suggestions/extra_arguments.stderr index 5ad8e35920a10..dec3da7518658 100644 --- a/tests/ui/argument-suggestions/extra_arguments.stderr +++ b/tests/ui/argument-suggestions/extra_arguments.stderr @@ -2,16 +2,18 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/extra_arguments.rs:19:3 | LL | empty(""); - | ^^^^^ -- - | | - | unexpected argument of type `&'static str` - | help: remove the extra argument + | ^^^^^ -- unexpected argument of type `&'static str` | note: function defined here --> $DIR/extra_arguments.rs:1:4 | LL | fn empty() {} | ^^^^^ +help: remove the extra argument + | +LL - empty(""); +LL + empty(); + | error[E0061]: this function takes 0 arguments but 2 arguments were supplied --> $DIR/extra_arguments.rs:20:3 @@ -36,31 +38,35 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:22:3 | LL | one_arg(1, 1); - | ^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg(_a: T) {} | ^^^^^^^ ----- +help: remove the extra argument + | +LL - one_arg(1, 1); +LL + one_arg(1); + | error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:23:3 | LL | one_arg(1, ""); - | ^^^^^^^ ---- - | | | - | | unexpected argument of type `&'static str` - | help: remove the extra argument + | ^^^^^^^ -- unexpected argument of type `&'static str` | note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg(_a: T) {} | ^^^^^^^ ----- +help: remove the extra argument + | +LL - one_arg(1, ""); +LL + one_arg(1); + | error[E0061]: this function takes 1 argument but 3 arguments were supplied --> $DIR/extra_arguments.rs:24:3 @@ -85,61 +91,69 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:26:3 | LL | two_arg_same(1, 1, 1); - | ^^^^^^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^^^^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- +help: remove the extra argument + | +LL - two_arg_same(1, 1, 1); +LL + two_arg_same(1, 1); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:27:3 | LL | two_arg_same(1, 1, 1.0); - | ^^^^^^^^^^^^ ----- - | | | - | | unexpected argument of type `{float}` - | help: remove the extra argument + | ^^^^^^^^^^^^ --- unexpected argument of type `{float}` | note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- +help: remove the extra argument + | +LL - two_arg_same(1, 1, 1.0); +LL + two_arg_same(1, 1); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:29:3 | LL | two_arg_diff(1, 1, ""); - | ^^^^^^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^^^^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- +help: remove the extra argument + | +LL - two_arg_diff(1, 1, ""); +LL + two_arg_diff(1, ""); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:30:3 | LL | two_arg_diff(1, "", ""); - | ^^^^^^^^^^^^ ---- - | | | - | | unexpected argument of type `&'static str` - | help: remove the extra argument + | ^^^^^^^^^^^^ -- unexpected argument of type `&'static str` | note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- +help: remove the extra argument + | +LL - two_arg_diff(1, "", ""); +LL + two_arg_diff(1, ""); + | error[E0061]: this function takes 2 arguments but 4 arguments were supplied --> $DIR/extra_arguments.rs:31:3 @@ -183,70 +197,75 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:35:3 | LL | two_arg_same(1, 1, ""); - | ^^^^^^^^^^^^ -------- - | | | - | | unexpected argument of type `&'static str` - | help: remove the extra argument + | ^^^^^^^^^^^^ -- unexpected argument of type `&'static str` | note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- +help: remove the extra argument + | +LL - two_arg_same(1, 1, ""); +LL + two_arg_same(1, 1); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:36:3 | LL | two_arg_diff(1, 1, ""); - | ^^^^^^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^^^^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- +help: remove the extra argument + | +LL - two_arg_diff(1, 1, ""); +LL + two_arg_diff(1, ""); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:37:3 | -LL | two_arg_same( - | ^^^^^^^^^^^^ -LL | 1, -LL | 1, - | ______- -LL | | "" - | | -- - | |_____|| - | |help: remove the extra argument - | unexpected argument of type `&'static str` +LL | two_arg_same( + | ^^^^^^^^^^^^ +... +LL | "" + | -- unexpected argument of type `&'static str` | note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- +help: remove the extra argument + | +LL - 1, +LL - "" +LL + 1 + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:43:3 | -LL | two_arg_diff( - | ^^^^^^^^^^^^ -LL | 1, - | ______- -LL | | 1, - | | - - | | | - | |_____unexpected argument of type `{integer}` - | help: remove the extra argument +LL | two_arg_diff( + | ^^^^^^^^^^^^ +LL | 1, +LL | 1, + | - unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- +help: remove the extra argument + | +LL - 1, + | error[E0061]: this function takes 0 arguments but 2 arguments were supplied --> $DIR/extra_arguments.rs:8:9 @@ -310,61 +329,69 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:53:3 | LL | one_arg(1, panic!()); - | ^^^^^^^ ---------- - | | | - | | unexpected argument - | help: remove the extra argument + | ^^^^^^^ -------- unexpected argument | note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg(_a: T) {} | ^^^^^^^ ----- +help: remove the extra argument + | +LL - one_arg(1, panic!()); +LL + one_arg(1); + | error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:54:3 | LL | one_arg(panic!(), 1); - | ^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg(_a: T) {} | ^^^^^^^ ----- +help: remove the extra argument + | +LL - one_arg(panic!(), 1); +LL + one_arg(panic!()); + | error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:55:3 | LL | one_arg(stringify!($e), 1); - | ^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg(_a: T) {} | ^^^^^^^ ----- +help: remove the extra argument + | +LL - one_arg(stringify!($e), 1); +LL + one_arg(stringify!($e)); + | error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:60:3 | LL | one_arg(for _ in 1.. {}, 1); - | ^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg(_a: T) {} | ^^^^^^^ ----- +help: remove the extra argument + | +LL - one_arg(for _ in 1.. {}, 1); +LL + one_arg(for _ in 1.. {}); + | error: aborting due to 22 previous errors diff --git a/tests/ui/argument-suggestions/issue-100154.stderr b/tests/ui/argument-suggestions/issue-100154.stderr index 966f56e2a1562..1496d994ef355 100644 --- a/tests/ui/argument-suggestions/issue-100154.stderr +++ b/tests/ui/argument-suggestions/issue-100154.stderr @@ -2,9 +2,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/issue-100154.rs:4:5 | LL | foo::<()>(()); - | ^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/issue-100154.rs:1:4 @@ -12,6 +10,11 @@ note: function defined here, with 0 generic parameters LL | fn foo(i: impl std::fmt::Display) {} | ^^^ = note: `impl Trait` cannot be explicitly specified as a generic argument +help: remove these generics + | +LL - foo::<()>(()); +LL + foo(()); + | error[E0277]: `()` doesn't implement `std::fmt::Display` --> $DIR/issue-100154.rs:4:11 diff --git a/tests/ui/argument-suggestions/issue-109831.stderr b/tests/ui/argument-suggestions/issue-109831.stderr index 7b9a3c9ef2c6c..1e90a524011f1 100644 --- a/tests/ui/argument-suggestions/issue-109831.stderr +++ b/tests/ui/argument-suggestions/issue-109831.stderr @@ -23,7 +23,12 @@ LL | struct A; | --------- similarly named unit struct `A` defined here ... LL | f(A, A, B, C); - | ^ help: a unit struct with a similar name exists: `A` + | ^ + | +help: a unit struct with a similar name exists + | +LL | f(A, A, B, A); + | ~ error[E0061]: this function takes 3 arguments but 4 arguments were supplied --> $DIR/issue-109831.rs:7:5 diff --git a/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr b/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr index 7c4daa3ffe95b..dc293945eb600 100644 --- a/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr +++ b/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr @@ -32,91 +32,103 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/suggest-better-removing-issue-126246.rs:10:5 | LL | add_one(2, 2); - | ^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:1:4 | LL | fn add_one(x: i32) -> i32 { | ^^^^^^^ ------ +help: remove the extra argument + | +LL - add_one(2, 2); +LL + add_one(2); + | error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/suggest-better-removing-issue-126246.rs:11:5 | LL | add_one(no_such_local, 10); - | ^^^^^^^ --------------- - | | - | unexpected argument - | help: remove the extra argument + | ^^^^^^^ ------------- unexpected argument | note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:1:4 | LL | fn add_one(x: i32) -> i32 { | ^^^^^^^ ------ +help: remove the extra argument + | +LL - add_one(no_such_local, 10); +LL + add_one(10); + | error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/suggest-better-removing-issue-126246.rs:13:5 | LL | add_one(10, no_such_local); - | ^^^^^^^ --------------- - | | | - | | unexpected argument - | help: remove the extra argument + | ^^^^^^^ ------------- unexpected argument | note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:1:4 | LL | fn add_one(x: i32) -> i32 { | ^^^^^^^ ------ +help: remove the extra argument + | +LL - add_one(10, no_such_local); +LL + add_one(10); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/suggest-better-removing-issue-126246.rs:15:5 | LL | add_two(10, no_such_local, 10); - | ^^^^^^^ --------------- - | | | - | | unexpected argument - | help: remove the extra argument + | ^^^^^^^ ------------- unexpected argument | note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:5:4 | LL | fn add_two(x: i32, y: i32) -> i32 { | ^^^^^^^ ------ ------ +help: remove the extra argument + | +LL - add_two(10, no_such_local, 10); +LL + add_two(10, 10); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/suggest-better-removing-issue-126246.rs:17:5 | LL | add_two(no_such_local, 10, 10); - | ^^^^^^^ --------------- - | | - | unexpected argument - | help: remove the extra argument + | ^^^^^^^ ------------- unexpected argument | note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:5:4 | LL | fn add_two(x: i32, y: i32) -> i32 { | ^^^^^^^ ------ ------ +help: remove the extra argument + | +LL - add_two(no_such_local, 10, 10); +LL + add_two(10, 10); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/suggest-better-removing-issue-126246.rs:19:5 | LL | add_two(10, 10, no_such_local); - | ^^^^^^^ --------------- - | | | - | | unexpected argument - | help: remove the extra argument + | ^^^^^^^ ------------- unexpected argument | note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:5:4 | LL | fn add_two(x: i32, y: i32) -> i32 { | ^^^^^^^ ------ ------ +help: remove the extra argument + | +LL - add_two(10, 10, no_such_local); +LL + add_two(10, 10); + | error: aborting due to 11 previous errors diff --git a/tests/ui/array-slice-vec/suggest-array-length.stderr b/tests/ui/array-slice-vec/suggest-array-length.stderr index fdab7ba7064e4..6a22b94d3a5d5 100644 --- a/tests/ui/array-slice-vec/suggest-array-length.stderr +++ b/tests/ui/array-slice-vec/suggest-array-length.stderr @@ -44,71 +44,99 @@ error[E0658]: using `_` for array lengths is unstable --> $DIR/suggest-array-length.rs:5:22 | LL | const Foo: [i32; _] = [1, 2, 3]; - | ^ help: consider specifying the array length: `3` + | ^ | = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider specifying the array length + | +LL | const Foo: [i32; 3] = [1, 2, 3]; + | ~ error[E0658]: using `_` for array lengths is unstable --> $DIR/suggest-array-length.rs:8:26 | LL | const REF_FOO: &[u8; _] = &[1]; - | ^ help: consider specifying the array length: `1` + | ^ | = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider specifying the array length + | +LL | const REF_FOO: &[u8; 1] = &[1]; + | ~ error[E0658]: using `_` for array lengths is unstable --> $DIR/suggest-array-length.rs:11:20 | LL | let foo: [i32; _] = [1, 2, 3]; - | ^ help: consider specifying the array length: `3` + | ^ | = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider specifying the array length + | +LL | let foo: [i32; 3] = [1, 2, 3]; + | ~ error[E0658]: using `_` for array lengths is unstable --> $DIR/suggest-array-length.rs:14:20 | LL | let bar: [i32; _] = [0; 3]; - | ^ help: consider specifying the array length: `3` + | ^ | = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider specifying the array length + | +LL | let bar: [i32; 3] = [0; 3]; + | ~ error[E0658]: using `_` for array lengths is unstable --> $DIR/suggest-array-length.rs:17:25 | LL | let ref_foo: &[i32; _] = &[1, 2, 3]; - | ^ help: consider specifying the array length: `3` + | ^ | = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider specifying the array length + | +LL | let ref_foo: &[i32; 3] = &[1, 2, 3]; + | ~ error[E0658]: using `_` for array lengths is unstable --> $DIR/suggest-array-length.rs:20:25 | LL | let ref_bar: &[i32; _] = &[0; 3]; - | ^ help: consider specifying the array length: `3` + | ^ | = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider specifying the array length + | +LL | let ref_bar: &[i32; 3] = &[0; 3]; + | ~ error[E0658]: using `_` for array lengths is unstable --> $DIR/suggest-array-length.rs:23:35 | LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; - | ^ help: consider specifying the array length: `3` + | ^ | = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider specifying the array length + | +LL | let multiple_ref_foo: &&[i32; 3] = &&[1, 2, 3]; + | ~ error: aborting due to 14 previous errors diff --git a/tests/ui/asm/issue-89305.stderr b/tests/ui/asm/issue-89305.stderr index 7efc5102042c2..73fa6fdff3141 100644 --- a/tests/ui/asm/issue-89305.stderr +++ b/tests/ui/asm/issue-89305.stderr @@ -2,7 +2,7 @@ warning: unused variable: `x` --> $DIR/issue-89305.rs:13:13 | LL | let x: () = asm!("nop"); - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/issue-89305.rs:7:9 @@ -10,6 +10,10 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _x: () = asm!("nop"); + | ~~ warning: 1 warning emitted diff --git a/tests/ui/asm/naked-functions-unused.x86_64.stderr b/tests/ui/asm/naked-functions-unused.x86_64.stderr index 8d3c300e0586c..cd7570280df5c 100644 --- a/tests/ui/asm/naked-functions-unused.x86_64.stderr +++ b/tests/ui/asm/naked-functions-unused.x86_64.stderr @@ -2,7 +2,7 @@ error: unused variable: `a` --> $DIR/naked-functions-unused.rs:17:32 | LL | pub extern "C" fn function(a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: the lint level is defined here --> $DIR/naked-functions-unused.rs:5:9 @@ -10,60 +10,109 @@ note: the lint level is defined here LL | #![deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | pub extern "C" fn function(_a: usize, b: usize) -> usize { + | ~~ error: unused variable: `b` --> $DIR/naked-functions-unused.rs:17:42 | LL | pub extern "C" fn function(a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | pub extern "C" fn function(a: usize, _b: usize) -> usize { + | ~~ error: unused variable: `a` --> $DIR/naked-functions-unused.rs:26:38 | LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | pub extern "C" fn associated(_a: usize, b: usize) -> usize { + | ~~ error: unused variable: `b` --> $DIR/naked-functions-unused.rs:26:48 | LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | pub extern "C" fn associated(a: usize, _b: usize) -> usize { + | ~~ error: unused variable: `a` --> $DIR/naked-functions-unused.rs:32:41 | LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | pub extern "C" fn method(&self, _a: usize, b: usize) -> usize { + | ~~ error: unused variable: `b` --> $DIR/naked-functions-unused.rs:32:51 | LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | pub extern "C" fn method(&self, a: usize, _b: usize) -> usize { + | ~~ error: unused variable: `a` --> $DIR/naked-functions-unused.rs:40:40 | LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | extern "C" fn trait_associated(_a: usize, b: usize) -> usize { + | ~~ error: unused variable: `b` --> $DIR/naked-functions-unused.rs:40:50 | LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | extern "C" fn trait_associated(a: usize, _b: usize) -> usize { + | ~~ error: unused variable: `a` --> $DIR/naked-functions-unused.rs:46:43 | LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | extern "C" fn trait_method(&self, _a: usize, b: usize) -> usize { + | ~~ error: unused variable: `b` --> $DIR/naked-functions-unused.rs:46:53 | LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | extern "C" fn trait_method(&self, a: usize, _b: usize) -> usize { + | ~~ error: aborting due to 10 previous errors diff --git a/tests/ui/asm/parse-error.stderr b/tests/ui/asm/parse-error.stderr index 80ee5191dbbe9..6d6e38211d515 100644 --- a/tests/ui/asm/parse-error.stderr +++ b/tests/ui/asm/parse-error.stderr @@ -371,47 +371,57 @@ LL | global_asm!("{}", label {}); error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:39:37 | -LL | let mut foo = 0; - | ----------- help: consider using `const` instead of `let`: `const foo` -... LL | asm!("{}", options(), const foo); | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const foo = 0; + | ~~~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:71:44 | -LL | let mut foo = 0; - | ----------- help: consider using `const` instead of `let`: `const foo` -... LL | asm!("{}", clobber_abi("C"), const foo); | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const foo = 0; + | ~~~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:74:55 | -LL | let mut foo = 0; - | ----------- help: consider using `const` instead of `let`: `const foo` -... LL | asm!("{}", options(), clobber_abi("C"), const foo); | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const foo = 0; + | ~~~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:76:31 | -LL | let mut foo = 0; - | ----------- help: consider using `const` instead of `let`: `const foo` -... LL | asm!("{a}", a = const foo, a = const bar); | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const foo = 0; + | ~~~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:76:46 | -LL | let mut bar = 0; - | ----------- help: consider using `const` instead of `let`: `const bar` -... LL | asm!("{a}", a = const foo, a = const bar); | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const bar = 0; + | ~~~~~~~~~ error: aborting due to 64 previous errors diff --git a/tests/ui/asm/type-check-1.stderr b/tests/ui/asm/type-check-1.stderr index 07a609c52139e..19afd244c7161 100644 --- a/tests/ui/asm/type-check-1.stderr +++ b/tests/ui/asm/type-check-1.stderr @@ -1,29 +1,35 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/type-check-1.rs:41:26 | -LL | let x = 0; - | ----- help: consider using `const` instead of `let`: `const x` -... LL | asm!("{}", const x); | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const x = 0; + | ~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/type-check-1.rs:44:36 | -LL | let x = 0; - | ----- help: consider using `const` instead of `let`: `const x` -... LL | asm!("{}", const const_foo(x)); | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const x = 0; + | ~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/type-check-1.rs:47:36 | -LL | let x = 0; - | ----- help: consider using `const` instead of `let`: `const x` -... LL | asm!("{}", const const_bar(x)); | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const x = 0; + | ~~~~~~~ error: invalid `sym` operand --> $DIR/type-check-1.rs:49:24 diff --git a/tests/ui/asm/x86_64/x86_64_parse_error.stderr b/tests/ui/asm/x86_64/x86_64_parse_error.stderr index f2854ae512851..5a5adbd4b6c30 100644 --- a/tests/ui/asm/x86_64/x86_64_parse_error.stderr +++ b/tests/ui/asm/x86_64/x86_64_parse_error.stderr @@ -15,29 +15,35 @@ LL | asm!("{1}", in("eax") foo, const bar); error[E0435]: attempt to use a non-constant value in a constant --> $DIR/x86_64_parse_error.rs:13:46 | -LL | let mut bar = 0; - | ----------- help: consider using `const` instead of `let`: `const bar` -... LL | asm!("{a}", in("eax") foo, a = const bar); | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const bar = 0; + | ~~~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/x86_64_parse_error.rs:15:46 | -LL | let mut bar = 0; - | ----------- help: consider using `const` instead of `let`: `const bar` -... LL | asm!("{a}", in("eax") foo, a = const bar); | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const bar = 0; + | ~~~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/x86_64_parse_error.rs:17:42 | -LL | let mut bar = 0; - | ----------- help: consider using `const` instead of `let`: `const bar` -... LL | asm!("{1}", in("eax") foo, const bar); | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const bar = 0; + | ~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/associated-consts/assoc-const-eq-missing.stderr b/tests/ui/associated-consts/assoc-const-eq-missing.stderr index 318c85dcfd6fd..29ba931522740 100644 --- a/tests/ui/associated-consts/assoc-const-eq-missing.stderr +++ b/tests/ui/associated-consts/assoc-const-eq-missing.stderr @@ -2,7 +2,12 @@ error[E0220]: associated constant `Z` not found for `Foo` --> $DIR/assoc-const-eq-missing.rs:14:16 | LL | fn foo1>() {} - | ^ help: there is an associated constant with a similar name: `N` + | ^ + | +help: there is an associated constant with a similar name + | +LL | fn foo1>() {} + | ~ error[E0220]: associated type `Z` not found for `Foo` --> $DIR/assoc-const-eq-missing.rs:16:16 @@ -14,7 +19,12 @@ error[E0220]: associated constant `Z` not found for `Foo` --> $DIR/assoc-const-eq-missing.rs:18:16 | LL | fn foo3>() {} - | ^ help: there is an associated constant with a similar name: `N` + | ^ + | +help: there is an associated constant with a similar name + | +LL | fn foo3>() {} + | ~ error: aborting due to 3 previous errors diff --git a/tests/ui/associated-inherent-types/assoc-inherent-no-body.stderr b/tests/ui/associated-inherent-types/assoc-inherent-no-body.stderr index c332416c6f31c..ae98883cedf35 100644 --- a/tests/ui/associated-inherent-types/assoc-inherent-no-body.stderr +++ b/tests/ui/associated-inherent-types/assoc-inherent-no-body.stderr @@ -2,9 +2,12 @@ error: associated type in `impl` without body --> $DIR/assoc-inherent-no-body.rs:7:5 | LL | type Baz; - | ^^^^^^^^- - | | - | help: provide a definition for the type: `= ;` + | ^^^^^^^^^ + | +help: provide a definition for the type + | +LL | type Baz = ; + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/associated-inherent-types/issue-109299.stderr b/tests/ui/associated-inherent-types/issue-109299.stderr index 1e11c0e8c2af1..f29d3cc7834e7 100644 --- a/tests/ui/associated-inherent-types/issue-109299.stderr +++ b/tests/ui/associated-inherent-types/issue-109299.stderr @@ -2,9 +2,12 @@ error[E0261]: use of undeclared lifetime name `'d` --> $DIR/issue-109299.rs:6:12 | LL | impl Lexer<'d> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'d` here: `<'d>` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'d` here + | +LL | impl<'d> Lexer<'d> { + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr index 978305c2ce355..a636438dcc7dc 100644 --- a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr +++ b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr @@ -2,7 +2,12 @@ error[E0223]: ambiguous associated type --> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:12 | LL | let _: S::::Pr = (); - | ^^^^^^^^^^^^^ help: use fully-qualified syntax: ` as Tr>::Pr` + | ^^^^^^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | let _: as Tr>::Pr = (); + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/associated-inherent-types/style.stderr b/tests/ui/associated-inherent-types/style.stderr index 12e4d545ab1d1..f462afabc47c4 100644 --- a/tests/ui/associated-inherent-types/style.stderr +++ b/tests/ui/associated-inherent-types/style.stderr @@ -2,13 +2,17 @@ error: associated type `typ` should have an upper camel case name --> $DIR/style.rs:8:10 | LL | type typ = (); - | ^^^ help: convert the identifier to upper camel case: `Typ` + | ^^^ | note: the lint level is defined here --> $DIR/style.rs:3:9 | LL | #![deny(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper camel case + | +LL | type Typ = (); + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/associated-inherent-types/substitute-params-bad.stderr b/tests/ui/associated-inherent-types/substitute-params-bad.stderr index 7a7808ba67b14..363684d99b602 100644 --- a/tests/ui/associated-inherent-types/substitute-params-bad.stderr +++ b/tests/ui/associated-inherent-types/substitute-params-bad.stderr @@ -2,7 +2,12 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/substitute-params-bad.rs:9:9 | LL | impl S { - | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | impl<'a, T> S { + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/substitute-params-bad.rs:22:35 diff --git a/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr b/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr index 9e1dd73980792..6d294a663f1ec 100644 --- a/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr +++ b/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr @@ -2,7 +2,12 @@ error[E0223]: ambiguous associated type --> $DIR/ambiguous-associated-type-with-generics.rs:13:13 | LL | let _x: >::Ty; - | ^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: ` as Assoc>::Ty` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | let _x: as Assoc>::Ty; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/associated-item/associated-item-duplicate-names-3.stderr b/tests/ui/associated-item/associated-item-duplicate-names-3.stderr index a2346e292ac40..d2f8e0bc005de 100644 --- a/tests/ui/associated-item/associated-item-duplicate-names-3.stderr +++ b/tests/ui/associated-item/associated-item-duplicate-names-3.stderr @@ -13,7 +13,12 @@ error[E0223]: ambiguous associated type --> $DIR/associated-item-duplicate-names-3.rs:18:12 | LL | let x: Baz::Bar = 5; - | ^^^^^^^^ help: use fully-qualified syntax: `::Bar` + | ^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | let x: ::Bar = 5; + | ~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/associated-item/issue-87638.stderr b/tests/ui/associated-item/issue-87638.stderr index cf6083444b0e6..f2e5eda67c827 100644 --- a/tests/ui/associated-item/issue-87638.stderr +++ b/tests/ui/associated-item/issue-87638.stderr @@ -5,10 +5,12 @@ LL | type Target; | ------------ associated type `Target` defined here ... LL | let _: ::Output; - | ^^^^^^ - | | - | not found in `Trait` - | help: maybe you meant this associated type: `Target` + | ^^^^^^ not found in `Trait` + | +help: maybe you meant this associated type + | +LL | let _: ::Target; + | ~~~~~~ error[E0576]: cannot find method or associated constant `BAR` in trait `Trait` --> $DIR/issue-87638.rs:20:27 @@ -17,10 +19,12 @@ LL | const FOO: usize; | ----------------- associated constant `FOO` defined here ... LL | let _ = ::BAR; - | ^^^ - | | - | not found in `Trait` - | help: maybe you meant this associated constant: `FOO` + | ^^^ not found in `Trait` + | +help: maybe you meant this associated constant + | +LL | let _ = ::FOO; + | ~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/associated-type-bounds/issue-71443-1.stderr b/tests/ui/associated-type-bounds/issue-71443-1.stderr index 27ef545daaa5c..77435487d429d 100644 --- a/tests/ui/associated-type-bounds/issue-71443-1.stderr +++ b/tests/ui/associated-type-bounds/issue-71443-1.stderr @@ -1,10 +1,13 @@ error[E0308]: mismatched types --> $DIR/issue-71443-1.rs:4:5 | -LL | fn hello Iterator>() { - | - help: try adding a return type: `-> Incorrect` LL | Incorrect | ^^^^^^^^^ expected `()`, found `Incorrect` + | +help: try adding a return type + | +LL | fn hello Iterator>() -> Incorrect { + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr index 39a2b98e2e2d1..3554198c1ed20 100644 --- a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr +++ b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr @@ -2,7 +2,12 @@ error[E0191]: the value of the associated types `Item` and `IntoIter` in `IntoIt --> $DIR/overlaping-bound-suggestion.rs:6:13 | LL | inner: >::IntoIterator as Item>::Core, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated types: `IntoIterator, Item = Type, IntoIter = Type>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: specify the associated types + | +LL | inner: , Item = Type, IntoIter = Type>::IntoIterator as Item>::Core, + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0223]: ambiguous associated type --> $DIR/overlaping-bound-suggestion.rs:6:13 diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr index 7e1695984f1c3..a71956dc2a9ef 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr @@ -11,19 +11,35 @@ error: argument types not allowed with return type notation --> $DIR/bad-inputs-and-output.rs:10:23 | LL | fn foo>() {} - | ^^^^^ help: remove the input types: `()` + | ^^^^^ + | +help: remove the input types + | +LL | fn foo>() {} + | ~~ error: return type not allowed with return type notation --> $DIR/bad-inputs-and-output.rs:13:25 | LL | fn bar (): Send>>() {} - | ^^^^^^ help: remove the return type + | ^^^^^^ + | +help: remove the return type + | +LL - fn bar (): Send>>() {} +LL + fn bar>() {} + | error: return type notation arguments must be elided with `..` --> $DIR/bad-inputs-and-output.rs:16:23 | LL | fn baz>() {} - | ^^ help: add `..`: `(..)` + | ^^ + | +help: add `..` + | +LL | fn baz>() {} + | ~~~~ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr index 5cb8e2642f51c..0a75257ea1e58 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr @@ -11,7 +11,12 @@ error[E0220]: associated function `methid` not found for `Trait` --> $DIR/missing.rs:10:17 | LL | fn bar>() {} - | ^^^^^^ help: there is an associated function with a similar name: `method` + | ^^^^^^ + | +help: there is an associated function with a similar name + | +LL | fn bar>() {} + | ~~~~~~ error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr index c5260adbed43a..fb94d09493fcd 100644 --- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr +++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr @@ -13,7 +13,12 @@ error[E0223]: ambiguous associated type --> $DIR/associated-types-in-ambiguous-context.rs:13:23 | LL | fn grab(&self) -> Grab::Value; - | ^^^^^^^^^^^ help: use fully-qualified syntax: `::Value` + | ^^^^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | fn grab(&self) -> ::Value; + | ~~~~~~~~~~~~~~~~~~~~~ error[E0223]: ambiguous associated type --> $DIR/associated-types-in-ambiguous-context.rs:16:22 @@ -30,7 +35,12 @@ error[E0223]: ambiguous associated type --> $DIR/associated-types-in-ambiguous-context.rs:22:17 | LL | trait Foo where Foo::Assoc: Bar { - | ^^^^^^^^^^ help: use fully-qualified syntax: `::Assoc` + | ^^^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | trait Foo where ::Assoc: Bar { + | ~~~~~~~~~~~~~~~~~~~~ error[E0223]: ambiguous associated type --> $DIR/associated-types-in-ambiguous-context.rs:27:10 diff --git a/tests/ui/associated-types/associated-types-incomplete-object.stderr b/tests/ui/associated-types/associated-types-incomplete-object.stderr index 0c9761afeb517..afa953760aea9 100644 --- a/tests/ui/associated-types/associated-types-incomplete-object.stderr +++ b/tests/ui/associated-types/associated-types-incomplete-object.stderr @@ -5,7 +5,12 @@ LL | type B; | ------ `B` defined here ... LL | let b = &42isize as &dyn Foo; - | ^^^^^^^^^^^^ help: specify the associated type: `Foo` + | ^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let b = &42isize as &dyn Foo; + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0191]: the value of the associated type `A` in `Foo` must be specified --> $DIR/associated-types-incomplete-object.rs:26:30 @@ -14,7 +19,12 @@ LL | type A; | ------ `A` defined here ... LL | let c = &42isize as &dyn Foo; - | ^^^^^^^^^^^ help: specify the associated type: `Foo` + | ^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let c = &42isize as &dyn Foo; + | ~~~~~~~~~~~~~~~~~~~~~ error[E0191]: the value of the associated types `A` and `B` in `Foo` must be specified --> $DIR/associated-types-incomplete-object.rs:29:30 @@ -25,7 +35,12 @@ LL | type B; | ------ `B` defined here ... LL | let d = &42isize as &dyn Foo; - | ^^^ help: specify the associated types: `Foo` + | ^^^ + | +help: specify the associated types + | +LL | let d = &42isize as &dyn Foo; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/associated-types/defaults-specialization.stderr b/tests/ui/associated-types/defaults-specialization.stderr index 7ef433d859fa4..b4ed99f36f44a 100644 --- a/tests/ui/associated-types/defaults-specialization.stderr +++ b/tests/ui/associated-types/defaults-specialization.stderr @@ -12,10 +12,7 @@ error[E0053]: method `make` has an incompatible type for trait --> $DIR/defaults-specialization.rs:19:18 | LL | fn make() -> u8 { 0 } - | ^^ - | | - | expected associated type, found `u8` - | help: change the output type to match the trait: ` as Tr>::Ty` + | ^^ expected associated type, found `u8` | note: type in trait --> $DIR/defaults-specialization.rs:9:18 @@ -24,6 +21,10 @@ LL | fn make() -> Self::Ty { | ^^^^^^^^ = note: expected signature `fn() -> as Tr>::Ty` found signature `fn() -> u8` +help: change the output type to match the trait + | +LL | fn make() -> as Tr>::Ty { 0 } + | ~~~~~~~~~~~~~~~~ error[E0053]: method `make` has an incompatible type for trait --> $DIR/defaults-specialization.rs:35:18 @@ -32,10 +33,7 @@ LL | default type Ty = bool; | ----------------------- associated type is `default` and may be overridden LL | LL | fn make() -> bool { true } - | ^^^^ - | | - | expected associated type, found `bool` - | help: change the output type to match the trait: ` as Tr>::Ty` + | ^^^^ expected associated type, found `bool` | note: type in trait --> $DIR/defaults-specialization.rs:9:18 @@ -44,6 +42,10 @@ LL | fn make() -> Self::Ty { | ^^^^^^^^ = note: expected signature `fn() -> as Tr>::Ty` found signature `fn() -> bool` +help: change the output type to match the trait + | +LL | fn make() -> as Tr>::Ty { true } + | ~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/defaults-specialization.rs:10:9 diff --git a/tests/ui/associated-types/issue-19883.stderr b/tests/ui/associated-types/issue-19883.stderr index 35184e852cfe1..e13783bca11a5 100644 --- a/tests/ui/associated-types/issue-19883.stderr +++ b/tests/ui/associated-types/issue-19883.stderr @@ -5,10 +5,12 @@ LL | type Output; | ------------ associated type `Output` defined here ... LL | >::Dst - | ^^^ - | | - | not found in `From` - | help: maybe you meant this associated type: `Output` + | ^^^ not found in `From` + | +help: maybe you meant this associated type + | +LL | >::Output + | ~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-22037.stderr b/tests/ui/associated-types/issue-22037.stderr index b02dad97d354e..e4a429119285d 100644 --- a/tests/ui/associated-types/issue-22037.stderr +++ b/tests/ui/associated-types/issue-22037.stderr @@ -4,10 +4,12 @@ error[E0576]: cannot find associated type `X` in trait `A` LL | type Output; | ------------ associated type `Output` defined here LL | fn a(&self) -> ::X; - | ^ - | | - | not found in `A` - | help: maybe you meant this associated type: `Output` + | ^ not found in `A` + | +help: maybe you meant this associated type + | +LL | fn a(&self) -> ::Output; + | ~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-23595-1.stderr b/tests/ui/associated-types/issue-23595-1.stderr index 694b68ef0901a..91151c53641de 100644 --- a/tests/ui/associated-types/issue-23595-1.stderr +++ b/tests/ui/associated-types/issue-23595-1.stderr @@ -6,7 +6,12 @@ LL | type Value; LL | type ChildKey; | ------------- `ChildKey` defined here LL | type Children = dyn Index; - | ------------- `Children` defined here ^^^^^^^^^ help: specify the associated types: `Hierarchy` + | ------------- `Children` defined here ^^^^^^^^^ + | +help: specify the associated types + | +LL | type Children = dyn Index>; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-23595-2.stderr b/tests/ui/associated-types/issue-23595-2.stderr index 2671bf57d0c43..9c5938c7e65f1 100644 --- a/tests/ui/associated-types/issue-23595-2.stderr +++ b/tests/ui/associated-types/issue-23595-2.stderr @@ -2,7 +2,12 @@ error[E0220]: associated type `anything_here_kills_it` not found for `Self` --> $DIR/issue-23595-2.rs:6:22 | LL | type B = C; - | ^^^^^^^^^^^^^^^^^^^^^^ help: `Self` has the following associated type: `B` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: `Self` has the following associated type + | +LL | type B = C; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr index 569028934cbac..ee419353a3acf 100644 --- a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr +++ b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr @@ -123,11 +123,13 @@ LL | } error[E0621]: explicit lifetime required in the type of `x` --> $DIR/without-precise-captures-we-are-powerless.rs:40:20 | -LL | fn through_field_and_ref<'a>(x: &S<'a>) { - | ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>` -... LL | outlives::<'a>(call_once(c)); | ^^^^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `x` + | +LL | fn through_field_and_ref<'a>(x: &'a S<'a>) { + | ~~~~~~~~~ error[E0597]: `c` does not live long enough --> $DIR/without-precise-captures-we-are-powerless.rs:43:20 diff --git a/tests/ui/async-await/async-fn/impl-header.stderr b/tests/ui/async-await/async-fn/impl-header.stderr index 64a98aab17b25..f7f499a2d3a92 100644 --- a/tests/ui/async-await/async-fn/impl-header.stderr +++ b/tests/ui/async-await/async-fn/impl-header.stderr @@ -39,7 +39,10 @@ error[E0046]: not all trait items implemented, missing: `call` LL | impl async Fn<()> for F {} | ^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation | - = help: implement the missing item: `fn call(&self, _: ()) -> >::Output { todo!() }` +help: implement the missing item + | +LL | impl async Fn<()> for F {fn call(&self, _: ()) -> >::Output { todo!() } + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr b/tests/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr index 8cea73f865148..07867adad2d42 100644 --- a/tests/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr +++ b/tests/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr @@ -2,7 +2,7 @@ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:5:13 | LL | pub mod await { - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 @@ -12,87 +12,127 @@ note: the lint level is defined here LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ = note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]` +help: you can use a raw identifier to stay compatible + | +LL | pub mod r#await { + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:7:20 | LL | pub struct await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | pub struct r#await; + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:11:16 | LL | use outer_mod::await::await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | use outer_mod::r#await::await; + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:11:23 | LL | use outer_mod::await::await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | use outer_mod::await::r#await; + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:16:14 | LL | struct Foo { await: () } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | struct Foo { r#await: () } + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:20:15 | LL | impl Foo { fn await() {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | impl Foo { fn r#await() {} } + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:24:14 | LL | macro_rules! await { - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | macro_rules! r#await { + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:31:5 | LL | await!(); - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | r#await!(); + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:34:11 | LL | match await { await => {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | match r#await { await => {} } + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-error-various-positions.rs:34:19 | LL | match await { await => {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | match await { r#await => {} } + | ~~~~~~~ error: aborting due to 10 previous errors diff --git a/tests/ui/async-await/await-keyword/2015-edition-warning.stderr b/tests/ui/async-await/await-keyword/2015-edition-warning.stderr index 70b7fa52a19c7..f2b0762fcc16c 100644 --- a/tests/ui/async-await/await-keyword/2015-edition-warning.stderr +++ b/tests/ui/async-await/await-keyword/2015-edition-warning.stderr @@ -2,7 +2,7 @@ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-warning.rs:7:13 | LL | pub mod await { - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 @@ -12,51 +12,75 @@ note: the lint level is defined here LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ = note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]` +help: you can use a raw identifier to stay compatible + | +LL | pub mod r#await { + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-warning.rs:10:20 | LL | pub struct await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | pub struct r#await; + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-warning.rs:15:16 | LL | use outer_mod::await::await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | use outer_mod::r#await::await; + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-warning.rs:15:23 | LL | use outer_mod::await::await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | use outer_mod::await::r#await; + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-warning.rs:22:11 | LL | match await { await => {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | match r#await { await => {} } + | ~~~~~~~ error: `await` is a keyword in the 2018 edition --> $DIR/2015-edition-warning.rs:22:19 | LL | match await { await => {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | match await { r#await => {} } + | ~~~~~~~ error: aborting due to 6 previous errors diff --git a/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr b/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr index a98bb0764c0e6..ac1bc693fab9f 100644 --- a/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr +++ b/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr @@ -2,115 +2,214 @@ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:8:13 | LL | let _ = await bar(); - | ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` + | ^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar().await; + | ~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:12:13 | LL | let _ = await? bar(); - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await?` + | ^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar().await?; + | ~~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:16:13 | LL | let _ = await bar()?; - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await` + | ^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar()?.await; + | ~~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:20:13 | LL | let _ = await { bar() }; - | ^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ bar() }.await` + | ^^^^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = { bar() }.await; + | ~~~~~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:24:13 | LL | let _ = await(bar()); - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `(bar()).await` + | ^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = (bar()).await; + | ~~~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:28:13 | LL | let _ = await { bar() }?; - | ^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ bar() }.await` + | ^^^^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = { bar() }.await?; + | ~~~~~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:32:14 | LL | let _ = (await bar())?; - | ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` + | ^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = (bar().await)?; + | ~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:36:24 | LL | let _ = bar().await(); - | ^^ help: `await` is not a method call, remove the parentheses + | ^^ + | +help: `await` is not a method call, remove the parentheses + | +LL - let _ = bar().await(); +LL + let _ = bar().await; + | error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:40:24 | LL | let _ = bar().await()?; - | ^^ help: `await` is not a method call, remove the parentheses + | ^^ + | +help: `await` is not a method call, remove the parentheses + | +LL - let _ = bar().await()?; +LL + let _ = bar().await?; + | error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:52:13 | LL | let _ = await bar(); - | ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` + | ^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar().await; + | ~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:56:13 | LL | let _ = await? bar(); - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await?` + | ^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar().await?; + | ~~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:60:13 | LL | let _ = await bar()?; - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await` + | ^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar()?.await; + | ~~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:64:14 | LL | let _ = (await bar())?; - | ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` + | ^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = (bar().await)?; + | ~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:68:24 | LL | let _ = bar().await(); - | ^^ help: `await` is not a method call, remove the parentheses + | ^^ + | +help: `await` is not a method call, remove the parentheses + | +LL - let _ = bar().await(); +LL + let _ = bar().await; + | error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:73:24 | LL | let _ = bar().await()?; - | ^^ help: `await` is not a method call, remove the parentheses + | ^^ + | +help: `await` is not a method call, remove the parentheses + | +LL - let _ = bar().await()?; +LL + let _ = bar().await?; + | error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:101:13 | LL | let _ = await!(bar()); - | ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` + | ^^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar().await; + | ~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:105:13 | LL | let _ = await!(bar())?; - | ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` + | ^^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar().await?; + | ~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:110:17 | LL | let _ = await!(bar())?; - | ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` + | ^^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar().await?; + | ~~~~~~~~~~~ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:117:17 | LL | let _ = await!(bar())?; - | ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` + | ^^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | let _ = bar().await?; + | ~~~~~~~~~~~ error: expected expression, found `=>` --> $DIR/incorrect-syntax-suggestions.rs:124:25 @@ -124,7 +223,12 @@ error: incorrect use of `await` --> $DIR/incorrect-syntax-suggestions.rs:124:11 | LL | match await { await => () } - | ^^^^^^^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ await => () }.await` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | match { await => () }.await + | ~~~~~~~~~~~~~~~~~~~~~ error: expected one of `.`, `?`, `{`, or an operator, found `}` --> $DIR/incorrect-syntax-suggestions.rs:127:1 diff --git a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr index eab5bea681cb1..f992976a33149 100644 --- a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr +++ b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr @@ -2,14 +2,16 @@ error[E0277]: `[usize; usize::MAX]` is not a future --> $DIR/debug-ice-attempted-to-add-with-overflow.rs:8:37 | LL | [0usize; 0xffff_ffff_ffff_ffff].await; - | -^^^^^ - | || - | |`[usize; usize::MAX]` is not a future - | help: remove the `.await` + | ^^^^^ `[usize; usize::MAX]` is not a future | = help: the trait `Future` is not implemented for `[usize; usize::MAX]`, which is required by `[usize; usize::MAX]: IntoFuture` = note: [usize; usize::MAX] must be a future or must implement `IntoFuture` to be awaited = note: required for `[usize; usize::MAX]` to implement `IntoFuture` +help: remove the `.await` + | +LL - [0usize; 0xffff_ffff_ffff_ffff].await; +LL + [0usize; 0xffff_ffff_ffff_ffff]; + | error[E0752]: `main` function is not allowed to be `async` --> $DIR/debug-ice-attempted-to-add-with-overflow.rs:6:1 diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr index 53cdc9b61d32b..b21129bbc560c 100644 --- a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr +++ b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr @@ -10,14 +10,16 @@ error[E0277]: `Option<_>` is not a future --> $DIR/drop-track-bad-field-in-fru.rs:6:46 | LL | None { value: (), ..Default::default() }.await; - | -^^^^^ - | || - | |`Option<_>` is not a future - | help: remove the `.await` + | ^^^^^ `Option<_>` is not a future | = help: the trait `Future` is not implemented for `Option<_>`, which is required by `Option<_>: IntoFuture` = note: Option<_> must be a future or must implement `IntoFuture` to be awaited = note: required for `Option<_>` to implement `IntoFuture` +help: remove the `.await` + | +LL - None { value: (), ..Default::default() }.await; +LL + None { value: (), ..Default::default() }; + | error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/in-trait/bad-signatures.stderr b/tests/ui/async-await/in-trait/bad-signatures.stderr index 127a343a93016..7ef2499d057a2 100644 --- a/tests/ui/async-await/in-trait/bad-signatures.stderr +++ b/tests/ui/async-await/in-trait/bad-signatures.stderr @@ -8,10 +8,12 @@ error: expected one of `:`, `@`, or `|`, found keyword `self` --> $DIR/bad-signatures.rs:5:23 | LL | async fn bar(&abc self); - | -----^^^^ - | | | - | | expected one of `:`, `@`, or `|` - | help: declare the type after the parameter binding: `: ` + | ^^^^ expected one of `:`, `@`, or `|` + | +help: declare the type after the parameter binding + | +LL | async fn bar(: ); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/issue-101715.stderr b/tests/ui/async-await/issue-101715.stderr index 3b429793b786f..e265cd468822c 100644 --- a/tests/ui/async-await/issue-101715.stderr +++ b/tests/ui/async-await/issue-101715.stderr @@ -2,14 +2,15 @@ error[E0277]: `()` is not a future --> $DIR/issue-101715.rs:11:10 | LL | .await - | -^^^^^ - | || - | |`()` is not a future - | help: remove the `.await` + | ^^^^^ `()` is not a future | = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` +help: remove the `.await` + | +LL - .await + | error: aborting due to 1 previous error diff --git a/tests/ui/async-await/issue-74047.stderr b/tests/ui/async-await/issue-74047.stderr index c2dfa050fc2ed..a1e55e03fb901 100644 --- a/tests/ui/async-await/issue-74047.stderr +++ b/tests/ui/async-await/issue-74047.stderr @@ -4,8 +4,14 @@ error[E0046]: not all trait items implemented, missing: `Error`, `try_from` LL | impl TryFrom for MyStream {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Error`, `try_from` in implementation | - = help: implement the missing item: `type Error = /* Type */;` - = help: implement the missing item: `fn try_from(_: OtherStream) -> Result>::Error> { todo!() }` +help: implement the missing item + | +LL | impl TryFrom for MyStream {type Error = /* Type */; + | ++++++++++++++++++++++++ +help: implement the missing item + | +LL | impl TryFrom for MyStream {fn try_from(_: OtherStream) -> Result>::Error> { todo!() } + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/async-await/issues/issue-63388-1.stderr b/tests/ui/async-await/issues/issue-63388-1.stderr index f7f285ad0ccda..6e7c6f52b0a10 100644 --- a/tests/ui/async-await/issues/issue-63388-1.stderr +++ b/tests/ui/async-await/issues/issue-63388-1.stderr @@ -1,14 +1,16 @@ error[E0621]: explicit lifetime required in the type of `foo` --> $DIR/issue-63388-1.rs:13:5 | -LL | &'a self, foo: &dyn Foo - | -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)` -LL | ) -> &dyn Foo LL | / { LL | | LL | | foo LL | | } | |_____^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `foo` + | +LL | &'a self, foo: &'a (dyn Foo + 'a) + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/async-await/issues/issue-63388-2.stderr b/tests/ui/async-await/issues/issue-63388-2.stderr index e515f227c7ef6..39e402e424478 100644 --- a/tests/ui/async-await/issues/issue-63388-2.stderr +++ b/tests/ui/async-await/issues/issue-63388-2.stderr @@ -15,14 +15,16 @@ LL | ) -> &'a dyn Foo error[E0621]: explicit lifetime required in the type of `foo` --> $DIR/issue-63388-2.rs:13:5 | -LL | foo: &dyn Foo, bar: &'a dyn Foo - | -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)` -LL | ) -> &dyn Foo LL | / { LL | | LL | | foo LL | | } | |_____^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `foo` + | +LL | foo: &'a (dyn Foo + 'a), bar: &'a dyn Foo + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/no-async-const.stderr b/tests/ui/async-await/no-async-const.stderr index d692ba8f47375..51eaf903ceac4 100644 --- a/tests/ui/async-await/no-async-const.stderr +++ b/tests/ui/async-await/no-async-const.stderr @@ -2,12 +2,13 @@ error: expected one of `extern`, `fn`, `safe`, or `unsafe`, found keyword `const --> $DIR/no-async-const.rs:4:11 | LL | pub async const fn x() {} - | ------^^^^^ - | | | - | | expected one of `extern`, `fn`, `safe`, or `unsafe` - | help: `const` must come before `async`: `const async` + | ^^^^^ expected one of `extern`, `fn`, `safe`, or `unsafe` | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +help: `const` must come before `async` + | +LL | pub const async fn x() {} + | ~~~~~~~~~~~ error: functions cannot be both `const` and `async` --> $DIR/no-async-const.rs:4:5 diff --git a/tests/ui/async-await/no-unsafe-async.stderr b/tests/ui/async-await/no-unsafe-async.stderr index 49b112f9313d4..ce16932d2441e 100644 --- a/tests/ui/async-await/no-unsafe-async.stderr +++ b/tests/ui/async-await/no-unsafe-async.stderr @@ -2,23 +2,25 @@ error: expected one of `extern` or `fn`, found keyword `async` --> $DIR/no-unsafe-async.rs:7:12 | LL | unsafe async fn g() {} - | -------^^^^^ - | | | - | | expected one of `extern` or `fn` - | help: `async` must come before `unsafe`: `async unsafe` + | ^^^^^ expected one of `extern` or `fn` | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +help: `async` must come before `unsafe` + | +LL | async unsafe fn g() {} + | ~~~~~~~~~~~~ error: expected one of `extern` or `fn`, found keyword `async` --> $DIR/no-unsafe-async.rs:11:8 | LL | unsafe async fn f() {} - | -------^^^^^ - | | | - | | expected one of `extern` or `fn` - | help: `async` must come before `unsafe`: `async unsafe` + | ^^^^^ expected one of `extern` or `fn` | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +help: `async` must come before `unsafe` + | +LL | async unsafe fn f() {} + | ~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr b/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr index 8344b7a07dc6f..2221417d9f833 100644 --- a/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr +++ b/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr @@ -61,8 +61,6 @@ LL | #[track_caller] || { error[E0308]: mismatched types --> $DIR/async-closure-gate.rs:27:5 | -LL | fn foo3() { - | - help: try adding a return type: `-> impl Future` LL | / async { LL | | LL | | let _ = #[track_caller] || { @@ -73,12 +71,14 @@ LL | | } | = note: expected unit type `()` found `async` block `{async block@$DIR/async-closure-gate.rs:27:5: 27:10}` +help: try adding a return type + | +LL | fn foo3() -> impl Future { + | +++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/async-closure-gate.rs:44:5 | -LL | fn foo5() { - | - help: try adding a return type: `-> impl Future` LL | / async { LL | | LL | | let _ = || { @@ -90,6 +90,10 @@ LL | | } | = note: expected unit type `()` found `async` block `{async block@$DIR/async-closure-gate.rs:44:5: 44:10}` +help: try adding a return type + | +LL | fn foo5() -> impl Future { + | +++++++++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr b/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr index 8344b7a07dc6f..2221417d9f833 100644 --- a/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr +++ b/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr @@ -61,8 +61,6 @@ LL | #[track_caller] || { error[E0308]: mismatched types --> $DIR/async-closure-gate.rs:27:5 | -LL | fn foo3() { - | - help: try adding a return type: `-> impl Future` LL | / async { LL | | LL | | let _ = #[track_caller] || { @@ -73,12 +71,14 @@ LL | | } | = note: expected unit type `()` found `async` block `{async block@$DIR/async-closure-gate.rs:27:5: 27:10}` +help: try adding a return type + | +LL | fn foo3() -> impl Future { + | +++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/async-closure-gate.rs:44:5 | -LL | fn foo5() { - | - help: try adding a return type: `-> impl Future` LL | / async { LL | | LL | | let _ = || { @@ -90,6 +90,10 @@ LL | | } | = note: expected unit type `()` found `async` block `{async block@$DIR/async-closure-gate.rs:44:5: 44:10}` +help: try adding a return type + | +LL | fn foo5() -> impl Future { + | +++++++++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/async-await/unnecessary-await.stderr b/tests/ui/async-await/unnecessary-await.stderr index 8d81957653240..4cb0a68a96854 100644 --- a/tests/ui/async-await/unnecessary-await.stderr +++ b/tests/ui/async-await/unnecessary-await.stderr @@ -23,14 +23,16 @@ error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:28:10 | LL | e!().await; - | -^^^^^ - | || - | |`()` is not a future - | help: remove the `.await` + | ^^^^^ `()` is not a future | = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` +help: remove the `.await` + | +LL - e!().await; +LL + e!(); + | error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:22:15 @@ -53,14 +55,16 @@ error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:36:20 | LL | for x in [] {}.await - | -^^^^^ - | || - | |`()` is not a future - | help: remove the `.await` + | ^^^^^ `()` is not a future | = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` +help: remove the `.await` + | +LL - for x in [] {}.await +LL + for x in [] {} + | error: aborting due to 4 previous errors diff --git a/tests/ui/async-await/unused-lifetime.stderr b/tests/ui/async-await/unused-lifetime.stderr index 5c00501a62fe5..e37d731aba8ab 100644 --- a/tests/ui/async-await/unused-lifetime.stderr +++ b/tests/ui/async-await/unused-lifetime.stderr @@ -2,47 +2,78 @@ error: lifetime parameter `'a` never used --> $DIR/unused-lifetime.rs:8:35 | LL | async fn async_wrong_without_args<'a>() {} - | -^^- help: elide the unused lifetime + | ^^ | note: the lint level is defined here --> $DIR/unused-lifetime.rs:6:9 | LL | #![deny(unused_lifetimes)] | ^^^^^^^^^^^^^^^^ +help: elide the unused lifetime + | +LL - async fn async_wrong_without_args<'a>() {} +LL + async fn async_wrong_without_args() {} + | error: lifetime parameter `'a` never used --> $DIR/unused-lifetime.rs:10:33 | LL | async fn async_wrong_1_lifetime<'a>(_: &i32) {} - | -^^- help: elide the unused lifetime + | ^^ + | +help: elide the unused lifetime + | +LL - async fn async_wrong_1_lifetime<'a>(_: &i32) {} +LL + async fn async_wrong_1_lifetime(_: &i32) {} + | error: lifetime parameter `'b` never used --> $DIR/unused-lifetime.rs:12:38 | LL | async fn async_wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {} - | --^^ - | | - | help: elide the unused lifetime + | ^^ + | +help: elide the unused lifetime + | +LL - async fn async_wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {} +LL + async fn async_wrong_2_lifetimes<'a>(_: &'a i32, _: &i32) {} + | error: lifetime parameter `'a` never used --> $DIR/unused-lifetime.rs:23:23 | LL | fn wrong_without_args<'a>() {} - | -^^- help: elide the unused lifetime + | ^^ + | +help: elide the unused lifetime + | +LL - fn wrong_without_args<'a>() {} +LL + fn wrong_without_args() {} + | error: lifetime parameter `'a` never used --> $DIR/unused-lifetime.rs:25:21 | LL | fn wrong_1_lifetime<'a>(_: &i32) {} - | -^^- help: elide the unused lifetime + | ^^ + | +help: elide the unused lifetime + | +LL - fn wrong_1_lifetime<'a>(_: &i32) {} +LL + fn wrong_1_lifetime(_: &i32) {} + | error: lifetime parameter `'b` never used --> $DIR/unused-lifetime.rs:27:26 | LL | fn wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {} - | --^^ - | | - | help: elide the unused lifetime + | ^^ + | +help: elide the unused lifetime + | +LL - fn wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {} +LL + fn wrong_2_lifetimes<'a>(_: &'a i32, _: &i32) {} + | error: aborting due to 6 previous errors diff --git a/tests/ui/attributes/issue-90873.stderr b/tests/ui/attributes/issue-90873.stderr index 5a8bbaf8ec191..444497538e8dc 100644 --- a/tests/ui/attributes/issue-90873.stderr +++ b/tests/ui/attributes/issue-90873.stderr @@ -32,7 +32,12 @@ error: missing type for `static` item --> $DIR/issue-90873.rs:1:17 | LL | #![u=||{static d=||1;}] - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | #![u=||{static d: =||1;}] + | ++++++++ error: aborting due to 6 previous errors diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index 9e37d5f50837d..4a95c36f4b2be 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -2,7 +2,12 @@ error: malformed `rustc_confusables` attribute input --> $DIR/rustc_confusables.rs:34:5 | LL | #[rustc_confusables] - | ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[rustc_confusables("name1", "name2", ...)] + | error: attribute should be applied to an inherent method --> $DIR/rustc_confusables.rs:45:1 diff --git a/tests/ui/auto-traits/auto-trait-validation.stderr b/tests/ui/auto-traits/auto-trait-validation.stderr index a6e5ac54869d2..b4db3fff864ad 100644 --- a/tests/ui/auto-traits/auto-trait-validation.stderr +++ b/tests/ui/auto-traits/auto-trait-validation.stderr @@ -2,34 +2,57 @@ error[E0567]: auto traits cannot have generic parameters --> $DIR/auto-trait-validation.rs:6:19 | LL | auto trait Generic {} - | -------^^^ help: remove the parameters + | -------^^^ | | | auto trait cannot have generic parameters + | +help: remove the parameters + | +LL - auto trait Generic {} +LL + auto trait Generic {} + | error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/auto-trait-validation.rs:8:17 | LL | auto trait Bound : Copy {} - | -----^^^^^^^ help: remove the super traits or lifetime bounds + | -----^^^^^^^ | | | auto traits cannot have super traits or lifetime bounds + | +help: remove the super traits or lifetime bounds + | +LL - auto trait Bound : Copy {} +LL + auto trait Bound {} + | error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/auto-trait-validation.rs:10:25 | LL | auto trait LifetimeBound : 'static {} - | -------------^^^^^^^^^^ help: remove the super traits or lifetime bounds + | -------------^^^^^^^^^^ | | | auto traits cannot have super traits or lifetime bounds + | +help: remove the super traits or lifetime bounds + | +LL - auto trait LifetimeBound : 'static {} +LL + auto trait LifetimeBound {} + | error[E0380]: auto traits cannot have associated items --> $DIR/auto-trait-validation.rs:12:25 | LL | auto trait MyTrait { fn foo() {} } - | ------- ---^^^----- - | | | - | | help: remove these associated items + | ------- ^^^ + | | | auto traits cannot have associated items + | +help: remove these associated items + | +LL - auto trait MyTrait { fn foo() {} } +LL + auto trait MyTrait { } + | error: aborting due to 4 previous errors diff --git a/tests/ui/auto-traits/bad-generics-on-dyn.stderr b/tests/ui/auto-traits/bad-generics-on-dyn.stderr index 06c7cbcd76da6..1f43c8b0e1d6c 100644 --- a/tests/ui/auto-traits/bad-generics-on-dyn.stderr +++ b/tests/ui/auto-traits/bad-generics-on-dyn.stderr @@ -2,9 +2,15 @@ error[E0567]: auto traits cannot have generic parameters --> $DIR/bad-generics-on-dyn.rs:3:18 | LL | auto trait Trait1<'a> {} - | ------^^^^ help: remove the parameters + | ------^^^^ | | | auto trait cannot have generic parameters + | +help: remove the parameters + | +LL - auto trait Trait1<'a> {} +LL + auto trait Trait1 {} + | error: aborting due to 1 previous error diff --git a/tests/ui/auto-traits/has-arguments.stderr b/tests/ui/auto-traits/has-arguments.stderr index b8a680e6a5cad..4a8a622abb0cc 100644 --- a/tests/ui/auto-traits/has-arguments.stderr +++ b/tests/ui/auto-traits/has-arguments.stderr @@ -2,9 +2,15 @@ error[E0567]: auto traits cannot have generic parameters --> $DIR/has-arguments.rs:3:18 | LL | auto trait Trait1<'outer> {} - | ------^^^^^^^^ help: remove the parameters + | ------^^^^^^^^ | | | auto trait cannot have generic parameters + | +help: remove the parameters + | +LL - auto trait Trait1<'outer> {} +LL + auto trait Trait1 {} + | error: aborting due to 1 previous error diff --git a/tests/ui/auto-traits/issue-117789.stderr b/tests/ui/auto-traits/issue-117789.stderr index 99efb21341758..ad7e3d15a7a7d 100644 --- a/tests/ui/auto-traits/issue-117789.stderr +++ b/tests/ui/auto-traits/issue-117789.stderr @@ -2,9 +2,15 @@ error[E0567]: auto traits cannot have generic parameters --> $DIR/issue-117789.rs:1:17 | LL | auto trait Trait

{} - | -----^^^ help: remove the parameters + | -----^^^ | | | auto trait cannot have generic parameters + | +help: remove the parameters + | +LL - auto trait Trait

{} +LL + auto trait Trait {} + | error[E0658]: auto traits are experimental and possibly buggy --> $DIR/issue-117789.rs:1:1 diff --git a/tests/ui/auto-traits/issue-23080-2.current.stderr b/tests/ui/auto-traits/issue-23080-2.current.stderr index 62c7b37041fea..1207e4f6cdfb3 100644 --- a/tests/ui/auto-traits/issue-23080-2.current.stderr +++ b/tests/ui/auto-traits/issue-23080-2.current.stderr @@ -4,7 +4,13 @@ error[E0380]: auto traits cannot have associated items LL | unsafe auto trait Trait { | ----- auto traits cannot have associated items LL | type Output; - | -----^^^^^^- help: remove these associated items + | ^^^^^^ + | +help: remove these associated items + | +LL - type Output; +LL + + | error: aborting due to 1 previous error diff --git a/tests/ui/auto-traits/issue-23080-2.next.stderr b/tests/ui/auto-traits/issue-23080-2.next.stderr index 62c7b37041fea..1207e4f6cdfb3 100644 --- a/tests/ui/auto-traits/issue-23080-2.next.stderr +++ b/tests/ui/auto-traits/issue-23080-2.next.stderr @@ -4,7 +4,13 @@ error[E0380]: auto traits cannot have associated items LL | unsafe auto trait Trait { | ----- auto traits cannot have associated items LL | type Output; - | -----^^^^^^- help: remove these associated items + | ^^^^^^ + | +help: remove these associated items + | +LL - type Output; +LL + + | error: aborting due to 1 previous error diff --git a/tests/ui/auto-traits/issue-23080.stderr b/tests/ui/auto-traits/issue-23080.stderr index 5cea45060c824..1592664272d1d 100644 --- a/tests/ui/auto-traits/issue-23080.stderr +++ b/tests/ui/auto-traits/issue-23080.stderr @@ -1,13 +1,17 @@ error[E0380]: auto traits cannot have associated items --> $DIR/issue-23080.rs:5:8 | -LL | unsafe auto trait Trait { - | ----- auto traits cannot have associated items -LL | fn method(&self) { - | _____- ^^^^^^ -LL | | println!("Hello"); -LL | | } - | |_____- help: remove these associated items +LL | unsafe auto trait Trait { + | ----- auto traits cannot have associated items +LL | fn method(&self) { + | ^^^^^^ + | +help: remove these associated items + | +LL - fn method(&self) { +LL - println!("Hello"); +LL - } + | error: aborting due to 1 previous error diff --git a/tests/ui/auto-traits/issue-84075.stderr b/tests/ui/auto-traits/issue-84075.stderr index 943d521ce9e27..bd2377f91d024 100644 --- a/tests/ui/auto-traits/issue-84075.stderr +++ b/tests/ui/auto-traits/issue-84075.stderr @@ -2,9 +2,15 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/issue-84075.rs:5:18 | LL | auto trait Magic where Self: Copy {} - | ----- ^^^^^^^^^^^^^^^^ help: remove the super traits or lifetime bounds + | ----- ^^^^^^^^^^^^^^^^ | | | auto traits cannot have super traits or lifetime bounds + | +help: remove the super traits or lifetime bounds + | +LL - auto trait Magic where Self: Copy {} +LL + auto trait Magic {} + | error: aborting due to 1 previous error diff --git a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr index 4c1de72798c45..97f31ac4b59f4 100644 --- a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr +++ b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr @@ -2,17 +2,29 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/typeck-auto-trait-no-supertraits-2.rs:4:17 | LL | auto trait Magic : Sized where Option : Magic {} - | -----^^^^^^^^ help: remove the super traits or lifetime bounds + | -----^^^^^^^^ | | | auto traits cannot have super traits or lifetime bounds + | +help: remove the super traits or lifetime bounds + | +LL - auto trait Magic : Sized where Option : Magic {} +LL + auto trait Magic where Option : Magic {} + | error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/typeck-auto-trait-no-supertraits-2.rs:4:26 | LL | auto trait Magic : Sized where Option : Magic {} - | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the super traits or lifetime bounds + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | auto traits cannot have super traits or lifetime bounds + | +help: remove the super traits or lifetime bounds + | +LL - auto trait Magic : Sized where Option : Magic {} +LL + auto trait Magic : Sized {} + | error[E0382]: use of moved value: `x` --> $DIR/typeck-auto-trait-no-supertraits-2.rs:8:41 diff --git a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr index 23aae13639c77..42be4d366269e 100644 --- a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr +++ b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr @@ -2,9 +2,15 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/typeck-auto-trait-no-supertraits.rs:28:17 | LL | auto trait Magic: Copy {} - | -----^^^^^^ help: remove the super traits or lifetime bounds + | -----^^^^^^ | | | auto traits cannot have super traits or lifetime bounds + | +help: remove the super traits or lifetime bounds + | +LL - auto trait Magic: Copy {} +LL + auto trait Magic {} + | error: aborting due to 1 previous error diff --git a/tests/ui/blind/blind-item-block-middle.stderr b/tests/ui/blind/blind-item-block-middle.stderr index b2ae169013a62..e7ab9a1c2c91f 100644 --- a/tests/ui/blind/blind-item-block-middle.stderr +++ b/tests/ui/blind/blind-item-block-middle.stderr @@ -9,7 +9,11 @@ LL | let bar = 5; | | | expected integer, found `bar` | `bar` is interpreted as a unit struct, not a new binding - | help: introduce a new binding instead: `other_bar` + | +help: introduce a new binding instead + | +LL | let other_bar = 5; + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/block-result/block-must-not-have-result-while.stderr b/tests/ui/block-result/block-must-not-have-result-while.stderr index 94a4b33da5dda..de2a25614ae7e 100644 --- a/tests/ui/block-result/block-must-not-have-result-while.stderr +++ b/tests/ui/block-result/block-must-not-have-result-while.stderr @@ -2,9 +2,13 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/block-must-not-have-result-while.rs:2:5 | LL | while true { - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | loop { + | ~~~~ error[E0308]: mismatched types --> $DIR/block-must-not-have-result-while.rs:3:9 diff --git a/tests/ui/block-result/consider-removing-last-semi.stderr b/tests/ui/block-result/consider-removing-last-semi.stderr index d30ab1293431b..0ffdc2497b970 100644 --- a/tests/ui/block-result/consider-removing-last-semi.stderr +++ b/tests/ui/block-result/consider-removing-last-semi.stderr @@ -5,9 +5,12 @@ LL | pub fn f() -> String { | - ^^^^^^ expected `String`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -LL | 0u8; -LL | "bla".to_string(); - | - help: remove this semicolon to return this value + | +help: remove this semicolon to return this value + | +LL - "bla".to_string(); +LL + "bla".to_string() + | error[E0308]: mismatched types --> $DIR/consider-removing-last-semi.rs:8:15 @@ -16,9 +19,12 @@ LL | pub fn g() -> String { | - ^^^^^^ expected `String`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -LL | "this won't work".to_string(); -LL | "removeme".to_string(); - | - help: remove this semicolon to return this value + | +help: remove this semicolon to return this value + | +LL - "removeme".to_string(); +LL + "removeme".to_string() + | error[E0308]: mismatched types --> $DIR/consider-removing-last-semi.rs:13:25 @@ -27,9 +33,12 @@ LL | pub fn macro_tests() -> u32 { | ----------- ^^^ expected `u32`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -... -LL | mac!(); - | - help: remove this semicolon to return this value + | +help: remove this semicolon to return this value + | +LL - mac!(); +LL + mac!() + | error: aborting due to 3 previous errors diff --git a/tests/ui/block-result/issue-11714.stderr b/tests/ui/block-result/issue-11714.stderr index 25651328e9dcc..05ca2e8accfac 100644 --- a/tests/ui/block-result/issue-11714.stderr +++ b/tests/ui/block-result/issue-11714.stderr @@ -5,9 +5,11 @@ LL | fn blah() -> i32 { | ---- ^^^ expected `i32`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -... -LL | ; - | - help: remove this semicolon to return this value + | +help: remove this semicolon to return this value + | +LL - ; + | error: aborting due to 1 previous error diff --git a/tests/ui/block-result/issue-13428.stderr b/tests/ui/block-result/issue-13428.stderr index c119b69da2294..bfddc17991817 100644 --- a/tests/ui/block-result/issue-13428.stderr +++ b/tests/ui/block-result/issue-13428.stderr @@ -13,9 +13,11 @@ LL | fn bar() -> String { | --- ^^^^^^ expected `String`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -LL | "foobar".to_string() -LL | ; - | - help: remove this semicolon to return this value + | +help: remove this semicolon to return this value + | +LL - ; + | error: aborting due to 2 previous errors diff --git a/tests/ui/block-result/issue-20862.stderr b/tests/ui/block-result/issue-20862.stderr index 1df3a6836206b..36e80c054ef68 100644 --- a/tests/ui/block-result/issue-20862.stderr +++ b/tests/ui/block-result/issue-20862.stderr @@ -1,13 +1,15 @@ error[E0308]: mismatched types --> $DIR/issue-20862.rs:2:5 | -LL | fn foo(x: i32) { - | - help: a return type might be missing here: `-> _` LL | |y| x + y | ^^^^^^^^^ expected `()`, found closure | = note: expected unit type `()` found closure `{closure@$DIR/issue-20862.rs:2:5: 2:8}` +help: a return type might be missing here + | +LL | fn foo(x: i32) -> _ { + | ++++ error[E0618]: expected function, found `()` --> $DIR/issue-20862.rs:7:13 diff --git a/tests/ui/borrowck/generic_const_early_param.stderr b/tests/ui/borrowck/generic_const_early_param.stderr index 3f56d6a332515..6447f92aba853 100644 --- a/tests/ui/borrowck/generic_const_early_param.stderr +++ b/tests/ui/borrowck/generic_const_early_param.stderr @@ -7,19 +7,24 @@ LL | struct DataWrapper<'static> { error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic_const_early_param.rs:6:12 | -LL | struct DataWrapper<'static> { - | - help: consider introducing lifetime `'a` here: `'a,` -LL | LL | data: &'a [u8; Self::SIZE], | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | struct DataWrapper<'a, 'static> { + | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic_const_early_param.rs:10:18 | LL | impl DataWrapper<'a> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | impl<'a> DataWrapper<'a> { + | ++++ warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/generic_const_early_param.rs:1:12 diff --git a/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr index 3a6b8008fceb3..41c7eccc728b1 100644 --- a/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr +++ b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr @@ -17,11 +17,15 @@ warning: anonymous parameters are deprecated and will be removed in the next edi --> $DIR/ice-mutability-error-slicing-121807.rs:7:30 | LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; - | ^^^^^^^^^^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: Self::Assoc<'_>` + | ^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 = note: `#[warn(anonymous_parameters)]` on by default +help: try naming the parameter or explicitly ignoring it + | +LL | extern "C" fn read_dword(_: Self::Assoc<'_>) -> u16; + | ~~~~~~~~~~~~~~~~~~ error[E0220]: associated type `Assoc` not found for `Self` --> $DIR/ice-mutability-error-slicing-121807.rs:7:36 diff --git a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr index a66281a188d72..bee6ffdcde382 100644 --- a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr +++ b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr @@ -5,10 +5,14 @@ LL | v.call(|(), this: &mut S| v.get()); | ^^----^------------------^-^^^^^^^ | | | | | | | | | first borrow occurs due to use of `v` in closure - | | | | help: try using the closure argument: `this` | | | immutable borrow occurs here | | immutable borrow later used by call | mutable borrow occurs here + | +help: try using the closure argument + | +LL | v.call(|(), this: &mut S| this.get()); + | ~~~~ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/issue-109271-pass-self-into-closure.rs:21:5 @@ -17,10 +21,14 @@ LL | v.call(|(), this: &mut S| v.set()); | ^^----^------------------^-^^^^^^^ | | | | | | | | | first borrow occurs due to use of `v` in closure - | | | | help: try using the closure argument: `this` | | | first mutable borrow occurs here | | first borrow later used by call | second mutable borrow occurs here + | +help: try using the closure argument + | +LL | v.call(|(), this: &mut S| this.set()); + | ~~~~ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/issue-109271-pass-self-into-closure.rs:21:12 diff --git a/tests/ui/borrowck/issue-82032.stderr b/tests/ui/borrowck/issue-82032.stderr index 2ac785cd1e3bd..bb2d67aa47331 100644 --- a/tests/ui/borrowck/issue-82032.stderr +++ b/tests/ui/borrowck/issue-82032.stderr @@ -2,12 +2,14 @@ error[E0596]: cannot borrow `*v` as mutable, as it is behind a `&` reference --> $DIR/issue-82032.rs:10:13 | LL | for v in self.0.values() { - | --------------- - | | | - | | help: use mutable method: `values_mut()` - | this iterator yields `&` references + | --------------- this iterator yields `&` references LL | v.flush(); | ^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: use mutable method + | +LL | for v in self.0.values_mut() { + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr index c0b6dcd1512f7..c50e3fb640597 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { - | ^^^^^^^^^^^^---- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^^^^^^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 | LL | struct LockedMarket(T); | ^^^^^^^^^^^^ +help: remove these generics + | +LL - async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { +LL + async fn buy_lock(coroutine: &Mutex) -> LockedMarket { + | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 @@ -32,9 +35,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { - | ^^^^^^^^^^^^---- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^^^^^^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 @@ -42,6 +43,11 @@ note: struct defined here, with 0 lifetime parameters LL | struct LockedMarket(T); | ^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { +LL + async fn buy_lock(coroutine: &Mutex) -> LockedMarket { + | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 diff --git a/tests/ui/borrowck/mut-borrow-in-loop.stderr b/tests/ui/borrowck/mut-borrow-in-loop.stderr index b621694a548cf..d0a3acaf976c2 100644 --- a/tests/ui/borrowck/mut-borrow-in-loop.stderr +++ b/tests/ui/borrowck/mut-borrow-in-loop.stderr @@ -2,9 +2,13 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/mut-borrow-in-loop.rs:15:9 | LL | while true { - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | loop { + | ~~~~ error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:10:25 diff --git a/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr b/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr index 349546606a57e..f65926d81c475 100644 --- a/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr +++ b/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr @@ -2,19 +2,23 @@ error[E0433]: failed to resolve: use of undeclared type `E` --> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:6:17 | LL | let mut a = E::StructVar { boxed: Box::new(5_i32) }; - | ^ - | | - | use of undeclared type `E` - | help: a trait with a similar name exists: `Eq` + | ^ use of undeclared type `E` + | +help: a trait with a similar name exists + | +LL | let mut a = Eq::StructVar { boxed: Box::new(5_i32) }; + | ~~ error[E0433]: failed to resolve: use of undeclared type `E` --> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:9:9 | LL | E::StructVar { box boxed } => { } - | ^ - | | - | use of undeclared type `E` - | help: a trait with a similar name exists: `Eq` + | ^ use of undeclared type `E` + | +help: a trait with a similar name exists + | +LL | Eq::StructVar { box boxed } => { } + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr b/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr index 5c70eccfbd35c..ac973bdeb3334 100644 --- a/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr +++ b/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr @@ -2,11 +2,15 @@ warning: anonymous parameters are deprecated and will be removed in the next edi --> $DIR/trait-impl-argument-difference-ice.rs:4:30 | LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; - | ^^^^^^^^^^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: Self::Assoc<'_>` + | ^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 = note: `#[warn(anonymous_parameters)]` on by default +help: try naming the parameter or explicitly ignoring it + | +LL | extern "C" fn read_dword(_: Self::Assoc<'_>) -> u16; + | ~~~~~~~~~~~~~~~~~~ error[E0220]: associated type `Assoc` not found for `Self` --> $DIR/trait-impl-argument-difference-ice.rs:4:36 diff --git a/tests/ui/c-variadic/issue-32201.stderr b/tests/ui/c-variadic/issue-32201.stderr index 352db9f62f6d8..1876f49f96b57 100644 --- a/tests/ui/c-variadic/issue-32201.stderr +++ b/tests/ui/c-variadic/issue-32201.stderr @@ -2,7 +2,12 @@ error[E0617]: can't pass `fn(*const u8) {bar}` to variadic function --> $DIR/issue-32201.rs:9:16 | LL | foo(0, bar); - | ^^^ help: cast the value to `fn(*const u8)`: `bar as fn(*const u8)` + | ^^^ + | +help: cast the value to `fn(*const u8)` + | +LL | foo(0, bar as fn(*const u8)); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/c-variadic/variadic-ffi-1.stderr b/tests/ui/c-variadic/variadic-ffi-1.stderr index 4beea83d8a528..246713cab444b 100644 --- a/tests/ui/c-variadic/variadic-ffi-1.stderr +++ b/tests/ui/c-variadic/variadic-ffi-1.stderr @@ -62,37 +62,67 @@ error[E0617]: can't pass `f32` to variadic function --> $DIR/variadic-ffi-1.rs:28:19 | LL | foo(1, 2, 3f32); - | ^^^^ help: cast the value to `c_double`: `3f32 as c_double` + | ^^^^ + | +help: cast the value to `c_double` + | +LL | foo(1, 2, 3f32 as c_double); + | ~~~~~~~~~~~~~~~~ error[E0617]: can't pass `bool` to variadic function --> $DIR/variadic-ffi-1.rs:29:19 | LL | foo(1, 2, true); - | ^^^^ help: cast the value to `c_int`: `true as c_int` + | ^^^^ + | +help: cast the value to `c_int` + | +LL | foo(1, 2, true as c_int); + | ~~~~~~~~~~~~~ error[E0617]: can't pass `i8` to variadic function --> $DIR/variadic-ffi-1.rs:30:19 | LL | foo(1, 2, 1i8); - | ^^^ help: cast the value to `c_int`: `1i8 as c_int` + | ^^^ + | +help: cast the value to `c_int` + | +LL | foo(1, 2, 1i8 as c_int); + | ~~~~~~~~~~~~ error[E0617]: can't pass `u8` to variadic function --> $DIR/variadic-ffi-1.rs:31:19 | LL | foo(1, 2, 1u8); - | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint` + | ^^^ + | +help: cast the value to `c_uint` + | +LL | foo(1, 2, 1u8 as c_uint); + | ~~~~~~~~~~~~~ error[E0617]: can't pass `i16` to variadic function --> $DIR/variadic-ffi-1.rs:32:19 | LL | foo(1, 2, 1i16); - | ^^^^ help: cast the value to `c_int`: `1i16 as c_int` + | ^^^^ + | +help: cast the value to `c_int` + | +LL | foo(1, 2, 1i16 as c_int); + | ~~~~~~~~~~~~~ error[E0617]: can't pass `u16` to variadic function --> $DIR/variadic-ffi-1.rs:33:19 | LL | foo(1, 2, 1u16); - | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint` + | ^^^^ + | +help: cast the value to `c_uint` + | +LL | foo(1, 2, 1u16 as c_uint); + | ~~~~~~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/tests/ui/cast/cast-char.stderr b/tests/ui/cast/cast-char.stderr index 211937c9d6faf..8ca0e28e59e3b 100644 --- a/tests/ui/cast/cast-char.stderr +++ b/tests/ui/cast/cast-char.stderr @@ -2,19 +2,28 @@ error: only `u8` can be cast into `char` --> $DIR/cast-char.rs:4:23 | LL | const XYZ: char = 0x1F888 as char; - | ^^^^^^^^^^^^^^^ help: use a `char` literal instead: `'\u{1F888}'` + | ^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/cast-char.rs:1:9 | LL | #![deny(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ +help: use a `char` literal instead + | +LL | const XYZ: char = '\u{1F888}'; + | ~~~~~~~~~~~ error: only `u8` can be cast into `char` --> $DIR/cast-char.rs:6:22 | LL | const XY: char = 129160 as char; - | ^^^^^^^^^^^^^^ help: use a `char` literal instead: `'\u{1F888}'` + | ^^^^^^^^^^^^^^ + | +help: use a `char` literal instead + | +LL | const XY: char = '\u{1F888}'; + | ~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/cast/cast-to-slice.stderr b/tests/ui/cast/cast-to-slice.stderr index 8f862c0001401..93ab026765e25 100644 --- a/tests/ui/cast/cast-to-slice.stderr +++ b/tests/ui/cast/cast-to-slice.stderr @@ -2,17 +2,23 @@ error[E0620]: cast to unsized type: `&[u8]` as `[char]` --> $DIR/cast-to-slice.rs:2:5 | LL | "example".as_bytes() as [char]; - | ^^^^^^^^^^^^^^^^^^^^^^^^------ - | | - | help: try casting to a reference instead: `&[char]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try casting to a reference instead + | +LL | "example".as_bytes() as &[char]; + | ~~~~~~~ error[E0620]: cast to unsized type: `&[u8]` as `[char]` --> $DIR/cast-to-slice.rs:6:5 | LL | arr as [char]; - | ^^^^^^^------ - | | - | help: try casting to a reference instead: `&[char]` + | ^^^^^^^^^^^^^ + | +help: try casting to a reference instead + | +LL | arr as &[char]; + | ~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/cast/cast-to-unsized-trait-object-suggestion.stderr b/tests/ui/cast/cast-to-unsized-trait-object-suggestion.stderr index 3b5b8ea69c195..be68e4dcc4629 100644 --- a/tests/ui/cast/cast-to-unsized-trait-object-suggestion.stderr +++ b/tests/ui/cast/cast-to-unsized-trait-object-suggestion.stderr @@ -2,17 +2,23 @@ error[E0620]: cast to unsized type: `&{integer}` as `dyn Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:2:5 | LL | &1 as dyn Send; - | ^^^^^^-------- - | | - | help: try casting to a reference instead: `&dyn Send` + | ^^^^^^^^^^^^^^ + | +help: try casting to a reference instead + | +LL | &1 as &dyn Send; + | ~~~~~~~~~ error[E0620]: cast to unsized type: `Box<{integer}>` as `dyn Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | LL | Box::new(1) as dyn Send; - | ^^^^^^^^^^^^^^^-------- - | | - | help: you can cast to a `Box` instead: `Box` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can cast to a `Box` instead + | +LL | Box::new(1) as Box; + | ~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/cast/ice-cast-type-with-error-124848.stderr b/tests/ui/cast/ice-cast-type-with-error-124848.stderr index 2d86bf76d1102..a9969ab736ac0 100644 --- a/tests/ui/cast/ice-cast-type-with-error-124848.stderr +++ b/tests/ui/cast/ice-cast-type-with-error-124848.stderr @@ -2,27 +2,34 @@ error[E0261]: use of undeclared lifetime name `'unpinned` --> $DIR/ice-cast-type-with-error-124848.rs:7:32 | LL | struct MyType<'a>(Cell>>, Pin); - | - ^^^^^^^^^ undeclared lifetime - | | - | help: consider introducing lifetime `'unpinned` here: `'unpinned,` + | ^^^^^^^^^ undeclared lifetime + | +help: consider introducing lifetime `'unpinned` here + | +LL | struct MyType<'unpinned, 'a>(Cell>>, Pin); + | ++++++++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-cast-type-with-error-124848.rs:14:53 | -LL | fn main() { - | - help: consider introducing lifetime `'a` here: `<'a>` -... LL | let bad_addr = &unpinned as *const Cell>> as usize; | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn main<'a>() { + | ++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-cast-type-with-error-124848.rs:14:67 | -LL | fn main() { - | - help: consider introducing lifetime `'a` here: `<'a>` -... LL | let bad_addr = &unpinned as *const Cell>> as usize; | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn main<'a>() { + | ++++ error[E0412]: cannot find type `Pin` in this scope --> $DIR/ice-cast-type-with-error-124848.rs:7:60 diff --git a/tests/ui/check-cfg/cargo-build-script.stderr b/tests/ui/check-cfg/cargo-build-script.stderr index 9ab3290ef22e6..e004b6378b9f2 100644 --- a/tests/ui/check-cfg/cargo-build-script.stderr +++ b/tests/ui/check-cfg/cargo-build-script.stderr @@ -28,9 +28,7 @@ warning: unexpected `cfg` condition value: `yes` --> $DIR/cargo-build-script.rs:18:7 | LL | #[cfg(has_bar = "yes")] - | ^^^^^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^ | = note: no expected value for `has_bar` = help: consider using a Cargo feature instead @@ -38,6 +36,11 @@ LL | #[cfg(has_bar = "yes")] [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(has_bar, values("yes"))'] } = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(has_bar = "yes")] +LL + #[cfg(has_bar)] + | warning: 3 warnings emitted diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr index 9d3117ed54d1b..fcedb9590a997 100644 --- a/tests/ui/check-cfg/cargo-feature.none.stderr +++ b/tests/ui/check-cfg/cargo-feature.none.stderr @@ -2,22 +2,32 @@ warning: unexpected `cfg` condition value: `serde` --> $DIR/cargo-feature.rs:14:7 | LL | #[cfg(feature = "serde")] - | ^^^^^^^^^^^^^^^^^ help: remove the condition + | ^^^^^^^^^^^^^^^^^ | = note: no expected values for `feature` = help: consider adding `serde` as a feature in `Cargo.toml` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the condition + | +LL - #[cfg(feature = "serde")] +LL + #[cfg()] + | warning: unexpected `cfg` condition value: (none) --> $DIR/cargo-feature.rs:18:7 | LL | #[cfg(feature)] - | ^^^^^^^ help: remove the condition + | ^^^^^^^ | = note: no expected values for `feature` = help: consider defining some features in `Cargo.toml` = note: see for more information about checking conditional configuration +help: remove the condition + | +LL - #[cfg(feature)] +LL + #[cfg()] + | warning: unexpected `cfg` condition name: `tokio_unstable` --> $DIR/cargo-feature.rs:22:7 diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr index 14e24cb1429ab..6c8ba70872947 100644 --- a/tests/ui/check-cfg/cargo-feature.some.stderr +++ b/tests/ui/check-cfg/cargo-feature.some.stderr @@ -13,11 +13,15 @@ warning: unexpected `cfg` condition value: (none) --> $DIR/cargo-feature.rs:18:7 | LL | #[cfg(feature)] - | ^^^^^^^- help: specify a config value: `= "bitcode"` + | ^^^^^^^ | = note: expected values for `feature` are: `bitcode` = help: consider defining some features in `Cargo.toml` = note: see for more information about checking conditional configuration +help: specify a config value + | +LL | #[cfg(feature = "bitcode")] + | +++++++++++ warning: unexpected `cfg` condition name: `tokio_unstable` --> $DIR/cargo-feature.rs:22:7 @@ -37,9 +41,7 @@ warning: unexpected `cfg` condition value: `m` --> $DIR/cargo-feature.rs:26:7 | LL | #[cfg(CONFIG_NVME = "m")] - | ^^^^^^^^^^^^^^--- - | | - | help: there is a expected value with a similar name: `"y"` + | ^^^^^^^^^^^^^^^^^ | = note: expected values for `CONFIG_NVME` are: `y` = help: consider using a Cargo feature instead @@ -48,6 +50,10 @@ LL | #[cfg(CONFIG_NVME = "m")] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(CONFIG_NVME, values("m"))'] } = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of the `build.rs` = note: see for more information about checking conditional configuration +help: there is a expected value with a similar name + | +LL | #[cfg(CONFIG_NVME = "y")] + | ~~~ warning: 4 warnings emitted diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr index a5f8176343a4c..edd268fff119e 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr @@ -2,12 +2,16 @@ warning: unexpected `cfg` condition name: `linux` --> $DIR/cfg-value-for-cfg-name.rs:9:7 | LL | #[cfg(linux)] - | ^^^^^ help: found config with similar value: `target_os = "linux"` + | ^^^^^ | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(linux)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: found config with similar value + | +LL | #[cfg(target_os = "linux")] + | ~~~~~~~~~~~~~~~~~~~ warning: unexpected `cfg` condition name: `linux` --> $DIR/cfg-value-for-cfg-name.rs:14:7 diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr index a440ccaaf584a..2582a1d5e55dd 100644 --- a/tests/ui/check-cfg/diagnotics.cargo.stderr +++ b/tests/ui/check-cfg/diagnotics.cargo.stderr @@ -2,11 +2,15 @@ warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:9:7 | LL | #[cfg(featur)] - | ^^^^^^ help: there is a config with a similar name: `feature` + | ^^^^^^ | = help: expected values for `feature` are: `foo` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: there is a config with a similar name + | +LL | #[cfg(feature)] + | ~~~~~~~ warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:13:7 @@ -37,7 +41,7 @@ warning: unexpected `cfg` condition name: `no_value` --> $DIR/diagnotics.rs:24:7 | LL | #[cfg(no_value)] - | ^^^^^^^^ help: there is a config with a similar name: `no_values` + | ^^^^^^^^ | = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: @@ -45,6 +49,10 @@ LL | #[cfg(no_value)] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(no_value)'] } = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(no_value)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration +help: there is a config with a similar name + | +LL | #[cfg(no_values)] + | ~~~~~~~~~ warning: unexpected `cfg` condition name: `no_value` --> $DIR/diagnotics.rs:28:7 @@ -67,9 +75,7 @@ warning: unexpected `cfg` condition value: `bar` --> $DIR/diagnotics.rs:32:7 | LL | #[cfg(no_values = "bar")] - | ^^^^^^^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^ | = note: no expected value for `no_values` = help: consider using a Cargo feature instead @@ -78,14 +84,17 @@ LL | #[cfg(no_values = "bar")] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(no_values, values("bar"))'] } = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(no_values, values(\"bar\"))");` to the top of the `build.rs` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(no_values = "bar")] +LL + #[cfg(no_values)] + | warning: unexpected `cfg` condition value: `quote"` --> $DIR/diagnotics.rs:36:7 | LL | #[cfg(quote = "quote\"")] - | ^^^^^^^^--------- - | | - | help: there is a expected value with a similar name: `"quote"` + | ^^^^^^^^^^^^^^^^^ | = note: expected values for `quote` are: `quote` = help: consider using a Cargo feature instead @@ -94,6 +103,10 @@ LL | #[cfg(quote = "quote\"")] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(quote, values("quote\""))'] } = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(quote, values(\"quote\\\"\"))");` to the top of the `build.rs` = note: see for more information about checking conditional configuration +help: there is a expected value with a similar name + | +LL | #[cfg(quote = "quote")] + | ~~~~~~~ warning: 7 warnings emitted diff --git a/tests/ui/check-cfg/diagnotics.rustc.stderr b/tests/ui/check-cfg/diagnotics.rustc.stderr index 6868be482d87f..8642a526882a8 100644 --- a/tests/ui/check-cfg/diagnotics.rustc.stderr +++ b/tests/ui/check-cfg/diagnotics.rustc.stderr @@ -2,12 +2,16 @@ warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:9:7 | LL | #[cfg(featur)] - | ^^^^^^ help: there is a config with a similar name: `feature` + | ^^^^^^ | = help: expected values for `feature` are: `foo` = help: to expect this configuration use `--check-cfg=cfg(featur)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: there is a config with a similar name + | +LL | #[cfg(feature)] + | ~~~~~~~ warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:13:7 @@ -40,10 +44,14 @@ warning: unexpected `cfg` condition name: `no_value` --> $DIR/diagnotics.rs:24:7 | LL | #[cfg(no_value)] - | ^^^^^^^^ help: there is a config with a similar name: `no_values` + | ^^^^^^^^ | = help: to expect this configuration use `--check-cfg=cfg(no_value)` = note: see for more information about checking conditional configuration +help: there is a config with a similar name + | +LL | #[cfg(no_values)] + | ~~~~~~~~~ warning: unexpected `cfg` condition name: `no_value` --> $DIR/diagnotics.rs:28:7 @@ -62,25 +70,30 @@ warning: unexpected `cfg` condition value: `bar` --> $DIR/diagnotics.rs:32:7 | LL | #[cfg(no_values = "bar")] - | ^^^^^^^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^ | = note: no expected value for `no_values` = help: to expect this configuration use `--check-cfg=cfg(no_values, values("bar"))` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(no_values = "bar")] +LL + #[cfg(no_values)] + | warning: unexpected `cfg` condition value: `quote"` --> $DIR/diagnotics.rs:36:7 | LL | #[cfg(quote = "quote\"")] - | ^^^^^^^^--------- - | | - | help: there is a expected value with a similar name: `"quote"` + | ^^^^^^^^^^^^^^^^^ | = note: expected values for `quote` are: `quote` = help: to expect this configuration use `--check-cfg=cfg(quote, values("quote\""))` = note: see for more information about checking conditional configuration +help: there is a expected value with a similar name + | +LL | #[cfg(quote = "quote")] + | ~~~~~~~ warning: 7 warnings emitted diff --git a/tests/ui/check-cfg/empty-values.stderr b/tests/ui/check-cfg/empty-values.stderr index 7f57a4ba59344..4024d4b514939 100644 --- a/tests/ui/check-cfg/empty-values.stderr +++ b/tests/ui/check-cfg/empty-values.stderr @@ -2,22 +2,32 @@ warning: unexpected `cfg` condition value: `foo` --> $DIR/empty-values.rs:7:7 | LL | #[cfg(foo = "foo")] - | ^^^^^^^^^^^ help: remove the condition + | ^^^^^^^^^^^ | = note: no expected values for `foo` = help: to expect this configuration use `--check-cfg=cfg(foo, values("foo"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the condition + | +LL - #[cfg(foo = "foo")] +LL + #[cfg()] + | warning: unexpected `cfg` condition value: (none) --> $DIR/empty-values.rs:11:7 | LL | #[cfg(foo)] - | ^^^ help: remove the condition + | ^^^ | = note: no expected values for `foo` = help: to expect this configuration use `--check-cfg=cfg(foo)` = note: see for more information about checking conditional configuration +help: remove the condition + | +LL - #[cfg(foo)] +LL + #[cfg()] + | warning: 2 warnings emitted diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr index 2497864e87ec4..08884da65ce85 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr @@ -13,12 +13,15 @@ warning: unexpected `cfg` condition value: `value` --> $DIR/exhaustive-names-values.rs:14:7 | LL | #[cfg(test = "value")] - | ^^^^---------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^ | = note: no expected value for `test` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(test = "value")] +LL + #[cfg(test)] + | warning: unexpected `cfg` condition name: `feature` --> $DIR/exhaustive-names-values.rs:18:7 diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr index a7d4c6d4df66e..04f716ab02f9b 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr @@ -13,12 +13,15 @@ warning: unexpected `cfg` condition value: `value` --> $DIR/exhaustive-names-values.rs:14:7 | LL | #[cfg(test = "value")] - | ^^^^---------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^ | = note: no expected value for `test` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(test = "value")] +LL + #[cfg(test)] + | warning: unexpected `cfg` condition value: `unk` --> $DIR/exhaustive-names-values.rs:18:7 diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr index a7d4c6d4df66e..04f716ab02f9b 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr @@ -13,12 +13,15 @@ warning: unexpected `cfg` condition value: `value` --> $DIR/exhaustive-names-values.rs:14:7 | LL | #[cfg(test = "value")] - | ^^^^---------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^ | = note: no expected value for `test` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(test = "value")] +LL + #[cfg(test)] + | warning: unexpected `cfg` condition value: `unk` --> $DIR/exhaustive-names-values.rs:18:7 diff --git a/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr index a3c0f36aee8b3..77f590b86fc71 100644 --- a/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr +++ b/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr @@ -2,13 +2,16 @@ warning: unexpected `cfg` condition value: `value` --> $DIR/exhaustive-values.rs:9:7 | LL | #[cfg(test = "value")] - | ^^^^---------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^ | = note: no expected value for `test` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the value + | +LL - #[cfg(test = "value")] +LL + #[cfg(test)] + | warning: 1 warning emitted diff --git a/tests/ui/check-cfg/exhaustive-values.without_names.stderr b/tests/ui/check-cfg/exhaustive-values.without_names.stderr index a3c0f36aee8b3..77f590b86fc71 100644 --- a/tests/ui/check-cfg/exhaustive-values.without_names.stderr +++ b/tests/ui/check-cfg/exhaustive-values.without_names.stderr @@ -2,13 +2,16 @@ warning: unexpected `cfg` condition value: `value` --> $DIR/exhaustive-values.rs:9:7 | LL | #[cfg(test = "value")] - | ^^^^---------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^ | = note: no expected value for `test` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the value + | +LL - #[cfg(test = "value")] +LL + #[cfg(test)] + | warning: 1 warning emitted diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index cc63466585a6a..374dc6be2e924 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -2,21 +2,29 @@ warning: unexpected `cfg` condition name: `widnows` --> $DIR/mix.rs:13:7 | LL | #[cfg(widnows)] - | ^^^^^^^ help: there is a config with a similar name: `windows` + | ^^^^^^^ | = help: to expect this configuration use `--check-cfg=cfg(widnows)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: there is a config with a similar name + | +LL | #[cfg(windows)] + | ~~~~~~~ warning: unexpected `cfg` condition value: (none) --> $DIR/mix.rs:17:7 | LL | #[cfg(feature)] - | ^^^^^^^- help: specify a config value: `= "foo"` + | ^^^^^^^ | = note: expected values for `feature` are: `foo` = help: to expect this configuration use `--check-cfg=cfg(feature)` = note: see for more information about checking conditional configuration +help: specify a config value + | +LL | #[cfg(feature = "foo")] + | +++++++ warning: unexpected `cfg` condition value: `bar` --> $DIR/mix.rs:24:7 @@ -52,10 +60,14 @@ warning: unexpected `cfg` condition name: `widnows` --> $DIR/mix.rs:41:10 | LL | cfg!(widnows); - | ^^^^^^^ help: there is a config with a similar name: `windows` + | ^^^^^^^ | = help: to expect this configuration use `--check-cfg=cfg(widnows)` = note: see for more information about checking conditional configuration +help: there is a config with a similar name + | +LL | cfg!(windows); + | ~~~~~~~ warning: unexpected `cfg` condition value: `bar` --> $DIR/mix.rs:44:10 diff --git a/tests/ui/check-cfg/no-expected-values.empty.stderr b/tests/ui/check-cfg/no-expected-values.empty.stderr index 9c7d970f35e53..bfdfa7a5abce6 100644 --- a/tests/ui/check-cfg/no-expected-values.empty.stderr +++ b/tests/ui/check-cfg/no-expected-values.empty.stderr @@ -2,25 +2,31 @@ warning: unexpected `cfg` condition value: `foo` --> $DIR/no-expected-values.rs:11:7 | LL | #[cfg(feature = "foo")] - | ^^^^^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^ | = note: no expected value for `feature` = help: to expect this configuration use `--check-cfg=cfg(feature, values("foo"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the value + | +LL - #[cfg(feature = "foo")] +LL + #[cfg(feature)] + | warning: unexpected `cfg` condition value: `foo` --> $DIR/no-expected-values.rs:15:7 | LL | #[cfg(test = "foo")] - | ^^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^^ | = note: no expected value for `test` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(test = "foo")] +LL + #[cfg(test)] + | warning: 2 warnings emitted diff --git a/tests/ui/check-cfg/no-expected-values.mixed.stderr b/tests/ui/check-cfg/no-expected-values.mixed.stderr index 9c7d970f35e53..bfdfa7a5abce6 100644 --- a/tests/ui/check-cfg/no-expected-values.mixed.stderr +++ b/tests/ui/check-cfg/no-expected-values.mixed.stderr @@ -2,25 +2,31 @@ warning: unexpected `cfg` condition value: `foo` --> $DIR/no-expected-values.rs:11:7 | LL | #[cfg(feature = "foo")] - | ^^^^^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^ | = note: no expected value for `feature` = help: to expect this configuration use `--check-cfg=cfg(feature, values("foo"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the value + | +LL - #[cfg(feature = "foo")] +LL + #[cfg(feature)] + | warning: unexpected `cfg` condition value: `foo` --> $DIR/no-expected-values.rs:15:7 | LL | #[cfg(test = "foo")] - | ^^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^^ | = note: no expected value for `test` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(test = "foo")] +LL + #[cfg(test)] + | warning: 2 warnings emitted diff --git a/tests/ui/check-cfg/no-expected-values.simple.stderr b/tests/ui/check-cfg/no-expected-values.simple.stderr index 9c7d970f35e53..bfdfa7a5abce6 100644 --- a/tests/ui/check-cfg/no-expected-values.simple.stderr +++ b/tests/ui/check-cfg/no-expected-values.simple.stderr @@ -2,25 +2,31 @@ warning: unexpected `cfg` condition value: `foo` --> $DIR/no-expected-values.rs:11:7 | LL | #[cfg(feature = "foo")] - | ^^^^^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^ | = note: no expected value for `feature` = help: to expect this configuration use `--check-cfg=cfg(feature, values("foo"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the value + | +LL - #[cfg(feature = "foo")] +LL + #[cfg(feature)] + | warning: unexpected `cfg` condition value: `foo` --> $DIR/no-expected-values.rs:15:7 | LL | #[cfg(test = "foo")] - | ^^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^^ | = note: no expected value for `test` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(test = "foo")] +LL + #[cfg(test)] + | warning: 2 warnings emitted diff --git a/tests/ui/check-cfg/unexpected-cfg-name.stderr b/tests/ui/check-cfg/unexpected-cfg-name.stderr index c652c8e27bc69..ab379da7dafaf 100644 --- a/tests/ui/check-cfg/unexpected-cfg-name.stderr +++ b/tests/ui/check-cfg/unexpected-cfg-name.stderr @@ -2,11 +2,15 @@ warning: unexpected `cfg` condition name: `widnows` --> $DIR/unexpected-cfg-name.rs:7:7 | LL | #[cfg(widnows)] - | ^^^^^^^ help: there is a config with a similar name: `windows` + | ^^^^^^^ | = help: to expect this configuration use `--check-cfg=cfg(widnows)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: there is a config with a similar name + | +LL | #[cfg(windows)] + | ~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/check-cfg/unexpected-cfg-value.stderr b/tests/ui/check-cfg/unexpected-cfg-value.stderr index 0fa0dde41b6df..e9caec37e64f6 100644 --- a/tests/ui/check-cfg/unexpected-cfg-value.stderr +++ b/tests/ui/check-cfg/unexpected-cfg-value.stderr @@ -2,14 +2,16 @@ warning: unexpected `cfg` condition value: `sedre` --> $DIR/unexpected-cfg-value.rs:8:7 | LL | #[cfg(feature = "sedre")] - | ^^^^^^^^^^------- - | | - | help: there is a expected value with a similar name: `"serde"` + | ^^^^^^^^^^^^^^^^^ | = note: expected values for `feature` are: `full` and `serde` = help: to expect this configuration use `--check-cfg=cfg(feature, values("sedre"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: there is a expected value with a similar name + | +LL | #[cfg(feature = "serde")] + | ~~~~~~~ warning: unexpected `cfg` condition value: `rand` --> $DIR/unexpected-cfg-value.rs:15:7 diff --git a/tests/ui/check-cfg/values-none.explicit.stderr b/tests/ui/check-cfg/values-none.explicit.stderr index 000eabdb22ede..cadc0d9be5016 100644 --- a/tests/ui/check-cfg/values-none.explicit.stderr +++ b/tests/ui/check-cfg/values-none.explicit.stderr @@ -2,26 +2,32 @@ warning: unexpected `cfg` condition value: `too` --> $DIR/values-none.rs:11:7 | LL | #[cfg(foo = "too")] - | ^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^ | = note: no expected value for `foo` = help: to expect this configuration use `--check-cfg=cfg(foo, values("too"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the value + | +LL - #[cfg(foo = "too")] +LL + #[cfg(foo)] + | warning: unexpected `cfg` condition value: `bar` --> $DIR/values-none.rs:16:7 | LL | #[cfg(foo = "bar")] - | ^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^ | = note: no expected value for `foo` = help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(foo = "bar")] +LL + #[cfg(foo)] + | warning: 2 warnings emitted diff --git a/tests/ui/check-cfg/values-none.implicit.stderr b/tests/ui/check-cfg/values-none.implicit.stderr index 000eabdb22ede..cadc0d9be5016 100644 --- a/tests/ui/check-cfg/values-none.implicit.stderr +++ b/tests/ui/check-cfg/values-none.implicit.stderr @@ -2,26 +2,32 @@ warning: unexpected `cfg` condition value: `too` --> $DIR/values-none.rs:11:7 | LL | #[cfg(foo = "too")] - | ^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^ | = note: no expected value for `foo` = help: to expect this configuration use `--check-cfg=cfg(foo, values("too"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the value + | +LL - #[cfg(foo = "too")] +LL + #[cfg(foo)] + | warning: unexpected `cfg` condition value: `bar` --> $DIR/values-none.rs:16:7 | LL | #[cfg(foo = "bar")] - | ^^^-------- - | | - | help: remove the value + | ^^^^^^^^^^^ | = note: no expected value for `foo` = help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - #[cfg(foo = "bar")] +LL + #[cfg(foo)] + | warning: 2 warnings emitted diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr index 41130210df1ec..4f38b492f9e88 100644 --- a/tests/ui/check-cfg/well-known-names.stderr +++ b/tests/ui/check-cfg/well-known-names.stderr @@ -35,10 +35,14 @@ warning: unexpected `cfg` condition name: `uniw` --> $DIR/well-known-names.rs:22:7 | LL | #[cfg(uniw)] - | ^^^^ help: there is a config with a similar name: `unix` + | ^^^^ | = help: to expect this configuration use `--check-cfg=cfg(uniw)` = note: see for more information about checking conditional configuration +help: there is a config with a similar name + | +LL | #[cfg(unix)] + | ~~~~ warning: 4 warnings emitted diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index 8a99ace75d852..18cf3a3e08f18 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -2,68 +2,86 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:28:5 | LL | clippy = "_UNEXPECTED_VALUE", - | ^^^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `clippy` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default +help: remove the value + | +LL - clippy = "_UNEXPECTED_VALUE", +LL + clippy, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:30:5 | LL | debug_assertions = "_UNEXPECTED_VALUE", - | ^^^^^^^^^^^^^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `debug_assertions` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - debug_assertions = "_UNEXPECTED_VALUE", +LL + debug_assertions, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:32:5 | LL | doc = "_UNEXPECTED_VALUE", - | ^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `doc` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - doc = "_UNEXPECTED_VALUE", +LL + doc, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:34:5 | LL | doctest = "_UNEXPECTED_VALUE", - | ^^^^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `doctest` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - doctest = "_UNEXPECTED_VALUE", +LL + doctest, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:36:5 | LL | miri = "_UNEXPECTED_VALUE", - | ^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `miri` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - miri = "_UNEXPECTED_VALUE", +LL + miri, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:38:5 | LL | overflow_checks = "_UNEXPECTED_VALUE", - | ^^^^^^^^^^^^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `overflow_checks` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - overflow_checks = "_UNEXPECTED_VALUE", +LL + overflow_checks, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:40:5 @@ -78,12 +96,15 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:42:5 | LL | proc_macro = "_UNEXPECTED_VALUE", - | ^^^^^^^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `proc_macro` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - proc_macro = "_UNEXPECTED_VALUE", +LL + proc_macro, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:44:5 @@ -98,12 +119,15 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:46:5 | LL | rustfmt = "_UNEXPECTED_VALUE", - | ^^^^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `rustfmt` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - rustfmt = "_UNEXPECTED_VALUE", +LL + rustfmt, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:48:5 @@ -217,12 +241,15 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:72:5 | LL | target_thread_local = "_UNEXPECTED_VALUE", - | ^^^^^^^^^^^^^^^^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `target_thread_local` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - target_thread_local = "_UNEXPECTED_VALUE", +LL + target_thread_local, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:74:5 @@ -237,56 +264,70 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:76:5 | LL | test = "_UNEXPECTED_VALUE", - | ^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `test` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - test = "_UNEXPECTED_VALUE", +LL + test, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:78:5 | LL | ub_checks = "_UNEXPECTED_VALUE", - | ^^^^^^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `ub_checks` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - ub_checks = "_UNEXPECTED_VALUE", +LL + ub_checks, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:80:5 | LL | unix = "_UNEXPECTED_VALUE", - | ^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `unix` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - unix = "_UNEXPECTED_VALUE", +LL + unix, + | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:82:5 | LL | windows = "_UNEXPECTED_VALUE", - | ^^^^^^^---------------------- - | | - | help: remove the value + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: no expected value for `windows` = note: see for more information about checking conditional configuration +help: remove the value + | +LL - windows = "_UNEXPECTED_VALUE", +LL + windows, + | warning: unexpected `cfg` condition value: `linuz` --> $DIR/well-known-values.rs:88:7 | LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` - | ^^^^^^^^^^^^------- - | | - | help: there is a expected value with a similar name: `"linux"` + | ^^^^^^^^^^^^^^^^^^^ | = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see for more information about checking conditional configuration +help: there is a expected value with a similar name + | +LL | #[cfg(target_os = "linux")] // testing that we suggest `linux` + | ~~~~~~~ warning: 29 warnings emitted diff --git a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr index ca8c2a16d323f..b8a2ff81030c7 100644 --- a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr +++ b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr @@ -102,11 +102,14 @@ LL | let PAT = v1; | | | pattern `1_u32..=u32::MAX` not covered | missing patterns are not covered because `PAT` is interpreted as a constant pattern, not a new variable - | help: introduce a variable instead: `PAT_var` | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `u32` +help: introduce a variable instead + | +LL | let PAT_var = v1; + | ~~~~~~~ error: aborting due to 7 previous errors diff --git a/tests/ui/closures/2229_closure_analysis/migrations/old_name.stderr b/tests/ui/closures/2229_closure_analysis/migrations/old_name.stderr index 47cb689fa0193..5d6d19e507a66 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/old_name.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/old_name.stderr @@ -2,9 +2,13 @@ warning: lint `disjoint_capture_migration` has been renamed to `rust_2021_incomp --> $DIR/old_name.rs:6:10 | LL | #![allow(disjoint_capture_migration)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rust_2021_incompatible_closure_captures` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(renamed_and_removed_lints)]` on by default +help: use the new name + | +LL | #![allow(rust_2021_incompatible_closure_captures)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr b/tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr index cf8bd7a0a2765..ed1b87307110d 100644 --- a/tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr +++ b/tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr @@ -2,7 +2,7 @@ warning: unused variable: `g2` --> $DIR/destructure-pattern-closure-within-closure.rs:10:17 | LL | let (_, g2) = g; - | ^^ help: if this is intentional, prefix it with an underscore: `_g2` + | ^^ | note: the lint level is defined here --> $DIR/destructure-pattern-closure-within-closure.rs:3:9 @@ -10,12 +10,21 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let (_, _g2) = g; + | ~~~ warning: unused variable: `t2` --> $DIR/destructure-pattern-closure-within-closure.rs:13:21 | LL | let (_, t2) = t; - | ^^ help: if this is intentional, prefix it with an underscore: `_t2` + | ^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let (_, _t2) = t; + | ~~~ warning: 2 warnings emitted diff --git a/tests/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.stderr b/tests/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.stderr index 7706f68ba5b44..419f64d5c0e28 100644 --- a/tests/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.stderr +++ b/tests/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.stderr @@ -2,7 +2,7 @@ warning: unused variable: `t1` --> $DIR/destructure_patterns.rs:14:14 | LL | let (t1, t2) = t; - | ^^ help: if this is intentional, prefix it with an underscore: `_t1` + | ^^ | note: the lint level is defined here --> $DIR/destructure_patterns.rs:3:9 @@ -10,30 +10,54 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let (_t1, t2) = t; + | ~~~ warning: unused variable: `t2` --> $DIR/destructure_patterns.rs:14:18 | LL | let (t1, t2) = t; - | ^^ help: if this is intentional, prefix it with an underscore: `_t2` + | ^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let (t1, _t2) = t; + | ~~~ warning: unused variable: `t1` --> $DIR/destructure_patterns.rs:26:14 | LL | let (t1, _) = t; - | ^^ help: if this is intentional, prefix it with an underscore: `_t1` + | ^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let (_t1, _) = t; + | ~~~ warning: unused variable: `t2` --> $DIR/destructure_patterns.rs:37:17 | LL | let (_, t2) = t; - | ^^ help: if this is intentional, prefix it with an underscore: `_t2` + | ^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let (_, _t2) = t; + | ~~~ warning: unused variable: `x` --> $DIR/destructure_patterns.rs:88:21 | LL | let Point { x, y } = p; - | ^ help: try ignoring the field: `x: _` + | ^ + | +help: try ignoring the field + | +LL | let Point { x: _, y } = p; + | ~~~~ warning: 5 warnings emitted diff --git a/tests/ui/closures/issue-90871.stderr b/tests/ui/closures/issue-90871.stderr index ef1cb213f73be..a58688a1f8051 100644 --- a/tests/ui/closures/issue-90871.stderr +++ b/tests/ui/closures/issue-90871.stderr @@ -2,10 +2,15 @@ error[E0412]: cannot find type `n` in this scope --> $DIR/issue-90871.rs:4:22 | LL | type_ascribe!(2, n([u8; || 1])) - | ^ help: a trait with a similar name exists: `Fn` + | ^ --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here + | +help: a trait with a similar name exists + | +LL | type_ascribe!(2, Fn([u8; || 1])) + | ~~ error[E0308]: mismatched types --> $DIR/issue-90871.rs:4:29 diff --git a/tests/ui/closures/old-closure-expr-precedence.stderr b/tests/ui/closures/old-closure-expr-precedence.stderr index fabece1ad4a11..3c677e784d35e 100644 --- a/tests/ui/closures/old-closure-expr-precedence.stderr +++ b/tests/ui/closures/old-closure-expr-precedence.stderr @@ -2,9 +2,14 @@ warning: unnecessary trailing semicolons --> $DIR/old-closure-expr-precedence.rs:60:21 | LL | if (true) { 12; };;; -num; - | ^^ help: remove these semicolons + | ^^ | = note: `#[warn(redundant_semicolons)]` on by default +help: remove these semicolons + | +LL - if (true) { 12; };;; -num; +LL + if (true) { 12; }; -num; + | warning: 1 warning emitted diff --git a/tests/ui/closures/old-closure-expression-remove-semicolon.stderr b/tests/ui/closures/old-closure-expression-remove-semicolon.stderr index c6ce1c62d93ec..c908ef0d11f80 100644 --- a/tests/ui/closures/old-closure-expression-remove-semicolon.stderr +++ b/tests/ui/closures/old-closure-expression-remove-semicolon.stderr @@ -5,9 +5,14 @@ LL | let _x: i32 = { | ___________________^ LL | | LL | | foo(); - | | - help: remove this semicolon to return this value LL | | }; | |_____^ expected `i32`, found `()` + | +help: remove this semicolon to return this value + | +LL - foo(); +LL + foo() + | error: aborting due to 1 previous error diff --git a/tests/ui/codemap_tests/tab.stderr b/tests/ui/codemap_tests/tab.stderr index d2de7486557f7..bc36468e52b91 100644 --- a/tests/ui/codemap_tests/tab.stderr +++ b/tests/ui/codemap_tests/tab.stderr @@ -7,10 +7,13 @@ LL | bar; error[E0308]: mismatched types --> $DIR/tab.rs:8:2 | -LL | fn foo() { - | - help: try adding a return type: `-> &'static str` LL | "bar boo" | ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&str` + | +help: try adding a return type + | +LL | fn foo() -> &'static str { + | +++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/codemap_tests/unicode_3.stderr b/tests/ui/codemap_tests/unicode_3.stderr index a35ed99d8a3dd..6ea7ab88e1bd5 100644 --- a/tests/ui/codemap_tests/unicode_3.stderr +++ b/tests/ui/codemap_tests/unicode_3.stderr @@ -2,9 +2,13 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/unicode_3.rs:4:45 | LL | let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; loop { break; } + | ~~~~ warning: 1 warning emitted diff --git a/tests/ui/coercion/coerce-loop-issue-122561.stderr b/tests/ui/coercion/coerce-loop-issue-122561.stderr index 0f77fd1364d6b..d2259889104b7 100644 --- a/tests/ui/coercion/coerce-loop-issue-122561.stderr +++ b/tests/ui/coercion/coerce-loop-issue-122561.stderr @@ -2,15 +2,24 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/coerce-loop-issue-122561.rs:48:5 | LL | while true { - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | loop { + | ~~~~ warning: denote infinite loops with `loop { ... }` --> $DIR/coerce-loop-issue-122561.rs:72:5 | LL | while true { - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ + | +help: use `loop` + | +LL | loop { + | ~~~~ error[E0658]: `for` is not allowed in a `const` --> $DIR/coerce-loop-issue-122561.rs:41:24 diff --git a/tests/ui/coercion/coercion-missing-tail-expected-type.stderr b/tests/ui/coercion/coercion-missing-tail-expected-type.stderr index 288e945f1f8d5..72253a517f2d0 100644 --- a/tests/ui/coercion/coercion-missing-tail-expected-type.stderr +++ b/tests/ui/coercion/coercion-missing-tail-expected-type.stderr @@ -5,8 +5,12 @@ LL | fn plus_one(x: i32) -> i32 { | -------- ^^^ expected `i32`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -LL | x + 1; - | - help: remove this semicolon to return this value + | +help: remove this semicolon to return this value + | +LL - x + 1; +LL + x + 1 + | error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:8:13 @@ -15,11 +19,14 @@ LL | fn foo() -> Result { | --- ^^^^^^^^^^^^^^^ expected `Result`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -LL | Ok(1); - | - help: remove this semicolon to return this value | = note: expected enum `Result` found unit type `()` +help: remove this semicolon to return this value + | +LL - Ok(1); +LL + Ok(1) + | error: aborting due to 2 previous errors diff --git a/tests/ui/coercion/issue-73886.stderr b/tests/ui/coercion/issue-73886.stderr index a6f8ba65ab51a..4f6a9e92b16c4 100644 --- a/tests/ui/coercion/issue-73886.stderr +++ b/tests/ui/coercion/issue-73886.stderr @@ -8,9 +8,13 @@ error[E0605]: non-primitive cast: `u32` as `Option<_>` --> $DIR/issue-73886.rs:4:13 | LL | let _ = 7u32 as Option<_>; - | ^^^^^^^^^^^^^^^^^ help: consider using the `From` trait instead: `Option<_>::from(7u32)` + | ^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object +help: consider using the `From` trait instead + | +LL | let _ = Option<_>::from(7u32); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr index a87b713c2b4bd..29ebbc5dffb11 100644 --- a/tests/ui/compare-method/bad-self-type.stderr +++ b/tests/ui/compare-method/bad-self-type.stderr @@ -2,22 +2,20 @@ error[E0053]: method `poll` has an incompatible type for trait --> $DIR/bad-self-type.rs:10:13 | LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { - | ^^^^ - | | - | expected `Pin<&mut MyFuture>`, found `MyFuture` - | help: change the self-receiver type to match the trait: `self: Pin<&mut MyFuture>` + | ^^^^ expected `Pin<&mut MyFuture>`, found `MyFuture` | = note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>` found signature `fn(MyFuture, &mut Context<'_>) -> Poll<_>` +help: change the self-receiver type to match the trait + | +LL | fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/bad-self-type.rs:22:18 | LL | fn foo(self: Box) {} - | ------^^^^^^^^^ - | | | - | | expected `MyFuture`, found `Box` - | help: change the self-receiver type to match the trait: `self` + | ^^^^^^^^^ expected `MyFuture`, found `Box` | note: type in trait --> $DIR/bad-self-type.rs:17:12 @@ -26,6 +24,10 @@ LL | fn foo(self); | ^^^^ = note: expected signature `fn(MyFuture)` found signature `fn(Box)` +help: change the self-receiver type to match the trait + | +LL | fn foo(self) {} + | ~~~~ error[E0053]: method `bar` has an incompatible type for trait --> $DIR/bad-self-type.rs:24:17 diff --git a/tests/ui/compare-method/issue-90444.stderr b/tests/ui/compare-method/issue-90444.stderr index 52e23d03b148b..f05c9939c0096 100644 --- a/tests/ui/compare-method/issue-90444.stderr +++ b/tests/ui/compare-method/issue-90444.stderr @@ -2,25 +2,27 @@ error[E0053]: method `from` has an incompatible type for trait --> $DIR/issue-90444.rs:3:16 | LL | fn from(_: fn((), (), &mut ())) -> Self { - | ^^^^^^^^^^^^^^^^^^^ - | | - | types differ in mutability - | help: change the parameter type to match the trait: `for<'a> fn((), (), &'a ())` + | ^^^^^^^^^^^^^^^^^^^ types differ in mutability | = note: expected signature `fn(for<'a> fn((), (), &'a ())) -> A` found signature `fn(for<'a> fn((), (), &'a mut ())) -> A` +help: change the parameter type to match the trait + | +LL | fn from(_: for<'a> fn((), (), &'a ())) -> Self { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0053]: method `from` has an incompatible type for trait --> $DIR/issue-90444.rs:11:16 | LL | fn from(_: fn((), (), u64)) -> Self { - | ^^^^^^^^^^^^^^^ - | | - | expected `u32`, found `u64` - | help: change the parameter type to match the trait: `fn((), (), u32)` + | ^^^^^^^^^^^^^^^ expected `u32`, found `u64` | = note: expected signature `fn(fn((), (), u32)) -> B` found signature `fn(fn((), (), u64)) -> B` +help: change the parameter type to match the trait + | +LL | fn from(_: fn((), (), u32)) -> Self { + | ~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/compare-method/reordered-type-param.stderr b/tests/ui/compare-method/reordered-type-param.stderr index 8a439acee13de..1e8266e213d7f 100644 --- a/tests/ui/compare-method/reordered-type-param.stderr +++ b/tests/ui/compare-method/reordered-type-param.stderr @@ -2,10 +2,8 @@ error[E0053]: method `b` has an incompatible type for trait --> $DIR/reordered-type-param.rs:16:30 | LL | fn b(&self, _x: G) -> G { panic!() } - | - - ^ - | | | | - | | | expected type parameter `F`, found type parameter `G` - | | | help: change the parameter type to match the trait: `F` + | - - ^ expected type parameter `F`, found type parameter `G` + | | | | | found type parameter | expected type parameter | @@ -18,6 +16,10 @@ LL | fn b(&self, x: C) -> C; found signature `fn(&E, G) -> G` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters +help: change the parameter type to match the trait + | +LL | fn b(&self, _x: F) -> G { panic!() } + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/compiletest-self-test/run-rustfix-revisions.foo.stderr b/tests/ui/compiletest-self-test/run-rustfix-revisions.foo.stderr index 74384ef24af18..1e704a9c450a3 100644 --- a/tests/ui/compiletest-self-test/run-rustfix-revisions.foo.stderr +++ b/tests/ui/compiletest-self-test/run-rustfix-revisions.foo.stderr @@ -2,13 +2,17 @@ error: unused variable: `x` --> $DIR/run-rustfix-revisions.rs:7:9 | LL | let x = 0usize; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/run-rustfix-revisions.rs:4:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 0usize; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/compiletest-self-test/ui-testing-optout.stderr b/tests/ui/compiletest-self-test/ui-testing-optout.stderr index 652c472c0bcfe..693fd16b72574 100644 --- a/tests/ui/compiletest-self-test/ui-testing-optout.stderr +++ b/tests/ui/compiletest-self-test/ui-testing-optout.stderr @@ -11,7 +11,12 @@ error[E0412]: cannot find type `D` in this scope | ----------- similarly named type alias `A` defined here ... 7 | type C = D; - | ^ help: a type alias with a similar name exists: `A` + | ^ + | +help: a type alias with a similar name exists + | +7 | type C = A; + | ~ error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:92:10 @@ -20,7 +25,12 @@ error[E0412]: cannot find type `F` in this scope | ----------- similarly named type alias `A` defined here ... 92 | type E = F; - | ^ help: a type alias with a similar name exists: `A` + | ^ + | +help: a type alias with a similar name exists + | +92 | type E = A; + | ~ error: aborting due to 3 previous errors diff --git a/tests/ui/conditional-compilation/cfg-attr-parse.stderr b/tests/ui/conditional-compilation/cfg-attr-parse.stderr index 8084a62204560..759df3c90c6f3 100644 --- a/tests/ui/conditional-compilation/cfg-attr-parse.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-parse.stderr @@ -2,9 +2,13 @@ error: malformed `cfg_attr` attribute input --> $DIR/cfg-attr-parse.rs:4:1 | LL | #[cfg_attr()] - | ^^^^^^^^^^^^^ help: missing condition and attribute: `#[cfg_attr(condition, attribute, other_attribute, ...)]` + | ^^^^^^^^^^^^^ | = note: for more information, visit +help: missing condition and attribute + | +LL | #[cfg_attr(condition, attribute, other_attribute, ...)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: expected `,`, found end of `cfg_attr` input --> $DIR/cfg-attr-parse.rs:8:17 diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index 3dd0823389cde..e9f37263a8e2e 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -2,19 +2,34 @@ error: `cfg` is not followed by parentheses --> $DIR/cfg-attr-syntax-validation.rs:1:1 | LL | #[cfg] - | ^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^^ + | +help: expected syntax is + | +LL | cfg(/* predicate */) + | ~~~~~~~~~~~~~~~~~~~~ error: `cfg` is not followed by parentheses --> $DIR/cfg-attr-syntax-validation.rs:4:1 | LL | #[cfg = 10] - | ^^^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^^^^^^^ + | +help: expected syntax is + | +LL | cfg(/* predicate */) + | ~~~~~~~~~~~~~~~~~~~~ error: `cfg` predicate is not specified --> $DIR/cfg-attr-syntax-validation.rs:7:1 | LL | #[cfg()] - | ^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^^^^ + | +help: expected syntax is + | +LL | cfg(/* predicate */) + | ~~~~~~~~~~~~~~~~~~~~ error: multiple `cfg` predicates are specified --> $DIR/cfg-attr-syntax-validation.rs:10:10 @@ -50,9 +65,13 @@ error[E0565]: literal in `cfg` predicate value must be a string --> $DIR/cfg-attr-syntax-validation.rs:25:11 | LL | #[cfg(a = b"hi")] - | -^^^^ - | | - | help: consider removing the prefix + | ^^^^^ + | +help: consider removing the prefix + | +LL - #[cfg(a = b"hi")] +LL + #[cfg(a = "hi")] + | error: expected unsuffixed literal, found `concat!("nonexistent")` --> $DIR/cfg-attr-syntax-validation.rs:30:25 diff --git a/tests/ui/conditional-compilation/cfg_accessible-input-validation.stderr b/tests/ui/conditional-compilation/cfg_accessible-input-validation.stderr index 86706c766356e..98a8063ef2dd6 100644 --- a/tests/ui/conditional-compilation/cfg_accessible-input-validation.stderr +++ b/tests/ui/conditional-compilation/cfg_accessible-input-validation.stderr @@ -2,13 +2,23 @@ error: malformed `cfg_accessible` attribute input --> $DIR/cfg_accessible-input-validation.rs:3:1 | LL | #[cfg_accessible] - | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[cfg_accessible(path)]` + | ^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[cfg_accessible(path)] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `cfg_accessible` attribute input --> $DIR/cfg_accessible-input-validation.rs:6:1 | LL | #[cfg_accessible = "value"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[cfg_accessible(path)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[cfg_accessible(path)] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: `cfg_accessible` path is not specified --> $DIR/cfg_accessible-input-validation.rs:9:1 diff --git a/tests/ui/confuse-field-and-method/issue-2392.stderr b/tests/ui/confuse-field-and-method/issue-2392.stderr index 440fbb27c0040..64e3521b46e07 100644 --- a/tests/ui/confuse-field-and-method/issue-2392.stderr +++ b/tests/ui/confuse-field-and-method/issue-2392.stderr @@ -19,9 +19,13 @@ LL | struct Obj where F: FnOnce() -> u32 { | ------------- method `not_closure` not found for this struct ... LL | o_closure.not_closure(); - | ^^^^^^^^^^^-- help: remove the arguments - | | - | field, not a method + | ^^^^^^^^^^^ field, not a method + | +help: remove the arguments + | +LL - o_closure.not_closure(); +LL + o_closure.not_closure; + | error[E0599]: no method named `closure` found for struct `Obj` in the current scope --> $DIR/issue-2392.rs:42:12 @@ -86,9 +90,13 @@ LL | struct Obj where F: FnOnce() -> u32 { | ------------- method `not_closure` not found for this struct ... LL | w.wrap.not_closure(); - | ^^^^^^^^^^^-- help: remove the arguments - | | - | field, not a method + | ^^^^^^^^^^^ field, not a method + | +help: remove the arguments + | +LL - w.wrap.not_closure(); +LL + w.wrap.not_closure; + | error[E0599]: no method named `closure` found for struct `Obj` in the current scope --> $DIR/issue-2392.rs:58:24 diff --git a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr index a8fc742e89f54..91a1053bb6d15 100644 --- a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr +++ b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr @@ -2,9 +2,13 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments we --> $DIR/transmutable-ice-110969.rs:11:14 | LL | Dst: BikeshedIntrinsicFrom, - | ^^^^^^^^^^^^^^^^^^^^^ ------ help: remove this generic argument - | | - | expected at most 2 generic arguments + | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments + | +help: remove this generic argument + | +LL - Dst: BikeshedIntrinsicFrom, +LL + Dst: BikeshedIntrinsicFrom, + | error[E0308]: mismatched types --> $DIR/transmutable-ice-110969.rs:25:74 diff --git a/tests/ui/const-generics/argument_order.stderr b/tests/ui/const-generics/argument_order.stderr index 99122c6f5e362..99306cb444ebb 100644 --- a/tests/ui/const-generics/argument_order.stderr +++ b/tests/ui/const-generics/argument_order.stderr @@ -2,7 +2,12 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/argument_order.rs:6:32 | LL | struct AlsoBad { - | -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, const N: usize, T, const M: usize, U>` + | ^^ ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct AlsoBad<'a, 'b, const N: usize, T, const M: usize, U> { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0747]: lifetime provided when a type was expected --> $DIR/argument_order.rs:13:23 diff --git a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr index 13f081940f39e..a5f7fb7590029 100644 --- a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr +++ b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr @@ -2,19 +2,23 @@ error[E0573]: expected type, found variant `Mode::Cool` --> $DIR/assoc_const_eq_diagnostic.rs:11:35 | LL | pub trait CoolStuff: Parse {} - | ^^^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `Mode` + | ^^^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | pub trait CoolStuff: Parse {} + | ~~~~ error[E0573]: expected type, found variant `Mode::Cool` --> $DIR/assoc_const_eq_diagnostic.rs:17:17 | LL | fn no_help() -> Mode::Cool {} - | ^^^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `Mode` + | ^^^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | fn no_help() -> Mode {} + | ~~~~ error: expected constant, found type --> $DIR/assoc_const_eq_diagnostic.rs:11:35 diff --git a/tests/ui/const-generics/const-param-before-other-params.stderr b/tests/ui/const-generics/const-param-before-other-params.stderr index 8f8c87afe8514..21da6c837cc4b 100644 --- a/tests/ui/const-generics/const-param-before-other-params.stderr +++ b/tests/ui/const-generics/const-param-before-other-params.stderr @@ -2,7 +2,12 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/const-param-before-other-params.rs:1:21 | LL | fn bar(_: &'a ()) { - | --------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const X: u8>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | fn bar<'a, const X: u8>(_: &'a ()) { + | ~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/const-parameter-uppercase-lint.stderr b/tests/ui/const-generics/const-parameter-uppercase-lint.stderr index 2a5ca5d39ceae..05608efce6cfe 100644 --- a/tests/ui/const-generics/const-parameter-uppercase-lint.stderr +++ b/tests/ui/const-generics/const-parameter-uppercase-lint.stderr @@ -2,13 +2,17 @@ error: const parameter `x` should have an upper case name --> $DIR/const-parameter-uppercase-lint.rs:3:15 | LL | fn noop() { - | ^ help: convert the identifier to upper case (notice the capitalization): `X` + | ^ | note: the lint level is defined here --> $DIR/const-parameter-uppercase-lint.rs:1:9 | LL | #![deny(non_upper_case_globals)] | ^^^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper case (notice the capitalization difference) + | +LL | fn noop() { + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/defaults/intermixed-lifetime.stderr b/tests/ui/const-generics/defaults/intermixed-lifetime.stderr index 5cff61dd9fb91..4f4670ec1b081 100644 --- a/tests/ui/const-generics/defaults/intermixed-lifetime.stderr +++ b/tests/ui/const-generics/defaults/intermixed-lifetime.stderr @@ -2,13 +2,23 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/intermixed-lifetime.rs:3:28 | LL | struct Foo(&'a (), T); - | -----------------^^---------- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T = u32>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct Foo<'a, const N: usize, T = u32>(&'a (), T); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/intermixed-lifetime.rs:6:37 | LL | struct Bar(&'a (), T); - | --------------------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T = u32>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct Bar<'a, const N: usize, T = u32>(&'a (), T); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr b/tests/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr index bf2b21c012d42..4ceac1291d3f2 100644 --- a/tests/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr +++ b/tests/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr @@ -2,7 +2,12 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/param-order-err-pretty-prints-default.rs:1:33 | LL | struct Foo(&'a u32); - | ----------------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const M: usize = 10>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct Foo<'a, const M: usize = 10>(&'a u32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/early/const-param-from-outer-fn.stderr b/tests/ui/const-generics/early/const-param-from-outer-fn.stderr index faba4ce10a1b4..0f7c7fbc6be01 100644 --- a/tests/ui/const-generics/early/const-param-from-outer-fn.stderr +++ b/tests/ui/const-generics/early/const-param-from-outer-fn.stderr @@ -4,9 +4,13 @@ error[E0401]: can't use generic parameters from outer item LL | fn foo() { | - const parameter from outer item LL | fn bar() -> u32 { - | - help: try introducing a local generic parameter here: `` LL | X | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | fn bar() -> u32 { + | +++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/early/invalid-const-arguments.stderr b/tests/ui/const-generics/early/invalid-const-arguments.stderr index cee34e3b71593..2435b3ffdf9f5 100644 --- a/tests/ui/const-generics/early/invalid-const-arguments.stderr +++ b/tests/ui/const-generics/early/invalid-const-arguments.stderr @@ -49,9 +49,12 @@ error[E0747]: type provided when a constant was expected --> $DIR/invalid-const-arguments.rs:10:19 | LL | impl Foo for B {} - | - ^ - | | - | help: consider changing this type parameter to a const parameter: `const N: u8` + | ^ + | +help: consider changing this type parameter to a const parameter + | +LL | impl Foo for B {} + | ~~~~~~~~~~~ error[E0747]: unresolved item provided when a constant was expected --> $DIR/invalid-const-arguments.rs:14:32 diff --git a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr index fcac95732d12e..b74772920f625 100644 --- a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr +++ b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr @@ -2,29 +2,36 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/in-signature.rs:7:21 | LL | fn arr_fn() -> [u8; _] { - | -----^- - | | | - | | not allowed in type signatures - | help: replace with the correct return type: `[u8; 3]` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn arr_fn() -> [u8; 3] { + | ~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/in-signature.rs:12:24 | LL | fn ty_fn() -> Bar { - | ---------^- - | | | - | | not allowed in type signatures - | help: replace with the correct return type: `Bar` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn ty_fn() -> Bar { + | ~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/in-signature.rs:17:25 | LL | fn ty_fn_mixed() -> Bar<_, _> { - | ----^--^- - | | | | - | | | not allowed in type signatures - | | not allowed in type signatures - | help: replace with the correct return type: `Bar` + | ^ ^ not allowed in type signatures + | | + | not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn ty_fn_mixed() -> Bar { + | ~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/in-signature.rs:22:15 @@ -42,37 +49,45 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/in-signature.rs:26:14 | LL | const TY_CT: Bar = Bar::(0); - | ^^^^^^^^^^^ - | | - | not allowed in type signatures - | help: replace with the correct type: `Bar` + | ^^^^^^^^^^^ not allowed in type signatures + | +help: replace with the correct type + | +LL | const TY_CT: Bar = Bar::(0); + | ~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/in-signature.rs:28:19 | LL | static TY_STATIC: Bar = Bar::(0); - | ^^^^^^^^^^^ - | | - | not allowed in type signatures - | help: replace with the correct type: `Bar` + | ^^^^^^^^^^^ not allowed in type signatures + | +help: replace with the correct type + | +LL | static TY_STATIC: Bar = Bar::(0); + | ~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/in-signature.rs:30:20 | LL | const TY_CT_MIXED: Bar<_, _> = Bar::(0); - | ^^^^^^^^^ - | | - | not allowed in type signatures - | help: replace with the correct type: `Bar` + | ^^^^^^^^^ not allowed in type signatures + | +help: replace with the correct type + | +LL | const TY_CT_MIXED: Bar = Bar::(0); + | ~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/in-signature.rs:32:25 | LL | static TY_STATIC_MIXED: Bar<_, _> = Bar::(0); - | ^^^^^^^^^ - | | - | not allowed in type signatures - | help: replace with the correct type: `Bar` + | ^^^^^^^^^ not allowed in type signatures + | +help: replace with the correct type + | +LL | static TY_STATIC_MIXED: Bar = Bar::(0); + | ~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types --> $DIR/in-signature.rs:51:23 diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr index 6d8dd017734c0..f891bbea21ef3 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr @@ -23,15 +23,18 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp --> $DIR/infer-arg-test.rs:18:10 | LL | let a: All<_, _, _>; - | ^^^ - help: remove this generic argument - | | - | expected 2 generic arguments + | ^^^ expected 2 generic arguments | note: struct defined here, with 2 generic parameters: `T`, `N` --> $DIR/infer-arg-test.rs:3:8 | LL | struct All<'a, T, const N: usize> { | ^^^ - -------------- +help: remove this generic argument + | +LL - let a: All<_, _, _>; +LL + let a: All<_, _, >; + | error: aborting due to 4 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr index 0c29d94ed5b4a..78d32b57f87f3 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr @@ -2,15 +2,18 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup --> $DIR/issue_114151.rs:17:5 | LL | foo::<_, L>([(); L + 1 + L]); - | ^^^ - help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: function defined here, with 1 generic parameter: `N` --> $DIR/issue_114151.rs:4:4 | LL | fn foo( | ^^^ -------------- +help: remove this generic argument + | +LL - foo::<_, L>([(); L + 1 + L]); +LL + foo::<_, >([(); L + 1 + L]); + | error[E0308]: mismatched types --> $DIR/issue_114151.rs:17:18 diff --git a/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr b/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr index 0e40255bcf59b..59be4cf681b12 100644 --- a/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr +++ b/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr @@ -2,9 +2,14 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/error_in_ty.rs:6:31 | LL | pub struct A {} - | - ^ help: a const parameter with a similar name exists: `z` + | - ^ | | | similarly named const parameter `z` defined here + | +help: a const parameter with a similar name exists + | +LL | pub struct A {} + | ~ error: `[usize; x]` is forbidden as the type of a const generic parameter --> $DIR/error_in_ty.rs:6:23 diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr index a470c36134cf4..6bd6eb4e00e6c 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -18,15 +18,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/issue-102768.rs:5:10 | LL | type Y<'a>; | ^ +help: remove these generics + | +LL - fn f2<'a>(arg: Box = &'a ()>>) {} +LL + fn f2<'a>(arg: Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/issue-102768.rs:9:30 @@ -49,9 +52,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/issue-102768.rs:5:10 @@ -59,6 +60,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f2<'a>(arg: Box = &'a ()>>) {} +LL + fn f2<'a>(arg: Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/issue-102768.rs:9:30 @@ -81,9 +87,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/issue-102768.rs:5:10 @@ -91,6 +95,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f2<'a>(arg: Box = &'a ()>>) {} +LL + fn f2<'a>(arg: Box>) {} + | error[E0038]: the trait `X` cannot be made into an object --> $DIR/issue-102768.rs:9:24 diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr index 39f022fbee9db..dd43945d015f4 100644 --- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr @@ -2,10 +2,12 @@ error[E0432]: unresolved import `v20::v13` --> $DIR/unevaluated-const-ice-119731.rs:37:15 | LL | pub use v20::{v13, v17}; - | ^^^ - | | - | no `v13` in `v20` - | help: a similar name exists in the module: `v11` + | ^^^ no `v13` in `v20` + | +help: a similar name exists in the module + | +LL | pub use v20::{v11, v17}; + | ~~~ error[E0425]: cannot find value `v8` in this scope --> $DIR/unevaluated-const-ice-119731.rs:13:38 @@ -20,7 +22,12 @@ LL | pub type v11 = [[usize; v4]; v4]; | --------------------------------- similarly named type alias `v11` defined here ... LL | pub const fn v21() -> v18 {} - | ^^^ help: a type alias with a similar name exists: `v11` + | ^^^ + | +help: a type alias with a similar name exists + | +LL | pub const fn v21() -> v11 {} + | ~~~ error[E0412]: cannot find type `v18` in this scope --> $DIR/unevaluated-const-ice-119731.rs:30:31 @@ -29,7 +36,12 @@ LL | pub type v11 = [[usize; v4]; v4]; | --------------------------------- similarly named type alias `v11` defined here ... LL | pub const fn v21() -> v18 { - | ^^^ help: a type alias with a similar name exists: `v11` + | ^^^ + | +help: a type alias with a similar name exists + | +LL | pub const fn v21() -> v11 { + | ~~~ error[E0422]: cannot find struct, variant or union type `v18` in this scope --> $DIR/unevaluated-const-ice-119731.rs:32:13 @@ -38,21 +50,35 @@ LL | pub type v11 = [[usize; v4]; v4]; | --------------------------------- similarly named type alias `v11` defined here ... LL | v18 { _p: () } - | ^^^ help: a type alias with a similar name exists: `v11` + | ^^^ + | +help: a type alias with a similar name exists + | +LL | v11 { _p: () } + | ~~~ warning: type `v11` should have an upper camel case name --> $DIR/unevaluated-const-ice-119731.rs:9:14 | LL | pub type v11 = [[usize; v4]; v4]; - | ^^^ help: convert the identifier to upper camel case (notice the capitalization): `V11` + | ^^^ | = note: `#[warn(non_camel_case_types)]` on by default +help: convert the identifier to upper camel case (notice the capitalization difference) + | +LL | pub type V11 = [[usize; v4]; v4]; + | ~~~ warning: type `v17` should have an upper camel case name --> $DIR/unevaluated-const-ice-119731.rs:16:16 | LL | pub struct v17 { - | ^^^ help: convert the identifier to upper camel case (notice the capitalization): `V17` + | ^^^ + | +help: convert the identifier to upper camel case (notice the capitalization difference) + | +LL | pub struct V17 { + | ~~~ error[E0425]: cannot find function `v6` in this scope --> $DIR/unevaluated-const-ice-119731.rs:13:35 diff --git a/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.stderr b/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.stderr index 67eed46eaddc3..ae074373da275 100644 --- a/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.stderr @@ -1,10 +1,13 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/unresolved_lifetimes_error.rs:5:13 | -LL | fn foo() -> [(); { - | - help: consider introducing lifetime `'a` here: `<'a>` LL | let a: &'a (); | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn foo<'a>() -> [(); { + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr b/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr index afad3388145c7..3b24808cd1622 100644 --- a/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr +++ b/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr @@ -17,9 +17,12 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:11:34 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `'a,` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | struct ConstChunksExact<'a, 'rem, T: 'a, const N: usize> {} + | +++ error[E0046]: not all trait items implemented, missing: `const_chunks_exact` --> $DIR/ice-unexpected-inference-var-122549.rs:9:1 diff --git a/tests/ui/const-generics/incorrect-number-of-const-args.stderr b/tests/ui/const-generics/incorrect-number-of-const-args.stderr index 01ac4e69a057e..97eb47275c2b2 100644 --- a/tests/ui/const-generics/incorrect-number-of-const-args.stderr +++ b/tests/ui/const-generics/incorrect-number-of-const-args.stderr @@ -20,15 +20,18 @@ error[E0107]: function takes 2 generic arguments but 3 generic arguments were su --> $DIR/incorrect-number-of-const-args.rs:9:5 | LL | foo::<0, 0, 0>(); - | ^^^ - help: remove this generic argument - | | - | expected 2 generic arguments + | ^^^ expected 2 generic arguments | note: function defined here, with 2 generic parameters: `X`, `Y` --> $DIR/incorrect-number-of-const-args.rs:1:4 | LL | fn foo() -> usize { | ^^^ -------------- -------------- +help: remove this generic argument + | +LL - foo::<0, 0, 0>(); +LL + foo::<0, 0, >(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr index 4a649d8a7e881..d4f899f837733 100644 --- a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -27,15 +27,18 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/invalid-const-arg-for-type-param.rs:12:5 | LL | S::<0>; - | ^----- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/invalid-const-arg-for-type-param.rs:3:8 | LL | struct S; | ^ +help: remove these generics + | +LL - S::<0>; +LL + S; + | error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/invalid-constant-in-args.stderr b/tests/ui/const-generics/invalid-constant-in-args.stderr index 158b9722ee61b..ed715257ac1c3 100644 --- a/tests/ui/const-generics/invalid-constant-in-args.stderr +++ b/tests/ui/const-generics/invalid-constant-in-args.stderr @@ -2,9 +2,13 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/invalid-constant-in-args.rs:4:12 | LL | let _: Cell<&str, "a"> = Cell::new(""); - | ^^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^ expected 1 generic argument + | +help: remove this generic argument + | +LL - let _: Cell<&str, "a"> = Cell::new(""); +LL + let _: Cell<&str, > = Cell::new(""); + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/invalid-enum.stderr b/tests/ui/const-generics/invalid-enum.stderr index 7e8a632b34f79..bb99aebfa2bf6 100644 --- a/tests/ui/const-generics/invalid-enum.stderr +++ b/tests/ui/const-generics/invalid-enum.stderr @@ -2,28 +2,34 @@ error[E0573]: expected type, found variant `CompileFlag::A` --> $DIR/invalid-enum.rs:23:12 | LL | test_1::(); - | ^^^^^^^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `CompileFlag` + | ^^^^^^^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | test_1::(); + | ~~~~~~~~~~~ error[E0573]: expected type, found variant `CompileFlag::A` --> $DIR/invalid-enum.rs:27:15 | LL | test_2::<_, CompileFlag::A>(0); - | ^^^^^^^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `CompileFlag` + | ^^^^^^^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | test_2::<_, CompileFlag>(0); + | ~~~~~~~~~~~ error[E0573]: expected type, found variant `CompileFlag::A` --> $DIR/invalid-enum.rs:31:18 | LL | let _: Example = Example { x: 0 }; - | ^^^^^^^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `CompileFlag` + | ^^^^^^^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | let _: Example = Example { x: 0 }; + | ~~~~~~~~~~~ error[E0747]: unresolved item provided when a constant was expected --> $DIR/invalid-enum.rs:31:18 diff --git a/tests/ui/const-generics/kind_mismatch.stderr b/tests/ui/const-generics/kind_mismatch.stderr index 80968ebea6876..df44260552199 100644 --- a/tests/ui/const-generics/kind_mismatch.stderr +++ b/tests/ui/const-generics/kind_mismatch.stderr @@ -2,17 +2,23 @@ error[E0747]: type provided when a constant was expected --> $DIR/kind_mismatch.rs:11:38 | LL | impl ContainsKey for KeyHolder {} - | - ^ - | | - | help: consider changing this type parameter to a const parameter: `const K: u8` + | ^ + | +help: consider changing this type parameter to a const parameter + | +LL | impl ContainsKey for KeyHolder {} + | ~~~~~~~~~~~ error[E0747]: type provided when a constant was expected --> $DIR/kind_mismatch.rs:11:21 | LL | impl ContainsKey for KeyHolder {} - | - ^ - | | - | help: consider changing this type parameter to a const parameter: `const K: u8` + | ^ + | +help: consider changing this type parameter to a const parameter + | +LL | impl ContainsKey for KeyHolder {} + | ~~~~~~~~~~~ error[E0277]: the trait bound `KeyHolder<0>: SubsetExcept<_>` is not satisfied --> $DIR/kind_mismatch.rs:22:45 diff --git a/tests/ui/const-generics/legacy-const-generics-bad.stderr b/tests/ui/const-generics/legacy-const-generics-bad.stderr index 83c71e07253b3..346233133542e 100644 --- a/tests/ui/const-generics/legacy-const-generics-bad.stderr +++ b/tests/ui/const-generics/legacy-const-generics-bad.stderr @@ -1,10 +1,13 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/legacy-const-generics-bad.rs:7:35 | -LL | let a = 1; - | ----- help: consider using `const` instead of `let`: `const a` LL | legacy_const_generics::foo(0, a, 2); | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const a = 1; + | ~~~~~~~ error: generic parameters may not be used in const operations --> $DIR/legacy-const-generics-bad.rs:12:35 diff --git a/tests/ui/const-generics/occurs-check/unused-substs-3.stderr b/tests/ui/const-generics/occurs-check/unused-substs-3.stderr index bcb59705c6b2f..cc73d28409d19 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-3.stderr +++ b/tests/ui/const-generics/occurs-check/unused-substs-3.stderr @@ -2,9 +2,12 @@ error[E0308]: mismatched types --> $DIR/unused-substs-3.rs:16:9 | LL | t = foo; - | ^^^- help: try using a conversion method: `.to_vec()` - | | - | cyclic type of infinite size + | ^^^ cyclic type of infinite size + | +help: try using a conversion method + | +LL | t = foo.to_vec(); + | +++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/suggest_const_for_array.stderr b/tests/ui/const-generics/suggest_const_for_array.stderr index c867914070bb7..cf4b94fe19f63 100644 --- a/tests/ui/const-generics/suggest_const_for_array.stderr +++ b/tests/ui/const-generics/suggest_const_for_array.stderr @@ -2,13 +2,23 @@ error[E0747]: type provided when a constant was expected --> $DIR/suggest_const_for_array.rs:6:15 | LL | example::<[usize; 3]>(); - | ^^^^^^^^^^ help: array type provided where a `usize` was expected, try: `{ 3 }` + | ^^^^^^^^^^ + | +help: array type provided where a `usize` was expected, try + | +LL | example::<{ 3 }>(); + | ~~~~~ error[E0747]: type provided when a constant was expected --> $DIR/suggest_const_for_array.rs:9:15 | LL | example::<[usize; 4 + 5]>(); - | ^^^^^^^^^^^^^^ help: array type provided where a `usize` was expected, try: `{ 4 + 5 }` + | ^^^^^^^^^^^^^^ + | +help: array type provided where a `usize` was expected, try + | +LL | example::<{ 4 + 5 }>(); + | ~~~~~~~~~ error[E0284]: type annotations needed --> $DIR/suggest_const_for_array.rs:6:5 diff --git a/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.stderr b/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.stderr index 9442eac0cf54a..48e3fe632da99 100644 --- a/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.stderr +++ b/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.stderr @@ -2,9 +2,12 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-type-mismatch-when-copying-112824.rs:5:21 | LL | pub struct Opcode2(&'a S); - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | pub struct Opcode2<'a>(&'a S); + | ++++ error[E0412]: cannot find type `S` in this scope --> $DIR/ice-type-mismatch-when-copying-112824.rs:5:24 diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/constructor-lifetime-args.stderr index a18123fe19cba..9e0bc3c6c1a6e 100644 --- a/tests/ui/constructor-lifetime-args.stderr +++ b/tests/ui/constructor-lifetime-args.stderr @@ -20,15 +20,18 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/constructor-lifetime-args.rs:19:5 | LL | S::<'static, 'static, 'static>(&0, &0); - | ^ ------- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^ expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/constructor-lifetime-args.rs:9:8 | LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- +help: remove this lifetime argument + | +LL - S::<'static, 'static, 'static>(&0, &0); +LL + S::<'static, 'static, >(&0, &0); + | error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/constructor-lifetime-args.rs:22:8 @@ -52,15 +55,18 @@ error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supp --> $DIR/constructor-lifetime-args.rs:24:8 | LL | E::V::<'static, 'static, 'static>(&0); - | ^ ------- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^ expected 2 lifetime arguments | note: enum defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/constructor-lifetime-args.rs:10:6 | LL | enum E<'a, 'b> { | ^ -- -- +help: remove this lifetime argument + | +LL - E::V::<'static, 'static, 'static>(&0); +LL + E::V::<'static, 'static, >(&0); + | error: aborting due to 4 previous errors diff --git a/tests/ui/consts/array-literal-len-mismatch.stderr b/tests/ui/consts/array-literal-len-mismatch.stderr index a11506ecb6d6a..49d85b97618b1 100644 --- a/tests/ui/consts/array-literal-len-mismatch.stderr +++ b/tests/ui/consts/array-literal-len-mismatch.stderr @@ -2,9 +2,12 @@ error[E0308]: mismatched types --> $DIR/array-literal-len-mismatch.rs:1:26 | LL | const NUMBERS: [u8; 3] = [10, 20]; - | - ^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements - | | - | help: consider specifying the actual array length: `2` + | ^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements + | +help: consider specifying the actual array length + | +LL | const NUMBERS: [u8; 2] = [10, 20]; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-array-oob-arith.stderr b/tests/ui/consts/const-array-oob-arith.stderr index 029d94273fae1..b537c9dbfb304 100644 --- a/tests/ui/consts/const-array-oob-arith.stderr +++ b/tests/ui/consts/const-array-oob-arith.stderr @@ -2,17 +2,23 @@ error[E0308]: mismatched types --> $DIR/const-array-oob-arith.rs:5:45 | LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; - | ---------------------- ^^^ expected an array with a fixed size of 2 elements, found one with 1 element - | | - | help: consider specifying the actual array length: `1` + | ^^^ expected an array with a fixed size of 2 elements, found one with 1 element + | +help: consider specifying the actual array length + | +LL | const BLUB: [i32; 1] = [5]; + | ~ error[E0308]: mismatched types --> $DIR/const-array-oob-arith.rs:8:44 | LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; - | ---------------------- ^^^^^^^ expected an array with a fixed size of 1 element, found one with 2 elements - | | - | help: consider specifying the actual array length: `2` + | ^^^^^^^ expected an array with a fixed size of 1 element, found one with 2 elements + | +help: consider specifying the actual array length + | +LL | const BOO: [i32; 2] = [5, 99]; + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-blocks/trait-error.stderr b/tests/ui/consts/const-blocks/trait-error.stderr index 8f00f14dfb900..83b9fbc9423ac 100644 --- a/tests/ui/consts/const-blocks/trait-error.stderr +++ b/tests/ui/consts/const-blocks/trait-error.stderr @@ -2,10 +2,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/trait-error.rs:5:6 | LL | [Foo(String::new()); 4]; - | ^^^^^^^^^^^^^^^^^^ - | | - | the trait `Copy` is not implemented for `String`, which is required by `Foo: Copy` - | help: create an inline `const` block: `const { Foo(String::new()) }` + | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`, which is required by `Foo: Copy` | note: required for `Foo` to implement `Copy` --> $DIR/trait-error.rs:1:10 @@ -14,6 +11,10 @@ LL | #[derive(Copy, Clone)] | ^^^^ unsatisfied trait bound introduced in this `derive` macro = note: the `Copy` trait is required because this value will be copied for each element of the array = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) +help: create an inline `const` block + | +LL | [const { Foo(String::new()) }; 4]; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/issue-104390.stderr b/tests/ui/consts/const-eval/issue-104390.stderr index 865b9996ea395..a6e739d3a761c 100644 --- a/tests/ui/consts/const-eval/issue-104390.stderr +++ b/tests/ui/consts/const-eval/issue-104390.stderr @@ -41,7 +41,12 @@ LL | fn f3() -> impl Sized { &'a 2E } | ^--^^^ | | | annotated with lifetime here - | help: remove the lifetime annotation + | +help: remove the lifetime annotation + | +LL - fn f3() -> impl Sized { &'a 2E } +LL + fn f3() -> impl Sized { & 2E } + | error: borrow expressions cannot be annotated with lifetimes --> $DIR/issue-104390.rs:5:25 @@ -50,7 +55,12 @@ LL | fn f4() -> impl Sized { &'static 2E } | ^-------^^^ | | | annotated with lifetime here - | help: remove the lifetime annotation + | +help: remove the lifetime annotation + | +LL - fn f4() -> impl Sized { &'static 2E } +LL + fn f4() -> impl Sized { & 2E } + | error: borrow expressions cannot be annotated with lifetimes --> $DIR/issue-104390.rs:8:25 @@ -59,7 +69,12 @@ LL | fn f6() -> impl Sized { &'_ 2E } | ^--^^^ | | | annotated with lifetime here - | help: remove the lifetime annotation + | +help: remove the lifetime annotation + | +LL - fn f6() -> impl Sized { &'_ 2E } +LL + fn f6() -> impl Sized { & 2E } + | error: aborting due to 9 previous errors diff --git a/tests/ui/consts/const-fn-in-vec.stderr b/tests/ui/consts/const-fn-in-vec.stderr index 7c6b3bee9404b..dc502982abbb9 100644 --- a/tests/ui/consts/const-fn-in-vec.stderr +++ b/tests/ui/consts/const-fn-in-vec.stderr @@ -2,36 +2,39 @@ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:1:47 | LL | static _MAYBE_STRINGS: [Option; 5] = [None; 5]; - | ^^^^ - | | - | the trait `Copy` is not implemented for `String`, which is required by `Option: Copy` - | help: create an inline `const` block: `const { None }` + | ^^^^ the trait `Copy` is not implemented for `String`, which is required by `Option: Copy` | = note: required for `Option` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array +help: create an inline `const` block + | +LL | static _MAYBE_STRINGS: [Option; 5] = [const { None }; 5]; + | ~~~~~~~~~~~~~~ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:7:34 | LL | let _strings: [String; 5] = [String::new(); 5]; - | ^^^^^^^^^^^^^ - | | - | the trait `Copy` is not implemented for `String` - | help: create an inline `const` block: `const { String::new() }` + | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | = note: the `Copy` trait is required because this value will be copied for each element of the array +help: create an inline `const` block + | +LL | let _strings: [String; 5] = [const { String::new() }; 5]; + | ~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:9:48 | LL | let _maybe_strings: [Option; 5] = [None; 5]; - | ^^^^ - | | - | the trait `Copy` is not implemented for `String`, which is required by `Option: Copy` - | help: create an inline `const` block: `const { None }` + | ^^^^ the trait `Copy` is not implemented for `String`, which is required by `Option: Copy` | = note: required for `Option` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array +help: create an inline `const` block + | +LL | let _maybe_strings: [Option; 5] = [const { None }; 5]; + | ~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/consts/const-fn-mismatch.stderr b/tests/ui/consts/const-fn-mismatch.stderr index 9e7d93b0c97bb..c5c1485efae12 100644 --- a/tests/ui/consts/const-fn-mismatch.stderr +++ b/tests/ui/consts/const-fn-mismatch.stderr @@ -2,10 +2,13 @@ error[E0379]: functions in trait impls cannot be declared const --> $DIR/const-fn-mismatch.rs:11:5 | LL | const fn f() -> u32 { - | ^^^^^- - | | - | functions in trait impls cannot be const - | help: remove the `const` + | ^^^^^ functions in trait impls cannot be const + | +help: remove the `const` + | +LL - const fn f() -> u32 { +LL + fn f() -> u32 { + | error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-fn-not-in-trait.stderr b/tests/ui/consts/const-fn-not-in-trait.stderr index 04430610ad00c..89ab0661162f4 100644 --- a/tests/ui/consts/const-fn-not-in-trait.stderr +++ b/tests/ui/consts/const-fn-not-in-trait.stderr @@ -2,19 +2,25 @@ error[E0379]: functions in traits cannot be declared const --> $DIR/const-fn-not-in-trait.rs:5:5 | LL | const fn f() -> u32; - | ^^^^^- - | | - | functions in traits cannot be const - | help: remove the `const` + | ^^^^^ functions in traits cannot be const + | +help: remove the `const` + | +LL - const fn f() -> u32; +LL + fn f() -> u32; + | error[E0379]: functions in traits cannot be declared const --> $DIR/const-fn-not-in-trait.rs:7:5 | LL | const fn g() -> u32 { - | ^^^^^- - | | - | functions in traits cannot be const - | help: remove the `const` + | ^^^^^ functions in traits cannot be const + | +help: remove the `const` + | +LL - const fn g() -> u32 { +LL + fn g() -> u32 { + | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr index 2aed68bdd6433..a7f4c02aeeaeb 100644 --- a/tests/ui/consts/const-pattern-irrefutable.stderr +++ b/tests/ui/consts/const-pattern-irrefutable.stderr @@ -6,11 +6,14 @@ LL | let a = 4; | | | patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered | missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable - | help: introduce a variable instead: `a_var` | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `u8` +help: introduce a variable instead + | +LL | let a_var = 4; + | ~~~~~ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:17:9 @@ -20,11 +23,14 @@ LL | let c = 4; | | | patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered | missing patterns are not covered because `c` is interpreted as a constant pattern, not a new variable - | help: introduce a variable instead: `c_var` | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `u8` +help: introduce a variable instead + | +LL | let c_var = 4; + | ~~~~~ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:22:9 @@ -34,11 +40,14 @@ LL | let d = 4; | | | patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered | missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable - | help: introduce a variable instead: `d_var` | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `u8` +help: introduce a variable instead + | +LL | let d_var = 4; + | ~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/consts/effect_param.stderr b/tests/ui/consts/effect_param.stderr index dba5d49b7921e..3777e20e4c0ad 100644 --- a/tests/ui/consts/effect_param.stderr +++ b/tests/ui/consts/effect_param.stderr @@ -2,33 +2,49 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/effect_param.rs:11:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^--------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - i8::checked_sub::(42, 43); +LL + i8::checked_sub(42, 43); + | error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/effect_param.rs:13:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^-------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - i8::checked_sub::(42, 43); +LL + i8::checked_sub(42, 43); + | error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/effect_param.rs:4:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^-------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - i8::checked_sub::(42, 43); +LL + i8::checked_sub(42, 43); + | error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/effect_param.rs:6:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^--------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - i8::checked_sub::(42, 43); +LL + i8::checked_sub(42, 43); + | error: aborting due to 4 previous errors diff --git a/tests/ui/consts/issue-104768.stderr b/tests/ui/consts/issue-104768.stderr index 8a4a41e4d68a8..29f8e6f522ef0 100644 --- a/tests/ui/consts/issue-104768.stderr +++ b/tests/ui/consts/issue-104768.stderr @@ -2,10 +2,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/issue-104768.rs:1:10 | LL | const A: &_ = 0_u32; - | ^^ - | | - | not allowed in type signatures - | help: replace with the correct type: `u32` + | ^^ not allowed in type signatures + | +help: replace with the correct type + | +LL | const A: u32 = 0_u32; + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-3521.stderr b/tests/ui/consts/issue-3521.stderr index 70ce9b2d6a08a..e81f90ea93afe 100644 --- a/tests/ui/consts/issue-3521.stderr +++ b/tests/ui/consts/issue-3521.stderr @@ -1,11 +1,13 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-3521.rs:8:15 | -LL | let foo: isize = 100; - | ------- help: consider using `const` instead of `let`: `const foo` -... LL | Bar = foo | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const foo: isize = 100; + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-54954.stderr b/tests/ui/consts/issue-54954.stderr index b8c983eb7b81c..9bce73cd6ec27 100644 --- a/tests/ui/consts/issue-54954.stderr +++ b/tests/ui/consts/issue-54954.stderr @@ -2,10 +2,13 @@ error[E0379]: functions in traits cannot be declared const --> $DIR/issue-54954.rs:5:5 | LL | const fn const_val() -> usize { - | ^^^^^- - | | - | functions in traits cannot be const - | help: remove the `const` + | ^^^^^ functions in traits cannot be const + | +help: remove the `const` + | +LL - const fn const_val() -> usize { +LL + fn const_val() -> usize { + | error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> $DIR/issue-54954.rs:1:24 diff --git a/tests/ui/consts/issue-91560.stderr b/tests/ui/consts/issue-91560.stderr index e1b5d4cacf8e3..ed1e9e6e2eae5 100644 --- a/tests/ui/consts/issue-91560.stderr +++ b/tests/ui/consts/issue-91560.stderr @@ -1,20 +1,24 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-91560.rs:10:19 | -LL | let mut length: usize = 2; - | -------------- help: consider using `const` instead of `let`: `const length` -LL | LL | let arr = [0; length]; | ^^^^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const length: usize = 2; + | ~~~~~~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-91560.rs:17:19 | -LL | let length: usize = 2; - | ------------ help: consider using `const` instead of `let`: `const length` -LL | LL | let arr = [0; length]; | ^^^^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const length: usize = 2; + | ~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/consts/missing_assoc_const_type.stderr b/tests/ui/consts/missing_assoc_const_type.stderr index 28af1f0f321e6..5d3400a38e2ad 100644 --- a/tests/ui/consts/missing_assoc_const_type.stderr +++ b/tests/ui/consts/missing_assoc_const_type.stderr @@ -2,7 +2,12 @@ error: missing type for `const` item --> $DIR/missing_assoc_const_type.rs:12:17 | LL | const FIRST: = 10; - | ^ help: provide a type for the associated constant: `u8` + | ^ + | +help: provide a type for the associated constant + | +LL | const FIRST: u8 = 10; + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/consts/missing_assoc_const_type2.stderr b/tests/ui/consts/missing_assoc_const_type2.stderr index 1255ca2d102b5..02621122bf5fc 100644 --- a/tests/ui/consts/missing_assoc_const_type2.stderr +++ b/tests/ui/consts/missing_assoc_const_type2.stderr @@ -2,7 +2,12 @@ error: missing type for `const` item --> $DIR/missing_assoc_const_type2.rs:12:17 | LL | const FIRST: = 10; - | ^ help: provide a type for the associated constant: `u8` + | ^ + | +help: provide a type for the associated constant + | +LL | const FIRST: u8 = 10; + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/consts/non-const-value-in-const.stderr b/tests/ui/consts/non-const-value-in-const.stderr index 0ce4b4b705334..02b4b37a66027 100644 --- a/tests/ui/consts/non-const-value-in-const.stderr +++ b/tests/ui/consts/non-const-value-in-const.stderr @@ -2,18 +2,23 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/non-const-value-in-const.rs:3:20 | LL | const Y: i32 = x; - | ------- ^ non-constant value - | | - | help: consider using `let` instead of `const`: `let Y` + | ^ non-constant value + | +help: consider using `let` instead of `const` + | +LL | let Y: i32 = x; + | ~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/non-const-value-in-const.rs:6:17 | -LL | let x = 5; - | ----- help: consider using `const` instead of `let`: `const x` -... LL | let _ = [0; x]; | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const x = 5; + | ~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/coroutine/type-mismatch-error.stderr b/tests/ui/coroutine/type-mismatch-error.stderr index f10c30e259072..0138e3cc32188 100644 --- a/tests/ui/coroutine/type-mismatch-error.stderr +++ b/tests/ui/coroutine/type-mismatch-error.stderr @@ -3,16 +3,19 @@ error[E0308]: `if` and `else` have incompatible types | LL | / if false { LL | | yield (); - | | --------- - | | | | - | | | help: consider removing this semicolon - | | expected because of this + | | --------- expected because of this LL | | } else { LL | | a | | ^ expected `()`, found `u8` LL | | LL | | } | |_____________- `if` and `else` have incompatible types + | +help: consider removing this semicolon + | +LL - yield (); +LL + yield () + | error: aborting due to 1 previous error diff --git a/tests/ui/coroutine/unresolved-ct-var.stderr b/tests/ui/coroutine/unresolved-ct-var.stderr index 8b87bac05acb2..6fde35a05fe9e 100644 --- a/tests/ui/coroutine/unresolved-ct-var.stderr +++ b/tests/ui/coroutine/unresolved-ct-var.stderr @@ -2,15 +2,18 @@ error[E0277]: `[(); _]` is not a future --> $DIR/unresolved-ct-var.rs:6:45 | LL | let s = std::array::from_fn(|_| ()).await; - | ----------------------------^^^^^ - | | || - | | |`[(); _]` is not a future - | | help: remove the `.await` + | --------------------------- ^^^^^ `[(); _]` is not a future + | | | this call returns `[(); _]` | = help: the trait `Future` is not implemented for `[(); _]`, which is required by `[(); _]: IntoFuture` = note: [(); _] must be a future or must implement `IntoFuture` to be awaited = note: required for `[(); _]` to implement `IntoFuture` +help: remove the `.await` + | +LL - let s = std::array::from_fn(|_| ()).await; +LL + let s = std::array::from_fn(|_| ()); + | error: aborting due to 1 previous error diff --git a/tests/ui/coverage-attr/bad-syntax.stderr b/tests/ui/coverage-attr/bad-syntax.stderr index a5868fcf19cff..8070b71e5a7a7 100644 --- a/tests/ui/coverage-attr/bad-syntax.stderr +++ b/tests/ui/coverage-attr/bad-syntax.stderr @@ -106,34 +106,47 @@ error: expected identifier, found `,` --> $DIR/bad-syntax.rs:42:12 | LL | #[coverage(,off)] - | ^ - | | - | expected identifier - | help: remove this comma + | ^ expected identifier + | +help: remove this comma + | +LL - #[coverage(,off)] +LL + #[coverage(off)] + | error: multiple `coverage` attributes --> $DIR/bad-syntax.rs:7:1 | LL | #[coverage(off)] - | ^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/bad-syntax.rs:8:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[coverage(off)] +LL + + | error: multiple `coverage` attributes --> $DIR/bad-syntax.rs:11:1 | LL | #[coverage(off)] - | ^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/bad-syntax.rs:12:1 | LL | #[coverage(on)] | ^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[coverage(off)] +LL + + | error: aborting due to 11 previous errors diff --git a/tests/ui/cross-crate/unit-struct.stderr b/tests/ui/cross-crate/unit-struct.stderr index a7e3e4685a997..cc2f0799dadd3 100644 --- a/tests/ui/cross-crate/unit-struct.stderr +++ b/tests/ui/cross-crate/unit-struct.stderr @@ -2,12 +2,17 @@ error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithFields --> $DIR/unit-struct.rs:9:13 | LL | let _ = xcrate_unit_struct::StructWithFields; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `xcrate_unit_struct::StructWithFields { foo: val }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/xcrate_unit_struct.rs:20:1 | LL | pub struct StructWithFields { | --------------------------- `xcrate_unit_struct::StructWithFields` defined here + | +help: use struct literal syntax instead + | +LL | let _ = xcrate_unit_struct::StructWithFields { foo: val }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithPrivFields` --> $DIR/unit-struct.rs:11:13 diff --git a/tests/ui/delegation/bad-resolve.stderr b/tests/ui/delegation/bad-resolve.stderr index 883ff523bcfea..d00a5ed85c6a9 100644 --- a/tests/ui/delegation/bad-resolve.stderr +++ b/tests/ui/delegation/bad-resolve.stderr @@ -20,10 +20,12 @@ error[E0407]: method `baz` is not a member of trait `Trait` --> $DIR/bad-resolve.rs:30:5 | LL | reuse ::baz; - | ^^^^^^^^^^^^^^^^^^^^---^ - | | | - | | help: there is an associated function with a similar name: `bar` - | not a member of trait `Trait` + | ^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Trait` + | +help: there is an associated function with a similar name + | +LL | reuse ::bar; + | ~~~ error[E0423]: expected function, found associated constant `Trait::C` --> $DIR/bad-resolve.rs:24:11 @@ -46,7 +48,12 @@ LL | fn bar() {} | -------- similarly named associated function `bar` defined here ... LL | reuse ::baz; - | ^^^ help: an associated function with a similar name exists: `bar` + | ^^^ + | +help: an associated function with a similar name exists + | +LL | reuse ::bar; + | ~~~ error[E0425]: cannot find function `foo` in this scope --> $DIR/bad-resolve.rs:35:11 diff --git a/tests/ui/delegation/explicit-paths.stderr b/tests/ui/delegation/explicit-paths.stderr index d33c5da4377b1..01e616b7f2195 100644 --- a/tests/ui/delegation/explicit-paths.stderr +++ b/tests/ui/delegation/explicit-paths.stderr @@ -2,19 +2,23 @@ error[E0407]: method `foo3` is not a member of trait `Trait` --> $DIR/explicit-paths.rs:51:9 | LL | reuse to_reuse::foo3; - | ^^^^^^^^^^^^^^^^----^ - | | | - | | help: there is an associated function with a similar name: `foo1` - | not a member of trait `Trait` + | ^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Trait` + | +help: there is an associated function with a similar name + | +LL | reuse to_reuse::foo1; + | ~~~~ error[E0407]: method `foo4` is not a member of trait `Trait` --> $DIR/explicit-paths.rs:53:9 | LL | reuse F::foo4 { &self.0 } - | ^^^^^^^^^----^^^^^^^^^^^^ - | | | - | | help: there is an associated function with a similar name: `foo1` - | not a member of trait `Trait` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Trait` + | +help: there is an associated function with a similar name + | +LL | reuse F::foo1 { &self.0 } + | ~~~~ error[E0425]: cannot find function `foo4` in `S` --> $DIR/explicit-paths.rs:29:14 diff --git a/tests/ui/delegation/target-expr.stderr b/tests/ui/delegation/target-expr.stderr index b30f0c474c68b..4b3f73824948b 100644 --- a/tests/ui/delegation/target-expr.stderr +++ b/tests/ui/delegation/target-expr.stderr @@ -3,11 +3,14 @@ error[E0401]: can't use generic parameters from outer item | LL | fn bar(_: T) { | - type parameter from outer item -LL | reuse Trait::static_method { - | - help: try introducing a local generic parameter here: `T,` ... LL | let _ = T::Default(); | ^^^^^^^^^^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | reuse Trait::static_methodT, { + | ++ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/target-expr.rs:29:17 diff --git a/tests/ui/deprecation/deprecation-sanity.stderr b/tests/ui/deprecation/deprecation-sanity.stderr index 383212ad9b4b8..e6b5b5ff00ad3 100644 --- a/tests/ui/deprecation/deprecation-sanity.stderr +++ b/tests/ui/deprecation/deprecation-sanity.stderr @@ -2,13 +2,18 @@ error: multiple `deprecated` attributes --> $DIR/deprecation-sanity.rs:27:1 | LL | #[deprecated(since = "a", note = "b")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/deprecation-sanity.rs:26:1 | LL | #[deprecated(since = "a", note = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[deprecated(since = "a", note = "b")] +LL + + | error[E0541]: unknown meta item 'reason' --> $DIR/deprecation-sanity.rs:4:43 @@ -44,9 +49,13 @@ error[E0565]: literal in `deprecated` value must be a string --> $DIR/deprecation-sanity.rs:19:25 | LL | #[deprecated(note = b"test")] - | -^^^^^^ - | | - | help: consider removing the prefix + | ^^^^^^^ + | +help: consider removing the prefix + | +LL - #[deprecated(note = b"test")] +LL + #[deprecated(note = "test")] + | error[E0565]: item in `deprecated` must be a key/value pair --> $DIR/deprecation-sanity.rs:22:18 @@ -64,9 +73,14 @@ error: this `#[deprecated]` annotation has no effect --> $DIR/deprecation-sanity.rs:35:1 | LL | #[deprecated = "hello"] - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove the unnecessary deprecation attribute + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[deny(useless_deprecated)]` on by default +help: remove the unnecessary deprecation attribute + | +LL - #[deprecated = "hello"] +LL + + | error: aborting due to 10 previous errors diff --git a/tests/ui/derives/deriving-meta-unknown-trait.stderr b/tests/ui/derives/deriving-meta-unknown-trait.stderr index 28753b8f9f288..9ddfd5c8b2da0 100644 --- a/tests/ui/derives/deriving-meta-unknown-trait.stderr +++ b/tests/ui/derives/deriving-meta-unknown-trait.stderr @@ -2,21 +2,30 @@ error: cannot find derive macro `Eqr` in this scope --> $DIR/deriving-meta-unknown-trait.rs:1:10 | LL | #[derive(Eqr)] - | ^^^ help: a derive macro with a similar name exists: `Eq` + | ^^^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named derive macro `Eq` defined here + | +help: a derive macro with a similar name exists + | +LL | #[derive(Eq)] + | ~~ error: cannot find derive macro `Eqr` in this scope --> $DIR/deriving-meta-unknown-trait.rs:1:10 | LL | #[derive(Eqr)] - | ^^^ help: a derive macro with a similar name exists: `Eq` + | ^^^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named derive macro `Eq` defined here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: a derive macro with a similar name exists + | +LL | #[derive(Eq)] + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/destructuring-assignment/note-unsupported.stderr b/tests/ui/destructuring-assignment/note-unsupported.stderr index f556330070cb1..0939a055fe729 100644 --- a/tests/ui/destructuring-assignment/note-unsupported.stderr +++ b/tests/ui/destructuring-assignment/note-unsupported.stderr @@ -2,7 +2,13 @@ error: functional record updates are not allowed in destructuring assignments --> $DIR/note-unsupported.rs:20:17 | LL | S { x: a, ..s } = S { x: 3, y: 4 }; - | ^ help: consider removing the trailing pattern + | ^ + | +help: consider removing the trailing pattern + | +LL - S { x: a, ..s } = S { x: 3, y: 4 }; +LL + S { x: a, .. } = S { x: 3, y: 4 }; + | error[E0368]: binary assignment operation `+=` cannot be applied to type `({integer}, {integer})` --> $DIR/note-unsupported.rs:7:5 diff --git a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr index 57851ed417ea8..dd4bdff973d73 100644 --- a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr +++ b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr @@ -10,7 +10,13 @@ error: functional record updates are not allowed in destructuring assignments --> $DIR/struct_destructure_fail.rs:13:19 | LL | Struct { a, ..d } = Struct { a: 1, b: 2 }; - | ^ help: consider removing the trailing pattern + | ^ + | +help: consider removing the trailing pattern + | +LL - Struct { a, ..d } = Struct { a: 1, b: 2 }; +LL + Struct { a, .. } = Struct { a: 1, b: 2 }; + | error[E0797]: base expression required after `..` --> $DIR/struct_destructure_fail.rs:15:19 diff --git a/tests/ui/did_you_mean/E0178.stderr b/tests/ui/did_you_mean/E0178.stderr index 58ac6e90823f6..e88bff850e558 100644 --- a/tests/ui/did_you_mean/E0178.stderr +++ b/tests/ui/did_you_mean/E0178.stderr @@ -2,19 +2,34 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` --> $DIR/E0178.rs:6:8 | LL | w: &'a Foo + Copy, - | ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Copy)` + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | w: &'a (Foo + Copy), + | ~~~~~~~~~~~~~~~~ error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` --> $DIR/E0178.rs:7:8 | LL | x: &'a Foo + 'a, - | ^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + 'a)` + | ^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | x: &'a (Foo + 'a), + | ~~~~~~~~~~~~~~ error[E0178]: expected a path on the left-hand side of `+`, not `&'a mut Foo` --> $DIR/E0178.rs:8:8 | LL | y: &'a mut Foo + 'a, - | ^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'a mut (Foo + 'a)` + | ^^^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | y: &'a mut (Foo + 'a), + | ~~~~~~~~~~~~~~~~~~ error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo` --> $DIR/E0178.rs:9:8 diff --git a/tests/ui/did_you_mean/issue-105225.stderr b/tests/ui/did_you_mean/issue-105225.stderr index 5fb46222bee59..17adfc5b89c0a 100644 --- a/tests/ui/did_you_mean/issue-105225.stderr +++ b/tests/ui/did_you_mean/issue-105225.stderr @@ -2,37 +2,52 @@ error: redundant argument --> $DIR/issue-105225.rs:7:21 | LL | println!("{x}", x); - | ^ help: this can be removed + | ^ | note: the formatting specifier is referencing the binding already --> $DIR/issue-105225.rs:7:16 | LL | println!("{x}", x); | ^ +help: this can be removed + | +LL - println!("{x}", x); +LL + println!("{x}", ); + | error: redundant argument --> $DIR/issue-105225.rs:10:27 | LL | println!("{x} {}", x, x); - | ^ help: this can be removed + | ^ | note: the formatting specifier is referencing the binding already --> $DIR/issue-105225.rs:10:16 | LL | println!("{x} {}", x, x); | ^ +help: this can be removed + | +LL - println!("{x} {}", x, x); +LL + println!("{x} {}", x, ); + | error: redundant argument --> $DIR/issue-105225.rs:13:27 | LL | println!("{} {x}", x, x); - | ^ help: this can be removed + | ^ | note: the formatting specifier is referencing the binding already --> $DIR/issue-105225.rs:13:19 | LL | println!("{} {x}", x, x); | ^ +help: this can be removed + | +LL - println!("{} {x}", x, x); +LL + println!("{} {x}", x, ); + | error: redundant arguments --> $DIR/issue-105225.rs:16:25 diff --git a/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr b/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr index 2a3242abea49c..952ac76a003d6 100644 --- a/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr +++ b/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr @@ -2,39 +2,56 @@ error: `~` cannot be used as a unary operator --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:4:14 | LL | let _x = ~1; - | ^ help: use `!` to perform bitwise not + | ^ + | +help: use `!` to perform bitwise not + | +LL | let _x = !1; + | ~ error: unexpected `1` after identifier --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:5:18 | LL | let _y = not 1; - | ----^ - | | - | help: use `!` to perform bitwise not + | ^ + | +help: use `!` to perform bitwise not + | +LL | let _y = !1; + | ~ error: unexpected keyword `false` after identifier --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:6:18 | LL | let _z = not false; - | ----^^^^^ - | | - | help: use `!` to perform logical negation + | ^^^^^ + | +help: use `!` to perform logical negation + | +LL | let _z = !false; + | ~ error: unexpected keyword `true` after identifier --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:7:18 | LL | let _a = not true; - | ----^^^^ - | | - | help: use `!` to perform logical negation + | ^^^^ + | +help: use `!` to perform logical negation + | +LL | let _a = !true; + | ~ error: unexpected `v` after identifier --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:9:18 | LL | let _v = not v; - | ----^ - | | - | help: use `!` to perform logical negation or bitwise not + | ^ + | +help: use `!` to perform logical negation or bitwise not + | +LL | let _v = !v; + | ~ error: aborting due to 5 previous errors diff --git a/tests/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr b/tests/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr index 9dde5b3ebe309..024b05e36a900 100644 --- a/tests/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr +++ b/tests/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr @@ -2,15 +2,19 @@ error[E0532]: expected tuple struct or tuple variant, found enum `Option` --> $DIR/issue-43871-enum-instead-of-variant.rs:21:12 | LL | if let Option(_) = x { - | ^^^^^^ help: try to match against one of the enum's variants: `std::option::Option::Some` + | ^^^^^^ | = help: you might have meant to match against the enum's non-tuple variant +help: try to match against one of the enum's variants + | +LL | if let std::option::Option::Some(_) = x { + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0532]: expected tuple struct or tuple variant, found enum `Example` --> $DIR/issue-43871-enum-instead-of-variant.rs:27:12 | LL | if let Example(_) = y { - | ^^^^^^^ help: try to match against one of the enum's variants: `Example::Ex` + | ^^^^^^^ | = help: you might have meant to match against the enum's non-tuple variant note: the enum is defined here @@ -18,14 +22,22 @@ note: the enum is defined here | LL | enum Example { Ex(String), NotEx } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try to match against one of the enum's variants + | +LL | if let Example::Ex(_) = y { + | ~~~~~~~~~~~ error[E0423]: expected function, tuple struct or tuple variant, found enum `Option` --> $DIR/issue-43871-enum-instead-of-variant.rs:19:13 | LL | let x = Option(1); - | ^^^^^^ help: try to construct one of the enum's variants: `std::option::Option::Some` + | ^^^^^^ | = help: you might have meant to construct the enum's non-tuple variant +help: try to construct one of the enum's variants + | +LL | let x = std::option::Option::Some(1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: expected function, tuple struct or tuple variant, found enum `Void` --> $DIR/issue-43871-enum-instead-of-variant.rs:31:13 diff --git a/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr b/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr index 14918ba895325..6dea6a4fac8f2 100644 --- a/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr +++ b/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr @@ -2,25 +2,34 @@ error: unexpected `for_you` after identifier --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:3:12 | LL | if not for_you { - | ----^^^^^^^ - | | - | help: use `!` to perform logical negation or bitwise not + | ^^^^^^^ + | +help: use `!` to perform logical negation or bitwise not + | +LL | if !for_you { + | ~ error: unexpected `the_worst` after identifier --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:11:15 | LL | while not the_worst { - | ----^^^^^^^^^ - | | - | help: use `!` to perform logical negation or bitwise not + | ^^^^^^^^^ + | +help: use `!` to perform logical negation or bitwise not + | +LL | while !the_worst { + | ~ error: unexpected `println` after identifier --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:20:9 | -LL | if not // lack of braces is [sic] - | ----- help: use `!` to perform logical negation or bitwise not LL | println!("Then when?"); | ^^^^^^^ + | +help: use `!` to perform logical negation or bitwise not + | +LL | if !// lack of braces is [sic] + | ~ error: expected `{`, found `;` --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:20:31 @@ -40,17 +49,23 @@ error: unexpected `2` after identifier --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:26:24 | LL | let resource = not 2; - | ----^ - | | - | help: use `!` to perform bitwise not + | ^ + | +help: use `!` to perform bitwise not + | +LL | let resource = !2; + | ~ error: unexpected `be_smothered_out_before` after identifier --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:32:27 | LL | let young_souls = not be_smothered_out_before; - | ----^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: use `!` to perform logical negation or bitwise not + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `!` to perform logical negation or bitwise not + | +LL | let young_souls = !be_smothered_out_before; + | ~ error: aborting due to 6 previous errors diff --git a/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr b/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr index cbe59e8e0af7e..c52102e2631d8 100644 --- a/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr +++ b/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr @@ -2,65 +2,97 @@ error: `and` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:7:15 | LL | let _ = a and b; - | ^^^ help: use `&&` to perform logical conjunction + | ^^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `&&` to perform logical conjunction + | +LL | let _ = a && b; + | ~~ error: `and` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:9:10 | LL | if a and b { - | ^^^ help: use `&&` to perform logical conjunction + | ^^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `&&` to perform logical conjunction + | +LL | if a && b { + | ~~ error: `or` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:20:15 | LL | let _ = a or b; - | ^^ help: use `||` to perform logical disjunction + | ^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `||` to perform logical disjunction + | +LL | let _ = a || b; + | ~~ error: `or` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:22:10 | LL | if a or b { - | ^^ help: use `||` to perform logical disjunction + | ^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `||` to perform logical disjunction + | +LL | if a || b { + | ~~ error: `and` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:30:11 | LL | if (a and b) { - | ^^^ help: use `&&` to perform logical conjunction + | ^^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `&&` to perform logical conjunction + | +LL | if (a && b) { + | ~~ error: `or` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:38:11 | LL | if (a or b) { - | ^^ help: use `||` to perform logical disjunction + | ^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `||` to perform logical disjunction + | +LL | if (a || b) { + | ~~ error: `and` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:46:13 | LL | while a and b { - | ^^^ help: use `&&` to perform logical conjunction + | ^^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `&&` to perform logical conjunction + | +LL | while a && b { + | ~~ error: `or` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:54:13 | LL | while a or b { - | ^^ help: use `||` to perform logical disjunction + | ^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `||` to perform logical disjunction + | +LL | while a || b { + | ~~ error[E0308]: mismatched types --> $DIR/issue-54109-and_instead_of_ampersands.rs:13:33 diff --git a/tests/ui/did_you_mean/issue-54109-without-witness.stderr b/tests/ui/did_you_mean/issue-54109-without-witness.stderr index 6455b0863f8f5..ee6d9901fcf60 100644 --- a/tests/ui/did_you_mean/issue-54109-without-witness.stderr +++ b/tests/ui/did_you_mean/issue-54109-without-witness.stderr @@ -2,65 +2,97 @@ error: `and` is not a logical operator --> $DIR/issue-54109-without-witness.rs:13:15 | LL | let _ = a and b; - | ^^^ help: use `&&` to perform logical conjunction + | ^^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `&&` to perform logical conjunction + | +LL | let _ = a && b; + | ~~ error: `and` is not a logical operator --> $DIR/issue-54109-without-witness.rs:15:10 | LL | if a and b { - | ^^^ help: use `&&` to perform logical conjunction + | ^^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `&&` to perform logical conjunction + | +LL | if a && b { + | ~~ error: `or` is not a logical operator --> $DIR/issue-54109-without-witness.rs:24:15 | LL | let _ = a or b; - | ^^ help: use `||` to perform logical disjunction + | ^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `||` to perform logical disjunction + | +LL | let _ = a || b; + | ~~ error: `or` is not a logical operator --> $DIR/issue-54109-without-witness.rs:26:10 | LL | if a or b { - | ^^ help: use `||` to perform logical disjunction + | ^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `||` to perform logical disjunction + | +LL | if a || b { + | ~~ error: `and` is not a logical operator --> $DIR/issue-54109-without-witness.rs:34:11 | LL | if (a and b) { - | ^^^ help: use `&&` to perform logical conjunction + | ^^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `&&` to perform logical conjunction + | +LL | if (a && b) { + | ~~ error: `or` is not a logical operator --> $DIR/issue-54109-without-witness.rs:42:11 | LL | if (a or b) { - | ^^ help: use `||` to perform logical disjunction + | ^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `||` to perform logical disjunction + | +LL | if (a || b) { + | ~~ error: `and` is not a logical operator --> $DIR/issue-54109-without-witness.rs:50:13 | LL | while a and b { - | ^^^ help: use `&&` to perform logical conjunction + | ^^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `&&` to perform logical conjunction + | +LL | while a && b { + | ~~ error: `or` is not a logical operator --> $DIR/issue-54109-without-witness.rs:58:13 | LL | while a or b { - | ^^ help: use `||` to perform logical disjunction + | ^^ | = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators +help: use `||` to perform logical disjunction + | +LL | while a || b { + | ~~ error: aborting due to 8 previous errors diff --git a/tests/ui/did_you_mean/println-typo.stderr b/tests/ui/did_you_mean/println-typo.stderr index a1e0b1f1ba4f1..c2d6201fc60f1 100644 --- a/tests/ui/did_you_mean/println-typo.stderr +++ b/tests/ui/did_you_mean/println-typo.stderr @@ -2,10 +2,15 @@ error: cannot find macro `prinltn` in this scope --> $DIR/println-typo.rs:4:5 | LL | prinltn!(); - | ^^^^^^^ help: a macro with a similar name exists: `println` + | ^^^^^^^ --> $SRC_DIR/std/src/macros.rs:LL:COL | = note: similarly named macro `println` defined here + | +help: a macro with a similar name exists + | +LL | println!(); + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/did_you_mean/pub-macro-rules.stderr b/tests/ui/did_you_mean/pub-macro-rules.stderr index ba9020460cea3..fb9148748ca1e 100644 --- a/tests/ui/did_you_mean/pub-macro-rules.stderr +++ b/tests/ui/did_you_mean/pub-macro-rules.stderr @@ -2,7 +2,12 @@ error: can't qualify macro_rules invocation with `pub` --> $DIR/pub-macro-rules.rs:2:5 | LL | pub macro_rules! foo { - | ^^^ help: try exporting the macro: `#[macro_export]` + | ^^^ + | +help: try exporting the macro + | +LL | #[macro_export] macro_rules! foo { + | ~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/tests/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr index 68734cd4ccd6b..40e2f59779e32 100644 --- a/tests/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr +++ b/tests/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr @@ -2,13 +2,23 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&Copy` --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 | LL | let _: &Copy + 'static; - | ^^^^^^^^^^^^^^^ help: try adding parentheses: `&(Copy + 'static)` + | ^^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | let _: &(Copy + 'static); + | ~~~~~~~~~~~~~~~~~ error[E0178]: expected a path on the left-hand side of `+`, not `&'static Copy` --> $DIR/trait-object-reference-without-parens-suggestion.rs:6:12 | LL | let _: &'static Copy + 'static; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'static (Copy + 'static)` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | let _: &'static (Copy + 'static); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0038]: the trait `Copy` cannot be made into an object --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 diff --git a/tests/ui/did_you_mean/use_instead_of_import.stderr b/tests/ui/did_you_mean/use_instead_of_import.stderr index 2aac8f68c5ebd..f8d6de8a11768 100644 --- a/tests/ui/did_you_mean/use_instead_of_import.stderr +++ b/tests/ui/did_you_mean/use_instead_of_import.stderr @@ -2,25 +2,45 @@ error: expected item, found `import` --> $DIR/use_instead_of_import.rs:3:1 | LL | import std::{ - | ^^^^^^ help: items are imported using the `use` keyword + | ^^^^^^ + | +help: items are imported using the `use` keyword + | +LL | use std::{ + | ~~~ error: expected item, found `require` --> $DIR/use_instead_of_import.rs:9:1 | LL | require std::time::Duration; - | ^^^^^^^ help: items are imported using the `use` keyword + | ^^^^^^^ + | +help: items are imported using the `use` keyword + | +LL | use std::time::Duration; + | ~~~ error: expected item, found `include` --> $DIR/use_instead_of_import.rs:12:1 | LL | include std::time::Instant; - | ^^^^^^^ help: items are imported using the `use` keyword + | ^^^^^^^ + | +help: items are imported using the `use` keyword + | +LL | use std::time::Instant; + | ~~~ error: expected item, found `using` --> $DIR/use_instead_of_import.rs:15:5 | LL | pub using std::io; - | ^^^^^ help: items are imported using the `use` keyword + | ^^^^^ + | +help: items are imported using the `use` keyword + | +LL | pub use std::io; + | ~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/drop/missing-drop-method.stderr b/tests/ui/drop/missing-drop-method.stderr index 1128f33e627b3..e65a285b2a7cf 100644 --- a/tests/ui/drop/missing-drop-method.stderr +++ b/tests/ui/drop/missing-drop-method.stderr @@ -4,7 +4,10 @@ error[E0046]: not all trait items implemented, missing: `drop` LL | impl Drop for DropNoMethod {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation | - = help: implement the missing item: `fn drop(&mut self) { todo!() }` +help: implement the missing item + | +LL | impl Drop for DropNoMethod {fn drop(&mut self) { todo!() } + | ++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr b/tests/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr index 0d53fb024acab..d5eef3788ac24 100644 --- a/tests/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr +++ b/tests/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr @@ -2,7 +2,7 @@ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:14:13 | LL | pub mod dyn { - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 @@ -12,123 +12,179 @@ note: the lint level is defined here LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ = note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]` +help: you can use a raw identifier to stay compatible + | +LL | pub mod r#dyn { + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:17:20 | LL | pub struct dyn; - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | pub struct r#dyn; + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:22:16 | LL | use outer_mod::dyn::dyn; - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | use outer_mod::r#dyn::dyn; + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:22:21 | LL | use outer_mod::dyn::dyn; - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | use outer_mod::dyn::r#dyn; + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:29:11 | LL | match dyn { dyn => {} } - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | match r#dyn { dyn => {} } + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:29:17 | LL | match dyn { dyn => {} } - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | match dyn { r#dyn => {} } + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:34:17 | LL | macro_defn::dyn(); - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | macro_defn::r#dyn(); + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:44:18 | LL | macro_rules! dyn { - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | macro_rules! r#dyn { + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:52:12 | LL | pub fn dyn() -> ::outer_mod::dyn::dyn { - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | pub fn r#dyn() -> ::outer_mod::dyn::dyn { + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:52:34 | LL | pub fn dyn() -> ::outer_mod::dyn::dyn { - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | pub fn dyn() -> ::outer_mod::r#dyn::dyn { + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:52:39 | LL | pub fn dyn() -> ::outer_mod::dyn::dyn { - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | pub fn dyn() -> ::outer_mod::dyn::r#dyn { + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:59:22 | LL | ::outer_mod::dyn::dyn - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | ::outer_mod::r#dyn::dyn + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:59:27 | LL | ::outer_mod::dyn::dyn - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | ::outer_mod::dyn::r#dyn + | ~~~~~ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:68:23 | LL | pub fn boxed() -> dyn!( - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | pub fn boxed() -> r#dyn!( + | ~~~~~ error: aborting due to 14 previous errors diff --git a/tests/ui/editions/edition-extern-crate-allowed.stderr b/tests/ui/editions/edition-extern-crate-allowed.stderr index dde774c520d71..42ff3b292070d 100644 --- a/tests/ui/editions/edition-extern-crate-allowed.stderr +++ b/tests/ui/editions/edition-extern-crate-allowed.stderr @@ -2,7 +2,7 @@ warning: unused extern crate --> $DIR/edition-extern-crate-allowed.rs:7:1 | LL | extern crate edition_extern_crate_allowed; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/edition-extern-crate-allowed.rs:5:9 @@ -10,6 +10,10 @@ note: the lint level is defined here LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` +help: remove it + | +LL - extern crate edition_extern_crate_allowed; + | warning: 1 warning emitted diff --git a/tests/ui/empty/empty-attributes.stderr b/tests/ui/empty/empty-attributes.stderr index e86dea10c705f..c0514514d1a1a 100644 --- a/tests/ui/empty/empty-attributes.stderr +++ b/tests/ui/empty/empty-attributes.stderr @@ -2,7 +2,7 @@ error: unused attribute --> $DIR/empty-attributes.rs:9:1 | LL | #[repr()] - | ^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^ | = note: attribute `repr` with an empty list has no effect note: the lint level is defined here @@ -10,62 +10,102 @@ note: the lint level is defined here | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[repr()] +LL + + | error: unused attribute --> $DIR/empty-attributes.rs:12:1 | LL | #[target_feature()] - | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^ | = note: attribute `target_feature` with an empty list has no effect +help: remove this attribute + | +LL - #[target_feature()] +LL + + | error: unused attribute --> $DIR/empty-attributes.rs:2:1 | LL | #![allow()] - | ^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^ | = note: attribute `allow` with an empty list has no effect +help: remove this attribute + | +LL - #![allow()] +LL + + | error: unused attribute --> $DIR/empty-attributes.rs:3:1 | LL | #![expect()] - | ^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^ | = note: attribute `expect` with an empty list has no effect +help: remove this attribute + | +LL - #![expect()] +LL + + | error: unused attribute --> $DIR/empty-attributes.rs:4:1 | LL | #![warn()] - | ^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^ | = note: attribute `warn` with an empty list has no effect +help: remove this attribute + | +LL - #![warn()] +LL + + | error: unused attribute --> $DIR/empty-attributes.rs:5:1 | LL | #![deny()] - | ^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^ | = note: attribute `deny` with an empty list has no effect +help: remove this attribute + | +LL - #![deny()] +LL + + | error: unused attribute --> $DIR/empty-attributes.rs:6:1 | LL | #![forbid()] - | ^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^ | = note: attribute `forbid` with an empty list has no effect +help: remove this attribute + | +LL - #![forbid()] +LL + + | error: unused attribute --> $DIR/empty-attributes.rs:7:1 | LL | #![feature()] - | ^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^ | = note: attribute `feature` with an empty list has no effect +help: remove this attribute + | +LL - #![feature()] +LL + + | error: aborting due to 8 previous errors diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index 4604ebeaa8b98..384ef37f030da 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -104,25 +104,34 @@ error[E0599]: no variant or associated item named `Empty3` found for enum `empty --> $DIR/empty-struct-braces-expr.rs:25:19 | LL | let xe3 = XE::Empty3; - | ^^^^^^ - | | - | variant or associated item not found in `XE` - | help: there is a variant with a similar name: `XEmpty3` + | ^^^^^^ variant or associated item not found in `XE` + | +help: there is a variant with a similar name + | +LL | let xe3 = XE::XEmpty3; + | ~~~~~~~ error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 | LL | let xe3 = XE::Empty3(); - | ^^^^^^ - | | - | variant or associated item not found in `XE` - | help: there is a variant with a similar name: `XEmpty3` + | ^^^^^^ variant or associated item not found in `XE` + | +help: there is a variant with a similar name + | +LL | let xe3 = XE::XEmpty3(); + | ~~~~~~~ error[E0599]: no variant named `Empty1` found for enum `empty_struct::XE` --> $DIR/empty-struct-braces-expr.rs:28:9 | LL | XE::Empty1 {}; - | ^^^^^^ help: there is a variant with a similar name: `XEmpty3` + | ^^^^^^ + | +help: there is a variant with a similar name + | +LL | XE::XEmpty3 {}; + | ~~~~~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/empty/empty-struct-tuple-pat.stderr b/tests/ui/empty/empty-struct-tuple-pat.stderr index 45001c7975324..a613215c6be94 100644 --- a/tests/ui/empty/empty-struct-tuple-pat.stderr +++ b/tests/ui/empty/empty-struct-tuple-pat.stderr @@ -5,10 +5,12 @@ LL | struct Empty2(); | ---------------- the tuple struct `Empty2` is defined here ... LL | Empty2 => () - | ^^^^^^ - | | - | cannot be named the same as a tuple struct - | help: try specify the pattern arguments: `Empty2(..)` + | ^^^^^^ cannot be named the same as a tuple struct + | +help: try specify the pattern arguments + | +LL | Empty2(..) => () + | ~~~~~~~~~~ error[E0530]: match bindings cannot shadow tuple structs --> $DIR/empty-struct-tuple-pat.rs:25:9 @@ -17,10 +19,12 @@ LL | use empty_struct::*; | --------------- the tuple struct `XEmpty6` is imported here ... LL | XEmpty6 => () - | ^^^^^^^ - | | - | cannot be named the same as a tuple struct - | help: try specify the pattern arguments: `XEmpty6(..)` + | ^^^^^^^ cannot be named the same as a tuple struct + | +help: try specify the pattern arguments + | +LL | XEmpty6(..) => () + | ~~~~~~~~~~~ error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E::Empty4` --> $DIR/empty-struct-tuple-pat.rs:29:9 @@ -29,7 +33,12 @@ LL | Empty4() | -------- `E::Empty4` defined here ... LL | E::Empty4 => () - | ^^^^^^^^^ help: use the tuple variant pattern syntax instead: `E::Empty4()` + | ^^^^^^^^^ + | +help: use the tuple variant pattern syntax instead + | +LL | E::Empty4() => () + | ~~~~~~~~~~~ error[E0532]: expected unit struct, unit variant or constant, found tuple variant `XE::XEmpty5` --> $DIR/empty-struct-tuple-pat.rs:33:9 diff --git a/tests/ui/empty/empty-struct-unit-pat.stderr b/tests/ui/empty/empty-struct-unit-pat.stderr index 5c0b4cffa9469..145568f7877cf 100644 --- a/tests/ui/empty/empty-struct-unit-pat.stderr +++ b/tests/ui/empty/empty-struct-unit-pat.stderr @@ -95,7 +95,12 @@ LL | Empty4 | ------ `E::Empty4` defined here ... LL | E::Empty4() => () - | ^^^^^^^^^^^ help: use this syntax instead: `E::Empty4` + | ^^^^^^^^^^^ + | +help: use this syntax instead + | +LL | E::Empty4 => () + | ~~~~~~~~~ error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XEmpty4` --> $DIR/empty-struct-unit-pat.rs:41:9 @@ -126,7 +131,12 @@ LL | Empty4 | ------ `E::Empty4` defined here ... LL | E::Empty4(..) => () - | ^^^^^^^^^^^^^ help: use this syntax instead: `E::Empty4` + | ^^^^^^^^^^^^^ + | +help: use this syntax instead + | +LL | E::Empty4 => () + | ~~~~~~~~~ error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XEmpty4` --> $DIR/empty-struct-unit-pat.rs:50:9 diff --git a/tests/ui/enum/enum-variant-type-2.stderr b/tests/ui/enum/enum-variant-type-2.stderr index 216dbda5dd7ad..ec19ec1522347 100644 --- a/tests/ui/enum/enum-variant-type-2.stderr +++ b/tests/ui/enum/enum-variant-type-2.stderr @@ -2,10 +2,12 @@ error[E0573]: expected type, found variant `Foo::Bar` --> $DIR/enum-variant-type-2.rs:7:11 | LL | fn foo(x: Foo::Bar) {} - | ^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `Foo` + | ^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | fn foo(x: Foo) {} + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/enum/nested-enum.stderr b/tests/ui/enum/nested-enum.stderr index 7d6f57e88a826..82567444f4bc3 100644 --- a/tests/ui/enum/nested-enum.stderr +++ b/tests/ui/enum/nested-enum.stderr @@ -2,25 +2,37 @@ error: `enum` definition cannot be nested inside `enum` --> $DIR/nested-enum.rs:2:5 | LL | enum Bar { Baz }, - | ^^^^------------ - | | - | help: consider creating a new `enum` definition instead of nesting + | ^^^^ + | +help: consider creating a new `enum` definition instead of nesting + | +LL - enum Bar { Baz }, +LL + , + | error: `struct` definition cannot be nested inside `enum` --> $DIR/nested-enum.rs:3:5 | LL | struct Quux { field: u8 }, - | ^^^^^^------------------- - | | - | help: consider creating a new `struct` definition instead of nesting + | ^^^^^^ + | +help: consider creating a new `struct` definition instead of nesting + | +LL - struct Quux { field: u8 }, +LL + , + | error: `union` definition cannot be nested inside `enum` --> $DIR/nested-enum.rs:4:5 | LL | union Wibble { field: u8 }, - | ^^^^^--------------------- - | | - | help: consider creating a new `union` definition instead of nesting + | ^^^^^ + | +help: consider creating a new `union` definition instead of nesting + | +LL - union Wibble { field: u8 }, +LL + , + | error: aborting due to 3 previous errors diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr index 5a20bf8b16869..68b0be61b182a 100644 --- a/tests/ui/env-macro/error-recovery-issue-55897.stderr +++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr @@ -17,10 +17,12 @@ error[E0432]: unresolved import `prelude` --> $DIR/error-recovery-issue-55897.rs:1:5 | LL | use prelude::*; - | ^^^^^^^ - | | - | unresolved import - | help: a similar path exists: `std::prelude` + | ^^^^^^^ unresolved import + | +help: a similar path exists + | +LL | use std::prelude::*; + | ~~~~~~~~~~~~ error[E0432]: unresolved import `env` --> $DIR/error-recovery-issue-55897.rs:4:9 diff --git a/tests/ui/error-codes/E0057.stderr b/tests/ui/error-codes/E0057.stderr index 9b0cf069824a6..efd2af6d609bd 100644 --- a/tests/ui/error-codes/E0057.stderr +++ b/tests/ui/error-codes/E0057.stderr @@ -18,16 +18,18 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/E0057.rs:5:13 | LL | let c = f(2, 3); - | ^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^ - unexpected argument of type `{integer}` | note: closure defined here --> $DIR/E0057.rs:2:13 | LL | let f = |x| x * 3; | ^^^ +help: remove the extra argument + | +LL - let c = f(2, 3); +LL + let c = f(2); + | error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0107.stderr b/tests/ui/error-codes/E0107.stderr index 3f540eb08bc7c..c6317270f9b12 100644 --- a/tests/ui/error-codes/E0107.stderr +++ b/tests/ui/error-codes/E0107.stderr @@ -20,113 +20,137 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli --> $DIR/E0107.rs:17:10 | LL | bar: Bar<'a>, - | ^^^---- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^ expected 0 lifetime arguments | note: enum defined here, with 0 lifetime parameters --> $DIR/E0107.rs:6:6 | LL | enum Bar { | ^^^ +help: remove these generics + | +LL - bar: Bar<'a>, +LL + bar: Bar, + | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:21:11 | LL | foo2: Foo<'a, 'b, 'c>, - | ^^^ ------ help: remove these lifetime arguments - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:1:8 | LL | struct Foo<'a>(&'a str); | ^^^ -- +help: remove these lifetime arguments + | +LL - foo2: Foo<'a, 'b, 'c>, +LL + foo2: Foo<'a, >, + | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/E0107.rs:25:11 | LL | qux1: Qux<'a, 'b, i32>, - | ^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove this lifetime argument + | +LL - qux1: Qux<'a, 'b, i32>, +LL + qux1: Qux<'a, , i32>, + | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/E0107.rs:29:11 | LL | qux2: Qux<'a, i32, 'b>, - | ^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove this lifetime argument + | +LL - qux2: Qux<'a, i32, 'b>, +LL + qux2: Qux<'a, i32, >, + | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:33:11 | LL | qux3: Qux<'a, 'b, 'c, i32>, - | ^^^ ------ help: remove these lifetime arguments - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove these lifetime arguments + | +LL - qux3: Qux<'a, 'b, 'c, i32>, +LL + qux3: Qux<'a, , i32>, + | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:37:11 | LL | qux4: Qux<'a, i32, 'b, 'c>, - | ^^^ ------ help: remove these lifetime arguments - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove these lifetime arguments + | +LL - qux4: Qux<'a, i32, 'b, 'c>, +LL + qux4: Qux<'a, i32, >, + | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:41:11 | LL | qux5: Qux<'a, 'b, i32, 'c>, - | ^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove this lifetime argument + | +LL - qux5: Qux<'a, 'b, i32, 'c>, +LL + qux5: Qux<'a, , i32, 'c>, + | error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were supplied --> $DIR/E0107.rs:45:11 | LL | quux: Quux<'a, i32, 'b>, - | ^^^^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/E0107.rs:4:8 | LL | struct Quux(T); | ^^^^ +help: remove this lifetime argument + | +LL - quux: Quux<'a, i32, 'b>, +LL + quux: Quux<, i32, 'b>, + | error[E0107]: trait takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/E0107.rs:55:27 diff --git a/tests/ui/error-codes/E0121.stderr b/tests/ui/error-codes/E0121.stderr index 023d7e011bf3a..6d2cf467435d2 100644 --- a/tests/ui/error-codes/E0121.stderr +++ b/tests/ui/error-codes/E0121.stderr @@ -2,19 +2,23 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/E0121.rs:1:13 | LL | fn foo() -> _ { 5 } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `i32` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn foo() -> i32 { 5 } + | ~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/E0121.rs:3:13 | LL | static BAR: _ = "test"; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `&str` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | static BAR: &str = "test"; + | ~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0191.stderr b/tests/ui/error-codes/E0191.stderr index 63974fd6cbbbd..14d42d03bded7 100644 --- a/tests/ui/error-codes/E0191.stderr +++ b/tests/ui/error-codes/E0191.stderr @@ -5,7 +5,12 @@ LL | type Bar; | -------- `Bar` defined here ... LL | type Foo = dyn Trait; - | ^^^^^ help: specify the associated type: `Trait` + | ^^^^^ + | +help: specify the associated type + | +LL | type Foo = dyn Trait; + | ~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0220.stderr b/tests/ui/error-codes/E0220.stderr index 0e0b5c7084ccd..a06dcdbe1449e 100644 --- a/tests/ui/error-codes/E0220.stderr +++ b/tests/ui/error-codes/E0220.stderr @@ -2,7 +2,12 @@ error[E0220]: associated type `F` not found for `Trait` --> $DIR/E0220.rs:5:22 | LL | type Foo = dyn Trait; - | ^ help: `Trait` has the following associated type: `Bar` + | ^ + | +help: `Trait` has the following associated type + | +LL | type Foo = dyn Trait; + | ~~~ error[E0191]: the value of the associated type `Bar` in `Trait` must be specified --> $DIR/E0220.rs:5:16 @@ -11,7 +16,12 @@ LL | type Bar; | -------- `Bar` defined here ... LL | type Foo = dyn Trait; - | ^^^^^^^^^^^^ help: specify the associated type: `Trait` + | ^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | type Foo = dyn Trait; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0223.stderr b/tests/ui/error-codes/E0223.stderr index e985a4c9bf0d9..d321232818cf6 100644 --- a/tests/ui/error-codes/E0223.stderr +++ b/tests/ui/error-codes/E0223.stderr @@ -2,7 +2,12 @@ error[E0223]: ambiguous associated type --> $DIR/E0223.rs:8:14 | LL | let foo: MyTrait::X; - | ^^^^^^^^^^ help: use fully-qualified syntax: `::X` + | ^^^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | let foo: ::X; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0261.stderr b/tests/ui/error-codes/E0261.stderr index 0eab2dc0ee05f..9ca26dc8459d7 100644 --- a/tests/ui/error-codes/E0261.stderr +++ b/tests/ui/error-codes/E0261.stderr @@ -2,17 +2,23 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/E0261.rs:1:12 | LL | fn foo(x: &'a str) { } - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn foo<'a>(x: &'a str) { } + | ++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/E0261.rs:5:9 | -LL | struct Foo { - | - help: consider introducing lifetime `'a` here: `<'a>` LL | x: &'a str, | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | struct Foo<'a> { + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0401.stderr b/tests/ui/error-codes/E0401.stderr index 5d6878620c89a..fedb064c6bea6 100644 --- a/tests/ui/error-codes/E0401.stderr +++ b/tests/ui/error-codes/E0401.stderr @@ -4,9 +4,12 @@ error[E0401]: can't use generic parameters from outer item LL | fn foo(x: T) { | - type parameter from outer item LL | fn bfnr, W: Fn()>(y: T) { - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `T,` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | fn bfnr, W: Fn()>(y: T) { + | ++ error[E0401]: can't use generic parameters from outer item --> $DIR/E0401.rs:9:16 @@ -14,11 +17,13 @@ error[E0401]: can't use generic parameters from outer item LL | fn foo(x: T) { | - type parameter from outer item ... -LL | fn baz $DIR/E0401.rs:22:25 diff --git a/tests/ui/error-codes/E0407.stderr b/tests/ui/error-codes/E0407.stderr index 889668f58927c..5e83a7ac40fd3 100644 --- a/tests/ui/error-codes/E0407.stderr +++ b/tests/ui/error-codes/E0407.stderr @@ -2,10 +2,12 @@ error[E0407]: method `b` is not a member of trait `Foo` --> $DIR/E0407.rs:9:5 | LL | fn b() {} - | ^^^-^^^^^ - | | | - | | help: there is an associated function with a similar name: `a` - | not a member of trait `Foo` + | ^^^^^^^^^ not a member of trait `Foo` + | +help: there is an associated function with a similar name + | +LL | fn a() {} + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0435.stderr b/tests/ui/error-codes/E0435.stderr index 68d6ddba2a107..33862a3a3132c 100644 --- a/tests/ui/error-codes/E0435.stderr +++ b/tests/ui/error-codes/E0435.stderr @@ -1,10 +1,13 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/E0435.rs:5:17 | -LL | let foo: usize = 42; - | ------- help: consider using `const` instead of `let`: `const foo` LL | let _: [u8; foo]; | ^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const foo: usize = 42; + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0449.stderr b/tests/ui/error-codes/E0449.stderr index c6a98269a19ce..bbd3826c608fe 100644 --- a/tests/ui/error-codes/E0449.stderr +++ b/tests/ui/error-codes/E0449.stderr @@ -2,25 +2,40 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/E0449.rs:11:1 | LL | pub impl Bar {} - | ^^^ help: remove the qualifier + | ^^^ | = note: place qualifiers on individual impl items instead +help: remove the qualifier + | +LL - pub impl Bar {} +LL + impl Bar {} + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/E0449.rs:13:1 | LL | pub impl Foo for Bar { - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub impl Foo for Bar { +LL + impl Foo for Bar { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/E0449.rs:14:5 | LL | pub fn foo() {} - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub fn foo() {} +LL + fn foo() {} + | error: aborting due to 3 previous errors diff --git a/tests/ui/error-codes/E0565-2.stderr b/tests/ui/error-codes/E0565-2.stderr index 42199351c3da2..4f3820b52119e 100644 --- a/tests/ui/error-codes/E0565-2.stderr +++ b/tests/ui/error-codes/E0565-2.stderr @@ -2,9 +2,13 @@ error[E0565]: literal in `deprecated` value must be a string --> $DIR/E0565-2.rs:2:22 | LL | #[deprecated(since = b"1.29", note = "hi")] - | -^^^^^^ - | | - | help: consider removing the prefix + | ^^^^^^^ + | +help: consider removing the prefix + | +LL - #[deprecated(since = b"1.29", note = "hi")] +LL + #[deprecated(since = "1.29", note = "hi")] + | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0586.stderr b/tests/ui/error-codes/E0586.stderr index f562e358cba1a..d359f55704d9d 100644 --- a/tests/ui/error-codes/E0586.stderr +++ b/tests/ui/error-codes/E0586.stderr @@ -2,9 +2,13 @@ error[E0586]: inclusive range with no end --> $DIR/E0586.rs:3:19 | LL | let x = &tmp[1..=]; - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | let x = &tmp[1..]; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0604.stderr b/tests/ui/error-codes/E0604.stderr index e91f74d6b3fd6..d7c944d53d046 100644 --- a/tests/ui/error-codes/E0604.stderr +++ b/tests/ui/error-codes/E0604.stderr @@ -2,10 +2,12 @@ error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/E0604.rs:2:5 | LL | 1u32 as char; - | ^^^^^^^^^^^^ - | | - | invalid cast - | help: try `char::from_u32` instead: `char::from_u32(1u32)` + | ^^^^^^^^^^^^ invalid cast + | +help: try `char::from_u32` instead + | +LL | char::from_u32(1u32); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0617.stderr b/tests/ui/error-codes/E0617.stderr index ea91ad0829230..fdcf0e398f870 100644 --- a/tests/ui/error-codes/E0617.stderr +++ b/tests/ui/error-codes/E0617.stderr @@ -2,31 +2,56 @@ error[E0617]: can't pass `f32` to variadic function --> $DIR/E0617.rs:7:36 | LL | printf(::std::ptr::null(), 0f32); - | ^^^^ help: cast the value to `c_double`: `0f32 as c_double` + | ^^^^ + | +help: cast the value to `c_double` + | +LL | printf(::std::ptr::null(), 0f32 as c_double); + | ~~~~~~~~~~~~~~~~ error[E0617]: can't pass `i8` to variadic function --> $DIR/E0617.rs:10:36 | LL | printf(::std::ptr::null(), 0i8); - | ^^^ help: cast the value to `c_int`: `0i8 as c_int` + | ^^^ + | +help: cast the value to `c_int` + | +LL | printf(::std::ptr::null(), 0i8 as c_int); + | ~~~~~~~~~~~~ error[E0617]: can't pass `i16` to variadic function --> $DIR/E0617.rs:13:36 | LL | printf(::std::ptr::null(), 0i16); - | ^^^^ help: cast the value to `c_int`: `0i16 as c_int` + | ^^^^ + | +help: cast the value to `c_int` + | +LL | printf(::std::ptr::null(), 0i16 as c_int); + | ~~~~~~~~~~~~~ error[E0617]: can't pass `u8` to variadic function --> $DIR/E0617.rs:16:36 | LL | printf(::std::ptr::null(), 0u8); - | ^^^ help: cast the value to `c_uint`: `0u8 as c_uint` + | ^^^ + | +help: cast the value to `c_uint` + | +LL | printf(::std::ptr::null(), 0u8 as c_uint); + | ~~~~~~~~~~~~~ error[E0617]: can't pass `u16` to variadic function --> $DIR/E0617.rs:19:36 | LL | printf(::std::ptr::null(), 0u16); - | ^^^^ help: cast the value to `c_uint`: `0u16 as c_uint` + | ^^^^ + | +help: cast the value to `c_uint` + | +LL | printf(::std::ptr::null(), 0u16 as c_uint); + | ~~~~~~~~~~~~~~ error[E0617]: can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function --> $DIR/E0617.rs:22:36 diff --git a/tests/ui/error-codes/E0620.stderr b/tests/ui/error-codes/E0620.stderr index 644ba813c9608..bdb28eee74100 100644 --- a/tests/ui/error-codes/E0620.stderr +++ b/tests/ui/error-codes/E0620.stderr @@ -2,9 +2,12 @@ error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` --> $DIR/E0620.rs:2:16 | LL | let _foo = &[1_usize, 2] as [usize]; - | ^^^^^^^^^^^^^^^^^------- - | | - | help: try casting to a reference instead: `&[usize]` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try casting to a reference instead + | +LL | let _foo = &[1_usize, 2] as &[usize]; + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/error-festival.stderr b/tests/ui/error-festival.stderr index 9d75671c4e6b4..f42b753d89b72 100644 --- a/tests/ui/error-festival.stderr +++ b/tests/ui/error-festival.stderr @@ -2,7 +2,12 @@ error[E0425]: cannot find value `y` in this scope --> $DIR/error-festival.rs:14:5 | LL | y = 2; - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL | x = 2; + | ~ error[E0603]: constant `FOO` is private --> $DIR/error-festival.rs:22:10 @@ -48,10 +53,12 @@ error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/error-festival.rs:25:5 | LL | 0u32 as char; - | ^^^^^^^^^^^^ - | | - | invalid cast - | help: try `char::from_u32` instead: `char::from_u32(0u32)` + | ^^^^^^^^^^^^ invalid cast + | +help: try `char::from_u32` instead + | +LL | char::from_u32(0u32); + | ~~~~~~~~~~~~~~~~~~~~ error[E0605]: non-primitive cast: `u8` as `Vec` --> $DIR/error-festival.rs:29:5 diff --git a/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr b/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr index 7aa66be0d0977..56c5b227ffd4e 100644 --- a/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr +++ b/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr @@ -2,12 +2,17 @@ error[E0423]: expected value, found struct `remapped_dep::SomeStruct` --> $DIR/remap-path-prefix-reverse.rs:16:13 | LL | let _ = remapped_dep::SomeStruct; // ~ERROR E0423 - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `remapped_dep::SomeStruct {}` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | ::: remapped-aux/remapped_dep.rs:4:1 | LL | pub struct SomeStruct {} // This line should be show as part of the error. | --------------------- `remapped_dep::SomeStruct` defined here + | +help: use struct literal syntax instead + | +LL | let _ = remapped_dep::SomeStruct {}; // ~ERROR E0423 + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr b/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr index 7aa66be0d0977..56c5b227ffd4e 100644 --- a/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr +++ b/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr @@ -2,12 +2,17 @@ error[E0423]: expected value, found struct `remapped_dep::SomeStruct` --> $DIR/remap-path-prefix-reverse.rs:16:13 | LL | let _ = remapped_dep::SomeStruct; // ~ERROR E0423 - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `remapped_dep::SomeStruct {}` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | ::: remapped-aux/remapped_dep.rs:4:1 | LL | pub struct SomeStruct {} // This line should be show as part of the error. | --------------------- `remapped_dep::SomeStruct` defined here + | +help: use struct literal syntax instead + | +LL | let _ = remapped_dep::SomeStruct {}; // ~ERROR E0423 + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/expr/if/attrs/else-attrs.stderr b/tests/ui/expr/if/attrs/else-attrs.stderr index 2733377054d7d..4dac9e3b878cb 100644 --- a/tests/ui/expr/if/attrs/else-attrs.stderr +++ b/tests/ui/expr/if/attrs/else-attrs.stderr @@ -9,12 +9,17 @@ error: outer attributes are not allowed on `if` and `else` branches | LL | } else #[attr] if false { | _______----_^^^^^^^_- - | | | | - | | | help: remove the attributes + | | | | | the branch belongs to this `else` LL | | } else { LL | | } | |_____- the attributes are attached to this branch + | +help: remove the attributes + | +LL - } else #[attr] if false { +LL + } else if false { + | error: expected expression, found keyword `else` --> $DIR/else-attrs.rs:20:15 diff --git a/tests/ui/expr/if/bad-if-let-suggestion.stderr b/tests/ui/expr/if/bad-if-let-suggestion.stderr index 0d1f895bd82bf..59bce4af7ecb2 100644 --- a/tests/ui/expr/if/bad-if-let-suggestion.stderr +++ b/tests/ui/expr/if/bad-if-let-suggestion.stderr @@ -27,7 +27,12 @@ LL | fn a() { | ------ similarly named function `a` defined here ... LL | if (i + j) = i {} - | ^ help: a function with a similar name exists: `a` + | ^ + | +help: a function with a similar name exists + | +LL | if (a + j) = i {} + | ~ error[E0425]: cannot find value `j` in this scope --> $DIR/bad-if-let-suggestion.rs:9:13 @@ -36,7 +41,12 @@ LL | fn a() { | ------ similarly named function `a` defined here ... LL | if (i + j) = i {} - | ^ help: a function with a similar name exists: `a` + | ^ + | +help: a function with a similar name exists + | +LL | if (i + a) = i {} + | ~ error[E0425]: cannot find value `i` in this scope --> $DIR/bad-if-let-suggestion.rs:9:18 @@ -45,7 +55,12 @@ LL | fn a() { | ------ similarly named function `a` defined here ... LL | if (i + j) = i {} - | ^ help: a function with a similar name exists: `a` + | ^ + | +help: a function with a similar name exists + | +LL | if (i + j) = a {} + | ~ error[E0425]: cannot find value `x` in this scope --> $DIR/bad-if-let-suggestion.rs:16:8 @@ -54,7 +69,12 @@ LL | fn a() { | ------ similarly named function `a` defined here ... LL | if x[0] = 1 {} - | ^ help: a function with a similar name exists: `a` + | ^ + | +help: a function with a similar name exists + | +LL | if a[0] = 1 {} + | ~ error[E0308]: mismatched types --> $DIR/bad-if-let-suggestion.rs:2:8 diff --git a/tests/ui/expr/if/if-else-type-mismatch.stderr b/tests/ui/expr/if/if-else-type-mismatch.stderr index f1fffdb1e7ef8..5f91d14a05cb9 100644 --- a/tests/ui/expr/if/if-else-type-mismatch.stderr +++ b/tests/ui/expr/if/if-else-type-mismatch.stderr @@ -35,15 +35,18 @@ error[E0308]: `if` and `else` have incompatible types LL | let _ = if true { | _____________- LL | | 3u32; - | | ----- - | | | | - | | | help: consider removing this semicolon - | | expected because of this + | | ----- expected because of this LL | | } else { LL | | 4u32 | | ^^^^ expected `()`, found `u32` LL | | }; | |_____- `if` and `else` have incompatible types + | +help: consider removing this semicolon + | +LL - 3u32; +LL + 3u32 + | error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:19:9 @@ -54,12 +57,15 @@ LL | | 5u32 | | ---- expected because of this LL | | } else { LL | | 6u32; - | | ^^^^- - | | | | - | | | help: consider removing this semicolon - | | expected `u32`, found `()` + | | ^^^^^ expected `u32`, found `()` LL | | }; | |_____- `if` and `else` have incompatible types + | +help: consider removing this semicolon + | +LL - 6u32; +LL + 6u32 + | error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:25:9 diff --git a/tests/ui/expr/issue-22933-2.stderr b/tests/ui/expr/issue-22933-2.stderr index 8cda8598f3c4f..dadc31213621c 100644 --- a/tests/ui/expr/issue-22933-2.stderr +++ b/tests/ui/expr/issue-22933-2.stderr @@ -5,10 +5,12 @@ LL | enum Delicious { | -------------- variant or associated item `PIE` not found for this enum ... LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, - | ^^^ - | | - | variant or associated item not found in `Delicious` - | help: there is a variant with a similar name: `Pie` + | ^^^ variant or associated item not found in `Delicious` + | +help: there is a variant with a similar name + | +LL | ApplePie = Delicious::Apple as isize | Delicious::Pie as isize, + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/extern/extern-const.stderr b/tests/ui/extern/extern-const.stderr index 31954ca2c8432..441495866cd9b 100644 --- a/tests/ui/extern/extern-const.stderr +++ b/tests/ui/extern/extern-const.stderr @@ -2,11 +2,13 @@ error: extern items cannot be `const` --> $DIR/extern-const.rs:14:11 | LL | const rust_dbg_static_mut: c_int; - | ------^^^^^^^^^^^^^^^^^^^ - | | - | help: try using a static value: `static` + | ^^^^^^^^^^^^^^^^^^^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: try using a static value + | +LL | static rust_dbg_static_mut: c_int; + | ~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/extern/extern-ffi-fn-with-body.stderr b/tests/ui/extern/extern-ffi-fn-with-body.stderr index dc34490b39a00..e6b7d1fe2bbae 100644 --- a/tests/ui/extern/extern-ffi-fn-with-body.stderr +++ b/tests/ui/extern/extern-ffi-fn-with-body.stderr @@ -1,18 +1,17 @@ error: incorrect function inside `extern` block --> $DIR/extern-ffi-fn-with-body.rs:2:8 | -LL | extern "C" { - | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | fn foo() -> i32 { - | ________^^^__________- - | | | - | | cannot have a body -LL | | return 0; -LL | | } - | |_____- help: remove the invalid body: `;` +LL | extern "C" { + | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body +LL | fn foo() -> i32 { + | ^^^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | fn foo() -> i32 ; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/extern/extern-no-mangle.stderr b/tests/ui/extern/extern-no-mangle.stderr index f20ee158ac433..1de8979546486 100644 --- a/tests/ui/extern/extern-no-mangle.stderr +++ b/tests/ui/extern/extern-no-mangle.stderr @@ -18,25 +18,33 @@ warning: `#[no_mangle]` has no effect on a foreign static --> $DIR/extern-no-mangle.rs:11:5 | LL | #[no_mangle] - | ^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^ ... LL | pub static FOO: u8; | ------------------- foreign static | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: symbol names in extern blocks are not mangled +help: remove this attribute + | +LL - #[no_mangle] + | warning: `#[no_mangle]` has no effect on a foreign function --> $DIR/extern-no-mangle.rs:16:5 | LL | #[no_mangle] - | ^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^ ... LL | pub fn bar(); | ------------- foreign function | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: symbol names in extern blocks are not mangled +help: remove this attribute + | +LL - #[no_mangle] + | warning: 3 warnings emitted diff --git a/tests/ui/extern/issue-112363-extern-item-where-clauses-debug-ice.stderr b/tests/ui/extern/issue-112363-extern-item-where-clauses-debug-ice.stderr index 039e50b5e12da..78977a2f2be94 100644 --- a/tests/ui/extern/issue-112363-extern-item-where-clauses-debug-ice.stderr +++ b/tests/ui/extern/issue-112363-extern-item-where-clauses-debug-ice.stderr @@ -16,9 +16,14 @@ error: `type`s inside `extern` blocks cannot have `where` clauses LL | extern "C" { | ---------- `extern` block begins here LL | type Item = [T] where [T]: Sized; - | ^^^^^^^^^^^^^^^^ help: remove the `where` clause + | ^^^^^^^^^^^^^^^^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the `where` clause + | +LL - type Item = [T] where [T]: Sized; +LL + type Item = [T] ; + | error[E0412]: cannot find type `T` in this scope --> $DIR/issue-112363-extern-item-where-clauses-debug-ice.rs:2:28 diff --git a/tests/ui/extern/issue-47725.stderr b/tests/ui/extern/issue-47725.stderr index 0d3b77b46084c..bd30f97ca58b0 100644 --- a/tests/ui/extern/issue-47725.stderr +++ b/tests/ui/extern/issue-47725.stderr @@ -2,7 +2,12 @@ error: malformed `link_name` attribute input --> $DIR/issue-47725.rs:17:1 | LL | #[link_name] - | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` + | ^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[link_name = "name"] + | warning: attribute should be applied to a foreign function or static --> $DIR/issue-47725.rs:3:1 diff --git a/tests/ui/extern/issue-95829.stderr b/tests/ui/extern/issue-95829.stderr index 16504d1f0c9d0..e2dad0861148b 100644 --- a/tests/ui/extern/issue-95829.stderr +++ b/tests/ui/extern/issue-95829.stderr @@ -1,19 +1,17 @@ error: incorrect function inside `extern` block --> $DIR/issue-95829.rs:4:14 | -LL | extern { - | ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | async fn L() { - | ______________^___- - | | | - | | cannot have a body -LL | | -LL | | async fn M() {} -LL | | } - | |_____- help: remove the invalid body: `;` +LL | extern { + | ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body +LL | async fn L() { + | ^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | async fn L() ; + | ~ error: functions in `extern` blocks cannot have qualifiers --> $DIR/issue-95829.rs:4:5 @@ -21,7 +19,13 @@ error: functions in `extern` blocks cannot have qualifiers LL | extern { | ------ in this `extern` block LL | async fn L() { - | ^^^^^ help: remove this qualifier + | ^^^^^ + | +help: remove this qualifier + | +LL - async fn L() { +LL + fn L() { + | error: aborting due to 2 previous errors diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr index 00b8c0eef989a..7944d86e55d20 100644 --- a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr +++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr @@ -1,9 +1,6 @@ error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:25 | -LL | fn ptr(self: Ptr); - | --------- help: consider changing method `ptr`'s `self` parameter to be `&self`: `&Self` -... LL | Ptr(Box::new(4)) as Ptr; | ^^^^^^^^^^^^^^ `Trait` cannot be made into an object | @@ -15,13 +12,14 @@ LL | trait Trait { LL | fn ptr(self: Ptr); | ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on = help: only type `i32` implements the trait, consider using it directly instead +help: consider changing method `ptr`'s `self` parameter to be `&self` + | +LL | fn ptr(self: &Self); + | ~~~~~ error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:5 | -LL | fn ptr(self: Ptr); - | --------- help: consider changing method `ptr`'s `self` parameter to be `&self`: `&Self` -... LL | Ptr(Box::new(4)) as Ptr; | ^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object | @@ -34,6 +32,10 @@ LL | fn ptr(self: Ptr); | ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on = help: only type `i32` implements the trait, consider using it directly instead = note: required for the cast from `Ptr<{integer}>` to `Ptr` +help: consider changing method `ptr`'s `self` parameter to be `&self` + | +LL | fn ptr(self: &Self); + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index 2fcad98be9f73..dd6d5237862ed 100644 --- a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -2,10 +2,12 @@ error[E0432]: unresolved import `core` --> $DIR/feature-gate-extern_absolute_paths.rs:1:5 | LL | use core::default; - | ^^^^ - | | - | maybe a missing crate `core`? - | help: try using `std` instead of `core`: `std` + | ^^^^ maybe a missing crate `core`? + | +help: try using `std` instead of `core` + | +LL | use std::default; + | ~~~ error[E0433]: failed to resolve: maybe a missing crate `core`? --> $DIR/feature-gate-extern_absolute_paths.rs:4:19 diff --git a/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr b/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr index 97370f0489b56..717274f061ec6 100644 --- a/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr +++ b/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr @@ -14,11 +14,15 @@ error[E0658]: using `_` for array lengths is unstable --> $DIR/feature-gate-generic_arg_infer.rs:14:18 | LL | let _y: [u8; _] = [0; 3]; - | ^ help: consider specifying the array length: `3` + | ^ | = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider specifying the array length + | +LL | let _y: [u8; 3] = [0; 3]; + | ~ error[E0747]: type provided when a constant was expected --> $DIR/feature-gate-generic_arg_infer.rs:20:20 diff --git a/tests/ui/feature-gates/feature-gate-min_const_fn.stderr b/tests/ui/feature-gates/feature-gate-min_const_fn.stderr index 0b16f9abb7071..3aa2cee92bd8e 100644 --- a/tests/ui/feature-gates/feature-gate-min_const_fn.stderr +++ b/tests/ui/feature-gates/feature-gate-min_const_fn.stderr @@ -2,28 +2,37 @@ error[E0379]: functions in traits cannot be declared const --> $DIR/feature-gate-min_const_fn.rs:6:5 | LL | const fn foo() -> u32; - | ^^^^^- - | | - | functions in traits cannot be const - | help: remove the `const` + | ^^^^^ functions in traits cannot be const + | +help: remove the `const` + | +LL - const fn foo() -> u32; +LL + fn foo() -> u32; + | error[E0379]: functions in traits cannot be declared const --> $DIR/feature-gate-min_const_fn.rs:7:5 | LL | const fn bar() -> u32 { 0 } - | ^^^^^- - | | - | functions in traits cannot be const - | help: remove the `const` + | ^^^^^ functions in traits cannot be const + | +help: remove the `const` + | +LL - const fn bar() -> u32 { 0 } +LL + fn bar() -> u32 { 0 } + | error[E0379]: functions in trait impls cannot be declared const --> $DIR/feature-gate-min_const_fn.rs:11:5 | LL | const fn foo() -> u32 { 0 } - | ^^^^^- - | | - | functions in trait impls cannot be const - | help: remove the `const` + | ^^^^^ functions in trait impls cannot be const + | +help: remove the `const` + | +LL - const fn foo() -> u32 { 0 } +LL + fn foo() -> u32 { 0 } + | error: aborting due to 3 previous errors diff --git a/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr b/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr index d1f4ed5cb04b8..696326157ce29 100644 --- a/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr +++ b/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr @@ -2,12 +2,13 @@ error[E0600]: cannot apply unary operator `-` to type `usize` --> $DIR/feature-gate-negate-unsigned.rs:10:23 | LL | let _max: usize = -1; - | ^^ - | | - | cannot apply unary operator `-` - | help: you may have meant the maximum value of `usize`: `usize::MAX` + | ^^ cannot apply unary operator `-` | = note: unsigned values cannot be negated +help: you may have meant the maximum value of `usize` + | +LL | let _max: usize = usize::MAX; + | ~~~~~~~~~~ error[E0600]: cannot apply unary operator `-` to type `u8` --> $DIR/feature-gate-negate-unsigned.rs:14:14 diff --git a/tests/ui/feature-gates/feature-gate-never_patterns.stderr b/tests/ui/feature-gates/feature-gate-never_patterns.stderr index 9f94e96203518..70284d5810514 100644 --- a/tests/ui/feature-gates/feature-gate-never_patterns.stderr +++ b/tests/ui/feature-gates/feature-gate-never_patterns.stderr @@ -57,19 +57,34 @@ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:38:9 | LL | Some(_) - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => todo!(), + | +++++++++++ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:43:9 | LL | Some(_) if false, - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => todo!(), if false, + | +++++++++++ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:45:9 | LL | Some(_) if false - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => todo!(), if false + | +++++++++++ error[E0658]: `!` patterns are experimental --> $DIR/feature-gate-never_patterns.rs:50:13 @@ -95,19 +110,35 @@ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:64:9 | LL | Some(_) - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => todo!(), + | +++++++++++ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:70:9 | LL | Some(_) if false - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => todo!(), if false + | +++++++++++ error: a guard on a never pattern will never be run --> $DIR/feature-gate-never_patterns.rs:54:19 | LL | Err(!) if false, - | ^^^^^ help: remove this guard + | ^^^^^ + | +help: remove this guard + | +LL - Err(!) if false, +LL + Err(!) if , + | error: aborting due to 13 previous errors diff --git a/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr b/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr index fc7dd7923f7a8..aad4a217e5e01 100644 --- a/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr +++ b/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr @@ -2,10 +2,12 @@ error[E0573]: expected type, found variant `Alpha::One` --> $DIR/feature-gate-offset-of-enum.rs:11:16 | LL | offset_of!(Alpha::One, 0); - | ^^^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `Alpha` + | ^^^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | offset_of!(Alpha, 0); + | ~~~~~ error[E0658]: using enums in offset_of is experimental --> $DIR/feature-gate-offset-of-enum.rs:12:23 diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 1b9febd431d6f..041c88fd118de 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -89,13 +89,14 @@ error[E0053]: method `call` has an incompatible type for trait --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:32 | LL | extern "rust-call" fn call(self, args: ()) -> () {} - | ^^^^ - | | - | expected `&Foo`, found `Foo` - | help: change the self-receiver type to match the trait: `&self` + | ^^^^ expected `&Foo`, found `Foo` | = note: expected signature `extern "rust-call" fn(&Foo, ()) -> _` found signature `extern "rust-call" fn(Foo, ())` +help: change the self-receiver type to match the trait + | +LL | extern "rust-call" fn call(&self, args: ()) -> () {} + | ~~~~~ error[E0183]: manual implementations of `FnOnce` are experimental --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 @@ -141,7 +142,10 @@ error[E0046]: not all trait items implemented, missing: `Output` LL | impl FnOnce() for Foo1 { | ^^^^^^^^^^^^^^^^^^^^^^ missing `Output` in implementation | - = help: implement the missing item: `type Output = /* Type */;` +help: implement the missing item + | +LL + type Output = /* Type */; + | error[E0277]: expected a `FnOnce()` closure, found `Bar` --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20 @@ -158,13 +162,14 @@ error[E0053]: method `call_mut` has an incompatible type for trait --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:36 | LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {} - | ^^^^^ - | | - | types differ in mutability - | help: change the self-receiver type to match the trait: `&mut self` + | ^^^^^ types differ in mutability | = note: expected signature `extern "rust-call" fn(&mut Bar, ()) -> _` found signature `extern "rust-call" fn(&Bar, ())` +help: change the self-receiver type to match the trait + | +LL | extern "rust-call" fn call_mut(&mut self, args: ()) -> () {} + | ~~~~~~~~~ error[E0046]: not all trait items implemented, missing: `Output` --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:1 @@ -172,7 +177,10 @@ error[E0046]: not all trait items implemented, missing: `Output` LL | impl FnOnce<()> for Baz { | ^^^^^^^^^^^^^^^^^^^^^^^ missing `Output` in implementation | - = help: implement the missing item: `type Output = /* Type */;` +help: implement the missing item + | +LL + type Output = /* Type */; + | error: aborting due to 18 previous errors diff --git a/tests/ui/feature-gates/gated-bad-feature.stderr b/tests/ui/feature-gates/gated-bad-feature.stderr index 2d01bdf3c1dff..ece6f733a19a7 100644 --- a/tests/ui/feature-gates/gated-bad-feature.stderr +++ b/tests/ui/feature-gates/gated-bad-feature.stderr @@ -2,13 +2,23 @@ error[E0556]: malformed `feature` attribute input --> $DIR/gated-bad-feature.rs:1:25 | LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)] - | ^^^^^^^^ help: expected just one word: `foo` + | ^^^^^^^^ + | +help: expected just one word + | +LL | #![feature(foo_bar_baz, foo, foo = "baz", foo)] + | ~~~ error[E0556]: malformed `feature` attribute input --> $DIR/gated-bad-feature.rs:1:35 | LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)] - | ^^^^^^^^^^^ help: expected just one word: `foo` + | ^^^^^^^^^^^ + | +help: expected just one word + | +LL | #![feature(foo_bar_baz, foo(bar), foo, foo)] + | ~~~ error[E0557]: feature has been removed --> $DIR/gated-bad-feature.rs:8:12 @@ -20,13 +30,23 @@ error: malformed `feature` attribute input --> $DIR/gated-bad-feature.rs:6:1 | LL | #![feature] - | ^^^^^^^^^^^ help: must be of the form: `#![feature(name1, name2, ...)]` + | ^^^^^^^^^^^ + | +help: must be of the form + | +LL | #![feature(name1, name2, ...)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `feature` attribute input --> $DIR/gated-bad-feature.rs:7:1 | LL | #![feature = "foo"] - | ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![feature(name1, name2, ...)]` + | ^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #![feature(name1, name2, ...)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0635]: unknown feature `foo_bar_baz` --> $DIR/gated-bad-feature.rs:1:12 diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr index e43cef7c15078..ad36fc33829dc 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr @@ -46,15 +46,24 @@ warning: use of deprecated attribute `crate_id`: no longer used --> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1 | LL | #![crate_id = "10"] - | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default +help: remove this attribute + | +LL - #![crate_id = "10"] + | warning: use of deprecated attribute `no_start`: no longer used --> $DIR/issue-43106-gating-of-builtin-attrs.rs:94:1 | LL | #![no_start] - | ^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #![no_start] + | warning: unknown lint: `x5400` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:105:8 diff --git a/tests/ui/fmt/format-args-capture-issue-102057.stderr b/tests/ui/fmt/format-args-capture-issue-102057.stderr index f2d625e7f8dc8..0ac5684c09a15 100644 --- a/tests/ui/fmt/format-args-capture-issue-102057.stderr +++ b/tests/ui/fmt/format-args-capture-issue-102057.stderr @@ -14,31 +14,56 @@ error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:9:22 | LL | format!("\x7Ba} {b}"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL | format!("\x7Ba} {a}"); + | ~ error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:11:25 | LL | format!("\x7Ba\x7D {b}"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL | format!("\x7Ba\x7D {a}"); + | ~ error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:13:25 | LL | format!("\x7Ba} \x7Bb}"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL | format!("\x7Ba} \x7Ba}"); + | ~ error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:15:28 | LL | format!("\x7Ba\x7D \x7Bb}"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL | format!("\x7Ba\x7D \x7Ba}"); + | ~ error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:17:28 | LL | format!("\x7Ba\x7D \x7Bb\x7D"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL | format!("\x7Ba\x7D \x7Ba\x7D"); + | ~ error: aborting due to 7 previous errors diff --git a/tests/ui/fmt/format-args-capture-issue-94010.stderr b/tests/ui/fmt/format-args-capture-issue-94010.stderr index ed90dc855360a..92946be532298 100644 --- a/tests/ui/fmt/format-args-capture-issue-94010.stderr +++ b/tests/ui/fmt/format-args-capture-issue-94010.stderr @@ -4,7 +4,12 @@ error[E0425]: cannot find value `foo` in this scope LL | const FOO: i32 = 123; | --------------------- similarly named constant `FOO` defined here LL | println!("{foo:X}"); - | ^^^ help: a constant with a similar name exists (notice the capitalization): `FOO` + | ^^^ + | +help: a constant with a similar name exists (notice the capitalization difference) + | +LL | println!("{FOO:X}"); + | ~~~ error[E0425]: cannot find value `foo` in this scope --> $DIR/format-args-capture-issue-94010.rs:5:18 @@ -13,7 +18,12 @@ LL | const FOO: i32 = 123; | --------------------- similarly named constant `FOO` defined here ... LL | println!("{:.foo$}", 0); - | ^^^ help: a constant with a similar name exists (notice the capitalization): `FOO` + | ^^^ + | +help: a constant with a similar name exists (notice the capitalization difference) + | +LL | println!("{:.FOO$}", 0); + | ~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/fmt/format-string-error-2.stderr b/tests/ui/fmt/format-string-error-2.stderr index dfd24bf60ad52..d5fe4081ac811 100644 --- a/tests/ui/fmt/format-string-error-2.stderr +++ b/tests/ui/fmt/format-string-error-2.stderr @@ -2,7 +2,12 @@ error: incorrect unicode escape sequence --> $DIR/format-string-error-2.rs:77:20 | LL | println!("\x7B}\u8 {", 1); - | ^^^ help: format of unicode escape sequences uses braces: `\u{8}` + | ^^^ + | +help: format of unicode escape sequences uses braces + | +LL | println!("\x7B}\u{8} {", 1); + | ~~~~~ error: invalid format string: expected `'}'`, found `'a'` --> $DIR/format-string-error-2.rs:5:5 diff --git a/tests/ui/fmt/ifmt-bad-arg.stderr b/tests/ui/fmt/ifmt-bad-arg.stderr index 09ce3dca4117e..7e97add2fe7d9 100644 --- a/tests/ui/fmt/ifmt-bad-arg.stderr +++ b/tests/ui/fmt/ifmt-bad-arg.stderr @@ -166,11 +166,13 @@ error: argument never used --> $DIR/ifmt-bad-arg.rs:56:27 | LL | format!("foo %s baz", "bar"); - | -- ^^^^^ argument never used - | | - | help: format specifiers use curly braces: `{}` + | ^^^^^ argument never used | = note: printf formatting is not supported; see the documentation for `std::fmt` +help: format specifiers use curly braces + | +LL | format!("foo {} baz", "bar"); + | ~~ error: invalid format string: expected `'}'`, found `'t'` --> $DIR/ifmt-bad-arg.rs:75:1 diff --git a/tests/ui/fmt/no-inline-literals-out-of-range.stderr b/tests/ui/fmt/no-inline-literals-out-of-range.stderr index 78ec4888c27a3..50dc9584a21fe 100644 --- a/tests/ui/fmt/no-inline-literals-out-of-range.stderr +++ b/tests/ui/fmt/no-inline-literals-out-of-range.stderr @@ -19,9 +19,13 @@ error: literal out of range for `u8` --> $DIR/no-inline-literals-out-of-range.rs:6:24 | LL | format_args!("{}", 0xffff_ffff_u8); // issue #116633 - | ^^^^^^^^^^^^^^ help: consider using the type `u32` instead: `0xffff_ffff_u32` + | ^^^^^^^^^^^^^^ | = note: the literal `0xffff_ffff_u8` (decimal `4294967295`) does not fit into the type `u8` and will become `255u8` +help: consider using the type `u32` instead + | +LL | format_args!("{}", 0xffff_ffff_u32); // issue #116633 + | ~~~~~~~~~~~~~~~ error: literal out of range for `usize` --> $DIR/no-inline-literals-out-of-range.rs:8:24 diff --git a/tests/ui/fmt/raw-idents.stderr b/tests/ui/fmt/raw-idents.stderr index 2ddc114d28614..64a932af1d48c 100644 --- a/tests/ui/fmt/raw-idents.stderr +++ b/tests/ui/fmt/raw-idents.stderr @@ -2,23 +2,27 @@ error: invalid format string: raw identifiers are not supported --> $DIR/raw-idents.rs:8:22 | LL | println!("It is {r#type}"); - | --^^^^ - | | - | raw identifier used here in format string - | help: remove the `r#` + | ^^^^^^ raw identifier used here in format string | = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#` +help: remove the `r#` + | +LL - println!("It is {r#type}"); +LL + println!("It is {type}"); + | error: invalid format string: raw identifiers are not supported --> $DIR/raw-idents.rs:9:31 | LL | println!(r##"It still is {r#type}"##); - | --^^^^ - | | - | raw identifier used here in format string - | help: remove the `r#` + | ^^^^^^ raw identifier used here in format string | = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#` +help: remove the `r#` + | +LL - println!(r##"It still is {r#type}"##); +LL + println!(r##"It still is {type}"##); + | error: invalid format string: raw identifiers are not supported --> $DIR/raw-idents.rs:10:14 @@ -33,12 +37,14 @@ error: invalid format string: raw identifiers are not supported --> $DIR/raw-idents.rs:11:16 | LL | println!("{\x72\x23type:?}"); - | --------^^^^ - | | - | raw identifier used here in format string - | help: remove the `r#` + | ^^^^^^^^^^^^ raw identifier used here in format string | = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#` +help: remove the `r#` + | +LL - println!("{\x72\x23type:?}"); +LL + println!("{type:?}"); + | error: aborting due to 4 previous errors diff --git a/tests/ui/fn/fn-compare-mismatch.stderr b/tests/ui/fn/fn-compare-mismatch.stderr index b4e71e75fdb9a..98c06b847faa1 100644 --- a/tests/ui/fn/fn-compare-mismatch.stderr +++ b/tests/ui/fn/fn-compare-mismatch.stderr @@ -20,7 +20,10 @@ LL | let x = f == g; = note: expected fn item `fn() {f}` found fn item `fn() {g}` = note: different fn items have unique types, even if their signatures are the same - = help: consider casting both fn items to fn pointers using `as fn()` +help: consider casting both fn items to fn pointers using `as fn()` + | +LL | let x = f == g as fn(); + | ~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/fn/fn-item-type.stderr b/tests/ui/fn/fn-item-type.stderr index 76cdbcceac841..1c0a6b19ffef8 100644 --- a/tests/ui/fn/fn-item-type.stderr +++ b/tests/ui/fn/fn-item-type.stderr @@ -18,7 +18,10 @@ LL | fn eq(x: T, y: T) {} | | | | | `y` needs to match the fn item type of this parameter | `x` and `y` all reference this parameter T - = help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` +help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` + | +LL | eq(foo::, bar:: as fn(isize) -> isize); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/fn-item-type.rs:29:19 @@ -40,7 +43,10 @@ LL | fn eq(x: T, y: T) {} | | | | | `y` needs to match the fn item type of this parameter | `x` and `y` all reference this parameter T - = help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` +help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` + | +LL | eq(foo::, foo:: as fn(isize) -> isize); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/fn-item-type.rs:34:23 @@ -62,7 +68,10 @@ LL | fn eq(x: T, y: T) {} | | | | | `y` needs to match the fn item type of this parameter | `x` and `y` all reference this parameter T - = help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` +help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` + | +LL | eq(bar::, bar::> as fn(isize) -> isize); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/fn-item-type.rs:40:26 @@ -84,7 +93,10 @@ LL | fn eq(x: T, y: T) {} | | | | | `y` needs to match the fn item type of this parameter | `x` and `y` all reference this parameter T - = help: consider casting both fn items to fn pointers using `as fn()` +help: consider casting both fn items to fn pointers using `as fn()` + | +LL | eq(::foo, ::foo as fn()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/fn-item-type.rs:45:19 diff --git a/tests/ui/fn/fn-pointer-mismatch.stderr b/tests/ui/fn/fn-pointer-mismatch.stderr index 9cda11639d0f5..4ec85c06a96da 100644 --- a/tests/ui/fn/fn-pointer-mismatch.stderr +++ b/tests/ui/fn/fn-pointer-mismatch.stderr @@ -9,7 +9,10 @@ LL | let g = if n % 2 == 0 { &foo } else { &bar }; = note: expected reference `&fn(_) -> _ {foo}` found reference `&fn(_) -> _ {bar}` = note: different fn items have unique types, even if their signatures are the same - = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` +help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` + | +LL | let g = if n % 2 == 0 { &foo } else { &(bar as fn(u32) -> u32) }; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/fn-pointer-mismatch.rs:23:9 @@ -22,7 +25,10 @@ LL | a = bar; = note: expected fn item `fn(_) -> _ {foo}` found fn item `fn(_) -> _ {bar}` = note: different fn items have unique types, even if their signatures are the same - = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` +help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` + | +LL | a = bar as fn(u32) -> u32; + | ~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/fn-pointer-mismatch.rs:31:18 @@ -37,7 +43,10 @@ LL | b = Box::new(bar); = note: different fn items have unique types, even if their signatures are the same note: associated function defined here --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` +help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` + | +LL | b = Box::new(bar as fn(u32) -> u32); + | ~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/fn-pointer-mismatch.rs:36:29 diff --git a/tests/ui/fn/fn-recover-return-sign.stderr b/tests/ui/fn/fn-recover-return-sign.stderr index 983109730ff3c..6fc1132b8d2d4 100644 --- a/tests/ui/fn/fn-recover-return-sign.stderr +++ b/tests/ui/fn/fn-recover-return-sign.stderr @@ -2,25 +2,45 @@ error: return types are denoted using `->` --> $DIR/fn-recover-return-sign.rs:3:8 | LL | fn a() => usize { 0 } - | ^^ help: use `->` instead + | ^^ + | +help: use `->` instead + | +LL | fn a() -> usize { 0 } + | ~~ error: return types are denoted using `->` --> $DIR/fn-recover-return-sign.rs:6:7 | LL | fn b(): usize { 0 } - | ^ help: use `->` instead + | ^ + | +help: use `->` instead + | +LL | fn b()-> usize { 0 } + | ~~ error: return types are denoted using `->` --> $DIR/fn-recover-return-sign.rs:21:25 | LL | let foo = |a: bool| => bool { a }; - | ^^ help: use `->` instead + | ^^ + | +help: use `->` instead + | +LL | let foo = |a: bool| -> bool { a }; + | ~~ error: return types are denoted using `->` --> $DIR/fn-recover-return-sign.rs:25:24 | LL | let bar = |a: bool|: bool { a }; - | ^ help: use `->` instead + | ^ + | +help: use `->` instead + | +LL | let bar = |a: bool|-> bool { a }; + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/fn/fn-recover-return-sign2.stderr b/tests/ui/fn/fn-recover-return-sign2.stderr index 25ee8dd0c5dcd..fb88ff7b95045 100644 --- a/tests/ui/fn/fn-recover-return-sign2.stderr +++ b/tests/ui/fn/fn-recover-return-sign2.stderr @@ -2,7 +2,12 @@ error: return types are denoted using `->` --> $DIR/fn-recover-return-sign2.rs:4:10 | LL | fn foo() => impl Fn() => bool { - | ^^ help: use `->` instead + | ^^ + | +help: use `->` instead + | +LL | fn foo() -> impl Fn() => bool { + | ~~ error: expected one of `+`, `->`, `::`, `where`, or `{`, found `=>` --> $DIR/fn-recover-return-sign2.rs:4:23 diff --git a/tests/ui/fn/issue-80179.stderr b/tests/ui/fn/issue-80179.stderr index f5d6c44db7511..9d3577ff7b8d0 100644 --- a/tests/ui/fn/issue-80179.stderr +++ b/tests/ui/fn/issue-80179.stderr @@ -2,21 +2,24 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/issue-80179.rs:10:24 | LL | fn returns_fn_ptr() -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `fn() -> i32` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn returns_fn_ptr() -> fn() -> i32 { + | ~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/issue-80179.rs:18:25 | LL | fn returns_closure() -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with an appropriate return type: `impl Fn() -> i32` + | ^ not allowed in type signatures | = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html +help: replace with an appropriate return type + | +LL | fn returns_closure() -> impl Fn() -> i32 { + | ~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/fn/suggest-return-closure.stderr b/tests/ui/fn/suggest-return-closure.stderr index 45c12b548e678..452d22fdd9b12 100644 --- a/tests/ui/fn/suggest-return-closure.stderr +++ b/tests/ui/fn/suggest-return-closure.stderr @@ -2,34 +2,37 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/suggest-return-closure.rs:1:17 | LL | fn fn_once() -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with an appropriate return type: `impl FnOnce()` + | ^ not allowed in type signatures | = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html +help: replace with an appropriate return type + | +LL | fn fn_once() -> impl FnOnce() { + | ~~~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/suggest-return-closure.rs:13:16 | LL | fn fn_mut() -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with an appropriate return type: `impl FnMut(char)` + | ^ not allowed in type signatures | = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html +help: replace with an appropriate return type + | +LL | fn fn_mut() -> impl FnMut(char) { + | ~~~~~~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/suggest-return-closure.rs:32:13 | LL | fn fun() -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with an appropriate return type: `impl Fn() -> i32` + | ^ not allowed in type signatures | = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html +help: replace with an appropriate return type + | +LL | fn fun() -> impl Fn() -> i32 { + | ~~~~~~~~~~~~~~~~ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/suggest-return-closure.rs:23:9 diff --git a/tests/ui/fn/suggest-return-future.stderr b/tests/ui/fn/suggest-return-future.stderr index a4c8b5d8c4b5d..dd43e99b083f2 100644 --- a/tests/ui/fn/suggest-return-future.stderr +++ b/tests/ui/fn/suggest-return-future.stderr @@ -2,19 +2,23 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/suggest-return-future.rs:7:13 | LL | fn foo() -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with an appropriate return type: `impl Future` + | ^ not allowed in type signatures + | +help: replace with an appropriate return type + | +LL | fn foo() -> impl Future { + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/suggest-return-future.rs:15:13 | LL | fn bar() -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with an appropriate return type: `impl Future` + | ^ not allowed in type signatures + | +help: replace with an appropriate return type + | +LL | fn bar() -> impl Future { + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/for-loop-while/label_break_value_invalid.stderr b/tests/ui/for-loop-while/label_break_value_invalid.stderr index f6999c4ab116a..033a81ce2e280 100644 --- a/tests/ui/for-loop-while/label_break_value_invalid.stderr +++ b/tests/ui/for-loop-while/label_break_value_invalid.stderr @@ -16,10 +16,12 @@ LL | let x: u8 = mac3!('b: { | -- a label with a similar name is reachable LL | if true { LL | break 'a 3; - | ^^ - | | - | undeclared label `'a` - | help: try using similarly named label: `'b` + | ^^ undeclared label `'a` + | +help: try using similarly named label + | +LL | break 'b 3; + | ~~ error[E0426]: use of undeclared label `'a` --> $DIR/label_break_value_invalid.rs:33:29 diff --git a/tests/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.stderr b/tests/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.stderr index 564ee14668763..412b607d2402c 100644 --- a/tests/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.stderr +++ b/tests/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.stderr @@ -1,19 +1,17 @@ error: incorrect function inside `extern` block --> $DIR/issue-74120-lowering-of-ffi-block-bodies.rs:7:8 | -LL | extern "C" { - | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | fn f() { - | ________^___- - | | | - | | cannot have a body -LL | | -LL | | fn g() {} -LL | | } - | |_____- help: remove the invalid body: `;` +LL | extern "C" { + | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body +LL | fn f() { + | ^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | fn f() ; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/foreign/issue-91370-foreign-fn-block-impl.stderr b/tests/ui/foreign/issue-91370-foreign-fn-block-impl.stderr index fea2ab61e929f..347eaae9ac65c 100644 --- a/tests/ui/foreign/issue-91370-foreign-fn-block-impl.stderr +++ b/tests/ui/foreign/issue-91370-foreign-fn-block-impl.stderr @@ -1,21 +1,18 @@ error: incorrect function inside `extern` block --> $DIR/issue-91370-foreign-fn-block-impl.rs:5:8 | -LL | extern { - | ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body +LL | extern { + | ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body LL | -LL | fn f() { - | ________^___- - | | | - | | cannot have a body -LL | | -LL | | -LL | | impl Copy for u8 {} -LL | | } - | |_____- help: remove the invalid body: `;` +LL | fn f() { + | ^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | fn f() ; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/future-incompatible-lint-group.stderr b/tests/ui/future-incompatible-lint-group.stderr index 4e6c434fa29b2..38d962b17c352 100644 --- a/tests/ui/future-incompatible-lint-group.stderr +++ b/tests/ui/future-incompatible-lint-group.stderr @@ -2,11 +2,15 @@ warning: anonymous parameters are deprecated and will be removed in the next edi --> $DIR/future-incompatible-lint-group.rs:7:10 | LL | fn f(u8) {} - | ^^ help: try naming the parameter or explicitly ignoring it: `_: u8` + | ^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 = note: `#[warn(anonymous_parameters)]` on by default +help: try naming the parameter or explicitly ignoring it + | +LL | fn f(_: u8) {} + | ~~~~~ error: this attribute can only be applied at the crate level --> $DIR/future-incompatible-lint-group.rs:13:12 diff --git a/tests/ui/generic-associated-types/equality-bound.stderr b/tests/ui/generic-associated-types/equality-bound.stderr index a054c06caebde..e598c3d2f8f68 100644 --- a/tests/ui/generic-associated-types/equality-bound.stderr +++ b/tests/ui/generic-associated-types/equality-bound.stderr @@ -114,28 +114,43 @@ error[E0412]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:20:79 | LL | fn from_iter(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A, - | ^ help: a struct with a similar name exists: `K` + | ^ ... LL | struct K {} | -------- similarly named struct `K` defined here + | +help: a struct with a similar name exists + | +LL | fn from_iter(_: T) -> Self where T: IntoIterator, IntoIterator::Item = K, + | ~ error[E0412]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:31:68 | LL | fn from_iter(_: T) -> Self where T: IntoIterator, T::Item = A, - | ^ help: a struct with a similar name exists: `K` + | ^ ... LL | struct K {} | -------- similarly named struct `K` defined here + | +help: a struct with a similar name exists + | +LL | fn from_iter(_: T) -> Self where T: IntoIterator, T::Item = K, + | ~ error[E0412]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:42:76 | LL | fn from_iter(_: T) -> Self where IntoIterator::Item = A, - | ^ help: a struct with a similar name exists: `K` + | ^ ... LL | struct K {} | -------- similarly named struct `K` defined here + | +help: a struct with a similar name exists + | +LL | fn from_iter(_: T) -> Self where IntoIterator::Item = K, + | ~ error[E0412]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:53:65 @@ -144,7 +159,12 @@ LL | struct K {} | -------- similarly named struct `K` defined here ... LL | fn from_iter(_: T) -> Self where T::Item = A, - | ^ help: a struct with a similar name exists: `K` + | ^ + | +help: a struct with a similar name exists + | +LL | fn from_iter(_: T) -> Self where T::Item = K, + | ~ error[E0412]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:64:62 @@ -153,7 +173,12 @@ LL | struct K {} | -------- similarly named struct `K` defined here ... LL | fn from_iter(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator, - | ^ help: a struct with a similar name exists: `K` + | ^ + | +help: a struct with a similar name exists + | +LL | fn from_iter(_: T) -> Self where IntoIterator::Item = K, T: IntoIterator, + | ~ error[E0412]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:75:51 @@ -162,16 +187,23 @@ LL | struct K {} | -------- similarly named struct `K` defined here ... LL | fn from_iter(_: T) -> Self where T::Item = A, T: IntoIterator, - | ^ help: a struct with a similar name exists: `K` + | ^ + | +help: a struct with a similar name exists + | +LL | fn from_iter(_: T) -> Self where T::Item = K, T: IntoIterator, + | ~ error[E0433]: failed to resolve: use of undeclared type `I` --> $DIR/equality-bound.rs:9:41 | LL | fn sum3(i: J) -> i32 where I::Item = i32 { - | ^ - | | - | use of undeclared type `I` - | help: a type parameter with a similar name exists: `J` + | ^ use of undeclared type `I` + | +help: a type parameter with a similar name exists + | +LL | fn sum3(i: J) -> i32 where J::Item = i32 { + | ~ error: aborting due to 16 previous errors diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index fcd3e7d9aace8..cb1b187930615 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -19,9 +19,13 @@ error: parenthesized generic arguments cannot be used in associated type constra --> $DIR/gat-trait-path-parenthesised-args.rs:18:27 | LL | fn bar<'a>(arg: Box>) {} - | ^-- - | | - | help: remove these parentheses + | ^^^ + | +help: remove these parentheses + | +LL - fn bar<'a>(arg: Box>) {} +LL + fn bar<'a>(arg: Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 @@ -43,15 +47,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} - | ^---- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 | LL | type Y<'a>; | ^ +help: remove these generics + | +LL - fn foo<'a>(arg: Box>) {} +LL + fn foo<'a>(arg: Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 @@ -74,9 +81,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} - | ^---- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 @@ -84,6 +89,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn foo<'a>(arg: Box>) {} +LL + fn foo<'a>(arg: Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 @@ -106,9 +116,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} - | ^---- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 @@ -116,6 +124,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn foo<'a>(arg: Box>) {} +LL + fn foo<'a>(arg: Box>) {} + | error[E0224]: at least one trait is required for an object type --> $DIR/gat-trait-path-parenthesised-args.rs:5:29 diff --git a/tests/ui/generic-associated-types/issue-70304.stderr b/tests/ui/generic-associated-types/issue-70304.stderr index 9b02c1b076837..19f1a864073ad 100644 --- a/tests/ui/generic-associated-types/issue-70304.stderr +++ b/tests/ui/generic-associated-types/issue-70304.stderr @@ -20,12 +20,14 @@ error: missing required bound on `Cursor` --> $DIR/issue-70304.rs:2:5 | LL | type Cursor<'a>: DocCursor<'a>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Cursor<'a>: DocCursor<'a> where Self: 'a; + | ++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/generic-associated-types/issue-80433.stderr b/tests/ui/generic-associated-types/issue-80433.stderr index 8ab6fdcb81573..6f17df6f0239c 100644 --- a/tests/ui/generic-associated-types/issue-80433.stderr +++ b/tests/ui/generic-associated-types/issue-80433.stderr @@ -2,12 +2,14 @@ error: missing required bound on `Output` --> $DIR/issue-80433.rs:7:5 | LL | type Output<'a>; - | ^^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` + | ^^^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Output<'a> where Self: 'a; + | ++++++++++++++ error[E0107]: missing generics for associated type `TestMut::Output` --> $DIR/issue-80433.rs:21:47 diff --git a/tests/ui/generic-associated-types/issue-86787.stderr b/tests/ui/generic-associated-types/issue-86787.stderr index 00795abbd05d4..b937cda56a3a2 100644 --- a/tests/ui/generic-associated-types/issue-86787.stderr +++ b/tests/ui/generic-associated-types/issue-86787.stderr @@ -2,12 +2,14 @@ error: missing required bound on `TRef` --> $DIR/issue-86787.rs:10:5 | LL | type TRef<'a>; - | ^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` + | ^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type TRef<'a> where Self: 'a; + | ++++++++++++++ error[E0276]: impl has stricter requirements than trait --> $DIR/issue-86787.rs:25:37 diff --git a/tests/ui/generic-associated-types/missing-item-sugg.rs b/tests/ui/generic-associated-types/missing-item-sugg.rs index b9266f6f8327a..f4d7ac30f1dc2 100644 --- a/tests/ui/generic-associated-types/missing-item-sugg.rs +++ b/tests/ui/generic-associated-types/missing-item-sugg.rs @@ -6,6 +6,6 @@ struct Local; impl missing_item_sugg::Foo for Local { //~^ ERROR not all trait items implemented, missing: `Gat` } -//~^ HELP implement the missing item: `type Gat = /* Type */ where T: std::fmt::Display;` +//~^ HELP implement the missing item fn main() {} diff --git a/tests/ui/generic-associated-types/missing-item-sugg.stderr b/tests/ui/generic-associated-types/missing-item-sugg.stderr index 1f142f7f6c12e..c69b254ca2c93 100644 --- a/tests/ui/generic-associated-types/missing-item-sugg.stderr +++ b/tests/ui/generic-associated-types/missing-item-sugg.stderr @@ -4,7 +4,10 @@ error[E0046]: not all trait items implemented, missing: `Gat` LL | impl missing_item_sugg::Foo for Local { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Gat` in implementation | - = help: implement the missing item: `type Gat = /* Type */ where T: std::fmt::Display;` +help: implement the missing item + | +LL + type Gat = /* Type */ where T: std::fmt::Display; + | error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr index 4523044b5886b..9eb0b8ca641cb 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -2,15 +2,18 @@ error[E0107]: associated type takes 1 lifetime argument but 2 lifetime arguments --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; - | ^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/parameter_number_and_kind.rs:8:10 | LL | type E<'a, T>; | ^ -- +help: remove this lifetime argument + | +LL - type FErr1 = Self::E<'static, 'static>; +LL + type FErr1 = Self::E<'static, >; + | error[E0107]: associated type takes 1 generic argument but 0 generic arguments were supplied --> $DIR/parameter_number_and_kind.rs:11:24 @@ -32,15 +35,18 @@ error[E0107]: associated type takes 1 generic argument but 2 generic arguments w --> $DIR/parameter_number_and_kind.rs:14:27 | LL | type FErr2 = Self::E<'static, T, u32>; - | ^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` --> $DIR/parameter_number_and_kind.rs:8:10 | LL | type E<'a, T>; | ^ - +help: remove this generic argument + | +LL - type FErr2 = Self::E<'static, T, u32>; +LL + type FErr2 = Self::E<'static, T, >; + | error: aborting due to 3 previous errors diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 2090f75aed328..f73022922a5b3 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -18,15 +18,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:2:10 | LL | type Y<'a>; | ^ +help: remove these generics + | +LL - fn f2<'a>(arg : Box = &'a ()>>) {} +LL + fn f2<'a>(arg : Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 @@ -49,9 +52,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:2:10 @@ -59,6 +60,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f2<'a>(arg : Box = &'a ()>>) {} +LL + fn f2<'a>(arg : Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 @@ -81,9 +87,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:2:10 @@ -91,6 +95,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f2<'a>(arg : Box = &'a ()>>) {} +LL + fn f2<'a>(arg : Box>) {} + | error[E0038]: the trait `X` cannot be made into an object --> $DIR/trait-path-type-error-once-implemented.rs:6:23 diff --git a/tests/ui/generic-associated-types/self-outlives-lint.stderr b/tests/ui/generic-associated-types/self-outlives-lint.stderr index 9e9b2e18abeb8..5d7963a21acf1 100644 --- a/tests/ui/generic-associated-types/self-outlives-lint.stderr +++ b/tests/ui/generic-associated-types/self-outlives-lint.stderr @@ -2,177 +2,209 @@ error: missing required bound on `Item` --> $DIR/self-outlives-lint.rs:7:5 | LL | type Item<'x>; - | ^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'x` + | ^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Item<'x> where Self: 'x; + | ++++++++++++++ error: missing required bound on `Out` --> $DIR/self-outlives-lint.rs:23:5 | LL | type Out<'x>; - | ^^^^^^^^^^^^- - | | - | help: add the required where clause: `where T: 'x` + | ^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Out<'x> where T: 'x; + | +++++++++++ error: missing required bound on `Out` --> $DIR/self-outlives-lint.rs:37:5 | LL | type Out<'x>; - | ^^^^^^^^^^^^- - | | - | help: add the required where clause: `where T: 'x` + | ^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Out<'x> where T: 'x; + | +++++++++++ error: missing required bounds on `Out` --> $DIR/self-outlives-lint.rs:44:5 | LL | type Out<'x, 'y>; - | ^^^^^^^^^^^^^^^^- - | | - | help: add the required where clauses: `where T: 'x, U: 'y` + | ^^^^^^^^^^^^^^^^^ | = note: these bounds are currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clauses + | +LL | type Out<'x, 'y> where T: 'x, U: 'y; + | ++++++++++++++++++ error: missing required bound on `Out` --> $DIR/self-outlives-lint.rs:59:5 | LL | type Out<'x, D>; - | ^^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where D: 'x` + | ^^^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Out<'x, D> where D: 'x; + | +++++++++++ error: missing required bound on `Out` --> $DIR/self-outlives-lint.rs:75:5 | LL | type Out<'x, D>; - | ^^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where D: 'x` + | ^^^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Out<'x, D> where D: 'x; + | +++++++++++ error: missing required bound on `Out` --> $DIR/self-outlives-lint.rs:90:5 | LL | type Out<'x, D>; - | ^^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where D: 'x` + | ^^^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Out<'x, D> where D: 'x; + | +++++++++++ error: missing required bounds on `Bar` --> $DIR/self-outlives-lint.rs:112:5 | LL | type Bar<'b>; - | ^^^^^^^^^^^^- - | | - | help: add the required where clauses: `where Self: 'a, Self: 'b` + | ^^^^^^^^^^^^^ | = note: these bounds are currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clauses + | +LL | type Bar<'b> where Self: 'a, Self: 'b; + | ++++++++++++++++++++++++ error: missing required bound on `Bar` --> $DIR/self-outlives-lint.rs:120:5 | LL | type Bar<'b>; - | ^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'b` + | ^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Bar<'b> where Self: 'b; + | ++++++++++++++ error: missing required bound on `Bar` --> $DIR/self-outlives-lint.rs:127:5 | LL | type Bar<'b>; - | ^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'b` + | ^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Bar<'b> where Self: 'b; + | ++++++++++++++ error: missing required bound on `Iterator` --> $DIR/self-outlives-lint.rs:142:5 | LL | type Iterator<'a>: Iterator>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Iterator<'a>: Iterator> where Self: 'a; + | ++++++++++++++ error: missing required bound on `Item` --> $DIR/self-outlives-lint.rs:140:5 | LL | type Item<'a>; - | ^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` + | ^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Item<'a> where Self: 'a; + | ++++++++++++++ error: missing required bound on `Item` --> $DIR/self-outlives-lint.rs:148:5 | LL | type Item<'a>; - | ^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` + | ^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Item<'a> where Self: 'a; + | ++++++++++++++ error: missing required bound on `Bar` --> $DIR/self-outlives-lint.rs:157:5 | LL | type Bar<'a, 'b>; - | ^^^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where 'b: 'a` + | ^^^^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Bar<'a, 'b> where 'b: 'a; + | ++++++++++++ error: missing required bound on `Fut` --> $DIR/self-outlives-lint.rs:173:5 | LL | type Fut<'out>; - | ^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where 'ctx: 'out` + | ^^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Fut<'out> where 'ctx: 'out; + | ++++++++++++++++ error: missing required bound on `Item` --> $DIR/self-outlives-lint.rs:213:5 | LL | type Item<'a>; - | ^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` + | ^^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Item<'a> where Self: 'a; + | ++++++++++++++ error: aborting due to 16 previous errors diff --git a/tests/ui/generic-const-items/assoc-const-missing-type.stderr b/tests/ui/generic-const-items/assoc-const-missing-type.stderr index 6f35c0958d45c..e7b8f2121169a 100644 --- a/tests/ui/generic-const-items/assoc-const-missing-type.stderr +++ b/tests/ui/generic-const-items/assoc-const-missing-type.stderr @@ -13,7 +13,12 @@ error: missing type for `const` item --> $DIR/assoc-const-missing-type.rs:12:15 | LL | const K = (); - | ^ help: provide a type for the associated constant: `()` + | ^ + | +help: provide a type for the associated constant + | +LL | const K () = (); + | ++ error[E0195]: lifetime parameters or bounds on const `Q` do not match the trait declaration --> $DIR/assoc-const-missing-type.rs:16:12 @@ -28,7 +33,12 @@ error: missing type for `const` item --> $DIR/assoc-const-missing-type.rs:16:12 | LL | const Q = ""; - | ^ help: provide a type for the associated constant: `: &str` + | ^ + | +help: provide a type for the associated constant + | +LL | const Q: &str = ""; + | ++++++ error[E0308]: mismatched types --> $DIR/assoc-const-missing-type.rs:12:18 diff --git a/tests/ui/generics/bad-mid-path-type-params.stderr b/tests/ui/generics/bad-mid-path-type-params.stderr index 71e15dd4c9264..7f4ba781e6ab3 100644 --- a/tests/ui/generics/bad-mid-path-type-params.stderr +++ b/tests/ui/generics/bad-mid-path-type-params.stderr @@ -2,71 +2,86 @@ error[E0107]: associated function takes 1 generic argument but 2 generic argumen --> $DIR/bad-mid-path-type-params.rs:30:16 | LL | let _ = S::new::(1, 1.0); - | ^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:6:8 | LL | fn new(x: T, _: U) -> S { | ^^^ - +help: remove this generic argument + | +LL - let _ = S::new::(1, 1.0); +LL + let _ = S::new::(1, 1.0); + | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/bad-mid-path-type-params.rs:33:13 | LL | let _ = S::<'a,isize>::new::(1, 1.0); - | ^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/bad-mid-path-type-params.rs:1:8 | LL | struct S { | ^ +help: remove this lifetime argument + | +LL - let _ = S::<'a,isize>::new::(1, 1.0); +LL + let _ = S::<,isize>::new::(1, 1.0); + | error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:36:24 | LL | let _: S2 = Trait::new::(1, 1.0); - | ^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:14:8 | LL | fn new(x: T, y: U) -> Self; | ^^^ - +help: remove this generic argument + | +LL - let _: S2 = Trait::new::(1, 1.0); +LL + let _: S2 = Trait::new::(1, 1.0); + | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/bad-mid-path-type-params.rs:39:17 | LL | let _: S2 = Trait::<'a,isize>::new::(1, 1.0); - | ^^^^^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^^^^ expected 0 lifetime arguments | note: trait defined here, with 0 lifetime parameters --> $DIR/bad-mid-path-type-params.rs:13:7 | LL | trait Trait { | ^^^^^ +help: remove this lifetime argument + | +LL - let _: S2 = Trait::<'a,isize>::new::(1, 1.0); +LL + let _: S2 = Trait::<,isize>::new::(1, 1.0); + | error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:39:36 | LL | let _: S2 = Trait::<'a,isize>::new::(1, 1.0); - | ^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:14:8 | LL | fn new(x: T, y: U) -> Self; | ^^^ - +help: remove this generic argument + | +LL - let _: S2 = Trait::<'a,isize>::new::(1, 1.0); +LL + let _: S2 = Trait::<'a,isize>::new::(1, 1.0); + | error: aborting due to 5 previous errors diff --git a/tests/ui/generics/foreign-generic-mismatch.stderr b/tests/ui/generics/foreign-generic-mismatch.stderr index 5322b3f919d2d..7e8e854d64248 100644 --- a/tests/ui/generics/foreign-generic-mismatch.stderr +++ b/tests/ui/generics/foreign-generic-mismatch.stderr @@ -20,15 +20,18 @@ error[E0107]: function takes 1 lifetime argument but 2 lifetime arguments were s --> $DIR/foreign-generic-mismatch.rs:8:31 | LL | foreign_generic_mismatch::lt_arg::<'static, 'static>(); - | ^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^ expected 1 lifetime argument | note: function defined here, with 1 lifetime parameter: `'a` --> $DIR/auxiliary/foreign-generic-mismatch.rs:3:8 | LL | pub fn lt_arg<'a: 'a>() {} | ^^^^^^ -- +help: remove this lifetime argument + | +LL - foreign_generic_mismatch::lt_arg::<'static, 'static>(); +LL + foreign_generic_mismatch::lt_arg::<'static, >(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/generics/generic-arg-mismatch-recover.stderr b/tests/ui/generics/generic-arg-mismatch-recover.stderr index f549a7180fc66..cb25fa7af40aa 100644 --- a/tests/ui/generics/generic-arg-mismatch-recover.stderr +++ b/tests/ui/generics/generic-arg-mismatch-recover.stderr @@ -2,43 +2,52 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/generic-arg-mismatch-recover.rs:6:5 | LL | Foo::<'static, 'static, ()>(&0); - | ^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/generic-arg-mismatch-recover.rs:1:8 | LL | struct Foo<'a, T: 'a>(&'a T); | ^^^ -- +help: remove this lifetime argument + | +LL - Foo::<'static, 'static, ()>(&0); +LL + Foo::<'static, , ()>(&0); + | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/generic-arg-mismatch-recover.rs:3:8 | LL | struct Bar<'a>(&'a ()); | ^^^ -- +help: remove this lifetime argument + | +LL - Bar::<'static, 'static, ()>(&()); +LL + Bar::<'static, , ()>(&()); + | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ -- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/generic-arg-mismatch-recover.rs:3:8 | LL | struct Bar<'a>(&'a ()); | ^^^ +help: remove this generic argument + | +LL - Bar::<'static, 'static, ()>(&()); +LL + Bar::<'static, 'static, >(&()); + | error: aborting due to 3 previous errors diff --git a/tests/ui/generics/generic-extern-lifetime.stderr b/tests/ui/generics/generic-extern-lifetime.stderr index 33332e760f582..6f9b496f1cd7b 100644 --- a/tests/ui/generics/generic-extern-lifetime.stderr +++ b/tests/ui/generics/generic-extern-lifetime.stderr @@ -2,9 +2,12 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:6:26 | LL | pub fn life2<'b>(x: &'a i32, y: &'b i32); - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `'a,` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | pub fn life2<'a, 'b>(x: &'a i32, y: &'b i32); + | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:8:37 diff --git a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr index c5812abfd3dfa..edbe7a5e139cb 100644 --- a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w --> $DIR/generic-impl-more-params-with-defaults.rs:13:5 | LL | Vec::::new(); - | ^^^ ---- help: remove this generic argument - | | - | expected at most 2 generic arguments + | ^^^ expected at most 2 generic arguments | note: struct defined here, with at most 2 generic parameters: `T`, `A` --> $DIR/generic-impl-more-params-with-defaults.rs:5:8 | LL | struct Vec( | ^^^ - -------- +help: remove this generic argument + | +LL - Vec::::new(); +LL + Vec::::new(); + | error: aborting due to 1 previous error diff --git a/tests/ui/generics/generic-no-mangle.stderr b/tests/ui/generics/generic-no-mangle.stderr index adfddbe9ca791..1c7b559c67fe4 100644 --- a/tests/ui/generics/generic-no-mangle.stderr +++ b/tests/ui/generics/generic-no-mangle.stderr @@ -1,8 +1,6 @@ error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:6:1 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | pub fn foo() {} | ^^^^^^^^^^^^^^^^^^ | @@ -11,134 +9,186 @@ note: the lint level is defined here | LL | #![deny(no_mangle_generic_items)] | ^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:9:1 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | pub extern "C" fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:21:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | pub fn foo() {} | ^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:24:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | pub extern "C" fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:42:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | fn foo() {} | ^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:45:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | extern "C" fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:64:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | fn foo() {} | ^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:67:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | fn foo2() {} | ^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:70:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | extern "C" fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:73:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | fn baz(x: &i32) -> &i32 { x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:76:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | fn qux<'a>(x: &'a i32) -> &i32 { x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:83:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | pub fn foo() {} | ^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:86:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | pub extern "C" fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:89:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | pub fn baz() {} | ^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:105:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | fn foo() {} | ^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:108:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | extern "C" fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: functions generic over types or consts must be mangled --> $DIR/generic-no-mangle.rs:111:5 | -LL | #[no_mangle] - | ------------ help: remove this attribute LL | fn baz() {} | ^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] + | error: aborting due to 17 previous errors diff --git a/tests/ui/generics/generic-type-more-params-with-defaults.stderr b/tests/ui/generics/generic-type-more-params-with-defaults.stderr index c44f6b7ddc02d..27752af1ad6cb 100644 --- a/tests/ui/generics/generic-type-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-type-more-params-with-defaults.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w --> $DIR/generic-type-more-params-with-defaults.rs:9:12 | LL | let _: Vec; - | ^^^ ---- help: remove this generic argument - | | - | expected at most 2 generic arguments + | ^^^ expected at most 2 generic arguments | note: struct defined here, with at most 2 generic parameters: `T`, `A` --> $DIR/generic-type-more-params-with-defaults.rs:5:8 | LL | struct Vec( | ^^^ - -------- +help: remove this generic argument + | +LL - let _: Vec; +LL + let _: Vec; + | error: aborting due to 1 previous error diff --git a/tests/ui/generics/impl-block-params-declared-in-wrong-spot-issue-113073.stderr b/tests/ui/generics/impl-block-params-declared-in-wrong-spot-issue-113073.stderr index dfc6761e17e7f..6ac066e3aacc5 100644 --- a/tests/ui/generics/impl-block-params-declared-in-wrong-spot-issue-113073.stderr +++ b/tests/ui/generics/impl-block-params-declared-in-wrong-spot-issue-113073.stderr @@ -2,9 +2,12 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:7:13 | LL | impl Foo for u8 {} - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | impl<'a> Foo for u8 {} + | ++++ error[E0229]: associated item constraints are not allowed here --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:3:10 diff --git a/tests/ui/generics/issue-59508-1.stderr b/tests/ui/generics/issue-59508-1.stderr index 7d4fdb2d87911..1f4b9699e24d9 100644 --- a/tests/ui/generics/issue-59508-1.stderr +++ b/tests/ui/generics/issue-59508-1.stderr @@ -2,7 +2,12 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-59508-1.rs:10:25 | LL | pub fn do_things() { - | ----^^--^^----- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b: 'a, T>` + | ^^ ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | pub fn do_things<'a, 'b: 'a, T>() { + | ~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/generics/issue-59508.stderr b/tests/ui/generics/issue-59508.stderr index aeaf0187eb51b..00295eea3671e 100644 --- a/tests/ui/generics/issue-59508.stderr +++ b/tests/ui/generics/issue-59508.stderr @@ -2,7 +2,12 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-59508.rs:10:25 | LL | pub fn do_things() { - | ----^^--^^----- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b: 'a, T>` + | ^^ ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | pub fn do_things<'a, 'b: 'a, T>() { + | ~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/generics/issue-80512-param-reordering-with-defaults.stderr b/tests/ui/generics/issue-80512-param-reordering-with-defaults.stderr index d7e12f07e060b..93fdce1636557 100644 --- a/tests/ui/generics/issue-80512-param-reordering-with-defaults.stderr +++ b/tests/ui/generics/issue-80512-param-reordering-with-defaults.stderr @@ -2,7 +2,12 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-80512-param-reordering-with-defaults.rs:3:18 | LL | struct S(&'a T); - | ---------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T = ()>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct S<'a, T = ()>(&'a T); + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/generics/issue-83556.stderr b/tests/ui/generics/issue-83556.stderr index 0c5a65f0c3d86..c7da8cef04a7e 100644 --- a/tests/ui/generics/issue-83556.stderr +++ b/tests/ui/generics/issue-83556.stderr @@ -2,7 +2,12 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-83556.rs:1:15 | LL | struct Foo(&'a ()); - | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct Foo<'a, T>(&'a ()); + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/generics/issue-95208-ignore-qself.stderr b/tests/ui/generics/issue-95208-ignore-qself.stderr index cf40e857d42ba..7d91fbc14a187 100644 --- a/tests/ui/generics/issue-95208-ignore-qself.stderr +++ b/tests/ui/generics/issue-95208-ignore-qself.stderr @@ -2,9 +2,12 @@ error: expected `:` followed by trait or lifetime --> $DIR/issue-95208-ignore-qself.rs:6:88 | LL | impl Struct where ::Item:: std::fmt::Display { - | --- ^ - | | - | help: use single colon: `:` + | ^ + | +help: use single colon + | +LL | impl Struct where ::Item: std::fmt::Display { + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/generics/issue-95208.stderr b/tests/ui/generics/issue-95208.stderr index 0d856d096affc..e047f1265e2e9 100644 --- a/tests/ui/generics/issue-95208.stderr +++ b/tests/ui/generics/issue-95208.stderr @@ -2,9 +2,12 @@ error: expected `:` followed by trait or lifetime --> $DIR/issue-95208.rs:6:46 | LL | impl Struct where T:: std::fmt::Display { - | --- ^ - | | - | help: use single colon: `:` + | ^ + | +help: use single colon + | +LL | impl Struct where T: std::fmt::Display { + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/generics/issue-98432.stderr b/tests/ui/generics/issue-98432.stderr index 2b09d43960f62..f20f779d884c0 100644 --- a/tests/ui/generics/issue-98432.stderr +++ b/tests/ui/generics/issue-98432.stderr @@ -5,9 +5,12 @@ LL | impl Struct { | - type parameter from outer item LL | const CONST: fn() = || { LL | struct _Obligation where T:; - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | struct _Obligation where T:; + | +++ error: aborting due to 1 previous error diff --git a/tests/ui/generics/lifetime-before-type-params.stderr b/tests/ui/generics/lifetime-before-type-params.stderr index 84825eb4ceb21..8e58a68921821 100644 --- a/tests/ui/generics/lifetime-before-type-params.stderr +++ b/tests/ui/generics/lifetime-before-type-params.stderr @@ -2,25 +2,45 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:2:13 | LL | fn first() {} - | ----^^--^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + | ^^ ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | fn first<'a, 'b, T>() {} + | ~~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:4:18 | LL | fn second<'a, T, 'b>() {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | fn second<'a, 'b, T>() {} + | ~~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:6:16 | LL | fn third() {} - | -------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | fn third<'a, T, U>() {} + | ~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:8:18 | LL | fn fourth<'a, T, 'b, U, 'c, V>() {} - | --------^^-----^^---- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, 'c, T, U, V>` + | ^^ ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | fn fourth<'a, 'b, 'c, T, U, V>() {} + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/generics/single-colon-path-not-const-generics.stderr b/tests/ui/generics/single-colon-path-not-const-generics.stderr index d61562bb199ff..06203b5e6fe70 100644 --- a/tests/ui/generics/single-colon-path-not-const-generics.stderr +++ b/tests/ui/generics/single-colon-path-not-const-generics.stderr @@ -4,9 +4,13 @@ error: path separator must be a double colon LL | pub struct Foo { | --- while parsing this struct LL | a: Vec, - | ^ help: use a double colon instead: `::` + | ^ | = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 +help: use a double colon instead + | +LL | a: Vec, + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/generics/wrong-number-of-args.stderr b/tests/ui/generics/wrong-number-of-args.stderr index e04408a0fdf36..9df759bf29b11 100644 --- a/tests/ui/generics/wrong-number-of-args.stderr +++ b/tests/ui/generics/wrong-number-of-args.stderr @@ -171,71 +171,86 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:6:14 | LL | type B = Ty<'static>; - | ^^--------- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove these generics + | +LL - type B = Ty<'static>; +LL + type B = Ty; + | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ ------- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove this lifetime argument + | +LL - type C = Ty<'static, usize>; +LL + type C = Ty<, usize>; + | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ ----- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove this generic argument + | +LL - type C = Ty<'static, usize>; +LL + type C = Ty<'static, >; + | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ ------- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove this lifetime argument + | +LL - type D = Ty<'static, usize, { 0 }>; +LL + type D = Ty<, usize, { 0 }>; + | error[E0107]: struct takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ ------------ help: remove these generic arguments - | | - | expected 0 generic arguments + | ^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove these generic arguments + | +LL - type D = Ty<'static, usize, { 0 }>; +LL + type D = Ty<'static, >; + | error[E0107]: missing generics for struct `type_and_type::Ty` --> $DIR/wrong-number-of-args.rs:26:14 @@ -275,15 +290,18 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp --> $DIR/wrong-number-of-args.rs:36:14 | LL | type D = Ty; - | ^^ ---- help: remove this generic argument - | | - | expected 2 generic arguments + | ^^ expected 2 generic arguments | note: struct defined here, with 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:24:12 | LL | struct Ty(A, B); | ^^ - - +help: remove this generic argument + | +LL - type D = Ty; +LL + type D = Ty; + | error[E0107]: struct takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:40:14 @@ -353,29 +371,35 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; - | ^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:46:12 | LL | struct Ty<'a, T>(&'a T); | ^^ -- +help: remove this lifetime argument + | +LL - type F = Ty<'static, usize, 'static, usize>; +LL + type F = Ty<'static, usize, , usize>; + | error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; - | ^^ ----- help: remove this generic argument - | | - | expected 1 generic argument + | ^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/wrong-number-of-args.rs:46:12 | LL | struct Ty<'a, T>(&'a T); | ^^ - +help: remove this generic argument + | +LL - type F = Ty<'static, usize, 'static, usize>; +LL + type F = Ty<'static, usize, 'static, >; + | error[E0107]: missing generics for struct `type_and_type_and_type::Ty` --> $DIR/wrong-number-of-args.rs:80:14 @@ -415,15 +439,18 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w --> $DIR/wrong-number-of-args.rs:92:14 | LL | type E = Ty; - | ^^ --- help: remove this generic argument - | | - | expected at most 3 generic arguments + | ^^ expected at most 3 generic arguments | note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C` --> $DIR/wrong-number-of-args.rs:78:12 | LL | struct Ty(A, B, C); | ^^ - - ---------------- +help: remove this generic argument + | +LL - type E = Ty; +LL + type E = Ty; + | error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:96:14 @@ -445,29 +472,35 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/wrong-number-of-args.rs:116:22 | LL | type A = Box>; - | ^^^^^^^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:104:11 | LL | trait NonGeneric { | ^^^^^^^^^^ +help: remove these generics + | +LL - type A = Box>; +LL + type A = Box; + | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:125:22 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:108:11 | LL | trait GenericLifetime<'a> { | ^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type C = Box>; +LL + type C = Box>; + | error[E0107]: missing generics for trait `GenericType` --> $DIR/wrong-number-of-args.rs:129:22 @@ -489,15 +522,18 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:133:22 | LL | type E = Box>; - | ^^^^^^^^^^^ ----- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:112:11 | LL | trait GenericType { | ^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type E = Box>; +LL + type E = Box>; + | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:142:22 @@ -519,43 +555,52 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/wrong-number-of-args.rs:153:26 | LL | type A = Box>; - | ^^^^^^^^^^^^------------------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:149:15 | LL | trait NonGenericAT { | ^^^^^^^^^^^^ +help: remove these generics + | +LL - type A = Box>; +LL + type A = Box; + | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:168:26 | LL | type B = Box>; - | ^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:159:15 | LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type B = Box>; +LL + type B = Box>; + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:172:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^^^^^^^^^^^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:159:15 | LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ +help: remove this generic argument + | +LL - type C = Box>; +LL + type C = Box>; + | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:185:26 @@ -577,29 +622,35 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:189:26 | LL | type B = Box>; - | ^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:181:15 | LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type B = Box>; +LL + type B = Box>; + | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:193:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^--------------------- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^^^^^^^^ expected 0 lifetime arguments | note: trait defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:181:15 | LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ +help: remove these generics + | +LL - type C = Box>; +LL + type C = Box; + | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:193:26 @@ -653,15 +704,18 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp --> $DIR/wrong-number-of-args.rs:216:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type C = Box>; +LL + type C = Box>; + | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:216:26 @@ -683,71 +737,86 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:227:26 | LL | type E = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type E = Box>; +LL + type E = Box>; + | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:234:26 | LL | type F = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type F = Box>; +LL + type F = Box>; + | error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:238:26 | LL | type G = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type G = Box>; +LL + type G = Box>; + | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type H = Box>; +LL + type H = Box>; + | error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type H = Box>; +LL + type H = Box>; + | error[E0107]: trait takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:254:26 @@ -787,15 +856,18 @@ error[E0107]: trait takes 2 generic arguments but 3 generic arguments were suppl --> $DIR/wrong-number-of-args.rs:262:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 2 generic arguments + | ^^^^^^^^^^^^^^^^^ expected 2 generic arguments | note: trait defined here, with 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:250:15 | LL | trait GenericTypeTypeAT { | ^^^^^^^^^^^^^^^^^ - - +help: remove this generic argument + | +LL - type C = Box>; +LL + type C = Box>; + | error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:277:26 @@ -911,9 +983,13 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:318:18 | LL | type C = HashMap<'static>; - | ^^^^^^^--------- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^^ expected 0 lifetime arguments + | +help: remove these generics + | +LL - type C = HashMap<'static>; +LL + type C = HashMap; + | error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:318:18 @@ -930,9 +1006,13 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w --> $DIR/wrong-number-of-args.rs:324:18 | LL | type D = HashMap; - | ^^^^^^^ --- help: remove this generic argument - | | - | expected at most 3 generic arguments + | ^^^^^^^ expected at most 3 generic arguments + | +help: remove this generic argument + | +LL - type D = HashMap; +LL + type D = HashMap; + | error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:328:18 @@ -973,9 +1053,13 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli --> $DIR/wrong-number-of-args.rs:342:18 | LL | type C = Result<'static>; - | ^^^^^^--------- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^ expected 0 lifetime arguments + | +help: remove these generics + | +LL - type C = Result<'static>; +LL + type C = Result; + | error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:342:18 @@ -992,9 +1076,13 @@ error[E0107]: enum takes 2 generic arguments but 3 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:348:18 | LL | type D = Result; - | ^^^^^^ ---- help: remove this generic argument - | | - | expected 2 generic arguments + | ^^^^^^ expected 2 generic arguments + | +help: remove this generic argument + | +LL - type D = Result; +LL + type D = Result; + | error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:352:18 diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr index 0d2aae689f037..0f60cd397b997 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr @@ -2,36 +2,60 @@ error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:15:9 | LL | ...X => {} - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | ..=X => {} + | ~~~ error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:16:9 | LL | ...0 => {} - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | ..=0 => {} + | ~~~ error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:17:9 | LL | ...'a' => {} - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | ..='a' => {} + | ~~~ error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:18:9 | LL | ...0.0f32 => {} - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | ..=0.0f32 => {} + | ~~~ error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:25:17 | LL | let ...$e; - | ^^^ help: use `..=` instead + | ^^^ ... LL | mac!(0); | ------- in this macro invocation | = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use `..=` instead + | +LL | let ..=$e; + | ~~~ error[E0005]: refutable pattern in local binding --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:25:17 diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr index 9ba0e09e1540c..57b26d0f2641e 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr @@ -2,57 +2,81 @@ error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-inclusive-no-end.rs:8:13 | LL | if let 0... = 1 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let 0.. = 1 {} + | ~~ error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-inclusive-no-end.rs:9:13 | LL | if let 0..= = 1 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let 0.. = 1 {} + | ~~ error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-inclusive-no-end.rs:11:13 | LL | if let X... = 1 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let X.. = 1 {} + | ~~ error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-inclusive-no-end.rs:12:13 | LL | if let X..= = 1 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let X.. = 1 {} + | ~~ error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-inclusive-no-end.rs:18:19 | LL | let $e...; - | ^^^ help: use `..` instead + | ^^^ ... LL | mac!(0); | ------- in this macro invocation | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use `..` instead + | +LL | let $e..; + | ~~ error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-inclusive-no-end.rs:20:19 | LL | let $e..=; - | ^^^ help: use `..` instead + | ^^^ ... LL | mac!(0); | ------- in this macro invocation | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use `..` instead + | +LL | let $e..; + | ~~ error[E0005]: refutable pattern in local binding --> $DIR/half-open-range-pats-inclusive-no-end.rs:18:17 diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr index 111e81799625e..ba87ed7e1ef48 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr @@ -2,53 +2,91 @@ error: the range pattern here has ambiguous interpretation --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:6:10 | LL | &0.. | _ => {} - | ^^^ help: add parentheses to clarify the precedence: `(0..)` + | ^^^ + | +help: add parentheses to clarify the precedence + | +LL | &(0..) | _ => {} + | ~~~~~ error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:8:11 | LL | &0..= | _ => {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | &0.. | _ => {} + | ~~ error: the range pattern here has ambiguous interpretation --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:8:10 | LL | &0..= | _ => {} - | ^^^^ help: add parentheses to clarify the precedence: `(0..=)` + | ^^^^ + | +help: add parentheses to clarify the precedence + | +LL | &(0..=) | _ => {} + | ~~~~~~ error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:11:11 | LL | &0... | _ => {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | &0.. | _ => {} + | ~~ error: the range pattern here has ambiguous interpretation --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:16:10 | LL | &..0 | _ => {} - | ^^^ help: add parentheses to clarify the precedence: `(..0)` + | ^^^ + | +help: add parentheses to clarify the precedence + | +LL | &(..0) | _ => {} + | ~~~~~ error: the range pattern here has ambiguous interpretation --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:18:10 | LL | &..=0 | _ => {} - | ^^^^ help: add parentheses to clarify the precedence: `(..=0)` + | ^^^^ + | +help: add parentheses to clarify the precedence + | +LL | &(..=0) | _ => {} + | ~~~~~~ error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:20:10 | LL | &...0 | _ => {} - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | &..=0 | _ => {} + | ~~~ error: the range pattern here has ambiguous interpretation --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:20:10 | LL | &...0 | _ => {} - | ^^^^ help: add parentheses to clarify the precedence: `(..=0)` + | ^^^^ + | +help: add parentheses to clarify the precedence + | +LL | &(..=0) | _ => {} + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/hygiene/assoc_item_ctxt.stderr b/tests/ui/hygiene/assoc_item_ctxt.stderr index effa9e8d65592..65e42d9a6b698 100644 --- a/tests/ui/hygiene/assoc_item_ctxt.stderr +++ b/tests/ui/hygiene/assoc_item_ctxt.stderr @@ -2,15 +2,16 @@ error[E0407]: method `method` is not a member of trait `Tr` --> $DIR/assoc_item_ctxt.rs:33:13 | LL | fn method() {} - | ^^^------^^^^^ - | | | - | | help: there is an associated function with a similar name: `method` - | not a member of trait `Tr` + | ^^^^^^^^^^^^^^ not a member of trait `Tr` ... LL | mac_trait_impl!(); | ----------------- in this macro invocation | = note: this error originates in the macro `mac_trait_impl` (in Nightly builds, run with -Z macro-backtrace for more info) +help: there is an associated function with a similar name + | +LL | fn method() {} + | ~~~~~~ error[E0046]: not all trait items implemented, missing: `method` --> $DIR/assoc_item_ctxt.rs:32:9 diff --git a/tests/ui/hygiene/rustc-macro-transparency.stderr b/tests/ui/hygiene/rustc-macro-transparency.stderr index 1d2a1e1249864..849cb47b4896b 100644 --- a/tests/ui/hygiene/rustc-macro-transparency.stderr +++ b/tests/ui/hygiene/rustc-macro-transparency.stderr @@ -11,10 +11,12 @@ LL | struct SemiTransparent; | ----------------------- similarly named unit struct `SemiTransparent` defined here ... LL | semitransparent; - | ^^^^^^^^^^^^^^^ - | | - | not a value - | help: a unit struct with a similar name exists: `SemiTransparent` + | ^^^^^^^^^^^^^^^ not a value + | +help: a unit struct with a similar name exists + | +LL | SemiTransparent; + | ~~~~~~~~~~~~~~~ error[E0423]: expected value, found macro `opaque` --> $DIR/rustc-macro-transparency.rs:30:5 diff --git a/tests/ui/illegal-ufcs-drop.stderr b/tests/ui/illegal-ufcs-drop.stderr index 4f214a12747e4..39d2f7b4724d8 100644 --- a/tests/ui/illegal-ufcs-drop.stderr +++ b/tests/ui/illegal-ufcs-drop.stderr @@ -2,10 +2,12 @@ error[E0040]: explicit use of destructor method --> $DIR/illegal-ufcs-drop.rs:12:5 | LL | Drop::drop(&mut Foo) - | ^^^^^^^^^^ - | | - | explicit destructor calls not allowed - | help: consider using `drop` function: `drop` + | ^^^^^^^^^^ explicit destructor calls not allowed + | +help: consider using `drop` function + | +LL | drop(&mut Foo) + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/associated-type-cycle.stderr b/tests/ui/impl-trait/associated-type-cycle.stderr index 7eef8d1e33893..ba90cf1054962 100644 --- a/tests/ui/impl-trait/associated-type-cycle.stderr +++ b/tests/ui/impl-trait/associated-type-cycle.stderr @@ -5,7 +5,12 @@ LL | type Bar; | -------- `Bar` defined here ... LL | impl Foo for Box { - | ^^^ help: specify the associated type: `Foo` + | ^^^ + | +help: specify the associated type + | +LL | impl Foo for Box> { + | ~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr index e8cd16bc30168..d184110c45345 100644 --- a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr +++ b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr @@ -2,9 +2,7 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup --> $DIR/explicit-generic-args-for-impl.rs:4:5 | LL | foo::("".to_string()); - | ^^^ ------ help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: function defined here, with 1 generic parameter: `T` --> $DIR/explicit-generic-args-for-impl.rs:1:4 @@ -12,6 +10,11 @@ note: function defined here, with 1 generic parameter: `T` LL | fn foo(_f: impl AsRef) {} | ^^^ - = note: `impl Trait` cannot be explicitly specified as a generic argument +help: remove this generic argument + | +LL - foo::("".to_string()); +LL + foo::("".to_string()); + | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr b/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr index 5aafc8b64d4ff..ee48a5ecbf0a2 100644 --- a/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr +++ b/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr @@ -2,25 +2,35 @@ error: unexpected `impl` keyword --> $DIR/extra-impl-in-trait-impl.rs:6:18 | LL | impl impl Default for S { - | ^^^^^ help: remove the extra `impl` + | ^^^^^ | note: this is parsed as an `impl Trait` type, but a trait is expected at this position --> $DIR/extra-impl-in-trait-impl.rs:6:18 | LL | impl impl Default for S { | ^^^^^^^^^^^^ +help: remove the extra `impl` + | +LL - impl impl Default for S { +LL + impl Default for S { + | error: unexpected `impl` keyword --> $DIR/extra-impl-in-trait-impl.rs:12:6 | LL | impl impl Default for S2 { - | ^^^^^ help: remove the extra `impl` + | ^^^^^ | note: this is parsed as an `impl Trait` type, but a trait is expected at this position --> $DIR/extra-impl-in-trait-impl.rs:12:6 | LL | impl impl Default for S2 { | ^^^^^^^^^^^^ +help: remove the extra `impl` + | +LL - impl impl Default for S2 { +LL + impl Default for S2 { + | error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr b/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr index e0955faac7ca0..b515bbea5972d 100644 --- a/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr +++ b/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr @@ -2,13 +2,23 @@ error: ambiguous `+` in a type --> $DIR/impl-fn-parsing-ambiguities.rs:4:27 | LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ { - | ^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(impl Debug + '_)` + | ^^^^^^^^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) { + | ~~~~~~~~~~~~~~~~~ error: ambiguous `+` in a type --> $DIR/impl-fn-parsing-ambiguities.rs:10:24 | LL | fn b() -> impl Fn() -> impl Debug + Send { - | ^^^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(impl Debug + Send)` + | ^^^^^^^^^^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | fn b() -> impl Fn() -> (impl Debug + Send) { + | ~~~~~~~~~~~~~~~~~~~ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` --> $DIR/impl-fn-parsing-ambiguities.rs:4:40 diff --git a/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr b/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr index 7046e729e1834..90c31c9e3fc19 100644 --- a/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr +++ b/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr @@ -2,10 +2,8 @@ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/impl-generic-mismatch-ab.rs:8:32 | LL | fn foo(&self, a: &impl Debug, b: &B) { } - | - ^^^^^^^^^^^ - | | | - | | expected type parameter `B`, found type parameter `impl Debug` - | | help: change the parameter type to match the trait: `&B` + | - ^^^^^^^^^^^ expected type parameter `B`, found type parameter `impl Debug` + | | | expected type parameter | note: type in trait @@ -17,6 +15,10 @@ LL | fn foo(&self, a: &A, b: &impl Debug); found signature `fn(&(), &impl Debug, &B)` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters +help: change the parameter type to match the trait + | +LL | fn foo(&self, a: &B, b: &B) { } + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/impl-trait-plus-priority.stderr b/tests/ui/impl-trait/impl-trait-plus-priority.stderr index 205d9b0b75ea8..43e9184337f3d 100644 --- a/tests/ui/impl-trait/impl-trait-plus-priority.stderr +++ b/tests/ui/impl-trait/impl-trait-plus-priority.stderr @@ -2,19 +2,34 @@ error: ambiguous `+` in a type --> $DIR/impl-trait-plus-priority.rs:23:18 | LL | type A = fn() -> impl A +; - | ^^^^^^^^ help: use parentheses to disambiguate: `(impl A)` + | ^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | type A = fn() -> (impl A); + | ~~~~~~~~ error: ambiguous `+` in a type --> $DIR/impl-trait-plus-priority.rs:25:18 | LL | type A = fn() -> impl A + B; - | ^^^^^^^^^^ help: use parentheses to disambiguate: `(impl A + B)` + | ^^^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | type A = fn() -> (impl A + B); + | ~~~~~~~~~~~~ error: ambiguous `+` in a type --> $DIR/impl-trait-plus-priority.rs:27:18 | LL | type A = fn() -> dyn A + B; - | ^^^^^^^^^ help: use parentheses to disambiguate: `(dyn A + B)` + | ^^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | type A = fn() -> (dyn A + B); + | ~~~~~~~~~~~ error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> A` --> $DIR/impl-trait-plus-priority.rs:29:10 @@ -26,43 +41,78 @@ error: ambiguous `+` in a type --> $DIR/impl-trait-plus-priority.rs:32:18 | LL | type A = Fn() -> impl A +; - | ^^^^^^^^ help: use parentheses to disambiguate: `(impl A)` + | ^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | type A = Fn() -> (impl A); + | ~~~~~~~~ error: ambiguous `+` in a type --> $DIR/impl-trait-plus-priority.rs:34:18 | LL | type A = Fn() -> impl A + B; - | ^^^^^^^^^^ help: use parentheses to disambiguate: `(impl A + B)` + | ^^^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | type A = Fn() -> (impl A + B); + | ~~~~~~~~~~~~ error: ambiguous `+` in a type --> $DIR/impl-trait-plus-priority.rs:36:18 | LL | type A = Fn() -> dyn A + B; - | ^^^^^^^^^ help: use parentheses to disambiguate: `(dyn A + B)` + | ^^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | type A = Fn() -> (dyn A + B); + | ~~~~~~~~~~~ error: ambiguous `+` in a type --> $DIR/impl-trait-plus-priority.rs:40:11 | LL | type A = &impl A +; - | ^^^^^^^^ help: use parentheses to disambiguate: `(impl A)` + | ^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | type A = &(impl A); + | ~~~~~~~~ error: ambiguous `+` in a type --> $DIR/impl-trait-plus-priority.rs:42:11 | LL | type A = &impl A + B; - | ^^^^^^^^^^ help: use parentheses to disambiguate: `(impl A + B)` + | ^^^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | type A = &(impl A + B); + | ~~~~~~~~~~~~ error: ambiguous `+` in a type --> $DIR/impl-trait-plus-priority.rs:44:11 | LL | type A = &dyn A + B; - | ^^^^^^^^^ help: use parentheses to disambiguate: `(dyn A + B)` + | ^^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | type A = &(dyn A + B); + | ~~~~~~~~~~~ error[E0178]: expected a path on the left-hand side of `+`, not `&A` --> $DIR/impl-trait-plus-priority.rs:46:10 | LL | type A = &A + B; - | ^^^^^^ help: try adding parentheses: `&(A + B)` + | ^^^^^^ + | +help: try adding parentheses + | +LL | type A = &(A + B); + | ~~~~~~~~ error: aborting due to 11 previous errors diff --git a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr index 8e61a65abe4be..e32c59a75c699 100644 --- a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr +++ b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr @@ -27,10 +27,7 @@ LL | type Ty = impl Sized; | ---------- the expected opaque type LL | LL | fn method() -> () {} - | ^^ - | | - | expected opaque type, found `()` - | help: change the output type to match the trait: `<() as compare_method::Trait>::Ty` + | ^^ expected opaque type, found `()` | note: type in trait --> $DIR/in-assoc-type-unconstrained.rs:17:24 @@ -44,6 +41,10 @@ note: this item must have the opaque type in its signature in order to be able t | LL | fn method() -> () {} | ^^^^^^ +help: change the output type to match the trait + | +LL | fn method() -> <() as compare_method::Trait>::Ty {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: unconstrained opaque type --> $DIR/in-assoc-type-unconstrained.rs:20:19 diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr index 856c92217b924..4c429624e0bfa 100644 --- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr +++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr @@ -4,9 +4,12 @@ error[E0308]: mismatched types LL | async fn woopsie_async(&self) -> String { | ------ expected `String` because of return type LL | 42 - | ^^- help: try using a conversion method: `.to_string()` - | | - | expected `String`, found integer + | ^^ expected `String`, found integer + | +help: try using a conversion method + | +LL | 42.to_string() + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/gat-outlives.stderr b/tests/ui/impl-trait/in-trait/gat-outlives.stderr index 8ec4b0ab2ee56..4599cada34dc5 100644 --- a/tests/ui/impl-trait/in-trait/gat-outlives.stderr +++ b/tests/ui/impl-trait/in-trait/gat-outlives.stderr @@ -2,23 +2,27 @@ error: missing required bound on `Gat` --> $DIR/gat-outlives.rs:6:5 | LL | type Gat<'a>; - | ^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` + | ^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Gat<'a> where Self: 'a; + | ++++++++++++++ error: missing required bound on `Gat` --> $DIR/gat-outlives.rs:12:5 | LL | type Gat<'a>; - | ^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` + | ^^^^^^^^^^^^^ | = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +help: add the required where clause + | +LL | type Gat<'a> where Self: 'a; + | ++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr index 2231205327cb0..6f6b787b6fe1b 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr @@ -2,10 +2,8 @@ error[E0053]: method `early` has an incompatible type for trait --> $DIR/method-signature-matches.rs:55:27 | LL | fn early<'late, T>(_: &'late ()) {} - | - ^^^^^^^^^ - | | | - | | expected type parameter `T`, found `()` - | | help: change the parameter type to match the trait: `&T` + | - ^^^^^^^^^ expected type parameter `T`, found `()` + | | | expected this type parameter | note: type in trait @@ -15,6 +13,10 @@ LL | fn early<'early, T>(x: &'early T) -> impl Sized; | ^^^^^^^^^ = note: expected signature `fn(&T)` found signature `fn(&'late ())` +help: change the parameter type to match the trait + | +LL | fn early<'late, T>(_: &T) {} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr index ec2a126865d5c..9e18517e48c55 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr @@ -2,10 +2,7 @@ error[E0053]: method `owo` has an incompatible type for trait --> $DIR/method-signature-matches.rs:11:15 | LL | fn owo(_: u8) {} - | ^^ - | | - | expected `()`, found `u8` - | help: change the parameter type to match the trait: `()` + | ^^ expected `()`, found `u8` | note: type in trait --> $DIR/method-signature-matches.rs:6:15 @@ -14,6 +11,10 @@ LL | fn owo(x: ()) -> impl Sized; | ^^ = note: expected signature `fn(())` found signature `fn(u8)` +help: change the parameter type to match the trait + | +LL | fn owo(_: ()) {} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr index 4d3e64e8050f9..c01d7322d117e 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr @@ -2,10 +2,7 @@ error[E0053]: method `owo` has an incompatible type for trait --> $DIR/method-signature-matches.rs:22:21 | LL | async fn owo(_: u8) {} - | ^^ - | | - | expected `()`, found `u8` - | help: change the parameter type to match the trait: `()` + | ^^ expected `()`, found `u8` | note: type in trait --> $DIR/method-signature-matches.rs:17:21 @@ -14,6 +11,10 @@ LL | async fn owo(x: ()) {} | ^^ = note: expected signature `fn(()) -> _` found signature `fn(u8) -> _` +help: change the parameter type to match the trait + | +LL | async fn owo(_: ()) {} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr index d7fc40fa3426f..aba82084f2258 100644 --- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr @@ -38,29 +38,35 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/opaque-and-lifetime-mismatch.rs:4:17 | LL | fn bar() -> Wrapper; - | ^^^^^^^ ---------- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ +help: remove this generic argument + | +LL - fn bar() -> Wrapper; +LL + fn bar() -> Wrapper<>; + | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/opaque-and-lifetime-mismatch.rs:18:17 | LL | fn foo() -> Wrapper; - | ^^^^^^^ ---------- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ +help: remove this generic argument + | +LL - fn foo() -> Wrapper; +LL + fn foo() -> Wrapper<>; + | error[E0053]: method `bar` has an incompatible return type for trait --> $DIR/opaque-and-lifetime-mismatch.rs:10:17 @@ -75,10 +81,7 @@ error[E0053]: method `bar` has an incompatible type for trait --> $DIR/opaque-and-lifetime-mismatch.rs:10:17 | LL | fn bar() -> i32 { - | ^^^ - | | - | expected `Wrapper<'static>`, found `i32` - | help: change the output type to match the trait: `Wrapper<'static>` + | ^^^ expected `Wrapper<'static>`, found `i32` | note: type in trait --> $DIR/opaque-and-lifetime-mismatch.rs:4:17 @@ -87,20 +90,27 @@ LL | fn bar() -> Wrapper; | ^^^^^^^^^^^^^^^^^^^ = note: expected signature `fn() -> Wrapper<'static>` found signature `fn() -> i32` +help: change the output type to match the trait + | +LL | fn bar() -> Wrapper<'static> { + | ~~~~~~~~~~~~~~~~ error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/opaque-and-lifetime-mismatch.rs:24:17 | LL | fn foo() -> Wrapper { - | ^^^^^^^ ---------- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ +help: remove this generic argument + | +LL - fn foo() -> Wrapper { +LL + fn foo() -> Wrapper<> { + | error: aborting due to 8 previous errors diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr index b8a8e2401b229..8c9f265601540 100644 --- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr +++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr @@ -5,10 +5,7 @@ LL | default impl Foo for U | - found this type parameter ... LL | fn bar(&self) -> U { - | ^ - | | - | expected associated type, found type parameter `U` - | help: change the output type to match the trait: `impl Sized` + | ^ expected associated type, found type parameter `U` | note: type in trait --> $DIR/specialization-broken.rs:8:22 @@ -17,6 +14,10 @@ LL | fn bar(&self) -> impl Sized; | ^^^^^^^^^^ = note: expected signature `fn(&_) -> impl Sized` found signature `fn(&_) -> U` +help: change the output type to match the trait + | +LL | fn bar(&self) -> impl Sized { + | ~~~~~~~~~~ error: method with return-position `impl Trait` in trait cannot be specialized --> $DIR/specialization-broken.rs:15:5 diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr index 273f51ddbe35c..ee5c8cc5698d6 100644 --- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -62,9 +62,12 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/must_outlive_least_region_or_bound.rs:15:41 | LL | fn foo<'a>(x: &i32) -> impl Copy + 'a { x } - | ---- ^ lifetime `'a` required - | | - | help: add explicit lifetime `'a` to the type of `x`: `&'a i32` + | ^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `x` + | +LL | fn foo<'a>(x: &'a i32) -> impl Copy + 'a { x } + | ~~~~~~~ error: lifetime may not live long enough --> $DIR/must_outlive_least_region_or_bound.rs:30:55 diff --git a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr index 6d41748853332..cc999578e6fb4 100644 --- a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr +++ b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr @@ -36,52 +36,64 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subje --> $DIR/opaque-used-in-extraneous-argument.rs:5:19 | LL | fn frob() -> impl Fn + '_ {} - | ^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(P) -> T` + | ^^^^^^^^^^^^^^^^^ | = note: see issue #29625 for more information = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: use parenthetical notation instead + | +LL | fn frob() -> impl Fn(P) -> T + '_ {} + | ~~~~~~~~~~ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change --> $DIR/opaque-used-in-extraneous-argument.rs:5:19 | LL | fn frob() -> impl Fn + '_ {} - | ^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(P) -> T` + | ^^^^^^^^^^^^^^^^^ | = note: see issue #29625 for more information = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use parenthetical notation instead + | +LL | fn frob() -> impl Fn(P) -> T + '_ {} + | ~~~~~~~~~~ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/opaque-used-in-extraneous-argument.rs:17:20 | LL | let old_path = frob("hello"); - | ^^^^ ------- - | | - | unexpected argument of type `&'static str` - | help: remove the extra argument + | ^^^^ ------- unexpected argument of type `&'static str` | note: function defined here --> $DIR/opaque-used-in-extraneous-argument.rs:5:4 | LL | fn frob() -> impl Fn + '_ {} | ^^^^ +help: remove the extra argument + | +LL - let old_path = frob("hello"); +LL + let old_path = frob(); + | error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/opaque-used-in-extraneous-argument.rs:20:5 | LL | open_parent(&old_path) - | ^^^^^^^^^^^ --------- - | | - | unexpected argument of type `&impl FnOnce<{type error}, Output = {type error}> + Fn<{type error}> + 'static` - | help: remove the extra argument + | ^^^^^^^^^^^ --------- unexpected argument of type `&impl FnOnce<{type error}, Output = {type error}> + Fn<{type error}> + 'static` | note: function defined here --> $DIR/opaque-used-in-extraneous-argument.rs:12:4 | LL | fn open_parent<'path>() { | ^^^^^^^^^^^ +help: remove the extra argument + | +LL - open_parent(&old_path) +LL + open_parent() + | error: aborting due to 7 previous errors diff --git a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr index 550996ab5e57c..e56a82575d82c 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr +++ b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr @@ -14,9 +14,12 @@ error[E0261]: use of undeclared lifetime name `'missing` --> $DIR/bad-lifetimes.rs:10:37 | LL | fn missing_lt() -> impl Sized + use<'missing> {} - | - ^^^^^^^^ undeclared lifetime - | | - | help: consider introducing lifetime `'missing` here: `<'missing>` + | ^^^^^^^^ undeclared lifetime + | +help: consider introducing lifetime `'missing` here + | +LL | fn missing_lt<'missing>() -> impl Sized + use<'missing> {} + | ++++++++++ error: expected lifetime parameter in `use<...>` precise captures list, found `'_` --> $DIR/bad-lifetimes.rs:3:39 diff --git a/tests/ui/impl-trait/precise-capturing/redundant.normal.stderr b/tests/ui/impl-trait/precise-capturing/redundant.normal.stderr index 44bc9f7daad8d..8cc3418c1bb62 100644 --- a/tests/ui/impl-trait/precise-capturing/redundant.normal.stderr +++ b/tests/ui/impl-trait/precise-capturing/redundant.normal.stderr @@ -2,19 +2,26 @@ warning: all possible in-scope parameters are already captured, so `use<...>` sy --> $DIR/redundant.rs:7:19 | LL | fn hello<'a>() -> impl Sized + use<'a> {} - | ^^^^^^^^^^^^^------- - | | - | help: remove the `use<...>` syntax + | ^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(impl_trait_redundant_captures)]` on by default +help: remove the `use<...>` syntax + | +LL - fn hello<'a>() -> impl Sized + use<'a> {} +LL + fn hello<'a>() -> impl Sized + {} + | warning: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant --> $DIR/redundant.rs:12:27 | LL | fn inherent(&self) -> impl Sized + use<'_> {} - | ^^^^^^^^^^^^^------- - | | - | help: remove the `use<...>` syntax + | ^^^^^^^^^^^^^^^^^^^^ + | +help: remove the `use<...>` syntax + | +LL - fn inherent(&self) -> impl Sized + use<'_> {} +LL + fn inherent(&self) -> impl Sized + {} + | warning: 2 warnings emitted diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr index 4352af1c0df76..3692cc77b0fb4 100644 --- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr +++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr @@ -26,13 +26,14 @@ LL | type Foo = impl PartialEq<(Foo, i32)>; | -------------------------- the found opaque type ... LL | fn eq(&self, _other: &(Foo, i32)) -> bool { - | ^^^^^^^^^^^ - | | - | expected `a::Bar`, found opaque type - | help: change the parameter type to match the trait: `&(a::Bar, i32)` + | ^^^^^^^^^^^ expected `a::Bar`, found opaque type | = note: expected signature `fn(&a::Bar, &(a::Bar, _)) -> _` found signature `fn(&a::Bar, &(a::Foo, _)) -> _` +help: change the parameter type to match the trait + | +LL | fn eq(&self, _other: &(a::Bar, i32)) -> bool { + | ~~~~~~~~~~~~~~ error: unconstrained opaque type --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:19:16 @@ -49,10 +50,7 @@ LL | type Foo = impl PartialEq<(Foo, i32)>; | -------------------------- the expected opaque type ... LL | fn eq(&self, _other: &(Bar, i32)) -> bool { - | ^^^^^^^^^^^ - | | - | expected opaque type, found `b::Bar` - | help: change the parameter type to match the trait: `&(b::Foo, i32)` + | ^^^^^^^^^^^ expected opaque type, found `b::Bar` | = note: expected signature `fn(&b::Bar, &(b::Foo, _)) -> _` found signature `fn(&b::Bar, &(b::Bar, _)) -> _` @@ -61,6 +59,10 @@ note: this item must have the opaque type in its signature in order to be able t | LL | fn eq(&self, _other: &(Bar, i32)) -> bool { | ^^ +help: change the parameter type to match the trait + | +LL | fn eq(&self, _other: &(b::Foo, i32)) -> bool { + | ~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/impl-trait/trait_type.stderr b/tests/ui/impl-trait/trait_type.stderr index 81e4c933e53f4..7fc1ede8eace7 100644 --- a/tests/ui/impl-trait/trait_type.stderr +++ b/tests/ui/impl-trait/trait_type.stderr @@ -2,13 +2,14 @@ error[E0053]: method `fmt` has an incompatible type for trait --> $DIR/trait_type.rs:7:21 | LL | fn fmt(&self, x: &str) -> () { } - | ^^^^ - | | - | types differ in mutability - | help: change the parameter type to match the trait: `&mut Formatter<'_>` + | ^^^^ types differ in mutability | = note: expected signature `fn(&MyType, &mut Formatter<'_>) -> Result<(), std::fmt::Error>` found signature `fn(&MyType, &str)` +help: change the parameter type to match the trait + | +LL | fn fmt(&self, x: &mut Formatter<'_>) -> () { } + | ~~~~~~~~~~~~~~~~~~ error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2 --> $DIR/trait_type.rs:12:11 @@ -32,7 +33,10 @@ error[E0046]: not all trait items implemented, missing: `fmt` LL | impl std::fmt::Display for MyType4 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | - = help: implement the missing item: `fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { todo!() }` +help: implement the missing item + | +LL | impl std::fmt::Display for MyType4 {fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { todo!() } + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 4 previous errors diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr index bffe0447f8bb4..f0d259d01de94 100644 --- a/tests/ui/impl-trait/where-allowed.stderr +++ b/tests/ui/impl-trait/where-allowed.stderr @@ -397,10 +397,7 @@ LL | type Out = impl Debug; | ---------- the expected opaque type ... LL | fn in_trait_impl_return() -> impl Debug { () } - | ^^^^^^^^^^ - | | - | expected opaque type, found a different opaque type - | help: change the output type to match the trait: `<() as DummyTrait>::Out` + | ^^^^^^^^^^ expected opaque type, found a different opaque type | note: type in trait --> $DIR/where-allowed.rs:119:34 @@ -410,6 +407,10 @@ LL | fn in_trait_impl_return() -> Self::Out; = note: expected signature `fn() -> <() as DummyTrait>::Out` found signature `fn() -> impl Debug` = note: distinct uses of `impl Trait` result in different opaque types +help: change the output type to match the trait + | +LL | fn in_trait_impl_return() -> <() as DummyTrait>::Out { () } + | ~~~~~~~~~~~~~~~~~~~~~~~ error: unconstrained opaque type --> $DIR/where-allowed.rs:122:16 diff --git a/tests/ui/imports/extern-crate-used.stderr b/tests/ui/imports/extern-crate-used.stderr index 982da0c913ed8..a944ad178f735 100644 --- a/tests/ui/imports/extern-crate-used.stderr +++ b/tests/ui/imports/extern-crate-used.stderr @@ -2,13 +2,18 @@ error: unused extern crate --> $DIR/extern-crate-used.rs:18:1 | LL | extern crate core; - | ^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/extern-crate-used.rs:6:9 | LL | #![deny(unused_extern_crates)] | ^^^^^^^^^^^^^^^^^^^^ +help: remove it + | +LL - extern crate core; +LL + + | error: aborting due to 1 previous error diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 4401ef58732e8..34654b484a614 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -70,13 +70,17 @@ LL | pub enum B { | ---------- similarly named enum `B` defined here ... LL | foo::(); - | ^ help: an enum with a similar name exists: `B` + | ^ | note: enum `bar::A` exists but is inaccessible --> $DIR/glob-resolve1.rs:11:5 | LL | enum A { | ^^^^^^ not accessible +help: an enum with a similar name exists + | +LL | foo::(); + | ~ error[E0412]: cannot find type `C` in this scope --> $DIR/glob-resolve1.rs:33:11 @@ -85,13 +89,17 @@ LL | pub enum B { | ---------- similarly named enum `B` defined here ... LL | foo::(); - | ^ help: an enum with a similar name exists: `B` + | ^ | note: struct `bar::C` exists but is inaccessible --> $DIR/glob-resolve1.rs:18:5 | LL | struct C; | ^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL | foo::(); + | ~ error[E0412]: cannot find type `D` in this scope --> $DIR/glob-resolve1.rs:34:11 @@ -100,13 +108,17 @@ LL | pub enum B { | ---------- similarly named enum `B` defined here ... LL | foo::(); - | ^ help: an enum with a similar name exists: `B` + | ^ | note: type alias `bar::D` exists but is inaccessible --> $DIR/glob-resolve1.rs:20:5 | LL | type D = isize; | ^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL | foo::(); + | ~ error: aborting due to 8 previous errors diff --git a/tests/ui/imports/import.stderr b/tests/ui/imports/import.stderr index 797712e2db99e..b6cc0fbfd3a11 100644 --- a/tests/ui/imports/import.stderr +++ b/tests/ui/imports/import.stderr @@ -2,10 +2,12 @@ error[E0432]: unresolved import `zed::baz` --> $DIR/import.rs:2:5 | LL | use zed::baz; - | ^^^^^--- - | | | - | | help: a similar name exists in the module: `bar` - | no `baz` in `zed` + | ^^^^^^^^ no `baz` in `zed` + | +help: a similar name exists in the module + | +LL | use zed::bar; + | ~~~ error[E0432]: unresolved import `foo` --> $DIR/import.rs:10:9 diff --git a/tests/ui/imports/issue-52891.stderr b/tests/ui/imports/issue-52891.stderr index 7bb1301edf264..5794c677c107b 100644 --- a/tests/ui/imports/issue-52891.stderr +++ b/tests/ui/imports/issue-52891.stderr @@ -15,12 +15,14 @@ LL | use issue_52891::a; | -------------- previous import of the module `a` here ... LL | use issue_52891::{a, b, c}; - | ^-- - | | - | `a` reimported here - | help: remove unnecessary import + | ^ `a` reimported here | = note: `a` must be defined only once in the type namespace of this module +help: remove unnecessary import + | +LL - use issue_52891::{a, b, c}; +LL + use issue_52891::{b, c}; + | error[E0252]: the name `a` is defined multiple times --> $DIR/issue-52891.rs:15:22 @@ -29,12 +31,14 @@ LL | use issue_52891::a; | -------------- previous import of the module `a` here ... LL | use issue_52891::{d, a, e}; - | ^-- - | | - | `a` reimported here - | help: remove unnecessary import + | ^ `a` reimported here | = note: `a` must be defined only once in the type namespace of this module +help: remove unnecessary import + | +LL - use issue_52891::{d, a, e}; +LL + use issue_52891::{d, e}; + | error[E0252]: the name `a` is defined multiple times --> $DIR/issue-52891.rs:16:25 @@ -54,12 +58,14 @@ LL | use issue_52891::a; | -------------- previous import of the module `a` here ... LL | use issue_52891::{a, - | ^-- - | | - | `a` reimported here - | help: remove unnecessary import + | ^ `a` reimported here | = note: `a` must be defined only once in the type namespace of this module +help: remove unnecessary import + | +LL - use issue_52891::{a, +LL + use issue_52891::{ + | error[E0252]: the name `a` is defined multiple times --> $DIR/issue-52891.rs:22:5 @@ -68,12 +74,14 @@ LL | use issue_52891::a; | -------------- previous import of the module `a` here ... LL | a, - | ^-- - | | - | `a` reimported here - | help: remove unnecessary import + | ^ `a` reimported here | = note: `a` must be defined only once in the type namespace of this module +help: remove unnecessary import + | +LL - a, +LL + + | error[E0252]: the name `a` is defined multiple times --> $DIR/issue-52891.rs:26:5 @@ -107,12 +115,13 @@ LL | extern crate issue_52891; | ------------------------- previous import of the extern crate `issue_52891` here ... LL | use issue_52891::{self}; - | ------------------^^^^-- - | | | - | | `issue_52891` reimported here - | help: remove unnecessary import + | ^^^^ `issue_52891` reimported here | = note: `issue_52891` must be defined only once in the type namespace of this module +help: remove unnecessary import + | +LL - use issue_52891::{self}; + | error[E0252]: the name `n` is defined multiple times --> $DIR/issue-52891.rs:36:5 diff --git a/tests/ui/imports/issue-55457.stderr b/tests/ui/imports/issue-55457.stderr index 09bb13a060478..9624622e2a6d3 100644 --- a/tests/ui/imports/issue-55457.stderr +++ b/tests/ui/imports/issue-55457.stderr @@ -2,10 +2,12 @@ error[E0432]: unresolved import `NonExistent` --> $DIR/issue-55457.rs:1:5 | LL | use NonExistent; - | ^^^^^^^^^^^ - | | - | no `NonExistent` in the root - | help: a similar name exists in the module: `non_existent` + | ^^^^^^^^^^^ no `NonExistent` in the root + | +help: a similar name exists in the module + | +LL | use non_existent; + | ~~~~~~~~~~~~ error[E0432]: unresolved import `non_existent` --> $DIR/issue-55457.rs:2:5 diff --git a/tests/ui/imports/resolve_self_super_hint.stderr b/tests/ui/imports/resolve_self_super_hint.stderr index bc862553b5bce..ea6c51f4ef1ec 100644 --- a/tests/ui/imports/resolve_self_super_hint.stderr +++ b/tests/ui/imports/resolve_self_super_hint.stderr @@ -2,31 +2,45 @@ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:3:9 | LL | use alloc::HashMap; - | ^^^^^ help: a similar path exists: `self::alloc` + | ^^^^^ + | +help: a similar path exists + | +LL | use self::alloc::HashMap; + | ~~~~~~~~~~~ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:8:13 | LL | use alloc::HashMap; - | ^^^^^ help: a similar path exists: `super::alloc` + | ^^^^^ + | +help: a similar path exists + | +LL | use super::alloc::HashMap; + | ~~~~~~~~~~~~ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:13:17 | LL | use alloc::HashMap; - | ^^^^^ - | | - | unresolved import - | help: a similar path exists: `a::alloc` + | ^^^^^ unresolved import + | +help: a similar path exists + | +LL | use a::alloc::HashMap; + | ~~~~~~~~ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:18:21 | LL | use alloc::HashMap; - | ^^^^^ - | | - | unresolved import - | help: a similar path exists: `a::alloc` + | ^^^^^ unresolved import + | +help: a similar path exists + | +LL | use a::alloc::HashMap; + | ~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/imports/shadow-glob-module-resolution-2.stderr b/tests/ui/imports/shadow-glob-module-resolution-2.stderr index 644fcb8416289..e57fcbd57a54b 100644 --- a/tests/ui/imports/shadow-glob-module-resolution-2.stderr +++ b/tests/ui/imports/shadow-glob-module-resolution-2.stderr @@ -16,10 +16,12 @@ error[E0432]: unresolved import `e` --> $DIR/shadow-glob-module-resolution-2.rs:13:5 | LL | use e as b; - | -^^^^^ - | | - | no `e` in the root - | help: a similar name exists in the module: `a` + | ^^^^^^ no `e` in the root + | +help: a similar name exists in the module + | +LL | use a as b; + | ~ error: aborting due to 3 previous errors diff --git a/tests/ui/indexing/index_message.stderr b/tests/ui/indexing/index_message.stderr index 6affb1ed96252..c4ddeea79413c 100644 --- a/tests/ui/indexing/index_message.stderr +++ b/tests/ui/indexing/index_message.stderr @@ -2,7 +2,12 @@ error[E0608]: cannot index into a value of type `({integer},)` --> $DIR/index_message.rs:3:14 | LL | let _ = z[0]; - | ^^^ help: to access tuple elements, use: `.0` + | ^^^ + | +help: to access tuple elements, use + | +LL | let _ = z.0; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/inference/array-len-mismatch.stderr b/tests/ui/inference/array-len-mismatch.stderr index 7358e47839725..33c9ee80bd161 100644 --- a/tests/ui/inference/array-len-mismatch.stderr +++ b/tests/ui/inference/array-len-mismatch.stderr @@ -3,18 +3,26 @@ error[E0308]: mismatched types | LL | let wrong: [u8; 3] = [10, 20]; | ------- ^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements - | | | - | | help: consider specifying the actual array length: `2` + | | | expected due to this + | +help: consider specifying the actual array length + | +LL | let wrong: [u8; 2] = [10, 20]; + | ~ error[E0308]: mismatched types --> $DIR/array-len-mismatch.rs:9:26 | LL | let wrong: [u8; 3] = returns_arr(); | ------- ^^^^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements - | | | - | | help: consider specifying the actual array length: `2` + | | | expected due to this + | +help: consider specifying the actual array length + | +LL | let wrong: [u8; 2] = returns_arr(); + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/inference/deref-suggestion.stderr b/tests/ui/inference/deref-suggestion.stderr index 096989db0b4e8..67dc3f678c855 100644 --- a/tests/ui/inference/deref-suggestion.stderr +++ b/tests/ui/inference/deref-suggestion.stderr @@ -2,9 +2,8 @@ error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:8:9 | LL | foo(s); - | --- ^- help: try using a conversion method: `.to_string()` - | | | - | | expected `String`, found `&String` + | --- ^ expected `String`, found `&String` + | | | arguments to this function are incorrect | note: function defined here @@ -12,6 +11,10 @@ note: function defined here | LL | fn foo(_: String) {} | ^^^ --------- +help: try using a conversion method + | +LL | foo(s.to_string()); + | ++++++++++++ error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:14:10 diff --git a/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr b/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr index e2ddf474c4a97..195594ef3ab5a 100644 --- a/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr +++ b/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr @@ -23,9 +23,12 @@ error[E0261]: use of undeclared lifetime name `'q` --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:14:21 | LL | impl<'static> Query<'q> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'q` here: `'q,` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'q` here + | +LL | impl<'q, 'static> Query<'q> { + | +++ error[E0392]: lifetime parameter `'q` is never used --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:11:14 @@ -55,16 +58,18 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:21:31 | LL | LendingIterator::for_each(Query::new(&data), Box::new); - | ^^^^^^^^^^ ----- - | | - | unexpected argument of type `&fn() {data}` - | help: remove the extra argument + | ^^^^^^^^^^ ----- unexpected argument of type `&fn() {data}` | note: associated function defined here --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:17:12 | LL | pub fn new() -> Self {} | ^^^ +help: remove the extra argument + | +LL - LendingIterator::for_each(Query::new(&data), Box::new); +LL + LendingIterator::for_each(Query::new(), Box::new); + | error: aborting due to 6 previous errors diff --git a/tests/ui/inference/issue-107090.stderr b/tests/ui/inference/issue-107090.stderr index e509e262fb1bd..0deafdfb931be 100644 --- a/tests/ui/inference/issue-107090.stderr +++ b/tests/ui/inference/issue-107090.stderr @@ -33,15 +33,23 @@ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/issue-107090.rs:11:47 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'b` here: `'b,` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'b` here + | +LL | impl<'b, 'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { + | +++ error[E0261]: use of undeclared lifetime name `'out` --> $DIR/issue-107090.rs:11:67 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { - | - help: consider introducing lifetime `'out` here: `'out,` ^^^^ undeclared lifetime + | ^^^^ undeclared lifetime + | +help: consider introducing lifetime `'out` here + | +LL | impl<'out, 'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { + | +++++ error[E0261]: use of undeclared lifetime name `'out` --> $DIR/issue-107090.rs:14:49 @@ -62,9 +70,12 @@ error[E0261]: use of undeclared lifetime name `'short` --> $DIR/issue-107090.rs:20:68 | LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { - | - ^^^^^^ undeclared lifetime - | | - | help: consider introducing lifetime `'short` here: `'short,` + | ^^^^^^ undeclared lifetime + | +help: consider introducing lifetime `'short` here + | +LL | fn badboi<'short, 'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { + | +++++++ error: aborting due to 6 previous errors diff --git a/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr index 1fea73529a8a2..c35675e84e08e 100644 --- a/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr +++ b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr @@ -35,12 +35,14 @@ LL | fn baz(x: bool) -> Result<(), MyError> { | --- ^^^^^^^^^^^^^^^^^^^ expected `Result<(), MyError>`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -... -LL | Err(MyError); - | - help: remove this semicolon to return this value | = note: expected enum `Result<(), MyError>` found unit type `()` +help: remove this semicolon to return this value + | +LL - Err(MyError); +LL + Err(MyError) + | error[E0308]: mismatched types --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:35:10 @@ -49,12 +51,16 @@ LL | if x { | __________^ LL | | LL | | error(); - | | - help: remove this semicolon to return this value LL | | } else { | |_____^ expected `Result<(), MyError>`, found `()` | = note: expected enum `Result<(), MyError>` found unit type `()` +help: remove this semicolon to return this value + | +LL - error(); +LL + error() + | error[E0308]: mismatched types --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:38:12 @@ -63,12 +69,16 @@ LL | } else { | ____________^ LL | | LL | | error(); - | | - help: remove this semicolon to return this value LL | | } | |_____^ expected `Result<(), MyError>`, found `()` | = note: expected enum `Result<(), MyError>` found unit type `()` +help: remove this semicolon to return this value + | +LL - error(); +LL + error() + | error[E0282]: type annotations needed --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:45:5 diff --git a/tests/ui/inference/stmts-as-exp-105431.stderr b/tests/ui/inference/stmts-as-exp-105431.stderr index f3da04b39a371..dd9aa30b6db93 100644 --- a/tests/ui/inference/stmts-as-exp-105431.stderr +++ b/tests/ui/inference/stmts-as-exp-105431.stderr @@ -25,9 +25,14 @@ LL | if true { | _____________^ LL | | eprintln!("hello"); LL | | 3; - | | - help: remove this semicolon to return this value LL | | } | |_____^ expected `i32`, found `()` + | +help: remove this semicolon to return this value + | +LL - 3; +LL + 3 + | error[E0308]: mismatched types --> $DIR/stmts-as-exp-105431.rs:19:10 @@ -35,9 +40,14 @@ error[E0308]: mismatched types LL | else { | __________^ LL | | 4; - | | - help: remove this semicolon to return this value LL | | } | |_____^ expected `i32`, found `()` + | +help: remove this semicolon to return this value + | +LL - 4; +LL + 4 + | error[E0308]: mismatched types --> $DIR/stmts-as-exp-105431.rs:30:5 @@ -63,19 +73,25 @@ error[E0308]: mismatched types --> $DIR/stmts-as-exp-105431.rs:36:14 | LL | 1 => { 1; } - | ^^^-^^ - | | | - | | help: remove this semicolon to return this value - | expected `i32`, found `()` + | ^^^^^^ expected `i32`, found `()` + | +help: remove this semicolon to return this value + | +LL - 1 => { 1; } +LL + 1 => { 1 } + | error[E0308]: mismatched types --> $DIR/stmts-as-exp-105431.rs:37:14 | LL | _ => { 2; } - | ^^^-^^ - | | | - | | help: remove this semicolon to return this value - | expected `i32`, found `()` + | ^^^^^^ expected `i32`, found `()` + | +help: remove this semicolon to return this value + | +LL - _ => { 2; } +LL + _ => { 2 } + | error[E0308]: `match` arms have incompatible types --> $DIR/stmts-as-exp-105431.rs:45:16 @@ -85,12 +101,15 @@ LL | let res = match v { LL | | 1 => { if 1 < 2 { 1 } else { 2 } } | | ------------------------- this is found to be of type `{integer}` LL | | _ => { 2; } - | | ^- - | | || - | | |help: consider removing this semicolon - | | expected integer, found `()` + | | ^^ expected integer, found `()` LL | | }; | |_____- `match` arms have incompatible types + | +help: consider removing this semicolon + | +LL - _ => { 2; } +LL + _ => { 2 } + | error[E0308]: mismatched types --> $DIR/stmts-as-exp-105431.rs:59:5 @@ -117,12 +136,15 @@ error[E0308]: mismatched types | LL | fn test_if_match_mixed_failed() -> i32 { | --- expected `i32` because of return type -LL | let x = if true { -LL | 3; - | - help: remove this semicolon to return this value ... LL | x | ^ expected `i32`, found `()` + | +help: remove this semicolon to return this value + | +LL - 3; +LL + 3 + | error: aborting due to 9 previous errors diff --git a/tests/ui/internal-lints/diagnostics_incorrect.stderr b/tests/ui/internal-lints/diagnostics_incorrect.stderr index e849ca2829e43..916373119f939 100644 --- a/tests/ui/internal-lints/diagnostics_incorrect.stderr +++ b/tests/ui/internal-lints/diagnostics_incorrect.stderr @@ -2,7 +2,12 @@ error: malformed `rustc_lint_diagnostics` attribute input --> $DIR/diagnostics_incorrect.rs:10:5 | LL | #[rustc_lint_diagnostics(a)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_diagnostics]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[rustc_lint_diagnostics] + | error: attribute should be applied to a function definition --> $DIR/diagnostics_incorrect.rs:5:1 diff --git a/tests/ui/internal-lints/query_stability_incorrect.stderr b/tests/ui/internal-lints/query_stability_incorrect.stderr index 3f78b39edd96a..8715bd2b74e54 100644 --- a/tests/ui/internal-lints/query_stability_incorrect.stderr +++ b/tests/ui/internal-lints/query_stability_incorrect.stderr @@ -2,7 +2,12 @@ error: malformed `rustc_lint_query_instability` attribute input --> $DIR/query_stability_incorrect.rs:10:5 | LL | #[rustc_lint_query_instability(a)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_query_instability]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[rustc_lint_query_instability] + | error: attribute should be applied to a function definition --> $DIR/query_stability_incorrect.rs:5:1 diff --git a/tests/ui/internal-lints/rustc_pass_by_value_self.stderr b/tests/ui/internal-lints/rustc_pass_by_value_self.stderr index fb39ed60b8235..4cc990f14f616 100644 --- a/tests/ui/internal-lints/rustc_pass_by_value_self.stderr +++ b/tests/ui/internal-lints/rustc_pass_by_value_self.stderr @@ -2,37 +2,61 @@ error: passing `TyCtxt<'tcx>` by reference --> $DIR/rustc_pass_by_value_self.rs:18:15 | LL | fn by_ref(&self) {} - | ^^^^^ help: try passing by value: `TyCtxt<'tcx>` + | ^^^^^ | note: the lint level is defined here --> $DIR/rustc_pass_by_value_self.rs:8:9 | LL | #![deny(rustc::pass_by_value)] | ^^^^^^^^^^^^^^^^^^^^ +help: try passing by value + | +LL | fn by_ref(TyCtxt<'tcx>) {} + | ~~~~~~~~~~~~ error: passing `Ty<'tcx>` by reference --> $DIR/rustc_pass_by_value_self.rs:30:21 | LL | fn by_ref(self: &Ty<'tcx>) {} - | ^^^^^^^^^ help: try passing by value: `Ty<'tcx>` + | ^^^^^^^^^ + | +help: try passing by value + | +LL | fn by_ref(self: Ty<'tcx>) {} + | ~~~~~~~~ error: passing `Foo` by reference --> $DIR/rustc_pass_by_value_self.rs:37:17 | LL | fn with_ref(&self) {} - | ^^^^^ help: try passing by value: `Foo` + | ^^^^^ + | +help: try passing by value + | +LL | fn with_ref(Foo) {} + | ~~~ error: passing `WithParameters` by reference --> $DIR/rustc_pass_by_value_self.rs:47:17 | LL | fn with_ref(&self) {} - | ^^^^^ help: try passing by value: `WithParameters` + | ^^^^^ + | +help: try passing by value + | +LL | fn with_ref(WithParameters) {} + | ~~~~~~~~~~~~~~~~~~~~ error: passing `WithParameters` by reference --> $DIR/rustc_pass_by_value_self.rs:51:17 | LL | fn with_ref(&self) {} - | ^^^^^ help: try passing by value: `WithParameters` + | ^^^^^ + | +help: try passing by value + | +LL | fn with_ref(WithParameters) {} + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/invalid/invalid-crate-type-macro.stderr b/tests/ui/invalid/invalid-crate-type-macro.stderr index 1cf77d4086bb0..5230cfa7bf5d4 100644 --- a/tests/ui/invalid/invalid-crate-type-macro.stderr +++ b/tests/ui/invalid/invalid-crate-type-macro.stderr @@ -2,7 +2,12 @@ error: malformed `crate_type` attribute input --> $DIR/invalid-crate-type-macro.rs:1:1 | LL | #![crate_type = foo!()] - | ^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "bin|lib|..."]` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #![crate_type = "bin|lib|..."] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/invalid/invalid-crate-type.stderr b/tests/ui/invalid/invalid-crate-type.stderr index 59d5d7bc9bbf0..981f976949cdd 100644 --- a/tests/ui/invalid/invalid-crate-type.stderr +++ b/tests/ui/invalid/invalid-crate-type.stderr @@ -10,49 +10,89 @@ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:6:15 | LL | #![crate_type="statoclib"] - | ^^^^^^^^^^^ help: did you mean: `"staticlib"` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | #![crate_type="staticlib"] + | ~~~~~~~~~~~ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:11:15 | LL | #![crate_type="procmacro"] - | ^^^^^^^^^^^ help: did you mean: `"proc-macro"` + | ^^^^^^^^^^^ + | +help: did you mean + | +LL | #![crate_type="proc-macro"] + | ~~~~~~~~~~~~ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:16:15 | LL | #![crate_type="static-lib"] - | ^^^^^^^^^^^^ help: did you mean: `"staticlib"` + | ^^^^^^^^^^^^ + | +help: did you mean + | +LL | #![crate_type="staticlib"] + | ~~~~~~~~~~~ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:21:15 | LL | #![crate_type="drylib"] - | ^^^^^^^^ help: did you mean: `"dylib"` + | ^^^^^^^^ + | +help: did you mean + | +LL | #![crate_type="dylib"] + | ~~~~~~~ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:26:15 | LL | #![crate_type="dlib"] - | ^^^^^^ help: did you mean: `"rlib"` + | ^^^^^^ + | +help: did you mean + | +LL | #![crate_type="rlib"] + | ~~~~~~ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:31:15 | LL | #![crate_type="lob"] - | ^^^^^ help: did you mean: `"lib"` + | ^^^^^ + | +help: did you mean + | +LL | #![crate_type="lib"] + | ~~~~~ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:36:15 | LL | #![crate_type="bon"] - | ^^^^^ help: did you mean: `"bin"` + | ^^^^^ + | +help: did you mean + | +LL | #![crate_type="bin"] + | ~~~~~ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:41:15 | LL | #![crate_type="cdalib"] - | ^^^^^^^^ help: did you mean: `"cdylib"` + | ^^^^^^^^ + | +help: did you mean + | +LL | #![crate_type="cdylib"] + | ~~~~~~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/invalid/invalid-rustc_legacy_const_generics-arguments.stderr b/tests/ui/invalid/invalid-rustc_legacy_const_generics-arguments.stderr index 1ced1433fe955..33008e6c2626f 100644 --- a/tests/ui/invalid/invalid-rustc_legacy_const_generics-arguments.stderr +++ b/tests/ui/invalid/invalid-rustc_legacy_const_generics-arguments.stderr @@ -10,13 +10,23 @@ error: malformed `rustc_legacy_const_generics` attribute input --> $DIR/invalid-rustc_legacy_const_generics-arguments.rs:37:1 | LL | #[rustc_legacy_const_generics] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_legacy_const_generics(N)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[rustc_legacy_const_generics(N)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `rustc_legacy_const_generics` attribute input --> $DIR/invalid-rustc_legacy_const_generics-arguments.rs:40:1 | LL | #[rustc_legacy_const_generics = 1] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_legacy_const_generics(N)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[rustc_legacy_const_generics(N)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: #[rustc_legacy_const_generics] must have one index for each generic parameter --> $DIR/invalid-rustc_legacy_const_generics-arguments.rs:3:1 diff --git a/tests/ui/invalid_crate_type_syntax.stderr b/tests/ui/invalid_crate_type_syntax.stderr index a5563720f6223..be90af38ec2bb 100644 --- a/tests/ui/invalid_crate_type_syntax.stderr +++ b/tests/ui/invalid_crate_type_syntax.stderr @@ -2,7 +2,12 @@ error: malformed `crate_type` attribute input --> $DIR/invalid_crate_type_syntax.rs:2:1 | LL | #![crate_type(lib)] - | ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "bin|lib|..."]` + | ^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #![crate_type = "bin|lib|..."] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-13058.stderr b/tests/ui/issues/issue-13058.stderr index 7cc2860eb5086..570bd10d13202 100644 --- a/tests/ui/issues/issue-13058.stderr +++ b/tests/ui/issues/issue-13058.stderr @@ -1,11 +1,13 @@ error[E0621]: explicit lifetime required in the type of `cont` --> $DIR/issue-13058.rs:14:21 | -LL | fn check<'r, I: Iterator, T: Itble<'r, usize, I>>(cont: &T) -> bool - | -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T` -LL | { LL | let cont_iter = cont.iter(); | ^^^^^^^^^^^ lifetime `'r` required + | +help: add explicit lifetime `'r` to the type of `cont` + | +LL | fn check<'r, I: Iterator, T: Itble<'r, usize, I>>(cont: &'r T) -> bool + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-14285.stderr b/tests/ui/issues/issue-14285.stderr index 4f89ae51157b8..202684efd426c 100644 --- a/tests/ui/issues/issue-14285.stderr +++ b/tests/ui/issues/issue-14285.stderr @@ -1,10 +1,13 @@ error[E0621]: explicit lifetime required in the type of `a` --> $DIR/issue-14285.rs:12:5 | -LL | fn foo<'a>(a: &dyn Foo) -> B<'a> { - | -------- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)` LL | B(a) | ^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `a` + | +LL | fn foo<'a>(a: &'a (dyn Foo + 'a)) -> B<'a> { + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-15034.stderr b/tests/ui/issues/issue-15034.stderr index 587a5c85e924a..a305212125ca3 100644 --- a/tests/ui/issues/issue-15034.stderr +++ b/tests/ui/issues/issue-15034.stderr @@ -1,10 +1,13 @@ error[E0621]: explicit lifetime required in the type of `lexer` --> $DIR/issue-15034.rs:17:9 | -LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> { - | ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>` LL | Parser { lexer: lexer } | ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `lexer` + | +LL | pub fn new(lexer: &'a mut Lexer<'a>) -> Parser<'a> { + | ~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-16048.stderr b/tests/ui/issues/issue-16048.stderr index 73610942d7a7e..af3ace874e1c9 100644 --- a/tests/ui/issues/issue-16048.stderr +++ b/tests/ui/issues/issue-16048.stderr @@ -11,9 +11,13 @@ error[E0605]: non-primitive cast: `Foo<'a>` as `T` --> $DIR/issue-16048.rs:24:16 | LL | return *self as T; - | ^^^^^^^^^^ help: consider using the `From` trait instead: `T::from(*self)` + | ^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object +help: consider using the `From` trait instead + | +LL | return T::from(*self); + | ~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-16939.stderr b/tests/ui/issues/issue-16939.stderr index 229ff9f181773..6e0889b89635b 100644 --- a/tests/ui/issues/issue-16939.stderr +++ b/tests/ui/issues/issue-16939.stderr @@ -2,16 +2,18 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/issue-16939.rs:5:9 | LL | |t| f(t); - | ^ - - | | - | unexpected argument - | help: remove the extra argument + | ^ - unexpected argument | note: callable defined here --> $DIR/issue-16939.rs:4:12 | LL | fn _foo (f: F) { | ^^^^ +help: remove the extra argument + | +LL - |t| f(t); +LL + |t| f(); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-17441.stderr b/tests/ui/issues/issue-17441.stderr index 29e50b91c7c6f..f7a236ed264ba 100644 --- a/tests/ui/issues/issue-17441.stderr +++ b/tests/ui/issues/issue-17441.stderr @@ -2,17 +2,23 @@ error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` --> $DIR/issue-17441.rs:2:16 | LL | let _foo = &[1_usize, 2] as [usize]; - | ^^^^^^^^^^^^^^^^^------- - | | - | help: try casting to a reference instead: `&[usize]` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try casting to a reference instead + | +LL | let _foo = &[1_usize, 2] as &[usize]; + | ~~~~~~~~ error[E0620]: cast to unsized type: `Box` as `dyn Debug` --> $DIR/issue-17441.rs:5:16 | LL | let _bar = Box::new(1_usize) as dyn std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^^------------------- - | | - | help: you can cast to a `Box` instead: `Box` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you can cast to a `Box` instead + | +LL | let _bar = Box::new(1_usize) as Box; + | ~~~~~~~~~~~~~~~~~~~~~~~~ error[E0620]: cast to unsized type: `usize` as `dyn Debug` --> $DIR/issue-17441.rs:8:16 diff --git a/tests/ui/issues/issue-17999.stderr b/tests/ui/issues/issue-17999.stderr index 4a1ef7350b8cb..d1cb37ac71267 100644 --- a/tests/ui/issues/issue-17999.stderr +++ b/tests/ui/issues/issue-17999.stderr @@ -2,19 +2,28 @@ error: unused variable: `x` --> $DIR/issue-17999.rs:5:13 | LL | let x = (); - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/issue-17999.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | let _x = (); + | ~~ error: unused variable: `a` --> $DIR/issue-17999.rs:7:13 | LL | a => {} - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _a => {} + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-18423.stderr b/tests/ui/issues/issue-18423.stderr index 2c6015eaa9d4b..a73688205ac80 100644 --- a/tests/ui/issues/issue-18423.stderr +++ b/tests/ui/issues/issue-18423.stderr @@ -2,9 +2,13 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-18423.rs:4:8 | LL | x: Box<'a, isize> - | ^^^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^^ expected 0 lifetime arguments + | +help: remove this lifetime argument + | +LL - x: Box<'a, isize> +LL + x: Box<, isize> + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-19086.stderr b/tests/ui/issues/issue-19086.stderr index 03b9249bb1e3d..b9ca594852dea 100644 --- a/tests/ui/issues/issue-19086.stderr +++ b/tests/ui/issues/issue-19086.stderr @@ -5,7 +5,12 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB(a, b) => println!("{} {}", a, b), - | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: b }` + | ^^^^^^^^^^ + | +help: use struct pattern syntax instead + | +LL | FooB { x: a, y: b } => println!("{} {}", a, b), + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-19100.stderr b/tests/ui/issues/issue-19100.stderr index ebbf083b7dea8..fbc14e138ef8e 100644 --- a/tests/ui/issues/issue-19100.stderr +++ b/tests/ui/issues/issue-19100.stderr @@ -2,15 +2,24 @@ error[E0170]: pattern binding `Bar` is named the same as one of the variants of --> $DIR/issue-19100.rs:17:1 | LL | Bar if true - | ^^^ help: to match on the variant, qualify the path: `Foo::Bar` + | ^^^ | = note: `#[deny(bindings_with_variant_name)]` on by default +help: to match on the variant, qualify the path + | +LL | Foo::Bar if true + | ~~~~~~~~ error[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo` --> $DIR/issue-19100.rs:21:1 | LL | Baz if false - | ^^^ help: to match on the variant, qualify the path: `Foo::Baz` + | ^^^ + | +help: to match on the variant, qualify the path + | +LL | Foo::Baz if false + | ~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-19482.stderr b/tests/ui/issues/issue-19482.stderr index 903a9f98c7588..9bb28475e0051 100644 --- a/tests/ui/issues/issue-19482.stderr +++ b/tests/ui/issues/issue-19482.stderr @@ -5,7 +5,12 @@ LL | type A; | ------ `A` defined here ... LL | fn bar(x: &dyn Foo) {} - | ^^^ help: specify the associated type: `Foo` + | ^^^ + | +help: specify the associated type + | +LL | fn bar(x: &dyn Foo) {} + | ~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-20225.stderr b/tests/ui/issues/issue-20225.stderr index 2d24a5bbd50ab..7d6b09cf7f893 100644 --- a/tests/ui/issues/issue-20225.stderr +++ b/tests/ui/issues/issue-20225.stderr @@ -4,13 +4,14 @@ error[E0053]: method `call` has an incompatible type for trait LL | impl<'a, T> Fn<(&'a T,)> for Foo { | - found this type parameter LL | extern "rust-call" fn call(&self, (_,): (T,)) {} - | ^^^^ - | | - | expected `&'a T`, found type parameter `T` - | help: change the parameter type to match the trait: `(&'a T,)` + | ^^^^ expected `&'a T`, found type parameter `T` | = note: expected signature `extern "rust-call" fn(&Foo, (&'a _,))` found signature `extern "rust-call" fn(&Foo, (_,))` +help: change the parameter type to match the trait + | +LL | extern "rust-call" fn call(&self, (_,): (&'a T,)) {} + | ~~~~~~~~ error[E0053]: method `call_mut` has an incompatible type for trait --> $DIR/issue-20225.rs:11:51 @@ -18,13 +19,14 @@ error[E0053]: method `call_mut` has an incompatible type for trait LL | impl<'a, T> FnMut<(&'a T,)> for Foo { | - found this type parameter LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {} - | ^^^^ - | | - | expected `&'a T`, found type parameter `T` - | help: change the parameter type to match the trait: `(&'a T,)` + | ^^^^ expected `&'a T`, found type parameter `T` | = note: expected signature `extern "rust-call" fn(&mut Foo, (&'a _,))` found signature `extern "rust-call" fn(&mut Foo, (_,))` +help: change the parameter type to match the trait + | +LL | extern "rust-call" fn call_mut(&mut self, (_,): (&'a T,)) {} + | ~~~~~~~~ error[E0053]: method `call_once` has an incompatible type for trait --> $DIR/issue-20225.rs:18:47 @@ -33,13 +35,14 @@ LL | impl<'a, T> FnOnce<(&'a T,)> for Foo { | - found this type parameter ... LL | extern "rust-call" fn call_once(self, (_,): (T,)) {} - | ^^^^ - | | - | expected `&'a T`, found type parameter `T` - | help: change the parameter type to match the trait: `(&'a T,)` + | ^^^^ expected `&'a T`, found type parameter `T` | = note: expected signature `extern "rust-call" fn(Foo, (&'a _,))` found signature `extern "rust-call" fn(Foo, (_,))` +help: change the parameter type to match the trait + | +LL | extern "rust-call" fn call_once(self, (_,): (&'a T,)) {} + | ~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/issues/issue-21332.stderr b/tests/ui/issues/issue-21332.stderr index 96e0f5fdb31db..7c960f7646db7 100644 --- a/tests/ui/issues/issue-21332.stderr +++ b/tests/ui/issues/issue-21332.stderr @@ -2,13 +2,14 @@ error[E0053]: method `next` has an incompatible type for trait --> $DIR/issue-21332.rs:5:27 | LL | fn next(&mut self) -> Result { Ok(7) } - | ^^^^^^^^^^^^^^^^ - | | - | expected `Option`, found `Result` - | help: change the output type to match the trait: `Option` + | ^^^^^^^^^^^^^^^^ expected `Option`, found `Result` | = note: expected signature `fn(&mut S) -> Option` found signature `fn(&mut S) -> Result` +help: change the output type to match the trait + | +LL | fn next(&mut self) -> Option { Ok(7) } + | ~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-21950.stderr b/tests/ui/issues/issue-21950.stderr index 584370c717827..2d65491af278f 100644 --- a/tests/ui/issues/issue-21950.stderr +++ b/tests/ui/issues/issue-21950.stderr @@ -5,7 +5,12 @@ LL | type Output; | ----------- `Output` defined here ... LL | let x = &10 as &dyn Add; - | ^^^ help: specify the associated type: `Add` + | ^^^ + | +help: specify the associated type + | +LL | let x = &10 as &dyn Add; + | ~~~~~~~~~~~~~~~~~~ error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/issue-21950.rs:10:25 diff --git a/tests/ui/issues/issue-22434.stderr b/tests/ui/issues/issue-22434.stderr index 172ae386c3e4a..891135745f743 100644 --- a/tests/ui/issues/issue-22434.stderr +++ b/tests/ui/issues/issue-22434.stderr @@ -5,7 +5,12 @@ LL | type A; | ------ `A` defined here ... LL | type I<'a> = &'a (dyn Foo + 'a); - | ^^^ help: specify the associated type: `Foo` + | ^^^ + | +help: specify the associated type + | +LL | type I<'a> = &'a (dyn Foo + 'a); + | ~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-22599.stderr b/tests/ui/issues/issue-22599.stderr index b599f6febe31b..1d4f7c150e90a 100644 --- a/tests/ui/issues/issue-22599.stderr +++ b/tests/ui/issues/issue-22599.stderr @@ -2,13 +2,17 @@ error: unused variable: `a` --> $DIR/issue-22599.rs:8:19 | LL | v = match 0 { a => 0 }; - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: the lint level is defined here --> $DIR/issue-22599.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | v = match 0 { _a => 0 }; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-23024.stderr b/tests/ui/issues/issue-23024.stderr index 1672622d8b723..9873d52679053 100644 --- a/tests/ui/issues/issue-23024.stderr +++ b/tests/ui/issues/issue-23024.stderr @@ -2,11 +2,15 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subje --> $DIR/issue-23024.rs:8:39 | LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); - | ^^ help: use parenthetical notation instead: `Fn() -> ()` + | ^^ | = note: see issue #29625 for more information = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: use parenthetical notation instead + | +LL | println!("{:?}",(vfnfer[0] as dyn Fn() -> ())(3)); + | ~~~~~~~~~~ error[E0107]: missing generics for trait `Fn` --> $DIR/issue-23024.rs:8:39 @@ -23,7 +27,12 @@ error[E0191]: the value of the associated type `Output` in `FnOnce` must be spec --> $DIR/issue-23024.rs:8:39 | LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); - | ^^ help: specify the associated type: `Fn` + | ^^ + | +help: specify the associated type + | +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/issues/issue-23217.stderr b/tests/ui/issues/issue-23217.stderr index 05ee0474c7838..d14da75ab72e6 100644 --- a/tests/ui/issues/issue-23217.stderr +++ b/tests/ui/issues/issue-23217.stderr @@ -4,10 +4,12 @@ error[E0599]: no variant or associated item named `A` found for enum `SomeEnum` LL | pub enum SomeEnum { | ----------------- variant or associated item `A` not found for this enum LL | B = SomeEnum::A, - | ^ - | | - | variant or associated item not found in `SomeEnum` - | help: there is a variant with a similar name: `B` + | ^ variant or associated item not found in `SomeEnum` + | +help: there is a variant with a similar name + | +LL | B = SomeEnum::B, + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-27042.stderr b/tests/ui/issues/issue-27042.stderr index 6586e61f2f644..c709e150b4de5 100644 --- a/tests/ui/issues/issue-27042.stderr +++ b/tests/ui/issues/issue-27042.stderr @@ -4,9 +4,13 @@ warning: denote infinite loops with `loop { ... }` LL | / 'b: LL | | LL | | while true { break }; // but here we cite the whole loop - | |__________________^ help: use `loop` + | |__________________^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | 'b: loop { break }; // but here we cite the whole loop + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/issue-27042.rs:6:16 diff --git a/tests/ui/issues/issue-27433.stderr b/tests/ui/issues/issue-27433.stderr index aba8e612858a2..537809b3d0e97 100644 --- a/tests/ui/issues/issue-27433.stderr +++ b/tests/ui/issues/issue-27433.stderr @@ -2,9 +2,12 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-27433.rs:5:23 | LL | const FOO : u32 = foo; - | --------- ^^^ non-constant value - | | - | help: consider using `let` instead of `const`: `let FOO` + | ^^^ non-constant value + | +help: consider using `let` instead of `const` + | +LL | let FOO : u32 = foo; + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-27842.stderr b/tests/ui/issues/issue-27842.stderr index b18fe1512b50b..cce721b5251da 100644 --- a/tests/ui/issues/issue-27842.stderr +++ b/tests/ui/issues/issue-27842.stderr @@ -2,7 +2,12 @@ error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer --> $DIR/issue-27842.rs:4:16 | LL | let _ = tup[0]; - | ^^^ help: to access tuple elements, use: `.0` + | ^^^ + | +help: to access tuple elements, use + | +LL | let _ = tup.0; + | ~~ error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` --> $DIR/issue-27842.rs:9:16 diff --git a/tests/ui/issues/issue-28344.stderr b/tests/ui/issues/issue-28344.stderr index d30fb3cfe58ab..c6423c07449bc 100644 --- a/tests/ui/issues/issue-28344.stderr +++ b/tests/ui/issues/issue-28344.stderr @@ -16,7 +16,12 @@ error[E0191]: the value of the associated type `Output` in `BitXor` must be spec --> $DIR/issue-28344.rs:4:17 | LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); - | ^^^^^^ help: specify the associated type: `BitXor` + | ^^^^^^ + | +help: specify the associated type + | +LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); + | ~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no function or associated item named `bitor` found for trait object `dyn BitXor<_>` in the current scope --> $DIR/issue-28344.rs:4:25 @@ -44,7 +49,12 @@ error[E0191]: the value of the associated type `Output` in `BitXor` must be spec --> $DIR/issue-28344.rs:10:13 | LL | let g = BitXor::bitor; - | ^^^^^^ help: specify the associated type: `BitXor` + | ^^^^^^ + | +help: specify the associated type + | +LL | let g = BitXor::bitor; + | ~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no function or associated item named `bitor` found for trait object `dyn BitXor<_>` in the current scope --> $DIR/issue-28344.rs:10:21 diff --git a/tests/ui/issues/issue-28433.stderr b/tests/ui/issues/issue-28433.stderr index 0fa67e35f1d4b..89468a087def1 100644 --- a/tests/ui/issues/issue-28433.stderr +++ b/tests/ui/issues/issue-28433.stderr @@ -2,17 +2,27 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-28433.rs:2:5 | LL | pub Duck, - | ^^^ help: remove the qualifier + | ^^^ | = note: enum variants and their fields always share the visibility of the enum they are in +help: remove the qualifier + | +LL - pub Duck, +LL + Duck, + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-28433.rs:5:5 | LL | pub(crate) Dove - | ^^^^^^^^^^ help: remove the qualifier + | ^^^^^^^^^^ | = note: enum variants and their fields always share the visibility of the enum they are in +help: remove the qualifier + | +LL - pub(crate) Dove +LL + Dove + | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-2848.stderr b/tests/ui/issues/issue-2848.stderr index 1cef27c34635e..63c0d70d35f3e 100644 --- a/tests/ui/issues/issue-2848.stderr +++ b/tests/ui/issues/issue-2848.stderr @@ -10,9 +10,13 @@ error[E0170]: pattern binding `beta` is named the same as one of the variants of --> $DIR/issue-2848.rs:14:15 | LL | alpha | beta => {} - | ^^^^ help: to match on the variant, qualify the path: `bar::foo::beta` + | ^^^^ | = note: `#[deny(bindings_with_variant_name)]` on by default +help: to match on the variant, qualify the path + | +LL | alpha | bar::foo::beta => {} + | ~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-28971.stderr b/tests/ui/issues/issue-28971.stderr index 26057cbc2d1d8..7ca57d6b99817 100644 --- a/tests/ui/issues/issue-28971.stderr +++ b/tests/ui/issues/issue-28971.stderr @@ -5,10 +5,12 @@ LL | enum Foo { | -------- variant or associated item `Baz` not found for this enum ... LL | Foo::Baz(..) => (), - | ^^^ - | | - | variant or associated item not found in `Foo` - | help: there is a variant with a similar name: `Bar` + | ^^^ variant or associated item not found in `Foo` + | +help: there is a variant with a similar name + | +LL | Foo::Bar(..) => (), + | ~~~ error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable --> $DIR/issue-28971.rs:15:5 diff --git a/tests/ui/issues/issue-3154.stderr b/tests/ui/issues/issue-3154.stderr index 3106aaddc4a1c..a83d78e5c9523 100644 --- a/tests/ui/issues/issue-3154.stderr +++ b/tests/ui/issues/issue-3154.stderr @@ -1,10 +1,13 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/issue-3154.rs:6:5 | -LL | fn thing<'a,Q>(x: &Q) -> Thing<'a,Q> { - | -- help: add explicit lifetime `'a` to the type of `x`: `&'a Q` LL | Thing { x: x } | ^^^^^^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `x` + | +LL | fn thing<'a,Q>(x: &'a Q) -> Thing<'a,Q> { + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/issues/issue-32004.stderr index 2d2ed5a63015b..48e4030c3a4c2 100644 --- a/tests/ui/issues/issue-32004.stderr +++ b/tests/ui/issues/issue-32004.stderr @@ -25,7 +25,12 @@ LL | struct S; | --------- `S` defined here ... LL | S(()) => {} - | ^^^^^ help: use this syntax instead: `S` + | ^^^^^ + | +help: use this syntax instead + | +LL | S => {} + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-32086.stderr b/tests/ui/issues/issue-32086.stderr index e566dea89088d..ead431e345c94 100644 --- a/tests/ui/issues/issue-32086.stderr +++ b/tests/ui/issues/issue-32086.stderr @@ -5,7 +5,12 @@ LL | struct S(u8); | ------------- similarly named tuple struct `S` defined here ... LL | let C(a) = S(11); - | ^ help: a tuple struct with a similar name exists: `S` + | ^ + | +help: a tuple struct with a similar name exists + | +LL | let S(a) = S(11); + | ~ error[E0532]: expected tuple struct or tuple variant, found constant `C` --> $DIR/issue-32086.rs:6:9 @@ -14,7 +19,12 @@ LL | struct S(u8); | ------------- similarly named tuple struct `S` defined here ... LL | let C(..) = S(11); - | ^ help: a tuple struct with a similar name exists: `S` + | ^ + | +help: a tuple struct with a similar name exists + | +LL | let S(..) = S(11); + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-32655.stderr b/tests/ui/issues/issue-32655.stderr index b8362499b2d0a..af029884d6afb 100644 --- a/tests/ui/issues/issue-32655.stderr +++ b/tests/ui/issues/issue-32655.stderr @@ -2,7 +2,7 @@ error: cannot find attribute `derive_Clone` in this scope --> $DIR/issue-32655.rs:3:11 | LL | #[derive_Clone] - | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` + | ^^^^^^^^^^^^ ... LL | foo!(); | ------ in this macro invocation @@ -11,15 +11,24 @@ LL | foo!(); = note: similarly named attribute macro `derive_const` defined here | = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) +help: an attribute macro with a similar name exists + | +LL | #[derive_const] + | ~~~~~~~~~~~~ error: cannot find attribute `derive_Clone` in this scope --> $DIR/issue-32655.rs:15:7 | LL | #[derive_Clone] - | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` + | ^^^^^^^^^^^^ --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named attribute macro `derive_const` defined here + | +help: an attribute macro with a similar name exists + | +LL | #[derive_const] + | ~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-3344.stderr b/tests/ui/issues/issue-3344.stderr index eac8f10fcc164..d31e2a0173869 100644 --- a/tests/ui/issues/issue-3344.stderr +++ b/tests/ui/issues/issue-3344.stderr @@ -4,7 +4,10 @@ error[E0046]: not all trait items implemented, missing: `partial_cmp` LL | impl PartialOrd for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `partial_cmp` in implementation | - = help: implement the missing item: `fn partial_cmp(&self, _: &Thing) -> Option { todo!() }` +help: implement the missing item + | +LL + fn partial_cmp(&self, _: &Thing) -> Option { todo!() } + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-33504.stderr b/tests/ui/issues/issue-33504.stderr index f3e1ca08b6fc3..00be092375e12 100644 --- a/tests/ui/issues/issue-33504.stderr +++ b/tests/ui/issues/issue-33504.stderr @@ -9,7 +9,11 @@ LL | let Test = 1; | | | expected integer, found `Test` | `Test` is interpreted as a unit struct, not a new binding - | help: introduce a new binding instead: `other_test` + | +help: introduce a new binding instead + | +LL | let other_test = 1; + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-34209.stderr b/tests/ui/issues/issue-34209.stderr index 41bc60d03dd81..4c61d250f52d1 100644 --- a/tests/ui/issues/issue-34209.stderr +++ b/tests/ui/issues/issue-34209.stderr @@ -5,7 +5,12 @@ LL | enum S { | ------ variant `B` not found here ... LL | S::B {} => {}, - | ^ help: there is a variant with a similar name: `A` + | ^ + | +help: there is a variant with a similar name + | +LL | S::A {} => {}, + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-3521-2.stderr b/tests/ui/issues/issue-3521-2.stderr index 0be0e93c19e64..e691a66e93e88 100644 --- a/tests/ui/issues/issue-3521-2.stderr +++ b/tests/ui/issues/issue-3521-2.stderr @@ -2,9 +2,12 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-3521-2.rs:5:23 | LL | static y: isize = foo + 1; - | -------- ^^^ non-constant value - | | - | help: consider using `let` instead of `static`: `let y` + | ^^^ non-constant value + | +help: consider using `let` instead of `static` + | +LL | let y: isize = foo + 1; + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr index 3676f388891eb..7b385d6f330d5 100644 --- a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr +++ b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr @@ -2,9 +2,12 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-3668-2.rs:4:27 | LL | static child: isize = x + 1; - | ------------ ^ non-constant value - | | - | help: consider using `let` instead of `static`: `let child` + | ^ non-constant value + | +help: consider using `let` instead of `static` + | +LL | let child: isize = x + 1; + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr index d761b2d87db4e..bd8131bb8f3c6 100644 --- a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr +++ b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr @@ -2,9 +2,12 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-3668.rs:8:34 | LL | static childVal: Box

= self.child.get(); - | --------------- ^^^^ non-constant value - | | - | help: consider using `let` instead of `static`: `let childVal` + | ^^^^ non-constant value + | +help: consider using `let` instead of `static` + | +LL | let childVal: Box

= self.child.get(); + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-40288-2.stderr b/tests/ui/issues/issue-40288-2.stderr index 2c64856b08f8d..a4429ca0c0d15 100644 --- a/tests/ui/issues/issue-40288-2.stderr +++ b/tests/ui/issues/issue-40288-2.stderr @@ -1,20 +1,24 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/issue-40288-2.rs:9:5 | -LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { - | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` -... LL | out[0] | ^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `y` + | +LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &'a T) -> &'a T { + | ~~~~~ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/issue-40288-2.rs:24:5 | -LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { - | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` -... LL | out.head | ^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `y` + | +LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &'a T) -> &'a T { + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-40782.stderr b/tests/ui/issues/issue-40782.stderr index 81f419bf687f4..614980202385b 100644 --- a/tests/ui/issues/issue-40782.stderr +++ b/tests/ui/issues/issue-40782.stderr @@ -2,13 +2,23 @@ error: missing `in` in `for` loop --> $DIR/issue-40782.rs:4:11 | LL | for _i 0..2 { - | ^ help: try adding `in` here + | ^ + | +help: try adding `in` here + | +LL | for _i in 0..2 { + | ++ error: missing `in` in `for` loop --> $DIR/issue-40782.rs:6:12 | LL | for _i of 0..2 { - | ^^ help: try using `in` here instead + | ^^ + | +help: try using `in` here instead + | +LL | for _i in 0..2 { + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-4265.stderr b/tests/ui/issues/issue-4265.stderr index 23d00aaa44b54..e988f01d0f727 100644 --- a/tests/ui/issues/issue-4265.stderr +++ b/tests/ui/issues/issue-4265.stderr @@ -14,10 +14,7 @@ LL | struct Foo { | ---------- method `bar` not found for this struct ... LL | Foo { baz: 0 }.bar(); - | ---------------^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `Foo::bar()` + | ^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Foo` @@ -25,6 +22,10 @@ note: the candidate is defined in an impl for the type `Foo` | LL | fn bar() { | ^^^^^^^^ +help: use associated function syntax instead + | +LL | Foo::bar(); + | ~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-43988.stderr b/tests/ui/issues/issue-43988.stderr index 7bbb8ed2ca94c..ca8f7a19b5a81 100644 --- a/tests/ui/issues/issue-43988.stderr +++ b/tests/ui/issues/issue-43988.stderr @@ -2,13 +2,23 @@ error: malformed `repr` attribute input --> $DIR/issue-43988.rs:24:5 | LL | #[repr] - | ^^^^^^^ help: must be of the form: `#[repr(C)]` + | ^^^^^^^ + | +help: must be of the form + | +LL | #[repr(C)] + | error: malformed `repr` attribute input --> $DIR/issue-43988.rs:34:14 | LL | let _z = #[repr] 1; - | ^^^^^^^ help: must be of the form: `#[repr(C)]` + | ^^^^^^^ + | +help: must be of the form + | +LL | let _z = #[repr(C)] 1; + | ~~~~~~~~~~ error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43988.rs:5:5 diff --git a/tests/ui/issues/issue-44239.stderr b/tests/ui/issues/issue-44239.stderr index 633fb177b75df..7490bcd7fb768 100644 --- a/tests/ui/issues/issue-44239.stderr +++ b/tests/ui/issues/issue-44239.stderr @@ -1,11 +1,13 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-44239.rs:8:26 | -LL | let n: usize = 0; - | ----- help: consider using `const` instead of `let`: `const n` -... LL | const N: usize = n; | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const n: usize = 0; + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-45562.stderr b/tests/ui/issues/issue-45562.stderr index 6fae86f9f31ca..8c2b823041c63 100644 --- a/tests/ui/issues/issue-45562.stderr +++ b/tests/ui/issues/issue-45562.stderr @@ -2,11 +2,13 @@ error: const items should never be `#[no_mangle]` --> $DIR/issue-45562.rs:3:14 | LL | #[no_mangle] pub const RAH: usize = 5; - | ---------^^^^^^^^^^^^^^^^ - | | - | help: try a static value: `pub static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[deny(no_mangle_const_items)]` on by default +help: try a static value + | +LL | #[no_mangle] pub static RAH: usize = 5; + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-46332.stderr b/tests/ui/issues/issue-46332.stderr index 8c0c1dfa6ee86..639bd2be04bef 100644 --- a/tests/ui/issues/issue-46332.stderr +++ b/tests/ui/issues/issue-46332.stderr @@ -5,7 +5,12 @@ LL | struct TyUint {} | ------------- similarly named struct `TyUint` defined here ... LL | TyUInt {}; - | ^^^^^^ help: a struct with a similar name exists (notice the capitalization): `TyUint` + | ^^^^^^ + | +help: a struct with a similar name exists (notice the capitalization difference) + | +LL | TyUint {}; + | ~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-4935.stderr b/tests/ui/issues/issue-4935.stderr index 25f299ae5f3bb..f18cf66f14d08 100644 --- a/tests/ui/issues/issue-4935.stderr +++ b/tests/ui/issues/issue-4935.stderr @@ -2,16 +2,18 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/issue-4935.rs:5:13 | LL | fn main() { foo(5, 6) } - | ^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/issue-4935.rs:3:4 | LL | fn foo(a: usize) {} | ^^^ -------- +help: remove the extra argument + | +LL - fn main() { foo(5, 6) } +LL + fn main() { foo(5) } + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-4968.stderr b/tests/ui/issues/issue-4968.stderr index 549e5509474de..7959011af9133 100644 --- a/tests/ui/issues/issue-4968.stderr +++ b/tests/ui/issues/issue-4968.stderr @@ -9,11 +9,14 @@ LL | match 42 { A => () } | | | | | expected integer, found `(isize, isize)` | | `A` is interpreted as a constant, not a new binding - | | help: introduce a new binding instead: `other_a` | this expression has type `{integer}` | = note: expected type `{integer}` found tuple `(isize, isize)` +help: introduce a new binding instead + | +LL | match 42 { other_a => () } + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5100.stderr b/tests/ui/issues/issue-5100.stderr index b1680aacd1656..440d22db3a740 100644 --- a/tests/ui/issues/issue-5100.stderr +++ b/tests/ui/issues/issue-5100.stderr @@ -60,7 +60,12 @@ error[E0618]: expected function, found `(char, char)` --> $DIR/issue-5100.rs:48:14 | LL | let v = [('a', 'b') - | ^^^^^^^^^^- help: consider separating array elements with a comma: `,` + | ^^^^^^^^^^ + | +help: consider separating array elements with a comma + | +LL | let v = [('a', 'b'), + | + error[E0308]: mismatched types --> $DIR/issue-5100.rs:55:19 diff --git a/tests/ui/issues/issue-51102.stderr b/tests/ui/issues/issue-51102.stderr index 09c52292dccaf..01671554d3ac2 100644 --- a/tests/ui/issues/issue-51102.stderr +++ b/tests/ui/issues/issue-51102.stderr @@ -2,10 +2,12 @@ error[E0026]: struct `SimpleStruct` does not have a field named `state` --> $DIR/issue-51102.rs:13:17 | LL | state: 0, - | ^^^^^ - | | - | struct `SimpleStruct` does not have this field - | help: `SimpleStruct` has a field named `no_state_here` + | ^^^^^ struct `SimpleStruct` does not have this field + | +help: `SimpleStruct` has a field named `no_state_here` + | +LL | no_state_here: 0, + | ~~~~~~~~~~~~~ error[E0025]: field `no_state_here` bound multiple times in the pattern --> $DIR/issue-51102.rs:24:17 diff --git a/tests/ui/issues/issue-52717.stderr b/tests/ui/issues/issue-52717.stderr index ab8c37225cae6..e8ecc0bb5cf59 100644 --- a/tests/ui/issues/issue-52717.stderr +++ b/tests/ui/issues/issue-52717.stderr @@ -2,10 +2,12 @@ error[E0026]: variant `A::A` does not have a field named `fob` --> $DIR/issue-52717.rs:10:12 | LL | A::A { fob } => { println!("{}", fob); } - | ^^^ - | | - | variant `A::A` does not have this field - | help: a field with a similar name exists: `foo` + | ^^^ variant `A::A` does not have this field + | +help: a field with a similar name exists + | +LL | A::A { foo } => { println!("{}", fob); } + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-53251.stderr b/tests/ui/issues/issue-53251.stderr index 05ea631158964..db9df7d911c41 100644 --- a/tests/ui/issues/issue-53251.stderr +++ b/tests/ui/issues/issue-53251.stderr @@ -2,9 +2,7 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume --> $DIR/issue-53251.rs:11:20 | LL | S::f::(); - | ^------- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments ... LL | impl_add!(a b); | -------------- in this macro invocation @@ -15,14 +13,17 @@ note: associated function defined here, with 0 generic parameters LL | fn f() {} | ^ = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove these generics + | +LL - S::f::(); +LL + S::f(); + | error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-53251.rs:11:20 | LL | S::f::(); - | ^------- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments ... LL | impl_add!(a b); | -------------- in this macro invocation @@ -34,6 +35,11 @@ LL | fn f() {} | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove these generics + | +LL - S::f::(); +LL + S::f(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-56199.stderr b/tests/ui/issues/issue-56199.stderr index eb6d7005979f6..89c04368b5fea 100644 --- a/tests/ui/issues/issue-56199.stderr +++ b/tests/ui/issues/issue-56199.stderr @@ -18,13 +18,23 @@ error: the `Self` constructor can only be used with tuple or unit structs --> $DIR/issue-56199.rs:15:17 | LL | let _ = Self; - | ^^^^ help: use curly brackets: `Self { /* fields */ }` + | ^^^^ + | +help: use curly brackets + | +LL | let _ = Self { /* fields */ }; + | ~~~~~~~~~~~~~~~~~~~~~ error: the `Self` constructor can only be used with tuple or unit structs --> $DIR/issue-56199.rs:17:17 | LL | let _ = Self(); - | ^^^^^^ help: use curly brackets: `Self { /* fields */ }` + | ^^^^^^ + | +help: use curly brackets + | +LL | let _ = Self { /* fields */ }; + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/issues/issue-56835.stderr b/tests/ui/issues/issue-56835.stderr index e949ae7b32402..f2bce5a1f8692 100644 --- a/tests/ui/issues/issue-56835.stderr +++ b/tests/ui/issues/issue-56835.stderr @@ -2,7 +2,12 @@ error: the `Self` constructor can only be used with tuple or unit structs --> $DIR/issue-56835.rs:4:12 | LL | fn bar(Self(foo): Self) {} - | ^^^^^^^^^ help: use curly brackets: `Self { /* fields */ }` + | ^^^^^^^^^ + | +help: use curly brackets + | +LL | fn bar(Self { /* fields */ }: Self) {} + | ~~~~~~~~~~~~~~~~~~~~~ error[E0164]: expected tuple struct or tuple variant, found self constructor `Self` --> $DIR/issue-56835.rs:4:12 diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr index 38014ecce7574..3c19b68cffbb3 100644 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr @@ -2,57 +2,61 @@ error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:9 | LL | let y = match x { - | - - | | - | this expression has type `Box` - | help: consider dereferencing the boxed value: `*x` + | - this expression has type `Box` LL | T::A(a) | T::B(a) => a, | ^^^^^^^ expected `Box`, found `T` | = note: expected struct `Box` found enum `T` +help: consider dereferencing the boxed value + | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:19 | LL | let y = match x { - | - - | | - | this expression has type `Box` - | help: consider dereferencing the boxed value: `*x` + | - this expression has type `Box` LL | T::A(a) | T::B(a) => a, | ^^^^^^^ expected `Box`, found `T` | = note: expected struct `Box` found enum `T` +help: consider dereferencing the boxed value + | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:9 | LL | let y = match x { - | - - | | - | this expression has type `Box` - | help: consider dereferencing the boxed value: `*x` + | - this expression has type `Box` LL | S::A { a } | S::B { b: a } => a, | ^^^^^^^^^^ expected `Box`, found `S` | = note: expected struct `Box` found enum `S` +help: consider dereferencing the boxed value + | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:22 | LL | let y = match x { - | - - | | - | this expression has type `Box` - | help: consider dereferencing the boxed value: `*x` + | - this expression has type `Box` LL | S::A { a } | S::B { b: a } => a, | ^^^^^^^^^^^^^ expected `Box`, found `S` | = note: expected struct `Box` found enum `S` +help: consider dereferencing the boxed value + | +LL | let y = match *x { + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr index c0b3cd6de66d7..1da0de21aa35f 100644 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr +++ b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr @@ -4,9 +4,12 @@ error[E0401]: can't use generic parameters from outer item LL | fn f() -> bool { | - type parameter from outer item LL | enum E { V(Z) } - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | enum E { V(Z) } + | +++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr index 670a54894b5c6..521345b03fbc0 100644 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr +++ b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr @@ -4,9 +4,12 @@ error[E0401]: can't use generic parameters from outer item LL | fn f() -> bool { | - type parameter from outer item LL | struct S(T); - | -^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | struct S(T); + | +++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-60622.stderr b/tests/ui/issues/issue-60622.stderr index 43da2773940e5..e694a92213c85 100644 --- a/tests/ui/issues/issue-60622.stderr +++ b/tests/ui/issues/issue-60622.stderr @@ -20,15 +20,18 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-60622.rs:10:7 | LL | b.a::<'_, T>(); - | ^ - help: remove this generic argument - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/issue-60622.rs:6:8 | LL | fn a(&self) {} | ^ +help: remove this generic argument + | +LL - b.a::<'_, T>(); +LL + b.a::<'_, >(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-63983.stderr b/tests/ui/issues/issue-63983.stderr index f90c81116264a..c2b2970598902 100644 --- a/tests/ui/issues/issue-63983.stderr +++ b/tests/ui/issues/issue-63983.stderr @@ -5,7 +5,12 @@ LL | Tuple(i32), | ---------- `MyEnum::Tuple` defined here ... LL | MyEnum::Tuple => "", - | ^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `MyEnum::Tuple(_)` + | ^^^^^^^^^^^^^ + | +help: use the tuple variant pattern syntax instead + | +LL | MyEnum::Tuple(_) => "", + | ~~~~~~~~~~~~~~~~ error[E0533]: expected unit struct, unit variant or constant, found struct variant `MyEnum::Struct` --> $DIR/issue-63983.rs:10:9 diff --git a/tests/ui/issues/issue-64792-bad-unicode-ctor.stderr b/tests/ui/issues/issue-64792-bad-unicode-ctor.stderr index 7fc414602d281..6e8dd4db2702b 100644 --- a/tests/ui/issues/issue-64792-bad-unicode-ctor.stderr +++ b/tests/ui/issues/issue-64792-bad-unicode-ctor.stderr @@ -5,7 +5,12 @@ LL | struct X {} | ----------- `X` defined here LL | LL | const Y: X = X("ö"); - | ^^^^^^ help: use struct literal syntax instead: `X {}` + | ^^^^^^ + | +help: use struct literal syntax instead + | +LL | const Y: X = X {}; + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-66667-function-cmp-cycle.stderr b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr index cec8117702a9b..a0fc5ccba64ba 100644 --- a/tests/ui/issues/issue-66667-function-cmp-cycle.stderr +++ b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr @@ -18,10 +18,13 @@ LL | second == 1 error[E0308]: mismatched types --> $DIR/issue-66667-function-cmp-cycle.rs:2:5 | -LL | fn first() { - | - help: try adding a return type: `-> bool` LL | second == 1 | ^^^^^^^^^^^ expected `()`, found `bool` + | +help: try adding a return type + | +LL | fn first() -> bool { + | +++++++ error[E0369]: binary operation `==` cannot be applied to type `fn() {first}` --> $DIR/issue-66667-function-cmp-cycle.rs:8:11 @@ -43,10 +46,13 @@ LL | first == 1 error[E0308]: mismatched types --> $DIR/issue-66667-function-cmp-cycle.rs:8:5 | -LL | fn second() { - | - help: try adding a return type: `-> bool` LL | first == 1 | ^^^^^^^^^^ expected `()`, found `bool` + | +help: try adding a return type + | +LL | fn second() -> bool { + | +++++++ error[E0369]: binary operation `==` cannot be applied to type `fn() {bar}` --> $DIR/issue-66667-function-cmp-cycle.rs:14:9 @@ -68,10 +74,13 @@ LL | bar == 1 error[E0308]: mismatched types --> $DIR/issue-66667-function-cmp-cycle.rs:14:5 | -LL | fn bar() { - | - help: try adding a return type: `-> bool` LL | bar == 1 | ^^^^^^^^ expected `()`, found `bool` + | +help: try adding a return type + | +LL | fn bar() -> bool { + | +++++++ error: aborting due to 9 previous errors diff --git a/tests/ui/issues/issue-66706.stderr b/tests/ui/issues/issue-66706.stderr index dd1e07589f516..2ce6f0bd8ca3e 100644 --- a/tests/ui/issues/issue-66706.stderr +++ b/tests/ui/issues/issue-66706.stderr @@ -2,9 +2,12 @@ error: expected one of `,` or `|`, found `&` --> $DIR/issue-66706.rs:2:16 | LL | [0; [|_: _ &_| ()].len()] - | -^ expected one of `,` or `|` - | | - | help: missing `,` + | ^ expected one of `,` or `|` + | +help: missing `,` + | +LL | [0; [|_: _, &_| ()].len()] + | + error: expected identifier, found reserved identifier `_` --> $DIR/issue-66706.rs:8:20 @@ -16,9 +19,12 @@ error: expected one of `,` or `|`, found `&` --> $DIR/issue-66706.rs:13:17 | LL | [0; [|&_: _ &_| {}; 0 ].len()] - | -^ expected one of `,` or `|` - | | - | help: missing `,` + | ^ expected one of `,` or `|` + | +help: missing `,` + | +LL | [0; [|&_: _, &_| {}; 0 ].len()] + | + error: expected identifier, found reserved identifier `_` --> $DIR/issue-66706.rs:19:26 diff --git a/tests/ui/issues/issue-75283.stderr b/tests/ui/issues/issue-75283.stderr index 240d9716a5561..de40c26d31bef 100644 --- a/tests/ui/issues/issue-75283.stderr +++ b/tests/ui/issues/issue-75283.stderr @@ -1,18 +1,17 @@ error: incorrect function inside `extern` block --> $DIR/issue-75283.rs:2:8 | -LL | extern "C" { - | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | fn lol() { - | ________^^^___- - | | | - | | cannot have a body -LL | | println!(""); -LL | | } - | |_____- help: remove the invalid body: `;` +LL | extern "C" { + | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body +LL | fn lol() { + | ^^^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | fn lol() ; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-81584.stderr b/tests/ui/issues/issue-81584.stderr index eb97916ad75ef..b129f45fd11ad 100644 --- a/tests/ui/issues/issue-81584.stderr +++ b/tests/ui/issues/issue-81584.stderr @@ -7,7 +7,10 @@ LL | .map(|y| y.iter().map(|x| x + 1)) | returns a value referencing data owned by the current function | `y` is borrowed here | - = help: use `.collect()` to allocate the iterator +help: use `.collect()` to allocate the iterator + | +LL | .map(|y| y.iter().map(|x| x + 1).collect::>()) + | ++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-pr29383.stderr b/tests/ui/issues/issue-pr29383.stderr index 57783d75ba182..a2d13c93c905f 100644 --- a/tests/ui/issues/issue-pr29383.stderr +++ b/tests/ui/issues/issue-pr29383.stderr @@ -5,7 +5,12 @@ LL | A, | - `E::A` defined here ... LL | Some(E::A(..)) => {} - | ^^^^^^^^ help: use this syntax instead: `E::A` + | ^^^^^^^^ + | +help: use this syntax instead + | +LL | Some(E::A) => {} + | ~~~~ error[E0532]: expected tuple struct or tuple variant, found unit variant `E::B` --> $DIR/issue-pr29383.rs:11:14 @@ -14,7 +19,12 @@ LL | B, | - `E::B` defined here ... LL | Some(E::B(..)) => {} - | ^^^^^^^^ help: use this syntax instead: `E::B` + | ^^^^^^^^ + | +help: use this syntax instead + | +LL | Some(E::B) => {} + | ~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/iterators/into-iter-on-arrays-2018.stderr b/tests/ui/iterators/into-iter-on-arrays-2018.stderr index 9d6bbf06c36bb..2caee3680f38d 100644 --- a/tests/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-2018.stderr @@ -20,28 +20,40 @@ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (du --> $DIR/into-iter-on-arrays-2018.rs:18:44 | LL | let _: Iter<'_, i32> = Box::new(array).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | let _: Iter<'_, i32> = Box::new(array).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-2018.rs:22:43 | LL | let _: Iter<'_, i32> = Rc::new(array).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | let _: Iter<'_, i32> = Rc::new(array).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-2018.rs:25:41 | LL | let _: Iter<'_, i32> = Array(array).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | let _: Iter<'_, i32> = Array(array).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-2018.rs:32:24 diff --git a/tests/ui/iterators/into-iter-on-arrays-lint.stderr b/tests/ui/iterators/into-iter-on-arrays-lint.stderr index da388d6b848de..35fd9ef89f653 100644 --- a/tests/ui/iterators/into-iter-on-arrays-lint.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-lint.stderr @@ -71,73 +71,105 @@ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (du --> $DIR/into-iter-on-arrays-lint.rs:24:21 | LL | Box::new(small).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new(small).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:27:22 | LL | Box::new([1, 2]).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new([1, 2]).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:30:19 | LL | Box::new(big).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new(big).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:33:25 | LL | Box::new([0u8; 33]).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new([0u8; 33]).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:37:31 | LL | Box::new(Box::new(small)).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new(Box::new(small)).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:40:32 | LL | Box::new(Box::new([1, 2])).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new(Box::new([1, 2])).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:43:29 | LL | Box::new(Box::new(big)).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new(Box::new(big)).iter(); + | ~~~~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:46:35 | LL | Box::new(Box::new([0u8; 33])).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new(Box::new([0u8; 33])).iter(); + | ~~~~ warning: 12 warnings emitted diff --git a/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr b/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr index d7f38a23725b0..fd20664e8dc83 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr @@ -19,25 +19,37 @@ warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` ( --> $DIR/into-iter-on-boxed-slices-2021.rs:18:58 | LL | let _: Iter<'_, i32> = Box::new(boxed_slice.clone()).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2024 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | let _: Iter<'_, i32> = Box::new(boxed_slice.clone()).iter(); + | ~~~~ warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-2021.rs:22:57 | LL | let _: Iter<'_, i32> = Rc::new(boxed_slice.clone()).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2024 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | let _: Iter<'_, i32> = Rc::new(boxed_slice.clone()).iter(); + | ~~~~ warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-2021.rs:25:55 | LL | let _: Iter<'_, i32> = Array(boxed_slice.clone()).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2024 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | let _: Iter<'_, i32> = Array(boxed_slice.clone()).iter(); + | ~~~~ warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-2021.rs:32:48 diff --git a/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr b/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr index b73faf0dbd3b6..aa5bf37631f58 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr @@ -19,17 +19,25 @@ warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` ( --> $DIR/into-iter-on-boxed-slices-lint.rs:13:29 | LL | Box::new(boxed.clone()).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2024 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new(boxed.clone()).iter(); + | ~~~~ warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-lint.rs:16:39 | LL | Box::new(Box::new(boxed.clone())).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = warning: this changes meaning in Rust 2024 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | Box::new(Box::new(boxed.clone())).iter(); + | ~~~~ warning: 3 warnings emitted diff --git a/tests/ui/label/label_misspelled.stderr b/tests/ui/label/label_misspelled.stderr index 4b5b9e92ca09a..25e21b1d6fb8d 100644 --- a/tests/ui/label/label_misspelled.stderr +++ b/tests/ui/label/label_misspelled.stderr @@ -40,10 +40,12 @@ error[E0425]: cannot find value `LOOP` in this scope LL | 'LOOP: loop { | ----- a label with a similar name exists LL | break LOOP; - | ^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'LOOP` + | ^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'LOOP; + | ~~~~~ error[E0425]: cannot find value `while_loop` in this scope --> $DIR/label_misspelled.rs:32:15 @@ -51,10 +53,12 @@ error[E0425]: cannot find value `while_loop` in this scope LL | 'while_loop: while true { | ----------- a label with a similar name exists LL | break while_loop; - | ^^^^^^^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'while_loop` + | ^^^^^^^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'while_loop; + | ~~~~~~~~~~~ error[E0425]: cannot find value `while_let` in this scope --> $DIR/label_misspelled.rs:36:15 @@ -62,10 +66,12 @@ error[E0425]: cannot find value `while_let` in this scope LL | 'while_let: while let Some(_) = Some(()) { | ---------- a label with a similar name exists LL | break while_let; - | ^^^^^^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'while_let` + | ^^^^^^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'while_let; + | ~~~~~~~~~~ error[E0425]: cannot find value `for_loop` in this scope --> $DIR/label_misspelled.rs:40:15 @@ -73,10 +79,12 @@ error[E0425]: cannot find value `for_loop` in this scope LL | 'for_loop: for _ in 0..3 { | --------- a label with a similar name exists LL | break for_loop; - | ^^^^^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'for_loop` + | ^^^^^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'for_loop; + | ~~~~~~~~~ warning: unused label --> $DIR/label_misspelled.rs:4:5 @@ -94,9 +102,13 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/label_misspelled.rs:4:5 | LL | 'while_loop: while true { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | 'while_loop: loop { + | ~~~~~~~~~~~~~~~~~ warning: unused label --> $DIR/label_misspelled.rs:9:5 @@ -120,7 +132,12 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/label_misspelled.rs:31:5 | LL | 'while_loop: while true { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `loop` + | +LL | 'while_loop: loop { + | ~~~~~~~~~~~~~~~~~ warning: unused label --> $DIR/label_misspelled.rs:47:5 @@ -132,7 +149,12 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/label_misspelled.rs:47:5 | LL | 'while_loop: while true { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `loop` + | +LL | 'while_loop: loop { + | ~~~~~~~~~~~~~~~~~ warning: unused label --> $DIR/label_misspelled.rs:52:5 diff --git a/tests/ui/label/label_misspelled_2.stderr b/tests/ui/label/label_misspelled_2.stderr index 960646d9894d1..90d2759c4b260 100644 --- a/tests/ui/label/label_misspelled_2.stderr +++ b/tests/ui/label/label_misspelled_2.stderr @@ -2,13 +2,23 @@ error: malformed loop label --> $DIR/label_misspelled_2.rs:10:5 | LL | c: for _ in 0..1 { - | ^ help: use the correct loop label format: `'c` + | ^ + | +help: use the correct loop label format + | +LL | 'c: for _ in 0..1 { + | ~~ error: malformed loop label --> $DIR/label_misspelled_2.rs:13:5 | LL | d: for _ in 0..1 { - | ^ help: use the correct loop label format: `'d` + | ^ + | +help: use the correct loop label format + | +LL | 'd: for _ in 0..1 { + | ~~ error[E0425]: cannot find value `b` in this scope --> $DIR/label_misspelled_2.rs:8:15 @@ -16,10 +26,12 @@ error[E0425]: cannot find value `b` in this scope LL | 'b: for _ in 0..1 { | -- a label with a similar name exists LL | break b; - | ^ - | | - | not found in this scope - | help: use the similarly named label: `'b` + | ^ not found in this scope + | +help: use the similarly named label + | +LL | break 'b; + | ~~ error[E0425]: cannot find value `d` in this scope --> $DIR/label_misspelled_2.rs:14:15 @@ -27,10 +39,12 @@ error[E0425]: cannot find value `d` in this scope LL | d: for _ in 0..1 { | - a label with a similar name exists LL | break d; - | ^ - | | - | not found in this scope - | help: use the similarly named label: `'d` + | ^ not found in this scope + | +help: use the similarly named label + | +LL | break 'd; + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/lang-items/issue-83471.stderr b/tests/ui/lang-items/issue-83471.stderr index 244b2efeaf1e0..3a2e83b143da2 100644 --- a/tests/ui/lang-items/issue-83471.stderr +++ b/tests/ui/lang-items/issue-83471.stderr @@ -26,11 +26,15 @@ warning: anonymous parameters are deprecated and will be removed in the next edi --> $DIR/issue-83471.rs:15:13 | LL | fn call(export_name); - | ^^^^^^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: export_name` + | ^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 = note: `#[warn(anonymous_parameters)]` on by default +help: try naming the parameter or explicitly ignoring it + | +LL | fn call(_: export_name); + | ~~~~~~~~~~~~~~ error[E0718]: `fn` lang item must be applied to a trait with 1 generic argument --> $DIR/issue-83471.rs:11:1 diff --git a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr index 1b8f1c3fd6fae..de0a0631bf884 100644 --- a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr +++ b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr @@ -2,15 +2,18 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were --> $DIR/mismatched_arg_count.rs:9:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} - | ^^^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^ expected 1 lifetime argument | note: type alias defined here, with 1 lifetime parameter: `'a` --> $DIR/mismatched_arg_count.rs:7:6 | LL | type Alias<'a, T> = >::Assoc; | ^^^^^ -- +help: remove this lifetime argument + | +LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} +LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, , T>) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/lazy-type-alias/leading-where-clause.stderr b/tests/ui/lazy-type-alias/leading-where-clause.stderr index 344c318d0ef9d..3a5b1295eef22 100644 --- a/tests/ui/lazy-type-alias/leading-where-clause.stderr +++ b/tests/ui/lazy-type-alias/leading-where-clause.stderr @@ -45,9 +45,14 @@ error: where clauses are not allowed before the type for type aliases --> $DIR/leading-where-clause.rs:24:27 | LL | pub type EmptyLeading1 where = T where T: Copy; - | ^^^^^ help: remove this `where` + | ^^^^^ | = note: see issue #89122 for more information +help: remove this `where` + | +LL - pub type EmptyLeading1 where = T where T: Copy; +LL + pub type EmptyLeading1 = T where T: Copy; + | error: aborting due to 4 previous errors diff --git a/tests/ui/let-else/let-else-allow-in-expr.stderr b/tests/ui/let-else/let-else-allow-in-expr.stderr index 3b2b9066c90d6..8889a64d05251 100644 --- a/tests/ui/let-else/let-else-allow-in-expr.stderr +++ b/tests/ui/let-else/let-else-allow-in-expr.stderr @@ -2,19 +2,28 @@ error: unused variable: `x` --> $DIR/let-else-allow-in-expr.rs:5:13 | LL | let x = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/let-else-allow-in-expr.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 1; + | ~~ error: unused variable: `x` --> $DIR/let-else-allow-in-expr.rs:27:9 | LL | let x = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 1; + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/let-else/let-else-allow-unused.stderr b/tests/ui/let-else/let-else-allow-unused.stderr index 2cad1be8c463b..1288be8046b8c 100644 --- a/tests/ui/let-else/let-else-allow-unused.stderr +++ b/tests/ui/let-else/let-else-allow-unused.stderr @@ -2,13 +2,17 @@ error: unused variable: `chaenomeles` --> $DIR/let-else-allow-unused.rs:14:14 | LL | let Some(chaenomeles) = value else { return }; - | ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_chaenomeles` + | ^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/let-else-allow-unused.rs:5:8 | LL | #[deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | let Some(_chaenomeles) = value else { return }; + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/let-else/let-else-check.stderr b/tests/ui/let-else/let-else-check.stderr index bdecbf708f9d2..86c67e843b8a8 100644 --- a/tests/ui/let-else/let-else-check.stderr +++ b/tests/ui/let-else/let-else-check.stderr @@ -2,19 +2,28 @@ error: unused variable: `x` --> $DIR/let-else-check.rs:12:13 | LL | let x = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/let-else-check.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 1; + | ~~ error: unused variable: `x` --> $DIR/let-else-check.rs:16:9 | LL | let x = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 1; + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/let-else/let-else-missing-semicolon.stderr b/tests/ui/let-else/let-else-missing-semicolon.stderr index 99029ff33fe0c..778a0e244f81c 100644 --- a/tests/ui/let-else/let-else-missing-semicolon.stderr +++ b/tests/ui/let-else/let-else-missing-semicolon.stderr @@ -2,17 +2,27 @@ error: expected `;`, found keyword `let` --> $DIR/let-else-missing-semicolon.rs:4:6 | LL | } - | ^ help: add `;` here + | ^ LL | let _ = ""; | --- unexpected token + | +help: add `;` here + | +LL | }; + | + error: expected `;`, found `}` --> $DIR/let-else-missing-semicolon.rs:8:6 | LL | } - | ^ help: add `;` here + | ^ LL | } | - unexpected token + | +help: add `;` here + | +LL | }; + | + error: aborting due to 2 previous errors diff --git a/tests/ui/let-else/let-else-then-diverge.stderr b/tests/ui/let-else/let-else-then-diverge.stderr index eda0025afa5ed..6a4a25dea56c4 100644 --- a/tests/ui/let-else/let-else-then-diverge.stderr +++ b/tests/ui/let-else/let-else-then-diverge.stderr @@ -2,13 +2,17 @@ error: unused variable: `x` --> $DIR/let-else-then-diverge.rs:9:13 | LL | let x = 5; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/let-else-then-diverge.rs:4:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 5; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr b/tests/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr index 1a21fed63bdec..da80991c727f7 100644 --- a/tests/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr +++ b/tests/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr @@ -26,7 +26,12 @@ error: bare CR not allowed in string, use `\r` instead --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:19:18 | LL | let _s = "foo bar"; - | ^ help: escape the character: `\r` + | ^ + | +help: escape the character + | +LL | let _s = "foo\rbar"; + | ++ error: bare CR not allowed in raw string --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:22:19 diff --git a/tests/ui/lifetimes/issue-107988.stderr b/tests/ui/lifetimes/issue-107988.stderr index c2d8c7050e97f..7d93c1d20246d 100644 --- a/tests/ui/lifetimes/issue-107988.stderr +++ b/tests/ui/lifetimes/issue-107988.stderr @@ -2,9 +2,12 @@ error[E0261]: use of undeclared lifetime name `'tcx` --> $DIR/issue-107988.rs:7:52 | LL | impl> TraitEngineExt<'tcx> for T { - | - ^^^^ undeclared lifetime - | | - | help: consider introducing lifetime `'tcx` here: `'tcx,` + | ^^^^ undeclared lifetime + | +help: consider introducing lifetime `'tcx` here + | +LL | impl<'tcx, T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T { + | +++++ error[E0261]: use of undeclared lifetime name `'tcx` --> $DIR/issue-107988.rs:7:30 diff --git a/tests/ui/lifetimes/issue-83907-invalid-fn-like-path.stderr b/tests/ui/lifetimes/issue-83907-invalid-fn-like-path.stderr index e57933da558fd..0edda2c721d13 100644 --- a/tests/ui/lifetimes/issue-83907-invalid-fn-like-path.stderr +++ b/tests/ui/lifetimes/issue-83907-invalid-fn-like-path.stderr @@ -2,9 +2,12 @@ error: free static item without body --> $DIR/issue-83907-invalid-fn-like-path.rs:3:1 | LL | static STATIC_VAR_FIVE: &One(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the static: `= ;` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the static + | +LL | static STATIC_VAR_FIVE: &One() = ; + | ~~~~~~~~~ error[E0412]: cannot find type `One` in this scope --> $DIR/issue-83907-invalid-fn-like-path.rs:3:26 diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr index 310dee5140603..e0e9206e62697 100644 --- a/tests/ui/lifetimes/issue-95023.stderr +++ b/tests/ui/lifetimes/issue-95023.stderr @@ -2,9 +2,12 @@ error: associated function in `impl` without body --> $DIR/issue-95023.rs:8:5 | LL | fn foo(&self) -> Self::B<{ N }>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the function + | +LL | fn foo(&self) -> Self::B<{ N }> { } + | ~~~~~~~~~~ error[E0407]: method `foo` is not a member of trait `Fn` --> $DIR/issue-95023.rs:8:5 @@ -48,21 +51,33 @@ error[E0046]: not all trait items implemented, missing: `call` LL | impl Fn(&isize) for Error { | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation | - = help: implement the missing item: `fn call(&self, _: (&isize,)) -> >::Output { todo!() }` +help: implement the missing item + | +LL + fn call(&self, _: (&isize,)) -> >::Output { todo!() } + | error[E0220]: associated type `B` not found for `Self` --> $DIR/issue-95023.rs:8:44 | LL | fn foo(&self) -> Self::B<{ N }>; - | ^ help: `Self` has the following associated type: `Output` + | ^ + | +help: `Self` has the following associated type + | +LL | fn foo(&self) -> Self::Output<{ N }>; + | ~~~~~~ error[E0220]: associated type `B` not found for `Self` --> $DIR/issue-95023.rs:8:44 | LL | fn foo(&self) -> Self::B<{ N }>; - | ^ help: `Self` has the following associated type: `Output` + | ^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: `Self` has the following associated type + | +LL | fn foo(&self) -> Self::Output<{ N }>; + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/lifetimes/issue-97193.stderr b/tests/ui/lifetimes/issue-97193.stderr index 21be543ccf9ce..0d444cb9fac4c 100644 --- a/tests/ui/lifetimes/issue-97193.stderr +++ b/tests/ui/lifetimes/issue-97193.stderr @@ -1,20 +1,17 @@ error: incorrect function inside `extern` block --> $DIR/issue-97193.rs:2:8 | -LL | extern "C" { - | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | fn a(&mut self) { - | ________^____________- - | | | - | | cannot have a body -LL | | -LL | | -LL | | fn b(buf: &Self) {} -LL | | } - | |_____- help: remove the invalid body: `;` +LL | extern "C" { + | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body +LL | fn a(&mut self) { + | ^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | fn a(&mut self) ; + | ~ error: `self` parameter is only allowed in associated functions --> $DIR/issue-97193.rs:2:10 diff --git a/tests/ui/lifetimes/issue-97194.stderr b/tests/ui/lifetimes/issue-97194.stderr index 93bde285a9901..29038e9860972 100644 --- a/tests/ui/lifetimes/issue-97194.stderr +++ b/tests/ui/lifetimes/issue-97194.stderr @@ -1,21 +1,17 @@ error: incorrect function inside `extern` block --> $DIR/issue-97194.rs:2:8 | -LL | extern "C" { - | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | fn bget(&self, index: [usize; Self::DIM]) -> bool { - | ________^^^^___________________________________________- - | | | - | | cannot have a body -LL | | -LL | | -LL | | -LL | | type T<'a> = &'a str; -LL | | } - | |_____- help: remove the invalid body: `;` +LL | extern "C" { + | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body +LL | fn bget(&self, index: [usize; Self::DIM]) -> bool { + | ^^^^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | fn bget(&self, index: [usize; Self::DIM]) -> bool ; + | ~ error: `self` parameter is only allowed in associated functions --> $DIR/issue-97194.rs:2:13 diff --git a/tests/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr b/tests/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr index af22078aff590..e16404f7540ef 100644 --- a/tests/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr +++ b/tests/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr @@ -1,11 +1,13 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/42701_one_named_and_one_anonymous.rs:10:9 | -LL | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 { - | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` -... LL | &*x | ^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `x` + | +LL | fn foo2<'a>(a: &'a Foo, x: &'a i32) -> &'a i32 { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr index e202c31214d37..21d3aae2da2c0 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr @@ -1,11 +1,13 @@ error[E0621]: explicit lifetime required in the type of `other` --> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:11:21 | -LL | fn bar(&self, other: Foo) -> Foo<'a> { - | --- help: add explicit lifetime `'a` to the type of `other`: `Foo<'a>` -... LL | other | ^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `other` + | +LL | fn bar(&self, other: Foo<'a>) -> Foo<'a> { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr index 5518ded0106d9..fde8dbd53cb0b 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr @@ -1,10 +1,13 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/ex1-return-one-existing-name-if-else-2.rs:2:16 | -LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { - | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` LL | if x > y { x } else { y } | ^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `x` + | +LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr index c689fa9884a76..421898aaedd0f 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr @@ -1,10 +1,13 @@ error[E0621]: explicit lifetime required in parameter type --> $DIR/ex1-return-one-existing-name-if-else-3.rs:2:27 | -LL | fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 { - | --------------- help: add explicit lifetime `'a` to type: `(&'a i32, &'a i32)` LL | if x > y { x } else { y } | ^ lifetime `'a` required + | +help: add explicit lifetime `'a` to type + | +LL | fn foo<'a>((x, y): (&'a i32, &'a i32)) -> &'a i32 { + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr index 3da50cfbb1d08..e167781c393ef 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr @@ -1,10 +1,13 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:4:15 | -LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { - | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` LL | if x > y { x } else { y } | ^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `x` + | +LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index 6dda9e61a79ca..80a9540f62ab8 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -1,11 +1,13 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:8:36 | -LL | fn foo<'a>(&'a self, x: &i32) -> &i32 { - | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` -LL | LL | if true { &self.field } else { x } | ^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `x` + | +LL | fn foo<'a>(&'a self, x: &'a i32) -> &i32 { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr index 1df0776a51b58..61e1f87386c7a 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr @@ -1,10 +1,13 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/ex1-return-one-existing-name-if-else.rs:2:27 | -LL | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { - | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a i32` LL | if x > y { x } else { y } | ^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `y` + | +LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr b/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr index 25a2f4b96f40d..ed9e761d6496a 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr @@ -1,10 +1,13 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/ex2a-push-one-existing-name-2.rs:6:5 | -LL | fn foo<'a>(x: Ref, y: &mut Vec>) { - | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` LL | y.push(x); | ^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `x` + | +LL | fn foo<'a>(x: Ref<'a, i32>, y: &mut Vec>) { + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr b/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr index e2725977d8370..751b10a25f774 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr @@ -1,11 +1,13 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/ex2a-push-one-existing-name-early-bound.rs:8:5 | -LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) - | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` -... LL | x.push(y); | ^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `y` + | +LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &'a T) + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr b/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr index 1025581d5acf5..dd50ad0ec5f9f 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr @@ -1,10 +1,13 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/ex2a-push-one-existing-name.rs:6:5 | -LL | fn foo<'a>(x: &mut Vec>, y: Ref) { - | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` LL | x.push(y); | ^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `y` + | +LL | fn foo<'a>(x: &mut Vec>, y: Ref<'a, i32>) { + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/noisy-follow-up-erro.stderr b/tests/ui/lifetimes/noisy-follow-up-erro.stderr index f549009a87c12..8a09bf0c2fc9a 100644 --- a/tests/ui/lifetimes/noisy-follow-up-erro.stderr +++ b/tests/ui/lifetimes/noisy-follow-up-erro.stderr @@ -2,24 +2,29 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/noisy-follow-up-erro.rs:12:30 | LL | fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { - | ^^^ -- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^^^ expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'c`, `'d` --> $DIR/noisy-follow-up-erro.rs:1:8 | LL | struct Foo<'c, 'd>(&'c (), &'d ()); | ^^^ -- -- +help: remove this lifetime argument + | +LL - fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { +LL + fn boom(&self, foo: &mut Foo<'_, '_, >) -> Result<(), &'a ()> { + | error[E0621]: explicit lifetime required in the type of `foo` --> $DIR/noisy-follow-up-erro.rs:14:9 | -LL | fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { - | -------------------- help: add explicit lifetime `'a` to the type of `foo`: `&mut Foo<'_, 'a>` -LL | LL | self.bar().map_err(|()| foo.acc(self))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `foo` + | +LL | fn boom(&self, foo: &mut Foo<'_, 'a>) -> Result<(), &'a ()> { + | ~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr b/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr index 0d6ade41511fd..f90133e9fb1ab 100644 --- a/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr +++ b/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr @@ -1,10 +1,13 @@ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9 | -LL | struct Test { - | - help: consider introducing lifetime `'b` here: `<'b>` LL | a: &'b str, | ^^ undeclared lifetime + | +help: consider introducing lifetime `'b` here + | +LL | struct Test<'b> { + | ++++ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9 @@ -12,9 +15,13 @@ error[E0261]: use of undeclared lifetime name `'b` LL | #[derive(Eq, PartialEq)] | -- lifetime `'b` is missing in item created through this procedural macro LL | struct Test { - | - help: consider introducing lifetime `'b` here: `<'b>` LL | a: &'b str, | ^^ undeclared lifetime + | +help: consider introducing lifetime `'b` here + | +LL | struct Test<'b> { + | ++++ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:13:13 diff --git a/tests/ui/lint/bare-trait-objects-path.stderr b/tests/ui/lint/bare-trait-objects-path.stderr index da1d9f248a01f..5a1a3cda76202 100644 --- a/tests/ui/lint/bare-trait-objects-path.stderr +++ b/tests/ui/lint/bare-trait-objects-path.stderr @@ -16,7 +16,12 @@ error[E0223]: ambiguous associated type --> $DIR/bare-trait-objects-path.rs:23:12 | LL | let _: Dyn::Ty; - | ^^^^^^^ help: use fully-qualified syntax: `::Ty` + | ^^^^^^^ + | +help: use fully-qualified syntax + | +LL | let _: ::Ty; + | ~~~~~~~~~~~~~~~~~~~~~~ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/bare-trait-objects-path.rs:14:5 diff --git a/tests/ui/lint/command-line-lint-group-deny.stderr b/tests/ui/lint/command-line-lint-group-deny.stderr index d78f198e73210..12fd97ebdf3dd 100644 --- a/tests/ui/lint/command-line-lint-group-deny.stderr +++ b/tests/ui/lint/command-line-lint-group-deny.stderr @@ -2,10 +2,14 @@ error: variable `_InappropriateCamelCasing` should have a snake case name --> $DIR/command-line-lint-group-deny.rs:4:9 | LL | let _InappropriateCamelCasing = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D non-snake-case` implied by `-D bad-style` = help: to override `-D bad-style` add `#[allow(non_snake_case)]` +help: convert the identifier to snake case + | +LL | let _inappropriate_camel_casing = true; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/command-line-lint-group-forbid.stderr b/tests/ui/lint/command-line-lint-group-forbid.stderr index 7b527e7b8b461..4dfc639c40a37 100644 --- a/tests/ui/lint/command-line-lint-group-forbid.stderr +++ b/tests/ui/lint/command-line-lint-group-forbid.stderr @@ -2,10 +2,14 @@ error: variable `_InappropriateCamelCasing` should have a snake case name --> $DIR/command-line-lint-group-forbid.rs:4:9 | LL | let _InappropriateCamelCasing = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-F non-snake-case` implied by `-F bad-style` = help: to override `-F bad-style` add `#[allow(non_snake_case)]` +help: convert the identifier to snake case + | +LL | let _inappropriate_camel_casing = true; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/command-line-lint-group-warn.stderr b/tests/ui/lint/command-line-lint-group-warn.stderr index cfe346a5bf6b0..36c0756bcee37 100644 --- a/tests/ui/lint/command-line-lint-group-warn.stderr +++ b/tests/ui/lint/command-line-lint-group-warn.stderr @@ -2,10 +2,14 @@ warning: variable `_InappropriateCamelCasing` should have a snake case name --> $DIR/command-line-lint-group-warn.rs:5:9 | LL | let _InappropriateCamelCasing = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-W non-snake-case` implied by `-W bad-style` = help: to override `-W bad-style` add `#[allow(non_snake_case)]` +help: convert the identifier to snake case + | +LL | let _inappropriate_camel_casing = true; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/lint/dead-code/issue-85071-2.stderr b/tests/ui/lint/dead-code/issue-85071-2.stderr index 5e963183d094b..7f915d1bf2205 100644 --- a/tests/ui/lint/dead-code/issue-85071-2.stderr +++ b/tests/ui/lint/dead-code/issue-85071-2.stderr @@ -22,13 +22,17 @@ warning: unused variable: `x` --> $DIR/issue-85071-2.rs:18:9 | LL | let x = s.f(); - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/issue-85071-2.rs:7:9 | LL | #![warn(unused_variables,unreachable_code)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | let _x = s.f(); + | ~~ warning: 2 warnings emitted diff --git a/tests/ui/lint/dead-code/issue-85071.stderr b/tests/ui/lint/dead-code/issue-85071.stderr index 721fb8148d96b..15387aac87d88 100644 --- a/tests/ui/lint/dead-code/issue-85071.stderr +++ b/tests/ui/lint/dead-code/issue-85071.stderr @@ -22,13 +22,17 @@ warning: unused variable: `x` --> $DIR/issue-85071.rs:15:9 | LL | let x = f(); - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/issue-85071.rs:9:9 | LL | #![warn(unused_variables,unreachable_code)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | let _x = f(); + | ~~ warning: 2 warnings emitted diff --git a/tests/ui/lint/deny-overflowing-literals.stderr b/tests/ui/lint/deny-overflowing-literals.stderr index beb0ad79560f9..b1dce8688e2c7 100644 --- a/tests/ui/lint/deny-overflowing-literals.stderr +++ b/tests/ui/lint/deny-overflowing-literals.stderr @@ -11,7 +11,12 @@ error: range endpoint is out of range for `u8` --> $DIR/deny-overflowing-literals.rs:5:14 | LL | for _ in 0..256u8 {} - | ^^^^^^^^ help: use an inclusive range instead: `0..=255u8` + | ^^^^^^^^ + | +help: use an inclusive range instead + | +LL | for _ in 0..=255u8 {} + | ~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lint/enable-unstable-lib-feature.stderr b/tests/ui/lint/enable-unstable-lib-feature.stderr index 327e6e3e956fb..16ce9d19dda29 100644 --- a/tests/ui/lint/enable-unstable-lib-feature.stderr +++ b/tests/ui/lint/enable-unstable-lib-feature.stderr @@ -2,13 +2,17 @@ error: function `BOGUS` should have a snake case name --> $DIR/enable-unstable-lib-feature.rs:11:8 | LL | pub fn BOGUS() { } - | ^^^^^ help: convert the identifier to snake case: `bogus` + | ^^^^^ | note: the lint level is defined here --> $DIR/enable-unstable-lib-feature.rs:6:9 | LL | #![deny(non_snake_case)] // To trigger a hard error | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | pub fn bogus() { } + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/expr_attr_paren_order.stderr b/tests/ui/lint/expr_attr_paren_order.stderr index b3a3741d245f1..45a2d43510a73 100644 --- a/tests/ui/lint/expr_attr_paren_order.stderr +++ b/tests/ui/lint/expr_attr_paren_order.stderr @@ -2,13 +2,17 @@ error: variable `X` should have a snake case name --> $DIR/expr_attr_paren_order.rs:17:17 | LL | let X = 0; - | ^ help: convert the identifier to snake case (notice the capitalization): `x` + | ^ | note: the lint level is defined here --> $DIR/expr_attr_paren_order.rs:15:37 | LL | #[allow(non_snake_case)] #[deny(non_snake_case)] ( | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | let x = 0; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/forbid-group-group-1.stderr b/tests/ui/lint/forbid-group-group-1.stderr index bbea56ac64ae7..8e808ed2e04db 100644 --- a/tests/ui/lint/forbid-group-group-1.stderr +++ b/tests/ui/lint/forbid-group-group-1.stderr @@ -2,7 +2,7 @@ error: variable `A` should have a snake case name --> $DIR/forbid-group-group-1.rs:11:9 | LL | let A: (); - | ^ help: convert the identifier to snake case: `a` + | ^ | note: the lint level is defined here --> $DIR/forbid-group-group-1.rs:4:11 @@ -10,6 +10,10 @@ note: the lint level is defined here LL | #![forbid(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ = note: `#[forbid(non_snake_case)]` implied by `#[forbid(nonstandard_style)]` +help: convert the identifier to snake case + | +LL | let a: (); + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr index 01c2ed84c635a..15a03b3b80766 100644 --- a/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr +++ b/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr @@ -2,12 +2,16 @@ warning: `...` range patterns are deprecated --> $DIR/cap-lints-warn-allowed-warn-by-default-lint.rs:10:10 | LL | 0...100 => true, - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see = note: `--force-warn ellipsis-inclusive-range-patterns` implied by `--force-warn rust-2021-compatibility` = help: to override `--force-warn rust-2021-compatibility` add `#[allow(ellipsis_inclusive_range_patterns)]` +help: use `..=` for an inclusive range + | +LL | 0..=100 => true, + | ~~~ warning: 1 warning emitted diff --git a/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr b/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr index e925a195fb1c4..2ebed5a082121 100644 --- a/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr +++ b/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr @@ -2,10 +2,14 @@ warning: function `FUNCTION` should have a snake case name --> $DIR/lint-group-allow-warnings.rs:9:8 | LL | pub fn FUNCTION() {} - | ^^^^^^^^ help: convert the identifier to snake case: `function` + | ^^^^^^^^ | = note: `--force-warn non-snake-case` implied by `--force-warn nonstandard-style` = help: to override `--force-warn nonstandard-style` add `#[allow(non_snake_case)]` +help: convert the identifier to snake case + | +LL | pub fn function() {} + | ~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/lint/function-item-references.stderr b/tests/ui/lint/function-item-references.stderr index a9d18bb6a4743..d91d769fb8f03 100644 --- a/tests/ui/lint/function-item-references.stderr +++ b/tests/ui/lint/function-item-references.stderr @@ -2,205 +2,369 @@ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:44:18 | LL | Pointer::fmt(&zst_ref, f) - | ^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^^^^^ | note: the lint level is defined here --> $DIR/function-item-references.rs:3:9 | LL | #![warn(function_item_references)] | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: cast `foo` to obtain a function pointer + | +LL | Pointer::fmt(foo as fn() -> _, f) + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:81:22 | LL | println!("{:p}", &foo); - | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | println!("{:p}", foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:83:20 | LL | print!("{:p}", &foo); - | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | print!("{:p}", foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:85:21 | LL | format!("{:p}", &foo); - | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | format!("{:p}", foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:88:22 | LL | println!("{:p}", &foo as *const _); - | ^^^^^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^^^^^^^^^^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | println!("{:p}", foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:90:22 | LL | println!("{:p}", zst_ref); - | ^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | println!("{:p}", foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:92:22 | LL | println!("{:p}", cast_zst_ptr); - | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^^^^^^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | println!("{:p}", foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:94:22 | LL | println!("{:p}", coerced_zst_ptr); - | ^^^^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^^^^^^^^^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | println!("{:p}", foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:97:22 | LL | println!("{:p}", &fn_item); - | ^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | println!("{:p}", foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:99:22 | LL | println!("{:p}", indirect_ref); - | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^^^^^^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | println!("{:p}", foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:102:22 | LL | println!("{:p}", &nop); - | ^^^^ help: cast `nop` to obtain a function pointer: `nop as fn()` + | ^^^^ + | +help: cast `nop` to obtain a function pointer + | +LL | println!("{:p}", nop as fn()); + | ~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:104:22 | LL | println!("{:p}", &bar); - | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` + | ^^^^ + | +help: cast `bar` to obtain a function pointer + | +LL | println!("{:p}", bar as fn(_) -> _); + | ~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:106:22 | LL | println!("{:p}", &baz); - | ^^^^ help: cast `baz` to obtain a function pointer: `baz as fn(_, _) -> _` + | ^^^^ + | +help: cast `baz` to obtain a function pointer + | +LL | println!("{:p}", baz as fn(_, _) -> _); + | ~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:108:22 | LL | println!("{:p}", &unsafe_fn); - | ^^^^^^^^^^ help: cast `unsafe_fn` to obtain a function pointer: `unsafe_fn as unsafe fn()` + | ^^^^^^^^^^ + | +help: cast `unsafe_fn` to obtain a function pointer + | +LL | println!("{:p}", unsafe_fn as unsafe fn()); + | ~~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:110:22 | LL | println!("{:p}", &c_fn); - | ^^^^^ help: cast `c_fn` to obtain a function pointer: `c_fn as extern "C" fn()` + | ^^^^^ + | +help: cast `c_fn` to obtain a function pointer + | +LL | println!("{:p}", c_fn as extern "C" fn()); + | ~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:112:22 | LL | println!("{:p}", &unsafe_c_fn); - | ^^^^^^^^^^^^ help: cast `unsafe_c_fn` to obtain a function pointer: `unsafe_c_fn as unsafe extern "C" fn()` + | ^^^^^^^^^^^^ + | +help: cast `unsafe_c_fn` to obtain a function pointer + | +LL | println!("{:p}", unsafe_c_fn as unsafe extern "C" fn()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:114:22 | LL | println!("{:p}", &variadic); - | ^^^^^^^^^ help: cast `variadic` to obtain a function pointer: `variadic as unsafe extern "C" fn(_, ...)` + | ^^^^^^^^^ + | +help: cast `variadic` to obtain a function pointer + | +LL | println!("{:p}", variadic as unsafe extern "C" fn(_, ...)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:116:22 | LL | println!("{:p}", &take_generic_ref::); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `take_generic_ref` to obtain a function pointer: `take_generic_ref:: as fn(_)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: cast `take_generic_ref` to obtain a function pointer + | +LL | println!("{:p}", take_generic_ref:: as fn(_)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:118:22 | LL | println!("{:p}", &take_generic_array::); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `take_generic_array` to obtain a function pointer: `take_generic_array:: as fn(_)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: cast `take_generic_array` to obtain a function pointer + | +LL | println!("{:p}", take_generic_array:: as fn(_)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:120:22 | LL | println!("{:p}", &multiple_generic::); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `multiple_generic` to obtain a function pointer: `multiple_generic:: as fn(_, _)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: cast `multiple_generic` to obtain a function pointer + | +LL | println!("{:p}", multiple_generic:: as fn(_, _)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:122:22 | LL | println!("{:p}", &multiple_generic_arrays::); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `multiple_generic_arrays` to obtain a function pointer: `multiple_generic_arrays:: as fn(_, _)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: cast `multiple_generic_arrays` to obtain a function pointer + | +LL | println!("{:p}", multiple_generic_arrays:: as fn(_, _)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:124:22 | LL | println!("{:p}", &std::env::var::); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `var` to obtain a function pointer: `var:: as fn(_) -> _` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: cast `var` to obtain a function pointer + | +LL | println!("{:p}", var:: as fn(_) -> _); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:127:32 | LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar); - | ^^^^ help: cast `nop` to obtain a function pointer: `nop as fn()` + | ^^^^ + | +help: cast `nop` to obtain a function pointer + | +LL | println!("{:p} {:p} {:p}", nop as fn(), &foo, &bar); + | ~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:127:38 | LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar); - | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | println!("{:p} {:p} {:p}", &nop, foo as fn() -> _, &bar); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:127:44 | LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar); - | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` + | ^^^^ + | +help: cast `bar` to obtain a function pointer + | +LL | println!("{:p} {:p} {:p}", &nop, &foo, bar as fn(_) -> _); + | ~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:142:41 | LL | std::mem::transmute::<_, usize>(&foo); - | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | std::mem::transmute::<_, usize>(foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:144:50 | LL | std::mem::transmute::<_, (usize, usize)>((&foo, &bar)); - | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^^^^^^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | std::mem::transmute::<_, (usize, usize)>(foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:144:50 | LL | std::mem::transmute::<_, (usize, usize)>((&foo, &bar)); - | ^^^^^^^^^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` + | ^^^^^^^^^^^^ + | +help: cast `bar` to obtain a function pointer + | +LL | std::mem::transmute::<_, (usize, usize)>(bar as fn(_) -> _); + | ~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:147:41 | LL | std::mem::transmute::<_, usize>(&take_generic_ref::); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `take_generic_ref` to obtain a function pointer: `take_generic_ref:: as fn(_)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: cast `take_generic_ref` to obtain a function pointer + | +LL | std::mem::transmute::<_, usize>(take_generic_ref:: as fn(_)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:156:15 | LL | print_ptr(&bar); - | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` + | ^^^^ + | +help: cast `bar` to obtain a function pointer + | +LL | print_ptr(bar as fn(_) -> _); + | ~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:158:24 | LL | bound_by_ptr_trait(&bar); - | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` + | ^^^^ + | +help: cast `bar` to obtain a function pointer + | +LL | bound_by_ptr_trait(bar as fn(_) -> _); + | ~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:160:30 | LL | bound_by_ptr_trait_tuple((&foo, &bar)); - | ^^^^^^^^^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` + | ^^^^^^^^^^^^ + | +help: cast `bar` to obtain a function pointer + | +LL | bound_by_ptr_trait_tuple(bar as fn(_) -> _); + | ~~~~~~~~~~~~~~~~~ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:160:30 | LL | bound_by_ptr_trait_tuple((&foo, &bar)); - | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` + | ^^^^^^^^^^^^ + | +help: cast `foo` to obtain a function pointer + | +LL | bound_by_ptr_trait_tuple(foo as fn() -> _); + | ~~~~~~~~~~~~~~~~ warning: 33 warnings emitted diff --git a/tests/ui/lint/future-incompat-json-test.stderr b/tests/ui/lint/future-incompat-json-test.stderr index bf29b9577db5e..bd4d5bbcfac16 100644 --- a/tests/ui/lint/future-incompat-json-test.stderr +++ b/tests/ui/lint/future-incompat-json-test.stderr @@ -2,6 +2,11 @@ --> $DIR/future-incompat-json-test.rs:9:9 | LL | let x = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 1; + | ~~ "}}]} diff --git a/tests/ui/lint/future-incompat-test.stderr b/tests/ui/lint/future-incompat-test.stderr index f24e1c7aba452..cba3375f78112 100644 --- a/tests/ui/lint/future-incompat-test.stderr +++ b/tests/ui/lint/future-incompat-test.stderr @@ -3,5 +3,10 @@ warning: unused variable: `x` --> $DIR/future-incompat-test.rs:9:9 | LL | let x = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 1; + | ~~ diff --git a/tests/ui/lint/group-forbid-always-trumps-cli.stderr b/tests/ui/lint/group-forbid-always-trumps-cli.stderr index 21674ebae9cec..4041640911b69 100644 --- a/tests/ui/lint/group-forbid-always-trumps-cli.stderr +++ b/tests/ui/lint/group-forbid-always-trumps-cli.stderr @@ -2,10 +2,14 @@ error: unused variable: `x` --> $DIR/group-forbid-always-trumps-cli.rs:4:9 | LL | let x = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | = note: `-F unused-variables` implied by `-F unused` = help: to override `-F unused` add `#[allow(unused_variables)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 1; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/inclusive-range-pattern-syntax.stderr b/tests/ui/lint/inclusive-range-pattern-syntax.stderr index ed9fa0d4101b2..32227c55211d9 100644 --- a/tests/ui/lint/inclusive-range-pattern-syntax.stderr +++ b/tests/ui/lint/inclusive-range-pattern-syntax.stderr @@ -2,7 +2,7 @@ warning: `...` range patterns are deprecated --> $DIR/inclusive-range-pattern-syntax.rs:9:10 | LL | 1...2 => {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see @@ -11,15 +11,23 @@ note: the lint level is defined here | LL | #![warn(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `..=` for an inclusive range + | +LL | 1..=2 => {} + | ~~~ warning: `...` range patterns are deprecated --> $DIR/inclusive-range-pattern-syntax.rs:16:9 | LL | &1...2 => {} - | ^^^^^^ help: use `..=` for an inclusive range: `&(1..=2)` + | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use `..=` for an inclusive range + | +LL | &(1..=2) => {} + | ~~~~~~~~ warning: 2 warnings emitted diff --git a/tests/ui/lint/issue-103317.stderr b/tests/ui/lint/issue-103317.stderr index 9c982ddc3464a..38bea64a58cb9 100644 --- a/tests/ui/lint/issue-103317.stderr +++ b/tests/ui/lint/issue-103317.stderr @@ -2,9 +2,7 @@ warning: unreachable `pub` item --> $DIR/issue-103317.rs:7:5 | LL | pub enum T { - | ---^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^ | = help: or consider exporting it for use by other crates note: the lint level is defined here @@ -12,6 +10,10 @@ note: the lint level is defined here | LL | #[warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ +help: consider restricting its visibility + | +LL | pub(crate) enum T { + | ~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/lint/issue-109529.stderr b/tests/ui/lint/issue-109529.stderr index 9e857d1b0ab5d..fa18fcd425569 100644 --- a/tests/ui/lint/issue-109529.stderr +++ b/tests/ui/lint/issue-109529.stderr @@ -2,11 +2,13 @@ error: range endpoint is out of range for `u8` --> $DIR/issue-109529.rs:4:14 | LL | for _ in 0..256 as u8 {} - | ------^^^^^^ - | | - | help: use an inclusive range instead: `0..=255` + | ^^^^^^^^^^^^ | = note: `#[deny(overflowing_literals)]` on by default +help: use an inclusive range instead + | +LL | for _ in 0..=255 as u8 {} + | ~~~~~~~ error: range endpoint is out of range for `u8` --> $DIR/issue-109529.rs:5:14 diff --git a/tests/ui/lint/issue-17718-const-naming.stderr b/tests/ui/lint/issue-17718-const-naming.stderr index 7d2aadd5f8081..7eb2b717d8f92 100644 --- a/tests/ui/lint/issue-17718-const-naming.stderr +++ b/tests/ui/lint/issue-17718-const-naming.stderr @@ -15,9 +15,13 @@ error: constant `foo` should have an upper case name --> $DIR/issue-17718-const-naming.rs:4:7 | LL | const foo: isize = 3; - | ^^^ help: convert the identifier to upper case (notice the capitalization): `FOO` + | ^^^ | = note: `#[deny(non_upper_case_globals)]` implied by `#[deny(warnings)]` +help: convert the identifier to upper case (notice the capitalization difference) + | +LL | const FOO: isize = 3; + | ~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lint/issue-30302.stderr b/tests/ui/lint/issue-30302.stderr index baf6c0d7a59d8..6671e154eba0d 100644 --- a/tests/ui/lint/issue-30302.stderr +++ b/tests/ui/lint/issue-30302.stderr @@ -2,9 +2,13 @@ error[E0170]: pattern binding `Nil` is named the same as one of the variants of --> $DIR/issue-30302.rs:13:9 | LL | Nil => true, - | ^^^ help: to match on the variant, qualify the path: `Stack::Nil` + | ^^^ | = note: `#[deny(bindings_with_variant_name)]` on by default +help: to match on the variant, qualify the path + | +LL | Stack::Nil => true, + | ~~~~~~~~~~ error: unreachable pattern --> $DIR/issue-30302.rs:15:9 diff --git a/tests/ui/lint/issue-83477.stderr b/tests/ui/lint/issue-83477.stderr index f824fc09e7240..4428cf7f34037 100644 --- a/tests/ui/lint/issue-83477.stderr +++ b/tests/ui/lint/issue-83477.stderr @@ -2,15 +2,24 @@ warning: unknown lint: `rustc::foo::bar::default_hash_types` --> $DIR/issue-83477.rs:5:9 | LL | #[allow(rustc::foo::bar::default_hash_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unknown_lints)]` on by default +help: did you mean + | +LL | #[allow(rustc::default_hash_types)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ warning: unknown lint: `rustc::foo::default_hash_types` --> $DIR/issue-83477.rs:9:9 | LL | #[allow(rustc::foo::default_hash_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: did you mean + | +LL | #[allow(rustc::default_hash_types)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ warning: prefer `FxHashMap` over `HashMap`, it has better performance --> $DIR/issue-83477.rs:14:13 diff --git a/tests/ui/lint/issue-97094.stderr b/tests/ui/lint/issue-97094.stderr index 1a0a3eaf25077..480fc94d1a996 100644 --- a/tests/ui/lint/issue-97094.stderr +++ b/tests/ui/lint/issue-97094.stderr @@ -15,9 +15,13 @@ error: lint `bare_trait_object` has been renamed to `bare_trait_objects` --> $DIR/issue-97094.rs:7:26 | LL | #![cfg_attr(all(), allow(bare_trait_object))] - | ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` + | ^^^^^^^^^^^^^^^^^ | = note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]` +help: use the new name + | +LL | #![cfg_attr(all(), allow(bare_trait_objects))] + | ~~~~~~~~~~~~~~~~~~ error: unknown lint: `nonex_lint_mod` --> $DIR/issue-97094.rs:10:25 diff --git a/tests/ui/lint/lint-attr-everywhere-early.stderr b/tests/ui/lint/lint-attr-everywhere-early.stderr index fac0eb4faff82..63538f82fcf38 100644 --- a/tests/ui/lint/lint-attr-everywhere-early.stderr +++ b/tests/ui/lint/lint-attr-everywhere-early.stderr @@ -2,13 +2,17 @@ error: type `type_outer` should have an upper camel case name --> $DIR/lint-attr-everywhere-early.rs:22:6 | LL | type type_outer = i32; - | ^^^^^^^^^^ help: convert the identifier to upper camel case: `TypeOuter` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:21:8 | LL | #[deny(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper camel case + | +LL | type TypeOuter = i32; + | ~~~~~~~~~ error: unnecessary parentheses around type --> $DIR/lint-attr-everywhere-early.rs:24:43 @@ -31,13 +35,17 @@ error: type `ITEM_OUTER` should have an upper camel case name --> $DIR/lint-attr-everywhere-early.rs:30:8 | LL | struct ITEM_OUTER; - | ^^^^^^^^^^ help: convert the identifier to upper camel case: `ItemOuter` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:29:8 | LL | #[deny(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper camel case + | +LL | struct ItemOuter; + | ~~~~~~~~~ error: usage of an `unsafe` block --> $DIR/lint-attr-everywhere-early.rs:35:9 @@ -67,37 +75,49 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-attr-everywhere-early.rs:46:24 | LL | fn inherent_fn() { while true {} } - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:45:12 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | fn inherent_fn() { loop {} } + | ~~~~ error: denote infinite loops with `loop { ... }` --> $DIR/lint-attr-everywhere-early.rs:49:34 | LL | const INHERENT_CONST: i32 = {while true {} 1}; - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:48:12 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | const INHERENT_CONST: i32 = {loop {} 1}; + | ~~~~ error: trait `trait_inner` should have an upper camel case name --> $DIR/lint-attr-everywhere-early.rs:52:7 | LL | trait trait_inner { - | ^^^^^^^^^^^ help: convert the identifier to upper camel case: `TraitInner` + | ^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:53:13 | LL | #![deny(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper camel case + | +LL | trait TraitInner { + | ~~~~~~~~~~ error: usage of an `unsafe` block --> $DIR/lint-attr-everywhere-early.rs:59:30 @@ -115,37 +135,49 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-attr-everywhere-early.rs:62:21 | LL | fn assoc_fn() { while true {} } - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:61:12 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | fn assoc_fn() { loop {} } + | ~~~~ error: denote infinite loops with `loop { ... }` --> $DIR/lint-attr-everywhere-early.rs:65:31 | LL | const ASSOC_CONST: i32 = {while true {} 1}; - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:64:12 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | const ASSOC_CONST: i32 = {loop {} 1}; + | ~~~~ error: associated type `assoc_type` should have an upper camel case name --> $DIR/lint-attr-everywhere-early.rs:68:10 | LL | type assoc_type; - | ^^^^^^^^^^ help: convert the identifier to upper camel case: `AssocType` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:67:12 | LL | #[deny(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper camel case + | +LL | type AssocType; + | ~~~~~~~~~ error: usage of an `unsafe` block --> $DIR/lint-attr-everywhere-early.rs:74:30 @@ -163,25 +195,33 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-attr-everywhere-early.rs:77:21 | LL | fn assoc_fn() { while true {} } - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:76:12 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | fn assoc_fn() { loop {} } + | ~~~~ error: denote infinite loops with `loop { ... }` --> $DIR/lint-attr-everywhere-early.rs:80:31 | LL | const ASSOC_CONST: i32 = {while true {} 1}; - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:79:12 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | const ASSOC_CONST: i32 = {loop {} 1}; + | ~~~~ error: unnecessary parentheses around type --> $DIR/lint-attr-everywhere-early.rs:83:23 @@ -238,13 +278,17 @@ error: variant `VARIANT_CAMEL` should have an upper camel case name --> $DIR/lint-attr-everywhere-early.rs:93:5 | LL | VARIANT_CAMEL, - | ^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `VariantCamel` + | ^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:92:12 | LL | #[deny(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper camel case + | +LL | VariantCamel, + | ~~~~~~~~~~~~ error: unnecessary parentheses around type --> $DIR/lint-attr-everywhere-early.rs:99:37 @@ -301,13 +345,17 @@ error: type parameter `foo` should have an upper camel case name --> $DIR/lint-attr-everywhere-early.rs:109:42 | LL | fn generics<#[deny(non_camel_case_types)]foo>() {} - | ^^^ help: convert the identifier to upper camel case (notice the capitalization): `Foo` + | ^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:109:20 | LL | fn generics<#[deny(non_camel_case_types)]foo>() {} | ^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper camel case (notice the capitalization difference) + | +LL | fn generics<#[deny(non_camel_case_types)]Foo>() {} + | ~~~ error: unnecessary parentheses around assigned value --> $DIR/lint-attr-everywhere-early.rs:115:13 @@ -376,19 +424,23 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-attr-everywhere-early.rs:133:13 | LL | while true {} - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:130:16 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | loop {} + | ~~~~ error: `...` range patterns are deprecated --> $DIR/lint-attr-everywhere-early.rs:139:20 | LL | Match{f1: 0...100} => {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see @@ -397,6 +449,10 @@ note: the lint level is defined here | LL | #[deny(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `..=` for an inclusive range + | +LL | Match{f1: 0..=100} => {} + | ~~~ error: usage of an `unsafe` block --> $DIR/lint-attr-everywhere-early.rs:148:9 @@ -486,7 +542,7 @@ error: `...` range patterns are deprecated --> $DIR/lint-attr-everywhere-early.rs:175:18 | LL | f1: 0...100, - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see @@ -495,6 +551,10 @@ note: the lint level is defined here | LL | #[deny(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `..=` for an inclusive range + | +LL | f1: 0..=100, + | ~~~ error: aborting due to 37 previous errors diff --git a/tests/ui/lint/lint-attr-everywhere-late.stderr b/tests/ui/lint/lint-attr-everywhere-late.stderr index ddc31905afbcf..f9f910cccbefc 100644 --- a/tests/ui/lint/lint-attr-everywhere-late.stderr +++ b/tests/ui/lint/lint-attr-everywhere-late.stderr @@ -194,13 +194,17 @@ error: variable `PARAM` should have a snake case name --> $DIR/lint-attr-everywhere-late.rs:131:37 | LL | fn function(#[deny(non_snake_case)] PARAM: i32) {} - | ^^^^^ help: convert the identifier to snake case: `param` + | ^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-late.rs:131:20 | LL | fn function(#[deny(non_snake_case)] PARAM: i32) {} | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | fn function(#[deny(non_snake_case)] param: i32) {} + | ~~~~~ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:139:13 @@ -223,13 +227,17 @@ error: variable `PARAM` should have a snake case name --> $DIR/lint-attr-everywhere-late.rs:145:44 | LL | let closure = |#[deny(non_snake_case)] PARAM: i32| {}; - | ^^^^^ help: convert the identifier to snake case: `param` + | ^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-late.rs:145:27 | LL | let closure = |#[deny(non_snake_case)] PARAM: i32| {}; | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | let closure = |#[deny(non_snake_case)] param: i32| {}; + | ~~~~~ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:155:13 @@ -269,13 +277,17 @@ error: variable `ARM_VAR` should have a snake case name --> $DIR/lint-attr-everywhere-late.rs:167:9 | LL | ARM_VAR => {} - | ^^^^^^^ help: convert the identifier to snake case: `arm_var` + | ^^^^^^^ | note: the lint level is defined here --> $DIR/lint-attr-everywhere-late.rs:166:16 | LL | #[deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | arm_var => {} + | ~~~~~~~ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:173:9 diff --git a/tests/ui/lint/lint-change-warnings.stderr b/tests/ui/lint/lint-change-warnings.stderr index 3fd5283aa6a4a..b7e8c06c5084e 100644 --- a/tests/ui/lint/lint-change-warnings.stderr +++ b/tests/ui/lint/lint-change-warnings.stderr @@ -2,7 +2,7 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-change-warnings.rs:5:5 | LL | while true {} - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-change-warnings.rs:1:9 @@ -10,20 +10,28 @@ note: the lint level is defined here LL | #![deny(warnings)] | ^^^^^^^^ = note: `#[deny(while_true)]` implied by `#[deny(warnings)]` +help: use `loop` + | +LL | loop {} + | ~~~~ warning: denote infinite loops with `loop { ... }` --> $DIR/lint-change-warnings.rs:15:5 | LL | while true {} - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | loop {} + | ~~~~ error: denote infinite loops with `loop { ... }` --> $DIR/lint-change-warnings.rs:20:5 | LL | while true {} - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-change-warnings.rs:18:10 @@ -31,6 +39,10 @@ note: the lint level is defined here LL | #[forbid(warnings)] | ^^^^^^^^ = note: `#[forbid(while_true)]` implied by `#[forbid(warnings)]` +help: use `loop` + | +LL | loop {} + | ~~~~ error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/lint/lint-group-nonstandard-style.stderr b/tests/ui/lint/lint-group-nonstandard-style.stderr index fcd0101237185..57349ccc24eb1 100644 --- a/tests/ui/lint/lint-group-nonstandard-style.stderr +++ b/tests/ui/lint/lint-group-nonstandard-style.stderr @@ -2,7 +2,7 @@ warning: type `snake_case` should have an upper camel case name --> $DIR/lint-group-nonstandard-style.rs:22:16 | LL | struct snake_case; - | ^^^^^^^^^^ help: convert the identifier to upper camel case: `SnakeCase` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-group-nonstandard-style.rs:18:17 @@ -10,12 +10,16 @@ note: the lint level is defined here LL | #![warn(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ = note: `#[warn(non_camel_case_types)]` implied by `#[warn(nonstandard_style)]` +help: convert the identifier to upper camel case + | +LL | struct SnakeCase; + | ~~~~~~~~~ error: function `CamelCase` should have a snake case name --> $DIR/lint-group-nonstandard-style.rs:4:4 | LL | fn CamelCase() {} - | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` + | ^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-group-nonstandard-style.rs:1:9 @@ -23,12 +27,16 @@ note: the lint level is defined here LL | #![deny(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ = note: `#[deny(non_snake_case)]` implied by `#[deny(nonstandard_style)]` +help: convert the identifier to snake case + | +LL | fn camel_case() {} + | ~~~~~~~~~~ error: function `CamelCase` should have a snake case name --> $DIR/lint-group-nonstandard-style.rs:12:12 | LL | fn CamelCase() {} - | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` + | ^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-group-nonstandard-style.rs:10:14 @@ -36,22 +44,34 @@ note: the lint level is defined here LL | #[forbid(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ = note: `#[forbid(non_snake_case)]` implied by `#[forbid(nonstandard_style)]` +help: convert the identifier to snake case + | +LL | fn camel_case() {} + | ~~~~~~~~~~ error: static variable `bad` should have an upper case name --> $DIR/lint-group-nonstandard-style.rs:14:16 | LL | static bad: isize = 1; - | ^^^ help: convert the identifier to upper case: `BAD` + | ^^^ | = note: `#[forbid(non_upper_case_globals)]` implied by `#[forbid(nonstandard_style)]` +help: convert the identifier to upper case + | +LL | static BAD: isize = 1; + | ~~~ warning: function `CamelCase` should have a snake case name --> $DIR/lint-group-nonstandard-style.rs:20:12 | LL | fn CamelCase() {} - | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` + | ^^^^^^^^^ | = note: `#[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]` +help: convert the identifier to snake case + | +LL | fn camel_case() {} + | ~~~~~~~~~~ error: aborting due to 3 previous errors; 2 warnings emitted diff --git a/tests/ui/lint/lint-impl-fn.stderr b/tests/ui/lint/lint-impl-fn.stderr index 24ec9c7e4f3bf..012397dbae0d9 100644 --- a/tests/ui/lint/lint-impl-fn.stderr +++ b/tests/ui/lint/lint-impl-fn.stderr @@ -2,37 +2,49 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-impl-fn.rs:10:21 | LL | fn bar(&self) { while true {} } - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-impl-fn.rs:9:12 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | fn bar(&self) { loop {} } + | ~~~~ error: denote infinite loops with `loop { ... }` --> $DIR/lint-impl-fn.rs:18:25 | LL | fn foo(&self) { while true {} } - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-impl-fn.rs:13:8 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | fn foo(&self) { loop {} } + | ~~~~ error: denote infinite loops with `loop { ... }` --> $DIR/lint-impl-fn.rs:27:5 | LL | while true {} - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-impl-fn.rs:25:8 | LL | #[deny(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | loop {} + | ~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/lint/lint-lowercase-static-const-pattern.stderr b/tests/ui/lint/lint-lowercase-static-const-pattern.stderr index 8780fac05b1eb..254c9f09c47ea 100644 --- a/tests/ui/lint/lint-lowercase-static-const-pattern.stderr +++ b/tests/ui/lint/lint-lowercase-static-const-pattern.stderr @@ -2,25 +2,39 @@ error: constant in pattern `a` should have an upper case name --> $DIR/lint-lowercase-static-const-pattern.rs:11:13 | LL | (0, a) => 0, - | ^ help: convert the identifier to upper case: `A` + | ^ | note: the lint level is defined here --> $DIR/lint-lowercase-static-const-pattern.rs:4:9 | LL | #![deny(non_upper_case_globals)] | ^^^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper case + | +LL | (0, A) => 0, + | ~ error: constant in pattern `aha` should have an upper case name --> $DIR/lint-lowercase-static-const-pattern.rs:26:13 | LL | (0, aha) => 0, - | ^^^ help: convert the identifier to upper case: `AHA` + | ^^^ + | +help: convert the identifier to upper case + | +LL | (0, AHA) => 0, + | ~~~ error: constant in pattern `not_okay` should have an upper case name --> $DIR/lint-lowercase-static-const-pattern.rs:40:13 | LL | (0, not_okay) => 0, - | ^^^^^^^^ help: convert the identifier to upper case: `NOT_OKAY` + | ^^^^^^^^ + | +help: convert the identifier to upper case + | +LL | (0, NOT_OKAY) => 0, + | ~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/lint/lint-malformed.stderr b/tests/ui/lint/lint-malformed.stderr index 2c9f045de71f5..d929fa9aee8bb 100644 --- a/tests/ui/lint/lint-malformed.stderr +++ b/tests/ui/lint/lint-malformed.stderr @@ -16,7 +16,12 @@ error: malformed `deny` attribute input --> $DIR/lint-malformed.rs:1:1 | LL | #![deny = "foo"] - | ^^^^^^^^^^^^^^^^ help: must be of the form: `#![deny(lint1, lint2, ..., /*opt*/ reason = "...")]` + | ^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #![deny(lint1, lint2, ..., /*opt*/ reason = "...")] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0452]: malformed lint attribute input --> $DIR/lint-malformed.rs:2:10 diff --git a/tests/ui/lint/lint-match-arms-2.stderr b/tests/ui/lint/lint-match-arms-2.stderr index 5e803ef193480..ed832787fd1be 100644 --- a/tests/ui/lint/lint-match-arms-2.stderr +++ b/tests/ui/lint/lint-match-arms-2.stderr @@ -2,13 +2,17 @@ error[E0170]: pattern binding `A` is named the same as one of the variants of th --> $DIR/lint-match-arms-2.rs:12:9 | LL | A => {} - | ^ help: to match on the variant, qualify the path: `E::A` + | ^ | note: the lint level is defined here --> $DIR/lint-match-arms-2.rs:11:16 | LL | #[deny(bindings_with_variant_name)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: to match on the variant, qualify the path + | +LL | E::A => {} + | ~~~~ error: irrefutable `if let` guard pattern --> $DIR/lint-match-arms-2.rs:18:14 diff --git a/tests/ui/lint/lint-match-arms.stderr b/tests/ui/lint/lint-match-arms.stderr index eccfa19fda781..9dcc3098a0043 100644 --- a/tests/ui/lint/lint-match-arms.stderr +++ b/tests/ui/lint/lint-match-arms.stderr @@ -2,13 +2,17 @@ error: unused variable: `y` --> $DIR/lint-match-arms.rs:5:9 | LL | y => (), - | ^ help: if this is intentional, prefix it with an underscore: `_y` + | ^ | note: the lint level is defined here --> $DIR/lint-match-arms.rs:3:16 | LL | #[deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | _y => (), + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/lint-non-camel-case-types.stderr b/tests/ui/lint/lint-non-camel-case-types.stderr index 875380b5dabc6..1cdf6df1bdcab 100644 --- a/tests/ui/lint/lint-non-camel-case-types.stderr +++ b/tests/ui/lint/lint-non-camel-case-types.stderr @@ -2,61 +2,105 @@ error: type `ONE_TWO_THREE` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:4:8 | LL | struct ONE_TWO_THREE; - | ^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `OneTwoThree` + | ^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-camel-case-types.rs:1:11 | LL | #![forbid(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper camel case + | +LL | struct OneTwoThree; + | ~~~~~~~~~~~ error: type `foo` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:7:8 | LL | struct foo { - | ^^^ help: convert the identifier to upper camel case (notice the capitalization): `Foo` + | ^^^ + | +help: convert the identifier to upper camel case (notice the capitalization difference) + | +LL | struct Foo { + | ~~~ error: type `foo2` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:11:6 | LL | enum foo2 { - | ^^^^ help: convert the identifier to upper camel case (notice the capitalization): `Foo2` + | ^^^^ + | +help: convert the identifier to upper camel case (notice the capitalization difference) + | +LL | enum Foo2 { + | ~~~~ error: type `foo3` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:15:8 | LL | struct foo3 { - | ^^^^ help: convert the identifier to upper camel case (notice the capitalization): `Foo3` + | ^^^^ + | +help: convert the identifier to upper camel case (notice the capitalization difference) + | +LL | struct Foo3 { + | ~~~~ error: type `foo4` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:19:6 | LL | type foo4 = isize; - | ^^^^ help: convert the identifier to upper camel case (notice the capitalization): `Foo4` + | ^^^^ + | +help: convert the identifier to upper camel case (notice the capitalization difference) + | +LL | type Foo4 = isize; + | ~~~~ error: variant `bar` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:22:5 | LL | bar - | ^^^ help: convert the identifier to upper camel case: `Bar` + | ^^^ + | +help: convert the identifier to upper camel case + | +LL | Bar + | ~~~ error: trait `foo6` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:25:7 | LL | trait foo6 { - | ^^^^ help: convert the identifier to upper camel case (notice the capitalization): `Foo6` + | ^^^^ + | +help: convert the identifier to upper camel case (notice the capitalization difference) + | +LL | trait Foo6 { + | ~~~~ error: associated type `foo7` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:26:10 | LL | type foo7; - | ^^^^ help: convert the identifier to upper camel case (notice the capitalization): `Foo7` + | ^^^^ + | +help: convert the identifier to upper camel case (notice the capitalization difference) + | +LL | type Foo7; + | ~~~~ error: type parameter `ty` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:30:6 | LL | fn f(_: ty) {} - | ^^ help: convert the identifier to upper camel case: `Ty` + | ^^ + | +help: convert the identifier to upper camel case + | +LL | fn f(_: ty) {} + | ~~ error: aborting due to 9 previous errors diff --git a/tests/ui/lint/lint-non-uppercase-associated-const.stderr b/tests/ui/lint/lint-non-uppercase-associated-const.stderr index 54c951b1f63ed..f9c0a8d8ab6c6 100644 --- a/tests/ui/lint/lint-non-uppercase-associated-const.stderr +++ b/tests/ui/lint/lint-non-uppercase-associated-const.stderr @@ -2,13 +2,17 @@ error: associated constant `not_upper` should have an upper case name --> $DIR/lint-non-uppercase-associated-const.rs:7:11 | LL | const not_upper: bool = true; - | ^^^^^^^^^ help: convert the identifier to upper case: `NOT_UPPER` + | ^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-uppercase-associated-const.rs:1:9 | LL | #![deny(non_upper_case_globals)] | ^^^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper case + | +LL | const NOT_UPPER: bool = true; + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/lint-non-uppercase-statics.stderr b/tests/ui/lint/lint-non-uppercase-statics.stderr index c6fd0a6e0ddf8..8442c8fb7728f 100644 --- a/tests/ui/lint/lint-non-uppercase-statics.stderr +++ b/tests/ui/lint/lint-non-uppercase-statics.stderr @@ -2,19 +2,28 @@ error: static variable `foo` should have an upper case name --> $DIR/lint-non-uppercase-statics.rs:4:8 | LL | static foo: isize = 1; - | ^^^ help: convert the identifier to upper case (notice the capitalization): `FOO` + | ^^^ | note: the lint level is defined here --> $DIR/lint-non-uppercase-statics.rs:1:11 | LL | #![forbid(non_upper_case_globals)] | ^^^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper case (notice the capitalization difference) + | +LL | static FOO: isize = 1; + | ~~~ error: static variable `bar` should have an upper case name --> $DIR/lint-non-uppercase-statics.rs:6:12 | LL | static mut bar: isize = 1; - | ^^^ help: convert the identifier to upper case: `BAR` + | ^^^ + | +help: convert the identifier to upper case + | +LL | static mut BAR: isize = 1; + | ~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lint/lint-non-uppercase-trait-assoc-const.stderr b/tests/ui/lint/lint-non-uppercase-trait-assoc-const.stderr index a5ac540d12542..fdad43a8f7bc8 100644 --- a/tests/ui/lint/lint-non-uppercase-trait-assoc-const.stderr +++ b/tests/ui/lint/lint-non-uppercase-trait-assoc-const.stderr @@ -2,13 +2,17 @@ error: associated constant `item` should have an upper case name --> $DIR/lint-non-uppercase-trait-assoc-const.rs:4:11 | LL | const item: usize; - | ^^^^ help: convert the identifier to upper case: `ITEM` + | ^^^^ | note: the lint level is defined here --> $DIR/lint-non-uppercase-trait-assoc-const.rs:1:9 | LL | #![deny(non_upper_case_globals)] | ^^^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper case + | +LL | const ITEM: usize; + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/lint-nonstandard-style-unicode-1.stderr b/tests/ui/lint/lint-nonstandard-style-unicode-1.stderr index 6c2aa225e602e..437df91e025ef 100644 --- a/tests/ui/lint/lint-nonstandard-style-unicode-1.stderr +++ b/tests/ui/lint/lint-nonstandard-style-unicode-1.stderr @@ -2,49 +2,83 @@ error: type `χa` should have an upper camel case name --> $DIR/lint-nonstandard-style-unicode-1.rs:14:8 | LL | struct χa; - | ^^ help: convert the identifier to upper camel case: `Χa` + | ^^ | note: the lint level is defined here --> $DIR/lint-nonstandard-style-unicode-1.rs:3:11 | LL | #![forbid(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper camel case + | +LL | struct Χa; + | ~~ error: type `__χa` should have an upper camel case name --> $DIR/lint-nonstandard-style-unicode-1.rs:22:8 | LL | struct __χa; - | ^^^^ help: convert the identifier to upper camel case: `Χa` + | ^^^^ + | +help: convert the identifier to upper camel case + | +LL | struct Χa; + | ~~ error: type `对__否` should have an upper camel case name --> $DIR/lint-nonstandard-style-unicode-1.rs:27:8 | LL | struct 对__否; - | ^^^^^^ help: convert the identifier to upper camel case: `对_否` + | ^^^^^^ + | +help: convert the identifier to upper camel case + | +LL | struct 对_否; + | ~~~~~ error: type `ヒ__χ` should have an upper camel case name --> $DIR/lint-nonstandard-style-unicode-1.rs:30:8 | LL | struct ヒ__χ; - | ^^^^^ help: convert the identifier to upper camel case: `ヒΧ` + | ^^^^^ + | +help: convert the identifier to upper camel case + | +LL | struct ヒΧ; + | ~~~ error: type `Hello_你好` should have an upper camel case name --> $DIR/lint-nonstandard-style-unicode-1.rs:36:8 | LL | struct Hello_你好; - | ^^^^^^^^^^ help: convert the identifier to upper camel case: `Hello你好` + | ^^^^^^^^^^ + | +help: convert the identifier to upper camel case + | +LL | struct Hello你好; + | ~~~~~~~~~ error: type `Hello_World` should have an upper camel case name --> $DIR/lint-nonstandard-style-unicode-1.rs:39:8 | LL | struct Hello_World; - | ^^^^^^^^^^^ help: convert the identifier to upper camel case: `HelloWorld` + | ^^^^^^^^^^^ + | +help: convert the identifier to upper camel case + | +LL | struct HelloWorld; + | ~~~~~~~~~~ error: type `你_ӟ` should have an upper camel case name --> $DIR/lint-nonstandard-style-unicode-1.rs:42:8 | LL | struct 你_ӟ; - | ^^^^ help: convert the identifier to upper camel case: `你Ӟ` + | ^^^^ + | +help: convert the identifier to upper camel case + | +LL | struct 你Ӟ; + | ~~~ error: aborting due to 7 previous errors diff --git a/tests/ui/lint/lint-nonstandard-style-unicode-3.stderr b/tests/ui/lint/lint-nonstandard-style-unicode-3.stderr index 3d4337bbc6f92..d2a561da90f93 100644 --- a/tests/ui/lint/lint-nonstandard-style-unicode-3.stderr +++ b/tests/ui/lint/lint-nonstandard-style-unicode-3.stderr @@ -2,13 +2,17 @@ error: static variable `τεχ` should have an upper case name --> $DIR/lint-nonstandard-style-unicode-3.rs:17:8 | LL | static τεχ: f32 = 3.14159265; - | ^^^ help: convert the identifier to upper case: `ΤΕΧ` + | ^^^ | note: the lint level is defined here --> $DIR/lint-nonstandard-style-unicode-3.rs:3:11 | LL | #![forbid(non_upper_case_globals)] | ^^^^^^^^^^^^^^^^^^^^^^ +help: convert the identifier to upper case + | +LL | static ΤΕΧ: f32 = 3.14159265; + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/lint-pre-expansion-extern-module.stderr b/tests/ui/lint/lint-pre-expansion-extern-module.stderr index 32c76da98b525..bb14e363b9fb7 100644 --- a/tests/ui/lint/lint-pre-expansion-extern-module.stderr +++ b/tests/ui/lint/lint-pre-expansion-extern-module.stderr @@ -2,12 +2,16 @@ warning: `try` is a keyword in the 2018 edition --> $DIR/lint_pre_expansion_extern_module_aux.rs:3:8 | LL | pub fn try() {} - | ^^^ help: you can use a raw identifier to stay compatible: `r#try` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 = note: `-W keyword-idents-2018` implied by `-W rust-2018-compatibility` = help: to override `-W rust-2018-compatibility` add `#[allow(keyword_idents_2018)]` +help: you can use a raw identifier to stay compatible + | +LL | pub fn r#try() {} + | ~~~~~ warning: 1 warning emitted diff --git a/tests/ui/lint/lint-range-endpoint-overflow.stderr b/tests/ui/lint/lint-range-endpoint-overflow.stderr index d2df73727412f..e17b5e5f1024c 100644 --- a/tests/ui/lint/lint-range-endpoint-overflow.stderr +++ b/tests/ui/lint/lint-range-endpoint-overflow.stderr @@ -2,13 +2,17 @@ error: range endpoint is out of range for `u8` --> $DIR/lint-range-endpoint-overflow.rs:4:19 | LL | let range_a = 0..256; - | ^^^^^^ help: use an inclusive range instead: `0..=255` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-range-endpoint-overflow.rs:1:9 | LL | #![deny(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ +help: use an inclusive range instead + | +LL | let range_a = 0..=255; + | ~~~~~~~ error: literal out of range for `u8` --> $DIR/lint-range-endpoint-overflow.rs:6:23 @@ -38,13 +42,23 @@ error: range endpoint is out of range for `u8` --> $DIR/lint-range-endpoint-overflow.rs:9:20 | LL | let _range_f = 0..256u8; - | ^^^^^^^^ help: use an inclusive range instead: `0..=255u8` + | ^^^^^^^^ + | +help: use an inclusive range instead + | +LL | let _range_f = 0..=255u8; + | ~~~~~~~~~ error: range endpoint is out of range for `i8` --> $DIR/lint-range-endpoint-overflow.rs:10:20 | LL | let _range_g = 0..128i8; - | ^^^^^^^^ help: use an inclusive range instead: `0..=127i8` + | ^^^^^^^^ + | +help: use an inclusive range instead + | +LL | let _range_g = 0..=127i8; + | ~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/tests/ui/lint/lint-removed-allow.stderr b/tests/ui/lint/lint-removed-allow.stderr index 849c9ec5ca0ff..cd5cc5b3ae3f7 100644 --- a/tests/ui/lint/lint-removed-allow.stderr +++ b/tests/ui/lint/lint-removed-allow.stderr @@ -2,13 +2,17 @@ error: unused variable: `unused` --> $DIR/lint-removed-allow.rs:8:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-removed-allow.rs:7:8 | LL | #[deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | fn main() { let _unused = (); } + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/lint-removed-cmdline-deny.stderr b/tests/ui/lint/lint-removed-cmdline-deny.stderr index 2a24e795f4438..04a831685e2ef 100644 --- a/tests/ui/lint/lint-removed-cmdline-deny.stderr +++ b/tests/ui/lint/lint-removed-cmdline-deny.stderr @@ -17,7 +17,7 @@ error: unused variable: `unused` --> $DIR/lint-removed-cmdline-deny.rs:13:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-removed-cmdline-deny.rs:12:8 @@ -25,6 +25,10 @@ note: the lint level is defined here LL | #[deny(warnings)] | ^^^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]` +help: if this is intentional, prefix it with an underscore + | +LL | fn main() { let _unused = (); } + | ~~~~~~~ error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok | diff --git a/tests/ui/lint/lint-removed-cmdline.stderr b/tests/ui/lint/lint-removed-cmdline.stderr index 78ae2fd8fbffe..42ca841dc09c0 100644 --- a/tests/ui/lint/lint-removed-cmdline.stderr +++ b/tests/ui/lint/lint-removed-cmdline.stderr @@ -17,7 +17,7 @@ error: unused variable: `unused` --> $DIR/lint-removed-cmdline.rs:13:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-removed-cmdline.rs:12:8 @@ -25,6 +25,10 @@ note: the lint level is defined here LL | #[deny(warnings)] | ^^^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]` +help: if this is intentional, prefix it with an underscore + | +LL | fn main() { let _unused = (); } + | ~~~~~~~ warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok | diff --git a/tests/ui/lint/lint-removed.stderr b/tests/ui/lint/lint-removed.stderr index 6d3629ba388f6..eed0e1ef14d1e 100644 --- a/tests/ui/lint/lint-removed.stderr +++ b/tests/ui/lint/lint-removed.stderr @@ -10,13 +10,17 @@ error: unused variable: `unused` --> $DIR/lint-removed.rs:8:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-removed.rs:7:8 | LL | #[deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | fn main() { let _unused = (); } + | ~~~~~~~ error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/lint/lint-renamed-allow.stderr b/tests/ui/lint/lint-renamed-allow.stderr index 8bc8530b42246..a833218111de4 100644 --- a/tests/ui/lint/lint-renamed-allow.stderr +++ b/tests/ui/lint/lint-renamed-allow.stderr @@ -2,7 +2,7 @@ error: unused variable: `unused` --> $DIR/lint-renamed-allow.rs:8:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-renamed-allow.rs:7:8 @@ -10,6 +10,10 @@ note: the lint level is defined here LL | #[deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | fn main() { let _unused = (); } + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/lint-renamed-cmdline-deny.stderr b/tests/ui/lint/lint-renamed-cmdline-deny.stderr index 3c1a59ec1e1c0..06e77a60340d4 100644 --- a/tests/ui/lint/lint-renamed-cmdline-deny.stderr +++ b/tests/ui/lint/lint-renamed-cmdline-deny.stderr @@ -20,7 +20,7 @@ error: unused variable: `unused` --> $DIR/lint-renamed-cmdline-deny.rs:10:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-renamed-cmdline-deny.rs:9:8 @@ -28,6 +28,10 @@ note: the lint level is defined here LL | #[deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | fn main() { let _unused = (); } + | ~~~~~~~ error: lint `bare_trait_object` has been renamed to `bare_trait_objects` | diff --git a/tests/ui/lint/lint-renamed-cmdline.stderr b/tests/ui/lint/lint-renamed-cmdline.stderr index 6544416f61149..69de067da56c6 100644 --- a/tests/ui/lint/lint-renamed-cmdline.stderr +++ b/tests/ui/lint/lint-renamed-cmdline.stderr @@ -20,7 +20,7 @@ error: unused variable: `unused` --> $DIR/lint-renamed-cmdline.rs:9:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-renamed-cmdline.rs:8:8 @@ -28,6 +28,10 @@ note: the lint level is defined here LL | #[deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | fn main() { let _unused = (); } + | ~~~~~~~ warning: lint `bare_trait_object` has been renamed to `bare_trait_objects` | diff --git a/tests/ui/lint/lint-renamed.stderr b/tests/ui/lint/lint-renamed.stderr index a1aa85e6744e0..0014e47e952ad 100644 --- a/tests/ui/lint/lint-renamed.stderr +++ b/tests/ui/lint/lint-renamed.stderr @@ -2,15 +2,19 @@ warning: lint `bare_trait_object` has been renamed to `bare_trait_objects` --> $DIR/lint-renamed.rs:1:8 | LL | #[deny(bare_trait_object)] - | ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` + | ^^^^^^^^^^^^^^^^^ | = note: `#[warn(renamed_and_removed_lints)]` on by default +help: use the new name + | +LL | #[deny(bare_trait_objects)] + | ~~~~~~~~~~~~~~~~~~ error: unused variable: `unused` --> $DIR/lint-renamed.rs:4:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-renamed.rs:3:8 @@ -18,6 +22,10 @@ note: the lint level is defined here LL | #[deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | fn main() { let _unused = (); } + | ~~~~~~~ error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/lint/lint-shorthand-field.stderr b/tests/ui/lint/lint-shorthand-field.stderr index 2d1ca30f991ae..0879808bc7a25 100644 --- a/tests/ui/lint/lint-shorthand-field.stderr +++ b/tests/ui/lint/lint-shorthand-field.stderr @@ -2,37 +2,61 @@ error: the `x:` in this pattern is redundant --> $DIR/lint-shorthand-field.rs:14:13 | LL | x: x, - | ^^^^ help: use shorthand field pattern: `x` + | ^^^^ | note: the lint level is defined here --> $DIR/lint-shorthand-field.rs:4:9 | LL | #![deny(non_shorthand_field_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use shorthand field pattern + | +LL | x, + | ~ error: the `y:` in this pattern is redundant --> $DIR/lint-shorthand-field.rs:15:13 | LL | y: ref y, - | ^^^^^^^^ help: use shorthand field pattern: `ref y` + | ^^^^^^^^ + | +help: use shorthand field pattern + | +LL | ref y, + | ~~~~~ error: the `x:` in this pattern is redundant --> $DIR/lint-shorthand-field.rs:65:13 | LL | x: mut x, - | ^^^^^^^^ help: use shorthand field pattern: `mut x` + | ^^^^^^^^ + | +help: use shorthand field pattern + | +LL | mut x, + | ~~~~~ error: the `y:` in this pattern is redundant --> $DIR/lint-shorthand-field.rs:66:13 | LL | y: ref y, - | ^^^^^^^^ help: use shorthand field pattern: `ref y` + | ^^^^^^^^ + | +help: use shorthand field pattern + | +LL | ref y, + | ~~~~~ error: the `z:` in this pattern is redundant --> $DIR/lint-shorthand-field.rs:67:13 | LL | z: ref mut z, - | ^^^^^^^^^^^^ help: use shorthand field pattern: `ref mut z` + | ^^^^^^^^^^^^ + | +help: use shorthand field pattern + | +LL | ref mut z, + | ~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr index 390028b349e5f..fb2d65b79b2a9 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -31,21 +31,25 @@ error: under strict provenance it is considered bad style to cast pointer `*cons --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 | LL | let ptr_addr = ptr as usize; - | ^^^--------- - | | - | help: use `.addr()` to obtain the address of a pointer: `.addr()` + | ^^^^^^^^^^^^ | = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead +help: use `.addr()` to obtain the address of a pointer + | +LL | let ptr_addr = ptr.addr(); + | ~~~~~~~ error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `u32` --> $DIR/lint-strict-provenance-lossy-casts.rs:16:26 | LL | let ptr_addr_32bit = ptr as u32; - | ^^^------- - | | - | help: use `.addr()` to obtain the address of a pointer: `.addr() as u32` + | ^^^^^^^^^^ | = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead +help: use `.addr()` to obtain the address of a pointer + | +LL | let ptr_addr_32bit = ptr.addr() as u32; + | ~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/lint/lint-unexported-no-mangle.stderr b/tests/ui/lint/lint-unexported-no-mangle.stderr index 39377b6fe8465..b7054fee7a1dc 100644 --- a/tests/ui/lint/lint-unexported-no-mangle.stderr +++ b/tests/ui/lint/lint-unexported-no-mangle.stderr @@ -31,19 +31,24 @@ error: const items should never be `#[no_mangle]` --> $DIR/lint-unexported-no-mangle.rs:9:1 | LL | const FOO: u64 = 1; - | -----^^^^^^^^^^^^^^ - | | - | help: try a static value: `pub static` + | ^^^^^^^^^^^^^^^^^^^ | = note: requested on the command line with `-F no-mangle-const-items` +help: try a static value + | +LL | pub static FOO: u64 = 1; + | ~~~~~~~~~~ error: const items should never be `#[no_mangle]` --> $DIR/lint-unexported-no-mangle.rs:12:1 | LL | pub const PUB_FOO: u64 = 1; - | ---------^^^^^^^^^^^^^^^^^^ - | | - | help: try a static value: `pub static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try a static value + | +LL | pub static PUB_FOO: u64 = 1; + | ~~~~~~~~~~ warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported | diff --git a/tests/ui/lint/lint-unknown-lint.stderr b/tests/ui/lint/lint-unknown-lint.stderr index 0cb6b49578cf3..ecedd3afa68d6 100644 --- a/tests/ui/lint/lint-unknown-lint.stderr +++ b/tests/ui/lint/lint-unknown-lint.stderr @@ -14,13 +14,23 @@ error: unknown lint: `dead_cod` --> $DIR/lint-unknown-lint.rs:5:9 | LL | #![deny(dead_cod)] - | ^^^^^^^^ help: did you mean: `dead_code` + | ^^^^^^^^ + | +help: did you mean + | +LL | #![deny(dead_code)] + | ~~~~~~~~~ error: unknown lint: `rust_2018_idiots` --> $DIR/lint-unknown-lint.rs:9:9 | LL | #![deny(rust_2018_idiots)] - | ^^^^^^^^^^^^^^^^ help: did you mean: `rust_2018_idioms` + | ^^^^^^^^^^^^^^^^ + | +help: did you mean + | +LL | #![deny(rust_2018_idioms)] + | ~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/lint/non-local-defs/consts.stderr b/tests/ui/lint/non-local-defs/consts.stderr index ed7bd56fe4a54..0cf6845a75aa5 100644 --- a/tests/ui/lint/non-local-defs/consts.stderr +++ b/tests/ui/lint/non-local-defs/consts.stderr @@ -2,10 +2,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam --> $DIR/consts.rs:15:5 | LL | const Z: () = { - | ----------- - | | | - | | help: use a const-anon item to suppress this lint: `_` - | move the `impl` block outside of this constant `Z` + | ----------- move the `impl` block outside of this constant `Z` ... LL | impl Uto for &Test {} | ^^^^^---^^^^^----- @@ -22,6 +19,10 @@ note: the lint level is defined here | LL | #![warn(non_local_definitions)] | ^^^^^^^^^^^^^^^^^^^^^ +help: use a const-anon item to suppress this lint + | +LL | const _: () = { + | ~ warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> $DIR/consts.rs:26:5 diff --git a/tests/ui/lint/non-local-defs/exhaustive.stderr b/tests/ui/lint/non-local-defs/exhaustive.stderr index 6d8c2ec0bc7cf..75d57d6f4754a 100644 --- a/tests/ui/lint/non-local-defs/exhaustive.stderr +++ b/tests/ui/lint/non-local-defs/exhaustive.stderr @@ -196,7 +196,6 @@ LL | impl Trait for *mut InsideMain {} | ^^^^^-----^^^^^--------------- | | | | | `*mut InsideMain` is not local - | | help: remove `*mut ` to make the `impl` local | `Trait` is not local | = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type @@ -210,6 +209,11 @@ LL | fn main() { LL | struct InsideMain; | ----------------- may need to be moved as well = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue +help: remove `*mut ` to make the `impl` local + | +LL - impl Trait for *mut InsideMain {} +LL + impl Trait for InsideMain {} + | warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> $DIR/exhaustive.rs:62:5 diff --git a/tests/ui/lint/non-local-defs/from-local-for-global.stderr b/tests/ui/lint/non-local-defs/from-local-for-global.stderr index 04eba8435fc04..6e15654d9b34b 100644 --- a/tests/ui/lint/non-local-defs/from-local-for-global.stderr +++ b/tests/ui/lint/non-local-defs/from-local-for-global.stderr @@ -45,7 +45,6 @@ LL | impl StillNonLocal for &Foo {} | ^^^^^-------------^^^^^---- | | | | | `&'_ Foo` is not local - | | help: remove `&` to make the `impl` local | `StillNonLocal` is not local | = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type @@ -58,6 +57,11 @@ LL | fn only_global() { LL | struct Foo; | ---------- may need to be moved as well = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue +help: remove `&` to make the `impl` local + | +LL - impl StillNonLocal for &Foo {} +LL + impl StillNonLocal for Foo {} + | warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> $DIR/from-local-for-global.rs:42:5 diff --git a/tests/ui/lint/non-local-defs/trait-solver-overflow-123573.stderr b/tests/ui/lint/non-local-defs/trait-solver-overflow-123573.stderr index 2eb71cecacaaf..f86bfbf0faaed 100644 --- a/tests/ui/lint/non-local-defs/trait-solver-overflow-123573.stderr +++ b/tests/ui/lint/non-local-defs/trait-solver-overflow-123573.stderr @@ -5,7 +5,6 @@ LL | impl Test for &Local {} | ^^^^^----^^^^^------ | | | | | `&'_ Local` is not local - | | help: remove `&` to make the `impl` local | `Test` is not local | = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type @@ -23,6 +22,11 @@ note: the lint level is defined here | LL | #![warn(non_local_definitions)] | ^^^^^^^^^^^^^^^^^^^^^ +help: remove `&` to make the `impl` local + | +LL - impl Test for &Local {} +LL + impl Test for Local {} + | warning: 1 warning emitted diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-cdylib.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-cdylib.stderr index f9167aa8df349..eb72e2b2c1761 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-cdylib.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-cdylib.stderr @@ -2,13 +2,17 @@ error: crate `NonSnakeCase` should have a snake case name --> $DIR/lint-non-snake-case-crate-cdylib.rs:3:18 | LL | #![crate_name = "NonSnakeCase"] - | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | ^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-crate-cdylib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | #![crate_name = "non_snake_case"] + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-dylib.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-dylib.stderr index 4ee1a9cb3ddd5..9032601dc5b75 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-dylib.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-dylib.stderr @@ -2,13 +2,17 @@ error: crate `NonSnakeCase` should have a snake case name --> $DIR/lint-non-snake-case-crate-dylib.rs:3:18 | LL | #![crate_name = "NonSnakeCase"] - | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | ^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-crate-dylib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | #![crate_name = "non_snake_case"] + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-lib.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-lib.stderr index a68c0e832b88c..6901342719d9a 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-lib.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-lib.stderr @@ -2,13 +2,17 @@ error: crate `NonSnakeCase` should have a snake case name --> $DIR/lint-non-snake-case-crate-lib.rs:3:18 | LL | #![crate_name = "NonSnakeCase"] - | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | ^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-crate-lib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | #![crate_name = "non_snake_case"] + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-proc-macro.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-proc-macro.stderr index e0091057bc971..bd2caf5044483 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-proc-macro.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-proc-macro.stderr @@ -2,13 +2,17 @@ error: crate `NonSnakeCase` should have a snake case name --> $DIR/lint-non-snake-case-crate-proc-macro.rs:3:18 | LL | #![crate_name = "NonSnakeCase"] - | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | ^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-crate-proc-macro.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | #![crate_name = "non_snake_case"] + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-rlib.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-rlib.stderr index 6e9d54bd5bcde..ef18fde443cc1 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-rlib.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-rlib.stderr @@ -2,13 +2,17 @@ error: crate `NonSnakeCase` should have a snake case name --> $DIR/lint-non-snake-case-crate-rlib.rs:3:18 | LL | #![crate_name = "NonSnakeCase"] - | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | ^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-crate-rlib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | #![crate_name = "non_snake_case"] + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-staticlib.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-staticlib.stderr index 4ee6d5bd4d46f..3364e20555d36 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-staticlib.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate-staticlib.stderr @@ -2,13 +2,17 @@ error: crate `NonSnakeCase` should have a snake case name --> $DIR/lint-non-snake-case-crate-staticlib.rs:3:18 | LL | #![crate_name = "NonSnakeCase"] - | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | ^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-crate-staticlib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | #![crate_name = "non_snake_case"] + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-functions.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-functions.stderr index f6ac6b99b602f..e3f17f898d999 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-functions.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-functions.stderr @@ -2,61 +2,105 @@ error: method `Foo_Method` should have a snake case name --> $DIR/lint-non-snake-case-functions.rs:7:8 | LL | fn Foo_Method() {} - | ^^^^^^^^^^ help: convert the identifier to snake case: `foo_method` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-functions.rs:1:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | fn foo_method() {} + | ~~~~~~~~~~ error: method `foo__method` should have a snake case name --> $DIR/lint-non-snake-case-functions.rs:11:8 | LL | fn foo__method(&self) {} - | ^^^^^^^^^^^ help: convert the identifier to snake case: `foo_method` + | ^^^^^^^^^^^ + | +help: convert the identifier to snake case + | +LL | fn foo_method(&self) {} + | ~~~~~~~~~~ error: method `xyZ` should have a snake case name --> $DIR/lint-non-snake-case-functions.rs:14:12 | LL | pub fn xyZ(&mut self) {} - | ^^^ help: convert the identifier to snake case: `xy_z` + | ^^^ + | +help: convert the identifier to snake case + | +LL | pub fn xy_z(&mut self) {} + | ~~~~ error: method `render_HTML` should have a snake case name --> $DIR/lint-non-snake-case-functions.rs:17:8 | LL | fn render_HTML() {} - | ^^^^^^^^^^^ help: convert the identifier to snake case: `render_html` + | ^^^^^^^^^^^ + | +help: convert the identifier to snake case + | +LL | fn render_html() {} + | ~~~~~~~~~~~ error: trait method `ABC` should have a snake case name --> $DIR/lint-non-snake-case-functions.rs:22:8 | LL | fn ABC(); - | ^^^ help: convert the identifier to snake case: `abc` + | ^^^ + | +help: convert the identifier to snake case + | +LL | fn abc(); + | ~~~ error: trait method `a_b_C` should have a snake case name --> $DIR/lint-non-snake-case-functions.rs:25:8 | LL | fn a_b_C(&self) {} - | ^^^^^ help: convert the identifier to snake case (notice the capitalization): `a_b_c` + | ^^^^^ + | +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | fn a_b_c(&self) {} + | ~~~~~ error: trait method `something__else` should have a snake case name --> $DIR/lint-non-snake-case-functions.rs:28:8 | LL | fn something__else(&mut self); - | ^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `something_else` + | ^^^^^^^^^^^^^^^ + | +help: convert the identifier to snake case + | +LL | fn something_else(&mut self); + | ~~~~~~~~~~~~~~ error: function `Cookie` should have a snake case name --> $DIR/lint-non-snake-case-functions.rs:38:4 | LL | fn Cookie() {} - | ^^^^^^ help: convert the identifier to snake case (notice the capitalization): `cookie` + | ^^^^^^ + | +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | fn cookie() {} + | ~~~~~~ error: function `bi_S_Cuit` should have a snake case name --> $DIR/lint-non-snake-case-functions.rs:41:8 | LL | pub fn bi_S_Cuit() {} - | ^^^^^^^^^ help: convert the identifier to snake case (notice the capitalization): `bi_s_cuit` + | ^^^^^^^^^ + | +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | pub fn bi_s_cuit() {} + | ~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr index 2841815ecf2b9..9a749ad2e109b 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr @@ -2,7 +2,7 @@ warning: unused variable: `Mod` --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:12:9 | LL | let Mod: usize = 0; - | ^^^ help: if this is intentional, prefix it with an underscore: `_Mod` + | ^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:1:9 @@ -10,12 +10,21 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _Mod: usize = 0; + | ~~~~ warning: unused variable: `Super` --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:16:9 | LL | let Super: usize = 0; - | ^^^^^ help: if this is intentional, prefix it with an underscore: `_Super` + | ^^^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _Super: usize = 0; + | ~~~~~~ error: module `Impl` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:5:5 @@ -59,9 +68,14 @@ error: variable `Super` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:16:9 | LL | let Super: usize = 0; - | ^^^^^ help: rename the identifier + | ^^^^^ | = note: `super` cannot be used as a raw identifier +help: rename the identifier + | +LL - let Super: usize = 0; +LL + let : usize = 0; + | error: aborting due to 4 previous errors; 2 warnings emitted diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-lifetimes.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-lifetimes.stderr index 8be7365cfc341..fa8b0ee2baf66 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-lifetimes.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-lifetimes.stderr @@ -2,13 +2,17 @@ error: lifetime `'FooBar` should have a snake case name --> $DIR/lint-non-snake-case-lifetimes.rs:4:6 | LL | fn f<'FooBar>( - | ^^^^^^^ help: convert the identifier to snake case: `'foo_bar` + | ^^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-lifetimes.rs:1:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | fn f<'foo_bar>( + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-modules.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-modules.stderr index f21f9a934f3f9..697ddb5429f2c 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-modules.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-modules.stderr @@ -2,13 +2,17 @@ error: module `FooBar` should have a snake case name --> $DIR/lint-non-snake-case-modules.rs:4:5 | LL | mod FooBar { - | ^^^^^^ help: convert the identifier to snake case: `foo_bar` + | ^^^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-modules.rs:1:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | mod foo_bar { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/non-snake-case/lint-nonstandard-style-unicode-2.stderr b/tests/ui/lint/non-snake-case/lint-nonstandard-style-unicode-2.stderr index 8eb0654e0a193..2e483de72a1f3 100644 --- a/tests/ui/lint/non-snake-case/lint-nonstandard-style-unicode-2.stderr +++ b/tests/ui/lint/non-snake-case/lint-nonstandard-style-unicode-2.stderr @@ -2,19 +2,28 @@ error: function `Ц` should have a snake case name --> $DIR/lint-nonstandard-style-unicode-2.rs:17:4 | LL | fn Ц() {} - | ^ help: convert the identifier to snake case: `ц` + | ^ | note: the lint level is defined here --> $DIR/lint-nonstandard-style-unicode-2.rs:3:11 | LL | #![forbid(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | fn ц() {} + | ~ error: function `分__隔` should have a snake case name --> $DIR/lint-nonstandard-style-unicode-2.rs:22:4 | LL | fn 分__隔() {} - | ^^^^^^ help: convert the identifier to snake case: `分_隔` + | ^^^^^^ + | +help: convert the identifier to snake case + | +LL | fn 分_隔() {} + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lint/non-snake-case/lint-uppercase-variables.stderr b/tests/ui/lint/non-snake-case/lint-uppercase-variables.stderr index 9220828014fda..9e6d3602beb4e 100644 --- a/tests/ui/lint/non-snake-case/lint-uppercase-variables.stderr +++ b/tests/ui/lint/non-snake-case/lint-uppercase-variables.stderr @@ -2,21 +2,30 @@ error[E0170]: pattern binding `Foo` is named the same as one of the variants of --> $DIR/lint-uppercase-variables.rs:22:9 | LL | Foo => {} - | ^^^ help: to match on the variant, qualify the path: `foo::Foo::Foo` + | ^^^ | = note: `#[deny(bindings_with_variant_name)]` on by default +help: to match on the variant, qualify the path + | +LL | foo::Foo::Foo => {} + | ~~~~~~~~~~~~~ error[E0170]: pattern binding `Foo` is named the same as one of the variants of the type `foo::Foo` --> $DIR/lint-uppercase-variables.rs:28:9 | LL | let Foo = foo::Foo::Foo; - | ^^^ help: to match on the variant, qualify the path: `foo::Foo::Foo` + | ^^^ + | +help: to match on the variant, qualify the path + | +LL | let foo::Foo::Foo = foo::Foo::Foo; + | ~~~~~~~~~~~~~ warning: unused variable: `Foo` --> $DIR/lint-uppercase-variables.rs:22:9 | LL | Foo => {} - | ^^^ help: if this is intentional, prefix it with an underscore: `_Foo` + | ^^^ | note: the lint level is defined here --> $DIR/lint-uppercase-variables.rs:1:9 @@ -24,66 +33,114 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | _Foo => {} + | ~~~~ warning: unused variable: `Foo` --> $DIR/lint-uppercase-variables.rs:28:9 | LL | let Foo = foo::Foo::Foo; - | ^^^ help: if this is intentional, prefix it with an underscore: `_Foo` + | ^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _Foo = foo::Foo::Foo; + | ~~~~ error[E0170]: pattern binding `Foo` is named the same as one of the variants of the type `foo::Foo` --> $DIR/lint-uppercase-variables.rs:33:17 | LL | fn in_param(Foo: foo::Foo) {} - | ^^^ help: to match on the variant, qualify the path: `foo::Foo::Foo` + | ^^^ + | +help: to match on the variant, qualify the path + | +LL | fn in_param(foo::Foo::Foo: foo::Foo) {} + | ~~~~~~~~~~~~~ warning: unused variable: `Foo` --> $DIR/lint-uppercase-variables.rs:33:17 | LL | fn in_param(Foo: foo::Foo) {} - | ^^^ help: if this is intentional, prefix it with an underscore: `_Foo` + | ^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | fn in_param(_Foo: foo::Foo) {} + | ~~~~ error: structure field `X` should have a snake case name --> $DIR/lint-uppercase-variables.rs:10:5 | LL | X: usize - | ^ help: convert the identifier to snake case (notice the capitalization): `x` + | ^ | note: the lint level is defined here --> $DIR/lint-uppercase-variables.rs:3:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | x: usize + | ~ error: variable `Xx` should have a snake case name --> $DIR/lint-uppercase-variables.rs:13:9 | LL | fn test(Xx: usize) { - | ^^ help: convert the identifier to snake case (notice the capitalization): `xx` + | ^^ + | +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | fn test(xx: usize) { + | ~~ error: variable `Test` should have a snake case name --> $DIR/lint-uppercase-variables.rs:18:9 | LL | let Test: usize = 0; - | ^^^^ help: convert the identifier to snake case: `test` + | ^^^^ + | +help: convert the identifier to snake case + | +LL | let test: usize = 0; + | ~~~~ error: variable `Foo` should have a snake case name --> $DIR/lint-uppercase-variables.rs:22:9 | LL | Foo => {} - | ^^^ help: convert the identifier to snake case (notice the capitalization): `foo` + | ^^^ + | +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | foo => {} + | ~~~ error: variable `Foo` should have a snake case name --> $DIR/lint-uppercase-variables.rs:28:9 | LL | let Foo = foo::Foo::Foo; - | ^^^ help: convert the identifier to snake case (notice the capitalization): `foo` + | ^^^ + | +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | let foo = foo::Foo::Foo; + | ~~~ error: variable `Foo` should have a snake case name --> $DIR/lint-uppercase-variables.rs:33:17 | LL | fn in_param(Foo: foo::Foo) {} - | ^^^ help: convert the identifier to snake case (notice the capitalization): `foo` + | ^^^ + | +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | fn in_param(foo: foo::Foo) {} + | ~~~ error: aborting due to 9 previous errors; 3 warnings emitted diff --git a/tests/ui/lint/non-snake-case/no-snake-case-warning-for-field-puns-issue-66362.stderr b/tests/ui/lint/non-snake-case/no-snake-case-warning-for-field-puns-issue-66362.stderr index cbbcf9909185a..6ddbbd79c36a1 100644 --- a/tests/ui/lint/non-snake-case/no-snake-case-warning-for-field-puns-issue-66362.stderr +++ b/tests/ui/lint/non-snake-case/no-snake-case-warning-for-field-puns-issue-66362.stderr @@ -2,31 +2,50 @@ error: structure field `lowerCamelCaseName` should have a snake case name --> $DIR/no-snake-case-warning-for-field-puns-issue-66362.rs:7:9 | LL | lowerCamelCaseName: bool, - | ^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `lower_camel_case_name` + | ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/no-snake-case-warning-for-field-puns-issue-66362.rs:1:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ +help: convert the identifier to snake case + | +LL | lower_camel_case_name: bool, + | ~~~~~~~~~~~~~~~~~~~~~ error: variable `lowerCamelCaseBinding` should have a snake case name --> $DIR/no-snake-case-warning-for-field-puns-issue-66362.rs:20:38 | LL | Foo::Good { snake_case_name: lowerCamelCaseBinding } => { } - | ^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `lower_camel_case_binding` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: convert the identifier to snake case + | +LL | Foo::Good { snake_case_name: lower_camel_case_binding } => { } + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: variable `anotherLowerCamelCaseBinding` should have a snake case name --> $DIR/no-snake-case-warning-for-field-puns-issue-66362.rs:24:41 | LL | if let Foo::Good { snake_case_name: anotherLowerCamelCaseBinding } = b { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `another_lower_camel_case_binding` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: convert the identifier to snake case + | +LL | if let Foo::Good { snake_case_name: another_lower_camel_case_binding } = b { } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: variable `yetAnotherLowerCamelCaseBinding` should have a snake case name --> $DIR/no-snake-case-warning-for-field-puns-issue-66362.rs:27:43 | LL | if let Foo::Bad { lowerCamelCaseName: yetAnotherLowerCamelCaseBinding } = b { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `yet_another_lower_camel_case_binding` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: convert the identifier to snake case + | +LL | if let Foo::Bad { lowerCamelCaseName: yet_another_lower_camel_case_binding } = b { } + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/lint/noop-method-call.stderr b/tests/ui/lint/noop-method-call.stderr index 8823644ac2d5f..e2f5fecafc46e 100644 --- a/tests/ui/lint/noop-method-call.stderr +++ b/tests/ui/lint/noop-method-call.stderr @@ -2,18 +2,28 @@ warning: call to `.clone()` on a reference in this situation does nothing --> $DIR/noop-method-call.rs:15:25 | LL | let _ = &mut encoded.clone(); - | ^^^^^^^^ help: remove this redundant call + | ^^^^^^^^ | = note: the type `[u8]` does not implement `Clone`, so calling `clone` on `&[u8]` copies the reference, which does not do anything and can be removed = note: `#[warn(noop_method_call)]` on by default +help: remove this redundant call + | +LL - let _ = &mut encoded.clone(); +LL + let _ = &mut encoded; + | warning: call to `.clone()` on a reference in this situation does nothing --> $DIR/noop-method-call.rs:17:21 | LL | let _ = &encoded.clone(); - | ^^^^^^^^ help: remove this redundant call + | ^^^^^^^^ | = note: the type `[u8]` does not implement `Clone`, so calling `clone` on `&[u8]` copies the reference, which does not do anything and can be removed +help: remove this redundant call + | +LL - let _ = &encoded.clone(); +LL + let _ = &encoded; + | warning: call to `.clone()` on a reference in this situation does nothing --> $DIR/noop-method-call.rs:23:71 diff --git a/tests/ui/lint/not_found.stderr b/tests/ui/lint/not_found.stderr index ea118c73ce784..f6b7066c093aa 100644 --- a/tests/ui/lint/not_found.stderr +++ b/tests/ui/lint/not_found.stderr @@ -10,13 +10,23 @@ warning: unknown lint: `DEAD_CODE` --> $DIR/not_found.rs:10:8 | LL | #[warn(DEAD_CODE)] - | ^^^^^^^^^ help: did you mean: `dead_code` + | ^^^^^^^^^ + | +help: did you mean + | +LL | #[warn(dead_code)] + | ~~~~~~~~~ warning: unknown lint: `Warnings` --> $DIR/not_found.rs:15:8 | LL | #[deny(Warnings)] - | ^^^^^^^^ help: did you mean (notice the capitalization): `warnings` + | ^^^^^^^^ + | +help: did you mean (notice the capitalization difference) + | +LL | #[deny(warnings)] + | ~~~~~~~~ warning: 3 warnings emitted diff --git a/tests/ui/lint/reasons.stderr b/tests/ui/lint/reasons.stderr index 8028785ab94be..6772a8886023e 100644 --- a/tests/ui/lint/reasons.stderr +++ b/tests/ui/lint/reasons.stderr @@ -21,7 +21,7 @@ warning: variable `Social_exchange_psychology` should have a snake case name --> $DIR/reasons.rs:29:9 | LL | let Social_exchange_psychology = CheaterDetectionMechanism {}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case (notice the capitalization): `social_exchange_psychology` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: people shouldn't have to change their usual style habits to contribute to our project @@ -31,6 +31,10 @@ note: the lint level is defined here LL | nonstandard_style, | ^^^^^^^^^^^^^^^^^ = note: `#[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]` +help: convert the identifier to snake case (notice the capitalization difference) + | +LL | let social_exchange_psychology = CheaterDetectionMechanism {}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 2 warnings emitted diff --git a/tests/ui/lint/recommend-literal.stderr b/tests/ui/lint/recommend-literal.stderr index 424ecadd4b8cc..f831f82aad71e 100644 --- a/tests/ui/lint/recommend-literal.stderr +++ b/tests/ui/lint/recommend-literal.stderr @@ -2,28 +2,34 @@ error[E0412]: cannot find type `double` in this scope --> $DIR/recommend-literal.rs:1:13 | LL | type Real = double; - | ^^^^^^ - | | - | not found in this scope - | help: perhaps you intended to use this type: `f64` + | ^^^^^^ not found in this scope + | +help: perhaps you intended to use this type + | +LL | type Real = f64; + | ~~~ error[E0412]: cannot find type `long` in this scope --> $DIR/recommend-literal.rs:7:12 | LL | let y: long = 74802374902374923; - | ^^^^ - | | - | not found in this scope - | help: perhaps you intended to use this type: `i64` + | ^^^^ not found in this scope + | +help: perhaps you intended to use this type + | +LL | let y: i64 = 74802374902374923; + | ~~~ error[E0412]: cannot find type `Boolean` in this scope --> $DIR/recommend-literal.rs:10:13 | LL | let v1: Boolean = true; - | ^^^^^^^ - | | - | not found in this scope - | help: perhaps you intended to use this type: `bool` + | ^^^^^^^ not found in this scope + | +help: perhaps you intended to use this type + | +LL | let v1: bool = true; + | ~~~~ error[E0412]: cannot find type `Bool` in this scope --> $DIR/recommend-literal.rs:13:13 @@ -44,28 +50,34 @@ error[E0412]: cannot find type `boolean` in this scope --> $DIR/recommend-literal.rs:19:9 | LL | fn z(a: boolean) { - | ^^^^^^^ - | | - | not found in this scope - | help: perhaps you intended to use this type: `bool` + | ^^^^^^^ not found in this scope + | +help: perhaps you intended to use this type + | +LL | fn z(a: bool) { + | ~~~~ error[E0412]: cannot find type `byte` in this scope --> $DIR/recommend-literal.rs:24:11 | LL | fn a() -> byte { - | ^^^^ - | | - | not found in this scope - | help: perhaps you intended to use this type: `u8` + | ^^^^ not found in this scope + | +help: perhaps you intended to use this type + | +LL | fn a() -> u8 { + | ~~ error[E0412]: cannot find type `float` in this scope --> $DIR/recommend-literal.rs:31:12 | LL | width: float, - | ^^^^^ - | | - | not found in this scope - | help: perhaps you intended to use this type: `f32` + | ^^^^^ not found in this scope + | +help: perhaps you intended to use this type + | +LL | width: f32, + | ~~~ error[E0412]: cannot find type `int` in this scope --> $DIR/recommend-literal.rs:34:19 @@ -86,10 +98,12 @@ error[E0412]: cannot find type `short` in this scope --> $DIR/recommend-literal.rs:40:16 | LL | impl Stuff for short {} - | ^^^^^ - | | - | not found in this scope - | help: perhaps you intended to use this type: `i16` + | ^^^^^ not found in this scope + | +help: perhaps you intended to use this type + | +LL | impl Stuff for i16 {} + | ~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/lint/redundant-semicolon/item-stmt-semi.stderr b/tests/ui/lint/redundant-semicolon/item-stmt-semi.stderr index 451b152cbe5a0..544bb7abef769 100644 --- a/tests/ui/lint/redundant-semicolon/item-stmt-semi.stderr +++ b/tests/ui/lint/redundant-semicolon/item-stmt-semi.stderr @@ -2,19 +2,30 @@ error: unnecessary trailing semicolon --> $DIR/item-stmt-semi.rs:4:18 | LL | fn inner() {}; - | ^ help: remove this semicolon + | ^ | note: the lint level is defined here --> $DIR/item-stmt-semi.rs:1:9 | LL | #![deny(redundant_semicolons)] | ^^^^^^^^^^^^^^^^^^^^ +help: remove this semicolon + | +LL - fn inner() {}; +LL + fn inner() {} + | error: unnecessary trailing semicolon --> $DIR/item-stmt-semi.rs:5:18 | LL | struct Bar {}; - | ^ help: remove this semicolon + | ^ + | +help: remove this semicolon + | +LL - struct Bar {}; +LL + struct Bar {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr b/tests/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr index d42aa1d613ffa..29d67f379f44f 100644 --- a/tests/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr +++ b/tests/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr @@ -3,19 +3,30 @@ error: unnecessary trailing semicolon --> $DIR/redundant-semi-proc-macro.rs:9:19 | LL | let tst = 123;; - | ^ help: remove this semicolon + | ^ | note: the lint level is defined here --> $DIR/redundant-semi-proc-macro.rs:3:9 | LL | #![deny(redundant_semicolons)] | ^^^^^^^^^^^^^^^^^^^^ +help: remove this semicolon + | +LL - let tst = 123;; +LL + let tst = 123; + | error: unnecessary trailing semicolons --> $DIR/redundant-semi-proc-macro.rs:16:7 | LL | };;; - | ^^ help: remove these semicolons + | ^^ + | +help: remove these semicolons + | +LL - };;; +LL + }; + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/renamed-lints-still-apply.stderr b/tests/ui/lint/renamed-lints-still-apply.stderr index 9eaf711293388..37b507be3a802 100644 --- a/tests/ui/lint/renamed-lints-still-apply.stderr +++ b/tests/ui/lint/renamed-lints-still-apply.stderr @@ -2,9 +2,13 @@ warning: lint `single_use_lifetime` has been renamed to `single_use_lifetimes` --> $DIR/renamed-lints-still-apply.rs:2:9 | LL | #![deny(single_use_lifetime)] - | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `single_use_lifetimes` + | ^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(renamed_and_removed_lints)]` on by default +help: use the new name + | +LL | #![deny(single_use_lifetimes)] + | ~~~~~~~~~~~~~~~~~~~~ error: lifetime parameter `'a` only used once --> $DIR/renamed-lints-still-apply.rs:6:9 diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr b/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr index 49dba1c7ffe8c..de32ffc2bb923 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr @@ -2,7 +2,7 @@ warning: unused variable: `x` --> $DIR/expect_lint_from_macro.rs:7:13 | LL | let x = 0; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ ... LL | trigger_unused_variables_macro!(); | --------------------------------- in this macro invocation @@ -13,17 +13,25 @@ note: the lint level is defined here LL | #![warn(unused_variables)] | ^^^^^^^^^^^^^^^^ = note: this warning originates in the macro `trigger_unused_variables_macro` (in Nightly builds, run with -Z macro-backtrace for more info) +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 0; + | ~~ warning: unused variable: `x` --> $DIR/expect_lint_from_macro.rs:7:13 | LL | let x = 0; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ ... LL | trigger_unused_variables_macro!(); | --------------------------------- in this macro invocation | = note: this warning originates in the macro `trigger_unused_variables_macro` (in Nightly builds, run with -Z macro-backtrace for more info) +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 0; + | ~~ warning: 2 warnings emitted diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr b/tests/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr index 02710d9f2af20..c060293a7c8c7 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr @@ -2,9 +2,7 @@ warning: variable does not need to be mutable --> $DIR/expect_nested_lint_levels.rs:35:13 | LL | let mut v = 0; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ | = note: this overrides the previous `expect` lint level and warns about the `unused_mut` lint here note: the lint level is defined here @@ -12,18 +10,27 @@ note: the lint level is defined here | LL | unused_mut, | ^^^^^^^^^^ +help: remove this `mut` + | +LL - let mut v = 0; +LL + let v = 0; + | error: unused variable: `this_is_my_function` --> $DIR/expect_nested_lint_levels.rs:47:9 | LL | let this_is_my_function = 3; - | ^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_this_is_my_function` + | ^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/expect_nested_lint_levels.rs:44:10 | LL | #[forbid(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | let _this_is_my_function = 3; + | ~~~~~~~~~~~~~~~~~~~~ warning: this lint expectation is unfulfilled --> $DIR/expect_nested_lint_levels.rs:6:5 diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr index e6d7896ddd402..d882d23d20e79 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr @@ -20,13 +20,17 @@ error: denote infinite loops with `loop { ... }` --> $DIR/expect_with_forbid.rs:20:5 | LL | while true {} - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/expect_with_forbid.rs:10:10 | LL | #[forbid(while_true)] | ^^^^^^^^^^ +help: use `loop` + | +LL | loop {} + | ~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr index 29e579464c8de..093110db0f9be 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr @@ -2,39 +2,60 @@ warning: unused variable: `x` --> $DIR/force_warn_expected_lints_fulfilled.rs:18:9 | LL | let x = 2; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | = note: requested on the command line with `--force-warn unused-variables` +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 2; + | ~~ warning: unused variable: `fox_name` --> $DIR/force_warn_expected_lints_fulfilled.rs:26:9 | LL | let fox_name = "Sir Nibbles"; - | ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_fox_name` + | ^^^^^^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _fox_name = "Sir Nibbles"; + | ~~~~~~~~~ warning: variable does not need to be mutable --> $DIR/force_warn_expected_lints_fulfilled.rs:30:9 | LL | let mut what_does_the_fox_say = "*ding* *deng* *dung*"; - | ----^^^^^^^^^^^^^^^^^^^^^ - | | - | help: remove this `mut` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: requested on the command line with `--force-warn unused-mut` +help: remove this `mut` + | +LL - let mut what_does_the_fox_say = "*ding* *deng* *dung*"; +LL + let what_does_the_fox_say = "*ding* *deng* *dung*"; + | warning: unused variable: `this_should_fulfill_the_expectation` --> $DIR/force_warn_expected_lints_fulfilled.rs:41:9 | LL | let this_should_fulfill_the_expectation = "The `#[allow]` has no power here"; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_this_should_fulfill_the_expectation` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _this_should_fulfill_the_expectation = "The `#[allow]` has no power here"; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: denote infinite loops with `loop { ... }` --> $DIR/force_warn_expected_lints_fulfilled.rs:8:5 | LL | while true { - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | = note: requested on the command line with `--force-warn while-true` +help: use `loop` + | +LL | loop { + | ~~~~ warning: 5 warnings emitted diff --git a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.stderr b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.stderr index f5e66694b8eaa..42c308aa2c0e1 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.stderr @@ -2,9 +2,13 @@ warning: unused variable: `this_should_not_fulfill_the_expectation` --> $DIR/force_warn_expected_lints_unfulfilled.rs:38:9 | LL | let this_should_not_fulfill_the_expectation = "maybe"; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_this_should_not_fulfill_the_expectation` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: requested on the command line with `--force-warn unused-variables` +help: if this is intentional, prefix it with an underscore + | +LL | let _this_should_not_fulfill_the_expectation = "maybe"; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: this lint expectation is unfulfilled --> $DIR/force_warn_expected_lints_unfulfilled.rs:7:14 diff --git a/tests/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr b/tests/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr index 7f01c2dc61beb..cdbc65885e4b8 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr @@ -2,7 +2,7 @@ error: unused attribute --> $DIR/lint-attribute-only-with-reason.rs:3:1 | LL | #[allow(reason = "I want to allow something")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: attribute `allow` without any lints has no effect note: the lint level is defined here @@ -10,38 +10,63 @@ note: the lint level is defined here | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[allow(reason = "I want to allow something")] +LL + + | error: unused attribute --> $DIR/lint-attribute-only-with-reason.rs:4:1 | LL | #[expect(reason = "I don't know what I'm waiting for")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: attribute `expect` without any lints has no effect +help: remove this attribute + | +LL - #[expect(reason = "I don't know what I'm waiting for")] +LL + + | error: unused attribute --> $DIR/lint-attribute-only-with-reason.rs:5:1 | LL | #[warn(reason = "This should be warn by default")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: attribute `warn` without any lints has no effect +help: remove this attribute + | +LL - #[warn(reason = "This should be warn by default")] +LL + + | error: unused attribute --> $DIR/lint-attribute-only-with-reason.rs:6:1 | LL | #[deny(reason = "All listed lints are denied")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: attribute `deny` without any lints has no effect +help: remove this attribute + | +LL - #[deny(reason = "All listed lints are denied")] +LL + + | error: unused attribute --> $DIR/lint-attribute-only-with-reason.rs:7:1 | LL | #[forbid(reason = "Just some reason")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: attribute `forbid` without any lints has no effect +help: remove this attribute + | +LL - #[forbid(reason = "Just some reason")] +LL + + | error: aborting due to 5 previous errors diff --git a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr index 000545a060075..e8a72c52b5e5f 100644 --- a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr +++ b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr @@ -31,9 +31,13 @@ warning: constant `µ` should have an upper case name --> $DIR/lint-uncommon-codepoints.rs:3:7 | LL | const µ: f64 = 0.000001; - | ^ help: convert the identifier to upper case: `Μ` + | ^ | = note: `#[warn(non_upper_case_globals)]` on by default +help: convert the identifier to upper case + | +LL | const Μ: f64 = 0.000001; + | ~ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/lint/suggestions.stderr b/tests/ui/lint/suggestions.stderr index a4871ead74b8b..e4701e1eb3377 100644 --- a/tests/ui/lint/suggestions.stderr +++ b/tests/ui/lint/suggestions.stderr @@ -2,9 +2,13 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/suggestions.rs:45:5 | LL | while true { - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | loop { + | ~~~~ warning: unnecessary parentheses around assigned value --> $DIR/suggestions.rs:48:31 @@ -27,87 +31,115 @@ warning: variable does not need to be mutable --> $DIR/suggestions.rs:48:13 | LL | let mut registry_no = (format!("NX-{}", 74205)); - | ----^^^^^^^^^^^ - | | - | help: remove this `mut` + | ^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/suggestions.rs:4:9 | LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 | ^^^^^^^^^^ +help: remove this `mut` + | +LL - let mut registry_no = (format!("NX-{}", 74205)); +LL + let registry_no = (format!("NX-{}", 74205)); + | warning: variable does not need to be mutable --> $DIR/suggestions.rs:54:13 | -LL | let mut - | _____________^ - | |_____________| -LL | || b = 1; - | ||____________-^ - | |_____________| - | help: remove this `mut` +LL | let mut + | _____________^ +LL | | b = 1; + | |_____________^ + | +help: remove this `mut` + | +LL - let mut +LL - b = 1; +LL + let b = 1; + | error: const items should never be `#[no_mangle]` --> $DIR/suggestions.rs:6:14 | LL | #[no_mangle] const DISCOVERY: usize = 1; - | -----^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: try a static value: `pub static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[deny(no_mangle_const_items)]` on by default +help: try a static value + | +LL | #[no_mangle] pub static DISCOVERY: usize = 1; + | ~~~~~~~~~~ warning: functions generic over types or consts must be mangled --> $DIR/suggestions.rs:12:1 | -LL | #[no_mangle] - | ------------ help: remove this attribute -LL | LL | pub fn defiant(_t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(no_mangle_generic_items)]` on by default +help: remove this attribute + | +LL - #[no_mangle] + | warning: the `warp_factor:` in this pattern is redundant --> $DIR/suggestions.rs:61:23 | LL | Equinox { warp_factor: warp_factor } => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use shorthand field pattern: `warp_factor` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(non_shorthand_field_patterns)]` on by default +help: use shorthand field pattern + | +LL | Equinox { warp_factor } => {} + | ~~~~~~~~~~~ error: const items should never be `#[no_mangle]` --> $DIR/suggestions.rs:22:18 | LL | #[no_mangle] pub const DAUNTLESS: bool = true; - | ---------^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: try a static value: `pub static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try a static value + | +LL | #[no_mangle] pub static DAUNTLESS: bool = true; + | ~~~~~~~~~~ warning: functions generic over types or consts must be mangled --> $DIR/suggestions.rs:26:18 | LL | #[no_mangle] pub fn val_jean() {} - | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] pub fn val_jean() {} +LL + pub fn val_jean() {} + | error: const items should never be `#[no_mangle]` --> $DIR/suggestions.rs:31:18 | LL | #[no_mangle] pub(crate) const VETAR: bool = true; - | ----------------^^^^^^^^^^^^^^^^^^^^ - | | - | help: try a static value: `pub static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try a static value + | +LL | #[no_mangle] pub static VETAR: bool = true; + | ~~~~~~~~~~ warning: functions generic over types or consts must be mangled --> $DIR/suggestions.rs:35:18 | LL | #[no_mangle] pub(crate) fn crossfield() {} - | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this attribute + | +LL - #[no_mangle] pub(crate) fn crossfield() {} +LL + pub(crate) fn crossfield() {} + | error: aborting due to 3 previous errors; 8 warnings emitted diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr index e7c90dcc81bb2..ef5e09705fb0b 100644 --- a/tests/ui/lint/type-overflow.stderr +++ b/tests/ui/lint/type-overflow.stderr @@ -48,9 +48,13 @@ warning: literal out of range for `u32` --> $DIR/type-overflow.rs:14:16 | LL | let fail = 0x1_FFFF_FFFFu32; - | ^^^^^^^^^^^^^^^^ help: consider using the type `u64` instead: `0x1_FFFF_FFFFu64` + | ^^^^^^^^^^^^^^^^ | = note: the literal `0x1_FFFF_FFFFu32` (decimal `8589934591`) does not fit into the type `u32` and will become `4294967295u32` +help: consider using the type `u64` instead + | +LL | let fail = 0x1_FFFF_FFFFu64; + | ~~~~~~~~~~~~~~~~ warning: literal out of range for `i128` --> $DIR/type-overflow.rs:16:22 @@ -82,10 +86,14 @@ warning: literal out of range for `i8` --> $DIR/type-overflow.rs:21:17 | LL | let fail = -0b1111_1111i8; - | ^^^^^^^^^^^^^ help: consider using the type `i16` instead: `0b1111_1111i16` + | ^^^^^^^^^^^^^ | = note: the literal `0b1111_1111i8` (decimal `255`) does not fit into the type `i8` = note: and the value `-0b1111_1111i8` will become `1i8` +help: consider using the type `i16` instead + | +LL | let fail = -0b1111_1111i16; + | ~~~~~~~~~~~~~~ warning: 7 warnings emitted diff --git a/tests/ui/lint/unnecessary-extern-crate.stderr b/tests/ui/lint/unnecessary-extern-crate.stderr index 1fa4aa9c9a9cf..1a2a7a55a9d53 100644 --- a/tests/ui/lint/unnecessary-extern-crate.stderr +++ b/tests/ui/lint/unnecessary-extern-crate.stderr @@ -2,43 +2,72 @@ error: unused extern crate --> $DIR/unnecessary-extern-crate.rs:6:1 | LL | extern crate core; - | ^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/unnecessary-extern-crate.rs:3:9 | LL | #![deny(unused_extern_crates)] | ^^^^^^^^^^^^^^^^^^^^ +help: remove it + | +LL - extern crate core; + | error: unused extern crate --> $DIR/unnecessary-extern-crate.rs:9:1 | LL | extern crate core as x; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove it + | +LL - extern crate core as x; + | error: unused extern crate --> $DIR/unnecessary-extern-crate.rs:31:5 | LL | extern crate core; - | ^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^ + | +help: remove it + | +LL - extern crate core; + | error: unused extern crate --> $DIR/unnecessary-extern-crate.rs:35:5 | LL | extern crate core as x; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove it + | +LL - extern crate core as x; + | error: unused extern crate --> $DIR/unnecessary-extern-crate.rs:44:9 | LL | extern crate core; - | ^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^ + | +help: remove it + | +LL - extern crate core; + | error: unused extern crate --> $DIR/unnecessary-extern-crate.rs:48:9 | LL | extern crate core as x; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove it + | +LL - extern crate core as x; + | error: aborting due to 6 previous errors diff --git a/tests/ui/lint/unreachable_pub.stderr b/tests/ui/lint/unreachable_pub.stderr index 705a537a3f1c4..3fc39d40bf2c7 100644 --- a/tests/ui/lint/unreachable_pub.stderr +++ b/tests/ui/lint/unreachable_pub.stderr @@ -2,9 +2,7 @@ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:8:13 | LL | pub use std::fmt; - | --- ^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^ | = help: or consider exporting it for use by other crates note: the lint level is defined here @@ -12,104 +10,129 @@ note: the lint level is defined here | LL | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ +help: consider restricting its visibility + | +LL | pub(crate) use std::fmt; + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:9:24 | LL | pub use std::env::{Args}; // braced-use has different item spans than unbraced - | --- ^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) use std::env::{Args}; // braced-use has different item spans than unbraced + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:13:5 | LL | pub struct Hydrogen { - | ---^^^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) struct Hydrogen { + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:24:9 | LL | pub fn count_neutrons(&self) -> usize { self.neutrons } - | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider restricting its visibility + | +LL | pub(crate) fn count_neutrons(&self) -> usize { self.neutrons } + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:33:5 | LL | pub enum Helium {} - | ---^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) enum Helium {} + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:34:5 | LL | pub union Lithium { c1: usize, c2: u8 } - | ---^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) union Lithium { c1: usize, c2: u8 } + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:35:5 | LL | pub fn beryllium() {} - | ---^^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) fn beryllium() {} + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:36:5 | LL | pub trait Boron {} - | ---^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) trait Boron {} + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:37:5 | LL | pub const CARBON: usize = 1; - | ---^^^^^^^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) const CARBON: usize = 1; + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:38:5 | LL | pub static NITROGEN: usize = 2; - | ---^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) static NITROGEN: usize = 2; + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:39:5 | LL | pub type Oxygen = bool; - | ---^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) type Oxygen = bool; + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:42:47 @@ -118,23 +141,26 @@ LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | define_empty_struct_with_visibility!(pub, Fluorine); - | --------------------------------------------------- - | | | - | | help: consider restricting its visibility: `pub(crate)` - | in this macro invocation + | --------------------------------------------------- in this macro invocation | = help: or consider exporting it for use by other crates = note: this warning originates in the macro `define_empty_struct_with_visibility` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider restricting its visibility + | +LL | define_empty_struct_with_visibility!(pub(crate), Fluorine); + | ~~~~~~~~~~ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:48:9 | LL | pub fn catalyze() -> bool; - | ---^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: or consider exporting it for use by other crates +help: consider restricting its visibility + | +LL | pub(crate) fn catalyze() -> bool; + | ~~~~~~~~~~ warning: 13 warnings emitted diff --git a/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr index 84efaa4f3687b..1bce441a37024 100644 --- a/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr +++ b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr @@ -23,7 +23,12 @@ error: unused variable: `a` --> $DIR/issue-117284-arg-in-macro.rs:16:9 | LL | let a = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _a = 1; + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lint/unused/issue-119383-if-let-guard.stderr b/tests/ui/lint/unused/issue-119383-if-let-guard.stderr index 5bf48bb80a8f6..0aa1b3e34a9cd 100644 --- a/tests/ui/lint/unused/issue-119383-if-let-guard.stderr +++ b/tests/ui/lint/unused/issue-119383-if-let-guard.stderr @@ -2,13 +2,17 @@ error: unused variable: `b` --> $DIR/issue-119383-if-let-guard.rs:6:24 | LL | () if let Some(b) = Some(()) => {} - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ | note: the lint level is defined here --> $DIR/issue-119383-if-let-guard.rs:2:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | () if let Some(_b) = Some(()) => {} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr b/tests/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr index fe2e3afc82ec8..bb121ec631ee8 100644 --- a/tests/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr +++ b/tests/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr @@ -2,7 +2,7 @@ warning: unused variable: `i_think_continually` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:26:9 | LL | let i_think_continually = 2; - | ^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_i_think_continually` + | ^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9 @@ -10,30 +10,54 @@ note: the lint level is defined here LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _i_think_continually = 2; + | ~~~~~~~~~~~~~~~~~~~~ warning: unused variable: `mut_unused_var` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:33:13 | LL | let mut mut_unused_var = 1; - | ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_mut_unused_var` + | ^^^^^^^^^^^^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let mut _mut_unused_var = 1; + | ~~~~~~~~~~~~~~~ warning: unused variable: `var` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:14 | LL | let (mut var, unused_var) = (1, 2); - | ^^^ help: if this is intentional, prefix it with an underscore: `_var` + | ^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let (mut _var, unused_var) = (1, 2); + | ~~~~ warning: unused variable: `unused_var` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:19 | LL | let (mut var, unused_var) = (1, 2); - | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused_var` + | ^^^^^^^^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let (mut var, _unused_var) = (1, 2); + | ~~~~~~~~~~~ warning: unused variable: `corridors_of_light` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:45:26 | LL | if let SoulHistory { corridors_of_light, - | ^^^^^^^^^^^^^^^^^^ help: try ignoring the field: `corridors_of_light: _` + | ^^^^^^^^^^^^^^^^^^ + | +help: try ignoring the field + | +LL | if let SoulHistory { corridors_of_light: _, + | ~~~~~~~~~~~~~~~~~~~~~ warning: variable `hours_are_suns` is assigned to, but never used --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:46:30 @@ -56,61 +80,103 @@ warning: unused variable: `fire` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:52:32 | LL | let LovelyAmbition { lips, fire } = the_spirit; - | ^^^^ help: try ignoring the field: `fire: _` + | ^^^^ + | +help: try ignoring the field + | +LL | let LovelyAmbition { lips, fire: _ } = the_spirit; + | ~~~~~~~ warning: unused variable: `case` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:61:23 | LL | Large::Suit { case } => {} - | ^^^^ help: try ignoring the field: `case: _` + | ^^^^ + | +help: try ignoring the field + | +LL | Large::Suit { case: _ } => {} + | ~~~~~~~ warning: unused variable: `case` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:66:24 | LL | &Large::Suit { case } => {} - | ^^^^ help: try ignoring the field: `case: _` + | ^^^^ + | +help: try ignoring the field + | +LL | &Large::Suit { case: _ } => {} + | ~~~~~~~ warning: unused variable: `case` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:71:27 | LL | box Large::Suit { case } => {} - | ^^^^ help: try ignoring the field: `case: _` + | ^^^^ + | +help: try ignoring the field + | +LL | box Large::Suit { case: _ } => {} + | ~~~~~~~ warning: unused variable: `case` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:76:24 | LL | (Large::Suit { case },) => {} - | ^^^^ help: try ignoring the field: `case: _` + | ^^^^ + | +help: try ignoring the field + | +LL | (Large::Suit { case: _ },) => {} + | ~~~~~~~ warning: unused variable: `case` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:81:24 | LL | [Large::Suit { case }] => {} - | ^^^^ help: try ignoring the field: `case: _` + | ^^^^ + | +help: try ignoring the field + | +LL | [Large::Suit { case: _ }] => {} + | ~~~~~~~ warning: unused variable: `case` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:86:29 | LL | Tuple(Large::Suit { case }, ()) => {} - | ^^^^ help: try ignoring the field: `case: _` + | ^^^^ + | +help: try ignoring the field + | +LL | Tuple(Large::Suit { case: _ }, ()) => {} + | ~~~~~~~ warning: variable does not need to be mutable --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:33:9 | LL | let mut mut_unused_var = 1; - | ----^^^^^^^^^^^^^^ - | | - | help: remove this `mut` + | ^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_mut)]` implied by `#[warn(unused)]` +help: remove this `mut` + | +LL - let mut mut_unused_var = 1; +LL + let mut_unused_var = 1; + | warning: variable does not need to be mutable --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:10 | LL | let (mut var, unused_var) = (1, 2); - | ----^^^ - | | - | help: remove this `mut` + | ^^^^^^^ + | +help: remove this `mut` + | +LL - let (mut var, unused_var) = (1, 2); +LL + let (var, unused_var) = (1, 2); + | warning: 16 warnings emitted diff --git a/tests/ui/lint/unused/issue-54180-unused-ref-field.stderr b/tests/ui/lint/unused/issue-54180-unused-ref-field.stderr index f2e6168998c44..a89579d391214 100644 --- a/tests/ui/lint/unused/issue-54180-unused-ref-field.stderr +++ b/tests/ui/lint/unused/issue-54180-unused-ref-field.stderr @@ -2,7 +2,7 @@ error: unused variable: `field` --> $DIR/issue-54180-unused-ref-field.rs:20:22 | LL | E::Variant { ref field } => (), - | ^^^^^^^^^ help: try ignoring the field: `field: _` + | ^^^^^^^^^ | note: the lint level is defined here --> $DIR/issue-54180-unused-ref-field.rs:3:9 @@ -10,24 +10,43 @@ note: the lint level is defined here LL | #![deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` +help: try ignoring the field + | +LL | E::Variant { field: _ } => (), + | ~~~~~~~~ error: unused variable: `f1` --> $DIR/issue-54180-unused-ref-field.rs:26:13 | LL | let S { ref f1 } = s; - | ^^^^^^ help: try ignoring the field: `f1: _` + | ^^^^^^ + | +help: try ignoring the field + | +LL | let S { f1: _ } = s; + | ~~~~~ error: unused variable: `x` --> $DIR/issue-54180-unused-ref-field.rs:32:20 | LL | Point { y, ref mut x } => y, - | ^^^^^^^^^ help: try ignoring the field: `x: _` + | ^^^^^^^^^ + | +help: try ignoring the field + | +LL | Point { y, x: _ } => y, + | ~~~~ error: unused variable: `x` --> $DIR/issue-54180-unused-ref-field.rs:29:45 | LL | let _: i32 = points.iter().map(|Point { x, y }| y).sum(); - | ^ help: try ignoring the field: `x: _` + | ^ + | +help: try ignoring the field + | +LL | let _: i32 = points.iter().map(|Point { x: _, y }| y).sum(); + | ~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/lint/unused/issue-81314-unused-span-ident.stderr b/tests/ui/lint/unused/issue-81314-unused-span-ident.stderr index 519c71e941311..e246d759b6ebf 100644 --- a/tests/ui/lint/unused/issue-81314-unused-span-ident.stderr +++ b/tests/ui/lint/unused/issue-81314-unused-span-ident.stderr @@ -2,7 +2,7 @@ error: unused variable: `rest` --> $DIR/issue-81314-unused-span-ident.rs:8:10 | LL | let [rest @ ..] = [1, 2, 3]; - | ^^^^ help: if this is intentional, prefix it with an underscore: `_rest` + | ^^^^ | note: the lint level is defined here --> $DIR/issue-81314-unused-span-ident.rs:5:9 @@ -10,12 +10,21 @@ note: the lint level is defined here LL | #![deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let [_rest @ ..] = [1, 2, 3]; + | ~~~~~ error: unused variable: `rest` --> $DIR/issue-81314-unused-span-ident.rs:11:13 | LL | pub fn foo([rest @ ..]: &[i32]) { - | ^^^^ help: if this is intentional, prefix it with an underscore: `_rest` + | ^^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | pub fn foo([_rest @ ..]: &[i32]) { + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lint/unused/lint-unused-extern-crate.stderr b/tests/ui/lint/unused/lint-unused-extern-crate.stderr index 46d8f3beeab42..0dee259126aba 100644 --- a/tests/ui/lint/unused/lint-unused-extern-crate.stderr +++ b/tests/ui/lint/unused/lint-unused-extern-crate.stderr @@ -2,19 +2,30 @@ error: unused extern crate --> $DIR/lint-unused-extern-crate.rs:11:1 | LL | extern crate lint_unused_extern_crate5; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-unused-extern-crate.rs:7:9 | LL | #![deny(unused_extern_crates)] | ^^^^^^^^^^^^^^^^^^^^ +help: remove it + | +LL - extern crate lint_unused_extern_crate5; +LL + + | error: unused extern crate --> $DIR/lint-unused-extern-crate.rs:29:5 | LL | extern crate lint_unused_extern_crate2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove it + | +LL - extern crate lint_unused_extern_crate2; +LL + + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/unused/lint-unused-mut-self.stderr b/tests/ui/lint/unused/lint-unused-mut-self.stderr index 01a524bd323c4..01bfd2582d319 100644 --- a/tests/ui/lint/unused/lint-unused-mut-self.stderr +++ b/tests/ui/lint/unused/lint-unused-mut-self.stderr @@ -2,23 +2,30 @@ error: variable does not need to be mutable --> $DIR/lint-unused-mut-self.rs:10:12 | LL | fn foo(mut self) {} - | ----^^^^ - | | - | help: remove this `mut` + | ^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-unused-mut-self.rs:6:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ +help: remove this `mut` + | +LL - fn foo(mut self) {} +LL + fn foo(self) {} + | error: variable does not need to be mutable --> $DIR/lint-unused-mut-self.rs:11:12 | LL | fn bar(mut self: Box) {} - | ----^^^^ - | | - | help: remove this `mut` + | ^^^^^^^^ + | +help: remove this `mut` + | +LL - fn bar(mut self: Box) {} +LL + fn bar(self: Box) {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/unused/lint-unused-mut-variables.stderr b/tests/ui/lint/unused/lint-unused-mut-variables.stderr index dcda1e5306f9e..0f787dcb09779 100644 --- a/tests/ui/lint/unused/lint-unused-mut-variables.stderr +++ b/tests/ui/lint/unused/lint-unused-mut-variables.stderr @@ -2,229 +2,335 @@ warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:9:5 | LL | mut a: i32, - | ----^ - | | - | help: remove this `mut` + | ^^^^^ | note: the lint level is defined here --> $DIR/lint-unused-mut-variables.rs:5:9 | LL | #![warn(unused_mut)] | ^^^^^^^^^^ +help: remove this `mut` + | +LL - mut a: i32, +LL + a: i32, + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:23:9 | LL | mut a: i32, - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - mut a: i32, +LL + a: i32, + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:14:5 | LL | mut a: i32, - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - mut a: i32, +LL + a: i32, + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:29:9 | LL | mut a: i32, - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - mut a: i32, +LL + a: i32, + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:39:9 | LL | mut a: i32, - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - mut a: i32, +LL + a: i32, + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:48:9 | LL | mut a: i32, - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - mut a: i32, +LL + a: i32, + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:57:9 | LL | mut a: i32, - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - mut a: i32, +LL + a: i32, + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:62:9 | LL | mut a: i32, - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - mut a: i32, +LL + a: i32, + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:107:14 | LL | let x = |mut y: isize| 10; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let x = |mut y: isize| 10; +LL + let x = |y: isize| 10; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:69:9 | LL | let mut a = 3; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut a = 3; +LL + let a = 3; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:71:9 | LL | let mut a = 2; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut a = 2; +LL + let a = 2; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:73:9 | LL | let mut b = 3; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut b = 3; +LL + let b = 3; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:75:9 | LL | let mut a = vec![3]; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut a = vec![3]; +LL + let a = vec![3]; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:77:10 | LL | let (mut a, b) = (1, 2); - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let (mut a, b) = (1, 2); +LL + let (a, b) = (1, 2); + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:79:9 | LL | let mut a; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut a; +LL + let a; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:83:9 | LL | let mut b; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut b; +LL + let b; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:92:9 | LL | mut x => {} - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - mut x => {} +LL + x => {} + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:99:10 | LL | (mut x, 1) | - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - (mut x, 1) | +LL + (x, 1) | + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:112:9 | LL | let mut a = &mut 5; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut a = &mut 5; +LL + let a = &mut 5; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:117:9 | LL | let mut b = (&mut a,); - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut b = (&mut a,); +LL + let b = (&mut a,); + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:120:9 | LL | let mut x = &mut 1; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut x = &mut 1; +LL + let x = &mut 1; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:132:9 | LL | let mut v : &mut Vec<()> = &mut vec![]; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - let mut v : &mut Vec<()> = &mut vec![]; +LL + let v : &mut Vec<()> = &mut vec![]; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:187:9 | LL | let mut raw_address_of_const = 1; - | ----^^^^^^^^^^^^^^^^^^^^ - | | - | help: remove this `mut` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove this `mut` + | +LL - let mut raw_address_of_const = 1; +LL + let raw_address_of_const = 1; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:109:13 | LL | fn what(mut foo: isize) {} - | ----^^^ - | | - | help: remove this `mut` + | ^^^^^^^ + | +help: remove this `mut` + | +LL - fn what(mut foo: isize) {} +LL + fn what(foo: isize) {} + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:127:20 | LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { - | ----^^^ - | | - | help: remove this `mut` + | ^^^^^^^ + | +help: remove this `mut` + | +LL - fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { +LL + fn mut_ref_arg(arg : &mut [u8]) -> &mut [u8] { + | error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:205:9 | LL | let mut b = vec![2]; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ | note: the lint level is defined here --> $DIR/lint-unused-mut-variables.rs:201:8 | LL | #[deny(unused_mut)] | ^^^^^^^^^^ +help: remove this `mut` + | +LL - let mut b = vec![2]; +LL + let b = vec![2]; + | warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:212:28 | LL | fn write_through_reference(mut arg: &mut Arg) { - | ----^^^ - | | - | help: remove this `mut` + | ^^^^^^^ + | +help: remove this `mut` + | +LL - fn write_through_reference(mut arg: &mut Arg) { +LL + fn write_through_reference(arg: &mut Arg) { + | error: aborting due to 1 previous error; 26 warnings emitted diff --git a/tests/ui/lint/unused/lint-unused-variables.stderr b/tests/ui/lint/unused/lint-unused-variables.stderr index 09729eeba7923..34c3503eee343 100644 --- a/tests/ui/lint/unused/lint-unused-variables.stderr +++ b/tests/ui/lint/unused/lint-unused-variables.stderr @@ -2,73 +2,127 @@ error: unused variable: `a` --> $DIR/lint-unused-variables.rs:8:5 | LL | a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: the lint level is defined here --> $DIR/lint-unused-variables.rs:5:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | _a: i32, + | ~~ error: unused variable: `a` --> $DIR/lint-unused-variables.rs:22:9 | LL | a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _a: i32, + | ~~ error: unused variable: `b` --> $DIR/lint-unused-variables.rs:14:5 | LL | b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _b: i32, + | ~~ error: unused variable: `b` --> $DIR/lint-unused-variables.rs:29:9 | LL | b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _b: i32, + | ~~ error: unused variable: `b` --> $DIR/lint-unused-variables.rs:34:9 | LL | b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _b: i32, + | ~~ error: unused variable: `b` --> $DIR/lint-unused-variables.rs:42:9 | LL | b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _b: i32, + | ~~ error: unused variable: `b` --> $DIR/lint-unused-variables.rs:47:9 | LL | b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _b: i32, + | ~~ error: unused variable: `b` --> $DIR/lint-unused-variables.rs:55:9 | LL | b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _b: i32, + | ~~ error: unused variable: `b` --> $DIR/lint-unused-variables.rs:60:9 | LL | b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _b: i32, + | ~~ error: unused variable: `a` --> $DIR/lint-unused-variables.rs:68:9 | LL | a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _a: i32, + | ~~ error: unused variable: `b` --> $DIR/lint-unused-variables.rs:74:9 | LL | b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | _b: i32, + | ~~ error: aborting due to 11 previous errors diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr index 769b174874b96..c14546fe2774e 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr @@ -2,7 +2,7 @@ error: unused attribute --> $DIR/unused-attr-duplicate.rs:33:1 | LL | #[no_link] - | ^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:32:1 @@ -14,24 +14,34 @@ note: the lint level is defined here | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[no_link] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:37:1 | LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:36:1 | LL | #[macro_use] | ^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[macro_use] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:47:1 | LL | #[path = "bar.rs"] - | ^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:46:1 @@ -39,24 +49,34 @@ note: attribute also specified here LL | #[path = "auxiliary/lint_unused_extern_crate.rs"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #[path = "bar.rs"] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:53:1 | LL | #[ignore = "some text"] - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:52:1 | LL | #[ignore] | ^^^^^^^^^ +help: remove this attribute + | +LL - #[ignore = "some text"] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:55:1 | LL | #[should_panic(expected = "values don't match")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:54:1 @@ -64,12 +84,17 @@ note: attribute also specified here LL | #[should_panic] | ^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #[should_panic(expected = "values don't match")] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:60:1 | LL | #[must_use = "some message"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:59:1 @@ -77,36 +102,51 @@ note: attribute also specified here LL | #[must_use] | ^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #[must_use = "some message"] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:66:1 | LL | #[non_exhaustive] - | ^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:65:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[non_exhaustive] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:70:1 | LL | #[automatically_derived] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:69:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[automatically_derived] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:74:1 | LL | #[inline(never)] - | ^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:73:1 @@ -114,36 +154,51 @@ note: attribute also specified here LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #[inline(never)] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:77:1 | LL | #[cold] - | ^^^^^^^ help: remove this attribute + | ^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:76:1 | LL | #[cold] | ^^^^^^^ +help: remove this attribute + | +LL - #[cold] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:79:1 | LL | #[track_caller] - | ^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:78:1 | LL | #[track_caller] | ^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[track_caller] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:92:1 | LL | #[export_name = "exported_symbol_name"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:94:1 @@ -151,36 +206,51 @@ note: attribute also specified here LL | #[export_name = "exported_symbol_name2"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #[export_name = "exported_symbol_name"] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:98:1 | LL | #[no_mangle] - | ^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:97:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[no_mangle] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:102:1 | LL | #[used] - | ^^^^^^^ help: remove this attribute + | ^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:101:1 | LL | #[used] | ^^^^^^^ +help: remove this attribute + | +LL - #[used] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:86:5 | LL | #[link_name = "this_does_not_exist"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:88:5 @@ -188,12 +258,17 @@ note: attribute also specified here LL | #[link_name = "rust_dbg_extern_identity_u32"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #[link_name = "this_does_not_exist"] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:14:1 | LL | #![crate_name = "unused_attr_duplicate2"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:13:1 @@ -201,12 +276,17 @@ note: attribute also specified here LL | #![crate_name = "unused_attr_duplicate"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #![crate_name = "unused_attr_duplicate2"] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:17:1 | LL | #![recursion_limit = "256"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:16:1 @@ -214,12 +294,17 @@ note: attribute also specified here LL | #![recursion_limit = "128"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #![recursion_limit = "256"] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:20:1 | LL | #![type_length_limit = "1"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:19:1 @@ -227,36 +312,51 @@ note: attribute also specified here LL | #![type_length_limit = "1048576"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #![type_length_limit = "1"] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:23:1 | LL | #![no_std] - | ^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:22:1 | LL | #![no_std] | ^^^^^^^^^^ +help: remove this attribute + | +LL - #![no_std] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:25:1 | LL | #![no_implicit_prelude] - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:24:1 | LL | #![no_implicit_prelude] | ^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #![no_implicit_prelude] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:27:1 | LL | #![windows_subsystem = "windows"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:26:1 @@ -264,30 +364,45 @@ note: attribute also specified here LL | #![windows_subsystem = "console"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: remove this attribute + | +LL - #![windows_subsystem = "windows"] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:30:1 | LL | #![no_builtins] - | ^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:29:1 | LL | #![no_builtins] | ^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #![no_builtins] +LL + + | error: unused attribute --> $DIR/unused-attr-duplicate.rs:40:5 | LL | #[macro_export] - | ^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:39:5 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[macro_export] +LL + + | error: aborting due to 23 previous errors diff --git a/tests/ui/lint/unused/unused-mut-warning-captured-var.stderr b/tests/ui/lint/unused/unused-mut-warning-captured-var.stderr index d4fa96c10a284..bf3547eef95d2 100644 --- a/tests/ui/lint/unused/unused-mut-warning-captured-var.stderr +++ b/tests/ui/lint/unused/unused-mut-warning-captured-var.stderr @@ -2,15 +2,18 @@ error: variable does not need to be mutable --> $DIR/unused-mut-warning-captured-var.rs:6:9 | LL | let mut x = 1; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ | note: the lint level is defined here --> $DIR/unused-mut-warning-captured-var.rs:3:11 | LL | #![forbid(unused_mut)] | ^^^^^^^^^^ +help: remove this `mut` + | +LL - let mut x = 1; +LL + let x = 1; + | error: aborting due to 1 previous error diff --git a/tests/ui/lint/unused_variables-issue-82488.stderr b/tests/ui/lint/unused_variables-issue-82488.stderr index 3babc94b4eb64..862f7dd342024 100644 --- a/tests/ui/lint/unused_variables-issue-82488.stderr +++ b/tests/ui/lint/unused_variables-issue-82488.stderr @@ -2,13 +2,17 @@ error: unused variable: `renamed` --> $DIR/unused_variables-issue-82488.rs:9:32 | LL | fn process_point(Point { x, y: renamed }: Point) { - | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_renamed` + | ^^^^^^^ | note: the lint level is defined here --> $DIR/unused_variables-issue-82488.rs:2:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | fn process_point(Point { x, y: _renamed }: Point) { + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/lint/warn-path-statement.stderr b/tests/ui/lint/warn-path-statement.stderr index 248d2ef299be3..e92ecca3e8ae7 100644 --- a/tests/ui/lint/warn-path-statement.stderr +++ b/tests/ui/lint/warn-path-statement.stderr @@ -10,13 +10,23 @@ error: path statement drops value --> $DIR/warn-path-statement.rs:13:5 | LL | y; - | ^^ help: use `drop` to clarify the intent: `drop(y);` + | ^^ + | +help: use `drop` to clarify the intent + | +LL | drop(y); + | ~~~~~~~~ error: path statement drops value --> $DIR/warn-path-statement.rs:16:5 | LL | z; - | ^^ help: use `drop` to clarify the intent: `drop(z);` + | ^^ + | +help: use `drop` to clarify the intent + | +LL | drop(z); + | ~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/liveness/liveness-consts.stderr b/tests/ui/liveness/liveness-consts.stderr index 34ce39473379e..c7ca837144e2d 100644 --- a/tests/ui/liveness/liveness-consts.stderr +++ b/tests/ui/liveness/liveness-consts.stderr @@ -2,7 +2,7 @@ warning: unused variable: `e` --> $DIR/liveness-consts.rs:24:13 | LL | let e = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_e` + | ^ | note: the lint level is defined here --> $DIR/liveness-consts.rs:2:9 @@ -10,18 +10,32 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _e = 1; + | ~~ warning: unused variable: `s` --> $DIR/liveness-consts.rs:33:24 | LL | pub fn f(x: [u8; { let s = 17; 100 }]) -> [u8; { let z = 18; 100 }] { - | ^ help: if this is intentional, prefix it with an underscore: `_s` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | pub fn f(x: [u8; { let _s = 17; 100 }]) -> [u8; { let z = 18; 100 }] { + | ~~ warning: unused variable: `z` --> $DIR/liveness-consts.rs:33:55 | LL | pub fn f(x: [u8; { let s = 17; 100 }]) -> [u8; { let z = 18; 100 }] { - | ^ help: if this is intentional, prefix it with an underscore: `_z` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | pub fn f(x: [u8; { let s = 17; 100 }]) -> [u8; { let _z = 18; 100 }] { + | ~~ warning: variable `a` is assigned to, but never used --> $DIR/liveness-consts.rs:7:13 @@ -44,7 +58,12 @@ warning: unused variable: `z` --> $DIR/liveness-consts.rs:60:13 | LL | let z = 42; - | ^ help: if this is intentional, prefix it with an underscore: `_z` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _z = 42; + | ~~ warning: value assigned to `t` is never read --> $DIR/liveness-consts.rs:42:9 @@ -58,7 +77,12 @@ warning: unused variable: `w` --> $DIR/liveness-consts.rs:49:13 | LL | let w = 10; - | ^ help: if this is intentional, prefix it with an underscore: `_w` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _w = 10; + | ~~ warning: 8 warnings emitted diff --git a/tests/ui/liveness/liveness-derive.stderr b/tests/ui/liveness/liveness-derive.stderr index c03d90991834c..76c95c946696a 100644 --- a/tests/ui/liveness/liveness-derive.stderr +++ b/tests/ui/liveness/liveness-derive.stderr @@ -2,7 +2,7 @@ warning: unused variable: `a` --> $DIR/liveness-derive.rs:15:13 | LL | let a = 0; - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: the lint level is defined here --> $DIR/liveness-derive.rs:6:9 @@ -10,12 +10,21 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _a = 0; + | ~~ warning: unused variable: `b` --> $DIR/liveness-derive.rs:20:13 | LL | let b = 16; - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _b = 16; + | ~~ warning: 2 warnings emitted diff --git a/tests/ui/liveness/liveness-move-in-while.stderr b/tests/ui/liveness/liveness-move-in-while.stderr index dc48c4cc9acfc..e8897626eee6c 100644 --- a/tests/ui/liveness/liveness-move-in-while.stderr +++ b/tests/ui/liveness/liveness-move-in-while.stderr @@ -2,21 +2,35 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/liveness-move-in-while.rs:8:9 | LL | while true { while true { while true { x = y; x.clone(); } } } - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | loop { while true { while true { x = y; x.clone(); } } } + | ~~~~ warning: denote infinite loops with `loop { ... }` --> $DIR/liveness-move-in-while.rs:8:22 | LL | while true { while true { while true { x = y; x.clone(); } } } - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ + | +help: use `loop` + | +LL | while true { loop { while true { x = y; x.clone(); } } } + | ~~~~ warning: denote infinite loops with `loop { ... }` --> $DIR/liveness-move-in-while.rs:8:35 | LL | while true { while true { while true { x = y; x.clone(); } } } - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ + | +help: use `loop` + | +LL | while true { while true { loop { x = y; x.clone(); } } } + | ~~~~ error[E0382]: borrow of moved value: `y` --> $DIR/liveness-move-in-while.rs:7:24 diff --git a/tests/ui/liveness/liveness-return-last-stmt-semi.stderr b/tests/ui/liveness/liveness-return-last-stmt-semi.stderr index de0843aa637f3..0e3b8050154d2 100644 --- a/tests/ui/liveness/liveness-return-last-stmt-semi.stderr +++ b/tests/ui/liveness/liveness-return-last-stmt-semi.stderr @@ -13,8 +13,12 @@ LL | fn bar(x: u32) -> u32 { | --- ^^^ expected `u32`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -LL | x * 2; - | - help: remove this semicolon to return this value + | +help: remove this semicolon to return this value + | +LL - x * 2; +LL + x * 2 + | error[E0308]: mismatched types --> $DIR/liveness-return-last-stmt-semi.rs:12:19 diff --git a/tests/ui/liveness/liveness-unused.stderr b/tests/ui/liveness/liveness-unused.stderr index f6c478ddbc72c..a58b4dc5f1c1c 100644 --- a/tests/ui/liveness/liveness-unused.stderr +++ b/tests/ui/liveness/liveness-unused.stderr @@ -17,31 +17,50 @@ error: unused variable: `x` --> $DIR/liveness-unused.rs:8:7 | LL | fn f1(x: isize) { - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | note: the lint level is defined here --> $DIR/liveness-unused.rs:2:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | fn f1(_x: isize) { + | ~~ error: unused variable: `x` --> $DIR/liveness-unused.rs:12:8 | LL | fn f1b(x: &mut isize) { - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | fn f1b(_x: &mut isize) { + | ~~ error: unused variable: `x` --> $DIR/liveness-unused.rs:20:9 | LL | let x: isize; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _x: isize; + | ~~ error: unused variable: `x` --> $DIR/liveness-unused.rs:25:9 | LL | let x = 3; - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | let _x = 3; + | ~~ error: variable `x` is assigned to, but never used --> $DIR/liveness-unused.rs:30:13 @@ -76,25 +95,45 @@ error: unused variable: `i` --> $DIR/liveness-unused.rs:59:12 | LL | Some(i) => { - | ^ help: if this is intentional, prefix it with an underscore: `_i` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | Some(_i) => { + | ~~ error: unused variable: `x` --> $DIR/liveness-unused.rs:79:9 | LL | for x in 1..10 { } - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | for _x in 1..10 { } + | ~~ error: unused variable: `x` --> $DIR/liveness-unused.rs:84:10 | LL | for (x, _) in [1, 2, 3].iter().enumerate() { } - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | for (_x, _) in [1, 2, 3].iter().enumerate() { } + | ~~ error: unused variable: `x` --> $DIR/liveness-unused.rs:89:13 | LL | for (_, x) in [1, 2, 3].iter().enumerate() { - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | for (_, _x) in [1, 2, 3].iter().enumerate() { + | ~~ error: variable `x` is assigned to, but never used --> $DIR/liveness-unused.rs:112:9 diff --git a/tests/ui/loops/issue-1962.stderr b/tests/ui/loops/issue-1962.stderr index db235d473038a..536daf948f76f 100644 --- a/tests/ui/loops/issue-1962.stderr +++ b/tests/ui/loops/issue-1962.stderr @@ -2,9 +2,13 @@ error: denote infinite loops with `loop { ... }` --> $DIR/issue-1962.rs:6:5 | LL | 'a: while true { - | ^^^^^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^^^^^ | = note: requested on the command line with `-D while-true` +help: use `loop` + | +LL | 'a: loop { + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/loops/loop-break-value.stderr b/tests/ui/loops/loop-break-value.stderr index 0912bdbb221ec..ebd9635a51835 100644 --- a/tests/ui/loops/loop-break-value.stderr +++ b/tests/ui/loops/loop-break-value.stderr @@ -22,18 +22,24 @@ error[E0425]: cannot find value `LOOP` in this scope LL | 'LOOP: for _ in 0 .. 9 { | ----- a label with a similar name exists LL | break LOOP; - | ^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'LOOP` + | ^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'LOOP; + | ~~~~~ warning: denote infinite loops with `loop { ... }` --> $DIR/loop-break-value.rs:30:5 | LL | 'while_loop: while true { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | 'while_loop: loop { + | ~~~~~~~~~~~~~~~~~ error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:32:9 diff --git a/tests/ui/macros/assert-trailing-junk.with-generic-asset.stderr b/tests/ui/macros/assert-trailing-junk.with-generic-asset.stderr index 1e73320e43912..5da5f08ae2356 100644 --- a/tests/ui/macros/assert-trailing-junk.with-generic-asset.stderr +++ b/tests/ui/macros/assert-trailing-junk.with-generic-asset.stderr @@ -14,45 +14,59 @@ error: no rules expected the token `blah` --> $DIR/assert-trailing-junk.rs:15:30 | LL | assert!(true, "whatever" blah); - | -^^^^ no rules expected this token in macro call - | | - | help: missing comma here + | ^^^^ no rules expected this token in macro call | = note: while trying to match sequence start +help: missing comma here + | +LL | assert!(true, "whatever", blah); + | + error: unexpected string literal --> $DIR/assert-trailing-junk.rs:18:18 | LL | assert!(true "whatever" blah); - | -^^^^^^^^^^ - | | - | help: try adding a comma + | ^^^^^^^^^^ + | +help: try adding a comma + | +LL | assert!(true, "whatever" blah); + | + error: no rules expected the token `blah` --> $DIR/assert-trailing-junk.rs:18:29 | LL | assert!(true "whatever" blah); - | -^^^^ no rules expected this token in macro call - | | - | help: missing comma here + | ^^^^ no rules expected this token in macro call | = note: while trying to match sequence start +help: missing comma here + | +LL | assert!(true "whatever", blah); + | + error: macro requires an expression as an argument --> $DIR/assert-trailing-junk.rs:22:5 | LL | assert!(true;); - | ^^^^^^^^^^^^-^ - | | - | help: try removing semicolon + | ^^^^^^^^^^^^^^ + | +help: try removing semicolon + | +LL - assert!(true;); +LL + assert!(true); + | error: unexpected string literal --> $DIR/assert-trailing-junk.rs:25:27 | LL | assert!(false || true "error message"); - | -^^^^^^^^^^^^^^^ - | | - | help: try adding a comma + | ^^^^^^^^^^^^^^^ + | +help: try adding a comma + | +LL | assert!(false || true, "error message"); + | + error: aborting due to 7 previous errors diff --git a/tests/ui/macros/assert-trailing-junk.without-generic-asset.stderr b/tests/ui/macros/assert-trailing-junk.without-generic-asset.stderr index 1e73320e43912..5da5f08ae2356 100644 --- a/tests/ui/macros/assert-trailing-junk.without-generic-asset.stderr +++ b/tests/ui/macros/assert-trailing-junk.without-generic-asset.stderr @@ -14,45 +14,59 @@ error: no rules expected the token `blah` --> $DIR/assert-trailing-junk.rs:15:30 | LL | assert!(true, "whatever" blah); - | -^^^^ no rules expected this token in macro call - | | - | help: missing comma here + | ^^^^ no rules expected this token in macro call | = note: while trying to match sequence start +help: missing comma here + | +LL | assert!(true, "whatever", blah); + | + error: unexpected string literal --> $DIR/assert-trailing-junk.rs:18:18 | LL | assert!(true "whatever" blah); - | -^^^^^^^^^^ - | | - | help: try adding a comma + | ^^^^^^^^^^ + | +help: try adding a comma + | +LL | assert!(true, "whatever" blah); + | + error: no rules expected the token `blah` --> $DIR/assert-trailing-junk.rs:18:29 | LL | assert!(true "whatever" blah); - | -^^^^ no rules expected this token in macro call - | | - | help: missing comma here + | ^^^^ no rules expected this token in macro call | = note: while trying to match sequence start +help: missing comma here + | +LL | assert!(true "whatever", blah); + | + error: macro requires an expression as an argument --> $DIR/assert-trailing-junk.rs:22:5 | LL | assert!(true;); - | ^^^^^^^^^^^^-^ - | | - | help: try removing semicolon + | ^^^^^^^^^^^^^^ + | +help: try removing semicolon + | +LL - assert!(true;); +LL + assert!(true); + | error: unexpected string literal --> $DIR/assert-trailing-junk.rs:25:27 | LL | assert!(false || true "error message"); - | -^^^^^^^^^^^^^^^ - | | - | help: try adding a comma + | ^^^^^^^^^^^^^^^ + | +help: try adding a comma + | +LL | assert!(false || true, "error message"); + | + error: aborting due to 7 previous errors diff --git a/tests/ui/macros/bang-after-name.stderr b/tests/ui/macros/bang-after-name.stderr index 27853161e4f31..8433c375c01b8 100644 --- a/tests/ui/macros/bang-after-name.stderr +++ b/tests/ui/macros/bang-after-name.stderr @@ -2,7 +2,13 @@ error: macro names aren't followed by a `!` --> $DIR/bang-after-name.rs:4:17 | LL | macro_rules! foo! { - | ^ help: remove the `!` + | ^ + | +help: remove the `!` + | +LL - macro_rules! foo! { +LL + macro_rules! foo { + | error: aborting due to 1 previous error diff --git a/tests/ui/macros/concat-bytes-error.stderr b/tests/ui/macros/concat-bytes-error.stderr index 3f2c64922e34d..a9f4b79cac567 100644 --- a/tests/ui/macros/concat-bytes-error.stderr +++ b/tests/ui/macros/concat-bytes-error.stderr @@ -18,7 +18,12 @@ error: cannot concatenate string literals --> $DIR/concat-bytes-error.rs:6:19 | LL | concat_bytes!("tnrsi", "tnri"); - | ^^^^^^^ help: try using a byte string: `b"tnrsi"` + | ^^^^^^^ + | +help: try using a byte string + | +LL | concat_bytes!(b"tnrsi", "tnri"); + | ~~~~~~~~ error: cannot concatenate float literals --> $DIR/concat-bytes-error.rs:7:19 @@ -30,13 +35,23 @@ error: cannot concatenate numeric literals --> $DIR/concat-bytes-error.rs:8:19 | LL | concat_bytes!(300); - | ^^^ help: try wrapping the number in an array: `[300]` + | ^^^ + | +help: try wrapping the number in an array + | +LL | concat_bytes!([300]); + | ~~~~~ error: cannot concatenate character literals --> $DIR/concat-bytes-error.rs:9:19 | LL | concat_bytes!('a'); - | ^^^ help: try using a byte character: `b'a'` + | ^^^ + | +help: try using a byte character + | +LL | concat_bytes!(b'a'); + | ~~~~ error: cannot concatenate boolean literals --> $DIR/concat-bytes-error.rs:10:19 @@ -48,13 +63,23 @@ error: cannot concatenate numeric literals --> $DIR/concat-bytes-error.rs:11:19 | LL | concat_bytes!(42, b"va", b'l'); - | ^^ help: try wrapping the number in an array: `[42]` + | ^^ + | +help: try wrapping the number in an array + | +LL | concat_bytes!([42], b"va", b'l'); + | ~~~~ error: cannot concatenate numeric literals --> $DIR/concat-bytes-error.rs:12:19 | LL | concat_bytes!(42, b"va", b'l', [1, 2]); - | ^^ help: try wrapping the number in an array: `[42]` + | ^^ + | +help: try wrapping the number in an array + | +LL | concat_bytes!([42], b"va", b'l', [1, 2]); + | ~~~~ error: cannot concatenate string literals --> $DIR/concat-bytes-error.rs:14:9 @@ -66,7 +91,12 @@ error: cannot concatenate character literals --> $DIR/concat-bytes-error.rs:17:9 | LL | 'a', - | ^^^ help: try using a byte character: `b'a'` + | ^^^ + | +help: try using a byte character + | +LL | b'a', + | ~~~~ error: cannot concatenate boolean literals --> $DIR/concat-bytes-error.rs:20:9 @@ -119,7 +149,12 @@ error: cannot concatenate numeric literals --> $DIR/concat-bytes-error.rs:40:19 | LL | concat_bytes!(5u16); - | ^^^^ help: try wrapping the number in an array: `[5u16]` + | ^^^^ + | +help: try wrapping the number in an array + | +LL | concat_bytes!([5u16]); + | ~~~~~~ error: numeric literal is not a `u8` --> $DIR/concat-bytes-error.rs:41:20 diff --git a/tests/ui/macros/format-foreign.stderr b/tests/ui/macros/format-foreign.stderr index 7971c2ab2b9b2..8546a9e817181 100644 --- a/tests/ui/macros/format-foreign.stderr +++ b/tests/ui/macros/format-foreign.stderr @@ -18,11 +18,13 @@ error: argument never used --> $DIR/format-foreign.rs:3:29 | LL | println!("%1$*2$.*3$f", 123.456); - | ----------- ^^^^^^^ argument never used - | | - | help: format specifiers use curly braces: `{0:1$.2$}` + | ^^^^^^^ argument never used | = note: printf formatting is not supported; see the documentation for `std::fmt` +help: format specifiers use curly braces + | +LL | println!("{0:1$.2$}", 123.456); + | ~~~~~~~~~ error: multiple unused formatting arguments --> $DIR/format-foreign.rs:6:7 @@ -56,11 +58,13 @@ error: named argument never used --> $DIR/format-foreign.rs:14:39 | LL | println!("Hi there, $NAME.", NAME="Tim"); - | ----- ^^^^^ named argument never used - | | - | help: format specifiers use curly braces: `{NAME}` + | ^^^^^ named argument never used | = note: shell formatting is not supported; see the documentation for `std::fmt` +help: format specifiers use curly braces + | +LL | println!("Hi there, {NAME}.", NAME="Tim"); + | ~~~~~~ error: multiple unused formatting arguments --> $DIR/format-foreign.rs:15:32 diff --git a/tests/ui/macros/format-unused-lables.stderr b/tests/ui/macros/format-unused-lables.stderr index fad87fa2aeea8..01364048bcc33 100644 --- a/tests/ui/macros/format-unused-lables.stderr +++ b/tests/ui/macros/format-unused-lables.stderr @@ -32,10 +32,7 @@ error: multiple unused formatting arguments --> $DIR/format-unused-lables.rs:14:9 | LL | println!("Some more $STUFF", - | ------------------ - | | | - | | help: format specifiers use curly braces: `{STUFF}` - | multiple missing formatting specifiers + | ------------------ multiple missing formatting specifiers LL | "woo!", | ^^^^^^ argument never used LL | STUFF= @@ -45,6 +42,10 @@ LL | , UNUSED="args"); | ^^^^^^ named argument never used | = note: shell formatting is not supported; see the documentation for `std::fmt` +help: format specifiers use curly braces + | +LL | println!("Some more {STUFF}", + | ~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/macros/issue-69396-const-no-type-in-macro.stderr b/tests/ui/macros/issue-69396-const-no-type-in-macro.stderr index 89aeafebac497..6d76dfb1f9464 100644 --- a/tests/ui/macros/issue-69396-const-no-type-in-macro.stderr +++ b/tests/ui/macros/issue-69396-const-no-type-in-macro.stderr @@ -17,7 +17,7 @@ error: missing type for `const` item --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20 | LL | const A = "A".$fn(); - | ^ help: provide a type for the constant: `: usize` + | ^ ... LL | / suite! { LL | | len; @@ -26,15 +26,16 @@ LL | | } | |_- in this macro invocation | = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) +help: provide a type for the constant + | +LL | const A: usize = "A".$fn(); + | +++++++ error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20 | LL | const A = "A".$fn(); - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `bool` + | ^ not allowed in type signatures ... LL | / suite! { LL | | len; @@ -43,6 +44,10 @@ LL | | } | |_- in this macro invocation | = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) +help: replace with the correct type + | +LL | const Abool = "A".$fn(); + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/macros/issue-86865.stderr b/tests/ui/macros/issue-86865.stderr index eed755366311b..bec1dc488f03a 100644 --- a/tests/ui/macros/issue-86865.stderr +++ b/tests/ui/macros/issue-86865.stderr @@ -2,17 +2,25 @@ error: format argument must be a string literal --> $DIR/issue-86865.rs:4:14 | LL | println!(b"foo"); - | -^^^^^ - | | - | help: consider removing the leading `b` + | ^^^^^^ + | +help: consider removing the leading `b` + | +LL - println!(b"foo"); +LL + println!("foo"); + | error: format argument must be a string literal --> $DIR/issue-86865.rs:8:15 | LL | write!(s, b"foo{}", "bar"); - | -^^^^^^^ - | | - | help: consider removing the leading `b` + | ^^^^^^^^ + | +help: consider removing the leading `b` + | +LL - write!(s, b"foo{}", "bar"); +LL + write!(s, "foo{}", "bar"); + | error: aborting due to 2 previous errors diff --git a/tests/ui/macros/macro-context.stderr b/tests/ui/macros/macro-context.stderr index 7785f41594627..fb8dcf14f6d2d 100644 --- a/tests/ui/macros/macro-context.stderr +++ b/tests/ui/macros/macro-context.stderr @@ -46,12 +46,16 @@ error[E0412]: cannot find type `i` in this scope --> $DIR/macro-context.rs:3:13 | LL | () => ( i ; typeof ); - | ^ help: a builtin type with a similar name exists: `i8` + | ^ ... LL | let a: m!(); | ---- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a builtin type with a similar name exists + | +LL | () => ( i8 ; typeof ); + | ~~ error[E0425]: cannot find value `i` in this scope --> $DIR/macro-context.rs:3:13 diff --git a/tests/ui/macros/macro-metavar-expr-concat/syntax-errors.stderr b/tests/ui/macros/macro-metavar-expr-concat/syntax-errors.stderr index b216a86d59abe..6706a4c11e1ce 100644 --- a/tests/ui/macros/macro-metavar-expr-concat/syntax-errors.stderr +++ b/tests/ui/macros/macro-metavar-expr-concat/syntax-errors.stderr @@ -20,7 +20,13 @@ error: expected identifier, found `1` --> $DIR/syntax-errors.rs:14:24 | LL | ${concat(aaaa, 1)} - | ^ help: try removing `1` + | ^ + | +help: try removing `1` + | +LL - ${concat(aaaa, 1)} +LL + ${concat(aaaa, )} + | error: expected comma --> $DIR/syntax-errors.rs:19:10 @@ -50,7 +56,13 @@ error: expected identifier, found `123` --> $DIR/syntax-errors.rs:34:29 | LL | ${concat($ex, aaaa, 123)} - | ^^^ help: try removing `123` + | ^^^ + | +help: try removing `123` + | +LL - ${concat($ex, aaaa, 123)} +LL + ${concat($ex, aaaa, )} + | error: `${concat(..)}` currently only accepts identifiers or meta-variables as parameters --> $DIR/syntax-errors.rs:25:19 diff --git a/tests/ui/macros/macro-name-typo.stderr b/tests/ui/macros/macro-name-typo.stderr index 9059b10faaacd..39b9d17c9d647 100644 --- a/tests/ui/macros/macro-name-typo.stderr +++ b/tests/ui/macros/macro-name-typo.stderr @@ -2,10 +2,15 @@ error: cannot find macro `printlx` in this scope --> $DIR/macro-name-typo.rs:2:5 | LL | printlx!("oh noes!"); - | ^^^^^^^ help: a macro with a similar name exists: `println` + | ^^^^^^^ --> $SRC_DIR/std/src/macros.rs:LL:COL | = note: similarly named macro `println` defined here + | +help: a macro with a similar name exists + | +LL | println!("oh noes!"); + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-or-patterns-back-compat.stderr b/tests/ui/macros/macro-or-patterns-back-compat.stderr index e04dfefa4e8e7..9b254917a5f51 100644 --- a/tests/ui/macros/macro-or-patterns-back-compat.stderr +++ b/tests/ui/macros/macro-or-patterns-back-compat.stderr @@ -2,7 +2,7 @@ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, whi --> $DIR/macro-or-patterns-back-compat.rs:10:21 | LL | macro_rules! foo { ($x:pat | $y:pat) => {} } - | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` + | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see @@ -11,33 +11,49 @@ note: the lint level is defined here | LL | #![deny(rust_2021_incompatible_or_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use pat_param to preserve semantics + | +LL | macro_rules! foo { ($x:pat_param | $y:pat) => {} } + | ~~~~~~~~~~~~ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro --> $DIR/macro-or-patterns-back-compat.rs:13:23 | LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } - | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` + | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use pat_param to preserve semantics + | +LL | macro_rules! bar { ($($x:pat_param)+ | $($y:pat)+) => {} } + | ~~~~~~~~~~~~ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro --> $DIR/macro-or-patterns-back-compat.rs:19:21 | LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} } - | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` + | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use pat_param to preserve semantics + | +LL | macro_rules! ogg { ($x:pat_param | $y:pat_param) => {} } + | ~~~~~~~~~~~~ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro --> $DIR/macro-or-patterns-back-compat.rs:23:26 | LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { - | ^^^^^^^^ help: use pat_param to preserve semantics: `$pat:pat_param` + | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use pat_param to preserve semantics + | +LL | ( $expr:expr , $( $( $pat:pat_param )|+ => $expr_arm:expr ),+ ) => { + | ~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr b/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr index a06487be3d601..f595f61219f95 100644 --- a/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr +++ b/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr @@ -2,31 +2,37 @@ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:3:28 | LL | macro_rules! foo { ($x:pat | $y:pat) => {} } - | ------ ^ not allowed after `pat` fragments - | | - | help: try a `pat_param` fragment specifier instead: `$x:pat_param` + | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` +help: try a `pat_param` fragment specifier instead + | +LL | macro_rules! foo { ($x:pat_param | $y:pat) => {} } + | ~~~~~~~~~~~~ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:4:32 | LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } - | ------ ^ not allowed after `pat` fragments - | | - | help: try a `pat_param` fragment specifier instead: `$x:pat_param` + | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` +help: try a `pat_param` fragment specifier instead + | +LL | macro_rules! bar { ($($x:pat_param)+ | $($y:pat)+) => {} } + | ~~~~~~~~~~~~ error: `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:7:36 | LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { - | -------- ^ not allowed after `pat` fragments - | | - | help: try a `pat_param` fragment specifier instead: `$pat:pat_param` + | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` +help: try a `pat_param` fragment specifier instead + | +LL | ( $expr:expr , $( $( $pat:pat_param )|+ => $expr_arm:expr ),+ ) => { + | ~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/macros/macro-pat2021-pattern-followed-by-or.stderr b/tests/ui/macros/macro-pat2021-pattern-followed-by-or.stderr index c3754dde080a3..7d4358451f2fb 100644 --- a/tests/ui/macros/macro-pat2021-pattern-followed-by-or.stderr +++ b/tests/ui/macros/macro-pat2021-pattern-followed-by-or.stderr @@ -2,31 +2,37 @@ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat2021-pattern-followed-by-or.rs:4:28 | LL | macro_rules! foo { ($x:pat | $y:pat) => {} } - | ------ ^ not allowed after `pat` fragments - | | - | help: try a `pat_param` fragment specifier instead: `$x:pat_param` + | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` +help: try a `pat_param` fragment specifier instead + | +LL | macro_rules! foo { ($x:pat_param | $y:pat) => {} } + | ~~~~~~~~~~~~ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat2021-pattern-followed-by-or.rs:7:28 | LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} } - | ------ ^ not allowed after `pat` fragments - | | - | help: try a `pat_param` fragment specifier instead: `$x:pat_param` + | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` +help: try a `pat_param` fragment specifier instead + | +LL | macro_rules! ogg { ($x:pat_param | $y:pat_param) => {} } + | ~~~~~~~~~~~~ error: `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat2021-pattern-followed-by-or.rs:9:35 | LL | ( $expr:expr , $( $( $pat:pat)|+ => $expr_arm:pat),+ ) => { - | -------- ^ not allowed after `pat` fragments - | | - | help: try a `pat_param` fragment specifier instead: `$pat:pat_param` + | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` +help: try a `pat_param` fragment specifier instead + | +LL | ( $expr:expr , $( $( $pat:pat_param)|+ => $expr_arm:pat),+ ) => { + | ~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/macros/macro-path-prelude-fail-3.stderr b/tests/ui/macros/macro-path-prelude-fail-3.stderr index 485d7b7869a9a..587ec7cb0dd77 100644 --- a/tests/ui/macros/macro-path-prelude-fail-3.stderr +++ b/tests/ui/macros/macro-path-prelude-fail-3.stderr @@ -2,12 +2,16 @@ error: cannot find macro `inline` in this scope --> $DIR/macro-path-prelude-fail-3.rs:2:5 | LL | inline!(); - | ^^^^^^ help: a macro with a similar name exists: `line` + | ^^^^^^ --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named macro `line` defined here | = note: `inline` is in scope, but it is an attribute: `#[inline]` +help: a macro with a similar name exists + | +LL | line!(); + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-reexport-removed.stderr b/tests/ui/macros/macro-reexport-removed.stderr index 475a586ddc083..2029376cd9ae0 100644 --- a/tests/ui/macros/macro-reexport-removed.stderr +++ b/tests/ui/macros/macro-reexport-removed.stderr @@ -10,7 +10,12 @@ error: cannot find attribute `macro_reexport` in this scope --> $DIR/macro-reexport-removed.rs:5:3 | LL | #[macro_reexport(macro_one)] - | ^^^^^^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_export` + | ^^^^^^^^^^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL | #[macro_export(macro_one)] + | ~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/macros/macro-use-all-and-none.stderr b/tests/ui/macros/macro-use-all-and-none.stderr index 00b10dccd0013..8fe2e7a9ec2a0 100644 --- a/tests/ui/macros/macro-use-all-and-none.stderr +++ b/tests/ui/macros/macro-use-all-and-none.stderr @@ -2,7 +2,7 @@ warning: unused attribute --> $DIR/macro-use-all-and-none.rs:7:1 | LL | #[macro_use()] - | ^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^ | = note: attribute `macro_use` with an empty list has no effect note: the lint level is defined here @@ -10,6 +10,11 @@ note: the lint level is defined here | LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[macro_use()] +LL + + | warning: 1 warning emitted diff --git a/tests/ui/macros/macro_undefined.stderr b/tests/ui/macros/macro_undefined.stderr index cc3efacbc5415..e58dfb0d75312 100644 --- a/tests/ui/macros/macro_undefined.stderr +++ b/tests/ui/macros/macro_undefined.stderr @@ -5,7 +5,12 @@ LL | macro_rules! kl { | --------------- similarly named macro `kl` defined here ... LL | k!(); - | ^ help: a macro with a similar name exists: `kl` + | ^ + | +help: a macro with a similar name exists + | +LL | kl!(); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/macros/macros-nonfatal-errors.stderr b/tests/ui/macros/macros-nonfatal-errors.stderr index abf43e2a009d7..23a10020ca74e 100644 --- a/tests/ui/macros/macros-nonfatal-errors.stderr +++ b/tests/ui/macros/macros-nonfatal-errors.stderr @@ -79,7 +79,10 @@ error: `#[default]` attribute does not accept a value LL | #[default = 1] | ^^^^^^^^^^^^^^ | - = help: try using `#[default]` +help: try using `#[default]` + | +LL | #[default] + | ~~~~~~~~~~ error: multiple `#[default]` attributes --> $DIR/macros-nonfatal-errors.rs:68:5 diff --git a/tests/ui/macros/missing-bang-in-decl.stderr b/tests/ui/macros/missing-bang-in-decl.stderr index aa78c9a690643..348a94ec2c054 100644 --- a/tests/ui/macros/missing-bang-in-decl.stderr +++ b/tests/ui/macros/missing-bang-in-decl.stderr @@ -24,7 +24,13 @@ error: macro names aren't followed by a `!` --> $DIR/missing-bang-in-decl.rs:10:16 | LL | macro_rules bar! { - | ^ help: remove the `!` + | ^ + | +help: remove the `!` + | +LL - macro_rules bar! { +LL + macro_rules bar { + | error: aborting due to 3 previous errors diff --git a/tests/ui/macros/missing-comma.stderr b/tests/ui/macros/missing-comma.stderr index 81877a29ed8ae..5ef28a7a90882 100644 --- a/tests/ui/macros/missing-comma.stderr +++ b/tests/ui/macros/missing-comma.stderr @@ -11,15 +11,17 @@ LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a b); - | -^ no rules expected this token in macro call - | | - | help: missing comma here + | ^ no rules expected this token in macro call | note: while trying to match meta-variable `$a:ident` --> $DIR/missing-comma.rs:2:6 | LL | ($a:ident) => (); | ^^^^^^^^ +help: missing comma here + | +LL | foo!(a, b); + | + error: no rules expected the token `e` --> $DIR/missing-comma.rs:23:21 @@ -28,15 +30,17 @@ LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a, b, c, d e); - | -^ no rules expected this token in macro call - | | - | help: missing comma here + | ^ no rules expected this token in macro call | note: while trying to match meta-variable `$d:ident` --> $DIR/missing-comma.rs:5:36 | LL | ($a:ident, $b:ident, $c:ident, $d:ident) => (); | ^^^^^^^^ +help: missing comma here + | +LL | foo!(a, b, c, d, e); + | + error: no rules expected the token `d` --> $DIR/missing-comma.rs:25:18 @@ -45,15 +49,17 @@ LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a, b, c d, e); - | -^ no rules expected this token in macro call - | | - | help: missing comma here + | ^ no rules expected this token in macro call | note: while trying to match meta-variable `$c:ident` --> $DIR/missing-comma.rs:4:26 | LL | ($a:ident, $b:ident, $c:ident) => (); | ^^^^^^^^ +help: missing comma here + | +LL | foo!(a, b, c, d, e); + | + error: no rules expected the token `d` --> $DIR/missing-comma.rs:27:18 diff --git a/tests/ui/macros/recovery-allowed.stderr b/tests/ui/macros/recovery-allowed.stderr index 44689853dabcc..825f7a8faf8e7 100644 --- a/tests/ui/macros/recovery-allowed.stderr +++ b/tests/ui/macros/recovery-allowed.stderr @@ -2,9 +2,12 @@ error: unexpected `1` after identifier --> $DIR/recovery-allowed.rs:5:23 | LL | please_recover! { not 1 } - | ----^ - | | - | help: use `!` to perform bitwise not + | ^ + | +help: use `!` to perform bitwise not + | +LL | please_recover! { !1 } + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr index 8e4ba192d79f5..28934abad4be2 100644 --- a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr +++ b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr @@ -188,7 +188,13 @@ error: unrecognized meta-variable expression --> $DIR/syntax-errors.rs:140:33 | LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } }; - | ^^^^^^^^^^^^^^ help: supported expressions are count, ignore, index and len + | ^^^^^^^^^^^^^^ + | +help: supported expressions are count, ignore, index and len + | +LL - ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } }; +LL + ( $( $i:ident ),* ) => { ${ (i) } }; + | error: expected identifier --> $DIR/syntax-errors.rs:118:33 diff --git a/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr b/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr index 11a8c01e49094..64d8e67db2406 100644 --- a/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr +++ b/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr @@ -5,7 +5,12 @@ LL | impl A { | ------------ the inner item doesn't inherit generics from this impl, so `Self` is invalid to reference ... LL | Self(1) - | ^^^^ help: replace `Self` with the actual type: `A` + | ^^^^ + | +help: replace `Self` with the actual type + | +LL | A(1) + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/malformed/malformed-derive-entry.stderr b/tests/ui/malformed/malformed-derive-entry.stderr index 3059d75d718a5..97855171cca72 100644 --- a/tests/ui/malformed/malformed-derive-entry.stderr +++ b/tests/ui/malformed/malformed-derive-entry.stderr @@ -2,19 +2,36 @@ error: traits in `#[derive(...)]` don't accept arguments --> $DIR/malformed-derive-entry.rs:1:14 | LL | #[derive(Copy(Bad))] - | ^^^^^ help: remove the arguments + | ^^^^^ + | +help: remove the arguments + | +LL - #[derive(Copy(Bad))] +LL + #[derive(Copy)] + | error: traits in `#[derive(...)]` don't accept values --> $DIR/malformed-derive-entry.rs:6:14 | LL | #[derive(Copy="bad")] - | ^^^^^^ help: remove the value + | ^^^^^^ + | +help: remove the value + | +LL - #[derive(Copy="bad")] +LL + #[derive(Copy)] + | error: malformed `derive` attribute input --> $DIR/malformed-derive-entry.rs:11:1 | LL | #[derive] - | ^^^^^^^^^ help: must be of the form: `#[derive(Trait1, Trait2, ...)]` + | ^^^^^^^^^ + | +help: must be of the form + | +LL | #[derive(Trait1, Trait2, ...)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: the trait bound `Test1: Clone` is not satisfied --> $DIR/malformed-derive-entry.rs:1:10 diff --git a/tests/ui/malformed/malformed-special-attrs.stderr b/tests/ui/malformed/malformed-special-attrs.stderr index 1764c3969cfee..634052d0b155c 100644 --- a/tests/ui/malformed/malformed-special-attrs.stderr +++ b/tests/ui/malformed/malformed-special-attrs.stderr @@ -2,29 +2,47 @@ error: malformed `cfg_attr` attribute input --> $DIR/malformed-special-attrs.rs:1:1 | LL | #[cfg_attr] - | ^^^^^^^^^^^ help: missing condition and attribute: `#[cfg_attr(condition, attribute, other_attribute, ...)]` + | ^^^^^^^^^^^ | = note: for more information, visit +help: missing condition and attribute + | +LL | #[cfg_attr(condition, attribute, other_attribute, ...)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `cfg_attr` attribute input --> $DIR/malformed-special-attrs.rs:4:1 | LL | #[cfg_attr = ""] - | ^^^^^^^^^^^^^^^^ help: missing condition and attribute: `#[cfg_attr(condition, attribute, other_attribute, ...)]` + | ^^^^^^^^^^^^^^^^ | = note: for more information, visit +help: missing condition and attribute + | +LL | #[cfg_attr(condition, attribute, other_attribute, ...)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `derive` attribute input --> $DIR/malformed-special-attrs.rs:7:1 | LL | #[derive] - | ^^^^^^^^^ help: must be of the form: `#[derive(Trait1, Trait2, ...)]` + | ^^^^^^^^^ + | +help: must be of the form + | +LL | #[derive(Trait1, Trait2, ...)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `derive` attribute input --> $DIR/malformed-special-attrs.rs:10:1 | LL | #[derive = ""] - | ^^^^^^^^^^^^^^ help: must be of the form: `#[derive(Trait1, Trait2, ...)]` + | ^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[derive(Trait1, Trait2, ...)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/marker_trait_attr/marker-attribute-with-values.stderr b/tests/ui/marker_trait_attr/marker-attribute-with-values.stderr index 6f9c9508e7e55..dc8276703222b 100644 --- a/tests/ui/marker_trait_attr/marker-attribute-with-values.stderr +++ b/tests/ui/marker_trait_attr/marker-attribute-with-values.stderr @@ -2,19 +2,34 @@ error: malformed `marker` attribute input --> $DIR/marker-attribute-with-values.rs:3:1 | LL | #[marker(always)] - | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[marker]` + | ^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[marker] + | ~~~~~~~~~ error: malformed `marker` attribute input --> $DIR/marker-attribute-with-values.rs:6:1 | LL | #[marker("never")] - | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[marker]` + | ^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[marker] + | ~~~~~~~~~ error: malformed `marker` attribute input --> $DIR/marker-attribute-with-values.rs:9:1 | LL | #[marker(key = "value")] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[marker]` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[marker] + | ~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/match/issue-56685.stderr b/tests/ui/match/issue-56685.stderr index ccf357d4aa00e..166b04fc80119 100644 --- a/tests/ui/match/issue-56685.stderr +++ b/tests/ui/match/issue-56685.stderr @@ -29,13 +29,23 @@ error: unused variable: `a` --> $DIR/issue-56685.rs:27:14 | LL | F::C(a, b) => { 3 } - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | F::C(_a, b) => { 3 } + | ~~ error: unused variable: `b` --> $DIR/issue-56685.rs:27:17 | LL | F::C(a, b) => { 3 } - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | F::C(a, _b) => { 3 } + | ~~ error: unused variable: `x` --> $DIR/issue-56685.rs:32:25 diff --git a/tests/ui/match/match-incompat-type-semi.stderr b/tests/ui/match/match-incompat-type-semi.stderr index 008b1c1e93d6d..bdb748f7045ff 100644 --- a/tests/ui/match/match-incompat-type-semi.stderr +++ b/tests/ui/match/match-incompat-type-semi.stderr @@ -9,14 +9,17 @@ LL | | x LL | | }, LL | | None => { LL | | 0; - | | ^- - | | || - | | |help: consider removing this semicolon - | | expected integer, found `()` + | | ^^ expected integer, found `()` ... | LL | | }, LL | | }; | |_____- `match` arms have incompatible types + | +help: consider removing this semicolon + | +LL - 0; +LL + 0 + | error[E0308]: `if` and `else` have incompatible types --> $DIR/match-incompat-type-semi.rs:20:9 @@ -27,14 +30,17 @@ LL | | x | | - expected because of this LL | | } else { LL | | 0; - | | ^- - | | || - | | |help: consider removing this semicolon - | | expected integer, found `()` + | | ^^ expected integer, found `()` LL | | LL | | LL | | }; | |_____- `if` and `else` have incompatible types + | +help: consider removing this semicolon + | +LL - 0; +LL + 0 + | error[E0308]: `match` arms have incompatible types --> $DIR/match-incompat-type-semi.rs:30:13 diff --git a/tests/ui/match/match-pattern-field-mismatch-2.stderr b/tests/ui/match/match-pattern-field-mismatch-2.stderr index 12b143dd29b91..039e5d87974f7 100644 --- a/tests/ui/match/match-pattern-field-mismatch-2.stderr +++ b/tests/ui/match/match-pattern-field-mismatch-2.stderr @@ -5,7 +5,12 @@ LL | NoColor, | ------- `Color::NoColor` defined here ... LL | Color::NoColor(_) => { } - | ^^^^^^^^^^^^^^^^^ help: use this syntax instead: `Color::NoColor` + | ^^^^^^^^^^^^^^^^^ + | +help: use this syntax instead + | +LL | Color::NoColor => { } + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/match/match-tail-expr-never-type-error.stderr b/tests/ui/match/match-tail-expr-never-type-error.stderr index 226d33daeb254..50a2504edae7c 100644 --- a/tests/ui/match/match-tail-expr-never-type-error.stderr +++ b/tests/ui/match/match-tail-expr-never-type-error.stderr @@ -1,8 +1,6 @@ error[E0308]: `match` arms have incompatible types --> $DIR/match-tail-expr-never-type-error.rs:9:13 | -LL | fn bar(a: bool) { - | - help: try adding a return type: `-> i32` LL | / match a { LL | | true => 1, | | - this is found to be of type `{integer}` @@ -15,6 +13,11 @@ LL | | never() LL | | } LL | | } | |_____- `match` arms have incompatible types + | +help: try adding a return type + | +LL | fn bar(a: bool) -> i32 { + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/match/ref_pat_eat_one_layer_2024/ref_pat_eat_one_layer_2024_ref_mut_inside_and.stderr b/tests/ui/match/ref_pat_eat_one_layer_2024/ref_pat_eat_one_layer_2024_ref_mut_inside_and.stderr index 964e9f36596bd..d2dd399fdb737 100644 --- a/tests/ui/match/ref_pat_eat_one_layer_2024/ref_pat_eat_one_layer_2024_ref_mut_inside_and.stderr +++ b/tests/ui/match/ref_pat_eat_one_layer_2024/ref_pat_eat_one_layer_2024_ref_mut_inside_and.stderr @@ -2,41 +2,56 @@ error[E0596]: cannot borrow as mutable inside an `&` pattern --> $DIR/ref_pat_eat_one_layer_2024_ref_mut_inside_and.rs:8:31 | LL | if let Some(&Some(ref mut x)) = &mut Some(Some(0)) { - | - ^ - | | - | help: replace this `&` with `&mut`: `&mut` + | ^ + | +help: replace this `&` with `&mut` + | +LL | if let Some(&mut Some(ref mut x)) = &mut Some(Some(0)) { + | ~~~~ error[E0596]: cannot borrow as mutable inside an `&` pattern --> $DIR/ref_pat_eat_one_layer_2024_ref_mut_inside_and.rs:13:31 | LL | if let &Some(Some(ref mut x)) = &mut Some(Some(0)) { - | - ^ - | | - | help: replace this `&` with `&mut`: `&mut` + | ^ + | +help: replace this `&` with `&mut` + | +LL | if let &mut Some(Some(ref mut x)) = &mut Some(Some(0)) { + | ~~~~ error[E0596]: cannot borrow as mutable inside an `&` pattern --> $DIR/ref_pat_eat_one_layer_2024_ref_mut_inside_and.rs:21:15 | LL | let &pat!(x) = &mut 0; - | - ^ - | | - | help: replace this `&` with `&mut`: `&mut` + | ^ + | +help: replace this `&` with `&mut` + | +LL | let &mut pat!(x) = &mut 0; + | ~~~~ error[E0596]: cannot borrow as mutable inside an `&` pattern --> $DIR/ref_pat_eat_one_layer_2024_ref_mut_inside_and.rs:25:19 | LL | let &(ref mut a, ref mut b) = &mut (true, false); - | - ^ - | | - | help: replace this `&` with `&mut`: `&mut` + | ^ + | +help: replace this `&` with `&mut` + | +LL | let &mut (ref mut a, ref mut b) = &mut (true, false); + | ~~~~ error[E0596]: cannot borrow as mutable inside an `&` pattern --> $DIR/ref_pat_eat_one_layer_2024_ref_mut_inside_and.rs:25:30 | LL | let &(ref mut a, ref mut b) = &mut (true, false); - | - ^ - | | - | help: replace this `&` with `&mut`: `&mut` + | ^ + | +help: replace this `&` with `&mut` + | +LL | let &mut (ref mut a, ref mut b) = &mut (true, false); + | ~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/methods/issue-3707.stderr b/tests/ui/methods/issue-3707.stderr index b3d4dfe5aaa88..905e3972017de 100644 --- a/tests/ui/methods/issue-3707.stderr +++ b/tests/ui/methods/issue-3707.stderr @@ -2,10 +2,7 @@ error[E0599]: no method named `boom` found for reference `&Obj` in the current s --> $DIR/issue-3707.rs:10:14 | LL | self.boom(); - | -----^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `Obj::boom()` + | ^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Obj` @@ -13,6 +10,10 @@ note: the candidate is defined in an impl for the type `Obj` | LL | pub fn boom() -> bool { | ^^^^^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | Obj::boom(); + | ~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/methods/issues/issue-105732.stderr b/tests/ui/methods/issues/issue-105732.stderr index a4924b3e663b7..aba7e30913cef 100644 --- a/tests/ui/methods/issues/issue-105732.stderr +++ b/tests/ui/methods/issues/issue-105732.stderr @@ -4,7 +4,13 @@ error[E0380]: auto traits cannot have associated items LL | auto trait Foo { | --- auto traits cannot have associated items LL | fn g(&self); - | ---^-------- help: remove these associated items + | ^ + | +help: remove these associated items + | +LL - fn g(&self); +LL + + | error[E0599]: no method named `g` found for reference `&Self` in the current scope --> $DIR/issue-105732.rs:10:14 diff --git a/tests/ui/methods/method-call-err-msg.stderr b/tests/ui/methods/method-call-err-msg.stderr index 5a76449e9f95b..0855a17b33394 100644 --- a/tests/ui/methods/method-call-err-msg.stderr +++ b/tests/ui/methods/method-call-err-msg.stderr @@ -2,16 +2,18 @@ error[E0061]: this method takes 0 arguments but 1 argument was supplied --> $DIR/method-call-err-msg.rs:13:7 | LL | x.zero(0) - | ^^^^ - - | | - | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^ - unexpected argument of type `{integer}` | note: method defined here --> $DIR/method-call-err-msg.rs:5:8 | LL | fn zero(self) -> Foo { self } | ^^^^ +help: remove the extra argument + | +LL - x.zero(0) +LL + x.zero() + | error[E0061]: this method takes 1 argument but 0 arguments were supplied --> $DIR/method-call-err-msg.rs:14:7 diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr index 645d8b8d14ad2..d431e0721ccb9 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr @@ -20,15 +20,18 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/method-call-lifetime-args-fail.rs:18:7 | LL | S.early::<'static, 'static, 'static>(); - | ^^^^^ ------- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^^^^^ expected 2 lifetime arguments | note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } | ^^^^^ -- -- +help: remove this lifetime argument + | +LL - S.early::<'static, 'static, 'static>(); +LL + S.early::<'static, 'static, >(); + | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:27:15 @@ -220,15 +223,18 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/method-call-lifetime-args-fail.rs:65:8 | LL | S::early::<'static, 'static, 'static>(S); - | ^^^^^ ------- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^^^^^ expected 2 lifetime arguments | note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } | ^^^^^ -- -- +help: remove this lifetime argument + | +LL - S::early::<'static, 'static, 'static>(S); +LL + S::early::<'static, 'static, >(S); + | error: aborting due to 18 previous errors diff --git a/tests/ui/methods/method-call-lifetime-args-unresolved.stderr b/tests/ui/methods/method-call-lifetime-args-unresolved.stderr index c72e7e0cdc37f..d3bd74a49fb3d 100644 --- a/tests/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/tests/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -1,10 +1,13 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/method-call-lifetime-args-unresolved.rs:2:15 | -LL | fn main() { - | - help: consider introducing lifetime `'a` here: `<'a>` LL | 0.clone::<'a>(); | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn main<'a>() { + | ++++ warning: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-unresolved.rs:2:15 diff --git a/tests/ui/mir/issue-112269.stderr b/tests/ui/mir/issue-112269.stderr index f5b796027979c..e7ddc5dcd31a2 100644 --- a/tests/ui/mir/issue-112269.stderr +++ b/tests/ui/mir/issue-112269.stderr @@ -6,11 +6,14 @@ LL | let x: i32 = 3; | | | patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered | missing patterns are not covered because `x` is interpreted as a constant pattern, not a new variable - | help: introduce a variable instead: `x_var` | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `i32` +help: introduce a variable instead + | +LL | let x_var: i32 = 3; + | ~~~~~ error[E0005]: refutable pattern in local binding --> $DIR/issue-112269.rs:7:9 @@ -20,11 +23,14 @@ LL | let y = 4; | | | patterns `i32::MIN..=2_i32` and `4_i32..=i32::MAX` not covered | missing patterns are not covered because `y` is interpreted as a constant pattern, not a new variable - | help: introduce a variable instead: `y_var` | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `i32` +help: introduce a variable instead + | +LL | let y_var = 4; + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/E0053.stderr b/tests/ui/mismatched_types/E0053.stderr index d0bd5b46cf59f..2559d4487491e 100644 --- a/tests/ui/mismatched_types/E0053.stderr +++ b/tests/ui/mismatched_types/E0053.stderr @@ -2,10 +2,7 @@ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/E0053.rs:9:15 | LL | fn foo(x: i16) { } - | ^^^ - | | - | expected `u16`, found `i16` - | help: change the parameter type to match the trait: `u16` + | ^^^ expected `u16`, found `i16` | note: type in trait --> $DIR/E0053.rs:2:15 @@ -14,15 +11,16 @@ LL | fn foo(x: u16); | ^^^ = note: expected signature `fn(u16)` found signature `fn(i16)` +help: change the parameter type to match the trait + | +LL | fn foo(x: u16) { } + | ~~~ error[E0053]: method `bar` has an incompatible type for trait --> $DIR/E0053.rs:11:12 | LL | fn bar(&mut self) { } - | ^^^^^^^^^ - | | - | types differ in mutability - | help: change the self-receiver type to match the trait: `&self` + | ^^^^^^^^^ types differ in mutability | note: type in trait --> $DIR/E0053.rs:3:12 @@ -31,6 +29,10 @@ LL | fn bar(&self); | ^^^^^ = note: expected signature `fn(&Bar)` found signature `fn(&mut Bar)` +help: change the self-receiver type to match the trait + | +LL | fn bar(&self) { } + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/cast-rfc0401.stderr b/tests/ui/mismatched_types/cast-rfc0401.stderr index 142a52aef13d0..b146fdd777303 100644 --- a/tests/ui/mismatched_types/cast-rfc0401.stderr +++ b/tests/ui/mismatched_types/cast-rfc0401.stderr @@ -103,10 +103,12 @@ error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/cast-rfc0401.rs:41:13 | LL | let _ = 0x61u32 as char; - | ^^^^^^^^^^^^^^^ - | | - | invalid cast - | help: try `char::from_u32` instead: `char::from_u32(0x61u32)` + | ^^^^^^^^^^^^^^^ invalid cast + | +help: try `char::from_u32` instead + | +LL | let _ = char::from_u32(0x61u32); + | ~~~~~~~~~~~~~~~~~~~~~~~ error[E0606]: casting `bool` as `f32` is invalid --> $DIR/cast-rfc0401.rs:43:13 diff --git a/tests/ui/mismatched_types/const-fn-in-trait.stderr b/tests/ui/mismatched_types/const-fn-in-trait.stderr index 06976933b2f94..d8d1832830c7d 100644 --- a/tests/ui/mismatched_types/const-fn-in-trait.stderr +++ b/tests/ui/mismatched_types/const-fn-in-trait.stderr @@ -2,19 +2,25 @@ error[E0379]: functions in traits cannot be declared const --> $DIR/const-fn-in-trait.rs:3:5 | LL | const fn g(); - | ^^^^^- - | | - | functions in traits cannot be const - | help: remove the `const` + | ^^^^^ functions in traits cannot be const + | +help: remove the `const` + | +LL - const fn g(); +LL + fn g(); + | error[E0379]: functions in trait impls cannot be declared const --> $DIR/const-fn-in-trait.rs:7:5 | LL | const fn f() -> u32 { 22 } - | ^^^^^- - | | - | functions in trait impls cannot be const - | help: remove the `const` + | ^^^^^ functions in trait impls cannot be const + | +help: remove the `const` + | +LL - const fn f() -> u32 { 22 } +LL + fn f() -> u32 { 22 } + | error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr index b93ce4a8674c2..bd446b3d78cb2 100644 --- a/tests/ui/mismatched_types/issue-112036.stderr +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -2,13 +2,14 @@ error[E0053]: method `drop` has an incompatible type for trait --> $DIR/issue-112036.rs:4:13 | LL | fn drop(self) {} - | ^^^^ - | | - | expected `&mut Foo`, found `Foo` - | help: change the self-receiver type to match the trait: `&mut self` + | ^^^^ expected `&mut Foo`, found `Foo` | = note: expected signature `fn(&mut Foo)` found signature `fn(Foo)` +help: change the self-receiver type to match the trait + | +LL | fn drop(&mut self) {} + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-13033.stderr b/tests/ui/mismatched_types/issue-13033.stderr index 4886fa30e89b1..2a266d40e7717 100644 --- a/tests/ui/mismatched_types/issue-13033.stderr +++ b/tests/ui/mismatched_types/issue-13033.stderr @@ -2,10 +2,7 @@ error[E0053]: method `bar` has an incompatible type for trait --> $DIR/issue-13033.rs:8:30 | LL | fn bar(&mut self, other: &dyn Foo) {} - | ^^^^^^^^ - | | - | types differ in mutability - | help: change the parameter type to match the trait: `&mut dyn Foo` + | ^^^^^^^^ types differ in mutability | note: type in trait --> $DIR/issue-13033.rs:2:30 @@ -14,6 +11,10 @@ LL | fn bar(&mut self, other: &mut dyn Foo); | ^^^^^^^^^^^^ = note: expected signature `fn(&mut Baz, &mut dyn Foo)` found signature `fn(&mut Baz, &dyn Foo)` +help: change the parameter type to match the trait + | +LL | fn bar(&mut self, other: &mut dyn Foo) {} + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-19109.stderr b/tests/ui/mismatched_types/issue-19109.stderr index e769ed0c1f976..63b11e3d265b6 100644 --- a/tests/ui/mismatched_types/issue-19109.stderr +++ b/tests/ui/mismatched_types/issue-19109.stderr @@ -1,13 +1,15 @@ error[E0308]: mismatched types --> $DIR/issue-19109.rs:4:5 | -LL | fn function(t: &mut dyn Trait) { - | - help: try adding a return type: `-> *mut dyn Trait` LL | t as *mut dyn Trait | ^^^^^^^^^^^^^^^^^^^ expected `()`, found `*mut dyn Trait` | = note: expected unit type `()` found raw pointer `*mut dyn Trait` +help: try adding a return type + | +LL | fn function(t: &mut dyn Trait) -> *mut dyn Trait { + | +++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/ref-pat-suggestions.stderr b/tests/ui/mismatched_types/ref-pat-suggestions.stderr index 148ed00b01d14..d45fd8aea1c6a 100644 --- a/tests/ui/mismatched_types/ref-pat-suggestions.stderr +++ b/tests/ui/mismatched_types/ref-pat-suggestions.stderr @@ -314,10 +314,13 @@ LL | let &mut _a = 0; | ^^^^^^^ - this expression has type `{integer}` | | | expected integer, found `&mut _` - | help: to declare a mutable variable use: `mut _a` | = note: expected type `{integer}` found mutable reference `&mut _` +help: to declare a mutable variable use + | +LL | let mut _a = 0; + | ~~~~~~ error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:30:15 diff --git a/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index 6e7bf5eb46d92..2e544a62223a0 100644 --- a/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -2,10 +2,7 @@ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/trait-impl-fn-incompatibility.rs:9:15 | LL | fn foo(x: i16) { } - | ^^^ - | | - | expected `u16`, found `i16` - | help: change the parameter type to match the trait: `u16` + | ^^^ expected `u16`, found `i16` | note: type in trait --> $DIR/trait-impl-fn-incompatibility.rs:2:15 @@ -14,15 +11,16 @@ LL | fn foo(x: u16); | ^^^ = note: expected signature `fn(u16)` found signature `fn(i16)` +help: change the parameter type to match the trait + | +LL | fn foo(x: u16) { } + | ~~~ error[E0053]: method `bar` has an incompatible type for trait --> $DIR/trait-impl-fn-incompatibility.rs:10:28 | LL | fn bar(&mut self, bar: &Bar) { } - | ^^^^ - | | - | types differ in mutability - | help: change the parameter type to match the trait: `&mut Bar` + | ^^^^ types differ in mutability | note: type in trait --> $DIR/trait-impl-fn-incompatibility.rs:3:28 @@ -31,6 +29,10 @@ LL | fn bar(&mut self, bar: &mut Bar); | ^^^^^^^^ = note: expected signature `fn(&mut Bar, &mut Bar)` found signature `fn(&mut Bar, &Bar)` +help: change the parameter type to match the trait + | +LL | fn bar(&mut self, bar: &mut Bar) { } + | ~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/missing/missing-comma-in-match.stderr b/tests/ui/missing/missing-comma-in-match.stderr index 50f74eeb5ed08..1091b53024dac 100644 --- a/tests/ui/missing/missing-comma-in-match.stderr +++ b/tests/ui/missing/missing-comma-in-match.stderr @@ -1,10 +1,13 @@ error: expected one of `,`, `.`, `?`, `}`, or an operator, found `=>` --> $DIR/missing-comma-in-match.rs:6:18 | -LL | &None => 1 - | - help: missing a comma here to end this `match` arm LL | &Some(2) => { 3 } | ^^ expected one of `,`, `.`, `?`, `}`, or an operator + | +help: missing a comma here to end this `match` arm + | +LL | &None => 1, + | + error: aborting due to 1 previous error diff --git a/tests/ui/missing/missing-items/m2.stderr b/tests/ui/missing/missing-items/m2.stderr index c552abccee421..1c3a10b6b0ec0 100644 --- a/tests/ui/missing/missing-items/m2.stderr +++ b/tests/ui/missing/missing-items/m2.stderr @@ -4,13 +4,34 @@ error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `met LL | impl m1::X for X { | ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method`, `method2`, `method3`, `method4`, `method5` in implementation | - = help: implement the missing item: `const CONSTANT: u32 = 42;` - = help: implement the missing item: `type Type = /* Type */;` - = help: implement the missing item: `fn method(&self, _: String) -> ::Type { todo!() }` - = help: implement the missing item: `fn method2(self: Box, _: String) -> ::Type { todo!() }` - = help: implement the missing item: `fn method3(_: &Self, _: String) -> ::Type { todo!() }` - = help: implement the missing item: `fn method4(&self, _: &Self) -> ::Type { todo!() }` - = help: implement the missing item: `fn method5(self: &Box) -> ::Type { todo!() }` +help: implement the missing item + | +LL + const CONSTANT: u32 = 42; + | +help: implement the missing item + | +LL + type Type = /* Type */; + | +help: implement the missing item + | +LL + fn method(&self, _: String) -> ::Type { todo!() } + | +help: implement the missing item + | +LL + fn method2(self: Box, _: String) -> ::Type { todo!() } + | +help: implement the missing item + | +LL + fn method3(_: &Self, _: String) -> ::Type { todo!() } + | +help: implement the missing item + | +LL + fn method4(&self, _: &Self) -> ::Type { todo!() } + | +help: implement the missing item + | +LL + fn method5(self: &Box) -> ::Type { todo!() } + | error: aborting due to 1 previous error diff --git a/tests/ui/modules/path-invalid-form.stderr b/tests/ui/modules/path-invalid-form.stderr index e8ded1343f780..cc2bab0014331 100644 --- a/tests/ui/modules/path-invalid-form.stderr +++ b/tests/ui/modules/path-invalid-form.stderr @@ -2,7 +2,12 @@ error: malformed `path` attribute input --> $DIR/path-invalid-form.rs:1:1 | LL | #[path = 123] - | ^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]` + | ^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[path = "file"] + | ~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/modules/path-macro.stderr b/tests/ui/modules/path-macro.stderr index eb02c721edd32..004f62cac939c 100644 --- a/tests/ui/modules/path-macro.stderr +++ b/tests/ui/modules/path-macro.stderr @@ -2,7 +2,12 @@ error: malformed `path` attribute input --> $DIR/path-macro.rs:5:1 | LL | #[path = foo!()] - | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]` + | ^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[path = "file"] + | ~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/nested-ty-params.stderr b/tests/ui/nested-ty-params.stderr index a9cdec667199a..61cfd091d1497 100644 --- a/tests/ui/nested-ty-params.stderr +++ b/tests/ui/nested-ty-params.stderr @@ -4,9 +4,12 @@ error[E0401]: can't use generic parameters from outer item LL | fn hd(v: Vec ) -> U { | - type parameter from outer item LL | fn hd1(w: [U]) -> U { return w[0]; } - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | fn hd1(w: [U]) -> U { return w[0]; } + | +++ error[E0401]: can't use generic parameters from outer item --> $DIR/nested-ty-params.rs:3:23 @@ -14,9 +17,12 @@ error[E0401]: can't use generic parameters from outer item LL | fn hd(v: Vec ) -> U { | - type parameter from outer item LL | fn hd1(w: [U]) -> U { return w[0]; } - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | fn hd1(w: [U]) -> U { return w[0]; } + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/never_type/issue-52443.stderr b/tests/ui/never_type/issue-52443.stderr index 02cb9cb22a3f4..ec250b35f372c 100644 --- a/tests/ui/never_type/issue-52443.stderr +++ b/tests/ui/never_type/issue-52443.stderr @@ -2,9 +2,13 @@ warning: denote infinite loops with `loop { ... }` --> $DIR/issue-52443.rs:6:11 | LL | [(); {while true {break}; 0}]; - | ^^^^^^^^^^ help: use `loop` + | ^^^^^^^^^^ | = note: `#[warn(while_true)]` on by default +help: use `loop` + | +LL | [(); {loop {break}; 0}]; + | ~~~~ error[E0658]: `for` is not allowed in a `const` --> $DIR/issue-52443.rs:9:12 diff --git a/tests/ui/never_type/never-assign-dead-code.stderr b/tests/ui/never_type/never-assign-dead-code.stderr index 5660bde5c279b..3a51e55aa26ea 100644 --- a/tests/ui/never_type/never-assign-dead-code.stderr +++ b/tests/ui/never_type/never-assign-dead-code.stderr @@ -25,9 +25,13 @@ warning: unused variable: `x` --> $DIR/never-assign-dead-code.rs:10:9 | LL | let x: ! = panic!("aah"); - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ | = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _x: ! = panic!("aah"); + | ~~ warning: 3 warnings emitted diff --git a/tests/ui/nll/capture-mut-ref.stderr b/tests/ui/nll/capture-mut-ref.stderr index d76e031466d4f..1d77c39ebf2b4 100644 --- a/tests/ui/nll/capture-mut-ref.stderr +++ b/tests/ui/nll/capture-mut-ref.stderr @@ -2,15 +2,18 @@ error: variable does not need to be mutable --> $DIR/capture-mut-ref.rs:9:9 | LL | let mut x = &mut 0; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ | note: the lint level is defined here --> $DIR/capture-mut-ref.rs:6:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ +help: remove this `mut` + | +LL - let mut x = &mut 0; +LL + let x = &mut 0; + | error: aborting due to 1 previous error diff --git a/tests/ui/nll/issue-61424.stderr b/tests/ui/nll/issue-61424.stderr index 8dc66cbaef80f..034312be86c17 100644 --- a/tests/ui/nll/issue-61424.stderr +++ b/tests/ui/nll/issue-61424.stderr @@ -2,15 +2,18 @@ error: variable does not need to be mutable --> $DIR/issue-61424.rs:6:9 | LL | let mut x; - | ----^ - | | - | help: remove this `mut` + | ^^^^^ | note: the lint level is defined here --> $DIR/issue-61424.rs:3:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ +help: remove this `mut` + | +LL - let mut x; +LL + let x; + | error: aborting due to 1 previous error diff --git a/tests/ui/nll/unused-mut-issue-50343.stderr b/tests/ui/nll/unused-mut-issue-50343.stderr index 582ca17cccc53..da5b0b9fc6412 100644 --- a/tests/ui/nll/unused-mut-issue-50343.stderr +++ b/tests/ui/nll/unused-mut-issue-50343.stderr @@ -2,15 +2,18 @@ error: variable does not need to be mutable --> $DIR/unused-mut-issue-50343.rs:7:33 | LL | vec![(42, 22)].iter().map(|(mut x, _y)| ()).count(); - | ----^ - | | - | help: remove this `mut` + | ^^^^^ | note: the lint level is defined here --> $DIR/unused-mut-issue-50343.rs:3:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ +help: remove this `mut` + | +LL - vec![(42, 22)].iter().map(|(mut x, _y)| ()).count(); +LL + vec![(42, 22)].iter().map(|(x, _y)| ()).count(); + | error: aborting due to 1 previous error diff --git a/tests/ui/nll/user-annotations/region-error-ice-109072.stderr b/tests/ui/nll/user-annotations/region-error-ice-109072.stderr index c187c17d98c68..858156f544ad2 100644 --- a/tests/ui/nll/user-annotations/region-error-ice-109072.stderr +++ b/tests/ui/nll/user-annotations/region-error-ice-109072.stderr @@ -2,9 +2,12 @@ error[E0261]: use of undeclared lifetime name `'missing` --> $DIR/region-error-ice-109072.rs:8:9 | LL | impl Lt<'missing> for () { - | - ^^^^^^^^ undeclared lifetime - | | - | help: consider introducing lifetime `'missing` here: `<'missing>` + | ^^^^^^^^ undeclared lifetime + | +help: consider introducing lifetime `'missing` here + | +LL | impl<'missing> Lt<'missing> for () { + | ++++++++++ error[E0261]: use of undeclared lifetime name `'missing` --> $DIR/region-error-ice-109072.rs:9:15 diff --git a/tests/ui/no_crate_type.stderr b/tests/ui/no_crate_type.stderr index 85d8f87afa673..e81b36c9c1eb8 100644 --- a/tests/ui/no_crate_type.stderr +++ b/tests/ui/no_crate_type.stderr @@ -2,7 +2,12 @@ error: malformed `crate_type` attribute input --> $DIR/no_crate_type.rs:2:1 | LL | #![crate_type] - | ^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "bin|lib|..."]` + | ^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #![crate_type = "bin|lib|..."] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/non-fmt-panic.stderr b/tests/ui/non-fmt-panic.stderr index 162802b7f610a..b36927ce7471f 100644 --- a/tests/ui/non-fmt-panic.stderr +++ b/tests/ui/non-fmt-panic.stderr @@ -381,12 +381,14 @@ warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:72:12 | LL | panic!(v); - | ------ ^ - | | - | help: use std::panic::panic_any instead: `std::panic::panic_any` + | ^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 = note: for more information, see +help: use std::panic::panic_any instead + | +LL | std::panic::panic_any(v); + | ~~~~~~~~~~~~~~~~~~~~~ warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:73:20 diff --git a/tests/ui/nonscalar-cast.stderr b/tests/ui/nonscalar-cast.stderr index 01b4a9a7ce026..be271e264d1a8 100644 --- a/tests/ui/nonscalar-cast.stderr +++ b/tests/ui/nonscalar-cast.stderr @@ -2,9 +2,13 @@ error[E0605]: non-primitive cast: `Foo` as `isize` --> $DIR/nonscalar-cast.rs:15:20 | LL | println!("{}", Foo { x: 1 } as isize); - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using the `From` trait instead: `isize::from(Foo { x: 1 })` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object +help: consider using the `From` trait instead + | +LL | println!("{}", isize::from(Foo { x: 1 })); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/numeric/numeric-fields.stderr b/tests/ui/numeric/numeric-fields.stderr index 668405ed638c1..6064d1fd1e35d 100644 --- a/tests/ui/numeric/numeric-fields.stderr +++ b/tests/ui/numeric/numeric-fields.stderr @@ -16,10 +16,12 @@ error[E0026]: struct `S` does not have a field named `0x1` --> $DIR/numeric-fields.rs:7:17 | LL | S{0: a, 0x1: b, ..} => {} - | ^^^ - | | - | struct `S` does not have this field - | help: `S` has a field named `1` + | ^^^ struct `S` does not have this field + | +help: `S` has a field named `1` + | +LL | S{0: a, 1: b, ..} => {} + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/numeric/uppercase-base-prefix.stderr b/tests/ui/numeric/uppercase-base-prefix.stderr index 4ba8d5224b3e6..a46bbdabab3d8 100644 --- a/tests/ui/numeric/uppercase-base-prefix.stderr +++ b/tests/ui/numeric/uppercase-base-prefix.stderr @@ -2,97 +2,145 @@ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:6:13 | LL | let a = 0XABCDEF; - | ^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0xABCDEF` + | ^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase (notice the capitalization difference) + | +LL | let a = 0xABCDEF; + | ~~~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:12:13 | LL | let b = 0O755; - | ^^^^^ help: try making the prefix lowercase (notice the capitalization): `0o755` + | ^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase (notice the capitalization difference) + | +LL | let b = 0o755; + | ~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:18:13 | LL | let c = 0B10101010; - | ^^^^^^^^^^ help: try making the prefix lowercase: `0b10101010` + | ^^^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase + | +LL | let c = 0b10101010; + | ~~~~~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:24:13 | LL | let d = 0XABC_DEF; - | ^^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0xABC_DEF` + | ^^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase (notice the capitalization difference) + | +LL | let d = 0xABC_DEF; + | ~~~~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:30:13 | LL | let e = 0O7_55; - | ^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0o7_55` + | ^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase (notice the capitalization difference) + | +LL | let e = 0o7_55; + | ~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:36:13 | LL | let f = 0B1010_1010; - | ^^^^^^^^^^^ help: try making the prefix lowercase: `0b1010_1010` + | ^^^^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase + | +LL | let f = 0b1010_1010; + | ~~~~~~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:42:13 | LL | let g = 0XABC_DEF_u64; - | ^^^^^^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0xABC_DEF_u64` + | ^^^^^^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase (notice the capitalization difference) + | +LL | let g = 0xABC_DEF_u64; + | ~~~~~~~~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:48:13 | LL | let h = 0O7_55_u32; - | ^^^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0o7_55_u32` + | ^^^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase (notice the capitalization difference) + | +LL | let h = 0o7_55_u32; + | ~~~~~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:54:13 | LL | let i = 0B1010_1010_u8; - | ^^^^^^^^^^^^^^ help: try making the prefix lowercase: `0b1010_1010_u8` + | ^^^^^^^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase + | +LL | let i = 0b1010_1010_u8; + | ~~~~~~~~~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:60:13 | LL | let j = 0XABCDEFu64; - | ^^^^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0xABCDEFu64` + | ^^^^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase (notice the capitalization difference) + | +LL | let j = 0xABCDEFu64; + | ~~~~~~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:66:13 | LL | let k = 0O755u32; - | ^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0o755u32` + | ^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase (notice the capitalization difference) + | +LL | let k = 0o755u32; + | ~~~~~~~~ error: invalid base prefix for number literal --> $DIR/uppercase-base-prefix.rs:72:13 | LL | let l = 0B10101010u8; - | ^^^^^^^^^^^^ help: try making the prefix lowercase: `0b10101010u8` + | ^^^^^^^^^^^^ | = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase +help: try making the prefix lowercase + | +LL | let l = 0b10101010u8; + | ~~~~~~~~~~~~ error: aborting due to 12 previous errors diff --git a/tests/ui/object-lifetime/object-lifetime-default-from-box-error.stderr b/tests/ui/object-lifetime/object-lifetime-default-from-box-error.stderr index 15b36925c47b5..17a11e9c646aa 100644 --- a/tests/ui/object-lifetime/object-lifetime-default-from-box-error.stderr +++ b/tests/ui/object-lifetime/object-lifetime-default-from-box-error.stderr @@ -21,11 +21,13 @@ LL | ss.r error[E0621]: explicit lifetime required in the type of `ss` --> $DIR/object-lifetime-default-from-box-error.rs:33:5 | -LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { - | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` -... LL | ss.r = b; | ^^^^ lifetime `'b` required + | +help: add explicit lifetime `'b` to the type of `ss` + | +LL | fn store1<'b>(ss: &mut SomeStruct<'b>, b: Box) { + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/object-safety/assoc_type_bounds.stderr b/tests/ui/object-safety/assoc_type_bounds.stderr index 3d5482625af3e..ce68bd353bada 100644 --- a/tests/ui/object-safety/assoc_type_bounds.stderr +++ b/tests/ui/object-safety/assoc_type_bounds.stderr @@ -5,7 +5,12 @@ LL | type Bar | -------- `Bar` defined here ... LL | fn foo(_: &dyn Foo<()>) {} - | ^^^^^^^ help: specify the associated type: `Foo<(), Bar = Type>` + | ^^^^^^^ + | +help: specify the associated type + | +LL | fn foo(_: &dyn Foo<(), Bar = Type>) {} + | ~~~~~~~~~~~~~~~~~~~ error[E0191]: the value of the associated type `Bar` in `Foo` must be specified --> $DIR/assoc_type_bounds.rs:11:16 @@ -14,7 +19,12 @@ LL | type Bar | -------- `Bar` defined here ... LL | fn bar(_: &dyn Foo) {} - | ^^^^^^^^ help: specify the associated type: `Foo` + | ^^^^^^^^ + | +help: specify the associated type + | +LL | fn bar(_: &dyn Foo) {} + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/object-safety/assoc_type_bounds2.stderr b/tests/ui/object-safety/assoc_type_bounds2.stderr index 815747436bf0d..7d6505072db12 100644 --- a/tests/ui/object-safety/assoc_type_bounds2.stderr +++ b/tests/ui/object-safety/assoc_type_bounds2.stderr @@ -5,7 +5,12 @@ LL | type Bar | -------- `Bar` defined here ... LL | fn foo(_: &dyn Foo<()>) {} - | ^^^^^^^ help: specify the associated type: `Foo<(), Bar = Type>` + | ^^^^^^^ + | +help: specify the associated type + | +LL | fn foo(_: &dyn Foo<(), Bar = Type>) {} + | ~~~~~~~~~~~~~~~~~~~ error[E0191]: the value of the associated type `Bar` in `Foo` must be specified --> $DIR/assoc_type_bounds2.rs:11:16 @@ -14,7 +19,12 @@ LL | type Bar | -------- `Bar` defined here ... LL | fn bar(_: &dyn Foo) {} - | ^^^^^^^^ help: specify the associated type: `Foo` + | ^^^^^^^^ + | +help: specify the associated type + | +LL | fn bar(_: &dyn Foo) {} + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr index 5438faaaf0546..722dac8a02db2 100644 --- a/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr +++ b/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr @@ -5,7 +5,12 @@ LL | type Bop; | -------- `Bop` defined here ... LL | fn foo(_: &dyn Foo) {} - | ^^^ help: specify the associated type: `Foo` + | ^^^ + | +help: specify the associated type + | +LL | fn foo(_: &dyn Foo) {} + | ~~~~~~~~~~~~~~~ error[E0191]: the value of the associated type `Bop` in `Bar` must be specified --> $DIR/assoc_type_bounds_sized_others.rs:22:16 @@ -14,7 +19,12 @@ LL | type Bop; | -------- `Bop` defined here ... LL | fn bar(_: &dyn Bar) {} - | ^^^ help: specify the associated type: `Bar` + | ^^^ + | +help: specify the associated type + | +LL | fn bar(_: &dyn Bar) {} + | ~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr index 7cd6175a5ad6a..60eb4ed73bb91 100644 --- a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr +++ b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr @@ -2,10 +2,15 @@ warning: unnecessary associated type bound for not object safe associated type --> $DIR/assoc_type_bounds_sized_unnecessary.rs:9:20 | LL | fn foo(_: &dyn Foo) {} - | ^^^^^^^^ help: remove this bound + | ^^^^^^^^ | = note: this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized` = note: `#[warn(unused_associated_type_bounds)]` on by default +help: remove this bound + | +LL - fn foo(_: &dyn Foo) {} +LL + fn foo(_: &dyn Foo<>) {} + | warning: 1 warning emitted diff --git a/tests/ui/object-safety/avoid-ice-on-warning.new.stderr b/tests/ui/object-safety/avoid-ice-on-warning.new.stderr index 517f910080de7..4ff45d7a84858 100644 --- a/tests/ui/object-safety/avoid-ice-on-warning.new.stderr +++ b/tests/ui/object-safety/avoid-ice-on-warning.new.stderr @@ -2,7 +2,12 @@ error: return types are denoted using `->` --> $DIR/avoid-ice-on-warning.rs:4:23 | LL | fn call_this(f: F) : Fn(&str) + call_that {} - | ^ help: use `->` instead + | ^ + | +help: use `->` instead + | +LL | fn call_this(f: F) -> Fn(&str) + call_that {} + | ~~ error[E0405]: cannot find trait `call_that` in this scope --> $DIR/avoid-ice-on-warning.rs:4:36 diff --git a/tests/ui/object-safety/avoid-ice-on-warning.old.stderr b/tests/ui/object-safety/avoid-ice-on-warning.old.stderr index 3939c06eabe5b..de45ec8c405a3 100644 --- a/tests/ui/object-safety/avoid-ice-on-warning.old.stderr +++ b/tests/ui/object-safety/avoid-ice-on-warning.old.stderr @@ -2,7 +2,12 @@ error: return types are denoted using `->` --> $DIR/avoid-ice-on-warning.rs:4:23 | LL | fn call_this(f: F) : Fn(&str) + call_that {} - | ^ help: use `->` instead + | ^ + | +help: use `->` instead + | +LL | fn call_this(f: F) -> Fn(&str) + call_that {} + | ~~ error[E0405]: cannot find trait `call_that` in this scope --> $DIR/avoid-ice-on-warning.rs:4:36 diff --git a/tests/ui/object-safety/issue-102762.stderr b/tests/ui/object-safety/issue-102762.stderr index e746628aa3774..f626272242608 100644 --- a/tests/ui/object-safety/issue-102762.stderr +++ b/tests/ui/object-safety/issue-102762.stderr @@ -1,9 +1,6 @@ error[E0038]: the trait `Fetcher` cannot be made into an object --> $DIR/issue-102762.rs:18:21 | -LL | fn get<'a>(self: &'a Box) -> Pin> + 'a>> - | ------------- help: consider changing method `get`'s `self` parameter to be `&self`: `&Self` -... LL | fn fetcher() -> Box { | ^^^^^^^^^^^ `Fetcher` cannot be made into an object | @@ -14,13 +11,14 @@ LL | pub trait Fetcher: Send + Sync { | ------- this trait cannot be made into an object... LL | fn get<'a>(self: &'a Box) -> Pin> + 'a>> | ^^^^^^^^^^^^^ ...because method `get`'s `self` parameter cannot be dispatched on +help: consider changing method `get`'s `self` parameter to be `&self` + | +LL | fn get<'a>(self: &Self) -> Pin> + 'a>> + | ~~~~~ error[E0038]: the trait `Fetcher` cannot be made into an object --> $DIR/issue-102762.rs:24:19 | -LL | fn get<'a>(self: &'a Box) -> Pin> + 'a>> - | ------------- help: consider changing method `get`'s `self` parameter to be `&self`: `&Self` -... LL | let fetcher = fetcher(); | ^^^^^^^^^ `Fetcher` cannot be made into an object | @@ -31,13 +29,14 @@ LL | pub trait Fetcher: Send + Sync { | ------- this trait cannot be made into an object... LL | fn get<'a>(self: &'a Box) -> Pin> + 'a>> | ^^^^^^^^^^^^^ ...because method `get`'s `self` parameter cannot be dispatched on +help: consider changing method `get`'s `self` parameter to be `&self` + | +LL | fn get<'a>(self: &Self) -> Pin> + 'a>> + | ~~~~~ error[E0038]: the trait `Fetcher` cannot be made into an object --> $DIR/issue-102762.rs:26:13 | -LL | fn get<'a>(self: &'a Box) -> Pin> + 'a>> - | ------------- help: consider changing method `get`'s `self` parameter to be `&self`: `&Self` -... LL | let _ = fetcher.get(); | ^^^^^^^^^^^^^ `Fetcher` cannot be made into an object | @@ -48,6 +47,10 @@ LL | pub trait Fetcher: Send + Sync { | ------- this trait cannot be made into an object... LL | fn get<'a>(self: &'a Box) -> Pin> + 'a>> | ^^^^^^^^^^^^^ ...because method `get`'s `self` parameter cannot be dispatched on +help: consider changing method `get`'s `self` parameter to be `&self` + | +LL | fn get<'a>(self: &Self) -> Pin> + 'a>> + | ~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/offset-of/offset-of-enum.stderr b/tests/ui/offset-of/offset-of-enum.stderr index 7e7ad41f5b6a9..386f4d0887f12 100644 --- a/tests/ui/offset-of/offset-of-enum.stderr +++ b/tests/ui/offset-of/offset-of-enum.stderr @@ -2,10 +2,12 @@ error[E0573]: expected type, found variant `Alpha::One` --> $DIR/offset-of-enum.rs:11:16 | LL | offset_of!(Alpha::One, 0); - | ^^^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `Alpha` + | ^^^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | offset_of!(Alpha, 0); + | ~~~~~ error[E0412]: cannot find type `Beta` in this scope --> $DIR/offset-of-enum.rs:17:16 diff --git a/tests/ui/operator-recovery/less-than-greater-than.stderr b/tests/ui/operator-recovery/less-than-greater-than.stderr index 21b2e77db9aa5..36a4a81035f1e 100644 --- a/tests/ui/operator-recovery/less-than-greater-than.stderr +++ b/tests/ui/operator-recovery/less-than-greater-than.stderr @@ -2,7 +2,12 @@ error: invalid comparison operator `<>` --> $DIR/less-than-greater-than.rs:2:22 | LL | println!("{}", 1 <> 2); - | ^^ help: `<>` is not a valid comparison operator, use `!=` + | ^^ + | +help: `<>` is not a valid comparison operator, use `!=` + | +LL | println!("{}", 1 != 2); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/or-patterns/fn-param-wrap-parens.stderr b/tests/ui/or-patterns/fn-param-wrap-parens.stderr index 1b9614a13782b..25d0327170447 100644 --- a/tests/ui/or-patterns/fn-param-wrap-parens.stderr +++ b/tests/ui/or-patterns/fn-param-wrap-parens.stderr @@ -2,7 +2,12 @@ error: top-level or-patterns are not allowed in function parameters --> $DIR/fn-param-wrap-parens.rs:13:9 | LL | fn fun1(A | B: E) {} - | ^^^^^ help: wrap the pattern in parentheses: `(A | B)` + | ^^^^^ + | +help: wrap the pattern in parentheses + | +LL | fn fun1((A | B): E) {} + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/or-patterns/issue-64879-trailing-before-guard.stderr b/tests/ui/or-patterns/issue-64879-trailing-before-guard.stderr index 9b827794f5be5..91db3d049f629 100644 --- a/tests/ui/or-patterns/issue-64879-trailing-before-guard.stderr +++ b/tests/ui/or-patterns/issue-64879-trailing-before-guard.stderr @@ -4,7 +4,13 @@ error: a trailing `|` is not allowed in an or-pattern LL | E::A | | ---- while parsing this or-pattern starting here LL | E::B | - | ^ help: remove the `|` + | ^ + | +help: remove the `|` + | +LL - E::B | +LL + E::B + | error[E0308]: mismatched types --> $DIR/issue-64879-trailing-before-guard.rs:12:42 diff --git a/tests/ui/or-patterns/missing-bindings.stderr b/tests/ui/or-patterns/missing-bindings.stderr index 677b40a7f0dc1..5156c35388711 100644 --- a/tests/ui/or-patterns/missing-bindings.stderr +++ b/tests/ui/or-patterns/missing-bindings.stderr @@ -249,7 +249,12 @@ error[E0170]: pattern binding `beta` is named the same as one of the variants of --> $DIR/missing-bindings.rs:22:22 | LL | Some(alpha | beta) => {} - | ^^^^ help: to match on the variant, qualify the path: `check_handling_of_paths::bar::foo::beta` + | ^^^^ + | +help: to match on the variant, qualify the path + | +LL | Some(alpha | check_handling_of_paths::bar::foo::beta) => {} + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0004]: non-exhaustive patterns: `None` not covered --> $DIR/missing-bindings.rs:21:11 diff --git a/tests/ui/or-patterns/multiple-pattern-typo.stderr b/tests/ui/or-patterns/multiple-pattern-typo.stderr index b0a82b3673b83..2e66f54979b03 100644 --- a/tests/ui/or-patterns/multiple-pattern-typo.stderr +++ b/tests/ui/or-patterns/multiple-pattern-typo.stderr @@ -2,55 +2,90 @@ error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:7:15 | LL | 1 | 2 || 3 => (), - | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | - ^^ | | | while parsing this or-pattern starting here + | +help: use a single `|` to separate multiple alternative patterns + | +LL | 1 | 2 | 3 => (), + | ~ error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:12:16 | LL | (1 | 2 || 3) => (), - | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | - ^^ | | | while parsing this or-pattern starting here + | +help: use a single `|` to separate multiple alternative patterns + | +LL | (1 | 2 | 3) => (), + | ~ error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:17:16 | LL | (1 | 2 || 3,) => (), - | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | - ^^ | | | while parsing this or-pattern starting here + | +help: use a single `|` to separate multiple alternative patterns + | +LL | (1 | 2 | 3,) => (), + | ~ error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:24:18 | LL | TS(1 | 2 || 3) => (), - | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | - ^^ | | | while parsing this or-pattern starting here + | +help: use a single `|` to separate multiple alternative patterns + | +LL | TS(1 | 2 | 3) => (), + | ~ error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:31:23 | LL | NS { f: 1 | 2 || 3 } => (), - | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | - ^^ | | | while parsing this or-pattern starting here + | +help: use a single `|` to separate multiple alternative patterns + | +LL | NS { f: 1 | 2 | 3 } => (), + | ~ error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:36:16 | LL | [1 | 2 || 3] => (), - | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | - ^^ | | | while parsing this or-pattern starting here + | +help: use a single `|` to separate multiple alternative patterns + | +LL | [1 | 2 | 3] => (), + | ~ error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:41:9 | LL | || 1 | 2 | 3 => (), - | ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | ^^ + | +help: use a single `|` to separate multiple alternative patterns + | +LL | | 1 | 2 | 3 => (), + | ~ error: aborting due to 7 previous errors diff --git a/tests/ui/or-patterns/nested-undelimited-precedence.stderr b/tests/ui/or-patterns/nested-undelimited-precedence.stderr index 5a63e621f4a3a..c069368b05ed1 100644 --- a/tests/ui/or-patterns/nested-undelimited-precedence.stderr +++ b/tests/ui/or-patterns/nested-undelimited-precedence.stderr @@ -2,31 +2,56 @@ error: top-level or-patterns are not allowed in `let` bindings --> $DIR/nested-undelimited-precedence.rs:19:9 | LL | let b @ A | B: E = A; - | ^^^^^^^^^ help: wrap the pattern in parentheses: `(b @ A | B)` + | ^^^^^^^^^ + | +help: wrap the pattern in parentheses + | +LL | let (b @ A | B): E = A; + | ~~~~~~~~~~~ error: top-level or-patterns are not allowed in `let` bindings --> $DIR/nested-undelimited-precedence.rs:34:9 | LL | let &A(_) | B(_): F = A(3); - | ^^^^^^^^^^^^ help: wrap the pattern in parentheses: `(&A(_) | B(_))` + | ^^^^^^^^^^^^ + | +help: wrap the pattern in parentheses + | +LL | let (&A(_) | B(_)): F = A(3); + | ~~~~~~~~~~~~~~ error: top-level or-patterns are not allowed in `let` bindings --> $DIR/nested-undelimited-precedence.rs:36:9 | LL | let &&A(_) | B(_): F = A(3); - | ^^^^^^^^^^^^^ help: wrap the pattern in parentheses: `(&&A(_) | B(_))` + | ^^^^^^^^^^^^^ + | +help: wrap the pattern in parentheses + | +LL | let (&&A(_) | B(_)): F = A(3); + | ~~~~~~~~~~~~~~~ error: top-level or-patterns are not allowed in `let` bindings --> $DIR/nested-undelimited-precedence.rs:38:9 | LL | let &mut A(_) | B(_): F = A(3); - | ^^^^^^^^^^^^^^^^ help: wrap the pattern in parentheses: `(&mut A(_) | B(_))` + | ^^^^^^^^^^^^^^^^ + | +help: wrap the pattern in parentheses + | +LL | let (&mut A(_) | B(_)): F = A(3); + | ~~~~~~~~~~~~~~~~~~ error: top-level or-patterns are not allowed in `let` bindings --> $DIR/nested-undelimited-precedence.rs:40:9 | LL | let &&mut A(_) | B(_): F = A(3); - | ^^^^^^^^^^^^^^^^^ help: wrap the pattern in parentheses: `(&&mut A(_) | B(_))` + | ^^^^^^^^^^^^^^^^^ + | +help: wrap the pattern in parentheses + | +LL | let (&&mut A(_) | B(_)): F = A(3); + | ~~~~~~~~~~~~~~~~~~~ error[E0408]: variable `b` is not bound in all patterns --> $DIR/nested-undelimited-precedence.rs:19:17 diff --git a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr index e09194d5d3976..be1b7f48ed147 100644 --- a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr +++ b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr @@ -16,25 +16,45 @@ error: top-level or-patterns are not allowed in function parameters --> $DIR/or-patterns-syntactic-fail.rs:18:13 | LL | fn fun1(A | B: E) {} - | ^^^^^ help: wrap the pattern in parentheses: `(A | B)` + | ^^^^^ + | +help: wrap the pattern in parentheses + | +LL | fn fun1((A | B): E) {} + | ~~~~~~~ error: top-level or-patterns are not allowed in function parameters --> $DIR/or-patterns-syntactic-fail.rs:21:13 | LL | fn fun2(| A | B: E) {} - | ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)` + | ^^^^^^^ + | +help: wrap the pattern in parentheses + | +LL | fn fun2((A | B): E) {} + | ~~~~~~~ error: top-level or-patterns are not allowed in `let` bindings --> $DIR/or-patterns-syntactic-fail.rs:26:9 | LL | let A | B: E = A; - | ^^^^^ help: wrap the pattern in parentheses: `(A | B)` + | ^^^^^ + | +help: wrap the pattern in parentheses + | +LL | let (A | B): E = A; + | ~~~~~~~ error: top-level or-patterns are not allowed in `let` bindings --> $DIR/or-patterns-syntactic-fail.rs:29:9 | LL | let | A | B: E = A; - | ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)` + | ^^^^^^^ + | +help: wrap the pattern in parentheses + | +LL | let (A | B): E = A; + | ~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/or-patterns/remove-leading-vert.stderr b/tests/ui/or-patterns/remove-leading-vert.stderr index af51c67e1c8ba..28a2541f9dfb9 100644 --- a/tests/ui/or-patterns/remove-leading-vert.stderr +++ b/tests/ui/or-patterns/remove-leading-vert.stderr @@ -2,161 +2,278 @@ error: top-level or-patterns are not allowed in function parameters --> $DIR/remove-leading-vert.rs:11:14 | LL | fn fun1( | A: E) {} - | ^^^ help: remove the `|`: `A` + | ^^^ + | +help: remove the `|` + | +LL | fn fun1( A: E) {} + | ~ error: unexpected `||` before function parameter --> $DIR/remove-leading-vert.rs:12:14 | LL | fn fun2( || A: E) {} - | ^^ help: remove the `||` + | ^^ | = note: alternatives in or-patterns are separated with `|`, not `||` +help: remove the `||` + | +LL - fn fun2( || A: E) {} +LL + fn fun2( A: E) {} + | error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:14:11 | LL | let ( || A): (E); - | ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | ^^ + | +help: use a single `|` to separate multiple alternative patterns + | +LL | let ( | A): (E); + | ~ error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:17:11 | LL | let [ || A ]: [E; 1]; - | ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | ^^ + | +help: use a single `|` to separate multiple alternative patterns + | +LL | let [ | A ]: [E; 1]; + | ~ error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:19:13 | LL | let TS( || A ): TS; - | ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | ^^ + | +help: use a single `|` to separate multiple alternative patterns + | +LL | let TS( | A ): TS; + | ~ error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:21:17 | LL | let NS { f: || A }: NS; - | ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | ^^ + | +help: use a single `|` to separate multiple alternative patterns + | +LL | let NS { f: | A }: NS; + | ~ error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:26:13 | LL | let ( A | ): E; - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - let ( A | ): E; +LL + let ( A ): E; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:27:12 | LL | let (a |,): (E,); - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - let (a |,): (E,); +LL + let (a ,): (E,); + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:28:17 | LL | let ( A | B | ): E; - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - let ( A | B | ): E; +LL + let ( A | B ): E; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:29:17 | LL | let [ A | B | ]: [E; 1]; - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - let [ A | B | ]: [E; 1]; +LL + let [ A | B ]: [E; 1]; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:30:18 | LL | let S { f: B | }; - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - let S { f: B | }; +LL + let S { f: B }; + | error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:31:13 | LL | let ( A || B | ): E; - | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | - ^^ | | | while parsing this or-pattern starting here + | +help: use a single `|` to separate multiple alternative patterns + | +LL | let ( A | B | ): E; + | ~ error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:31:18 | LL | let ( A || B | ): E; - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - let ( A || B | ): E; +LL + let ( A || B ): E; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:34:11 | LL | A | => {} - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - A | => {} +LL + A => {} + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:35:11 | LL | A || => {} - | - ^^ help: remove the `||` + | - ^^ | | | while parsing this or-pattern starting here | = note: alternatives in or-patterns are separated with `|`, not `||` +help: remove the `||` + | +LL - A || => {} +LL + A => {} + | error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:36:11 | LL | A || B | => {} - | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` + | - ^^ | | | while parsing this or-pattern starting here + | +help: use a single `|` to separate multiple alternative patterns + | +LL | A | B | => {} + | ~ error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:36:16 | LL | A || B | => {} - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - A || B | => {} +LL + A || B => {} + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:38:17 | LL | | A | B | => {} - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - | A | B | => {} +LL + | A | B => {} + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:45:11 | LL | let a | : u8 = 0; - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - let a | : u8 = 0; +LL + let a : u8 = 0; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:46:11 | LL | let a | = 0; - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - let a | = 0; +LL + let a = 0; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:47:11 | LL | let a | ; - | - ^ help: remove the `|` + | - ^ | | | while parsing this or-pattern starting here + | +help: remove the `|` + | +LL - let a | ; +LL + let a ; + | error: aborting due to 21 previous errors diff --git a/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr index cc21df77353f5..ebb98ec88d028 100644 --- a/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr +++ b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr @@ -122,49 +122,71 @@ error: associated constant in `impl` without body --> $DIR/assoc-static-semantic-fail.rs:12:5 | LL | static IB: u8; - | ^^^^^^^^^^^^^- - | | - | help: provide a definition for the constant: `= ;` + | ^^^^^^^^^^^^^^ + | +help: provide a definition for the constant + | +LL | static IB: u8 = ; + | ~~~~~~~~~ error: associated constant in `impl` without body --> $DIR/assoc-static-semantic-fail.rs:18:5 | LL | pub(crate) default static ID: u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the constant: `= ;` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the constant + | +LL | pub(crate) default static ID: u8 = ; + | ~~~~~~~~~ error[E0449]: visibility qualifiers are not permitted here --> $DIR/assoc-static-semantic-fail.rs:32:5 | LL | pub(crate) default static TD: u8; - | ^^^^^^^^^^ help: remove the qualifier + | ^^^^^^^^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub(crate) default static TD: u8; +LL + default static TD: u8; + | error: associated constant in `impl` without body --> $DIR/assoc-static-semantic-fail.rs:41:5 | LL | static TB: u8; - | ^^^^^^^^^^^^^- - | | - | help: provide a definition for the constant: `= ;` + | ^^^^^^^^^^^^^^ + | +help: provide a definition for the constant + | +LL | static TB: u8 = ; + | ~~~~~~~~~ error: associated constant in `impl` without body --> $DIR/assoc-static-semantic-fail.rs:47:5 | LL | pub default static TD: u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the constant: `= ;` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the constant + | +LL | pub default static TD: u8 = ; + | ~~~~~~~~~ error[E0449]: visibility qualifiers are not permitted here --> $DIR/assoc-static-semantic-fail.rs:47:5 | LL | pub default static TD: u8; - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub default static TD: u8; +LL + default static TD: u8; + | warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/assoc-static-semantic-fail.rs:3:12 diff --git a/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr index 3593c5182ce9f..e658ab29a9e2b 100644 --- a/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr +++ b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr @@ -154,9 +154,14 @@ error: outer attributes are not allowed on `if` and `else` branches | LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch - | | | - | | help: remove the attributes + | | | the branch belongs to this `if` + | +help: remove the attributes + | +LL - #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } +LL + #[cfg(FALSE)] fn e() { let _ = if 0 {}; } + | error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:40:38 @@ -178,9 +183,14 @@ error: outer attributes are not allowed on `if` and `else` branches | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch - | | | - | | help: remove the attributes + | | | the branch belongs to this `else` + | +help: remove the attributes + | +LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } +LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else {}; } + | error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:46:46 @@ -196,18 +206,28 @@ error: outer attributes are not allowed on `if` and `else` branches | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | ---- ^^^^^^^ ------- the attributes are attached to this branch - | | | - | | help: remove the attributes + | | | the branch belongs to this `else` + | +help: remove the attributes + | +LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } +LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {}; } + | error: outer attributes are not allowed on `if` and `else` branches --> $DIR/attr-stmt-expr-attr-bad.rs:50:50 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch - | | | - | | help: remove the attributes + | | | the branch belongs to this `if` + | +help: remove the attributes + | +LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } +LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {}; } + | error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:52:51 @@ -223,9 +243,14 @@ error: outer attributes are not allowed on `if` and `else` branches | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch - | | | - | | help: remove the attributes + | | | the branch belongs to this `if` + | +help: remove the attributes + | +LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } +LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {}; } + | error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:56:46 @@ -247,9 +272,14 @@ error: outer attributes are not allowed on `if` and `else` branches | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch - | | | - | | help: remove the attributes + | | | the branch belongs to this `else` + | +help: remove the attributes + | +LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } +LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {}; } + | error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:62:54 @@ -265,18 +295,28 @@ error: outer attributes are not allowed on `if` and `else` branches | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } | ---- ^^^^^^^ --------------- the attributes are attached to this branch - | | | - | | help: remove the attributes + | | | the branch belongs to this `else` + | +help: remove the attributes + | +LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } +LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; } + | error: outer attributes are not allowed on `if` and `else` branches --> $DIR/attr-stmt-expr-attr-bad.rs:66:66 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch - | | | - | | help: remove the attributes + | | | the branch belongs to this `if` + | +help: remove the attributes + | +LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } +LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; } + | error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:68:67 @@ -361,9 +401,13 @@ error[E0586]: inclusive range with no end --> $DIR/attr-stmt-expr-attr-bad.rs:85:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] 10 => () } } + | ~~ error: expected one of `=>`, `if`, or `|`, found `#` --> $DIR/attr-stmt-expr-attr-bad.rs:85:38 @@ -375,9 +419,13 @@ error[E0586]: inclusive range with no end --> $DIR/attr-stmt-expr-attr-bad.rs:88:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] -10 => () } } + | ~~ error: expected one of `=>`, `if`, or `|`, found `#` --> $DIR/attr-stmt-expr-attr-bad.rs:88:38 @@ -395,9 +443,13 @@ error[E0586]: inclusive range with no end --> $DIR/attr-stmt-expr-attr-bad.rs:93:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] FOO => () } } + | ~~ error: expected one of `=>`, `if`, or `|`, found `#` --> $DIR/attr-stmt-expr-attr-bad.rs:93:38 diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index a22ddbac1b931..89253d7d4aacd 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -2,7 +2,12 @@ error: character constant must be escaped: `'` --> $DIR/bad-char-literals.rs:6:6 | LL | '''; - | ^ help: escape the character: `\'` + | ^ + | +help: escape the character + | +LL | '\''; + | ~~ error: character constant must be escaped: `\n` --> $DIR/bad-char-literals.rs:10:6 @@ -10,19 +15,34 @@ error: character constant must be escaped: `\n` LL | ' | ______^ LL | | '; - | |_ help: escape the character: `\n` + | |_ + | +help: escape the character + | +LL | '\n'; + | ++ error: character constant must be escaped: `\r` --> $DIR/bad-char-literals.rs:15:6 | LL | ' '; - | ^ help: escape the character: `\r` + | ^ + | +help: escape the character + | +LL | '\r'; + | ++ error: character constant must be escaped: `\t` --> $DIR/bad-char-literals.rs:18:6 | LL | ' '; - | ^^^^ help: escape the character: `\t` + | ^^^^ + | +help: escape the character + | +LL | '\t'; + | ++ error: aborting due to 4 previous errors diff --git a/tests/ui/parser/bad-fn-ptr-qualifier.stderr b/tests/ui/parser/bad-fn-ptr-qualifier.stderr index 265e31329ca54..523ee47b0c942 100644 --- a/tests/ui/parser/bad-fn-ptr-qualifier.stderr +++ b/tests/ui/parser/bad-fn-ptr-qualifier.stderr @@ -5,7 +5,12 @@ LL | pub type T0 = const fn(); | -----^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - pub type T0 = const fn(); +LL + pub type T0 = fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/bad-fn-ptr-qualifier.rs:6:15 @@ -14,7 +19,12 @@ LL | pub type T1 = const extern "C" fn(); | -----^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - pub type T1 = const extern "C" fn(); +LL + pub type T1 = extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/bad-fn-ptr-qualifier.rs:7:15 @@ -23,7 +33,12 @@ LL | pub type T2 = const unsafe extern fn(); | -----^^^^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - pub type T2 = const unsafe extern fn(); +LL + pub type T2 = unsafe extern fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/bad-fn-ptr-qualifier.rs:8:15 @@ -32,7 +47,12 @@ LL | pub type T3 = async fn(); | -----^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - pub type T3 = async fn(); +LL + pub type T3 = fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/bad-fn-ptr-qualifier.rs:9:15 @@ -41,7 +61,12 @@ LL | pub type T4 = async extern fn(); | -----^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - pub type T4 = async extern fn(); +LL + pub type T4 = extern fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/bad-fn-ptr-qualifier.rs:10:15 @@ -50,7 +75,12 @@ LL | pub type T5 = async unsafe extern "C" fn(); | -----^^^^^^^^^^^^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - pub type T5 = async unsafe extern "C" fn(); +LL + pub type T5 = unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/bad-fn-ptr-qualifier.rs:11:15 @@ -59,7 +89,12 @@ LL | pub type T6 = const async unsafe extern "C" fn(); | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - pub type T6 = const async unsafe extern "C" fn(); +LL + pub type T6 = async unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/bad-fn-ptr-qualifier.rs:11:15 @@ -68,7 +103,12 @@ LL | pub type T6 = const async unsafe extern "C" fn(); | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - pub type T6 = const async unsafe extern "C" fn(); +LL + pub type T6 = const unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/bad-fn-ptr-qualifier.rs:15:17 @@ -77,7 +117,12 @@ LL | pub type FTT0 = for<'a> const fn(); | ^^^^^^^^-----^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - pub type FTT0 = for<'a> const fn(); +LL + pub type FTT0 = for<'a> fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/bad-fn-ptr-qualifier.rs:16:17 @@ -86,7 +131,12 @@ LL | pub type FTT1 = for<'a> const extern "C" fn(); | ^^^^^^^^-----^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - pub type FTT1 = for<'a> const extern "C" fn(); +LL + pub type FTT1 = for<'a> extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/bad-fn-ptr-qualifier.rs:17:17 @@ -95,7 +145,12 @@ LL | pub type FTT2 = for<'a> const unsafe extern fn(); | ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - pub type FTT2 = for<'a> const unsafe extern fn(); +LL + pub type FTT2 = for<'a> unsafe extern fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/bad-fn-ptr-qualifier.rs:18:17 @@ -104,7 +159,12 @@ LL | pub type FTT3 = for<'a> async fn(); | ^^^^^^^^-----^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - pub type FTT3 = for<'a> async fn(); +LL + pub type FTT3 = for<'a> fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/bad-fn-ptr-qualifier.rs:19:17 @@ -113,7 +173,12 @@ LL | pub type FTT4 = for<'a> async extern fn(); | ^^^^^^^^-----^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - pub type FTT4 = for<'a> async extern fn(); +LL + pub type FTT4 = for<'a> extern fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/bad-fn-ptr-qualifier.rs:20:17 @@ -122,7 +187,12 @@ LL | pub type FTT5 = for<'a> async unsafe extern "C" fn(); | ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - pub type FTT5 = for<'a> async unsafe extern "C" fn(); +LL + pub type FTT5 = for<'a> unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/bad-fn-ptr-qualifier.rs:22:17 @@ -131,7 +201,12 @@ LL | pub type FTT6 = for<'a> const async unsafe extern "C" fn(); | ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - pub type FTT6 = for<'a> const async unsafe extern "C" fn(); +LL + pub type FTT6 = for<'a> async unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/bad-fn-ptr-qualifier.rs:22:17 @@ -140,7 +215,12 @@ LL | pub type FTT6 = for<'a> const async unsafe extern "C" fn(); | ^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - pub type FTT6 = for<'a> const async unsafe extern "C" fn(); +LL + pub type FTT6 = for<'a> const unsafe extern "C" fn(); + | error: aborting due to 16 previous errors diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index 5b414c8927e2c..25e319954418d 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -24,13 +24,23 @@ error: byte constant must be escaped: `\t` --> $DIR/byte-literals.rs:8:7 | LL | b' '; - | ^^^^ help: escape the character: `\t` + | ^^^^ + | +help: escape the character + | +LL | b'\t'; + | ++ error: byte constant must be escaped: `'` --> $DIR/byte-literals.rs:9:7 | LL | b'''; - | ^ help: escape the character: `\'` + | ^ + | +help: escape the character + | +LL | b'\''; + | ~~ error: non-ASCII character in byte literal --> $DIR/byte-literals.rs:10:7 diff --git a/tests/ui/parser/char/whitespace-character-literal.stderr b/tests/ui/parser/char/whitespace-character-literal.stderr index 3bd048f8f622b..f273b5d61d57f 100644 --- a/tests/ui/parser/char/whitespace-character-literal.stderr +++ b/tests/ui/parser/char/whitespace-character-literal.stderr @@ -2,15 +2,17 @@ error: character literal may only contain one codepoint --> $DIR/whitespace-character-literal.rs:5:30 | LL | let _hair_space_around = ' x​'; - | ^--^ - | | - | help: consider removing the non-printing characters: `x` + | ^^^^ | note: there are non-printing characters, the full sequence is `\u{200a}x\u{200b}` --> $DIR/whitespace-character-literal.rs:5:31 | LL | let _hair_space_around = ' x​'; | ^^ +help: consider removing the non-printing characters + | +LL | let _hair_space_around = 'x​'; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/default-on-wrong-item-kind.stderr b/tests/ui/parser/default-on-wrong-item-kind.stderr index af513f7617b09..392c85e0c43d7 100644 --- a/tests/ui/parser/default-on-wrong-item-kind.stderr +++ b/tests/ui/parser/default-on-wrong-item-kind.stderr @@ -154,11 +154,13 @@ error: extern items cannot be `const` --> $DIR/default-on-wrong-item-kind.rs:38:19 | LL | default const foo: u8; - | --------------^^^ - | | - | help: try using a static value: `static` + | ^^^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: try using a static value + | +LL | static foo: u8; + | ~~~~~~ error: a module cannot be `default` --> $DIR/default-on-wrong-item-kind.rs:41:5 diff --git a/tests/ui/parser/default.stderr b/tests/ui/parser/default.stderr index c420e5a774d20..16018c7145ce8 100644 --- a/tests/ui/parser/default.stderr +++ b/tests/ui/parser/default.stderr @@ -21,9 +21,14 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/default.rs:17:5 | LL | pub default fn foo() -> T { - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub default fn foo() -> T { +LL + default fn foo() -> T { + | warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/default.rs:3:12 diff --git a/tests/ui/parser/do-catch-suggests-try.stderr b/tests/ui/parser/do-catch-suggests-try.stderr index cd8907b7eac9a..fd3406ae29f89 100644 --- a/tests/ui/parser/do-catch-suggests-try.stderr +++ b/tests/ui/parser/do-catch-suggests-try.stderr @@ -2,9 +2,13 @@ error: found removed `do catch` syntax --> $DIR/do-catch-suggests-try.rs:4:25 | LL | let _: Option<()> = do catch {}; - | ^^^^^^^^ help: replace with the new syntax: `try` + | ^^^^^^^^ | = note: following RFC #2388, the new non-placeholder syntax is `try` +help: replace with the new syntax + | +LL | let _: Option<()> = try {}; + | ~~~ error[E0308]: mismatched types --> $DIR/do-catch-suggests-try.rs:9:33 diff --git a/tests/ui/parser/doc-comment-in-if-statement.stderr b/tests/ui/parser/doc-comment-in-if-statement.stderr index fc0bc507370af..bae398add478e 100644 --- a/tests/ui/parser/doc-comment-in-if-statement.stderr +++ b/tests/ui/parser/doc-comment-in-if-statement.stderr @@ -16,9 +16,14 @@ error: outer attributes are not allowed on `if` and `else` branches | LL | if true /*!*/ {} | -- ^^^^^ -- the attributes are attached to this branch - | | | - | | help: remove the attributes + | | | the branch belongs to this `if` + | +help: remove the attributes + | +LL - if true /*!*/ {} +LL + if true {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/duplicate-visibility.stderr b/tests/ui/parser/duplicate-visibility.stderr index 0d1421ee7f4e4..369c107cddca1 100644 --- a/tests/ui/parser/duplicate-visibility.stderr +++ b/tests/ui/parser/duplicate-visibility.stderr @@ -4,10 +4,7 @@ error: expected one of `(`, `async`, `const`, `default`, `extern`, `fn`, `safe`, LL | extern "C" { | - while parsing this item list starting here LL | pub pub fn foo(); - | ^^^ - | | - | expected one of 9 possible tokens - | help: there is already a visibility modifier, remove one + | ^^^ expected one of 9 possible tokens ... LL | } | - the item list ends here @@ -17,6 +14,11 @@ note: explicit visibility first seen here | LL | pub pub fn foo(); | ^^^ +help: there is already a visibility modifier, remove one + | +LL - pub pub fn foo(); +LL + pub fn foo(); + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr index 536afc53f0ceb..463e96336bc32 100644 --- a/tests/ui/parser/emoji-identifiers.stderr +++ b/tests/ui/parser/emoji-identifiers.stderr @@ -60,9 +60,14 @@ error: Ferris cannot be used as an identifier --> $DIR/emoji-identifiers.rs:17:9 | LL | let 🦀 = 1; - | ^^ help: try using their name instead: `ferris` + | ^^ LL | dbg!(🦀); | ^^ + | +help: try using their name instead + | +LL | let ferris = 1; + | ~~~~~~ error[E0599]: no function or associated item named `full_of✨` found for struct `👀` in the current scope --> $DIR/emoji-identifiers.rs:9:8 @@ -90,7 +95,12 @@ LL | fn i_like_to_😅_a_lot() -> 👀 { | ----------------------------- similarly named function `i_like_to_😅_a_lot` defined here ... LL | let _ = i_like_to_😄_a_lot() ➖ 4; - | ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `i_like_to_😅_a_lot` + | ^^^^^^^^^^^^^^^^^^ + | +help: a function with a similar name exists + | +LL | let _ = i_like_to_😅_a_lot() ➖ 4; + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 10 previous errors diff --git a/tests/ui/parser/empty-impl-semicolon.stderr b/tests/ui/parser/empty-impl-semicolon.stderr index cb15c36e6491c..7eb023ccb2972 100644 --- a/tests/ui/parser/empty-impl-semicolon.stderr +++ b/tests/ui/parser/empty-impl-semicolon.stderr @@ -4,7 +4,10 @@ error: expected `{}`, found `;` LL | impl Foo; | ^ | - = help: try using `{}` instead +help: try using `{}` instead + | +LL | impl Foo{} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/eq-less-to-less-eq.stderr b/tests/ui/parser/eq-less-to-less-eq.stderr index 4717d8287ff7b..693d0942e3a99 100644 --- a/tests/ui/parser/eq-less-to-less-eq.stderr +++ b/tests/ui/parser/eq-less-to-less-eq.stderr @@ -2,9 +2,12 @@ error: expected one of `!`, `(`, `+`, `::`, `<`, `>`, or `as`, found `{` --> $DIR/eq-less-to-less-eq.rs:4:15 | LL | if a =< b { - | -- ^ expected one of 7 possible tokens - | | - | help: did you mean: `<=` + | ^ expected one of 7 possible tokens + | +help: did you mean + | +LL | if a <= b { + | ~~ error: expected one of `!`, `(`, `+`, `::`, `<`, `>`, or `as`, found `{` --> $DIR/eq-less-to-less-eq.rs:12:15 diff --git a/tests/ui/parser/expr-as-stmt.stderr b/tests/ui/parser/expr-as-stmt.stderr index 76a83aa0161bb..46443ad4f1b80 100644 --- a/tests/ui/parser/expr-as-stmt.stderr +++ b/tests/ui/parser/expr-as-stmt.stderr @@ -81,9 +81,12 @@ error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:64:7 | LL | { foo() } || { true } - | ^^^^^- help: consider using a semicolon here: `;` - | | - | expected `()`, found `i32` + | ^^^^^ expected `()`, found `i32` + | +help: consider using a semicolon here + | +LL | { foo(); } || { true } + | + error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:8:6 @@ -227,9 +230,12 @@ error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:69:5 | LL | match () { () => 1 } + match () { () => 1 } - | ^^^^^^^^^^^^^^^^^^^^- help: consider using a semicolon here - | | - | expected `()`, found integer + | ^^^^^^^^^^^^^^^^^^^^ expected `()`, found integer + | +help: consider using a semicolon here + | +LL | match () { () => 1 }; + match () { () => 1 } + | + error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:75:14 diff --git a/tests/ui/parser/expr-rarrow-call.stderr b/tests/ui/parser/expr-rarrow-call.stderr index 90082f98cb5f8..221e3a74d79f9 100644 --- a/tests/ui/parser/expr-rarrow-call.stderr +++ b/tests/ui/parser/expr-rarrow-call.stderr @@ -2,41 +2,61 @@ error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:14:10 | LL | named->foo; - | ^^ help: try using `.` instead + | ^^ | = help: the `.` operator will dereference the value if needed +help: try using `.` instead + | +LL | named.foo; + | ~ error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:18:12 | LL | unnamed->0; - | ^^ help: try using `.` instead + | ^^ | = help: the `.` operator will dereference the value if needed +help: try using `.` instead + | +LL | unnamed.0; + | ~ error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:22:6 | LL | t->0; - | ^^ help: try using `.` instead + | ^^ | = help: the `.` operator will dereference the value if needed +help: try using `.` instead + | +LL | t.0; + | ~ error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:23:6 | LL | t->1; - | ^^ help: try using `.` instead + | ^^ | = help: the `.` operator will dereference the value if needed +help: try using `.` instead + | +LL | t.1; + | ~ error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:30:8 | LL | foo->clone(); - | ^^ help: try using `.` instead + | ^^ | = help: the `.` operator will dereference the value if needed +help: try using `.` instead + | +LL | foo.clone(); + | ~ error: aborting due to 5 previous errors diff --git a/tests/ui/parser/fn-body-eq-expr-semi.stderr b/tests/ui/parser/fn-body-eq-expr-semi.stderr index f1255d8642a60..5cf5c202f42c1 100644 --- a/tests/ui/parser/fn-body-eq-expr-semi.stderr +++ b/tests/ui/parser/fn-body-eq-expr-semi.stderr @@ -92,12 +92,14 @@ error: incorrect function inside `extern` block LL | extern "C" { | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body LL | fn foo() = 42; - | ^^^ ----- help: remove the invalid body: `;` - | | - | cannot have a body + | ^^^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | fn foo() ; + | ~ error: incorrect function inside `extern` block --> $DIR/fn-body-eq-expr-semi.rs:11:8 @@ -106,12 +108,14 @@ LL | extern "C" { | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body ... LL | fn bar() -> u8 = 42; - | ^^^ ----- help: remove the invalid body: `;` - | | - | cannot have a body + | ^^^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | fn bar() -> u8 ; + | ~ error: aborting due to 10 previous errors diff --git a/tests/ui/parser/fn-body-optional-semantic-fail.stderr b/tests/ui/parser/fn-body-optional-semantic-fail.stderr index 14bcd7c16faa1..d8e0fc97672d8 100644 --- a/tests/ui/parser/fn-body-optional-semantic-fail.stderr +++ b/tests/ui/parser/fn-body-optional-semantic-fail.stderr @@ -2,25 +2,34 @@ error: free function without a body --> $DIR/fn-body-optional-semantic-fail.rs:4:5 | LL | fn f1(); - | ^^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^^ + | +help: provide a definition for the function + | +LL | fn f1() { } + | ~~~~~~~~~~ error: associated function in `impl` without body --> $DIR/fn-body-optional-semantic-fail.rs:14:9 | LL | fn f1(); - | ^^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^^ + | +help: provide a definition for the function + | +LL | fn f1() { } + | ~~~~~~~~~~ error: associated function in `impl` without body --> $DIR/fn-body-optional-semantic-fail.rs:19:9 | LL | fn f3(); - | ^^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^^ + | +help: provide a definition for the function + | +LL | fn f3() { } + | ~~~~~~~~~~ error: incorrect function inside `extern` block --> $DIR/fn-body-optional-semantic-fail.rs:25:12 @@ -29,12 +38,14 @@ LL | extern "C" { | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body LL | fn f5(); // OK. LL | fn f6() {} - | ^^ -- help: remove the invalid body: `;` - | | - | cannot have a body + | ^^ cannot have a body | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the invalid body + | +LL | fn f6() ; + | ~ error: aborting due to 4 previous errors diff --git a/tests/ui/parser/fn-colon-return-type.stderr b/tests/ui/parser/fn-colon-return-type.stderr index b61a62a17f7e2..d7569fe1eb0c1 100644 --- a/tests/ui/parser/fn-colon-return-type.stderr +++ b/tests/ui/parser/fn-colon-return-type.stderr @@ -2,7 +2,12 @@ error: return types are denoted using `->` --> $DIR/fn-colon-return-type.rs:1:15 | LL | fn foo(x: i32): i32 { - | ^ help: use `->` instead + | ^ + | +help: use `->` instead + | +LL | fn foo(x: i32)-> i32 { + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-defined-using-def.stderr b/tests/ui/parser/fn-defined-using-def.stderr index 972c861c75024..0b0aa034730c2 100644 --- a/tests/ui/parser/fn-defined-using-def.stderr +++ b/tests/ui/parser/fn-defined-using-def.stderr @@ -2,9 +2,12 @@ error: expected one of `!` or `::`, found `foo` --> $DIR/fn-defined-using-def.rs:6:5 | LL | def foo() {} - | --- ^^^ expected one of `!` or `::` - | | - | help: write `fn` instead of `def` to declare a function + | ^^^ expected one of `!` or `::` + | +help: write `fn` instead of `def` to declare a function + | +LL | fn foo() {} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-defined-using-fun.stderr b/tests/ui/parser/fn-defined-using-fun.stderr index 3c8e586c0e8c3..f2f870831495c 100644 --- a/tests/ui/parser/fn-defined-using-fun.stderr +++ b/tests/ui/parser/fn-defined-using-fun.stderr @@ -2,9 +2,12 @@ error: expected one of `!` or `::`, found `foo` --> $DIR/fn-defined-using-fun.rs:6:5 | LL | fun foo() {} - | --- ^^^ expected one of `!` or `::` - | | - | help: write `fn` instead of `fun` to declare a function + | ^^^ expected one of `!` or `::` + | +help: write `fn` instead of `fun` to declare a function + | +LL | fn foo() {} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-defined-using-func.stderr b/tests/ui/parser/fn-defined-using-func.stderr index 9dd90798d9261..916c4299106b4 100644 --- a/tests/ui/parser/fn-defined-using-func.stderr +++ b/tests/ui/parser/fn-defined-using-func.stderr @@ -2,9 +2,12 @@ error: expected one of `!` or `::`, found `foo` --> $DIR/fn-defined-using-func.rs:6:6 | LL | func foo() {} - | ---- ^^^ expected one of `!` or `::` - | | - | help: write `fn` instead of `func` to declare a function + | ^^^ expected one of `!` or `::` + | +help: write `fn` instead of `func` to declare a function + | +LL | fn foo() {} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-defined-using-function.stderr b/tests/ui/parser/fn-defined-using-function.stderr index 504ab1bb93d75..6c2ff78c6e135 100644 --- a/tests/ui/parser/fn-defined-using-function.stderr +++ b/tests/ui/parser/fn-defined-using-function.stderr @@ -2,9 +2,12 @@ error: expected one of `!` or `::`, found `foo` --> $DIR/fn-defined-using-function.rs:6:10 | LL | function foo() {} - | -------- ^^^ expected one of `!` or `::` - | | - | help: write `fn` instead of `function` to declare a function + | ^^^ expected one of `!` or `::` + | +help: write `fn` instead of `function` to declare a function + | +LL | fn foo() {} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-field-parse-error-ice.stderr b/tests/ui/parser/fn-field-parse-error-ice.stderr index 3bf68e8cc04fe..a96bc5f78074c 100644 --- a/tests/ui/parser/fn-field-parse-error-ice.stderr +++ b/tests/ui/parser/fn-field-parse-error-ice.stderr @@ -2,7 +2,12 @@ error: expected `,`, or `}`, found keyword `fn` --> $DIR/fn-field-parse-error-ice.rs:4:16 | LL | inner : dyn fn () - | ^ help: try adding a comma: `,` + | ^ + | +help: try adding a comma + | +LL | inner : dyn, fn () + | + error: expected identifier, found keyword `fn` --> $DIR/fn-field-parse-error-ice.rs:4:17 diff --git a/tests/ui/parser/fn-header-semantic-fail.stderr b/tests/ui/parser/fn-header-semantic-fail.stderr index b519ddbe2b436..218b286dab24d 100644 --- a/tests/ui/parser/fn-header-semantic-fail.stderr +++ b/tests/ui/parser/fn-header-semantic-fail.stderr @@ -11,19 +11,25 @@ error[E0379]: functions in traits cannot be declared const --> $DIR/fn-header-semantic-fail.rs:18:9 | LL | const fn ft3(); - | ^^^^^- - | | - | functions in traits cannot be const - | help: remove the `const` + | ^^^^^ functions in traits cannot be const + | +help: remove the `const` + | +LL - const fn ft3(); +LL + fn ft3(); + | error[E0379]: functions in traits cannot be declared const --> $DIR/fn-header-semantic-fail.rs:20:9 | LL | const async unsafe extern "C" fn ft5(); - | ^^^^^- - | | - | functions in traits cannot be const - | help: remove the `const` + | ^^^^^ functions in traits cannot be const + | +help: remove the `const` + | +LL - const async unsafe extern "C" fn ft5(); +LL + async unsafe extern "C" fn ft5(); + | error: functions cannot be both `const` and `async` --> $DIR/fn-header-semantic-fail.rs:20:9 @@ -38,19 +44,25 @@ error[E0379]: functions in trait impls cannot be declared const --> $DIR/fn-header-semantic-fail.rs:29:9 | LL | const fn ft3() {} - | ^^^^^- - | | - | functions in trait impls cannot be const - | help: remove the `const` + | ^^^^^ functions in trait impls cannot be const + | +help: remove the `const` + | +LL - const fn ft3() {} +LL + fn ft3() {} + | error[E0379]: functions in trait impls cannot be declared const --> $DIR/fn-header-semantic-fail.rs:31:9 | LL | const async unsafe extern "C" fn ft5() {} - | ^^^^^- - | | - | functions in trait impls cannot be const - | help: remove the `const` + | ^^^^^ functions in trait impls cannot be const + | +help: remove the `const` + | +LL - const async unsafe extern "C" fn ft5() {} +LL + async unsafe extern "C" fn ft5() {} + | error: functions cannot be both `const` and `async` --> $DIR/fn-header-semantic-fail.rs:31:9 @@ -76,7 +88,13 @@ error: functions in `extern` blocks cannot have qualifiers LL | extern "C" { | ---------- in this `extern` block LL | async fn fe1(); - | ^^^^^ help: remove this qualifier + | ^^^^^ + | +help: remove this qualifier + | +LL - async fn fe1(); +LL + fn fe1(); + | error: items in unadorned `extern` blocks cannot have safety qualifiers --> $DIR/fn-header-semantic-fail.rs:47:9 @@ -96,7 +114,13 @@ LL | extern "C" { | ---------- in this `extern` block ... LL | const fn fe3(); - | ^^^^^ help: remove this qualifier + | ^^^^^ + | +help: remove this qualifier + | +LL - const fn fe3(); +LL + fn fe3(); + | error: functions in `extern` blocks cannot have qualifiers --> $DIR/fn-header-semantic-fail.rs:49:9 @@ -105,7 +129,13 @@ LL | extern "C" { | ---------- in this `extern` block ... LL | extern "C" fn fe4(); - | ^^^^^^^^^^ help: remove this qualifier + | ^^^^^^^^^^ + | +help: remove this qualifier + | +LL - extern "C" fn fe4(); +LL + fn fe4(); + | error: functions in `extern` blocks cannot have qualifiers --> $DIR/fn-header-semantic-fail.rs:50:15 @@ -114,7 +144,13 @@ LL | extern "C" { | ---------- in this `extern` block ... LL | const async unsafe extern "C" fn fe5(); - | ^^^^^ help: remove this qualifier + | ^^^^^ + | +help: remove this qualifier + | +LL - const async unsafe extern "C" fn fe5(); +LL + const unsafe extern "C" fn fe5(); + | error: functions in `extern` blocks cannot have qualifiers --> $DIR/fn-header-semantic-fail.rs:50:9 @@ -123,7 +159,13 @@ LL | extern "C" { | ---------- in this `extern` block ... LL | const async unsafe extern "C" fn fe5(); - | ^^^^^ help: remove this qualifier + | ^^^^^ + | +help: remove this qualifier + | +LL - const async unsafe extern "C" fn fe5(); +LL + async unsafe extern "C" fn fe5(); + | error: functions in `extern` blocks cannot have qualifiers --> $DIR/fn-header-semantic-fail.rs:50:28 @@ -132,7 +174,13 @@ LL | extern "C" { | ---------- in this `extern` block ... LL | const async unsafe extern "C" fn fe5(); - | ^^^^^^^^^^ help: remove this qualifier + | ^^^^^^^^^^ + | +help: remove this qualifier + | +LL - const async unsafe extern "C" fn fe5(); +LL + const async unsafe fn fe5(); + | error: items in unadorned `extern` blocks cannot have safety qualifiers --> $DIR/fn-header-semantic-fail.rs:50:9 diff --git a/tests/ui/parser/foreign-const-semantic-fail.stderr b/tests/ui/parser/foreign-const-semantic-fail.stderr index 8dc66c0d012ca..d317847f98ad7 100644 --- a/tests/ui/parser/foreign-const-semantic-fail.stderr +++ b/tests/ui/parser/foreign-const-semantic-fail.stderr @@ -2,21 +2,25 @@ error: extern items cannot be `const` --> $DIR/foreign-const-semantic-fail.rs:4:11 | LL | const A: isize; - | ------^ - | | - | help: try using a static value: `static` + | ^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: try using a static value + | +LL | static A: isize; + | ~~~~~~ error: extern items cannot be `const` --> $DIR/foreign-const-semantic-fail.rs:6:11 | LL | const B: isize = 42; - | ------^ - | | - | help: try using a static value: `static` + | ^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: try using a static value + | +LL | static B: isize = 42; + | ~~~~~~ error: incorrect `static` inside `extern` block --> $DIR/foreign-const-semantic-fail.rs:6:11 diff --git a/tests/ui/parser/foreign-const-syntactic-fail.stderr b/tests/ui/parser/foreign-const-syntactic-fail.stderr index 9cf58fa95fb2d..7da2c0190228d 100644 --- a/tests/ui/parser/foreign-const-syntactic-fail.stderr +++ b/tests/ui/parser/foreign-const-syntactic-fail.stderr @@ -2,21 +2,25 @@ error: extern items cannot be `const` --> $DIR/foreign-const-syntactic-fail.rs:7:11 | LL | const A: isize; - | ------^ - | | - | help: try using a static value: `static` + | ^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: try using a static value + | +LL | static A: isize; + | ~~~~~~ error: extern items cannot be `const` --> $DIR/foreign-const-syntactic-fail.rs:8:11 | LL | const B: isize = 42; - | ------^ - | | - | help: try using a static value: `static` + | ^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: try using a static value + | +LL | static B: isize = 42; + | ~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/foreign-ty-semantic-fail.stderr b/tests/ui/parser/foreign-ty-semantic-fail.stderr index 2b400dfea3bfa..4daafafbe8cc3 100644 --- a/tests/ui/parser/foreign-ty-semantic-fail.stderr +++ b/tests/ui/parser/foreign-ty-semantic-fail.stderr @@ -11,9 +11,14 @@ LL | extern "C" { | ---------- `extern` block begins here ... LL | type B<'a> where 'a: 'static; - | ^^^^ help: remove the generic parameters + | ^^^^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the generic parameters + | +LL - type B<'a> where 'a: 'static; +LL + type B where 'a: 'static; + | error: `type`s inside `extern` blocks cannot have `where` clauses --> $DIR/foreign-ty-semantic-fail.rs:8:16 @@ -22,9 +27,14 @@ LL | extern "C" { | ---------- `extern` block begins here ... LL | type B<'a> where 'a: 'static; - | ^^^^^^^^^^^^^^^^^ help: remove the `where` clause + | ^^^^^^^^^^^^^^^^^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the `where` clause + | +LL - type B<'a> where 'a: 'static; +LL + type B<'a> ; + | error: `type`s inside `extern` blocks cannot have generic parameters --> $DIR/foreign-ty-semantic-fail.rs:11:11 @@ -33,9 +43,14 @@ LL | extern "C" { | ---------- `extern` block begins here ... LL | type C where T: 'static; - | ^^^^^^^^ help: remove the generic parameters + | ^^^^^^^^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the generic parameters + | +LL - type C where T: 'static; +LL + type C where T: 'static; + | error: `type`s inside `extern` blocks cannot have `where` clauses --> $DIR/foreign-ty-semantic-fail.rs:11:20 @@ -44,9 +59,14 @@ LL | extern "C" { | ---------- `extern` block begins here ... LL | type C where T: 'static; - | ^^^^^^^^^^^^^^^^ help: remove the `where` clause + | ^^^^^^^^^^^^^^^^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the `where` clause + | +LL - type C where T: 'static; +LL + type C ; + | error: incorrect `type` inside `extern` block --> $DIR/foreign-ty-semantic-fail.rs:14:10 @@ -68,9 +88,14 @@ LL | extern "C" { | ---------- `extern` block begins here ... LL | type E: where; - | ^^^^^ help: remove the `where` clause + | ^^^^^ | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html +help: remove the `where` clause + | +LL - type E: where; +LL + type E: ; + | error: aborting due to 7 previous errors diff --git a/tests/ui/parser/ident-recovery.stderr b/tests/ui/parser/ident-recovery.stderr index e9a55026d1245..83666014eb250 100644 --- a/tests/ui/parser/ident-recovery.stderr +++ b/tests/ui/parser/ident-recovery.stderr @@ -2,19 +2,25 @@ error: expected identifier, found `,` --> $DIR/ident-recovery.rs:1:4 | LL | fn ,comma() { - | ^ - | | - | expected identifier - | help: remove this comma + | ^ expected identifier + | +help: remove this comma + | +LL - fn ,comma() { +LL + fn comma() { + | error: expected identifier, found `,` --> $DIR/ident-recovery.rs:4:16 | LL | x: i32,, - | ^ - | | - | expected identifier - | help: remove this comma + | ^ expected identifier + | +help: remove this comma + | +LL - x: i32,, +LL + x: i32, + | error: expected identifier, found keyword `break` --> $DIR/ident-recovery.rs:10:4 diff --git a/tests/ui/parser/if-in-in.stderr b/tests/ui/parser/if-in-in.stderr index 6117370c0ce68..d8def76792e2a 100644 --- a/tests/ui/parser/if-in-in.stderr +++ b/tests/ui/parser/if-in-in.stderr @@ -2,9 +2,13 @@ error: expected iterable, found keyword `in` --> $DIR/if-in-in.rs:4:14 | LL | for i in in 1..2 { - | ---^^ - | | - | help: remove the duplicated `in` + | ^^ + | +help: remove the duplicated `in` + | +LL - for i in in 1..2 { +LL + for i in 1..2 { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/impl-item-const-semantic-fail.stderr b/tests/ui/parser/impl-item-const-semantic-fail.stderr index 579f4c29c5260..80c636a120b34 100644 --- a/tests/ui/parser/impl-item-const-semantic-fail.stderr +++ b/tests/ui/parser/impl-item-const-semantic-fail.stderr @@ -2,9 +2,12 @@ error: associated constant in `impl` without body --> $DIR/impl-item-const-semantic-fail.rs:6:5 | LL | const Y: u8; - | ^^^^^^^^^^^- - | | - | help: provide a definition for the constant: `= ;` + | ^^^^^^^^^^^^ + | +help: provide a definition for the constant + | +LL | const Y: u8 = ; + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/impl-item-fn-no-body-semantic-fail.stderr b/tests/ui/parser/impl-item-fn-no-body-semantic-fail.stderr index 1704d99cf29f6..8db88a5d5a6fb 100644 --- a/tests/ui/parser/impl-item-fn-no-body-semantic-fail.stderr +++ b/tests/ui/parser/impl-item-fn-no-body-semantic-fail.stderr @@ -2,9 +2,12 @@ error: associated function in `impl` without body --> $DIR/impl-item-fn-no-body-semantic-fail.rs:6:5 | LL | fn f(); - | ^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^ + | +help: provide a definition for the function + | +LL | fn f() { } + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr b/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr index 9800420072be4..8de46bb731c47 100644 --- a/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr +++ b/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr @@ -2,17 +2,23 @@ error: associated type in `impl` without body --> $DIR/impl-item-type-no-body-semantic-fail.rs:6:5 | LL | type Y; - | ^^^^^^- - | | - | help: provide a definition for the type: `= ;` + | ^^^^^^^ + | +help: provide a definition for the type + | +LL | type Y = ; + | ~~~~~~~~~ error: associated type in `impl` without body --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:5 | LL | type Z: Ord; - | ^^^^^^^^^^^- - | | - | help: provide a definition for the type: `= ;` + | ^^^^^^^^^^^^ + | +help: provide a definition for the type + | +LL | type Z: Ord = ; + | ~~~~~~~~~ error: bounds on `type`s in `impl`s have no effect --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:13 @@ -24,9 +30,12 @@ error: associated type in `impl` without body --> $DIR/impl-item-type-no-body-semantic-fail.rs:13:5 | LL | type W: Ord where Self: Eq; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the type: `= ;` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the type + | +LL | type W: Ord where Self: Eq = ; + | ~~~~~~~~~ error: bounds on `type`s in `impl`s have no effect --> $DIR/impl-item-type-no-body-semantic-fail.rs:13:13 @@ -38,9 +47,12 @@ error: associated type in `impl` without body --> $DIR/impl-item-type-no-body-semantic-fail.rs:18:5 | LL | type W where Self: Eq; - | ^^^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the type: `= ;` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the type + | +LL | type W where Self: Eq = ; + | ~~~~~~~~~ error[E0658]: inherent associated types are unstable --> $DIR/impl-item-type-no-body-semantic-fail.rs:6:5 diff --git a/tests/ui/parser/impl-parsing.stderr b/tests/ui/parser/impl-parsing.stderr index a57cc075ccc90..6a24a9453e631 100644 --- a/tests/ui/parser/impl-parsing.stderr +++ b/tests/ui/parser/impl-parsing.stderr @@ -2,13 +2,23 @@ error: missing `for` in a trait impl --> $DIR/impl-parsing.rs:4:11 | LL | impl Trait Type {} - | ^ help: add `for` here + | ^ + | +help: add `for` here + | +LL | impl Trait for Type {} + | +++ error: missing `for` in a trait impl --> $DIR/impl-parsing.rs:5:11 | LL | impl Trait .. {} - | ^ help: add `for` here + | ^ + | +help: add `for` here + | +LL | impl Trait for .. {} + | +++ error: expected a trait, found type --> $DIR/impl-parsing.rs:6:6 diff --git a/tests/ui/parser/intersection-patterns-1.stderr b/tests/ui/parser/intersection-patterns-1.stderr index dc968656c91ff..ed2466b21a751 100644 --- a/tests/ui/parser/intersection-patterns-1.stderr +++ b/tests/ui/parser/intersection-patterns-1.stderr @@ -6,7 +6,11 @@ LL | Some(x) @ y => {} | | | | | binding on the right, should be on the left | pattern on the left, should be on the right - | help: switch the order: `y @ Some(x)` + | +help: switch the order + | +LL | y @ Some(x) => {} + | ~~~~~~~~~~~ error: pattern on wrong side of `@` --> $DIR/intersection-patterns-1.rs:27:9 @@ -16,7 +20,11 @@ LL | 1 ..= 5 @ e => {} | | | | | binding on the right, should be on the left | pattern on the left, should be on the right - | help: switch the order: `e @ 1..=5` + | +help: switch the order + | +LL | e @ 1..=5 => {} + | ~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/inverted-parameters.stderr b/tests/ui/parser/inverted-parameters.stderr index 8662277820390..4033b4986ce7f 100644 --- a/tests/ui/parser/inverted-parameters.stderr +++ b/tests/ui/parser/inverted-parameters.stderr @@ -2,19 +2,23 @@ error: expected one of `:`, `@`, or `|`, found `bar` --> $DIR/inverted-parameters.rs:4:24 | LL | fn foo(&self, &str bar) {} - | -----^^^ - | | | - | | expected one of `:`, `@`, or `|` - | help: declare the type after the parameter binding: `: ` + | ^^^ expected one of `:`, `@`, or `|` + | +help: declare the type after the parameter binding + | +LL | fn foo(&self, : ) {} + | ~~~~~~~~~~~~~~~~~~~~ error: expected one of `:`, `@`, or `|`, found `quux` --> $DIR/inverted-parameters.rs:10:10 | LL | fn baz(S quux, xyzzy: i32) {} - | --^^^^ - | | | - | | expected one of `:`, `@`, or `|` - | help: declare the type after the parameter binding: `: ` + | ^^^^ expected one of `:`, `@`, or `|` + | +help: declare the type after the parameter binding + | +LL | fn baz(: , xyzzy: i32) {} + | ~~~~~~~~~~~~~~~~~~~~ error: expected one of `:`, `@`, or `|`, found `a` --> $DIR/inverted-parameters.rs:15:12 @@ -52,10 +56,12 @@ error: expected one of `:`, `@`, or `|`, found `S` --> $DIR/inverted-parameters.rs:27:23 | LL | fn missing_colon(quux S) {} - | -----^ - | | | - | | expected one of `:`, `@`, or `|` - | help: declare the type after the parameter binding: `: ` + | ^ expected one of `:`, `@`, or `|` + | +help: declare the type after the parameter binding + | +LL | fn missing_colon(: ) {} + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.stderr b/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.stderr index 9776677589f5b..c0d85aa17d2a3 100644 --- a/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.stderr +++ b/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.stderr @@ -2,7 +2,13 @@ error: expected item, found `;` --> $DIR/fn-no-semicolon-issue-124935-semi-after-item.rs:5:1 | LL | ; - | ^ help: remove this semicolon + | ^ + | +help: remove this semicolon + | +LL - ; +LL + + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-100197-mut-let.stderr b/tests/ui/parser/issues/issue-100197-mut-let.stderr index 07d136881408e..252ed7d0715d4 100644 --- a/tests/ui/parser/issues/issue-100197-mut-let.stderr +++ b/tests/ui/parser/issues/issue-100197-mut-let.stderr @@ -2,7 +2,12 @@ error: invalid variable declaration --> $DIR/issue-100197-mut-let.rs:4:5 | LL | mut let _x = 123; - | ^^^^^^^ help: switch the order of `mut` and `let`: `let mut` + | ^^^^^^^ + | +help: switch the order of `mut` and `let` + | +LL | let mut _x = 123; + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-101477-enum.stderr b/tests/ui/parser/issues/issue-101477-enum.stderr index 94130671f1c9a..8d4efdd17f7b2 100644 --- a/tests/ui/parser/issues/issue-101477-enum.stderr +++ b/tests/ui/parser/issues/issue-101477-enum.stderr @@ -2,9 +2,13 @@ error: unexpected `==` --> $DIR/issue-101477-enum.rs:6:7 | LL | B == 2 - | ^^ help: try using `=` instead + | ^^ | = help: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` +help: try using `=` instead + | +LL | B = 2 + | ~ error: expected item, found `==` --> $DIR/issue-101477-enum.rs:6:7 diff --git a/tests/ui/parser/issues/issue-101477-let.stderr b/tests/ui/parser/issues/issue-101477-let.stderr index 56348357397fc..d2671abbdea9e 100644 --- a/tests/ui/parser/issues/issue-101477-let.stderr +++ b/tests/ui/parser/issues/issue-101477-let.stderr @@ -2,7 +2,12 @@ error: unexpected `==` --> $DIR/issue-101477-let.rs:4:11 | LL | let x == 2; - | ^^ help: try using `=` instead + | ^^ + | +help: try using `=` instead + | +LL | let x = 2; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-103425.stderr b/tests/ui/parser/issues/issue-103425.stderr index 0efe3e3ca7117..e7e1b7106b0bb 100644 --- a/tests/ui/parser/issues/issue-103425.stderr +++ b/tests/ui/parser/issues/issue-103425.stderr @@ -2,28 +2,43 @@ error: expected `;`, found `5.0` --> $DIR/issue-103425.rs:2:6 | LL | 3 - | ^ help: add `;` here + | ^ LL | LL | 5.0 | --- unexpected token + | +help: add `;` here + | +LL | 3; + | + error: expected `;`, found `3_i8` --> $DIR/issue-103425.rs:8:10 | LL | 2_u32 - | ^ help: add `;` here + | ^ LL | LL | 3_i8 | ---- unexpected token + | +help: add `;` here + | +LL | 2_u32; + | + error: expected `;`, found `5.0` --> $DIR/issue-103425.rs:10:9 | LL | 3_i8 - | ^ help: add `;` here + | ^ LL | LL | 5.0 | --- unexpected token + | +help: add `;` here + | +LL | 3_i8; + | + error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr index b0d8b03ae08c3..c890a207f0884 100644 --- a/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr +++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr @@ -13,9 +13,12 @@ error: expected one of `)` or `,`, found `Citron` --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38 | LL | struct Apple((Apple, Option(Banana ? Citron))); - | -^^^^^^ expected one of `)` or `,` - | | - | help: missing `,` + | ^^^^^^ expected one of `)` or `,` + | +help: missing `,` + | +LL | struct Apple((Apple, Option(Banana ?, Citron))); + | + error[E0412]: cannot find type `Citron` in this scope --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38 diff --git a/tests/ui/parser/issues/issue-10392-2.stderr b/tests/ui/parser/issues/issue-10392-2.stderr index 3e5d5062bee34..0006a88d7bb2a 100644 --- a/tests/ui/parser/issues/issue-10392-2.stderr +++ b/tests/ui/parser/issues/issue-10392-2.stderr @@ -5,8 +5,13 @@ LL | let A { .., } = a(); | --^ | | | | | expected `}` - | | help: remove this comma | `..` must be at the end and cannot have a trailing comma + | +help: remove this comma + | +LL - let A { .., } = a(); +LL + let A { .. } = a(); + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr index 86d3449cc33b6..e5c6ba27755ee 100644 --- a/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr +++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr @@ -2,13 +2,23 @@ error: missing parameters for function definition --> $DIR/issue-108109-fn-missing-params.rs:3:15 | LL | pub fn missing -> () {} - | ^ help: add a parameter list + | ^ + | +help: add a parameter list + | +LL | pub fn missing() -> () {} + | ++ error: missing parameters for function definition --> $DIR/issue-108109-fn-missing-params.rs:6:16 | LL | pub fn missing2 {} - | ^ help: add a parameter list + | ^ + | +help: add a parameter list + | +LL | pub fn missing2() {} + | ++ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr index 78017babbf609..1a7f65a1542ca 100644 --- a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr +++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr @@ -2,10 +2,14 @@ error: expected one of `(`, `+`, `,`, `::`, `<`, or `{`, found `->` --> $DIR/issue-108109-fn-trait-missing-paren.rs:3:34 | LL | pub fn func() where F: FnOnce -> () {} - | -------^^ expected one of `(`, `+`, `,`, `::`, `<`, or `{` - | | | - | | help: try adding parentheses + | ------ ^^ expected one of `(`, `+`, `,`, `::`, `<`, or `{` + | | | `Fn` bounds require arguments in parentheses + | +help: try adding parentheses + | +LL | pub fn func() where F: FnOnce() -> () {} + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-112188.stderr b/tests/ui/parser/issues/issue-112188.stderr index 6d2d8e6a3b055..3d567ce6109bf 100644 --- a/tests/ui/parser/issues/issue-112188.stderr +++ b/tests/ui/parser/issues/issue-112188.stderr @@ -5,8 +5,13 @@ LL | let Foo { .., } = f; | --^ | | | | | expected `}` - | | help: remove this comma | `..` must be at the end and cannot have a trailing comma + | +help: remove this comma + | +LL - let Foo { .., } = f; +LL + let Foo { .. } = f; + | error: expected `}`, found `,` --> $DIR/issue-112188.rs:12:17 @@ -27,11 +32,16 @@ error: expected `}`, found `,` --> $DIR/issue-112188.rs:13:17 | LL | let Foo { .., x, .. } = f; - | --^- + | --^ | | | | | expected `}` | `..` must be at the end and cannot have a trailing comma - | help: remove the starting `..` + | +help: remove the starting `..` + | +LL - let Foo { .., x, .. } = f; +LL + let Foo { x, .. } = f; + | error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issues/issue-113203.stderr b/tests/ui/parser/issues/issue-113203.stderr index 5db628d59776a..f9c8ad9128051 100644 --- a/tests/ui/parser/issues/issue-113203.stderr +++ b/tests/ui/parser/issues/issue-113203.stderr @@ -2,7 +2,12 @@ error: incorrect use of `await` --> $DIR/issue-113203.rs:5:5 | LL | await {}() - | ^^^^^^^^ help: `await` is a postfix operation: `{}.await` + | ^^^^^^^^ + | +help: `await` is a postfix operation + | +LL | {}.await() + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-113342.stderr b/tests/ui/parser/issues/issue-113342.stderr index 6d9f22f6a7ce8..59e65950534db 100644 --- a/tests/ui/parser/issues/issue-113342.stderr +++ b/tests/ui/parser/issues/issue-113342.stderr @@ -2,10 +2,12 @@ error: expected `fn`, found keyword `pub` --> $DIR/issue-113342.rs:7:12 | LL | extern "C" pub fn id(x: i32) -> i32 { x } - | -----------^^^ - | | | - | | expected `fn` - | help: visibility `pub` must come before `extern "C"`: `pub extern "C"` + | ^^^ expected `fn` + | +help: visibility `pub` must come before `extern "C"` + | +LL | pub extern "C" fn id(x: i32) -> i32 { x } + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-118530-ice.stderr b/tests/ui/parser/issues/issue-118530-ice.stderr index 75c6a40c74450..a8a2327d0cee2 100644 --- a/tests/ui/parser/issues/issue-118530-ice.stderr +++ b/tests/ui/parser/issues/issue-118530-ice.stderr @@ -30,16 +30,23 @@ LL | #[feature] | ---------- only `;` terminated statements or tail expressions are allowed after this attribute LL | attr::fn bar() -> String { | ^--- unexpected token - | | - | help: add `;` here + | +help: add `;` here + | +LL | attr::fn; bar() -> String { + | + error: `->` used for field access or method call --> $DIR/issue-118530-ice.rs:5:20 | LL | attr::fn bar() -> String { - | ^^ help: try using `.` instead + | ^^ | = help: the `.` operator will dereference the value if needed +help: try using `.` instead + | +LL | attr::fn bar() . String { + | ~ error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/issue-118530-ice.rs:5:30 diff --git a/tests/ui/parser/issues/issue-14303.stderr b/tests/ui/parser/issues/issue-14303.stderr index f121107c0958f..167197b06556e 100644 --- a/tests/ui/parser/issues/issue-14303.stderr +++ b/tests/ui/parser/issues/issue-14303.stderr @@ -2,31 +2,56 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:1:18 | LL | enum Enum<'a, T, 'b> { - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | enum Enum<'a, 'b, T> { + | ~~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:6:22 | LL | struct Struct<'a, T, 'b> { - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct Struct<'a, 'b, T> { + | ~~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:11:20 | LL | trait Trait<'a, T, 'b> {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | trait Trait<'a, 'b, T> {} + | ~~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:14:15 | LL | fn foo<'a, T, 'b>(x: &'a T) {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | fn foo<'a, 'b, T>(x: &'a T) {} + | ~~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:18:13 | LL | impl<'a, T, 'b> Y {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | impl<'a, 'b, T> Y {} + | ~~~~~~~~~~~ error[E0747]: type provided when a lifetime was expected --> $DIR/issue-14303.rs:30:37 diff --git a/tests/ui/parser/issues/issue-17718-const-mut.stderr b/tests/ui/parser/issues/issue-17718-const-mut.stderr index a27f517086efa..54b819c3cfb84 100644 --- a/tests/ui/parser/issues/issue-17718-const-mut.stderr +++ b/tests/ui/parser/issues/issue-17718-const-mut.stderr @@ -1,10 +1,13 @@ error: const globals cannot be mutable --> $DIR/issue-17718-const-mut.rs:2:1 | -LL | const - | ----- help: you might want to declare a static instead: `static` LL | mut | ^^^ cannot be mutable + | +help: you might want to declare a static instead + | +LL | static + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr b/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr index 88d97c795fc2a..4a3743579e7a6 100644 --- a/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr +++ b/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr @@ -86,9 +86,12 @@ error: incorrect unicode escape sequence --> $DIR/issue-23620-invalid-escapes.rs:32:14 | LL | let _ = "\u8f"; - | ^^^- - | | - | help: format of unicode escape sequences uses braces: `\u{8f}` + | ^^^ + | +help: format of unicode escape sequences uses braces + | +LL | let _ = "\u{8f}"; + | ~~~~~~ error: aborting due to 13 previous errors diff --git a/tests/ui/parser/issues/issue-27255.stderr b/tests/ui/parser/issues/issue-27255.stderr index 391a23556c4e0..2cd7ebd60b143 100644 --- a/tests/ui/parser/issues/issue-27255.stderr +++ b/tests/ui/parser/issues/issue-27255.stderr @@ -2,13 +2,23 @@ error: missing `for` in a trait impl --> $DIR/issue-27255.rs:3:7 | LL | impl A .. {} - | ^ help: add `for` here + | ^ + | +help: add `for` here + | +LL | impl A for .. {} + | +++ error: missing `for` in a trait impl --> $DIR/issue-27255.rs:7:7 | LL | impl A usize {} - | ^^^^^^ help: add `for` here + | ^^^^^^ + | +help: add `for` here + | +LL | impl A for usize {} + | +++ error: `impl Trait for .. {}` is an obsolete syntax --> $DIR/issue-27255.rs:3:1 diff --git a/tests/ui/parser/issues/issue-3036.stderr b/tests/ui/parser/issues/issue-3036.stderr index 3dd89b7e828df..62a9c1d9752a0 100644 --- a/tests/ui/parser/issues/issue-3036.stderr +++ b/tests/ui/parser/issues/issue-3036.stderr @@ -2,9 +2,14 @@ error: expected `;`, found `}` --> $DIR/issue-3036.rs:6:15 | LL | let _x = 3 - | ^ help: add `;` here + | ^ LL | } | - unexpected token + | +help: add `;` here + | +LL | let _x = 3; + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-32501.stderr b/tests/ui/parser/issues/issue-32501.stderr index c0513a64039e6..b0ec135b784a4 100644 --- a/tests/ui/parser/issues/issue-32501.stderr +++ b/tests/ui/parser/issues/issue-32501.stderr @@ -2,9 +2,14 @@ error: `mut` must be followed by a named binding --> $DIR/issue-32501.rs:7:9 | LL | let mut _ = 0; - | ^^^^ help: remove the `mut` prefix + | ^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: remove the `mut` prefix + | +LL - let mut _ = 0; +LL + let _ = 0; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-46186.stderr b/tests/ui/parser/issues/issue-46186.stderr index c67c271e19ae5..5ea3e1f49838a 100644 --- a/tests/ui/parser/issues/issue-46186.stderr +++ b/tests/ui/parser/issues/issue-46186.stderr @@ -2,9 +2,14 @@ error: expected item, found `;` --> $DIR/issue-46186.rs:5:2 | LL | }; - | ^ help: remove this semicolon + | ^ | = help: braced struct declarations are not followed by a semicolon +help: remove this semicolon + | +LL - }; +LL + } + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-48636.stderr b/tests/ui/parser/issues/issue-48636.stderr index 488a046a54900..c17a8ec2f8991 100644 --- a/tests/ui/parser/issues/issue-48636.stderr +++ b/tests/ui/parser/issues/issue-48636.stderr @@ -4,11 +4,14 @@ error[E0585]: found a documentation comment that doesn't document anything LL | struct S { | - while parsing this struct LL | x: u8 - | - help: missing comma here: `,` LL | /// The ID of the parent core | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: doc comments must come before what they document, if a comment was intended use `//` +help: missing comma here + | +LL | x: u8, + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-49040.stderr b/tests/ui/parser/issues/issue-49040.stderr index 11ef5e1aadfd8..c25d5683ecfcf 100644 --- a/tests/ui/parser/issues/issue-49040.stderr +++ b/tests/ui/parser/issues/issue-49040.stderr @@ -2,7 +2,13 @@ error: expected item, found `;` --> $DIR/issue-49040.rs:1:28 | LL | #![allow(unused_variables)]; - | ^ help: remove this semicolon + | ^ + | +help: remove this semicolon + | +LL - #![allow(unused_variables)]; +LL + #![allow(unused_variables)] + | error[E0601]: `main` function not found in crate `issue_49040` --> $DIR/issue-49040.rs:2:12 diff --git a/tests/ui/parser/issues/issue-49257.stderr b/tests/ui/parser/issues/issue-49257.stderr index 97e16f88b8d32..aa784d1d28370 100644 --- a/tests/ui/parser/issues/issue-49257.stderr +++ b/tests/ui/parser/issues/issue-49257.stderr @@ -35,8 +35,13 @@ LL | let Point { .., } = p; | --^ | | | | | expected `}` - | | help: remove this comma | `..` must be at the end and cannot have a trailing comma + | +help: remove this comma + | +LL - let Point { .., } = p; +LL + let Point { .. } = p; + | error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issues/issue-52496.stderr b/tests/ui/parser/issues/issue-52496.stderr index 78c81bf5b0df7..4edc56b6dec83 100644 --- a/tests/ui/parser/issues/issue-52496.stderr +++ b/tests/ui/parser/issues/issue-52496.stderr @@ -2,7 +2,12 @@ error: float literals must have an integer part --> $DIR/issue-52496.rs:4:24 | LL | let _ = Foo { bar: .5, baz: 42 }; - | ^^ help: must have an integer part: `0.5` + | ^^ + | +help: must have an integer part + | +LL | let _ = Foo { bar: 0.5, baz: 42 }; + | ~~~ error: expected one of `,`, `:`, or `}`, found `.` --> $DIR/issue-52496.rs:8:22 diff --git a/tests/ui/parser/issues/issue-54521-2.stderr b/tests/ui/parser/issues/issue-54521-2.stderr index 9556b83b730a4..ad662ef1cca55 100644 --- a/tests/ui/parser/issues/issue-54521-2.stderr +++ b/tests/ui/parser/issues/issue-54521-2.stderr @@ -2,25 +2,49 @@ error: unmatched angle brackets --> $DIR/issue-54521-2.rs:11:25 | LL | let _ = Vec::>>>>::new(); - | ^^^^ help: remove extra angle brackets + | ^^^^ + | +help: remove extra angle brackets + | +LL - let _ = Vec::>>>>::new(); +LL + let _ = Vec::::new(); + | error: unmatched angle brackets --> $DIR/issue-54521-2.rs:14:25 | LL | let _ = Vec::>>>::new(); - | ^^^ help: remove extra angle brackets + | ^^^ + | +help: remove extra angle brackets + | +LL - let _ = Vec::>>>::new(); +LL + let _ = Vec::::new(); + | error: unmatched angle brackets --> $DIR/issue-54521-2.rs:17:25 | LL | let _ = Vec::>>::new(); - | ^^ help: remove extra angle brackets + | ^^ + | +help: remove extra angle brackets + | +LL - let _ = Vec::>>::new(); +LL + let _ = Vec::::new(); + | error: unmatched angle bracket --> $DIR/issue-54521-2.rs:20:25 | LL | let _ = Vec::>::new(); - | ^ help: remove extra angle bracket + | ^ + | +help: remove extra angle bracket + | +LL - let _ = Vec::>::new(); +LL + let _ = Vec::::new(); + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/issues/issue-54521-3.stderr b/tests/ui/parser/issues/issue-54521-3.stderr index 0f23dd6210757..bd468869b0663 100644 --- a/tests/ui/parser/issues/issue-54521-3.stderr +++ b/tests/ui/parser/issues/issue-54521-3.stderr @@ -2,25 +2,49 @@ error: unmatched angle brackets --> $DIR/issue-54521-3.rs:11:60 | LL | let _ = vec![1, 2, 3].into_iter().collect::>>>>>(); - | ^^^^ help: remove extra angle brackets + | ^^^^ + | +help: remove extra angle brackets + | +LL - let _ = vec![1, 2, 3].into_iter().collect::>>>>>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::>(); + | error: unmatched angle brackets --> $DIR/issue-54521-3.rs:14:60 | LL | let _ = vec![1, 2, 3].into_iter().collect::>>>>(); - | ^^^ help: remove extra angle brackets + | ^^^ + | +help: remove extra angle brackets + | +LL - let _ = vec![1, 2, 3].into_iter().collect::>>>>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::>(); + | error: unmatched angle brackets --> $DIR/issue-54521-3.rs:17:60 | LL | let _ = vec![1, 2, 3].into_iter().collect::>>>(); - | ^^ help: remove extra angle brackets + | ^^ + | +help: remove extra angle brackets + | +LL - let _ = vec![1, 2, 3].into_iter().collect::>>>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::>(); + | error: unmatched angle bracket --> $DIR/issue-54521-3.rs:20:60 | LL | let _ = vec![1, 2, 3].into_iter().collect::>>(); - | ^ help: remove extra angle bracket + | ^ + | +help: remove extra angle bracket + | +LL - let _ = vec![1, 2, 3].into_iter().collect::>>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::>(); + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/issues/issue-57684.stderr b/tests/ui/parser/issues/issue-57684.stderr index 514bbffde6b1e..39e1c8cd7cc74 100644 --- a/tests/ui/parser/issues/issue-57684.stderr +++ b/tests/ui/parser/issues/issue-57684.stderr @@ -2,17 +2,23 @@ error: expected `:`, found `=` --> $DIR/issue-57684.rs:27:20 | LL | let _ = X { f1 = 5 }; - | -^ - | | - | help: replace equals symbol with a colon: `:` + | ^ + | +help: replace equals symbol with a colon + | +LL | let _ = X { f1: 5 }; + | ~ error: expected `:`, found `=` --> $DIR/issue-57684.rs:32:12 | LL | f1 = 5, - | -^ - | | - | help: replace equals symbol with a colon: `:` + | ^ + | +help: replace equals symbol with a colon + | +LL | f1: 5, + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-57819.stderr b/tests/ui/parser/issues/issue-57819.stderr index 493e9835b1ca9..a01625d9c4c3f 100644 --- a/tests/ui/parser/issues/issue-57819.stderr +++ b/tests/ui/parser/issues/issue-57819.stderr @@ -2,43 +2,85 @@ error: unmatched angle brackets --> $DIR/issue-57819.rs:19:10 | LL | bar::<<<<::Output>(); - | ^^^ help: remove extra angle brackets + | ^^^ + | +help: remove extra angle brackets + | +LL - bar::<<<<::Output>(); +LL + bar::<::Output>(); + | error: unmatched angle brackets --> $DIR/issue-57819.rs:22:10 | LL | bar::<<<::Output>(); - | ^^ help: remove extra angle brackets + | ^^ + | +help: remove extra angle brackets + | +LL - bar::<<<::Output>(); +LL + bar::<::Output>(); + | error: unmatched angle bracket --> $DIR/issue-57819.rs:25:10 | LL | bar::<<::Output>(); - | ^ help: remove extra angle bracket + | ^ + | +help: remove extra angle bracket + | +LL - bar::<<::Output>(); +LL + bar::<::Output>(); + | error: unmatched angle brackets --> $DIR/issue-57819.rs:34:48 | LL | let _ = vec![1, 2, 3].into_iter().collect::<<<<>(); - | ^^^^ help: remove extra angle brackets + | ^^^^ + | +help: remove extra angle brackets + | +LL - let _ = vec![1, 2, 3].into_iter().collect::<<<<>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::>(); + | error: unmatched angle brackets --> $DIR/issue-57819.rs:37:48 | LL | let _ = vec![1, 2, 3].into_iter().collect::<<<>(); - | ^^^ help: remove extra angle brackets + | ^^^ + | +help: remove extra angle brackets + | +LL - let _ = vec![1, 2, 3].into_iter().collect::<<<>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::>(); + | error: unmatched angle brackets --> $DIR/issue-57819.rs:40:48 | LL | let _ = vec![1, 2, 3].into_iter().collect::<<>(); - | ^^ help: remove extra angle brackets + | ^^ + | +help: remove extra angle brackets + | +LL - let _ = vec![1, 2, 3].into_iter().collect::<<>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::>(); + | error: unmatched angle bracket --> $DIR/issue-57819.rs:43:48 | LL | let _ = vec![1, 2, 3].into_iter().collect::<>(); - | ^ help: remove extra angle bracket + | ^ + | +help: remove extra angle bracket + | +LL - let _ = vec![1, 2, 3].into_iter().collect::<>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::>(); + | error: aborting due to 7 previous errors diff --git a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr index 2bd87ee0c38fa..76259b40a9332 100644 --- a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr +++ b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr @@ -2,13 +2,18 @@ error: `mut` must be followed by a named binding --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:6:13 | LL | let mut $eval = (); - | ^^^^ help: remove the `mut` prefix + | ^^^^ ... LL | mac1! { does_not_exist!() } | --------------------------- in this macro invocation | = note: `mut` may be followed by `variable` and `variable @ pattern` = note: this error originates in the macro `mac1` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove the `mut` prefix + | +LL - let mut $eval = (); +LL + let $eval = (); + | error: expected identifier, found `does_not_exist!()` --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:17 @@ -25,13 +30,18 @@ error: `mut` must be followed by a named binding --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:13 | LL | let mut $eval = (); - | ^^^ help: remove the `mut` prefix + | ^^^ ... LL | mac2! { does_not_exist!() } | --------------------------- in this macro invocation | = note: `mut` may be followed by `variable` and `variable @ pattern` = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove the `mut` prefix + | +LL - let mut $eval = (); +LL + let $eval = (); + | error: cannot find macro `does_not_exist` in this scope --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:22:13 diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr index 0a88dd2c4d31c..49d091cf3914c 100644 --- a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr +++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr @@ -46,13 +46,23 @@ error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:14:5 | LL | mut n = 0; - | ^^^ help: missing keyword: `let mut` + | ^^^ + | +help: missing keyword + | +LL | let mut n = 0; + | ~~~~~~~ error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5 | LL | mut var; - | ^^^ help: missing keyword: `let mut` + | ^^^ + | +help: missing keyword + | +LL | let mut var; + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33 diff --git a/tests/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr b/tests/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr index adabb68593c09..e1b5bbed7e558 100644 --- a/tests/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr +++ b/tests/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr @@ -2,7 +2,12 @@ error: expected `,`, or `}`, found `ö` --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:2:22 | LL | pub bar: Vecö - | ^ help: try adding a comma: `,` + | ^ + | +help: try adding a comma + | +LL | pub bar: Vec,ö + | + error: expected `:`, found `}` --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:4:1 diff --git a/tests/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.stderr b/tests/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.stderr index 4961e8fc0492d..c6fe073d16d8f 100644 --- a/tests/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.stderr +++ b/tests/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.stderr @@ -2,19 +2,23 @@ error: unexpected `...` --> $DIR/issue-70388-recover-dotdotdot-rest-pat.rs:4:13 | LL | let Foo(...) = Foo(0); - | ^^^ - | | - | not a valid pattern - | help: for a rest pattern, use `..` instead of `...` + | ^^^ not a valid pattern + | +help: for a rest pattern, use `..` instead of `...` + | +LL | let Foo(..) = Foo(0); + | ~~ error: unexpected `...` --> $DIR/issue-70388-recover-dotdotdot-rest-pat.rs:5:13 | LL | let [_, ..., _] = [0, 1]; - | ^^^ - | | - | not a valid pattern - | help: for a rest pattern, use `..` instead of `...` + | ^^^ not a valid pattern + | +help: for a rest pattern, use `..` instead of `...` + | +LL | let [_, .., _] = [0, 1]; + | ~~ error[E0308]: mismatched types --> $DIR/issue-70388-recover-dotdotdot-rest-pat.rs:6:33 diff --git a/tests/ui/parser/issues/issue-70388-without-witness.stderr b/tests/ui/parser/issues/issue-70388-without-witness.stderr index b750ad4c626d6..1266cef5c22da 100644 --- a/tests/ui/parser/issues/issue-70388-without-witness.stderr +++ b/tests/ui/parser/issues/issue-70388-without-witness.stderr @@ -2,19 +2,23 @@ error: unexpected `...` --> $DIR/issue-70388-without-witness.rs:7:13 | LL | let Foo(...) = Foo(0); - | ^^^ - | | - | not a valid pattern - | help: for a rest pattern, use `..` instead of `...` + | ^^^ not a valid pattern + | +help: for a rest pattern, use `..` instead of `...` + | +LL | let Foo(..) = Foo(0); + | ~~ error: unexpected `...` --> $DIR/issue-70388-without-witness.rs:8:13 | LL | let [_, ..., _] = [0, 1]; - | ^^^ - | | - | not a valid pattern - | help: for a rest pattern, use `..` instead of `...` + | ^^^ not a valid pattern + | +help: for a rest pattern, use `..` instead of `...` + | +LL | let [_, .., _] = [0, 1]; + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr index ec0af9a6caf1e..d0b06c19c20f7 100644 --- a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr +++ b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr @@ -8,16 +8,24 @@ error: expected one of `:`, `@`, or `|`, found keyword `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17 | LL | fn foo(&mur Self) {} - | -----^^^^ - | | | - | | expected one of `:`, `@`, or `|` - | help: declare the type after the parameter binding: `: ` + | ^^^^ expected one of `:`, `@`, or `|` + | +help: declare the type after the parameter binding + | +LL | fn foo(: ) {} + | ~~~~~~~~~~~~~~~~~~~~ error: unexpected lifetime `'static` in pattern --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:13 | LL | fn bar(&'static mur Self) {} - | ^^^^^^^ help: remove the lifetime + | ^^^^^^^ + | +help: remove the lifetime + | +LL - fn bar(&'static mur Self) {} +LL + fn bar(& mur Self) {} + | error: expected identifier, found keyword `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25 @@ -29,10 +37,12 @@ error: expected one of `:`, `@`, or `|`, found keyword `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25 | LL | fn bar(&'static mur Self) {} - | -------------^^^^ - | | | - | | expected one of `:`, `@`, or `|` - | help: declare the type after the parameter binding: `: ` + | ^^^^ expected one of `:`, `@`, or `|` + | +help: declare the type after the parameter binding + | +LL | fn bar(: ) {} + | ~~~~~~~~~~~~~~~~~~~~ error: expected one of `:`, `@`, or `|`, found keyword `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:14:17 diff --git a/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr b/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr index 652aeff5dd44f..c5ae72afbc505 100644 --- a/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr +++ b/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr @@ -2,24 +2,38 @@ error: lifetime must precede `mut` --> $DIR/issue-73568-lifetime-after-mut.rs:2:13 | LL | fn x<'a>(x: &mut 'a i32){} - | ^^^^^^^ help: place the lifetime before `mut`: `&'a mut` + | ^^^^^^^ + | +help: place the lifetime before `mut` + | +LL | fn x<'a>(x: &'a mut i32){} + | ~~~~~~~ error[E0178]: expected a path on the left-hand side of `+`, not `&mut 'a` --> $DIR/issue-73568-lifetime-after-mut.rs:14:13 | LL | fn y<'a>(y: &mut 'a + Send) { - | ^^^^^^^^^^^^^^ help: try adding parentheses: `&mut ('a + Send)` + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn y<'a>(y: &mut ('a + Send)) { + | ~~~~~~~~~~~~~~~~ error: lifetime must precede `mut` --> $DIR/issue-73568-lifetime-after-mut.rs:6:22 | LL | fn w<$lt>(w: &mut $lt i32) {} - | ^^^^^^^^ help: place the lifetime before `mut`: `&$lt mut` + | ^^^^^^^^ ... LL | mac!('a); | -------- in this macro invocation | = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: place the lifetime before `mut` + | +LL | fn w<$lt>(w: &$lt mut i32) {} + | ~~~~~~~~ error[E0423]: expected value, found trait `Send` --> $DIR/issue-73568-lifetime-after-mut.rs:17:28 diff --git a/tests/ui/parser/issues/issue-76437-async.stderr b/tests/ui/parser/issues/issue-76437-async.stderr index 483599135f566..8639bbf2c17f2 100644 --- a/tests/ui/parser/issues/issue-76437-async.stderr +++ b/tests/ui/parser/issues/issue-76437-async.stderr @@ -2,10 +2,12 @@ error: expected one of `extern`, `fn`, `safe`, or `unsafe`, found keyword `pub` --> $DIR/issue-76437-async.rs:4:11 | LL | async pub fn t() {} - | ------^^^ - | | | - | | expected one of `extern`, `fn`, `safe`, or `unsafe` - | help: visibility `pub` must come before `async`: `pub async` + | ^^^ expected one of `extern`, `fn`, `safe`, or `unsafe` + | +help: visibility `pub` must come before `async` + | +LL | pub async fn t() {} + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-const-async-unsafe.stderr b/tests/ui/parser/issues/issue-76437-const-async-unsafe.stderr index a703fc4e8a452..0b5f924ed6cab 100644 --- a/tests/ui/parser/issues/issue-76437-const-async-unsafe.stderr +++ b/tests/ui/parser/issues/issue-76437-const-async-unsafe.stderr @@ -2,10 +2,12 @@ error: expected one of `extern` or `fn`, found keyword `pub` --> $DIR/issue-76437-const-async-unsafe.rs:4:24 | LL | const async unsafe pub fn t() {} - | -------------------^^^ - | | | - | | expected one of `extern` or `fn` - | help: visibility `pub` must come before `const async unsafe`: `pub const async unsafe` + | ^^^ expected one of `extern` or `fn` + | +help: visibility `pub` must come before `const async unsafe` + | +LL | pub const async unsafe fn t() {} + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-const-async.stderr b/tests/ui/parser/issues/issue-76437-const-async.stderr index 81fa8a5f557e0..5a0f819f868c5 100644 --- a/tests/ui/parser/issues/issue-76437-const-async.stderr +++ b/tests/ui/parser/issues/issue-76437-const-async.stderr @@ -2,10 +2,12 @@ error: expected one of `extern`, `fn`, `safe`, or `unsafe`, found keyword `pub` --> $DIR/issue-76437-const-async.rs:4:17 | LL | const async pub fn t() {} - | ------------^^^ - | | | - | | expected one of `extern`, `fn`, `safe`, or `unsafe` - | help: visibility `pub` must come before `const async`: `pub const async` + | ^^^ expected one of `extern`, `fn`, `safe`, or `unsafe` + | +help: visibility `pub` must come before `const async` + | +LL | pub const async fn t() {} + | ~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-const.stderr b/tests/ui/parser/issues/issue-76437-const.stderr index 005a27b7c2498..2eb92d416c1b8 100644 --- a/tests/ui/parser/issues/issue-76437-const.stderr +++ b/tests/ui/parser/issues/issue-76437-const.stderr @@ -2,10 +2,12 @@ error: expected one of `async`, `extern`, `fn`, `safe`, or `unsafe`, found keywo --> $DIR/issue-76437-const.rs:4:11 | LL | const pub fn t() {} - | ------^^^ - | | | - | | expected one of `async`, `extern`, `fn`, `safe`, or `unsafe` - | help: visibility `pub` must come before `const`: `pub const` + | ^^^ expected one of `async`, `extern`, `fn`, `safe`, or `unsafe` + | +help: visibility `pub` must come before `const` + | +LL | pub const fn t() {} + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr b/tests/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr index 4ea76179be3f6..6bdc77dd8ed91 100644 --- a/tests/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr +++ b/tests/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr @@ -2,10 +2,12 @@ error: expected one of `extern` or `fn`, found keyword `pub` --> $DIR/issue-76437-pub-crate-unsafe.rs:4:12 | LL | unsafe pub(crate) fn t() {} - | -------^^^------- - | | | - | | expected one of `extern` or `fn` - | help: visibility `pub(crate)` must come before `unsafe`: `pub(crate) unsafe` + | ^^^ expected one of `extern` or `fn` + | +help: visibility `pub(crate)` must come before `unsafe` + | +LL | pub(crate) unsafe fn t() {} + | ~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-unsafe.stderr b/tests/ui/parser/issues/issue-76437-unsafe.stderr index 69f7927750bf0..084593a3ed876 100644 --- a/tests/ui/parser/issues/issue-76437-unsafe.stderr +++ b/tests/ui/parser/issues/issue-76437-unsafe.stderr @@ -2,10 +2,12 @@ error: expected one of `extern` or `fn`, found keyword `pub` --> $DIR/issue-76437-unsafe.rs:4:12 | LL | unsafe pub fn t() {} - | -------^^^ - | | | - | | expected one of `extern` or `fn` - | help: visibility `pub` must come before `unsafe`: `pub unsafe` + | ^^^ expected one of `extern` or `fn` + | +help: visibility `pub` must come before `unsafe` + | +LL | pub unsafe fn t() {} + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76597.stderr b/tests/ui/parser/issues/issue-76597.stderr index 25858981cff0f..81e72448b30ac 100644 --- a/tests/ui/parser/issues/issue-76597.stderr +++ b/tests/ui/parser/issues/issue-76597.stderr @@ -2,12 +2,14 @@ error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `y` --> $DIR/issue-76597.rs:7:38 | LL | ... x: u8 - | - - | | - | expected one of 7 possible tokens - | help: missing `,` + | - expected one of 7 possible tokens LL | ... y: u8, | ^ unexpected token + | +help: missing `,` + | +LL | x: u8, + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87197-missing-semicolon.stderr b/tests/ui/parser/issues/issue-87197-missing-semicolon.stderr index 57772de1e7a4b..874e7b0716306 100644 --- a/tests/ui/parser/issues/issue-87197-missing-semicolon.stderr +++ b/tests/ui/parser/issues/issue-87197-missing-semicolon.stderr @@ -2,25 +2,40 @@ error: expected `;`, found `println` --> $DIR/issue-87197-missing-semicolon.rs:6:16 | LL | let x = 100 - | ^ help: add `;` here + | ^ LL | println!("{}", x) | ------- unexpected token + | +help: add `;` here + | +LL | let x = 100; + | + error: expected `;`, found keyword `let` --> $DIR/issue-87197-missing-semicolon.rs:7:22 | LL | println!("{}", x) - | ^ help: add `;` here + | ^ LL | let y = 200 | --- unexpected token + | +help: add `;` here + | +LL | println!("{}", x); + | + error: expected `;`, found `println` --> $DIR/issue-87197-missing-semicolon.rs:8:16 | LL | let y = 200 - | ^ help: add `;` here + | ^ LL | println!("{}", y); | ------- unexpected token + | +help: add `;` here + | +LL | let y = 200; + | + error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr index ed2e4d8154929..692fbc0350953 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr @@ -2,16 +2,18 @@ error: expected one of `extern`, `fn`, `safe`, or `unsafe`, found keyword `const --> $DIR/const-async-const.rs:5:13 | LL | const async const fn test() {} - | ^^^^^ - | | - | expected one of `extern`, `fn`, `safe`, or `unsafe` - | help: `const` already used earlier, remove this one + | ^^^^^ expected one of `extern`, `fn`, `safe`, or `unsafe` | note: `const` first seen here --> $DIR/const-async-const.rs:5:1 | LL | const async const fn test() {} | ^^^^^ +help: `const` already used earlier, remove this one + | +LL - const async const fn test() {} +LL + const async fn test() {} + | error: functions cannot be both `const` and `async` --> $DIR/const-async-const.rs:5:1 diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr index 3f504a9ebfc49..c4f207d7cd331 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr @@ -2,27 +2,30 @@ error: expected one of `extern` or `fn`, found keyword `const` --> $DIR/recovery.rs:6:12 | LL | unsafe const fn from_u32(val: u32) {} - | -------^^^^^ - | | | - | | expected one of `extern` or `fn` - | help: `const` must come before `unsafe`: `const unsafe` + | ^^^^^ expected one of `extern` or `fn` | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +help: `const` must come before `unsafe` + | +LL | const unsafe fn from_u32(val: u32) {} + | ~~~~~~~~~~~~ error: expected one of `extern` or `fn`, found keyword `unsafe` --> $DIR/recovery.rs:14:12 | LL | unsafe unsafe fn from_u32(val: u32) {} - | ^^^^^^ - | | - | expected one of `extern` or `fn` - | help: `unsafe` already used earlier, remove this one + | ^^^^^^ expected one of `extern` or `fn` | note: `unsafe` first seen here --> $DIR/recovery.rs:14:5 | LL | unsafe unsafe fn from_u32(val: u32) {} | ^^^^^^ +help: `unsafe` already used earlier, remove this one + | +LL - unsafe unsafe fn from_u32(val: u32) {} +LL + unsafe fn from_u32(val: u32) {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr index 489e8eefb052e..ec0977e485607 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr @@ -2,12 +2,13 @@ error: expected one of `extern` or `fn`, found keyword `const` --> $DIR/several-kw-jump.rs:9:14 | LL | async unsafe const fn test() {} - | -------------^^^^^ - | | | - | | expected one of `extern` or `fn` - | help: `const` must come before `async unsafe`: `const async unsafe` + | ^^^^^ expected one of `extern` or `fn` | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +help: `const` must come before `async unsafe` + | +LL | const async unsafe fn test() {} + | ~~~~~~~~~~~~~~~~~~ error: functions cannot be both `const` and `async` --> $DIR/several-kw-jump.rs:9:1 diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr index 74989502e7f5d..d66afac46ee1a 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr @@ -2,12 +2,13 @@ error: expected one of `extern` or `fn`, found keyword `async` --> $DIR/wrong-async.rs:9:8 | LL | unsafe async fn test() {} - | -------^^^^^ - | | | - | | expected one of `extern` or `fn` - | help: `async` must come before `unsafe`: `async unsafe` + | ^^^^^ expected one of `extern` or `fn` | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +help: `async` must come before `unsafe` + | +LL | async unsafe fn test() {} + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr index 5958f0c7d2ddd..f5fb163a89cfe 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr @@ -2,12 +2,13 @@ error: expected one of `extern` or `fn`, found keyword `const` --> $DIR/wrong-const.rs:9:8 | LL | unsafe const fn test() {} - | -------^^^^^ - | | | - | | expected one of `extern` or `fn` - | help: `const` must come before `unsafe`: `const unsafe` + | ^^^^^ expected one of `extern` or `fn` | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +help: `const` must come before `unsafe` + | +LL | const unsafe fn test() {} + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr index 0e9f7c51e1a45..4bc4e56ec4edb 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr @@ -2,12 +2,13 @@ error: expected `fn`, found keyword `unsafe` --> $DIR/wrong-unsafe.rs:9:8 | LL | extern unsafe fn test() {} - | -------^^^^^^ - | | | - | | expected `fn` - | help: `unsafe` must come before `extern`: `unsafe extern` + | ^^^^^^ expected `fn` | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +help: `unsafe` must come before `extern` + | +LL | unsafe extern fn test() {} + | ~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87635.stderr b/tests/ui/parser/issues/issue-87635.stderr index 1d459f1b907ed..e399c13066179 100644 --- a/tests/ui/parser/issues/issue-87635.stderr +++ b/tests/ui/parser/issues/issue-87635.stderr @@ -13,7 +13,12 @@ error: associated function in `impl` without body --> $DIR/issue-87635.rs:4:5 | LL | pub fn bar() - | ^^^^^^^^^^^^- help: provide a definition for the function: `{ }` + | ^^^^^^^^^^^^ + | +help: provide a definition for the function + | +LL | pub fn bar() { } + | ++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr index dd75f32f68ff2..50d58ffb2fb35 100644 --- a/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr +++ b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr @@ -2,16 +2,18 @@ error: expected one of `async`, `extern`, `fn`, `safe`, or `unsafe`, found keywo --> $DIR/issue-87694-duplicated-pub.rs:1:11 | LL | pub const pub fn test() {} - | ^^^ - | | - | expected one of `async`, `extern`, `fn`, `safe`, or `unsafe` - | help: there is already a visibility modifier, remove one + | ^^^ expected one of `async`, `extern`, `fn`, `safe`, or `unsafe` | note: explicit visibility first seen here --> $DIR/issue-87694-duplicated-pub.rs:1:1 | LL | pub const pub fn test() {} | ^^^ +help: there is already a visibility modifier, remove one + | +LL - pub const pub fn test() {} +LL + pub const fn test() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr index d35e09dceaf7f..db87583eb5de4 100644 --- a/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr +++ b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr @@ -2,10 +2,12 @@ error: expected one of `async`, `extern`, `fn`, `safe`, or `unsafe`, found keywo --> $DIR/issue-87694-misplaced-pub.rs:1:7 | LL | const pub fn test() {} - | ------^^^ - | | | - | | expected one of `async`, `extern`, `fn`, `safe`, or `unsafe` - | help: visibility `pub` must come before `const`: `pub const` + | ^^^ expected one of `async`, `extern`, `fn`, `safe`, or `unsafe` + | +help: visibility `pub` must come before `const` + | +LL | pub const fn test() {} + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-89396.stderr b/tests/ui/parser/issues/issue-89396.stderr index 41ce07050746a..6744f2cf07eea 100644 --- a/tests/ui/parser/issues/issue-89396.stderr +++ b/tests/ui/parser/issues/issue-89396.stderr @@ -2,19 +2,23 @@ error: expected one of `=>`, `if`, or `|`, found `=` --> $DIR/issue-89396.rs:9:17 | LL | Some(_) = true, - | ^ - | | - | expected one of `=>`, `if`, or `|` - | help: use a fat arrow to start a match arm: `=>` + | ^ expected one of `=>`, `if`, or `|` + | +help: use a fat arrow to start a match arm + | +LL | Some(_) => true, + | ~~ error: expected one of `=>`, `@`, `if`, or `|`, found `->` --> $DIR/issue-89396.rs:12:14 | LL | None -> false, - | ^^ - | | - | expected one of `=>`, `@`, `if`, or `|` - | help: use a fat arrow to start a match arm: `=>` + | ^^ expected one of `=>`, `@`, `if`, or `|` + | +help: use a fat arrow to start a match arm + | +LL | None => false, + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-89574.stderr b/tests/ui/parser/issues/issue-89574.stderr index a0586d41e2e59..aa5e66b18a927 100644 --- a/tests/ui/parser/issues/issue-89574.stderr +++ b/tests/ui/parser/issues/issue-89574.stderr @@ -8,7 +8,12 @@ error: missing type for `const` item --> $DIR/issue-89574.rs:2:22 | LL | const EMPTY_ARRAY = []; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | const EMPTY_ARRAY: = []; + | ++++++++ error[E0282]: type annotations needed --> $DIR/issue-89574.rs:2:25 diff --git a/tests/ui/parser/issues/issue-90993.stderr b/tests/ui/parser/issues/issue-90993.stderr index ab6bce410e6cc..a18e93f1f1a98 100644 --- a/tests/ui/parser/issues/issue-90993.stderr +++ b/tests/ui/parser/issues/issue-90993.stderr @@ -17,9 +17,13 @@ error: unexpected `=` after inclusive range --> $DIR/issue-90993.rs:2:5 | LL | ...=. - | ^^^^ help: use `..=` instead + | ^^^^ | = note: inclusive ranges end with a single equals sign (`..=`) +help: use `..=` instead + | +LL | ..=. + | ~~~ error: expected one of `-`, `;`, `}`, or path, found `.` --> $DIR/issue-90993.rs:2:9 diff --git a/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr index c503bc3ccfcb7..c98b8fa1f1eeb 100644 --- a/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr +++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr @@ -2,7 +2,12 @@ error: `enum` and `struct` are mutually exclusive --> $DIR/issue-99625-enum-struct-mutually-exclusive.rs:3:5 | LL | pub enum struct Range { - | ^^^^^^^^^^^ help: replace `enum struct` with: `enum` + | ^^^^^^^^^^^ + | +help: replace `enum struct` with + | +LL | pub enum Range { + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr index 72377fc379cac..1ccf44a350d9e 100644 --- a/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr +++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr @@ -2,13 +2,23 @@ error: `const` and `let` are mutually exclusive --> $DIR/issue-99910-const-let-mutually-exclusive.rs:4:5 | LL | const let _FOO: i32 = 123; - | ^^^^^^^^^ help: remove `let`: `const` + | ^^^^^^^^^ + | +help: remove `let` + | +LL | const _FOO: i32 = 123; + | ~~~~~ error: `const` and `let` are mutually exclusive --> $DIR/issue-99910-const-let-mutually-exclusive.rs:6:5 | LL | let const _BAR: i32 = 123; - | ^^^^^^^^^ help: remove `let`: `const` + | ^^^^^^^^^ + | +help: remove `let` + | +LL | const _BAR: i32 = 123; + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.stderr b/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.stderr index 2d7f540443d29..8d4f23683863b 100644 --- a/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.stderr +++ b/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.stderr @@ -2,9 +2,14 @@ error: expected item, found `;` --> $DIR/missing-main-issue-124935-semi-after-item.rs:5:1 | LL | ; - | ^ help: remove this semicolon + | ^ | = help: function declarations are not followed by a semicolon +help: remove this semicolon + | +LL - ; +LL + + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr b/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr index 2df5cca24f06c..fcc0c730f781d 100644 --- a/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr +++ b/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr @@ -2,10 +2,12 @@ error: expected one of `...`, `..=`, `..`, `=>`, `if`, or `|`, found `>=` --> $DIR/recover-ge-as-fat-arrow.rs:4:11 | LL | 1 >= {} - | ^^ - | | - | expected one of `...`, `..=`, `..`, `=>`, `if`, or `|` - | help: use a fat arrow to start a match arm: `=>` + | ^^ expected one of `...`, `..=`, `..`, `=>`, `if`, or `|` + | +help: use a fat arrow to start a match arm + | +LL | 1 => {} + | ~~ error[E0308]: mismatched types --> $DIR/recover-ge-as-fat-arrow.rs:5:29 diff --git a/tests/ui/parser/item-free-const-no-body-semantic-fail.stderr b/tests/ui/parser/item-free-const-no-body-semantic-fail.stderr index 5365b0a1f8242..ed1cf1f2db546 100644 --- a/tests/ui/parser/item-free-const-no-body-semantic-fail.stderr +++ b/tests/ui/parser/item-free-const-no-body-semantic-fail.stderr @@ -2,23 +2,34 @@ error: free constant item without body --> $DIR/item-free-const-no-body-semantic-fail.rs:5:1 | LL | const A: u8; - | ^^^^^^^^^^^- - | | - | help: provide a definition for the constant: `= ;` + | ^^^^^^^^^^^^ + | +help: provide a definition for the constant + | +LL | const A: u8 = ; + | ~~~~~~~~~ error: free constant item without body --> $DIR/item-free-const-no-body-semantic-fail.rs:6:1 | LL | const B; - | ^^^^^^^- - | | - | help: provide a definition for the constant: `= ;` + | ^^^^^^^^ + | +help: provide a definition for the constant + | +LL | const B = ; + | ~~~~~~~~~ error: missing type for `const` item --> $DIR/item-free-const-no-body-semantic-fail.rs:6:8 | LL | const B; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | const B: ; + | ++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/parser/item-free-static-no-body-semantic-fail.stderr b/tests/ui/parser/item-free-static-no-body-semantic-fail.stderr index 1b61e430546e0..48ac65249c80f 100644 --- a/tests/ui/parser/item-free-static-no-body-semantic-fail.stderr +++ b/tests/ui/parser/item-free-static-no-body-semantic-fail.stderr @@ -2,45 +2,67 @@ error: free static item without body --> $DIR/item-free-static-no-body-semantic-fail.rs:5:1 | LL | static A: u8; - | ^^^^^^^^^^^^- - | | - | help: provide a definition for the static: `= ;` + | ^^^^^^^^^^^^^ + | +help: provide a definition for the static + | +LL | static A: u8 = ; + | ~~~~~~~~~ error: free static item without body --> $DIR/item-free-static-no-body-semantic-fail.rs:6:1 | LL | static B; - | ^^^^^^^^- - | | - | help: provide a definition for the static: `= ;` + | ^^^^^^^^^ + | +help: provide a definition for the static + | +LL | static B = ; + | ~~~~~~~~~ error: free static item without body --> $DIR/item-free-static-no-body-semantic-fail.rs:9:1 | LL | static mut C: u8; - | ^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the static: `= ;` + | ^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the static + | +LL | static mut C: u8 = ; + | ~~~~~~~~~ error: free static item without body --> $DIR/item-free-static-no-body-semantic-fail.rs:10:1 | LL | static mut D; - | ^^^^^^^^^^^^- - | | - | help: provide a definition for the static: `= ;` + | ^^^^^^^^^^^^^ + | +help: provide a definition for the static + | +LL | static mut D = ; + | ~~~~~~~~~ error: missing type for `static` item --> $DIR/item-free-static-no-body-semantic-fail.rs:6:9 | LL | static B; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | static B: ; + | ++++++++ error: missing type for `static mut` item --> $DIR/item-free-static-no-body-semantic-fail.rs:10:13 | LL | static mut D; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | static mut D: ; + | ++++++++ error: aborting due to 6 previous errors diff --git a/tests/ui/parser/item-free-type-bounds-semantic-fail.stderr b/tests/ui/parser/item-free-type-bounds-semantic-fail.stderr index 1077c10392888..7d1b052279c1d 100644 --- a/tests/ui/parser/item-free-type-bounds-semantic-fail.stderr +++ b/tests/ui/parser/item-free-type-bounds-semantic-fail.stderr @@ -2,9 +2,12 @@ error: free type alias without body --> $DIR/item-free-type-bounds-semantic-fail.rs:4:5 | LL | type A: Ord; - | ^^^^^^^^^^^- - | | - | help: provide a definition for the type: `= ;` + | ^^^^^^^^^^^^ + | +help: provide a definition for the type + | +LL | type A: Ord = ; + | ~~~~~~~~~ error: bounds on `type`s in this context have no effect --> $DIR/item-free-type-bounds-semantic-fail.rs:4:13 @@ -28,9 +31,12 @@ error: free type alias without body --> $DIR/item-free-type-bounds-semantic-fail.rs:11:5 | LL | type D<_T>: Ord; - | ^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the type: `= ;` + | ^^^^^^^^^^^^^^^^ + | +help: provide a definition for the type + | +LL | type D<_T>: Ord = ; + | ~~~~~~~~~ error: bounds on `type`s in this context have no effect --> $DIR/item-free-type-bounds-semantic-fail.rs:11:17 diff --git a/tests/ui/parser/item-kw-case-mismatch.stderr b/tests/ui/parser/item-kw-case-mismatch.stderr index ba59ea8536338..0abc59e064a00 100644 --- a/tests/ui/parser/item-kw-case-mismatch.stderr +++ b/tests/ui/parser/item-kw-case-mismatch.stderr @@ -2,85 +2,155 @@ error: keyword `use` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:7:1 | LL | Use std::ptr::read; - | ^^^ help: write it in the correct case (notice the capitalization): `use` + | ^^^ + | +help: write it in the correct case (notice the capitalization difference) + | +LL | use std::ptr::read; + | ~~~ error: keyword `use` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:8:1 | LL | USE std::ptr::write; - | ^^^ help: write it in the correct case: `use` + | ^^^ + | +help: write it in the correct case + | +LL | use std::ptr::write; + | ~~~ error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:10:7 | LL | async Fn _a() {} - | ^^ help: write it in the correct case (notice the capitalization): `fn` + | ^^ + | +help: write it in the correct case (notice the capitalization difference) + | +LL | async fn _a() {} + | ~~ error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:13:1 | LL | Fn _b() {} - | ^^ help: write it in the correct case (notice the capitalization): `fn` + | ^^ + | +help: write it in the correct case (notice the capitalization difference) + | +LL | fn _b() {} + | ~~ error: keyword `async` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:16:1 | LL | aSYNC fN _c() {} - | ^^^^^ help: write it in the correct case: `async` + | ^^^^^ + | +help: write it in the correct case + | +LL | async fN _c() {} + | ~~~~~ error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:16:7 | LL | aSYNC fN _c() {} - | ^^ help: write it in the correct case: `fn` + | ^^ + | +help: write it in the correct case + | +LL | aSYNC fn _c() {} + | ~~ error: keyword `async` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:20:1 | LL | Async fn _d() {} - | ^^^^^ help: write it in the correct case: `async` + | ^^^^^ + | +help: write it in the correct case + | +LL | async fn _d() {} + | ~~~~~ error: keyword `const` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:1 | LL | CONST UNSAFE FN _e() {} - | ^^^^^ help: write it in the correct case: `const` + | ^^^^^ + | +help: write it in the correct case + | +LL | const UNSAFE FN _e() {} + | ~~~~~ error: keyword `unsafe` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:7 | LL | CONST UNSAFE FN _e() {} - | ^^^^^^ help: write it in the correct case: `unsafe` + | ^^^^^^ + | +help: write it in the correct case + | +LL | CONST unsafe FN _e() {} + | ~~~~~~ error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:14 | LL | CONST UNSAFE FN _e() {} - | ^^ help: write it in the correct case: `fn` + | ^^ + | +help: write it in the correct case + | +LL | CONST UNSAFE fn _e() {} + | ~~ error: keyword `unsafe` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:28:1 | LL | unSAFE EXTern fn _f() {} - | ^^^^^^ help: write it in the correct case: `unsafe` + | ^^^^^^ + | +help: write it in the correct case + | +LL | unsafe EXTern fn _f() {} + | ~~~~~~ error: keyword `extern` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:28:8 | LL | unSAFE EXTern fn _f() {} - | ^^^^^^ help: write it in the correct case: `extern` + | ^^^^^^ + | +help: write it in the correct case + | +LL | unSAFE extern fn _f() {} + | ~~~~~~ error: keyword `extern` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:32:1 | LL | EXTERN "C" FN _g() {} - | ^^^^^^ help: write it in the correct case: `extern` + | ^^^^^^ + | +help: write it in the correct case + | +LL | extern "C" FN _g() {} + | ~~~~~~ error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:32:12 | LL | EXTERN "C" FN _g() {} - | ^^ help: write it in the correct case: `fn` + | ^^ + | +help: write it in the correct case + | +LL | EXTERN "C" fn _g() {} + | ~~ error: aborting due to 14 previous errors diff --git a/tests/ui/parser/item-needs-block.stderr b/tests/ui/parser/item-needs-block.stderr index 3cabd0c73a3c9..e872c13f757d4 100644 --- a/tests/ui/parser/item-needs-block.stderr +++ b/tests/ui/parser/item-needs-block.stderr @@ -4,7 +4,10 @@ error: expected `{}`, found `;` LL | trait Trait; | ^ | - = help: try using `{}` instead +help: try using `{}` instead + | +LL | trait Trait{} + | ~~ error: expected `{}`, found `;` --> $DIR/item-needs-block.rs:4:18 @@ -12,7 +15,10 @@ error: expected `{}`, found `;` LL | impl Trait for (); | ^ | - = help: try using `{}` instead +help: try using `{}` instead + | +LL | impl Trait for (){} + | ~~ error: expected `{}`, found `;` --> $DIR/item-needs-block.rs:7:10 @@ -20,7 +26,10 @@ error: expected `{}`, found `;` LL | enum Enum; | ^ | - = help: try using `{}` instead +help: try using `{}` instead + | +LL | enum Enum{} + | ~~ error: aborting due to 3 previous errors diff --git a/tests/ui/parser/kw-in-trait-bounds.stderr b/tests/ui/parser/kw-in-trait-bounds.stderr index 3c54e03195031..4a1ad3667373d 100644 --- a/tests/ui/parser/kw-in-trait-bounds.stderr +++ b/tests/ui/parser/kw-in-trait-bounds.stderr @@ -90,37 +90,57 @@ error[E0405]: cannot find trait `r#struct` in this scope --> $DIR/kw-in-trait-bounds.rs:16:10 | LL | fn _g(_: impl struct, _: &dyn struct) - | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` + | ^^^^^^ ... LL | trait Struct {} | ------------ similarly named trait `Struct` defined here + | +help: a trait with a similar name exists (notice the capitalization difference) + | +LL | fn _g(_: impl struct, _: &dyn struct) + | ~~~~~~ error[E0405]: cannot find trait `r#struct` in this scope --> $DIR/kw-in-trait-bounds.rs:30:8 | LL | B: struct, - | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` + | ^^^^^^ ... LL | trait Struct {} | ------------ similarly named trait `Struct` defined here + | +help: a trait with a similar name exists (notice the capitalization difference) + | +LL | B: Struct, + | ~~~~~~ error[E0405]: cannot find trait `r#struct` in this scope --> $DIR/kw-in-trait-bounds.rs:16:29 | LL | fn _g(_: impl struct, _: &dyn struct) - | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` + | ^^^^^^ ... LL | trait Struct {} | ------------ similarly named trait `Struct` defined here + | +help: a trait with a similar name exists (notice the capitalization difference) + | +LL | fn _g(_: impl Struct, _: &dyn struct) + | ~~~~~~ error[E0405]: cannot find trait `r#struct` in this scope --> $DIR/kw-in-trait-bounds.rs:16:45 | LL | fn _g(_: impl struct, _: &dyn struct) - | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` + | ^^^^^^ ... LL | trait Struct {} | ------------ similarly named trait `Struct` defined here + | +help: a trait with a similar name exists (notice the capitalization difference) + | +LL | fn _g(_: impl struct, _: &dyn Struct) + | ~~~~~~ error: aborting due to 12 previous errors diff --git a/tests/ui/parser/label-after-block-like.stderr b/tests/ui/parser/label-after-block-like.stderr index 8ff50b124b32b..a480ce087a502 100644 --- a/tests/ui/parser/label-after-block-like.stderr +++ b/tests/ui/parser/label-after-block-like.stderr @@ -2,12 +2,15 @@ error: labeled expression must be followed by `:` --> $DIR/label-after-block-like.rs:2:20 | LL | if let () = () 'a {} - | ---^^ - | | | - | | help: add `:` after the label + | --^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | if let () = () 'a: {} + | + error: expected `{`, found `'a` --> $DIR/label-after-block-like.rs:2:20 @@ -29,12 +32,15 @@ error: labeled expression must be followed by `:` --> $DIR/label-after-block-like.rs:8:13 | LL | if true 'a {} - | ---^^ - | | | - | | help: add `:` after the label + | --^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | if true 'a: {} + | + error: expected `{`, found `'a` --> $DIR/label-after-block-like.rs:8:13 @@ -56,12 +62,15 @@ error: labeled expression must be followed by `:` --> $DIR/label-after-block-like.rs:14:10 | LL | loop 'a {} - | ---^^ - | | | - | | help: add `:` after the label + | --^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | loop 'a: {} + | + error: expected `{`, found `'a` --> $DIR/label-after-block-like.rs:14:10 @@ -80,12 +89,15 @@ error: labeled expression must be followed by `:` --> $DIR/label-after-block-like.rs:20:16 | LL | while true 'a {} - | ---^^ - | | | - | | help: add `:` after the label + | --^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | while true 'a: {} + | + error: expected `{`, found `'a` --> $DIR/label-after-block-like.rs:20:16 @@ -105,12 +117,15 @@ error: labeled expression must be followed by `:` --> $DIR/label-after-block-like.rs:26:23 | LL | while let () = () 'a {} - | ---^^ - | | | - | | help: add `:` after the label + | --^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | while let () = () 'a: {} + | + error: expected `{`, found `'a` --> $DIR/label-after-block-like.rs:26:23 @@ -130,12 +145,15 @@ error: labeled expression must be followed by `:` --> $DIR/label-after-block-like.rs:32:19 | LL | for _ in 0..0 'a {} - | ---^^ - | | | - | | help: add `:` after the label + | --^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | for _ in 0..0 'a: {} + | + error: expected `{`, found `'a` --> $DIR/label-after-block-like.rs:32:19 @@ -152,12 +170,15 @@ error: labeled expression must be followed by `:` --> $DIR/label-after-block-like.rs:38:12 | LL | unsafe 'a {} - | ---^^ - | | | - | | help: add `:` after the label + | --^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | unsafe 'a: {} + | + error: expected `{`, found `'a` --> $DIR/label-after-block-like.rs:38:12 diff --git a/tests/ui/parser/labeled-no-colon-expr.stderr b/tests/ui/parser/labeled-no-colon-expr.stderr index 4d61d9c14034c..22920d0a6c47a 100644 --- a/tests/ui/parser/labeled-no-colon-expr.stderr +++ b/tests/ui/parser/labeled-no-colon-expr.stderr @@ -2,45 +2,57 @@ error: labeled expression must be followed by `:` --> $DIR/labeled-no-colon-expr.rs:2:5 | LL | 'l0 while false {} - | ----^^^^^^^^^^^^^^ - | | | - | | help: add `:` after the label + | ---^^^^^^^^^^^^^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | 'l0: while false {} + | + error: labeled expression must be followed by `:` --> $DIR/labeled-no-colon-expr.rs:3:5 | LL | 'l1 for _ in 0..1 {} - | ----^^^^^^^^^^^^^^^^ - | | | - | | help: add `:` after the label + | ---^^^^^^^^^^^^^^^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | 'l1: for _ in 0..1 {} + | + error: labeled expression must be followed by `:` --> $DIR/labeled-no-colon-expr.rs:4:5 | LL | 'l2 loop {} - | ----^^^^^^^ - | | | - | | help: add `:` after the label + | ---^^^^^^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | 'l2: loop {} + | + error: labeled expression must be followed by `:` --> $DIR/labeled-no-colon-expr.rs:5:5 | LL | 'l3 {} - | ----^^ - | | | - | | help: add `:` after the label + | ---^^^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | 'l3: {} + | + error: expected `while`, `for`, `loop` or `{` after a label --> $DIR/labeled-no-colon-expr.rs:6:9 @@ -58,12 +70,15 @@ error: labeled expression must be followed by `:` --> $DIR/labeled-no-colon-expr.rs:6:9 | LL | 'l4 0; - | ----^ - | | | - | | help: add `:` after the label + | --- ^ + | | | the label | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | 'l4: 0; + | + error: cannot use a `block` macro fragment here --> $DIR/labeled-no-colon-expr.rs:11:17 @@ -86,14 +101,16 @@ error: labeled expression must be followed by `:` --> $DIR/labeled-no-colon-expr.rs:14:8 | LL | 'l5 $b; - | ---- help: add `:` after the label - | | - | the label + | --- the label ... LL | m!({}); | ^^ | = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them +help: add `:` after the label + | +LL | 'l5: $b; + | + error: aborting due to 8 previous errors diff --git a/tests/ui/parser/let-binop.stderr b/tests/ui/parser/let-binop.stderr index dd33e9157cfd5..1fdb24d590dec 100644 --- a/tests/ui/parser/let-binop.stderr +++ b/tests/ui/parser/let-binop.stderr @@ -2,25 +2,37 @@ error: can't reassign to an uninitialized variable --> $DIR/let-binop.rs:4:15 | LL | let a: i8 *= 1; - | ^^ help: initialize the variable + | ^^ | = help: if you meant to overwrite, remove the `let` binding +help: initialize the variable + | +LL | let a: i8 = 1; + | ~ error: can't reassign to an uninitialized variable --> $DIR/let-binop.rs:6:11 | LL | let b += 1; - | ^^ help: initialize the variable + | ^^ | = help: if you meant to overwrite, remove the `let` binding +help: initialize the variable + | +LL | let b = 1; + | ~ error: can't reassign to an uninitialized variable --> $DIR/let-binop.rs:8:11 | LL | let c *= 1; - | ^^ help: initialize the variable + | ^^ | = help: if you meant to overwrite, remove the `let` binding +help: initialize the variable + | +LL | let c = 1; + | ~ error: aborting due to 3 previous errors diff --git a/tests/ui/parser/lifetime-in-pattern-recover.stderr b/tests/ui/parser/lifetime-in-pattern-recover.stderr index 4bf7f57bfb59f..d810435d890a5 100644 --- a/tests/ui/parser/lifetime-in-pattern-recover.stderr +++ b/tests/ui/parser/lifetime-in-pattern-recover.stderr @@ -2,13 +2,25 @@ error: unexpected lifetime `'a` in pattern --> $DIR/lifetime-in-pattern-recover.rs:2:10 | LL | let &'a x = &0; - | ^^ help: remove the lifetime + | ^^ + | +help: remove the lifetime + | +LL - let &'a x = &0; +LL + let & x = &0; + | error: unexpected lifetime `'a` in pattern --> $DIR/lifetime-in-pattern-recover.rs:3:10 | LL | let &'a mut y = &mut 0; - | ^^ help: remove the lifetime + | ^^ + | +help: remove the lifetime + | +LL - let &'a mut y = &mut 0; +LL + let & mut y = &mut 0; + | error[E0308]: mismatched types --> $DIR/lifetime-in-pattern-recover.rs:5:33 diff --git a/tests/ui/parser/lifetime-in-pattern.stderr b/tests/ui/parser/lifetime-in-pattern.stderr index a1d721e746ad0..795130a6ea0f7 100644 --- a/tests/ui/parser/lifetime-in-pattern.stderr +++ b/tests/ui/parser/lifetime-in-pattern.stderr @@ -2,7 +2,13 @@ error: unexpected lifetime `'a` in pattern --> $DIR/lifetime-in-pattern.rs:1:10 | LL | fn test(&'a str) { - | ^^ help: remove the lifetime + | ^^ + | +help: remove the lifetime + | +LL - fn test(&'a str) { +LL + fn test(& str) { + | error: expected one of `:`, `@`, or `|`, found `)` --> $DIR/lifetime-in-pattern.rs:1:16 diff --git a/tests/ui/parser/macro/macro-expand-to-match-arm.stderr b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr index e3e7ff89c8134..bac72d98e2425 100644 --- a/tests/ui/parser/macro/macro-expand-to-match-arm.stderr +++ b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr @@ -14,7 +14,12 @@ error: `match` arm with no body --> $DIR/macro-expand-to-match-arm.rs:14:9 | LL | arm!(None => {}), - | ^^^^^^^^^^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^^^^^^^^^^ + | +help: add a body after the pattern + | +LL | arm!(None => {}) => todo!(),, + | +++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/macro/pub-item-macro.stderr b/tests/ui/parser/macro/pub-item-macro.stderr index 9a2fffcced553..14f0b0908d1cb 100644 --- a/tests/ui/parser/macro/pub-item-macro.stderr +++ b/tests/ui/parser/macro/pub-item-macro.stderr @@ -2,13 +2,18 @@ error: can't qualify macro invocation with `pub` --> $DIR/pub-item-macro.rs:10:5 | LL | pub priv_x!(); - | ^^^ help: remove the visibility + | ^^^ ... LL | pub_x!(); | -------- in this macro invocation | = help: try adjusting the macro to put `pub` inside the invocation = note: this error originates in the macro `pub_x` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove the visibility + | +LL - pub priv_x!(); +LL + priv_x!(); + | error[E0603]: static `x` is private --> $DIR/pub-item-macro.rs:20:23 diff --git a/tests/ui/parser/macros-no-semicolon.stderr b/tests/ui/parser/macros-no-semicolon.stderr index f310662dbb0e7..4cf01e457d703 100644 --- a/tests/ui/parser/macros-no-semicolon.stderr +++ b/tests/ui/parser/macros-no-semicolon.stderr @@ -2,17 +2,27 @@ error: expected `;`, found `assert_eq` --> $DIR/macros-no-semicolon.rs:2:21 | LL | assert_eq!(1, 2) - | ^ help: add `;` here + | ^ LL | assert_eq!(3, 4) | --------- unexpected token + | +help: add `;` here + | +LL | assert_eq!(1, 2); + | + error: expected `;`, found `println` --> $DIR/macros-no-semicolon.rs:3:21 | LL | assert_eq!(3, 4) - | ^ help: add `;` here + | ^ LL | println!("hello"); | ------- unexpected token + | +help: add `;` here + | +LL | assert_eq!(3, 4); + | + error: aborting due to 2 previous errors diff --git a/tests/ui/parser/match-arm-without-body.stderr b/tests/ui/parser/match-arm-without-body.stderr index a3f7e32c1773b..286a13a79ee7c 100644 --- a/tests/ui/parser/match-arm-without-body.stderr +++ b/tests/ui/parser/match-arm-without-body.stderr @@ -56,55 +56,100 @@ error: expected `,` following `match` arm --> $DIR/match-arm-without-body.rs:66:15 | LL | pat!() - | ^ help: missing a comma here to end this `match` arm: `,` + | ^ + | +help: missing a comma here to end this `match` arm + | +LL | pat!(), + | + error: `match` arm with no body --> $DIR/match-arm-without-body.rs:7:9 | LL | Some(_) - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => todo!(), + | +++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:30:9 | LL | Some(_) if true - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => todo!(), if true + | +++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:40:9 | LL | Some(_) if true, - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => todo!(), if true, + | +++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:45:9 | LL | Some(_) if true, - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => todo!(), if true, + | +++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:51:9 | LL | pat!() - | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^ + | +help: add a body after the pattern + | +LL | pat!() => todo!(), + | +++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:56:9 | LL | pat!(), - | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^ + | +help: add a body after the pattern + | +LL | pat!() => todo!(),, + | +++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:61:9 | LL | pat!() if true, - | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^ + | +help: add a body after the pattern + | +LL | pat!() => todo!(), if true, + | +++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:72:9 | LL | pat!(), - | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^ + | +help: add a body after the pattern + | +LL | pat!() => todo!(),, + | +++++++++++ error: aborting due to 13 previous errors diff --git a/tests/ui/parser/match-arm-without-braces.stderr b/tests/ui/parser/match-arm-without-braces.stderr index ee1c8e562fc33..4a4a154d86091 100644 --- a/tests/ui/parser/match-arm-without-braces.stderr +++ b/tests/ui/parser/match-arm-without-braces.stderr @@ -60,7 +60,12 @@ error: expected `,` following `match` arm --> $DIR/match-arm-without-braces.rs:48:29 | LL | Some(Val::Foo) => 17 - | ^ help: missing a comma here to end this `match` arm: `,` + | ^ + | +help: missing a comma here to end this `match` arm + | +LL | Some(Val::Foo) => 17, + | + error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:53:11 diff --git a/tests/ui/parser/match-refactor-to-expr.stderr b/tests/ui/parser/match-refactor-to-expr.stderr index 72dfcd7dd7da7..ad4be16480214 100644 --- a/tests/ui/parser/match-refactor-to-expr.stderr +++ b/tests/ui/parser/match-refactor-to-expr.stderr @@ -2,15 +2,18 @@ error: expected one of `.`, `?`, `{`, or an operator, found `;` --> $DIR/match-refactor-to-expr.rs:8:9 | LL | match - | ----- - | | - | while parsing this `match` expression - | help: try removing this `match` + | ----- while parsing this `match` expression LL | Some(4).unwrap_or(5) | - expected one of `.`, `?`, `{`, or an operator LL | LL | ; | ^ unexpected token + | +help: try removing this `match` + | +LL - match +LL + + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-macro-rules.stderr b/tests/ui/parser/misspelled-macro-rules.stderr index fc718d8556dfe..b0eb1f12c1d35 100644 --- a/tests/ui/parser/misspelled-macro-rules.stderr +++ b/tests/ui/parser/misspelled-macro-rules.stderr @@ -2,9 +2,12 @@ error: expected one of `(`, `[`, or `{`, found `thing` --> $DIR/misspelled-macro-rules.rs:7:14 | LL | marco_rules! thing { - | ----------- ^^^^^ expected one of `(`, `[`, or `{` - | | - | help: perhaps you meant to define a macro: `macro_rules` + | ^^^^^ expected one of `(`, `[`, or `{` + | +help: perhaps you meant to define a macro + | +LL | macro_rules! thing { + | ~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/multibyte-char-use-seperator-issue-80134.stderr b/tests/ui/parser/multibyte-char-use-seperator-issue-80134.stderr index 21e71aa121560..3d82c848bba82 100644 --- a/tests/ui/parser/multibyte-char-use-seperator-issue-80134.stderr +++ b/tests/ui/parser/multibyte-char-use-seperator-issue-80134.stderr @@ -2,19 +2,23 @@ error: expected one of `)`, `,`, `.`, `?`, or an operator, found `é` --> $DIR/multibyte-char-use-seperator-issue-80134.rs:4:8 | LL | (()é); - | ^ - | | - | expected one of `)`, `,`, `.`, `?`, or an operator - | help: missing `,` + | ^ expected one of `)`, `,`, `.`, `?`, or an operator + | +help: missing `,` + | +LL | ((),é); + | + error: expected one of `)`, `,`, `.`, `?`, or an operator, found `氷` --> $DIR/multibyte-char-use-seperator-issue-80134.rs:7:8 | LL | (()氷); - | -^ - | | - | expected one of `)`, `,`, `.`, `?`, or an operator - | help: missing `,` + | ^^ expected one of `)`, `,`, `.`, `?`, or an operator + | +help: missing `,` + | +LL | ((),氷); + | + error[E0425]: cannot find value `é` in this scope --> $DIR/multibyte-char-use-seperator-issue-80134.rs:4:8 diff --git a/tests/ui/parser/mut-patterns.stderr b/tests/ui/parser/mut-patterns.stderr index 6559cf09cdfcf..f4f11b88d3615 100644 --- a/tests/ui/parser/mut-patterns.stderr +++ b/tests/ui/parser/mut-patterns.stderr @@ -2,53 +2,87 @@ error: `mut` must be followed by a named binding --> $DIR/mut-patterns.rs:9:9 | LL | let mut _ = 0; - | ^^^^ help: remove the `mut` prefix + | ^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: remove the `mut` prefix + | +LL - let mut _ = 0; +LL + let _ = 0; + | error: `mut` must be followed by a named binding --> $DIR/mut-patterns.rs:10:9 | LL | let mut (_, _) = (0, 0); - | ^^^^ help: remove the `mut` prefix + | ^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: remove the `mut` prefix + | +LL - let mut (_, _) = (0, 0); +LL + let (_, _) = (0, 0); + | error: `mut` must be attached to each individual binding --> $DIR/mut-patterns.rs:12:9 | LL | let mut (x @ y) = 0; - | ^^^^^^^^^^^ help: add `mut` to each binding: `(mut x @ mut y)` + | ^^^^^^^^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: add `mut` to each binding + | +LL | let (mut x @ mut y) = 0; + | ~~~~~~~~~~~~~~~ error: `mut` on a binding may not be repeated --> $DIR/mut-patterns.rs:14:13 | LL | let mut mut x = 0; - | ^^^ help: remove the additional `mut`s + | ^^^ + | +help: remove the additional `mut`s + | +LL - let mut mut x = 0; +LL + let mut x = 0; + | error: `mut` must be attached to each individual binding --> $DIR/mut-patterns.rs:19:9 | LL | let mut Foo { x: x } = Foo { x: 3 }; - | ^^^^^^^^^^^^^^^^ help: add `mut` to each binding: `Foo { x: mut x }` + | ^^^^^^^^^^^^^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: add `mut` to each binding + | +LL | let Foo { x: mut x } = Foo { x: 3 }; + | ~~~~~~~~~~~~~~~~ error: `mut` must be attached to each individual binding --> $DIR/mut-patterns.rs:23:9 | LL | let mut Foo { x } = Foo { x: 3 }; - | ^^^^^^^^^^^^^ help: add `mut` to each binding: `Foo { mut x }` + | ^^^^^^^^^^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: add `mut` to each binding + | +LL | let Foo { mut x } = Foo { x: 3 }; + | ~~~~~~~~~~~~~ error: `mut` on a binding may not be repeated --> $DIR/mut-patterns.rs:28:13 | LL | let mut mut yield(become, await) = r#yield(0, 0); - | ^^^ help: remove the additional `mut`s + | ^^^ + | +help: remove the additional `mut`s + | +LL - let mut mut yield(become, await) = r#yield(0, 0); +LL + let mut yield(become, await) = r#yield(0, 0); + | error: expected identifier, found reserved keyword `yield` --> $DIR/mut-patterns.rs:28:17 @@ -87,17 +121,26 @@ error: `mut` must be followed by a named binding --> $DIR/mut-patterns.rs:28:9 | LL | let mut mut yield(become, await) = r#yield(0, 0); - | ^^^^^^^^ help: remove the `mut` prefix + | ^^^^^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: remove the `mut` prefix + | +LL - let mut mut yield(become, await) = r#yield(0, 0); +LL + let yield(become, await) = r#yield(0, 0); + | error: `mut` must be attached to each individual binding --> $DIR/mut-patterns.rs:37:9 | LL | let mut W(mut a, W(b, W(ref c, W(d, B { box f })))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `mut` to each binding: `W(mut a, W(mut b, W(ref c, W(mut d, B { box mut f }))))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: add `mut` to each binding + | +LL | let W(mut a, W(mut b, W(ref c, W(mut d, B { box mut f })))) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: expected identifier, found `x` --> $DIR/mut-patterns.rs:44:21 diff --git a/tests/ui/parser/no-const-fn-in-extern-block.stderr b/tests/ui/parser/no-const-fn-in-extern-block.stderr index 8c23824a70888..1df4d6b81b03d 100644 --- a/tests/ui/parser/no-const-fn-in-extern-block.stderr +++ b/tests/ui/parser/no-const-fn-in-extern-block.stderr @@ -4,7 +4,13 @@ error: functions in `extern` blocks cannot have qualifiers LL | extern "C" { | ---------- in this `extern` block LL | const fn foo(); - | ^^^^^ help: remove this qualifier + | ^^^^^ + | +help: remove this qualifier + | +LL - const fn foo(); +LL + fn foo(); + | error: functions in `extern` blocks cannot have qualifiers --> $DIR/no-const-fn-in-extern-block.rs:4:5 @@ -13,7 +19,13 @@ LL | extern "C" { | ---------- in this `extern` block ... LL | const unsafe fn bar(); - | ^^^^^ help: remove this qualifier + | ^^^^^ + | +help: remove this qualifier + | +LL - const unsafe fn bar(); +LL + unsafe fn bar(); + | error: items in unadorned `extern` blocks cannot have safety qualifiers --> $DIR/no-const-fn-in-extern-block.rs:4:5 diff --git a/tests/ui/parser/not-a-pred.stderr b/tests/ui/parser/not-a-pred.stderr index bcc64a687fd0c..6f6a332cb8155 100644 --- a/tests/ui/parser/not-a-pred.stderr +++ b/tests/ui/parser/not-a-pred.stderr @@ -2,7 +2,12 @@ error: return types are denoted using `->` --> $DIR/not-a-pred.rs:1:26 | LL | fn f(a: isize, b: isize) : lt(a, b) { } - | ^ help: use `->` instead + | ^ + | +help: use `->` instead + | +LL | fn f(a: isize, b: isize) -> lt(a, b) { } + | ~~ error[E0573]: expected type, found function `lt` --> $DIR/not-a-pred.rs:1:28 diff --git a/tests/ui/parser/pat-lt-bracket-7.stderr b/tests/ui/parser/pat-lt-bracket-7.stderr index 004dcfb2a7b2d..c956b6a1a8c56 100644 --- a/tests/ui/parser/pat-lt-bracket-7.stderr +++ b/tests/ui/parser/pat-lt-bracket-7.stderr @@ -2,10 +2,12 @@ error: expected one of `)`, `,`, `@`, or `|`, found `[` --> $DIR/pat-lt-bracket-7.rs:5:16 | LL | for Thing(x[]) in foo {} - | ^ - | | - | expected one of `)`, `,`, `@`, or `|` - | help: missing `,` + | ^ expected one of `)`, `,`, `@`, or `|` + | +help: missing `,` + | +LL | for Thing(x,[]) in foo {} + | + error[E0308]: mismatched types --> $DIR/pat-lt-bracket-7.rs:9:30 diff --git a/tests/ui/parser/pat-recover-methodcalls.stderr b/tests/ui/parser/pat-recover-methodcalls.stderr index 1f9ae81dc0c55..46f47820bcfe2 100644 --- a/tests/ui/parser/pat-recover-methodcalls.stderr +++ b/tests/ui/parser/pat-recover-methodcalls.stderr @@ -26,10 +26,12 @@ error: expected one of `)`, `,`, `...`, `..=`, `..`, or `|`, found `.` --> $DIR/pat-recover-methodcalls.rs:34:15 | LL | if let (-1.Some(4)) = (0, Some(4)) {} - | ^ - | | - | expected one of `)`, `,`, `...`, `..=`, `..`, or `|` - | help: missing `,` + | ^ expected one of `)`, `,`, `...`, `..=`, `..`, or `|` + | +help: missing `,` + | +LL | if let (-1,.Some(4)) = (0, Some(4)) {} + | + error: aborting due to 5 previous errors diff --git a/tests/ui/parser/pat-recover-ranges.stderr b/tests/ui/parser/pat-recover-ranges.stderr index a7d62bd7f8ad2..7f5c6ac37ea34 100644 --- a/tests/ui/parser/pat-recover-ranges.stderr +++ b/tests/ui/parser/pat-recover-ranges.stderr @@ -122,11 +122,15 @@ warning: `...` range patterns are deprecated --> $DIR/pat-recover-ranges.rs:18:16 | LL | (1 + 4)...1 * 2 => (), - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see = note: `#[warn(ellipsis_inclusive_range_patterns)]` on by default +help: use `..=` for an inclusive range + | +LL | (1 + 4)..=1 * 2 => (), + | ~~~ error: aborting due to 13 previous errors; 1 warning emitted diff --git a/tests/ui/parser/pat-recover-wildcards.stderr b/tests/ui/parser/pat-recover-wildcards.stderr index 2b0c9bbc5be86..93423695b9e27 100644 --- a/tests/ui/parser/pat-recover-wildcards.stderr +++ b/tests/ui/parser/pat-recover-wildcards.stderr @@ -32,9 +32,13 @@ error[E0586]: inclusive range with no end --> $DIR/pat-recover-wildcards.rs:35:10 | LL | 0..._ => () - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | 0.._ => () + | ~~ error: expected one of `=>`, `if`, or `|`, found reserved identifier `_` --> $DIR/pat-recover-wildcards.rs:35:13 diff --git a/tests/ui/parser/pub-method-macro.stderr b/tests/ui/parser/pub-method-macro.stderr index 35cbf42307913..2e2c30dc6ad21 100644 --- a/tests/ui/parser/pub-method-macro.stderr +++ b/tests/ui/parser/pub-method-macro.stderr @@ -2,9 +2,14 @@ error: can't qualify macro invocation with `pub` --> $DIR/pub-method-macro.rs:17:9 | LL | pub defn!(f); - | ^^^ help: remove the visibility + | ^^^ | = help: try adjusting the macro to put `pub` inside the invocation +help: remove the visibility + | +LL - pub defn!(f); +LL + defn!(f); + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/qualified-path-in-turbofish.stderr b/tests/ui/parser/qualified-path-in-turbofish.stderr index 6e5af8cc1f0cc..6cb8d309ee1fb 100644 --- a/tests/ui/parser/qualified-path-in-turbofish.stderr +++ b/tests/ui/parser/qualified-path-in-turbofish.stderr @@ -2,7 +2,12 @@ error: found single colon before projection in qualified path --> $DIR/qualified-path-in-turbofish.rs:17:27 | LL | template::<:Ty>(); - | ^ help: use double colon: `::` + | ^ + | +help: use double colon + | +LL | template::<::Ty>(); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/range-exclusive-dotdotlt.stderr b/tests/ui/parser/range-exclusive-dotdotlt.stderr index af25e1df343de..9a38473b64403 100644 --- a/tests/ui/parser/range-exclusive-dotdotlt.stderr +++ b/tests/ui/parser/range-exclusive-dotdotlt.stderr @@ -2,17 +2,25 @@ error: expected type, found `10` --> $DIR/range-exclusive-dotdotlt.rs:2:17 | LL | let _ = 0..<10; - | -^^ expected type - | | - | help: remove the `<` to write an exclusive range + | ^^ expected type + | +help: remove the `<` to write an exclusive range + | +LL - let _ = 0..<10; +LL + let _ = 0..10; + | error: expected one of `!`, `(`, `+`, `::`, `<`, `>`, or `as`, found `;` --> $DIR/range-exclusive-dotdotlt.rs:8:20 | LL | let _ = 0.. $DIR/range-exclusive-dotdotlt.rs:14:18 @@ -24,17 +32,25 @@ error: expected type, found `1` --> $DIR/range-exclusive-dotdotlt.rs:19:26 | LL | let _ = [1, 2, 3][..<1]; - | -^ expected type - | | - | help: remove the `<` to write an exclusive range + | ^ expected type + | +help: remove the `<` to write an exclusive range + | +LL - let _ = [1, 2, 3][..<1]; +LL + let _ = [1, 2, 3][..1]; + | error: expected one of `!`, `(`, `+`, `::`, `<`, `>`, or `as`, found `]` --> $DIR/range-exclusive-dotdotlt.rs:25:29 | LL | let _ = [1, 2, 3][.. $DIR/range-exclusive-dotdotlt.rs:31:30 diff --git a/tests/ui/parser/range-inclusive-extra-equals.stderr b/tests/ui/parser/range-inclusive-extra-equals.stderr index 83df719dd3cc5..a573cdf950cdd 100644 --- a/tests/ui/parser/range-inclusive-extra-equals.stderr +++ b/tests/ui/parser/range-inclusive-extra-equals.stderr @@ -2,9 +2,13 @@ error: unexpected `=` after inclusive range --> $DIR/range-inclusive-extra-equals.rs:7:13 | LL | if let 1..==3 = 1 {} - | ^^^^ help: use `..=` instead + | ^^^^ | = note: inclusive ranges end with a single equals sign (`..=`) +help: use `..=` instead + | +LL | if let 1..=3 = 1 {} + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/range_inclusive.stderr b/tests/ui/parser/range_inclusive.stderr index 0fd7f28db317f..138c67e47c3d0 100644 --- a/tests/ui/parser/range_inclusive.stderr +++ b/tests/ui/parser/range_inclusive.stderr @@ -2,9 +2,13 @@ error[E0586]: inclusive range with no end --> $DIR/range_inclusive.rs:5:15 | LL | for _ in 1..= {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | for _ in 1.. {} + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/raw/raw-byte-string-eof.stderr b/tests/ui/parser/raw/raw-byte-string-eof.stderr index 88fd53904c43f..6a126c712a168 100644 --- a/tests/ui/parser/raw/raw-byte-string-eof.stderr +++ b/tests/ui/parser/raw/raw-byte-string-eof.stderr @@ -2,11 +2,13 @@ error[E0748]: unterminated raw string --> $DIR/raw-byte-string-eof.rs:2:5 | LL | br##"a"#; - | ^ - help: consider terminating the string here: `##` - | | - | unterminated raw string + | ^ unterminated raw string | = note: this raw string should be terminated with `"##` +help: consider terminating the string here + | +LL | br##"a"##; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/raw/raw-str-unbalanced.stderr b/tests/ui/parser/raw/raw-str-unbalanced.stderr index eac8c06c1df5c..89e9c842d8966 100644 --- a/tests/ui/parser/raw/raw-str-unbalanced.stderr +++ b/tests/ui/parser/raw/raw-str-unbalanced.stderr @@ -2,35 +2,58 @@ error: too many `#` when terminating raw string --> $DIR/raw-str-unbalanced.rs:2:10 | LL | r#""## - | -----^ help: remove the extra `#` + | -----^ | | | this raw string started with 1 `#` + | +help: remove the extra `#` + | +LL - r#""## +LL + r#""# + | error: too many `#` when terminating raw string --> $DIR/raw-str-unbalanced.rs:7:9 | LL | / r#" LL | | "#### - | | -^^^ help: remove the extra `#`s + | | -^^^ | |________| | this raw string started with 1 `#` + | +help: remove the extra `#`s + | +LL - "#### +LL + "# + | error: expected `;`, found `#` --> $DIR/raw-str-unbalanced.rs:10:28 | LL | const A: &'static str = r"" - | ^ help: add `;` here + | ^ ... LL | #[test] | - unexpected token + | +help: add `;` here + | +LL | const A: &'static str = r""; + | + error: too many `#` when terminating raw string --> $DIR/raw-str-unbalanced.rs:16:28 | LL | const B: &'static str = r""## - | ---^^ help: remove the extra `#`s + | ---^^ | | | this raw string started with 0 `#`s + | +help: remove the extra `#`s + | +LL - const B: &'static str = r""## +LL + const B: &'static str = r"" + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/raw/raw-string-2.stderr b/tests/ui/parser/raw/raw-string-2.stderr index 90dd9775e62e4..a73bcec7a87d2 100644 --- a/tests/ui/parser/raw/raw-string-2.stderr +++ b/tests/ui/parser/raw/raw-string-2.stderr @@ -2,9 +2,13 @@ error[E0748]: unterminated raw string --> $DIR/raw-string-2.rs:2:13 | LL | let x = r###"here's a long string"# "# "##; - | ^ unterminated raw string -- help: consider terminating the string here: `###` + | ^ unterminated raw string | = note: this raw string should be terminated with `"###` +help: consider terminating the string here + | +LL | let x = r###"here's a long string"# "# "###; + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/raw/raw-string.stderr b/tests/ui/parser/raw/raw-string.stderr index 6654ef7a75a42..413ca1e7342d3 100644 --- a/tests/ui/parser/raw/raw-string.stderr +++ b/tests/ui/parser/raw/raw-string.stderr @@ -2,11 +2,13 @@ error[E0748]: unterminated raw string --> $DIR/raw-string.rs:2:13 | LL | let x = r##"lol"#; - | ^ - help: consider terminating the string here: `##` - | | - | unterminated raw string + | ^ unterminated raw string | = note: this raw string should be terminated with `"##` +help: consider terminating the string here + | +LL | let x = r##"lol"##; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/recover-colon-instead-of-eq-in-local.stderr b/tests/ui/parser/recover/recover-colon-instead-of-eq-in-local.stderr index 15c27bb9451b6..cffb3bc334434 100644 --- a/tests/ui/parser/recover/recover-colon-instead-of-eq-in-local.stderr +++ b/tests/ui/parser/recover/recover-colon-instead-of-eq-in-local.stderr @@ -13,7 +13,11 @@ LL | let _: std::env::temp_dir().join("foo"); | - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=` | | | while parsing the type for `_` - | help: use `=` if you meant to assign + | +help: use `=` if you meant to assign + | +LL | let _= std::env::temp_dir().join("foo"); + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/recover/recover-const-async-fn-ptr.stderr b/tests/ui/parser/recover/recover-const-async-fn-ptr.stderr index 7012096b64450..8e5b76163ade1 100644 --- a/tests/ui/parser/recover/recover-const-async-fn-ptr.stderr +++ b/tests/ui/parser/recover/recover-const-async-fn-ptr.stderr @@ -5,7 +5,12 @@ LL | type T0 = const fn(); | -----^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - type T0 = const fn(); +LL + type T0 = fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/recover-const-async-fn-ptr.rs:4:11 @@ -14,7 +19,12 @@ LL | type T1 = const extern "C" fn(); | -----^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - type T1 = const extern "C" fn(); +LL + type T1 = extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/recover-const-async-fn-ptr.rs:5:11 @@ -23,7 +33,12 @@ LL | type T2 = const unsafe extern fn(); | -----^^^^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - type T2 = const unsafe extern fn(); +LL + type T2 = unsafe extern fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/recover-const-async-fn-ptr.rs:6:11 @@ -32,7 +47,12 @@ LL | type T3 = async fn(); | -----^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - type T3 = async fn(); +LL + type T3 = fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/recover-const-async-fn-ptr.rs:7:11 @@ -41,7 +61,12 @@ LL | type T4 = async extern fn(); | -----^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - type T4 = async extern fn(); +LL + type T4 = extern fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/recover-const-async-fn-ptr.rs:8:11 @@ -50,7 +75,12 @@ LL | type T5 = async unsafe extern "C" fn(); | -----^^^^^^^^^^^^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - type T5 = async unsafe extern "C" fn(); +LL + type T5 = unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/recover-const-async-fn-ptr.rs:9:11 @@ -59,7 +89,12 @@ LL | type T6 = const async unsafe extern "C" fn(); | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - type T6 = const async unsafe extern "C" fn(); +LL + type T6 = async unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/recover-const-async-fn-ptr.rs:9:11 @@ -68,7 +103,12 @@ LL | type T6 = const async unsafe extern "C" fn(); | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - type T6 = const async unsafe extern "C" fn(); +LL + type T6 = const unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/recover-const-async-fn-ptr.rs:13:12 @@ -77,7 +117,12 @@ LL | type FT0 = for<'a> const fn(); | ^^^^^^^^-----^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - type FT0 = for<'a> const fn(); +LL + type FT0 = for<'a> fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/recover-const-async-fn-ptr.rs:14:12 @@ -86,7 +131,12 @@ LL | type FT1 = for<'a> const extern "C" fn(); | ^^^^^^^^-----^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - type FT1 = for<'a> const extern "C" fn(); +LL + type FT1 = for<'a> extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/recover-const-async-fn-ptr.rs:15:12 @@ -95,7 +145,12 @@ LL | type FT2 = for<'a> const unsafe extern fn(); | ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - type FT2 = for<'a> const unsafe extern fn(); +LL + type FT2 = for<'a> unsafe extern fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/recover-const-async-fn-ptr.rs:16:12 @@ -104,7 +159,12 @@ LL | type FT3 = for<'a> async fn(); | ^^^^^^^^-----^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - type FT3 = for<'a> async fn(); +LL + type FT3 = for<'a> fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/recover-const-async-fn-ptr.rs:17:12 @@ -113,7 +173,12 @@ LL | type FT4 = for<'a> async extern fn(); | ^^^^^^^^-----^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - type FT4 = for<'a> async extern fn(); +LL + type FT4 = for<'a> extern fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/recover-const-async-fn-ptr.rs:18:12 @@ -122,7 +187,12 @@ LL | type FT5 = for<'a> async unsafe extern "C" fn(); | ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - type FT5 = for<'a> async unsafe extern "C" fn(); +LL + type FT5 = for<'a> unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `const` --> $DIR/recover-const-async-fn-ptr.rs:19:12 @@ -131,7 +201,12 @@ LL | type FT6 = for<'a> const async unsafe extern "C" fn(); | ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | `const` because of this - | help: remove the `const` qualifier + | +help: remove the `const` qualifier + | +LL - type FT6 = for<'a> const async unsafe extern "C" fn(); +LL + type FT6 = for<'a> async unsafe extern "C" fn(); + | error: an `fn` pointer type cannot be `async` --> $DIR/recover-const-async-fn-ptr.rs:19:12 @@ -140,7 +215,12 @@ LL | type FT6 = for<'a> const async unsafe extern "C" fn(); | ^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^ | | | `async` because of this - | help: remove the `async` qualifier + | +help: remove the `async` qualifier + | +LL - type FT6 = for<'a> const async unsafe extern "C" fn(); +LL + type FT6 = for<'a> const unsafe extern "C" fn(); + | error[E0308]: mismatched types --> $DIR/recover-const-async-fn-ptr.rs:24:33 diff --git a/tests/ui/parser/recover/recover-enum.stderr b/tests/ui/parser/recover/recover-enum.stderr index a2b650e4f4eb7..096fe760e18a9 100644 --- a/tests/ui/parser/recover/recover-enum.stderr +++ b/tests/ui/parser/recover/recover-enum.stderr @@ -2,36 +2,42 @@ error: expected one of `(`, `,`, `=`, `{`, or `}`, found `Bad` --> $DIR/recover-enum.rs:4:9 | LL | Very - | - - | | - | expected one of `(`, `,`, `=`, `{`, or `}` - | help: missing `,` + | - expected one of `(`, `,`, `=`, `{`, or `}` LL | Bad(usize) | ^^^ unexpected token + | +help: missing `,` + | +LL | Very, + | + error: expected one of `,`, `=`, or `}`, found `Stuff` --> $DIR/recover-enum.rs:6:9 | LL | Bad(usize) - | - - | | - | expected one of `,`, `=`, or `}` - | help: missing `,` + | - expected one of `,`, `=`, or `}` LL | LL | Stuff { a: usize } | ^^^^^ unexpected token + | +help: missing `,` + | +LL | Bad(usize), + | + error: expected one of `,`, `=`, or `}`, found `Here` --> $DIR/recover-enum.rs:8:9 | LL | Stuff { a: usize } - | - - | | - | expected one of `,`, `=`, or `}` - | help: missing `,` + | - expected one of `,`, `=`, or `}` LL | LL | Here | ^^^^ unexpected token + | +help: missing `,` + | +LL | Stuff { a: usize }, + | + error: aborting due to 3 previous errors diff --git a/tests/ui/parser/recover/recover-field-extra-angle-brackets-in-struct-with-a-field.stderr b/tests/ui/parser/recover/recover-field-extra-angle-brackets-in-struct-with-a-field.stderr index 2b56498c50d3c..19c6b1a90a14d 100644 --- a/tests/ui/parser/recover/recover-field-extra-angle-brackets-in-struct-with-a-field.stderr +++ b/tests/ui/parser/recover/recover-field-extra-angle-brackets-in-struct-with-a-field.stderr @@ -5,7 +5,15 @@ LL | next: Option> | _________________________^ LL | | LL | | } - | |_ help: remove extra angle bracket + | |_ + | +help: remove extra angle bracket + | +LL - next: Option> +LL - +LL - } +LL + next: Option} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/recover-field-extra-angle-brackets.stderr b/tests/ui/parser/recover/recover-field-extra-angle-brackets.stderr index 628626926a784..45af63133918b 100644 --- a/tests/ui/parser/recover/recover-field-extra-angle-brackets.stderr +++ b/tests/ui/parser/recover/recover-field-extra-angle-brackets.stderr @@ -2,7 +2,13 @@ error: unmatched angle bracket --> $DIR/recover-field-extra-angle-brackets.rs:5:19 | LL | first: Vec>, - | ^ help: remove extra angle bracket + | ^ + | +help: remove extra angle bracket + | +LL - first: Vec>, +LL + first: Vec, + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/recover-field-semi.stderr b/tests/ui/parser/recover/recover-field-semi.stderr index 3cf4847488c05..8664027d15a70 100644 --- a/tests/ui/parser/recover/recover-field-semi.stderr +++ b/tests/ui/parser/recover/recover-field-semi.stderr @@ -4,7 +4,12 @@ error: struct fields are separated by `,` LL | struct Foo { | --- while parsing this struct LL | foo: i32; - | ^ help: replace `;` with `,` + | ^ + | +help: replace `;` with `,` + | +LL | foo: i32, + | ~ error: union fields are separated by `,` --> $DIR/recover-field-semi.rs:7:13 @@ -12,15 +17,25 @@ error: union fields are separated by `,` LL | union Bar { | --- while parsing this union LL | foo: i32; - | ^ help: replace `;` with `,` + | ^ + | +help: replace `;` with `,` + | +LL | foo: i32, + | ~ error: struct fields are separated by `,` --> $DIR/recover-field-semi.rs:12:19 | LL | Qux { foo: i32; } - | --- ^ help: replace `;` with `,` + | --- ^ | | | while parsing this struct + | +help: replace `;` with `,` + | +LL | Qux { foo: i32, } + | ~ error: unions cannot have zero fields --> $DIR/recover-field-semi.rs:6:1 diff --git a/tests/ui/parser/recover/recover-missing-semi-before-item.stderr b/tests/ui/parser/recover/recover-missing-semi-before-item.stderr index 61c43f2f18998..8a87d44c95913 100644 --- a/tests/ui/parser/recover/recover-missing-semi-before-item.stderr +++ b/tests/ui/parser/recover/recover-missing-semi-before-item.stderr @@ -2,82 +2,132 @@ error: expected `;`, found keyword `struct` --> $DIR/recover-missing-semi-before-item.rs:6:16 | LL | let foo = 3 - | ^ help: add `;` here + | ^ LL | struct Foo; | ------ unexpected token + | +help: add `;` here + | +LL | let foo = 3; + | + error: expected `;`, found `union` --> $DIR/recover-missing-semi-before-item.rs:11:16 | LL | let foo = 3 - | ^ help: add `;` here + | ^ LL | union Foo { | ----- unexpected token + | +help: add `;` here + | +LL | let foo = 3; + | + error: expected `;`, found keyword `enum` --> $DIR/recover-missing-semi-before-item.rs:18:16 | LL | let foo = 3 - | ^ help: add `;` here + | ^ LL | enum Foo { | ---- unexpected token + | +help: add `;` here + | +LL | let foo = 3; + | + error: expected `;`, found keyword `fn` --> $DIR/recover-missing-semi-before-item.rs:25:16 | LL | let foo = 3 - | ^ help: add `;` here + | ^ LL | fn foo() {} | -- unexpected token + | +help: add `;` here + | +LL | let foo = 3; + | + error: expected `;`, found keyword `extern` --> $DIR/recover-missing-semi-before-item.rs:30:16 | LL | let foo = 3 - | ^ help: add `;` here + | ^ LL | extern fn foo() {} | ------ unexpected token + | +help: add `;` here + | +LL | let foo = 3; + | + error: expected `;`, found keyword `impl` --> $DIR/recover-missing-semi-before-item.rs:36:16 | LL | let foo = 3 - | ^ help: add `;` here + | ^ LL | impl Foo {} | ---- unexpected token + | +help: add `;` here + | +LL | let foo = 3; + | + error: expected `;`, found keyword `pub` --> $DIR/recover-missing-semi-before-item.rs:41:16 | LL | let foo = 3 - | ^ help: add `;` here + | ^ LL | pub use bar::Bar; | --- unexpected token + | +help: add `;` here + | +LL | let foo = 3; + | + error: expected `;`, found keyword `mod` --> $DIR/recover-missing-semi-before-item.rs:46:16 | LL | let foo = 3 - | ^ help: add `;` here + | ^ LL | mod foo {} | --- unexpected token + | +help: add `;` here + | +LL | let foo = 3; + | + error: expected `;`, found keyword `type` --> $DIR/recover-missing-semi-before-item.rs:51:16 | LL | let foo = 3 - | ^ help: add `;` here + | ^ LL | type Foo = usize; | ---- unexpected token + | +help: add `;` here + | +LL | let foo = 3; + | + error: expected `;`, found keyword `fn` --> $DIR/recover-missing-semi-before-item.rs:59:19 | LL | const X: i32 = 123 - | ^ help: add `;` here + | ^ LL | LL | fn main() {} | -- unexpected token + | +help: add `;` here + | +LL | const X: i32 = 123; + | + error: aborting due to 10 previous errors diff --git a/tests/ui/parser/recover/recover-missing-semi.stderr b/tests/ui/parser/recover/recover-missing-semi.stderr index ba47982853871..3e8cb37160ecd 100644 --- a/tests/ui/parser/recover/recover-missing-semi.stderr +++ b/tests/ui/parser/recover/recover-missing-semi.stderr @@ -2,19 +2,29 @@ error: expected `;`, found keyword `let` --> $DIR/recover-missing-semi.rs:2:22 | LL | let _: usize = () - | ^ help: add `;` here + | ^ ... LL | let _ = 3; | --- unexpected token + | +help: add `;` here + | +LL | let _: usize = (); + | + error: expected `;`, found keyword `return` --> $DIR/recover-missing-semi.rs:9:22 | LL | let _: usize = () - | ^ help: add `;` here + | ^ ... LL | return 3; | ------ unexpected token + | +help: add `;` here + | +LL | let _: usize = (); + | + error[E0308]: mismatched types --> $DIR/recover-missing-semi.rs:2:20 diff --git a/tests/ui/parser/recover/recover-range-pats.stderr b/tests/ui/parser/recover/recover-range-pats.stderr index e29b6c1c666b3..1d1a62b56bd2d 100644 --- a/tests/ui/parser/recover/recover-range-pats.stderr +++ b/tests/ui/parser/recover/recover-range-pats.stderr @@ -2,202 +2,326 @@ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:20:12 | LL | if let .0..Y = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let 0.0..Y = 0 {} + | ~~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:22:16 | LL | if let X.. .0 = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let X.. 0.0 = 0 {} + | ~~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:33:12 | LL | if let .0..=Y = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let 0.0..=Y = 0 {} + | ~~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:35:16 | LL | if let X..=.0 = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let X..=0.0 = 0 {} + | ~~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:58:12 | LL | if let .0...Y = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let 0.0...Y = 0 {} + | ~~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:62:17 | LL | if let X... .0 = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let X... 0.0 = 0 {} + | ~~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:73:12 | LL | if let .0.. = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let 0.0.. = 0 {} + | ~~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:79:13 | LL | if let 0..= = 0 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let 0.. = 0 {} + | ~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:80:13 | LL | if let X..= = 0 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let X.. = 0 {} + | ~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:81:16 | LL | if let true..= = 0 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let true.. = 0 {} + | ~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:83:12 | LL | if let .0..= = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let 0.0..= = 0 {} + | ~~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:83:14 | LL | if let .0..= = 0 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let .0.. = 0 {} + | ~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:89:13 | LL | if let 0... = 0 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let 0.. = 0 {} + | ~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:90:13 | LL | if let X... = 0 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let X.. = 0 {} + | ~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:91:16 | LL | if let true... = 0 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let true.. = 0 {} + | ~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:93:12 | LL | if let .0... = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let 0.0... = 0 {} + | ~~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:93:14 | LL | if let .0... = 0 {} - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | if let .0.. = 0 {} + | ~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:103:15 | LL | if let .. .0 = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let .. 0.0 = 0 {} + | ~~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:113:15 | LL | if let ..=.0 = 0 {} - | ^^ help: must have an integer part: `0.0` + | ^^ + | +help: must have an integer part + | +LL | if let ..=0.0 = 0 {} + | ~~~ error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:119:12 | LL | if let ...3 = 0 {} - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | if let ..=3 = 0 {} + | ~~~ error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:121:12 | LL | if let ...Y = 0 {} - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | if let ..=Y = 0 {} + | ~~~ error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:123:12 | LL | if let ...true = 0 {} - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | if let ..=true = 0 {} + | ~~~ error: float literals must have an integer part --> $DIR/recover-range-pats.rs:126:15 | LL | if let ....3 = 0 {} - | ^^ help: must have an integer part: `0.3` + | ^^ + | +help: must have an integer part + | +LL | if let ...0.3 = 0 {} + | ~~~ error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:126:12 | LL | if let ....3 = 0 {} - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | if let ..=.3 = 0 {} + | ~~~ error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:152:17 | LL | let ...$e; - | ^^^ help: use `..=` instead + | ^^^ ... LL | mac!(0); | ------- in this macro invocation | = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use `..=` instead + | +LL | let ..=$e; + | ~~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:159:19 | LL | let $e...; - | ^^^ help: use `..` instead + | ^^^ ... LL | mac!(0); | ------- in this macro invocation | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use `..` instead + | +LL | let $e..; + | ~~ error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:161:19 | LL | let $e..=; - | ^^^ help: use `..` instead + | ^^^ ... LL | mac!(0); | ------- in this macro invocation | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use `..` instead + | +LL | let $e..; + | ~~ error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:40:13 | LL | if let 0...3 = 0 {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see @@ -206,75 +330,107 @@ note: the lint level is defined here | LL | #![deny(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `..=` for an inclusive range + | +LL | if let 0..=3 = 0 {} + | ~~~ error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:43:13 | LL | if let 0...Y = 0 {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use `..=` for an inclusive range + | +LL | if let 0..=Y = 0 {} + | ~~~ error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:46:13 | LL | if let X...3 = 0 {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use `..=` for an inclusive range + | +LL | if let X..=3 = 0 {} + | ~~~ error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:49:13 | LL | if let X...Y = 0 {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use `..=` for an inclusive range + | +LL | if let X..=Y = 0 {} + | ~~~ error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:52:16 | LL | if let true...Y = 0 {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use `..=` for an inclusive range + | +LL | if let true..=Y = 0 {} + | ~~~ error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:55:13 | LL | if let X...true = 0 {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use `..=` for an inclusive range + | +LL | if let X..=true = 0 {} + | ~~~ error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:58:14 | LL | if let .0...Y = 0 {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use `..=` for an inclusive range + | +LL | if let .0..=Y = 0 {} + | ~~~ error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:62:13 | LL | if let X... .0 = 0 {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see +help: use `..=` for an inclusive range + | +LL | if let X..= .0 = 0 {} + | ~~~ error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:137:20 | LL | let $e1...$e2; - | ^^^ help: use `..=` for an inclusive range + | ^^^ ... LL | mac2!(0, 1); | ----------- in this macro invocation @@ -282,6 +438,10 @@ LL | mac2!(0, 1); = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use `..=` for an inclusive range + | +LL | let $e1..=$e2; + | ~~~ error[E0029]: only `char` and numeric types are allowed in range patterns --> $DIR/recover-range-pats.rs:18:12 diff --git a/tests/ui/parser/recover/recover-ref-dyn-mut.stderr b/tests/ui/parser/recover/recover-ref-dyn-mut.stderr index c048c8ea1b0dd..bb0f0b0214c46 100644 --- a/tests/ui/parser/recover/recover-ref-dyn-mut.stderr +++ b/tests/ui/parser/recover/recover-ref-dyn-mut.stderr @@ -2,7 +2,12 @@ error: `mut` must precede `dyn` --> $DIR/recover-ref-dyn-mut.rs:5:12 | LL | let r: &dyn mut Trait; - | ^^^^^^^^ help: place `mut` before `dyn`: `&mut dyn` + | ^^^^^^^^ + | +help: place `mut` before `dyn` + | +LL | let r: &mut dyn Trait; + | ~~~~~~~~ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/recover-ref-dyn-mut.rs:5:21 diff --git a/tests/ui/parser/recover/recover-unticked-labels.stderr b/tests/ui/parser/recover/recover-unticked-labels.stderr index fbd108ca613c7..d517e1b46b4aa 100644 --- a/tests/ui/parser/recover/recover-unticked-labels.stderr +++ b/tests/ui/parser/recover/recover-unticked-labels.stderr @@ -2,27 +2,36 @@ error: expected a label, found an identifier --> $DIR/recover-unticked-labels.rs:5:26 | LL | 'label: loop { break label 0 }; - | -^^^^ - | | - | help: labels start with a tick + | ^^^^^ + | +help: labels start with a tick + | +LL | 'label: loop { break 'label 0 }; + | + error: expected a label, found an identifier --> $DIR/recover-unticked-labels.rs:6:29 | LL | 'label: loop { continue label }; - | -^^^^ - | | - | help: labels start with a tick + | ^^^^^ + | +help: labels start with a tick + | +LL | 'label: loop { continue 'label }; + | + error[E0425]: cannot find value `label` in this scope --> $DIR/recover-unticked-labels.rs:4:26 | LL | 'label: loop { break label }; - | ------ ^^^^^ - | | | - | | not found in this scope - | | help: use the similarly named label: `'label` + | ------ ^^^^^ not found in this scope + | | | a label with a similar name exists + | +help: use the similarly named label + | +LL | 'label: loop { break 'label }; + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/parser/regions-out-of-scope-slice.stderr b/tests/ui/parser/regions-out-of-scope-slice.stderr index 5d8f6af166bd4..53d7679231c2a 100644 --- a/tests/ui/parser/regions-out-of-scope-slice.stderr +++ b/tests/ui/parser/regions-out-of-scope-slice.stderr @@ -5,7 +5,12 @@ LL | x = &'blk [1,2,3]; | ^----^^^^^^^^ | | | annotated with lifetime here - | help: remove the lifetime annotation + | +help: remove the lifetime annotation + | +LL - x = &'blk [1,2,3]; +LL + x = & [1,2,3]; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax/removed-syntax-field-let-2.stderr b/tests/ui/parser/removed-syntax/removed-syntax-field-let-2.stderr index fda0919b9b647..7a3561c205300 100644 --- a/tests/ui/parser/removed-syntax/removed-syntax-field-let-2.stderr +++ b/tests/ui/parser/removed-syntax/removed-syntax-field-let-2.stderr @@ -2,25 +2,29 @@ error: expected identifier, found keyword `let` --> $DIR/removed-syntax-field-let-2.rs:2:5 | LL | let x: i32, - | ^^^- - | | - | expected identifier, found keyword - | help: remove this `let` keyword + | ^^^ expected identifier, found keyword | = note: the `let` keyword is not allowed in `struct` fields = note: see for more information +help: remove this `let` keyword + | +LL - let x: i32, +LL + x: i32, + | error: expected identifier, found keyword `let` --> $DIR/removed-syntax-field-let-2.rs:4:5 | LL | let y: i32, - | ^^^- - | | - | expected identifier, found keyword - | help: remove this `let` keyword + | ^^^ expected identifier, found keyword | = note: the `let` keyword is not allowed in `struct` fields = note: see for more information +help: remove this `let` keyword + | +LL - let y: i32, +LL + y: i32, + | error[E0063]: missing fields `x` and `y` in initializer of `Foo` --> $DIR/removed-syntax-field-let-2.rs:9:13 diff --git a/tests/ui/parser/removed-syntax/removed-syntax-field-let.stderr b/tests/ui/parser/removed-syntax/removed-syntax-field-let.stderr index 339d056e6360f..48e439c8c2c34 100644 --- a/tests/ui/parser/removed-syntax/removed-syntax-field-let.stderr +++ b/tests/ui/parser/removed-syntax/removed-syntax-field-let.stderr @@ -2,13 +2,15 @@ error: expected identifier, found keyword `let` --> $DIR/removed-syntax-field-let.rs:2:5 | LL | let foo: (), - | ^^^- - | | - | expected identifier, found keyword - | help: remove this `let` keyword + | ^^^ expected identifier, found keyword | = note: the `let` keyword is not allowed in `struct` fields = note: see for more information +help: remove this `let` keyword + | +LL - let foo: (), +LL + foo: (), + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax/removed-syntax-field-semicolon.stderr b/tests/ui/parser/removed-syntax/removed-syntax-field-semicolon.stderr index 522912a9e1c6d..27c9bf064fb73 100644 --- a/tests/ui/parser/removed-syntax/removed-syntax-field-semicolon.stderr +++ b/tests/ui/parser/removed-syntax/removed-syntax-field-semicolon.stderr @@ -4,7 +4,12 @@ error: struct fields are separated by `,` LL | struct S { | - while parsing this struct LL | bar: (); - | ^ help: replace `;` with `,` + | ^ + | +help: replace `;` with `,` + | +LL | bar: (), + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax/removed-syntax-fn-sigil.stderr b/tests/ui/parser/removed-syntax/removed-syntax-fn-sigil.stderr index c089e0ba9693c..0cdee1d51eaca 100644 --- a/tests/ui/parser/removed-syntax/removed-syntax-fn-sigil.stderr +++ b/tests/ui/parser/removed-syntax/removed-syntax-fn-sigil.stderr @@ -2,7 +2,12 @@ error: missing parameters for function definition --> $DIR/removed-syntax-fn-sigil.rs:2:14 | LL | let x: fn~() = || (); - | ^ help: add a parameter list + | ^ + | +help: add a parameter list + | +LL | let x: fn()~() = || (); + | ++ error: expected one of `->`, `;`, or `=`, found `~` --> $DIR/removed-syntax-fn-sigil.rs:2:14 diff --git a/tests/ui/parser/removed-syntax/removed-syntax-static-fn.stderr b/tests/ui/parser/removed-syntax/removed-syntax-static-fn.stderr index 52e0658949d3d..d3ed7fc6376d3 100644 --- a/tests/ui/parser/removed-syntax/removed-syntax-static-fn.stderr +++ b/tests/ui/parser/removed-syntax/removed-syntax-static-fn.stderr @@ -19,7 +19,12 @@ error: missing type for `static` item --> $DIR/removed-syntax-static-fn.rs:4:14 | LL | static fn f() {} - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | static fn: f() {} + | ++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/parser/removed-syntax/removed-syntax-with-1.stderr b/tests/ui/parser/removed-syntax/removed-syntax-with-1.stderr index 78042678a87bb..02de9d979cb4b 100644 --- a/tests/ui/parser/removed-syntax/removed-syntax-with-1.stderr +++ b/tests/ui/parser/removed-syntax/removed-syntax-with-1.stderr @@ -2,10 +2,14 @@ error: expected one of `,`, `.`, `?`, `}`, or an operator, found `with` --> $DIR/removed-syntax-with-1.rs:8:25 | LL | let b = S { foo: () with a, bar: () }; - | - -^^^^ expected one of `,`, `.`, `?`, `}`, or an operator - | | | - | | help: try adding a comma: `,` + | - ^^^^ expected one of `,`, `.`, `?`, `}`, or an operator + | | | while parsing this struct + | +help: try adding a comma + | +LL | let b = S { foo: (), with a, bar: () }; + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/similar-tokens.stderr b/tests/ui/parser/similar-tokens.stderr index 7070232c1423a..0b1c13de680c2 100644 --- a/tests/ui/parser/similar-tokens.stderr +++ b/tests/ui/parser/similar-tokens.stderr @@ -2,10 +2,12 @@ error: expected one of `,`, `::`, `as`, or `}`, found `.` --> $DIR/similar-tokens.rs:9:10 | LL | use x::{A. B}; - | ^ - | | - | expected one of `,`, `::`, `as`, or `}` - | help: missing `,` + | ^ expected one of `,`, `::`, `as`, or `}` + | +help: missing `,` + | +LL | use x::{A,. B}; + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr b/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr index 7f16ebcfc3ace..9e333ee0aefa4 100644 --- a/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr +++ b/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr @@ -2,91 +2,165 @@ error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:9:16 | LL | field1: i32 = 42, - | ^^^^^ help: remove this unsupported default value + | ^^^^^ + | +help: remove this unsupported default value + | +LL - field1: i32 = 42, +LL + field1: i32, + | error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:10:14 | LL | field2: E = E::A, - | ^^^^^^^ help: remove this unsupported default value + | ^^^^^^^ + | +help: remove this unsupported default value + | +LL - field2: E = E::A, +LL + field2: E, + | error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:11:16 | LL | field3: i32 = 1 + 2, - | ^^^^^^^^ help: remove this unsupported default value + | ^^^^^^^^ + | +help: remove this unsupported default value + | +LL - field3: i32 = 1 + 2, +LL + field3: i32, + | error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:12:16 | LL | field4: i32 = { 1 + 2 }, - | ^^^^^^^^^^^^ help: remove this unsupported default value + | ^^^^^^^^^^^^ + | +help: remove this unsupported default value + | +LL - field4: i32 = { 1 + 2 }, +LL + field4: i32, + | error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:13:14 | LL | field5: E = foo(42), - | ^^^^^^^^^^ help: remove this unsupported default value + | ^^^^^^^^^^ + | +help: remove this unsupported default value + | +LL - field5: E = foo(42), +LL + field5: E, + | error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:14:14 | LL | field6: E = { foo(42) }, - | ^^^^^^^^^^^^^^ help: remove this unsupported default value + | ^^^^^^^^^^^^^^ + | +help: remove this unsupported default value + | +LL - field6: E = { foo(42) }, +LL + field6: E, + | error: expected `,`, or `}`, found `field2` --> $DIR/struct-default-values-and-missing-field-separator.rs:18:16 | LL | field1: i32 - | ^ help: try adding a comma: `,` + | ^ + | +help: try adding a comma + | +LL | field1: i32, + | + error: expected `,`, or `}`, found `field3` --> $DIR/struct-default-values-and-missing-field-separator.rs:19:14 | LL | field2: E - | ^ help: try adding a comma: `,` + | ^ + | +help: try adding a comma + | +LL | field2: E, + | + error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:20:16 | LL | field3: i32 = 1 + 2, - | ^^^^^^^^ help: remove this unsupported default value + | ^^^^^^^^ + | +help: remove this unsupported default value + | +LL - field3: i32 = 1 + 2, +LL + field3: i32, + | error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:21:16 | LL | field4: i32 = { 1 + 2 }, - | ^^^^^^^^^^^^ help: remove this unsupported default value + | ^^^^^^^^^^^^ + | +help: remove this unsupported default value + | +LL - field4: i32 = { 1 + 2 }, +LL + field4: i32, + | error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:22:14 | LL | field5: E = foo(42), - | ^^^^^^^^^^ help: remove this unsupported default value + | ^^^^^^^^^^ + | +help: remove this unsupported default value + | +LL - field5: E = foo(42), +LL + field5: E, + | error: default values on `struct` fields aren't supported --> $DIR/struct-default-values-and-missing-field-separator.rs:23:14 | LL | field6: E = { foo(42) }, - | ^^^^^^^^^^^^^^ help: remove this unsupported default value + | ^^^^^^^^^^^^^^ + | +help: remove this unsupported default value + | +LL - field6: E = { foo(42) }, +LL + field6: E, + | error: expected `:`, found `=` --> $DIR/struct-default-values-and-missing-field-separator.rs:27:12 | LL | field1 = i32, - | ^ - | | - | expected `:` - | help: field names and their types are separated with `:` + | ^ expected `:` + | +help: field names and their types are separated with `:` + | +LL | field1 : i32, + | ~ error: expected `:`, found `;` --> $DIR/struct-default-values-and-missing-field-separator.rs:28:11 | LL | field2; E, - | ^ - | | - | expected `:` - | help: field names and their types are separated with `:` + | ^ expected `:` + | +help: field names and their types are separated with `:` + | +LL | field2: E, + | ~ error: aborting due to 14 previous errors diff --git a/tests/ui/parser/struct-filed-with-attr.stderr b/tests/ui/parser/struct-filed-with-attr.stderr index d850ed620de43..8799ea4cfb099 100644 --- a/tests/ui/parser/struct-filed-with-attr.stderr +++ b/tests/ui/parser/struct-filed-with-attr.stderr @@ -2,7 +2,12 @@ error: expected `,`, or `}`, found `#` --> $DIR/struct-filed-with-attr.rs:5:14 | LL | owo: bool - | ^ help: try adding a comma: `,` + | ^ + | +help: try adding a comma + | +LL | owo: bool, + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest-assoc-const.stderr b/tests/ui/parser/suggest-assoc-const.stderr index 6e29fad98d466..70ebeded31374 100644 --- a/tests/ui/parser/suggest-assoc-const.stderr +++ b/tests/ui/parser/suggest-assoc-const.stderr @@ -2,7 +2,12 @@ error: non-item in item list --> $DIR/suggest-assoc-const.rs:5:5 | LL | let _X: i32; - | ^^^ help: consider using `const` instead of `let` for associated const: `const` + | ^^^ + | +help: consider using `const` instead of `let` for associated const + | +LL | const _X: i32; + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr b/tests/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr index 396c76ac85f2f..f406799bf5543 100644 --- a/tests/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr +++ b/tests/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr @@ -4,12 +4,15 @@ error: non-item in item list LL | trait Foo { | - item list starts here LL | fn bar() {}; - | ^ - | | - | non-item starts here - | help: consider removing this semicolon + | ^ non-item starts here LL | } | - item list ends here + | +help: consider removing this semicolon + | +LL - fn bar() {}; +LL + fn bar() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/trait-object-delimiters.stderr b/tests/ui/parser/trait-object-delimiters.stderr index 5f175e86545a8..1839eeeb2e4ef 100644 --- a/tests/ui/parser/trait-object-delimiters.stderr +++ b/tests/ui/parser/trait-object-delimiters.stderr @@ -2,7 +2,12 @@ error: ambiguous `+` in a type --> $DIR/trait-object-delimiters.rs:3:13 | LL | fn foo1(_: &dyn Drop + AsRef) {} - | ^^^^^^^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(dyn Drop + AsRef)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use parentheses to disambiguate + | +LL | fn foo1(_: &(dyn Drop + AsRef)) {} + | ~~~~~~~~~~~~~~~~~~~~~~~ error: incorrect parentheses around trait bounds --> $DIR/trait-object-delimiters.rs:6:17 @@ -38,9 +43,12 @@ error: expected one of `!`, `(`, `)`, `*`, `,`, `?`, `async`, `const`, `for`, `u --> $DIR/trait-object-delimiters.rs:10:17 | LL | fn foo3(_: &dyn {Drop + AsRef}) {} - | -^ expected one of 13 possible tokens - | | - | help: missing `,` + | ^ expected one of 13 possible tokens + | +help: missing `,` + | +LL | fn foo3(_: &dyn, {Drop + AsRef}) {} + | + error: expected identifier, found `<` --> $DIR/trait-object-delimiters.rs:14:17 @@ -52,9 +60,14 @@ error: invalid `dyn` keyword --> $DIR/trait-object-delimiters.rs:16:25 | LL | fn foo5(_: &(dyn Drop + dyn AsRef)) {} - | ^^^ help: remove this keyword + | ^^^ | = help: `dyn` is only needed at the start of a trait `+`-separated list +help: remove this keyword + | +LL - fn foo5(_: &(dyn Drop + dyn AsRef)) {} +LL + fn foo5(_: &(dyn Drop + AsRef)) {} + | error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-delimiters.rs:3:24 diff --git a/tests/ui/parser/trait-object-lifetime-parens.stderr b/tests/ui/parser/trait-object-lifetime-parens.stderr index 9c7a9662c4024..5b4529ee35c57 100644 --- a/tests/ui/parser/trait-object-lifetime-parens.stderr +++ b/tests/ui/parser/trait-object-lifetime-parens.stderr @@ -2,13 +2,23 @@ error: parenthesized lifetime bounds are not supported --> $DIR/trait-object-lifetime-parens.rs:5:21 | LL | fn f<'a, T: Trait + ('a)>() {} - | ^^^^ help: remove the parentheses + | ^^^^ + | +help: remove the parentheses + | +LL | fn f<'a, T: Trait + 'a>() {} + | ~~ error: parenthesized lifetime bounds are not supported --> $DIR/trait-object-lifetime-parens.rs:8:24 | LL | let _: Box; - | ^^^^ help: remove the parentheses + | ^^^^ + | +help: remove the parentheses + | +LL | let _: Box; + | ~~ error: lifetime in trait object type must be followed by `+` --> $DIR/trait-object-lifetime-parens.rs:10:17 diff --git a/tests/ui/parser/trait-object-polytrait-priority.stderr b/tests/ui/parser/trait-object-polytrait-priority.stderr index 23ec1e9cf3d45..9e4eb00663761 100644 --- a/tests/ui/parser/trait-object-polytrait-priority.stderr +++ b/tests/ui/parser/trait-object-polytrait-priority.stderr @@ -2,7 +2,12 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&for<'a> Trait< --> $DIR/trait-object-polytrait-priority.rs:6:12 | LL | let _: &for<'a> Trait<'a> + 'static; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&(for<'a> Trait<'a> + 'static)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | let _: &(for<'a> Trait<'a> + 'static); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/trait-pub-assoc-const.stderr b/tests/ui/parser/trait-pub-assoc-const.stderr index 1bace786b2181..8f0649ea030c9 100644 --- a/tests/ui/parser/trait-pub-assoc-const.stderr +++ b/tests/ui/parser/trait-pub-assoc-const.stderr @@ -2,9 +2,14 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/trait-pub-assoc-const.rs:2:5 | LL | pub const Foo: u32; - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub const Foo: u32; +LL + const Foo: u32; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/trait-pub-assoc-ty.stderr b/tests/ui/parser/trait-pub-assoc-ty.stderr index 28e05bdc63045..b7ca32e4d52bc 100644 --- a/tests/ui/parser/trait-pub-assoc-ty.stderr +++ b/tests/ui/parser/trait-pub-assoc-ty.stderr @@ -2,9 +2,14 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/trait-pub-assoc-ty.rs:2:5 | LL | pub type Foo; - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub type Foo; +LL + type Foo; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/trait-pub-method.stderr b/tests/ui/parser/trait-pub-method.stderr index cc1ba0eaaeaea..8194b7ed93a96 100644 --- a/tests/ui/parser/trait-pub-method.stderr +++ b/tests/ui/parser/trait-pub-method.stderr @@ -2,9 +2,14 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/trait-pub-method.rs:2:5 | LL | pub fn foo(); - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub fn foo(); +LL + fn foo(); + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/unicode-character-literal.stderr b/tests/ui/parser/unicode-character-literal.stderr index 726cde2b413e2..a1561e7f04b06 100644 --- a/tests/ui/parser/unicode-character-literal.stderr +++ b/tests/ui/parser/unicode-character-literal.stderr @@ -34,15 +34,17 @@ error: character literal may only contain one codepoint --> $DIR/unicode-character-literal.rs:17:14 | LL | let _a = 'Å'; - | ^-^ - | | - | help: consider using the normalized form `\u{c5}` of this character: `Å` + | ^^^ | note: this `A` is followed by the combining mark `\u{30a}` --> $DIR/unicode-character-literal.rs:17:15 | LL | let _a = 'Å'; | ^ +help: consider using the normalized form `\u{c5}` of this character + | +LL | let _a = 'Å'; + | ~ error: aborting due to 3 previous errors diff --git a/tests/ui/parser/unicode-control-codepoints.stderr b/tests/ui/parser/unicode-control-codepoints.stderr index fc071a9419142..dd6595ca9575a 100644 --- a/tests/ui/parser/unicode-control-codepoints.stderr +++ b/tests/ui/parser/unicode-control-codepoints.stderr @@ -94,7 +94,11 @@ LL | // if access_level != "user" { // Check if admin | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen = note: `#[deny(text_direction_codepoint_in_comment)]` on by default - = help: if their presence wasn't intentional, you can remove them +help: if their presence wasn't intentional, you can remove them + | +LL - // if access_level != "user" { // Check if admin +LL + // if access_level != "user" { // Check if admin + | error: unicode codepoint changing visible direction of text present in comment --> $DIR/unicode-control-codepoints.rs:30:1 @@ -109,7 +113,11 @@ LL | //"/* } if isAdmin begin admins only */" | this comment contains invisible unicode text flow control codepoints | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen - = help: if their presence wasn't intentional, you can remove them +help: if their presence wasn't intentional, you can remove them + | +LL - //"/* } if isAdmin begin admins only */" +LL + //"/* } if isAdmin begin admins only */" + | error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:11:22 @@ -125,7 +133,11 @@ LL | println!("{:?}", "/* } if isAdmin begin admins only "); | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen = note: `#[deny(text_direction_codepoint_in_literal)]` on by default - = help: if their presence wasn't intentional, you can remove them +help: if their presence wasn't intentional, you can remove them + | +LL - println!("{:?}", "/* } if isAdmin begin admins only "); +LL + println!("{:?}", "/* } if isAdmin begin admins only "); + | help: if you want to keep them but make them visible in your source code, you can escape them | LL | println!("{:?}", "/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "); @@ -144,7 +156,11 @@ LL | println!("{:?}", r##"/* } if isAdmin begin admins only "##); | this literal contains invisible unicode text flow control codepoints | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen - = help: if their presence wasn't intentional, you can remove them +help: if their presence wasn't intentional, you can remove them + | +LL - println!("{:?}", r##"/* } if isAdmin begin admins only "##); +LL + println!("{:?}", r##"/* } if isAdmin begin admins only "##); + | help: if you want to keep them but make them visible in your source code, you can escape them | LL | println!("{:?}", r##"/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "##); @@ -160,7 +176,11 @@ LL | println!("{:?}", ''); | this literal contains an invisible unicode text flow control codepoint | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen - = help: if their presence wasn't intentional, you can remove them +help: if their presence wasn't intentional, you can remove them + | +LL - println!("{:?}", ''); +LL + println!("{:?}", ''); + | help: if you want to keep them but make them visible in your source code, you can escape them | LL | println!("{:?}", '\u{202e}'); diff --git a/tests/ui/parser/unmatched-langle-1.stderr b/tests/ui/parser/unmatched-langle-1.stderr index cdf74bdedc2e1..3411a05fb589a 100644 --- a/tests/ui/parser/unmatched-langle-1.stderr +++ b/tests/ui/parser/unmatched-langle-1.stderr @@ -2,7 +2,13 @@ error: unmatched angle brackets --> $DIR/unmatched-langle-1.rs:5:10 | LL | foo::<<<>(); - | ^^^ help: remove extra angle brackets + | ^^^ + | +help: remove extra angle brackets + | +LL - foo::<<<>(); +LL + foo::>(); + | error[E0412]: cannot find type `Ty` in this scope --> $DIR/unmatched-langle-1.rs:5:14 diff --git a/tests/ui/parser/unnecessary-let.stderr b/tests/ui/parser/unnecessary-let.stderr index 952119cae3e27..c6ac0d562f82c 100644 --- a/tests/ui/parser/unnecessary-let.stderr +++ b/tests/ui/parser/unnecessary-let.stderr @@ -2,19 +2,36 @@ error: expected pattern, found `let` --> $DIR/unnecessary-let.rs:2:9 | LL | for let x of [1, 2, 3] {} - | ^^^ help: remove the unnecessary `let` keyword + | ^^^ + | +help: remove the unnecessary `let` keyword + | +LL - for let x of [1, 2, 3] {} +LL + for x of [1, 2, 3] {} + | error: missing `in` in `for` loop --> $DIR/unnecessary-let.rs:2:15 | LL | for let x of [1, 2, 3] {} - | ^^ help: try using `in` here instead + | ^^ + | +help: try using `in` here instead + | +LL | for let x in [1, 2, 3] {} + | ~~ error: expected pattern, found `let` --> $DIR/unnecessary-let.rs:7:9 | LL | let 1 => {} - | ^^^ help: remove the unnecessary `let` keyword + | ^^^ + | +help: remove the unnecessary `let` keyword + | +LL - let 1 => {} +LL + 1 => {} + | error: aborting due to 3 previous errors diff --git a/tests/ui/parser/use-colon-as-mod-sep.stderr b/tests/ui/parser/use-colon-as-mod-sep.stderr index bfc5374ef9d2d..347b271df9900 100644 --- a/tests/ui/parser/use-colon-as-mod-sep.stderr +++ b/tests/ui/parser/use-colon-as-mod-sep.stderr @@ -2,33 +2,49 @@ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:3:17 | LL | use std::process:Command; - | ^ help: use double colon + | ^ | = note: import paths are delimited using `::` +help: use double colon + | +LL | use std::process::Command; + | ~~ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:5:8 | LL | use std:fs::File; - | ^ help: use double colon + | ^ | = note: import paths are delimited using `::` +help: use double colon + | +LL | use std::fs::File; + | ~~ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:8 | LL | use std:collections:HashMap; - | ^ help: use double colon + | ^ | = note: import paths are delimited using `::` +help: use double colon + | +LL | use std::collections:HashMap; + | ~~ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:20 | LL | use std:collections:HashMap; - | ^ help: use double colon + | ^ | = note: import paths are delimited using `::` +help: use double colon + | +LL | use std:collections::HashMap; + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/patchable-function-entry/patchable-function-entry-attribute.stderr b/tests/ui/patchable-function-entry/patchable-function-entry-attribute.stderr index d9710c6e6a2f5..9c60a4c6ff2eb 100644 --- a/tests/ui/patchable-function-entry/patchable-function-entry-attribute.stderr +++ b/tests/ui/patchable-function-entry/patchable-function-entry-attribute.stderr @@ -2,7 +2,12 @@ error: malformed `patchable_function_entry` attribute input --> $DIR/patchable-function-entry-attribute.rs:10:1 | LL | #[patchable_function_entry] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[patchable_function_entry(prefix_nops = m, entry_nops = n)] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: integer value out of range --> $DIR/patchable-function-entry-attribute.rs:4:42 diff --git a/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr b/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr index 2f45415844d86..1599edd7a992d 100644 --- a/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr +++ b/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr @@ -6,7 +6,11 @@ LL | let _ @ a = 0; | | | | | binding on the right, should be on the left | pattern on the left, should be on the right - | help: switch the order: `a @ _` + | +help: switch the order + | +LL | let a @ _ = 0; + | ~~~~~ error: pattern on wrong side of `@` --> $DIR/wild-before-at-syntactically-rejected.rs:10:9 @@ -16,7 +20,11 @@ LL | let _ @ ref a = 0; | | | | | binding on the right, should be on the left | pattern on the left, should be on the right - | help: switch the order: `ref a @ _` + | +help: switch the order + | +LL | let ref a @ _ = 0; + | ~~~~~~~~~ error: pattern on wrong side of `@` --> $DIR/wild-before-at-syntactically-rejected.rs:12:9 @@ -26,7 +34,11 @@ LL | let _ @ ref mut a = 0; | | | | | binding on the right, should be on the left | pattern on the left, should be on the right - | help: switch the order: `ref mut a @ _` + | +help: switch the order + | +LL | let ref mut a @ _ = 0; + | ~~~~~~~~~~~~~ error: left-hand side of `@` must be a binding --> $DIR/wild-before-at-syntactically-rejected.rs:14:9 diff --git a/tests/ui/pattern/issue-106862.stderr b/tests/ui/pattern/issue-106862.stderr index 27f8ac97284eb..74c082e1b3375 100644 --- a/tests/ui/pattern/issue-106862.stderr +++ b/tests/ui/pattern/issue-106862.stderr @@ -5,7 +5,12 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB(a, b) => println!("{} {}", a, b), - | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: b }` + | ^^^^^^^^^^ + | +help: use struct pattern syntax instead + | +LL | FooB { x: a, y: b } => println!("{} {}", a, b), + | ~~~~~~~~~~~~~~~~~~~ error[E0532]: expected tuple struct or tuple variant, found variant `FooB` --> $DIR/issue-106862.rs:22:9 @@ -14,7 +19,12 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB(x, y) => println!("{} {}", x, y), - | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + | ^^^^^^^^^^ + | +help: use struct pattern syntax instead + | +LL | FooB { x, y } => println!("{} {}", x, y), + | ~~~~~~~~~~~~~ error[E0532]: expected tuple struct or tuple variant, found variant `FooA` --> $DIR/issue-106862.rs:28:9 @@ -23,7 +33,12 @@ LL | FooA { opt_x: Option, y: i32 }, | ----------------------------------- `FooA` defined here ... LL | FooA(Some(x), y) => println!("{} {}", x, y), - | ^^^^^^^^^^^^^^^^ help: use struct pattern syntax instead: `FooA { opt_x: Some(x), y }` + | ^^^^^^^^^^^^^^^^ + | +help: use struct pattern syntax instead + | +LL | FooA { opt_x: Some(x), y } => println!("{} {}", x, y), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0532]: expected tuple struct or tuple variant, found variant `FooB` --> $DIR/issue-106862.rs:34:9 @@ -32,7 +47,12 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB(a, _, _) => println!("{}", a), - | ^^^^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: _ }` + | ^^^^^^^^^^^^^ + | +help: use struct pattern syntax instead + | +LL | FooB { x: a, y: _ } => println!("{}", a), + | ~~~~~~~~~~~~~~~~~~~ error[E0532]: expected tuple struct or tuple variant, found variant `FooB` --> $DIR/issue-106862.rs:40:9 @@ -41,7 +61,12 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB() => (), - | ^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + | ^^^^^^ + | +help: use struct pattern syntax instead + | +LL | FooB { x, y } => (), + | ~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/pattern/issue-14221.stderr b/tests/ui/pattern/issue-14221.stderr index 7ea51b5f804c0..305564f311c18 100644 --- a/tests/ui/pattern/issue-14221.stderr +++ b/tests/ui/pattern/issue-14221.stderr @@ -2,15 +2,24 @@ error[E0170]: pattern binding `A` is named the same as one of the variants of th --> $DIR/issue-14221.rs:13:13 | LL | A => "A", - | ^ help: to match on the variant, qualify the path: `E::A` + | ^ | = note: `#[deny(bindings_with_variant_name)]` on by default +help: to match on the variant, qualify the path + | +LL | E::A => "A", + | ~~~~ error[E0170]: pattern binding `B` is named the same as one of the variants of the type `E` --> $DIR/issue-14221.rs:15:13 | LL | B => "B", - | ^ help: to match on the variant, qualify the path: `E::B` + | ^ + | +help: to match on the variant, qualify the path + | +LL | E::B => "B", + | ~~~~ error: unreachable pattern --> $DIR/issue-14221.rs:15:13 diff --git a/tests/ui/pattern/issue-67776-match-same-name-enum-variant-refs.stderr b/tests/ui/pattern/issue-67776-match-same-name-enum-variant-refs.stderr index da580c7accb97..fb222da32e883 100644 --- a/tests/ui/pattern/issue-67776-match-same-name-enum-variant-refs.stderr +++ b/tests/ui/pattern/issue-67776-match-same-name-enum-variant-refs.stderr @@ -2,39 +2,68 @@ error[E0170]: pattern binding `Bar` is named the same as one of the variants of --> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:15:9 | LL | Bar => {}, - | ^^^ help: to match on the variant, qualify the path: `Foo::Bar` + | ^^^ | = note: `#[deny(bindings_with_variant_name)]` on by default +help: to match on the variant, qualify the path + | +LL | Foo::Bar => {}, + | ~~~~~~~~ error[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo` --> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:17:9 | LL | Baz => {}, - | ^^^ help: to match on the variant, qualify the path: `Foo::Baz` + | ^^^ + | +help: to match on the variant, qualify the path + | +LL | Foo::Baz => {}, + | ~~~~~~~~ error[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo` --> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:24:9 | LL | Bar => {}, - | ^^^ help: to match on the variant, qualify the path: `Foo::Bar` + | ^^^ + | +help: to match on the variant, qualify the path + | +LL | Foo::Bar => {}, + | ~~~~~~~~ error[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo` --> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:26:9 | LL | Baz => {}, - | ^^^ help: to match on the variant, qualify the path: `Foo::Baz` + | ^^^ + | +help: to match on the variant, qualify the path + | +LL | Foo::Baz => {}, + | ~~~~~~~~ error[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo` --> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:33:9 | LL | Bar => {}, - | ^^^ help: to match on the variant, qualify the path: `Foo::Bar` + | ^^^ + | +help: to match on the variant, qualify the path + | +LL | Foo::Bar => {}, + | ~~~~~~~~ error[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo` --> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:35:9 | LL | Baz => {}, - | ^^^ help: to match on the variant, qualify the path: `Foo::Baz` + | ^^^ + | +help: to match on the variant, qualify the path + | +LL | Foo::Baz => {}, + | ~~~~~~~~ error: aborting due to 6 previous errors diff --git a/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr b/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr index 167016397d212..622358126b09e 100644 --- a/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr +++ b/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr @@ -2,9 +2,13 @@ error: `mut` must be attached to each individual binding --> $DIR/issue-80186-mut-binding-help-suggestion.rs:5:9 | LL | let mut &x = &0; - | ^^^^^^ help: add `mut` to each binding: `&(mut x)` + | ^^^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: add `mut` to each binding + | +LL | let &(mut x) = &0; + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/pattern/match_ergonomics_2024.stderr b/tests/ui/pattern/match_ergonomics_2024.stderr index 11844434ad214..6ba3757717d86 100644 --- a/tests/ui/pattern/match_ergonomics_2024.stderr +++ b/tests/ui/pattern/match_ergonomics_2024.stderr @@ -2,47 +2,61 @@ error: the semantics of this pattern will change in edition 2024 --> $DIR/match_ergonomics_2024.rs:14:9 | LL | let Foo(mut a) = &Foo(0); - | -^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/match_ergonomics_2024.rs:7:9 | LL | #![deny(rust_2024_incompatible_pat)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: desugar the match ergonomics + | +LL | let &Foo(mut a) = &Foo(0); + | + error: the semantics of this pattern will change in edition 2024 --> $DIR/match_ergonomics_2024.rs:18:9 | LL | let Foo(mut a) = &mut Foo(0); - | -^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&mut` + | ^^^^^^^^^^ + | +help: desugar the match ergonomics + | +LL | let &mut Foo(mut a) = &mut Foo(0); + | ++++ error: the semantics of this pattern will change in edition 2024 --> $DIR/match_ergonomics_2024.rs:22:12 | LL | if let Some(&_) = &&&&&Some(&0u8) {} - | -^^^^^^^ - | | - | help: desugar the match ergonomics: `&&&&&` + | ^^^^^^^^ + | +help: desugar the match ergonomics + | +LL | if let &&&&&Some(&_) = &&&&&Some(&0u8) {} + | +++++ error: the semantics of this pattern will change in edition 2024 --> $DIR/match_ergonomics_2024.rs:25:12 | LL | if let Some(&mut _) = &&&&&Some(&mut 0u8) {} - | -^^^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&&&&&` + | ^^^^^^^^^^^^ + | +help: desugar the match ergonomics + | +LL | if let &&&&&Some(&mut _) = &&&&&Some(&mut 0u8) {} + | +++++ error: the semantics of this pattern will change in edition 2024 --> $DIR/match_ergonomics_2024.rs:28:12 | LL | if let Some(&_) = &&&&&mut Some(&0u8) {} - | -^^^^^^^ - | | - | help: desugar the match ergonomics: `&&&&&mut` + | ^^^^^^^^ + | +help: desugar the match ergonomics + | +LL | if let &&&&&mut Some(&_) = &&&&&mut Some(&0u8) {} + | ++++++++ error: the semantics of this pattern will change in edition 2024 --> $DIR/match_ergonomics_2024.rs:31:12 diff --git a/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr b/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr index 5ed3979feb807..60ed95a2c5776 100644 --- a/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr +++ b/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr @@ -5,7 +5,12 @@ LL | struct S {} | ----------- `S` defined here ... LL | let Self = S; - | ^ help: use struct literal syntax instead: `S {}` + | ^ + | +help: use struct literal syntax instead + | +LL | let Self = S {}; + | ~~~~ error[E0533]: expected unit struct, found self constructor `Self` --> $DIR/no-match-tuple-variant-self-ctor.rs:30:17 diff --git a/tests/ui/pattern/no-patterns-in-args-2.stderr b/tests/ui/pattern/no-patterns-in-args-2.stderr index 6adcbb9dccd82..4a3b029b3385c 100644 --- a/tests/ui/pattern/no-patterns-in-args-2.stderr +++ b/tests/ui/pattern/no-patterns-in-args-2.stderr @@ -8,7 +8,7 @@ error: patterns aren't allowed in functions without bodies --> $DIR/no-patterns-in-args-2.rs:4:11 | LL | fn f1(mut arg: u8); - | ^^^^^^^ help: remove `mut` from the parameter: `arg` + | ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #35203 @@ -17,6 +17,10 @@ note: the lint level is defined here | LL | #![deny(patterns_in_fns_without_body)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove `mut` from the parameter + | +LL | fn f1(arg: u8); + | ~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index 0d7f2e4af69aa..12c2c70d4a4f5 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -5,10 +5,12 @@ LL | use declarations_for_tuple_field_count_errors::*; | -------------------------------------------- the tuple struct `Z1` is imported here ... LL | Z1 => {} - | ^^ - | | - | cannot be named the same as a tuple struct - | help: try specify the pattern arguments: `Z1(..)` + | ^^ cannot be named the same as a tuple struct + | +help: try specify the pattern arguments + | +LL | Z1(..) => {} + | ~~~~~~ error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0` --> $DIR/pat-tuple-field-count-cross.rs:9:9 diff --git a/tests/ui/pattern/pat-tuple-overfield.stderr b/tests/ui/pattern/pat-tuple-overfield.stderr index 54d89e03101dc..2cf85982f4c08 100644 --- a/tests/ui/pattern/pat-tuple-overfield.stderr +++ b/tests/ui/pattern/pat-tuple-overfield.stderr @@ -5,10 +5,12 @@ LL | struct Z1(); | ------------ the tuple struct `Z1` is defined here ... LL | Z1 => {} - | ^^ - | | - | cannot be named the same as a tuple struct - | help: try specify the pattern arguments: `Z1(..)` + | ^^ cannot be named the same as a tuple struct + | +help: try specify the pattern arguments + | +LL | Z1(..) => {} + | ~~~~~~ error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0` --> $DIR/pat-tuple-overfield.rs:52:9 diff --git a/tests/ui/pattern/pat-tuple-underfield.stderr b/tests/ui/pattern/pat-tuple-underfield.stderr index e75f9b38da566..939529e0cf240 100644 --- a/tests/ui/pattern/pat-tuple-underfield.stderr +++ b/tests/ui/pattern/pat-tuple-underfield.stderr @@ -5,7 +5,12 @@ LL | S(i32, f32), | ----------- `E::S` defined here ... LL | E::S => {} - | ^^^^ help: use the tuple variant pattern syntax instead: `E::S(_, _)` + | ^^^^ + | +help: use the tuple variant pattern syntax instead + | +LL | E::S(_, _) => {} + | ~~~~~~~~~~ error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 2 fields --> $DIR/pat-tuple-underfield.rs:9:11 diff --git a/tests/ui/pattern/pattern-bad-ref-box-order.stderr b/tests/ui/pattern/pattern-bad-ref-box-order.stderr index a49f05c1028d8..a89d3ed21b629 100644 --- a/tests/ui/pattern/pattern-bad-ref-box-order.stderr +++ b/tests/ui/pattern/pattern-bad-ref-box-order.stderr @@ -2,7 +2,12 @@ error: switch the order of `ref` and `box` --> $DIR/pattern-bad-ref-box-order.rs:8:14 | LL | Some(ref box _i) => {}, - | ^^^^^^^ help: swap them: `box ref` + | ^^^^^^^ + | +help: swap them + | +LL | Some(box ref _i) => {}, + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/pattern/pattern-binding-disambiguation.stderr b/tests/ui/pattern/pattern-binding-disambiguation.stderr index 61c32b6a17bdf..96bb425619457 100644 --- a/tests/ui/pattern/pattern-binding-disambiguation.stderr +++ b/tests/ui/pattern/pattern-binding-disambiguation.stderr @@ -5,10 +5,12 @@ LL | struct TupleStruct(); | --------------------- the tuple struct `TupleStruct` is defined here ... LL | TupleStruct => {} - | ^^^^^^^^^^^ - | | - | cannot be named the same as a tuple struct - | help: try specify the pattern arguments: `TupleStruct(..)` + | ^^^^^^^^^^^ cannot be named the same as a tuple struct + | +help: try specify the pattern arguments + | +LL | TupleStruct(..) => {} + | ~~~~~~~~~~~~~~~ error[E0530]: match bindings cannot shadow tuple variants --> $DIR/pattern-binding-disambiguation.rs:33:9 @@ -17,10 +19,12 @@ LL | use E::*; | ---- the tuple variant `TupleVariant` is imported here ... LL | TupleVariant => {} - | ^^^^^^^^^^^^ - | | - | cannot be named the same as a tuple variant - | help: try specify the pattern arguments: `TupleVariant(..)` + | ^^^^^^^^^^^^ cannot be named the same as a tuple variant + | +help: try specify the pattern arguments + | +LL | TupleVariant(..) => {} + | ~~~~~~~~~~~~~~~~ error[E0530]: match bindings cannot shadow statics --> $DIR/pattern-binding-disambiguation.rs:42:9 diff --git a/tests/ui/pattern/pattern-error-continue.stderr b/tests/ui/pattern/pattern-error-continue.stderr index 10fcccb030162..79467296d3369 100644 --- a/tests/ui/pattern/pattern-error-continue.stderr +++ b/tests/ui/pattern/pattern-error-continue.stderr @@ -54,10 +54,12 @@ error[E0433]: failed to resolve: use of undeclared type `E` --> $DIR/pattern-error-continue.rs:33:9 | LL | E::V => {} - | ^ - | | - | use of undeclared type `E` - | help: an enum with a similar name exists: `A` + | ^ use of undeclared type `E` + | +help: an enum with a similar name exists + | +LL | A::V => {} + | ~ error: aborting due to 5 previous errors diff --git a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr index 37c02eb6ada9c..9d642b9245a26 100644 --- a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr +++ b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr @@ -2,7 +2,12 @@ error: range-to patterns with `...` are not allowed --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:17:13 | LL | [_, ...tail] => println!("{tail}"), - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | [_, ..=tail] => println!("{tail}"), + | ~~~ error[E0425]: cannot find value `rest` in this scope --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:3:13 diff --git a/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.stderr b/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.stderr index 8a029073f0574..808a75b0fd332 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.stderr @@ -2,10 +2,7 @@ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:15:9 | LL | 20..30 => {} - | ^^^^^^ - | | - | this range doesn't match `30_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `20_u8..=30_u8` + | ^^^^^^ this range doesn't match `30_u8` because `..` is an exclusive range LL | 31..=40 => {} | ------- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them | @@ -14,17 +11,23 @@ note: the lint level is defined here | LL | #![deny(non_contiguous_range_endpoints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use an inclusive range instead + | +LL | 20_u8..=30_u8 => {} + | ~~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:20:9 | LL | 20..30 => {} - | ^^^^^^ - | | - | this range doesn't match `30_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `20_u8..=30_u8` + | ^^^^^^ this range doesn't match `30_u8` because `..` is an exclusive range LL | 31 => {} | -- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | 20_u8..=30_u8 => {} + | ~~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:25:13 @@ -33,17 +36,24 @@ LL | m!(0u8, 20..30, 31..=40); | ^^^^^^ ------- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them | | | this range doesn't match `30_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `20_u8..=30_u8` + | +help: use an inclusive range instead + | +LL | m!(0u8, 20_u8..=30_u8, 31..=40); + | ~~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:26:22 | LL | m!(0u8, 31..=40, 20..30); - | ------- ^^^^^^ - | | | - | | this range doesn't match `30_u8` because `..` is an exclusive range - | | help: use an inclusive range instead: `20_u8..=30_u8` + | ------- ^^^^^^ this range doesn't match `30_u8` because `..` is an exclusive range + | | | this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | m!(0u8, 31..=40, 20_u8..=30_u8); + | ~~~~~~~~~~~~~ warning: multiple patterns overlap on their endpoints --> $DIR/gap_between_ranges.rs:27:21 @@ -63,7 +73,11 @@ LL | m!(0u8, 20..30, 31..=40); | ^^^^^^ ------- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them | | | this range doesn't match `30_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `20_u8..=30_u8` + | +help: use an inclusive range instead + | +LL | m!(0u8, 20_u8..=30_u8, 31..=40); + | ~~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:31:13 @@ -72,122 +86,146 @@ LL | m!(0u8, 20..30, 31..=32); | ^^^^^^ ------- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them | | | this range doesn't match `30_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `20_u8..=30_u8` + | +help: use an inclusive range instead + | +LL | m!(0u8, 20_u8..=30_u8, 31..=32); + | ~~~~~~~~~~~~~ error: exclusive range missing `u8::MAX` --> $DIR/gap_between_ranges.rs:41:9 | LL | 0..255 => {} - | ^^^^^^ - | | - | this range doesn't match `u8::MAX` because `..` is an exclusive range - | help: use an inclusive range instead: `0_u8..=u8::MAX` + | ^^^^^^ this range doesn't match `u8::MAX` because `..` is an exclusive range + | +help: use an inclusive range instead + | +LL | 0_u8..=u8::MAX => {} + | ~~~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:70:9 | LL | 0..10 => {} - | ^^^^^ - | | - | this range doesn't match `10_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `0_u8..=10_u8` + | ^^^^^ this range doesn't match `10_u8` because `..` is an exclusive range LL | 11..20 => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them LL | 11..30 => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | 0_u8..=10_u8 => {} + | ~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:76:9 | LL | 0..10 => {} - | ^^^^^ - | | - | this range doesn't match `10_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `0_u8..=10_u8` + | ^^^^^ this range doesn't match `10_u8` because `..` is an exclusive range LL | 11..20 => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | 0_u8..=10_u8 => {} + | ~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:77:9 | LL | 11..20 => {} - | ^^^^^^ - | | - | this range doesn't match `20_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `11_u8..=20_u8` + | ^^^^^^ this range doesn't match `20_u8` because `..` is an exclusive range LL | 21..30 => {} | ------ this could appear to continue range `11_u8..20_u8`, but `20_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | 11_u8..=20_u8 => {} + | ~~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:82:9 | LL | 00..20 => {} - | ^^^^^^ - | | - | this range doesn't match `20_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `0_u8..=20_u8` + | ^^^^^^ this range doesn't match `20_u8` because `..` is an exclusive range LL | 10..20 => {} LL | 21..30 => {} | ------ this could appear to continue range `0_u8..20_u8`, but `20_u8` isn't matched by either of them LL | 21..40 => {} | ------ this could appear to continue range `0_u8..20_u8`, but `20_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | 0_u8..=20_u8 => {} + | ~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:83:9 | LL | 10..20 => {} - | ^^^^^^ - | | - | this range doesn't match `20_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `10_u8..=20_u8` + | ^^^^^^ this range doesn't match `20_u8` because `..` is an exclusive range LL | 21..30 => {} | ------ this could appear to continue range `10_u8..20_u8`, but `20_u8` isn't matched by either of them LL | 21..40 => {} | ------ this could appear to continue range `10_u8..20_u8`, but `20_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | 10_u8..=20_u8 => {} + | ~~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:91:10 | LL | (0..10, true) => {} - | ^^^^^ - | | - | this range doesn't match `10_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `0_u8..=10_u8` + | ^^^^^ this range doesn't match `10_u8` because `..` is an exclusive range LL | (11..20, true) => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | (0_u8..=10_u8, true) => {} + | ~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:96:16 | LL | (true, 0..10) => {} - | ^^^^^ - | | - | this range doesn't match `10_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `0_u8..=10_u8` + | ^^^^^ this range doesn't match `10_u8` because `..` is an exclusive range LL | (true, 11..20) => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | (true, 0_u8..=10_u8) => {} + | ~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:102:10 | LL | (0..10, true) => {} - | ^^^^^ - | | - | this range doesn't match `10_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `0_u8..=10_u8` + | ^^^^^ this range doesn't match `10_u8` because `..` is an exclusive range LL | (11..20, false) => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | (0_u8..=10_u8, true) => {} + | ~~~~~~~~~~~~ error: multiple ranges are one apart --> $DIR/gap_between_ranges.rs:112:14 | LL | Some(0..10) => {} - | ^^^^^ - | | - | this range doesn't match `10_u8` because `..` is an exclusive range - | help: use an inclusive range instead: `0_u8..=10_u8` + | ^^^^^ this range doesn't match `10_u8` because `..` is an exclusive range LL | Some(11..20) => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them + | +help: use an inclusive range instead + | +LL | Some(0_u8..=10_u8) => {} + | ~~~~~~~~~~~~ error: aborting due to 16 previous errors; 1 warning emitted diff --git a/tests/ui/privacy/issue-113860-1.stderr b/tests/ui/privacy/issue-113860-1.stderr index c05452fb51c79..66c5299021b5c 100644 --- a/tests/ui/privacy/issue-113860-1.stderr +++ b/tests/ui/privacy/issue-113860-1.stderr @@ -2,9 +2,14 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-113860-1.rs:12:5 | LL | pub(self) fn fun() {} - | ^^^^^^^^^ help: remove the qualifier + | ^^^^^^^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub(self) fn fun() {} +LL + fn fun() {} + | error: module has missing stability attribute --> $DIR/issue-113860-1.rs:1:1 diff --git a/tests/ui/privacy/issue-113860-2.stderr b/tests/ui/privacy/issue-113860-2.stderr index c53c490ca1ecb..fa109735dd49c 100644 --- a/tests/ui/privacy/issue-113860-2.stderr +++ b/tests/ui/privacy/issue-113860-2.stderr @@ -2,9 +2,14 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-113860-2.rs:12:5 | LL | pub(self) type X = Self; - | ^^^^^^^^^ help: remove the qualifier + | ^^^^^^^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub(self) type X = Self; +LL + type X = Self; + | error: module has missing stability attribute --> $DIR/issue-113860-2.rs:1:1 diff --git a/tests/ui/privacy/issue-113860.stderr b/tests/ui/privacy/issue-113860.stderr index d813b740ac5bd..788dc31ad48a9 100644 --- a/tests/ui/privacy/issue-113860.stderr +++ b/tests/ui/privacy/issue-113860.stderr @@ -2,9 +2,14 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-113860.rs:12:5 | LL | pub(self) const X: u32 = 3; - | ^^^^^^^^^ help: remove the qualifier + | ^^^^^^^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub(self) const X: u32 = 3; +LL + const X: u32 = 3; + | error: module has missing stability attribute --> $DIR/issue-113860.rs:1:1 diff --git a/tests/ui/privacy/issue-29161.stderr b/tests/ui/privacy/issue-29161.stderr index f8911cb09c1bc..79f66f7541d28 100644 --- a/tests/ui/privacy/issue-29161.stderr +++ b/tests/ui/privacy/issue-29161.stderr @@ -2,9 +2,14 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-29161.rs:5:9 | LL | pub fn default() -> A { - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub fn default() -> A { +LL + fn default() -> A { + | error[E0603]: struct `A` is private --> $DIR/issue-29161.rs:13:8 diff --git a/tests/ui/privacy/priv-in-bad-locations.stderr b/tests/ui/privacy/priv-in-bad-locations.stderr index 93a0eabb91456..132648d62964b 100644 --- a/tests/ui/privacy/priv-in-bad-locations.stderr +++ b/tests/ui/privacy/priv-in-bad-locations.stderr @@ -2,33 +2,53 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:1:1 | LL | pub extern "C" { - | ^^^ help: remove the qualifier + | ^^^ | = note: place qualifiers on individual foreign items instead +help: remove the qualifier + | +LL - pub extern "C" { +LL + extern "C" { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:11:1 | LL | pub impl B {} - | ^^^ help: remove the qualifier + | ^^^ | = note: place qualifiers on individual impl items instead +help: remove the qualifier + | +LL - pub impl B {} +LL + impl B {} + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:13:1 | LL | pub impl A for B { - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub impl A for B { +LL + impl A for B { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:14:5 | LL | pub fn foo(&self) {} - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub fn foo(&self) {} +LL + fn foo(&self) {} + | error: aborting due to 4 previous errors diff --git a/tests/ui/privacy/privacy-sanity.stderr b/tests/ui/privacy/privacy-sanity.stderr index 0acb05cbabaa7..a34892305e953 100644 --- a/tests/ui/privacy/privacy-sanity.stderr +++ b/tests/ui/privacy/privacy-sanity.stderr @@ -2,145 +2,235 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:13:1 | LL | pub impl Tr for S { - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub impl Tr for S { +LL + impl Tr for S { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:14:5 | LL | pub fn f() {} - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub fn f() {} +LL + fn f() {} + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:15:5 | LL | pub const C: u8 = 0; - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub const C: u8 = 0; +LL + const C: u8 = 0; + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:16:5 | LL | pub type T = u8; - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub type T = u8; +LL + type T = u8; + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:18:1 | LL | pub impl S { - | ^^^ help: remove the qualifier + | ^^^ | = note: place qualifiers on individual impl items instead +help: remove the qualifier + | +LL - pub impl S { +LL + impl S { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:23:1 | LL | pub extern "C" { - | ^^^ help: remove the qualifier + | ^^^ | = note: place qualifiers on individual foreign items instead +help: remove the qualifier + | +LL - pub extern "C" { +LL + extern "C" { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:39:5 | LL | pub impl Tr for S { - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub impl Tr for S { +LL + impl Tr for S { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:40:9 | LL | pub fn f() {} - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub fn f() {} +LL + fn f() {} + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:41:9 | LL | pub const C: u8 = 0; - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub const C: u8 = 0; +LL + const C: u8 = 0; + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:42:9 | LL | pub type T = u8; - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub type T = u8; +LL + type T = u8; + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:44:5 | LL | pub impl S { - | ^^^ help: remove the qualifier + | ^^^ | = note: place qualifiers on individual impl items instead +help: remove the qualifier + | +LL - pub impl S { +LL + impl S { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:49:5 | LL | pub extern "C" { - | ^^^ help: remove the qualifier + | ^^^ | = note: place qualifiers on individual foreign items instead +help: remove the qualifier + | +LL - pub extern "C" { +LL + extern "C" { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:68:5 | LL | pub impl Tr for S { - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub impl Tr for S { +LL + impl Tr for S { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:69:9 | LL | pub fn f() {} - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub fn f() {} +LL + fn f() {} + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:70:9 | LL | pub const C: u8 = 0; - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub const C: u8 = 0; +LL + const C: u8 = 0; + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:71:9 | LL | pub type T = u8; - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub type T = u8; +LL + type T = u8; + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:73:5 | LL | pub impl S { - | ^^^ help: remove the qualifier + | ^^^ | = note: place qualifiers on individual impl items instead +help: remove the qualifier + | +LL - pub impl S { +LL + impl S { + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:78:5 | LL | pub extern "C" { - | ^^^ help: remove the qualifier + | ^^^ | = note: place qualifiers on individual foreign items instead +help: remove the qualifier + | +LL - pub extern "C" { +LL + extern "C" { + | error: aborting due to 18 previous errors diff --git a/tests/ui/privacy/restricted/relative-2018.stderr b/tests/ui/privacy/restricted/relative-2018.stderr index dec0d5157da4f..d0f6d415491f9 100644 --- a/tests/ui/privacy/restricted/relative-2018.stderr +++ b/tests/ui/privacy/restricted/relative-2018.stderr @@ -8,9 +8,12 @@ error: relative paths are not supported in visibilities in 2018 edition or later --> $DIR/relative-2018.rs:9:12 | LL | pub(in a::b) struct S5; - | ^--- - | | - | help: try: `crate::a::b` + | ^ + | +help: try + | +LL | pub(in crate::a::b) struct S5; + | ~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/privacy/unresolved-trait-impl-item.stderr b/tests/ui/privacy/unresolved-trait-impl-item.stderr index 588e47c26bcd1..789f5a22d2d54 100644 --- a/tests/ui/privacy/unresolved-trait-impl-item.stderr +++ b/tests/ui/privacy/unresolved-trait-impl-item.stderr @@ -2,10 +2,12 @@ error[E0407]: method `unresolved` is not a member of trait `MyTrait` --> $DIR/unresolved-trait-impl-item.rs:11:5 | LL | async fn unresolved(&self) {} - | ^^^^^^^^^----------^^^^^^^^^^ - | | | - | | help: there is an associated function with a similar name: `resolved` - | not a member of trait `MyTrait` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `MyTrait` + | +help: there is an associated function with a similar name + | +LL | async fn resolved(&self) {} + | ~~~~~~~~ error[E0324]: item `RESOLVED_WRONG` is an associated method, which doesn't match its trait `MyTrait` --> $DIR/unresolved-trait-impl-item.rs:12:5 diff --git a/tests/ui/privacy/useless-pub.stderr b/tests/ui/privacy/useless-pub.stderr index 7d064c12a09d6..9e7844ddce01e 100644 --- a/tests/ui/privacy/useless-pub.stderr +++ b/tests/ui/privacy/useless-pub.stderr @@ -2,25 +2,40 @@ error[E0449]: visibility qualifiers are not permitted here --> $DIR/useless-pub.rs:8:5 | LL | pub fn foo(&self) {} - | ^^^ help: remove the qualifier + | ^^^ | = note: trait items always share the visibility of their trait +help: remove the qualifier + | +LL - pub fn foo(&self) {} +LL + fn foo(&self) {} + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/useless-pub.rs:12:10 | LL | V1 { pub f: i32 }, - | ^^^ help: remove the qualifier + | ^^^ | = note: enum variants and their fields always share the visibility of the enum they are in +help: remove the qualifier + | +LL - V1 { pub f: i32 }, +LL + V1 { f: i32 }, + | error[E0449]: visibility qualifiers are not permitted here --> $DIR/useless-pub.rs:13:8 | LL | V2(pub i32), - | ^^^ help: remove the qualifier + | ^^^ | = note: enum variants and their fields always share the visibility of the enum they are in +help: remove the qualifier + | +LL - V2(pub i32), +LL + V2( i32), + | error: aborting due to 3 previous errors diff --git a/tests/ui/proc-macro/attribute.stderr b/tests/ui/proc-macro/attribute.stderr index 3269aaf7f917e..64a76c39324ac 100644 --- a/tests/ui/proc-macro/attribute.stderr +++ b/tests/ui/proc-macro/attribute.stderr @@ -2,13 +2,23 @@ error: malformed `proc_macro_derive` attribute input --> $DIR/attribute.rs:9:1 | LL | #[proc_macro_derive] - | ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `proc_macro_derive` attribute input --> $DIR/attribute.rs:12:1 | LL | #[proc_macro_derive = ""] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: attribute must have either one or two arguments --> $DIR/attribute.rs:15:1 diff --git a/tests/ui/proc-macro/attributes-included.stderr b/tests/ui/proc-macro/attributes-included.stderr index 72c88d5d8b752..317da463d7b89 100644 --- a/tests/ui/proc-macro/attributes-included.stderr +++ b/tests/ui/proc-macro/attributes-included.stderr @@ -2,7 +2,7 @@ warning: unused variable: `a` --> $DIR/attributes-included.rs:17:9 | LL | let a: i32 = "foo"; - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: the lint level is defined here --> $DIR/attributes-included.rs:4:9 @@ -10,6 +10,10 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _a: i32 = "foo"; + | ~~ warning: 1 warning emitted diff --git a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr index df7c4f72eb0b6..6c8a29a7a42f0 100644 --- a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr +++ b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr @@ -13,18 +13,27 @@ error[E0425]: cannot find value `local_use` in this scope --> $DIR/gen-macro-rules-hygiene.rs:12:1 | LL | gen_macro_rules!(); - | ^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `local_def` + | ^^^^^^^^^^^^^^^^^^ ... LL | generated!(); | ------------ in this macro invocation | = note: this error originates in the macro `generated` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a local variable with a similar name exists + | +LL | local_def; + | ~~~~~~~~~ error[E0425]: cannot find value `local_def` in this scope --> $DIR/gen-macro-rules-hygiene.rs:21:9 | LL | local_def; - | ^^^^^^^^^ help: a local variable with a similar name exists: `local_use` + | ^^^^^^^^^ + | +help: a local variable with a similar name exists + | +LL | local_use; + | ~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/proc-macro/invalid-attributes.stderr b/tests/ui/proc-macro/invalid-attributes.stderr index fe411fa5e1f8e..3ff96e4092308 100644 --- a/tests/ui/proc-macro/invalid-attributes.stderr +++ b/tests/ui/proc-macro/invalid-attributes.stderr @@ -2,37 +2,67 @@ error: malformed `proc_macro` attribute input --> $DIR/invalid-attributes.rs:10:1 | LL | #[proc_macro = "test"] - | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro]` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[proc_macro] + | ~~~~~~~~~~~~~ error: malformed `proc_macro` attribute input --> $DIR/invalid-attributes.rs:13:1 | LL | #[proc_macro()] - | ^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro]` + | ^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[proc_macro] + | ~~~~~~~~~~~~~ error: malformed `proc_macro` attribute input --> $DIR/invalid-attributes.rs:16:1 | LL | #[proc_macro(x)] - | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro]` + | ^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[proc_macro] + | ~~~~~~~~~~~~~ error: malformed `proc_macro_attribute` attribute input --> $DIR/invalid-attributes.rs:19:1 | LL | #[proc_macro_attribute = "test"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_attribute]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[proc_macro_attribute] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `proc_macro_attribute` attribute input --> $DIR/invalid-attributes.rs:22:1 | LL | #[proc_macro_attribute()] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_attribute]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[proc_macro_attribute] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `proc_macro_attribute` attribute input --> $DIR/invalid-attributes.rs:25:1 | LL | #[proc_macro_attribute(x)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_attribute]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[proc_macro_attribute] + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/tests/ui/proc-macro/issue-37788.stderr b/tests/ui/proc-macro/issue-37788.stderr index 9ce783073fdca..c23ebd02dc56d 100644 --- a/tests/ui/proc-macro/issue-37788.stderr +++ b/tests/ui/proc-macro/issue-37788.stderr @@ -5,12 +5,14 @@ LL | fn main() { | - expected `()` because of default return type LL | // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE. LL | std::cell::Cell::new(0) - | ^^^^^^^^^^^^^^^^^^^^^^^- help: consider using a semicolon here: `;` - | | - | expected `()`, found `Cell<{integer}>` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Cell<{integer}>` | = note: expected unit type `()` found struct `Cell<{integer}>` +help: consider using a semicolon here + | +LL | std::cell::Cell::new(0); + | + error: aborting due to 1 previous error diff --git a/tests/ui/proc-macro/lints_in_proc_macros.stderr b/tests/ui/proc-macro/lints_in_proc_macros.stderr index 244d218608be7..09069a38e6e09 100644 --- a/tests/ui/proc-macro/lints_in_proc_macros.stderr +++ b/tests/ui/proc-macro/lints_in_proc_macros.stderr @@ -2,9 +2,13 @@ error[E0425]: cannot find value `foobar2` in this scope --> $DIR/lints_in_proc_macros.rs:9:5 | LL | bang_proc_macro2!(); - | ^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `foobar` + | ^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `bang_proc_macro2` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a local variable with a similar name exists + | +LL | foobar; + | ~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/proc-macro/mixed-site-span.stderr b/tests/ui/proc-macro/mixed-site-span.stderr index 1378608012464..427b8e50ac302 100644 --- a/tests/ui/proc-macro/mixed-site-span.stderr +++ b/tests/ui/proc-macro/mixed-site-span.stderr @@ -10,15 +10,24 @@ error[E0425]: cannot find value `local_use` in this scope --> $DIR/mixed-site-span.rs:13:9 | LL | proc_macro_rules!(); - | ^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `local_def` + | ^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a local variable with a similar name exists + | +LL | local_def; + | ~~~~~~~~~ error[E0425]: cannot find value `local_def` in this scope --> $DIR/mixed-site-span.rs:17:9 | LL | local_def; - | ^^^^^^^^^ help: a local variable with a similar name exists: `local_use` + | ^^^^^^^^^ + | +help: a local variable with a similar name exists + | +LL | local_use; + | ~~~~~~~~~ error[E0412]: cannot find type `ItemUse` in crate `$crate` --> $DIR/mixed-site-span.rs:24:1 diff --git a/tests/ui/proc-macro/no-macro-use-attr.stderr b/tests/ui/proc-macro/no-macro-use-attr.stderr index 3dda3cc7d5a5b..a088ba18b7551 100644 --- a/tests/ui/proc-macro/no-macro-use-attr.stderr +++ b/tests/ui/proc-macro/no-macro-use-attr.stderr @@ -2,13 +2,17 @@ warning: unused extern crate --> $DIR/no-macro-use-attr.rs:6:1 | LL | extern crate test_macros; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/no-macro-use-attr.rs:4:9 | LL | #![warn(unused_extern_crates)] | ^^^^^^^^^^^^^^^^^^^^ +help: remove it + | +LL - extern crate test_macros; + | error: fatal error triggered by #[rustc_error] --> $DIR/no-macro-use-attr.rs:10:1 diff --git a/tests/ui/proc-macro/parent-source-spans.stderr b/tests/ui/proc-macro/parent-source-spans.stderr index a3b27fd7bcc1b..bff7d7c94586c 100644 --- a/tests/ui/proc-macro/parent-source-spans.stderr +++ b/tests/ui/proc-macro/parent-source-spans.stderr @@ -140,7 +140,7 @@ error[E0425]: cannot find value `ok` in this scope --> $DIR/parent-source-spans.rs:29:5 | LL | parent_source_spans!($($tokens)*); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | one!("hello", "world"); | ---------------------- in this macro invocation @@ -149,12 +149,16 @@ LL | one!("hello", "world"); = note: similarly named tuple variant `Ok` defined here | = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a tuple variant with a similar name exists + | +LL | Ok; + | ~~ error[E0425]: cannot find value `ok` in this scope --> $DIR/parent-source-spans.rs:29:5 | LL | parent_source_spans!($($tokens)*); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | two!("yay", "rust"); | ------------------- in this macro invocation @@ -163,12 +167,16 @@ LL | two!("yay", "rust"); = note: similarly named tuple variant `Ok` defined here | = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a tuple variant with a similar name exists + | +LL | Ok; + | ~~ error[E0425]: cannot find value `ok` in this scope --> $DIR/parent-source-spans.rs:29:5 | LL | parent_source_spans!($($tokens)*); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | three!("hip", "hop"); | -------------------- in this macro invocation @@ -177,6 +185,10 @@ LL | three!("hip", "hop"); = note: similarly named tuple variant `Ok` defined here | = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `three` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a tuple variant with a similar name exists + | +LL | Ok; + | ~~ error: aborting due to 21 previous errors diff --git a/tests/ui/proc-macro/proc-macro-attributes.stderr b/tests/ui/proc-macro/proc-macro-attributes.stderr index 140d879069040..565fa278ab613 100644 --- a/tests/ui/proc-macro/proc-macro-attributes.stderr +++ b/tests/ui/proc-macro/proc-macro-attributes.stderr @@ -2,7 +2,12 @@ error: cannot find attribute `C` in this scope --> $DIR/proc-macro-attributes.rs:9:3 | LL | #[C] - | ^ help: a derive helper attribute with a similar name exists: `B` + | ^ + | +help: a derive helper attribute with a similar name exists + | +LL | #[B] + | ~ error[E0659]: `B` is ambiguous --> $DIR/proc-macro-attributes.rs:6:3 diff --git a/tests/ui/proc-macro/resolve-error.stderr b/tests/ui/proc-macro/resolve-error.stderr index e7639f474c75e..c198cb1cb38cb 100644 --- a/tests/ui/proc-macro/resolve-error.stderr +++ b/tests/ui/proc-macro/resolve-error.stderr @@ -2,12 +2,17 @@ error: cannot find macro `bang_proc_macrp` in this scope --> $DIR/resolve-error.rs:60:5 | LL | bang_proc_macrp!(); - | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `bang_proc_macro` + | ^^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/test-macros.rs:15:1 | LL | pub fn empty(_: TokenStream) -> TokenStream { | ------------------------------------------- similarly named macro `bang_proc_macro` defined here + | +help: a macro with a similar name exists + | +LL | bang_proc_macro!(); + | ~~~~~~~~~~~~~~~ error: cannot find macro `Dlona` in this scope --> $DIR/resolve-error.rs:57:5 @@ -22,7 +27,12 @@ LL | macro_rules! attr_proc_mac { | -------------------------- similarly named macro `attr_proc_mac` defined here ... LL | attr_proc_macra!(); - | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `attr_proc_mac` + | ^^^^^^^^^^^^^^^ + | +help: a macro with a similar name exists + | +LL | attr_proc_mac!(); + | ~~~~~~~~~~~~~ error: cannot find macro `FooWithLongNama` in this scope --> $DIR/resolve-error.rs:51:5 @@ -31,7 +41,12 @@ LL | macro_rules! FooWithLongNam { | --------------------------- similarly named macro `FooWithLongNam` defined here ... LL | FooWithLongNama!(); - | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `FooWithLongNam` + | ^^^^^^^^^^^^^^^ + | +help: a macro with a similar name exists + | +LL | FooWithLongNam!(); + | ~~~~~~~~~~~~~~ error: cannot find derive macro `attr_proc_macra` in this scope --> $DIR/resolve-error.rs:45:10 @@ -51,18 +66,23 @@ error: cannot find derive macro `Dlona` in this scope --> $DIR/resolve-error.rs:40:10 | LL | #[derive(Dlona)] - | ^^^^^ help: a derive macro with a similar name exists: `Clona` + | ^^^^^ | ::: $DIR/auxiliary/derive-clona.rs:11:1 | LL | pub fn derive_clonea(input: TokenStream) -> TokenStream { | ------------------------------------------------------- similarly named derive macro `Clona` defined here + | +help: a derive macro with a similar name exists + | +LL | #[derive(Clona)] + | ~~~~~ error: cannot find derive macro `Dlona` in this scope --> $DIR/resolve-error.rs:40:10 | LL | #[derive(Dlona)] - | ^^^^^ help: a derive macro with a similar name exists: `Clona` + | ^^^^^ | ::: $DIR/auxiliary/derive-clona.rs:11:1 | @@ -70,26 +90,39 @@ LL | pub fn derive_clonea(input: TokenStream) -> TokenStream { | ------------------------------------------------------- similarly named derive macro `Clona` defined here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: a derive macro with a similar name exists + | +LL | #[derive(Clona)] + | ~~~~~ error: cannot find derive macro `Dlone` in this scope --> $DIR/resolve-error.rs:35:10 | LL | #[derive(Dlone)] - | ^^^^^ help: a derive macro with a similar name exists: `Clone` + | ^^^^^ --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: similarly named derive macro `Clone` defined here + | +help: a derive macro with a similar name exists + | +LL | #[derive(Clone)] + | ~~~~~ error: cannot find derive macro `Dlone` in this scope --> $DIR/resolve-error.rs:35:10 | LL | #[derive(Dlone)] - | ^^^^^ help: a derive macro with a similar name exists: `Clone` + | ^^^^^ --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: similarly named derive macro `Clone` defined here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: a derive macro with a similar name exists + | +LL | #[derive(Clone)] + | ~~~~~ error: cannot find attribute `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:32:3 @@ -101,29 +134,39 @@ error: cannot find attribute `attr_proc_macra` in this scope --> $DIR/resolve-error.rs:28:3 | LL | #[attr_proc_macra] - | ^^^^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `attr_proc_macro` + | ^^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/test-macros.rs:20:1 | LL | pub fn empty_attr(_: TokenStream, _: TokenStream) -> TokenStream { | ---------------------------------------------------------------- similarly named attribute macro `attr_proc_macro` defined here + | +help: an attribute macro with a similar name exists + | +LL | #[attr_proc_macro] + | ~~~~~~~~~~~~~~~ error: cannot find derive macro `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:22:10 | LL | #[derive(FooWithLongNan)] - | ^^^^^^^^^^^^^^ help: a derive macro with a similar name exists: `FooWithLongName` + | ^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/derive-foo.rs:11:1 | LL | pub fn derive_foo(input: TokenStream) -> TokenStream { | ---------------------------------------------------- similarly named derive macro `FooWithLongName` defined here + | +help: a derive macro with a similar name exists + | +LL | #[derive(FooWithLongName)] + | ~~~~~~~~~~~~~~~ error: cannot find derive macro `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:22:10 | LL | #[derive(FooWithLongNan)] - | ^^^^^^^^^^^^^^ help: a derive macro with a similar name exists: `FooWithLongName` + | ^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/derive-foo.rs:11:1 | @@ -131,6 +174,10 @@ LL | pub fn derive_foo(input: TokenStream) -> TokenStream { | ---------------------------------------------------- similarly named derive macro `FooWithLongName` defined here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: a derive macro with a similar name exists + | +LL | #[derive(FooWithLongName)] + | ~~~~~~~~~~~~~~~ error: aborting due to 14 previous errors diff --git a/tests/ui/proc-macro/span-preservation.stderr b/tests/ui/proc-macro/span-preservation.stderr index 3ad9c539f8474..893a48260f963 100644 --- a/tests/ui/proc-macro/span-preservation.stderr +++ b/tests/ui/proc-macro/span-preservation.stderr @@ -37,34 +37,46 @@ LL | let y = Foo { a: 10, b: 10isize }; error[E0308]: mismatched types --> $DIR/span-preservation.rs:39:5 | -LL | extern "C" fn bar() { - | - help: try adding a return type: `-> i32` LL | 0 | ^ expected `()`, found integer + | +help: try adding a return type + | +LL | extern "C" fn bar() -> i32 { + | ++++++ error[E0308]: mismatched types --> $DIR/span-preservation.rs:44:5 | -LL | extern "C" fn baz() { - | - help: try adding a return type: `-> i32` LL | 0 | ^ expected `()`, found integer + | +help: try adding a return type + | +LL | extern "C" fn baz() -> i32 { + | ++++++ error[E0308]: mismatched types --> $DIR/span-preservation.rs:49:5 | -LL | extern "Rust" fn rust_abi() { - | - help: try adding a return type: `-> i32` LL | 0 | ^ expected `()`, found integer + | +help: try adding a return type + | +LL | extern "Rust" fn rust_abi() -> i32 { + | ++++++ error[E0308]: mismatched types --> $DIR/span-preservation.rs:54:5 | -LL | extern "\x43" fn c_abi_escaped() { - | - help: try adding a return type: `-> i32` LL | 0 | ^ expected `()`, found integer + | +help: try adding a return type + | +LL | extern "\x43" fn c_abi_escaped() -> i32 { + | ++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/pub/pub-ident-fn-or-struct.stderr b/tests/ui/pub/pub-ident-fn-or-struct.stderr index a8fa4bd3bd3b4..65590cb38a380 100644 --- a/tests/ui/pub/pub-ident-fn-or-struct.stderr +++ b/tests/ui/pub/pub-ident-fn-or-struct.stderr @@ -2,7 +2,12 @@ error: missing `fn` or `struct` for function or struct definition --> $DIR/pub-ident-fn-or-struct.rs:1:4 | LL | pub S (foo) bar - | ---^- help: if you meant to call a macro, try: `S!` + | ^ + | +help: if you meant to call a macro, try + | +LL | S! (foo) bar + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/pub/pub-restricted.stderr b/tests/ui/pub/pub-restricted.stderr index 4694530e54863..fc177aa2033e1 100644 --- a/tests/ui/pub/pub-restricted.stderr +++ b/tests/ui/pub/pub-restricted.stderr @@ -2,56 +2,76 @@ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:3:6 | LL | pub (a) fn afn() {} - | ^ help: make this visible only to module `a` with `in`: `in a` + | ^ | = help: some possible visibility restrictions are: `pub(crate)`: visible only on the current crate `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path +help: make this visible only to module `a` with `in` + | +LL | pub (in a) fn afn() {} + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:4:6 | LL | pub (b) fn bfn() {} - | ^ help: make this visible only to module `b` with `in`: `in b` + | ^ | = help: some possible visibility restrictions are: `pub(crate)`: visible only on the current crate `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path +help: make this visible only to module `b` with `in` + | +LL | pub (in b) fn bfn() {} + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 | LL | pub (crate::a) fn cfn() {} - | ^^^^^^^^ help: make this visible only to module `crate::a` with `in`: `in crate::a` + | ^^^^^^^^ | = help: some possible visibility restrictions are: `pub(crate)`: visible only on the current crate `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path +help: make this visible only to module `crate::a` with `in` + | +LL | pub (in crate::a) fn cfn() {} + | ~~~~~~~~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 | LL | pub (a) invalid: usize, - | ^ help: make this visible only to module `a` with `in`: `in a` + | ^ | = help: some possible visibility restrictions are: `pub(crate)`: visible only on the current crate `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path +help: make this visible only to module `a` with `in` + | +LL | pub (in a) invalid: usize, + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 | LL | pub (xyz) fn xyz() {} - | ^^^ help: make this visible only to module `xyz` with `in`: `in xyz` + | ^^^ | = help: some possible visibility restrictions are: `pub(crate)`: visible only on the current crate `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path +help: make this visible only to module `xyz` with `in` + | +LL | pub (in xyz) fn xyz() {} + | ~~~~~~ error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 diff --git a/tests/ui/query-system/issue-83479.stderr b/tests/ui/query-system/issue-83479.stderr index 7cb41f5cbe51c..d01aae3c6fd5c 100644 --- a/tests/ui/query-system/issue-83479.stderr +++ b/tests/ui/query-system/issue-83479.stderr @@ -15,17 +15,23 @@ error: free static item without body --> $DIR/issue-83479.rs:7:9 | LL | static FOO: usize; - | ^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the static: `= ;` + | ^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the static + | +LL | static FOO: usize = ; + | ~~~~~~~~~ error: free static item without body --> $DIR/issue-83479.rs:12:9 | LL | static FOO: usize; - | ^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the static: `= ;` + | ^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the static + | +LL | static FOO: usize = ; + | ~~~~~~~~~ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/issue-83479.rs:3:24 diff --git a/tests/ui/range/exclusive-range-patterns-2021.stderr b/tests/ui/range/exclusive-range-patterns-2021.stderr index a967437041a54..68b14c658016b 100644 --- a/tests/ui/range/exclusive-range-patterns-2021.stderr +++ b/tests/ui/range/exclusive-range-patterns-2021.stderr @@ -2,25 +2,34 @@ error[E0783]: `...` range patterns are deprecated --> $DIR/exclusive-range-patterns-2021.rs:6:9 | LL | 0...3 => {} - | ^---^ - | | - | help: use `..=` for an inclusive range + | ^^^^^ + | +help: use `..=` for an inclusive range + | +LL | 0..=3 => {} + | ~~~ error[E0783]: `...` range patterns are deprecated --> $DIR/exclusive-range-patterns-2021.rs:8:9 | LL | 4...10 => {} - | ^---^^ - | | - | help: use `..=` for an inclusive range + | ^^^^^^ + | +help: use `..=` for an inclusive range + | +LL | 4..=10 => {} + | ~~~ error[E0783]: `...` range patterns are deprecated --> $DIR/exclusive-range-patterns-2021.rs:10:10 | LL | (11...100) => {} - | ^^---^^^ - | | - | help: use `..=` for an inclusive range + | ^^^^^^^^ + | +help: use `..=` for an inclusive range + | +LL | (11..=100) => {} + | ~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/range/impossible_range.stderr b/tests/ui/range/impossible_range.stderr index 53c56065c2a3a..2e05c2ebd3a0e 100644 --- a/tests/ui/range/impossible_range.stderr +++ b/tests/ui/range/impossible_range.stderr @@ -2,17 +2,25 @@ error[E0586]: inclusive range with no end --> $DIR/impossible_range.rs:11:5 | LL | ..=; - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | ..; + | ~~ error[E0586]: inclusive range with no end --> $DIR/impossible_range.rs:18:6 | LL | 0..=; - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | 0..; + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/range/range-inclusive-pattern-precedence.stderr b/tests/ui/range/range-inclusive-pattern-precedence.stderr index 2e2d7983c03a8..bd7fae9ea36a6 100644 --- a/tests/ui/range/range-inclusive-pattern-precedence.stderr +++ b/tests/ui/range/range-inclusive-pattern-precedence.stderr @@ -2,13 +2,18 @@ error: the range pattern here has ambiguous interpretation --> $DIR/range-inclusive-pattern-precedence.rs:15:10 | LL | &10..=15 => {} - | ^^^^^^^ help: add parentheses to clarify the precedence: `(10..=15)` + | ^^^^^^^ + | +help: add parentheses to clarify the precedence + | +LL | &(10..=15) => {} + | ~~~~~~~~~ warning: `...` range patterns are deprecated --> $DIR/range-inclusive-pattern-precedence.rs:11:9 | LL | &0...9 => {} - | ^^^^^^ help: use `..=` for an inclusive range: `&(0..=9)` + | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see @@ -17,6 +22,10 @@ note: the lint level is defined here | LL | #![warn(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `..=` for an inclusive range + | +LL | &(0..=9) => {} + | ~~~~~~~~ error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/range/range-inclusive-pattern-precedence2.stderr b/tests/ui/range/range-inclusive-pattern-precedence2.stderr index 84294604c80f1..6649fb88c3f11 100644 --- a/tests/ui/range/range-inclusive-pattern-precedence2.stderr +++ b/tests/ui/range/range-inclusive-pattern-precedence2.stderr @@ -2,13 +2,18 @@ error: the range pattern here has ambiguous interpretation --> $DIR/range-inclusive-pattern-precedence2.rs:14:13 | LL | box 10..=15 => {} - | ^^^^^^^ help: add parentheses to clarify the precedence: `(10..=15)` + | ^^^^^^^ + | +help: add parentheses to clarify the precedence + | +LL | box (10..=15) => {} + | ~~~~~~~~~ warning: `...` range patterns are deprecated --> $DIR/range-inclusive-pattern-precedence2.rs:10:14 | LL | box 0...9 => {} - | ^^^ help: use `..=` for an inclusive range + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see @@ -17,6 +22,10 @@ note: the lint level is defined here | LL | #![warn(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `..=` for an inclusive range + | +LL | box 0..=9 => {} + | ~~~ error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/recursion_limit/invalid_digit_type.stderr b/tests/ui/recursion_limit/invalid_digit_type.stderr index 94442b5747fc3..b945d425422e8 100644 --- a/tests/ui/recursion_limit/invalid_digit_type.stderr +++ b/tests/ui/recursion_limit/invalid_digit_type.stderr @@ -2,7 +2,12 @@ error: malformed `recursion_limit` attribute input --> $DIR/invalid_digit_type.rs:1:1 | LL | #![recursion_limit = 123] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #![recursion_limit = "N"] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/recursion_limit/invalid_macro.stderr b/tests/ui/recursion_limit/invalid_macro.stderr index aa4894ec4d8eb..f41236e920018 100644 --- a/tests/ui/recursion_limit/invalid_macro.stderr +++ b/tests/ui/recursion_limit/invalid_macro.stderr @@ -2,7 +2,12 @@ error: malformed `recursion_limit` attribute input --> $DIR/invalid_macro.rs:1:1 | LL | #![recursion_limit = foo!()] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #![recursion_limit = "N"] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/recursion_limit/no-value.stderr b/tests/ui/recursion_limit/no-value.stderr index b2e8c46c372a1..dbd1874a43ff9 100644 --- a/tests/ui/recursion_limit/no-value.stderr +++ b/tests/ui/recursion_limit/no-value.stderr @@ -2,7 +2,12 @@ error: malformed `recursion_limit` attribute input --> $DIR/no-value.rs:3:1 | LL | #![recursion_limit] - | ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]` + | ^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #![recursion_limit = "N"] + | error: aborting due to 1 previous error diff --git a/tests/ui/regions/outlives-with-missing.stderr b/tests/ui/regions/outlives-with-missing.stderr index 0e3aaaf5fdbd0..40904db9457e1 100644 --- a/tests/ui/regions/outlives-with-missing.stderr +++ b/tests/ui/regions/outlives-with-missing.stderr @@ -5,7 +5,12 @@ LL | impl HandlerWrapper { | - similarly named type parameter `H` defined here ... LL | T: Send + Sync + 'static, - | ^ help: a type parameter with a similar name exists: `H` + | ^ + | +help: a type parameter with a similar name exists + | +LL | H: Send + Sync + 'static, + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/regions/regions-glb-free-free.stderr b/tests/ui/regions/regions-glb-free-free.stderr index 727669f26835e..b1cec44528171 100644 --- a/tests/ui/regions/regions-glb-free-free.stderr +++ b/tests/ui/regions/regions-glb-free-free.stderr @@ -1,8 +1,6 @@ error[E0621]: explicit lifetime required in the type of `s` --> $DIR/regions-glb-free-free.rs:15:13 | -LL | pub fn set_desc(self, s: &str) -> Flag<'a> { - | ---- help: add explicit lifetime `'a` to the type of `s`: `&'a str` LL | / Flag { LL | | name: self.name, LL | | desc: s, @@ -10,6 +8,11 @@ LL | | max_count: self.max_count, LL | | value: self.value LL | | } | |_____________^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `s` + | +LL | pub fn set_desc(self, s: &'a str) -> Flag<'a> { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/regions/regions-in-enums.stderr b/tests/ui/regions/regions-in-enums.stderr index 66537653291c7..449763e8b5914 100644 --- a/tests/ui/regions/regions-in-enums.stderr +++ b/tests/ui/regions/regions-in-enums.stderr @@ -1,18 +1,24 @@ error[E0261]: use of undeclared lifetime name `'foo` --> $DIR/regions-in-enums.rs:13:9 | -LL | enum No0 { - | - help: consider introducing lifetime `'foo` here: `<'foo>` LL | X5(&'foo usize) | ^^^^ undeclared lifetime + | +help: consider introducing lifetime `'foo` here + | +LL | enum No0<'foo> { + | ++++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-enums.rs:17:9 | -LL | enum No1 { - | - help: consider introducing lifetime `'a` here: `<'a>` LL | X6(&'a usize) | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | enum No1<'a> { + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/regions/regions-in-structs.stderr b/tests/ui/regions/regions-in-structs.stderr index 5dfdc2ee93b43..c34b1ffca64f0 100644 --- a/tests/ui/regions/regions-in-structs.stderr +++ b/tests/ui/regions/regions-in-structs.stderr @@ -1,19 +1,24 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-structs.rs:10:9 | -LL | struct StructDecl { - | - help: consider introducing lifetime `'a` here: `<'a>` LL | a: &'a isize, | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | struct StructDecl<'a> { + | ++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-structs.rs:11:9 | -LL | struct StructDecl { - | - help: consider introducing lifetime `'a` here: `<'a>` -LL | a: &'a isize, LL | b: &'a isize, | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | struct StructDecl<'a> { + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/regions/regions-infer-at-fn-not-param.stderr b/tests/ui/regions/regions-infer-at-fn-not-param.stderr index 4c7660276f2dd..6b0e38209f098 100644 --- a/tests/ui/regions/regions-infer-at-fn-not-param.stderr +++ b/tests/ui/regions/regions-infer-at-fn-not-param.stderr @@ -2,9 +2,12 @@ error[E0621]: explicit lifetime required in the type of `p` --> $DIR/regions-infer-at-fn-not-param.rs:13:57 | LL | fn take1<'a>(p: Parameterized1) -> Parameterized1<'a> { p } - | -------------- ^ lifetime `'a` required - | | - | help: add explicit lifetime `'a` to the type of `p`: `Parameterized1<'a>` + | ^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `p` + | +LL | fn take1<'a>(p: Parameterized1<'a>) -> Parameterized1<'a> { p } + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/regions/regions-name-undeclared.stderr b/tests/ui/regions/regions-name-undeclared.stderr index 532603de5f783..06e6f4299deaf 100644 --- a/tests/ui/regions/regions-name-undeclared.stderr +++ b/tests/ui/regions/regions-name-undeclared.stderr @@ -50,9 +50,12 @@ LL | fn bar<'a>(x: &'a isize) { | -- lifetime parameter from outer item ... LL | type X = Option<&'a isize>; - | - ^^ use of generic parameter from outer item - | | - | help: consider introducing lifetime `'a` here: `<'a>` + | ^^ use of generic parameter from outer item + | +help: consider introducing lifetime `'a` here + | +LL | type X<'a> = Option<&'a isize>; + | ++++ error[E0401]: can't use generic parameters from outer item --> $DIR/regions-name-undeclared.rs:28:13 @@ -60,10 +63,13 @@ error[E0401]: can't use generic parameters from outer item LL | fn bar<'a>(x: &'a isize) { | -- lifetime parameter from outer item ... -LL | enum E { - | - help: consider introducing lifetime `'a` here: `<'a>` LL | E1(&'a isize) | ^^ use of generic parameter from outer item + | +help: consider introducing lifetime `'a` here + | +LL | enum E<'a> { + | ++++ error[E0401]: can't use generic parameters from outer item --> $DIR/regions-name-undeclared.rs:31:13 @@ -71,10 +77,13 @@ error[E0401]: can't use generic parameters from outer item LL | fn bar<'a>(x: &'a isize) { | -- lifetime parameter from outer item ... -LL | struct S { - | - help: consider introducing lifetime `'a` here: `<'a>` LL | f: &'a isize | ^^ use of generic parameter from outer item + | +help: consider introducing lifetime `'a` here + | +LL | struct S<'a> { + | ++++ error[E0401]: can't use generic parameters from outer item --> $DIR/regions-name-undeclared.rs:33:14 @@ -83,17 +92,23 @@ LL | fn bar<'a>(x: &'a isize) { | -- lifetime parameter from outer item ... LL | fn f(a: &'a isize) { } - | - ^^ use of generic parameter from outer item - | | - | help: consider introducing lifetime `'a` here: `<'a>` + | ^^ use of generic parameter from outer item + | +help: consider introducing lifetime `'a` here + | +LL | fn f<'a>(a: &'a isize) { } + | ++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:41:17 | LL | fn fn_types(a: &'a isize, - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn fn_types<'a>(a: &'a isize, + | ++++ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:43:36 @@ -129,11 +144,13 @@ LL | fn fn_types<'b>(a: &'a isize, error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:47:17 | -LL | fn fn_types(a: &'a isize, - | - help: consider introducing lifetime `'a` here: `<'a>` -... LL | c: &'a isize) | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn fn_types<'a>(a: &'a isize, + | ++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:53:31 diff --git a/tests/ui/regions/regions-static-bound.stderr b/tests/ui/regions/regions-static-bound.stderr index 48aa8f323291d..21428fb048d9d 100644 --- a/tests/ui/regions/regions-static-bound.stderr +++ b/tests/ui/regions/regions-static-bound.stderr @@ -2,15 +2,18 @@ warning: lifetime parameter `'b` never used --> $DIR/regions-static-bound.rs:3:17 | LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } - | -^^ - | | - | help: elide the unused lifetime + | ^^ | note: the lint level is defined here --> $DIR/regions-static-bound.rs:1:9 | LL | #![warn(unused_lifetimes, redundant_lifetimes)] | ^^^^^^^^^^^^^^^^ +help: elide the unused lifetime + | +LL - fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } +LL + fn static_id<'a>(t: &'a ()) -> &'static () where 'a: 'static { t } + | warning: unnecessary lifetime parameter `'a` --> $DIR/regions-static-bound.rs:3:14 diff --git a/tests/ui/regions/regions-undeclared.stderr b/tests/ui/regions/regions-undeclared.stderr index 6bfde5524ac49..2bc0f1848032e 100644 --- a/tests/ui/regions/regions-undeclared.stderr +++ b/tests/ui/regions/regions-undeclared.stderr @@ -7,35 +7,46 @@ LL | static c_x: &'blk isize = &22; error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:4:10 | -LL | enum EnumDecl { - | - help: consider introducing lifetime `'a` here: `<'a>` LL | Foo(&'a isize), | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | enum EnumDecl<'a> { + | ++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:5:10 | -LL | enum EnumDecl { - | - help: consider introducing lifetime `'a` here: `<'a>` -LL | Foo(&'a isize), LL | Bar(&'a isize), | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | enum EnumDecl<'a> { + | ++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:8:15 | LL | fn fnDecl(x: &'a isize, - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn fnDecl<'a>(x: &'a isize, + | ++++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:9:15 | -LL | fn fnDecl(x: &'a isize, - | - help: consider introducing lifetime `'a` here: `<'a>` LL | y: &'a isize) | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn fnDecl<'a>(x: &'a isize, + | ++++ error: aborting due to 5 previous errors diff --git a/tests/ui/removing-extern-crate.stderr b/tests/ui/removing-extern-crate.stderr index 4dddf160ce27b..d0babc05513f3 100644 --- a/tests/ui/removing-extern-crate.stderr +++ b/tests/ui/removing-extern-crate.stderr @@ -2,7 +2,7 @@ warning: unused extern crate --> $DIR/removing-extern-crate.rs:8:1 | LL | extern crate removing_extern_crate as foo; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/removing-extern-crate.rs:6:9 @@ -10,24 +10,47 @@ note: the lint level is defined here LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` +help: remove it + | +LL - extern crate removing_extern_crate as foo; +LL + + | warning: unused extern crate --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate core; - | ^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^ + | +help: remove it + | +LL - extern crate core; +LL + + | warning: unused extern crate --> $DIR/removing-extern-crate.rs:12:5 | LL | extern crate removing_extern_crate as foo; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove it + | +LL - extern crate removing_extern_crate as foo; +LL + + | warning: unused extern crate --> $DIR/removing-extern-crate.rs:13:5 | LL | extern crate core; - | ^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^ + | +help: remove it + | +LL - extern crate core; +LL + + | warning: 4 warnings emitted diff --git a/tests/ui/repeat-expr/repeat_count.stderr b/tests/ui/repeat-expr/repeat_count.stderr index 8a1ed8f3b9c7c..ab2d2045df0ab 100644 --- a/tests/ui/repeat-expr/repeat_count.stderr +++ b/tests/ui/repeat-expr/repeat_count.stderr @@ -1,10 +1,13 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/repeat_count.rs:5:17 | -LL | let n = 1; - | ----- help: consider using `const` instead of `let`: `const n` LL | let a = [0; n]; | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const n = 1; + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/repeat_count.rs:7:17 diff --git a/tests/ui/repr/issue-83505-repr-simd.stderr b/tests/ui/repr/issue-83505-repr-simd.stderr index df99baaf52293..e731fa266d583 100644 --- a/tests/ui/repr/issue-83505-repr-simd.stderr +++ b/tests/ui/repr/issue-83505-repr-simd.stderr @@ -2,9 +2,12 @@ error: free static item without body --> $DIR/issue-83505-repr-simd.rs:9:1 | LL | static CLs: Es; - | ^^^^^^^^^^^^^^- - | | - | help: provide a definition for the static: `= ;` + | ^^^^^^^^^^^^^^^ + | +help: provide a definition for the static + | +LL | static CLs: Es = ; + | ~~~~~~~~~ error[E0517]: attribute should be applied to a struct --> $DIR/issue-83505-repr-simd.rs:5:8 diff --git a/tests/ui/repr/malformed-repr-hints.stderr b/tests/ui/repr/malformed-repr-hints.stderr index 6fb927557619f..148be15a2acbe 100644 --- a/tests/ui/repr/malformed-repr-hints.stderr +++ b/tests/ui/repr/malformed-repr-hints.stderr @@ -8,7 +8,12 @@ error[E0589]: invalid `repr(align)` attribute: `align` needs an argument --> $DIR/malformed-repr-hints.rs:10:8 | LL | #[repr(align)] - | ^^^^^ help: supply an argument here: `align(...)` + | ^^^^^ + | +help: supply an argument here + | +LL | #[repr(align(...))] + | ~~~~~~~~~~ error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses --> $DIR/malformed-repr-hints.rs:14:8 diff --git a/tests/ui/repr/repr-align-assign.stderr b/tests/ui/repr/repr-align-assign.stderr index 3606d02210ba0..b7291b81f6582 100644 --- a/tests/ui/repr/repr-align-assign.stderr +++ b/tests/ui/repr/repr-align-assign.stderr @@ -2,29 +2,47 @@ error[E0693]: incorrect `repr(align)` attribute format --> $DIR/repr-align-assign.rs:5:8 | LL | #[repr(align=8)] - | ^^^^^^^ help: use parentheses instead: `align(8)` + | ^^^^^^^ + | +help: use parentheses instead + | +LL | #[repr(align(8))] + | ~~~~~~~~ error[E0693]: incorrect `repr(align)` attribute format --> $DIR/repr-align-assign.rs:9:8 | LL | #[repr(align="8")] - | ^^^^^^^^^ help: use parentheses instead: `align(8)` + | ^^^^^^^^^ + | +help: use parentheses instead + | +LL | #[repr(align(8))] + | ~~~~~~~~ error[E0693]: incorrect `repr(align)` attribute format --> $DIR/repr-align-assign.rs:5:8 | LL | #[repr(align=8)] - | ^^^^^^^ help: use parentheses instead: `align(8)` + | ^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use parentheses instead + | +LL | #[repr(align(8))] + | ~~~~~~~~ error[E0693]: incorrect `repr(align)` attribute format --> $DIR/repr-align-assign.rs:9:8 | LL | #[repr(align="8")] - | ^^^^^^^^^ help: use parentheses instead: `align(8)` + | ^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use parentheses instead + | +LL | #[repr(align(8))] + | ~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/repr/repr.stderr b/tests/ui/repr/repr.stderr index e0bec666381cf..dfd875a645f11 100644 --- a/tests/ui/repr/repr.stderr +++ b/tests/ui/repr/repr.stderr @@ -2,19 +2,34 @@ error: malformed `repr` attribute input --> $DIR/repr.rs:1:1 | LL | #[repr] - | ^^^^^^^ help: must be of the form: `#[repr(C)]` + | ^^^^^^^ + | +help: must be of the form + | +LL | #[repr(C)] + | ~~~~~~~~~~ error: malformed `repr` attribute input --> $DIR/repr.rs:4:1 | LL | #[repr = "B"] - | ^^^^^^^^^^^^^ help: must be of the form: `#[repr(C)]` + | ^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[repr(C)] + | ~~~~~~~~~~ error: malformed `repr` attribute input --> $DIR/repr.rs:7:1 | LL | #[repr = "C"] - | ^^^^^^^^^^^^^ help: must be of the form: `#[repr(C)]` + | ^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[repr(C)] + | ~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/resolve/112590-2.stderr b/tests/ui/resolve/112590-2.stderr index 0db20249d27f5..bd2a02dd7cf6f 100644 --- a/tests/ui/resolve/112590-2.stderr +++ b/tests/ui/resolve/112590-2.stderr @@ -61,10 +61,12 @@ error[E0433]: failed to resolve: use of undeclared crate or module `vec` --> $DIR/112590-2.rs:23:24 | LL | let _t: Vec = vec::new(); - | ^^^ - | | - | use of undeclared crate or module `vec` - | help: a struct with a similar name exists (notice the capitalization): `Vec` + | ^^^ use of undeclared crate or module `vec` + | +help: a struct with a similar name exists (notice the capitalization difference) + | +LL | let _t: Vec = Vec::new(); + | ~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/bad-type-env-capture.stderr b/tests/ui/resolve/bad-type-env-capture.stderr index 3f9bc9149c24a..272672beb4fbb 100644 --- a/tests/ui/resolve/bad-type-env-capture.stderr +++ b/tests/ui/resolve/bad-type-env-capture.stderr @@ -4,9 +4,12 @@ error[E0401]: can't use generic parameters from outer item LL | fn foo() { | - type parameter from outer item LL | fn bar(b: T) { } - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | fn bar(b: T) { } + | +++ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/explicit-self-lowercase-param.stderr b/tests/ui/resolve/explicit-self-lowercase-param.stderr index 6daa6f5d7af58..6a7173f274914 100644 --- a/tests/ui/resolve/explicit-self-lowercase-param.stderr +++ b/tests/ui/resolve/explicit-self-lowercase-param.stderr @@ -2,7 +2,12 @@ error: attempt to use a non-constant value in a constant --> $DIR/explicit-self-lowercase-param.rs:4:29 | LL | fn do_nothing(self: Box) {} - | ^^^^ help: try using `Self` + | ^^^^ + | +help: try using `Self` (notice the capitalization difference) + | +LL | fn do_nothing(self: Box) {} + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr index 60aa94038c3ad..3852b84fee2e0 100644 --- a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr +++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr @@ -4,11 +4,13 @@ error[E0401]: can't use generic parameters from outer item LL | fn outer() { // outer function | - type parameter from outer item LL | const K: u32 = T::C; - | - ^^^^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^^^^ use of generic parameter from outer item | = note: a `const` is a separate item from the item that contains it +help: try introducing a local generic parameter here + | +LL | const K: u32 = T::C; + | +++ error[E0401]: can't use generic parameters from outer item --> $DIR/generic-params-from-outer-item-in-const-item.rs:19:24 @@ -17,11 +19,13 @@ LL | impl Tr for T { // outer impl block | - type parameter from outer item LL | const C: u32 = { LL | const I: u32 = T::C; - | - ^^^^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^^^^ use of generic parameter from outer item | = note: a `const` is a separate item from the item that contains it +help: try introducing a local generic parameter here + | +LL | const I: u32 = T::C; + | +++ error[E0401]: can't use generic parameters from outer item --> $DIR/generic-params-from-outer-item-in-const-item.rs:27:20 @@ -29,11 +33,13 @@ error[E0401]: can't use generic parameters from outer item LL | struct S(U32<{ // outer struct | - type parameter from outer item LL | const _: u32 = T::C; - | - ^^^^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^^^^ use of generic parameter from outer item | = note: a `const` is a separate item from the item that contains it +help: try introducing a local generic parameter here + | +LL | const _: u32 = T::C; + | +++ error: aborting due to 3 previous errors diff --git a/tests/ui/resolve/issue-100365.stderr b/tests/ui/resolve/issue-100365.stderr index 372d772666804..2d9bab4304d46 100644 --- a/tests/ui/resolve/issue-100365.stderr +++ b/tests/ui/resolve/issue-100365.stderr @@ -2,19 +2,34 @@ error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:2:16 | LL | let addr = Into::.into([127, 0, 0, 1]); - | ^^^^^^^^^^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let addr = Into::::into([127, 0, 0, 1]); + | ~~ error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:6:13 | LL | let _ = Into.into(()); - | ^^^^- help: use the path separator to refer to an item: `::` + | ^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = Into::into(()); + | ~~ error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:10:13 | LL | let _ = Into::<()>.into; - | ^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = Into::<()>::into; + | ~~ error[E0423]: expected value, found trait `std::iter::Iterator` --> $DIR/issue-100365.rs:17:9 @@ -42,12 +57,16 @@ error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:25:9 | LL | Into::.into("") - | ^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^^^^^ ... LL | let _ = create!(); | --------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | Into::::into("") + | ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/resolve/issue-10200.stderr b/tests/ui/resolve/issue-10200.stderr index 7b218694b269e..29c40e32aff62 100644 --- a/tests/ui/resolve/issue-10200.stderr +++ b/tests/ui/resolve/issue-10200.stderr @@ -5,7 +5,12 @@ LL | struct Foo(bool); | ----------------- similarly named tuple struct `Foo` defined here ... LL | foo(x) - | ^^^ help: a tuple struct with a similar name exists (notice the capitalization): `Foo` + | ^^^ + | +help: a tuple struct with a similar name exists (notice the capitalization difference) + | +LL | Foo(x) + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-22692.stderr b/tests/ui/resolve/issue-22692.stderr index 6962aa161e92a..be0634ebffc96 100644 --- a/tests/ui/resolve/issue-22692.stderr +++ b/tests/ui/resolve/issue-22692.stderr @@ -2,19 +2,34 @@ error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:2:13 | LL | let _ = String.new(); - | ^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = String::new(); + | ~~ error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:6:13 | LL | let _ = String.default; - | ^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = String::default; + | ~~ error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:10:13 | LL | let _ = Vec::<()>.with_capacity(1); - | ^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = Vec::<()>::with_capacity(1); + | ~~ error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 @@ -50,23 +65,31 @@ error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:26:9 | LL | Vec.new() - | ^^^- help: use the path separator to refer to an item: `::` + | ^^^ ... LL | let _ = create!(type method); | -------------------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | Vec::new() + | ~~ error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:31:9 | LL | Vec.new - | ^^^- help: use the path separator to refer to an item: `::` + | ^^^ ... LL | let _ = create!(type field); | ------------------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | Vec::new + | ~~ error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 diff --git a/tests/ui/resolve/issue-3021-c.stderr b/tests/ui/resolve/issue-3021-c.stderr index 537bbaf7b6a56..dcbaf2afd10c6 100644 --- a/tests/ui/resolve/issue-3021-c.stderr +++ b/tests/ui/resolve/issue-3021-c.stderr @@ -3,22 +3,28 @@ error[E0401]: can't use generic parameters from outer item | LL | fn siphash() { | - type parameter from outer item -LL | -LL | trait U { - | - help: try introducing a local generic parameter here: `` +... LL | fn g(&self, x: T) -> T; | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | trait U { + | +++ error[E0401]: can't use generic parameters from outer item --> $DIR/issue-3021-c.rs:4:30 | LL | fn siphash() { | - type parameter from outer item -LL | -LL | trait U { - | - help: try introducing a local generic parameter here: `` +... LL | fn g(&self, x: T) -> T; | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | trait U { + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-30535.stderr b/tests/ui/resolve/issue-30535.stderr index 0fa96a87482cc..1181a5a8ce3e0 100644 --- a/tests/ui/resolve/issue-30535.stderr +++ b/tests/ui/resolve/issue-30535.stderr @@ -2,10 +2,12 @@ error[E0573]: expected type, found variant `foo::Foo::FooV` --> $DIR/issue-30535.rs:6:8 | LL | _: foo::Foo::FooV - | ^^^^^^^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `foo::Foo` + | ^^^^^^^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | _: foo::Foo + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-3214.stderr b/tests/ui/resolve/issue-3214.stderr index 5b57c1baf90ba..0e5360d8a30dc 100644 --- a/tests/ui/resolve/issue-3214.stderr +++ b/tests/ui/resolve/issue-3214.stderr @@ -4,23 +4,30 @@ error[E0401]: can't use generic parameters from outer item LL | fn foo() { | - type parameter from outer item LL | struct Foo { - | - help: try introducing a local generic parameter here: `` LL | x: T, | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | struct Foo { + | +++ error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-3214.rs:6:22 | LL | impl Drop for Foo { - | ^^^--- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/issue-3214.rs:2:12 | LL | struct Foo { | ^^^ +help: remove these generics + | +LL - impl Drop for Foo { +LL + impl Drop for Foo { + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-35675.stderr b/tests/ui/resolve/issue-35675.stderr index 44af65b0768a8..5d5a60df148ab 100644 --- a/tests/ui/resolve/issue-35675.stderr +++ b/tests/ui/resolve/issue-35675.stderr @@ -24,10 +24,12 @@ error[E0573]: expected type, found variant `Fruit::Apple` --> $DIR/issue-35675.rs:13:33 | LL | fn should_return_fruit_too() -> Fruit::Apple { - | ^^^^^^^^^^^^ - | | - | not a type - | help: try using the variant's enum: `Fruit` + | ^^^^^^^^^^^^ not a type + | +help: try using the variant's enum + | +LL | fn should_return_fruit_too() -> Fruit { + | ~~~~~ error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in this scope --> $DIR/issue-35675.rs:15:5 @@ -44,10 +46,12 @@ error[E0573]: expected type, found variant `Ok` --> $DIR/issue-35675.rs:19:13 | LL | fn foo() -> Ok { - | ^^ - | | - | not a type - | help: try using the variant's enum: `std::result::Result` + | ^^ not a type + | +help: try using the variant's enum + | +LL | fn foo() -> std::result::Result { + | ~~~~~~~~~~~~~~~~~~~ error[E0412]: cannot find type `Variant3` in this scope --> $DIR/issue-35675.rs:24:13 @@ -64,10 +68,12 @@ error[E0573]: expected type, found variant `Some` --> $DIR/issue-35675.rs:28:13 | LL | fn qux() -> Some { - | ^^^^ - | | - | not a type - | help: try using the variant's enum: `std::option::Option` + | ^^^^ not a type + | +help: try using the variant's enum + | +LL | fn qux() -> std::option::Option { + | ~~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/issue-49074.stderr b/tests/ui/resolve/issue-49074.stderr index bbfeb4ea9483a..281bb95756c2d 100644 --- a/tests/ui/resolve/issue-49074.stderr +++ b/tests/ui/resolve/issue-49074.stderr @@ -10,7 +10,12 @@ error: cannot find attribute `marco_use` in this scope --> $DIR/issue-49074.rs:3:3 | LL | #[marco_use] // typo - | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_use` + | ^^^^^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL | #[macro_use] // typo + | ~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-6702.stderr b/tests/ui/resolve/issue-6702.stderr index d1ceee3e56e82..cb0a690b36203 100644 --- a/tests/ui/resolve/issue-6702.stderr +++ b/tests/ui/resolve/issue-6702.stderr @@ -7,7 +7,12 @@ LL | | } | |_- `Monster` defined here ... LL | let _m = Monster(); - | ^^^^^^^^^ help: use struct literal syntax instead: `Monster { damage: val }` + | ^^^^^^^^^ + | +help: use struct literal syntax instead + | +LL | let _m = Monster { damage: val }; + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr index da9eeea954a1a..d54ac98b2131b 100644 --- a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr +++ b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr @@ -2,25 +2,34 @@ error: free function without a body --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:3:1 | LL | async fn free(); - | ^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^^^^^^^^^^ + | +help: provide a definition for the function + | +LL | async fn free() { } + | ~~~~~~~~~~ error: associated function in `impl` without body --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:7:5 | LL | async fn inherent(); - | ^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the function + | +LL | async fn inherent() { } + | ~~~~~~~~~~ error: associated function in `impl` without body --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:14:5 | LL | async fn associated(); - | ^^^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the function + | +LL | async fn associated() { } + | ~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 0a9a504f79caa..d3b6899f90e72 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -30,7 +30,7 @@ error[E0423]: expected value, found enum `B` --> $DIR/issue-73427.rs:35:5 | LL | B.foo(); - | ^ help: the following enum variant is available: `(B::TupleWithFields(/* fields */))` + | ^ | note: the enum is defined here --> $DIR/issue-73427.rs:9:1 @@ -40,6 +40,10 @@ LL | | StructWithFields { x: () }, LL | | TupleWithFields(()), LL | | } | |_^ +help: the following enum variant is available + | +LL | (B::TupleWithFields(/* fields */)).foo(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: expected value, found enum `C` --> $DIR/issue-73427.rs:37:5 diff --git a/tests/ui/resolve/issue-81508.stderr b/tests/ui/resolve/issue-81508.stderr index 7258174ba89b3..c31baa1ac214b 100644 --- a/tests/ui/resolve/issue-81508.stderr +++ b/tests/ui/resolve/issue-81508.stderr @@ -1,20 +1,26 @@ error[E0433]: failed to resolve: use of undeclared type `Baz` --> $DIR/issue-81508.rs:11:20 | -LL | let Baz: &str = ""; - | --- help: `Baz` is defined here, but is not a type -LL | LL | println!("{}", Baz::Bar); | ^^^ use of undeclared type `Baz` + | +help: `Baz` is defined here, but is not a type + | +LL - let Baz: &str = ""; +LL + let : &str = ""; + | error[E0433]: failed to resolve: use of undeclared type `Foo` --> $DIR/issue-81508.rs:20:24 | -LL | use super::Foo; - | ---------- help: `Foo` is defined here, but is not a type -LL | fn function() { LL | println!("{}", Foo::Bar); | ^^^ use of undeclared type `Foo` + | +help: `Foo` is defined here, but is not a type + | +LL - use super::Foo; +LL + use ; + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/levenshtein.stderr b/tests/ui/resolve/levenshtein.stderr index cf478210132ed..9c89813b50c62 100644 --- a/tests/ui/resolve/levenshtein.stderr +++ b/tests/ui/resolve/levenshtein.stderr @@ -2,7 +2,12 @@ error[E0412]: cannot find type `esize` in this scope --> $DIR/levenshtein.rs:5:11 | LL | fn foo(c: esize) {} // Misspelled primitive type name. - | ^^^^^ help: a builtin type with a similar name exists: `isize` + | ^^^^^ + | +help: a builtin type with a similar name exists + | +LL | fn foo(c: isize) {} // Misspelled primitive type name. + | ~~~~~ error[E0412]: cannot find type `Baz` in this scope --> $DIR/levenshtein.rs:10:10 @@ -11,16 +16,26 @@ LL | enum Bar { } | -------- similarly named enum `Bar` defined here LL | LL | type A = Baz; // Misspelled type name. - | ^^^ help: an enum with a similar name exists: `Bar` + | ^^^ + | +help: an enum with a similar name exists + | +LL | type A = Bar; // Misspelled type name. + | ~~~ error[E0412]: cannot find type `Opiton` in this scope --> $DIR/levenshtein.rs:12:10 | LL | type B = Opiton; // Misspelled type name from the prelude. - | ^^^^^^ help: an enum with a similar name exists: `Option` + | ^^^^^^ --> $SRC_DIR/core/src/option.rs:LL:COL | = note: similarly named enum `Option` defined here + | +help: an enum with a similar name exists + | +LL | type B = Option; // Misspelled type name from the prelude. + | ~~~~~~ error[E0412]: cannot find type `Baz` in this scope --> $DIR/levenshtein.rs:16:14 @@ -35,7 +50,12 @@ LL | const MAX_ITEM: usize = 10; | --------------------------- similarly named constant `MAX_ITEM` defined here ... LL | let v = [0u32; MAXITEM]; // Misspelled constant name. - | ^^^^^^^ help: a constant with a similar name exists: `MAX_ITEM` + | ^^^^^^^ + | +help: a constant with a similar name exists + | +LL | let v = [0u32; MAX_ITEM]; // Misspelled constant name. + | ~~~~~~~~ error[E0412]: cannot find type `first` in module `m` --> $DIR/levenshtein.rs:28:15 @@ -44,7 +64,12 @@ LL | pub struct First; | ----------------- similarly named struct `First` defined here ... LL | let b: m::first = m::second; // Misspelled item in module. - | ^^^^^ help: a struct with a similar name exists (notice the capitalization): `First` + | ^^^^^ + | +help: a struct with a similar name exists (notice the capitalization difference) + | +LL | let b: m::First = m::second; // Misspelled item in module. + | ~~~~~ error[E0425]: cannot find value `second` in module `m` --> $DIR/levenshtein.rs:28:26 @@ -53,7 +78,12 @@ LL | pub struct Second; | ------------------ similarly named unit struct `Second` defined here ... LL | let b: m::first = m::second; // Misspelled item in module. - | ^^^^^^ help: a unit struct with a similar name exists (notice the capitalization): `Second` + | ^^^^^^ + | +help: a unit struct with a similar name exists (notice the capitalization difference) + | +LL | let b: m::first = m::Second; // Misspelled item in module. + | ~~~~~~ error[E0425]: cannot find function `foobar` in this scope --> $DIR/levenshtein.rs:26:5 @@ -62,7 +92,12 @@ LL | fn foo_bar() {} | ------------ similarly named function `foo_bar` defined here ... LL | foobar(); // Misspelled function name. - | ^^^^^^ help: a function with a similar name exists: `foo_bar` + | ^^^^^^ + | +help: a function with a similar name exists + | +LL | foo_bar(); // Misspelled function name. + | ~~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index ee3aecddcc342..c5062ae1c0af3 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -141,13 +141,17 @@ LL | pub enum E { | ---------- similarly named enum `E` defined here ... LL | let _: Z = m::n::Z; - | ^ help: an enum with a similar name exists: `E` + | ^ | note: enum `m::Z` exists but is inaccessible --> $DIR/privacy-enum-ctor.rs:11:9 | LL | pub(in m) enum Z { | ^^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL | let _: E = m::n::Z; + | ~ error[E0423]: expected value, found enum `m::n::Z` --> $DIR/privacy-enum-ctor.rs:57:16 @@ -182,13 +186,17 @@ LL | pub enum E { | ---------- similarly named enum `E` defined here ... LL | let _: Z = m::n::Z::Fn; - | ^ help: an enum with a similar name exists: `E` + | ^ | note: enum `m::Z` exists but is inaccessible --> $DIR/privacy-enum-ctor.rs:11:9 | LL | pub(in m) enum Z { | ^^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL | let _: E = m::n::Z::Fn; + | ~ error[E0412]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:64:12 @@ -197,13 +205,17 @@ LL | pub enum E { | ---------- similarly named enum `E` defined here ... LL | let _: Z = m::n::Z::Struct; - | ^ help: an enum with a similar name exists: `E` + | ^ | note: enum `m::Z` exists but is inaccessible --> $DIR/privacy-enum-ctor.rs:11:9 | LL | pub(in m) enum Z { | ^^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL | let _: E = m::n::Z::Struct; + | ~ error[E0412]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:68:12 @@ -212,13 +224,17 @@ LL | pub enum E { | ---------- similarly named enum `E` defined here ... LL | let _: Z = m::n::Z::Unit {}; - | ^ help: an enum with a similar name exists: `E` + | ^ | note: enum `m::Z` exists but is inaccessible --> $DIR/privacy-enum-ctor.rs:11:9 | LL | pub(in m) enum Z { | ^^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL | let _: E = m::n::Z::Unit {}; + | ~ error[E0603]: enum `Z` is private --> $DIR/privacy-enum-ctor.rs:57:22 diff --git a/tests/ui/resolve/privacy-struct-ctor.stderr b/tests/ui/resolve/privacy-struct-ctor.stderr index c1fcaaf05738f..4a517feaac563 100644 --- a/tests/ui/resolve/privacy-struct-ctor.stderr +++ b/tests/ui/resolve/privacy-struct-ctor.stderr @@ -5,10 +5,12 @@ LL | pub struct S(u8); | ----------------- similarly named tuple struct `S` defined here ... LL | Z; - | ^ - | | - | constructor is not visible here due to private fields - | help: a tuple struct with a similar name exists: `S` + | ^ constructor is not visible here due to private fields + | +help: a tuple struct with a similar name exists + | +LL | S; + | ~ error[E0423]: expected value, found struct `S` --> $DIR/privacy-struct-ctor.rs:33:5 @@ -25,7 +27,12 @@ LL | | } | |_____- `S2` defined here ... LL | S2; - | ^^ help: use struct literal syntax instead: `S2 { s: val }` + | ^^ + | +help: use struct literal syntax instead + | +LL | S2 { s: val }; + | ~~~~~~~~~~~~~ error[E0423]: expected value, found struct `xcrate::S` --> $DIR/privacy-struct-ctor.rs:43:5 diff --git a/tests/ui/resolve/resolve-primitive-fallback.stderr b/tests/ui/resolve/resolve-primitive-fallback.stderr index e3a5d4edcf102..d0583966459be 100644 --- a/tests/ui/resolve/resolve-primitive-fallback.stderr +++ b/tests/ui/resolve/resolve-primitive-fallback.stderr @@ -24,13 +24,15 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/resolve-primitive-fallback.rs:3:5 | LL | std::mem::size_of(u16); - | ^^^^^^^^^^^^^^^^^ --- - | | - | unexpected argument - | help: remove the extra argument + | ^^^^^^^^^^^^^^^^^ --- unexpected argument | note: function defined here --> $SRC_DIR/core/src/mem/mod.rs:LL:COL +help: remove the extra argument + | +LL - std::mem::size_of(u16); +LL + std::mem::size_of(); + | error: aborting due to 3 previous errors diff --git a/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr b/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr index 1ab56fdc50441..086418df7a253 100644 --- a/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr +++ b/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr @@ -3,11 +3,14 @@ error[E0401]: can't use generic parameters from outer item | LL | trait TraitA { | - type parameter from outer item -LL | fn outer(&self) { -LL | enum Foo { - | - help: try introducing a local generic parameter here: `A,` +... LL | Variance(A) | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | enum Foo { + | ++ error[E0401]: can't use generic parameters from outer item --> $DIR/resolve-type-param-in-item-in-trait.rs:16:23 @@ -16,9 +19,12 @@ LL | trait TraitB { | - type parameter from outer item LL | fn outer(&self) { LL | struct Foo(A); - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `A,` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | struct Foo(A); + | ++ error[E0401]: can't use generic parameters from outer item --> $DIR/resolve-type-param-in-item-in-trait.rs:23:28 @@ -27,9 +33,12 @@ LL | trait TraitC { | - type parameter from outer item LL | fn outer(&self) { LL | struct Foo { a: A } - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `A,` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | struct Foo { a: A } + | ++ error[E0401]: can't use generic parameters from outer item --> $DIR/resolve-type-param-in-item-in-trait.rs:30:22 @@ -38,9 +47,12 @@ LL | trait TraitD { | - type parameter from outer item LL | fn outer(&self) { LL | fn foo(a: A) { } - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `A,` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | fn foo(a: A) { } + | ++ error: aborting due to 4 previous errors diff --git a/tests/ui/resolve/suggest-path-for-tuple-struct.stderr b/tests/ui/resolve/suggest-path-for-tuple-struct.stderr index 4764cf2db20e8..12c631f5a8300 100644 --- a/tests/ui/resolve/suggest-path-for-tuple-struct.stderr +++ b/tests/ui/resolve/suggest-path-for-tuple-struct.stderr @@ -2,13 +2,23 @@ error[E0423]: expected value, found struct `SomeTupleStruct` --> $DIR/suggest-path-for-tuple-struct.rs:22:13 | LL | let _ = SomeTupleStruct.new(); - | ^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = SomeTupleStruct::new(); + | ~~ error[E0423]: expected value, found struct `SomeRegularStruct` --> $DIR/suggest-path-for-tuple-struct.rs:24:13 | LL | let _ = SomeRegularStruct.new(); - | ^^^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = SomeRegularStruct::new(); + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index a4ce0deeb70f5..04d3b4d0e902f 100644 --- a/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -2,19 +2,34 @@ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:17:5 | LL | a.I - | ^- help: use the path separator to refer to an item: `::` + | ^ + | +help: use the path separator to refer to an item + | +LL | a::I + | ~~ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:23:5 | LL | a.g() - | ^- help: use the path separator to refer to an item: `::` + | ^ + | +help: use the path separator to refer to an item + | +LL | a::g() + | ~~ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:29:5 | LL | a.b.J - | ^- help: use the path separator to refer to an item: `::` + | ^ + | +help: use the path separator to refer to an item + | +LL | a::b.J + | ~~ error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:35:5 @@ -38,7 +53,12 @@ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:42:5 | LL | a.b.f(); - | ^- help: use the path separator to refer to an item: `::` + | ^ + | +help: use the path separator to refer to an item + | +LL | a::b.f(); + | ~~ error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:46:12 @@ -47,9 +67,12 @@ LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here ... LL | v.push(a::b); - | ^^^- - | | - | help: a constant with a similar name exists: `I` + | ^^^^ + | +help: a constant with a similar name exists + | +LL | v.push(a::I); + | ~ error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:52:5 @@ -76,9 +99,12 @@ LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here ... LL | a::b - | ^^^- - | | - | help: a constant with a similar name exists: `I` + | ^^^^ + | +help: a constant with a similar name exists + | +LL | a::I + | ~ error[E0423]: expected function, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:65:5 @@ -87,9 +113,12 @@ LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here ... LL | a::b() - | ^^^- - | | - | help: a constant with a similar name exists: `I` + | ^^^^ + | +help: a constant with a similar name exists + | +LL | a::I() + | ~ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:72:9 @@ -117,23 +146,31 @@ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:80:9 | LL | a.f() - | ^- help: use the path separator to refer to an item: `::` + | ^ ... LL | let _ = create!(method); | --------------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | a::f() + | ~~ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:85:9 | LL | a.f - | ^- help: use the path separator to refer to an item: `::` + | ^ ... LL | let _ = create!(field); | -------------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | a::f + | ~~ error: aborting due to 13 previous errors diff --git a/tests/ui/resolve/tuple-struct-alias.stderr b/tests/ui/resolve/tuple-struct-alias.stderr index a739ea43eed47..fc36fc1a6d8b7 100644 --- a/tests/ui/resolve/tuple-struct-alias.stderr +++ b/tests/ui/resolve/tuple-struct-alias.stderr @@ -5,9 +5,13 @@ LL | struct S(u8, u16); | ------------------ similarly named tuple struct `S` defined here ... LL | A(..) => {} - | ^ help: a tuple struct with a similar name exists: `S` + | ^ | = note: can't use a type alias as a constructor +help: a tuple struct with a similar name exists + | +LL | S(..) => {} + | ~ error[E0423]: expected function, tuple struct or tuple variant, found type alias `A` --> $DIR/tuple-struct-alias.rs:5:13 @@ -16,9 +20,13 @@ LL | struct S(u8, u16); | ------------------ similarly named tuple struct `S` defined here ... LL | let s = A(0, 1); - | ^ help: a tuple struct with a similar name exists: `S` + | ^ | = note: can't use a type alias as a constructor +help: a tuple struct with a similar name exists + | +LL | let s = S(0, 1); + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr index 0306c8af87d85..9ea0811fe5d4a 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -5,7 +5,12 @@ LL | config: String, | -------------- a field by that name exists in `Self` ... LL | Self { config } - | ^^^^^^ help: a local variable with a similar name exists: `cofig` + | ^^^^^^ + | +help: a local variable with a similar name exists + | +LL | Self { cofig } + | ~~~~~ error[E0425]: cannot find value `config` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:11:20 @@ -14,7 +19,12 @@ LL | config: String, | -------------- a field by that name exists in `Self` ... LL | println!("{config}"); - | ^^^^^^ help: a local variable with a similar name exists: `cofig` + | ^^^^^^ + | +help: a local variable with a similar name exists + | +LL | println!("{cofig}"); + | ~~~~~ error[E0425]: cannot find value `config` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:15:20 diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index f4fb7fd955f2b..2ac35ef02b376 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -2,10 +2,12 @@ error[E0433]: failed to resolve: could not find `Struc` in `module` --> $DIR/typo-suggestion-mistyped-in-path.rs:35:13 | LL | module::Struc::foo(); - | ^^^^^ - | | - | could not find `Struc` in `module` - | help: a struct with a similar name exists: `Struct` + | ^^^^^ could not find `Struc` in `module` + | +help: a struct with a similar name exists + | +LL | module::Struct::foo(); + | ~~~~~~ error[E0599]: no function or associated item named `fob` found for struct `Struct` in the current scope --> $DIR/typo-suggestion-mistyped-in-path.rs:23:13 @@ -25,10 +27,12 @@ error[E0433]: failed to resolve: use of undeclared type `Struc` --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5 | LL | Struc::foo(); - | ^^^^^ - | | - | use of undeclared type `Struc` - | help: a struct with a similar name exists: `Struct` + | ^^^^^ use of undeclared type `Struc` + | +help: a struct with a similar name exists + | +LL | Struct::foo(); + | ~~~~~~ error[E0433]: failed to resolve: use of undeclared crate or module `modul` --> $DIR/typo-suggestion-mistyped-in-path.rs:31:5 @@ -45,10 +49,12 @@ error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 | LL | Trai::foo(); - | ^^^^ - | | - | use of undeclared type `Trai` - | help: a trait with a similar name exists: `Trait` + | ^^^^ use of undeclared type `Trai` + | +help: a trait with a similar name exists + | +LL | Trait::foo(); + | ~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/return/infer-return-ty-for-fn-sig-issue-125488.stderr b/tests/ui/return/infer-return-ty-for-fn-sig-issue-125488.stderr index 8b7c5e1681ad1..bdc1ed480d63a 100644 --- a/tests/ui/return/infer-return-ty-for-fn-sig-issue-125488.stderr +++ b/tests/ui/return/infer-return-ty-for-fn-sig-issue-125488.stderr @@ -2,37 +2,45 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/infer-return-ty-for-fn-sig-issue-125488.rs:8:24 | LL | fn f1(s: S<'_>) -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `S<'_>` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn f1(s: S<'_>) -> S<'_> { + | ~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/infer-return-ty-for-fn-sig-issue-125488.rs:13:24 | LL | fn f2(s: S<'_>) -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `S<'_>` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn f2(s: S<'_>) -> S<'_> { + | ~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/infer-return-ty-for-fn-sig-issue-125488.rs:23:24 | LL | fn f3(s: S<'_>) -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `S<'_>` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn f3(s: S<'_>) -> S<'_> { + | ~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/infer-return-ty-for-fn-sig-issue-125488.rs:28:24 | LL | fn f4(s: S<'_>) -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `S<'_>` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn f4(s: S<'_>) -> S<'_> { + | ~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/return/return-impl-trait-bad.stderr b/tests/ui/return/return-impl-trait-bad.stderr index 6277c5feb20e9..425aba603d0f9 100644 --- a/tests/ui/return/return-impl-trait-bad.stderr +++ b/tests/ui/return/return-impl-trait-bad.stderr @@ -45,10 +45,8 @@ error[E0308]: mismatched types --> $DIR/return-impl-trait-bad.rs:28:5 | LL | fn used_in_trait() -> T - | - - - | | | - | | expected `T` because of return type - | | help: consider using an impl return type: `impl Send` + | - - expected `T` because of return type + | | | expected this type parameter ... LL | "don't suggest this, because the generic param is used in the bound." @@ -57,6 +55,10 @@ LL | "don't suggest this, because the generic param is used in the bound." = note: expected type parameter `T` found reference `&'static str` = note: the caller chooses a type for `T` which can be different from `&'static str` +help: consider using an impl return type + | +LL | fn used_in_trait() -> impl Send + | ~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/return/return-impl-trait.stderr b/tests/ui/return/return-impl-trait.stderr index 114ae0c244516..276473c3b9891 100644 --- a/tests/ui/return/return-impl-trait.stderr +++ b/tests/ui/return/return-impl-trait.stderr @@ -2,10 +2,7 @@ error[E0308]: mismatched types --> $DIR/return-impl-trait.rs:15:5 | LL | fn bar() -> T - | - - - | | | - | | expected `T` because of return type - | expected this type parameter help: consider using an impl return type: `impl Trait + std::marker::Sync + Send` + | - expected this type parameter - expected `T` because of return type ... LL | () | ^^ expected type parameter `T`, found `()` @@ -13,15 +10,17 @@ LL | () = note: expected type parameter `T` found unit type `()` = note: the caller chooses a type for `T` which can be different from `()` +help: consider using an impl return type + | +LL | fn bar() -> impl Trait + std::marker::Sync + Send + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/return-impl-trait.rs:23:5 | LL | fn other_bounds() -> T - | - - - | | | - | | expected `T` because of return type - | | help: consider using an impl return type: `impl Trait` + | - - expected `T` because of return type + | | | expected this type parameter ... LL | () @@ -30,6 +29,10 @@ LL | () = note: expected type parameter `T` found unit type `()` = note: the caller chooses a type for `T` which can be different from `()` +help: consider using an impl return type + | +LL | fn other_bounds() -> impl Trait + | ~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/return/return-struct.stderr b/tests/ui/return/return-struct.stderr index 282e6498ebe3e..751083e502bab 100644 --- a/tests/ui/return/return-struct.stderr +++ b/tests/ui/return/return-struct.stderr @@ -16,19 +16,24 @@ LL | fn foo() -> Age { error[E0308]: mismatched types --> $DIR/return-struct.rs:15:5 | -LL | fn bar() { - | - help: try adding a return type: `-> Age` -LL | let mut age = 29; LL | Age::Years(age, 55) | ^^^^^^^^^^^^^^^^^^^ expected `()`, found `Age` + | +help: try adding a return type + | +LL | fn bar() -> Age { + | ++++++ error[E0308]: mismatched types --> $DIR/return-struct.rs:20:5 | -LL | fn baz() { - | - help: try adding a return type: `-> S` LL | S | ^ expected `()`, found `S` + | +help: try adding a return type + | +LL | fn baz() -> S { + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.stderr index f16f5e5be8734..b94f804627212 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.stderr @@ -22,7 +22,13 @@ error: a guard on a never pattern will never be run --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:8:13 | LL | false - | ^^^^^ help: remove this guard + | ^^^^^ + | +help: remove this guard + | +LL - false +LL + + | error: mismatched types --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:5:14 diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/bindings.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/bindings.stderr index d9c0f67335cdc..d1047aa135d7a 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/bindings.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/bindings.stderr @@ -2,49 +2,89 @@ error: never patterns cannot contain variable bindings --> $DIR/bindings.rs:17:15 | LL | Err(&(_a, _b, !)), - | ^^ help: use a wildcard `_` instead + | ^^ + | +help: use a wildcard `_` instead + | +LL | Err(&(_, _b, !)), + | ~ error: never patterns cannot contain variable bindings --> $DIR/bindings.rs:17:19 | LL | Err(&(_a, _b, !)), - | ^^ help: use a wildcard `_` instead + | ^^ + | +help: use a wildcard `_` instead + | +LL | Err(&(_a, _, !)), + | ~ error: never patterns cannot contain variable bindings --> $DIR/bindings.rs:22:25 | LL | Ok(_ok) | Err(&(_a, _b, !)) => {} - | ^^ help: use a wildcard `_` instead + | ^^ + | +help: use a wildcard `_` instead + | +LL | Ok(_ok) | Err(&(_, _b, !)) => {} + | ~ error: never patterns cannot contain variable bindings --> $DIR/bindings.rs:22:29 | LL | Ok(_ok) | Err(&(_a, _b, !)) => {} - | ^^ help: use a wildcard `_` instead + | ^^ + | +help: use a wildcard `_` instead + | +LL | Ok(_ok) | Err(&(_a, _, !)) => {} + | ~ error: never patterns cannot contain variable bindings --> $DIR/bindings.rs:35:10 | LL | let (_a, (! | !)) = (true, void); - | ^^ help: use a wildcard `_` instead + | ^^ + | +help: use a wildcard `_` instead + | +LL | let (_, (! | !)) = (true, void); + | ~ error: never patterns cannot contain variable bindings --> $DIR/bindings.rs:39:9 | LL | let _a @ ! = void; - | ^^ help: use a wildcard `_` instead + | ^^ + | +help: use a wildcard `_` instead + | +LL | let _ @ ! = void; + | ~ error: never patterns cannot contain variable bindings --> $DIR/bindings.rs:42:10 | LL | let (_a @ (), !) = ((), void); - | ^^ help: use a wildcard `_` instead + | ^^ + | +help: use a wildcard `_` instead + | +LL | let (_ @ (), !) = ((), void); + | ~ error: never patterns cannot contain variable bindings --> $DIR/bindings.rs:45:14 | LL | (_b @ (_, !))) = (true, void); - | ^^ help: use a wildcard `_` instead + | ^^ + | +help: use a wildcard `_` instead + | +LL | (_ @ (_, !))) = (true, void); + | ~ error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/check.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/check.stderr index fbf7aa02ac2b9..b08cf4e809548 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/check.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/check.stderr @@ -2,34 +2,49 @@ error: a never pattern is always unreachable --> $DIR/check.rs:15:20 | LL | Some(!) => {} - | ^^ - | | - | this will never be executed - | help: remove this expression + | ^^ this will never be executed + | +help: remove this expression + | +LL - Some(!) => {} +LL + Some(!) => + | error: a guard on a never pattern will never be run --> $DIR/check.rs:20:20 | LL | Some(!) if true, - | ^^^^ help: remove this guard + | ^^^^ + | +help: remove this guard + | +LL - Some(!) if true, +LL + Some(!) if , + | error: a never pattern is always unreachable --> $DIR/check.rs:25:28 | LL | Some(!) if true => {} - | ^^ - | | - | this will never be executed - | help: remove this expression + | ^^ this will never be executed + | +help: remove this expression + | +LL - Some(!) if true => {} +LL + Some(!) if true => + | error: a never pattern is always unreachable --> $DIR/check.rs:30:27 | LL | Some(never!()) => {} - | ^^ - | | - | this will never be executed - | help: remove this expression + | ^^ this will never be executed + | +help: remove this expression + | +LL - Some(never!()) => {} +LL + Some(never!()) => + | error[E0004]: non-exhaustive patterns: `Some(!)` not covered --> $DIR/check.rs:19:11 diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/parse.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/parse.stderr index 17d1b7e0d43b8..7b5e25719eb37 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/parse.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/parse.stderr @@ -2,13 +2,23 @@ error: expected `,` following `match` arm --> $DIR/parse.rs:26:16 | LL | Some(!) - | ^ help: missing a comma here to end this `match` arm: `,` + | ^ + | +help: missing a comma here to end this `match` arm + | +LL | Some(!), + | + error: expected `,` following `match` arm --> $DIR/parse.rs:31:24 | LL | Some(!) if true - | ^ help: missing a comma here to end this `match` arm: `,` + | ^ + | +help: missing a comma here to end this `match` arm + | +LL | Some(!) if true, + | + error: expected one of `,`, `=>`, `if`, `|`, or `}`, found `<=` --> $DIR/parse.rs:42:17 @@ -20,31 +30,59 @@ error: top-level or-patterns are not allowed in `let` bindings --> $DIR/parse.rs:67:9 | LL | let Ok(_) | Err(!) = &res; // Disallowed; see #82048. - | ^^^^^^^^^^^^^^ help: wrap the pattern in parentheses: `(Ok(_) | Err(!))` + | ^^^^^^^^^^^^^^ + | +help: wrap the pattern in parentheses + | +LL | let (Ok(_) | Err(!)) = &res; // Disallowed; see #82048. + | ~~~~~~~~~~~~~~~~ error: never patterns cannot contain variable bindings --> $DIR/parse.rs:73:9 | LL | let y @ ! = x; - | ^ help: use a wildcard `_` instead + | ^ + | +help: use a wildcard `_` instead + | +LL | let _ @ ! = x; + | ~ error: a guard on a never pattern will never be run --> $DIR/parse.rs:31:20 | LL | Some(!) if true - | ^^^^ help: remove this guard + | ^^^^ + | +help: remove this guard + | +LL - Some(!) if true +LL + Some(!) if + | error: a guard on a never pattern will never be run --> $DIR/parse.rs:37:20 | LL | Some(!) if true, - | ^^^^ help: remove this guard + | ^^^^ + | +help: remove this guard + | +LL - Some(!) if true, +LL + Some(!) if , + | error: a guard on a never pattern will never be run --> $DIR/parse.rs:49:21 | LL | never!() if true, - | ^^^^ help: remove this guard + | ^^^^ + | +help: remove this guard + | +LL - never!() if true, +LL + never!() if , + | error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-2005-default-binding-mode/const.stderr b/tests/ui/rfcs/rfc-2005-default-binding-mode/const.stderr index 1c8e8d5b0a7db..538e31637238b 100644 --- a/tests/ui/rfcs/rfc-2005-default-binding-mode/const.stderr +++ b/tests/ui/rfcs/rfc-2005-default-binding-mode/const.stderr @@ -11,7 +11,11 @@ LL | FOO => {}, | | | expected `&Foo`, found `Foo` | `FOO` is interpreted as a constant, not a new binding - | help: introduce a new binding instead: `other_foo` + | +help: introduce a new binding instead + | +LL | other_foo => {}, + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr index 136cd763b05c1..0706604ba58ba 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr @@ -2,7 +2,12 @@ error: malformed `non_exhaustive` attribute input --> $DIR/invalid-attribute.rs:1:1 | LL | #[non_exhaustive(anything)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[non_exhaustive]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[non_exhaustive] + | error[E0701]: attribute should be applied to a struct or enum --> $DIR/invalid-attribute.rs:5:1 diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-odd-syntax.stderr b/tests/ui/rfcs/rfc-2091-track-caller/error-odd-syntax.stderr index e22d812c8b038..954af2b40421a 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-odd-syntax.stderr +++ b/tests/ui/rfcs/rfc-2091-track-caller/error-odd-syntax.stderr @@ -2,7 +2,12 @@ error: malformed `track_caller` attribute input --> $DIR/error-odd-syntax.rs:1:1 | LL | #[track_caller(1)] - | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[track_caller]` + | ^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[track_caller] + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-main.stderr b/tests/ui/rfcs/rfc-2091-track-caller/error-with-main.stderr index 4626544a5cd2b..b07d410a0aa06 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-main.stderr +++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-main.stderr @@ -2,9 +2,15 @@ error: `main` function is not allowed to be `#[track_caller]` --> $DIR/error-with-main.rs:1:1 | LL | #[track_caller] - | ^^^^^^^^^^^^^^^ help: remove this annotation + | ^^^^^^^^^^^^^^^ LL | fn main() { | --------- `main` function is not allowed to be `#[track_caller]` + | +help: remove this annotation + | +LL - #[track_caller] +LL + + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr index 16e1af46059a4..4ec92b6ace1b1 100644 --- a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr +++ b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr @@ -2,121 +2,215 @@ error: unused variable: `a` --> $DIR/param-attrs-cfg.rs:24:23 | LL | #[cfg(something)] a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ | note: the lint level is defined here --> $DIR/param-attrs-cfg.rs:5:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _a: i32, + | ~~ error: unused variable: `a` --> $DIR/param-attrs-cfg.rs:41:27 | LL | #[cfg(something)] a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _a: i32, + | ~~ error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:30:23 | LL | #[cfg(something)] b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _b: i32, + | ~~ error: unused variable: `c` --> $DIR/param-attrs-cfg.rs:32:40 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_c` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg_attr(nothing, cfg(nothing))] _c: i32, + | ~~ error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:48:27 | LL | #[cfg(something)] b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _b: i32, + | ~~ error: unused variable: `c` --> $DIR/param-attrs-cfg.rs:50:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_c` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg_attr(nothing, cfg(nothing))] _c: i32, + | ~~ error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:56:27 | LL | #[cfg(something)] b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _b: i32, + | ~~ error: unused variable: `c` --> $DIR/param-attrs-cfg.rs:58:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_c` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg_attr(nothing, cfg(nothing))] _c: i32, + | ~~ error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:67:27 | LL | #[cfg(something)] b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _b: i32, + | ~~ error: unused variable: `c` --> $DIR/param-attrs-cfg.rs:69:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_c` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg_attr(nothing, cfg(nothing))] _c: i32, + | ~~ error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:75:27 | LL | #[cfg(something)] b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _b: i32, + | ~~ error: unused variable: `c` --> $DIR/param-attrs-cfg.rs:77:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_c` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg_attr(nothing, cfg(nothing))] _c: i32, + | ~~ error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:86:27 | LL | #[cfg(something)] b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _b: i32, + | ~~ error: unused variable: `c` --> $DIR/param-attrs-cfg.rs:88:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_c` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg_attr(nothing, cfg(nothing))] _c: i32, + | ~~ error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:94:27 | LL | #[cfg(something)] b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _b: i32, + | ~~ error: unused variable: `c` --> $DIR/param-attrs-cfg.rs:96:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_c` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg_attr(nothing, cfg(nothing))] _c: i32, + | ~~ error: unused variable: `a` --> $DIR/param-attrs-cfg.rs:107:27 | LL | #[cfg(something)] a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _a: i32, + | ~~ error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:113:27 | LL | #[cfg(something)] b: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_b` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg(something)] _b: i32, + | ~~ error: unused variable: `c` --> $DIR/param-attrs-cfg.rs:115:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_c` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | #[cfg_attr(nothing, cfg(nothing))] _c: i32, + | ~~ error: aborting due to 19 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.stderr index 2a030369093d6..f95e72d073e5b 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.stderr @@ -15,14 +15,15 @@ error: using `#![feature(effects)]` without enabling next trait solver globally error: const `impl` for trait `A` which is not marked with `#[const_trait]` --> $DIR/const-impl-requires-const-trait.rs:8:12 | -LL | pub trait A {} - | - help: mark `A` as const: `#[const_trait]` -... LL | impl const A for () {} | ^ | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +help: mark `A` as const + | +LL | #[const_trait]pub trait A {} + | ++++++++++++++ error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr index fa2e3da368bd8..3d9df78b196e3 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr @@ -2,15 +2,18 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params-cross-crate.rs:14:5 | LL | foo::(); - | ^^^--------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/auxiliary/cross-crate.rs:5:14 | LL | pub const fn foo() {} | ^^^ +help: remove these generics + | +LL - foo::(); +LL + foo(); + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params-cross-crate.rs:16:12 @@ -32,15 +35,18 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params-cross-crate.rs:7:5 | LL | foo::(); - | ^^^-------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/auxiliary/cross-crate.rs:5:14 | LL | pub const fn foo() {} | ^^^ +help: remove these generics + | +LL - foo::(); +LL + foo(); + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params-cross-crate.rs:9:12 diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr index fbb96dfd85e1b..8412a3d0a8a0c 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr @@ -16,15 +16,18 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params.rs:22:5 | LL | foo::(); - | ^^^--------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/no-explicit-const-params.rs:3:10 | LL | const fn foo() {} | ^^^ +help: remove these generics + | +LL - foo::(); +LL + foo(); + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params.rs:24:12 @@ -55,15 +58,18 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params.rs:15:5 | LL | foo::(); - | ^^^-------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/no-explicit-const-params.rs:3:10 | LL | const fn foo() {} | ^^^ +help: remove these generics + | +LL - foo::(); +LL + foo(); + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params.rs:17:12 diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/spec-effectvar-ice.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/spec-effectvar-ice.stderr index e97a9615ae1a0..b607b1f07dfef 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/spec-effectvar-ice.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/spec-effectvar-ice.stderr @@ -15,26 +15,28 @@ error: using `#![feature(effects)]` without enabling next trait solver globally error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` --> $DIR/spec-effectvar-ice.rs:12:15 | -LL | trait Foo {} - | - help: mark `Foo` as const: `#[const_trait]` -LL | LL | impl const Foo for T {} | ^^^ | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +help: mark `Foo` as const + | +LL | #[const_trait]trait Foo {} + | ++++++++++++++ error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` --> $DIR/spec-effectvar-ice.rs:15:15 | -LL | trait Foo {} - | - help: mark `Foo` as const: `#[const_trait]` -... LL | impl const Foo for T where T: const Specialize {} | ^^^ | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +help: mark `Foo` as const + | +LL | #[const_trait]trait Foo {} + | ++++++++++++++ error: `const` can only be applied to `#[const_trait]` traits --> $DIR/spec-effectvar-ice.rs:15:40 diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/trait-fn-const.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/trait-fn-const.stderr index 15cb84026e470..69d16347ceb64 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/trait-fn-const.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/trait-fn-const.stderr @@ -5,10 +5,13 @@ LL | #[const_trait] | -------------- this declares all associated functions implicitly const LL | trait Trait { LL | const fn fun(); - | ^^^^^- - | | - | functions in traits cannot be const - | help: remove the `const` + | ^^^^^ functions in traits cannot be const + | +help: remove the `const` + | +LL - const fn fun(); +LL + fn fun(); + | error[E0379]: functions in trait impls cannot be declared const --> $DIR/trait-fn-const.rs:10:5 @@ -16,10 +19,13 @@ error[E0379]: functions in trait impls cannot be declared const LL | impl const Trait for () { | ----- this declares all associated functions implicitly const LL | const fn fun() {} - | ^^^^^- - | | - | functions in trait impls cannot be const - | help: remove the `const` + | ^^^^^ functions in trait impls cannot be const + | +help: remove the `const` + | +LL - const fn fun() {} +LL + fn fun() {} + | error[E0379]: functions in trait impls cannot be declared const --> $DIR/trait-fn-const.rs:14:5 diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.stderr index 1f309e1e85446..2e895f2e5a611 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.stderr @@ -2,21 +2,25 @@ error: expected one of `extern`, `fn`, `safe`, or `unsafe`, found keyword `const --> $DIR/ice-120503-async-const-method.rs:7:11 | LL | async const fn bar(&self) { - | ------^^^^^ - | | | - | | expected one of `extern`, `fn`, `safe`, or `unsafe` - | help: `const` must come before `async`: `const async` + | ^^^^^ expected one of `extern`, `fn`, `safe`, or `unsafe` | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +help: `const` must come before `async` + | +LL | const async fn bar(&self) { + | ~~~~~~~~~~~ error[E0379]: functions in trait impls cannot be declared const --> $DIR/ice-120503-async-const-method.rs:7:11 | LL | async const fn bar(&self) { - | ^^^^^- - | | - | functions in trait impls cannot be const - | help: remove the `const` + | ^^^^^ functions in trait impls cannot be const + | +help: remove the `const` + | +LL - async const fn bar(&self) { +LL + async fn bar(&self) { + | error: functions cannot be both `const` and `async` --> $DIR/ice-120503-async-const-method.rs:7:5 @@ -64,10 +68,15 @@ error[E0425]: cannot find function `main8` in this scope --> $DIR/ice-120503-async-const-method.rs:13:9 | LL | main8().await; - | ^^^^^ help: a function with a similar name exists: `main` + | ^^^^^ ... LL | fn main() {} | --------- similarly named function `main` defined here + | +help: a function with a similar name exists + | +LL | main().await; + | ~~~~ error[E0391]: cycle detected when computing type of opaque `::bar::{opaque#0}` --> $DIR/ice-120503-async-const-method.rs:7:5 diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-126148-failed-to-normalize.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-126148-failed-to-normalize.stderr index e49436c8f0f78..bded2d0edd8b2 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-126148-failed-to-normalize.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-126148-failed-to-normalize.stderr @@ -18,7 +18,10 @@ error[E0046]: not all trait items implemented, missing: `from_residual` LL | impl const FromResidual for TryMe {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_residual` in implementation | - = help: implement the missing item: `fn from_residual(_: Error) -> Self { todo!() }` +help: implement the missing item + | +LL | impl const FromResidual for TryMe {fn from_residual(_: Error) -> Self { todo!() } + | ++++++++++++++++++++++++++++++++++++++++++++++ error: const `impl` for trait `Try` which is not marked with `#[const_trait]` --> $DIR/ice-126148-failed-to-normalize.rs:12:12 @@ -35,8 +38,14 @@ error[E0046]: not all trait items implemented, missing: `from_output`, `branch` LL | impl const Try for TryMe { | ^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_output`, `branch` in implementation | - = help: implement the missing item: `fn from_output(_: ::Output) -> Self { todo!() }` - = help: implement the missing item: `fn branch(self) -> ControlFlow<::Residual, ::Output> { todo!() }` +help: implement the missing item + | +LL + fn from_output(_: ::Output) -> Self { todo!() } + | +help: implement the missing item + | +LL + fn branch(self) -> ControlFlow<::Residual, ::Output> { todo!() } + | error: aborting due to 5 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr index c331236a4601c..3c6247f086704 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr @@ -2,21 +2,24 @@ error[E0433]: failed to resolve: maybe a missing crate `core`? --> $DIR/issue-102156.rs:4:5 | LL | use core::convert::{From, TryFrom}; - | ^^^^ - | | - | maybe a missing crate `core`? - | help: try using `std` instead of `core`: `std` + | ^^^^ maybe a missing crate `core`? + | +help: try using `std` instead of `core` + | +LL | use std::convert::{From, TryFrom}; + | ~~~ error[E0433]: failed to resolve: maybe a missing crate `core`? --> $DIR/issue-102156.rs:4:5 | LL | use core::convert::{From, TryFrom}; - | ^^^^ - | | - | maybe a missing crate `core`? - | help: try using `std` instead of `core`: `std` + | ^^^^ maybe a missing crate `core`? | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: try using `std` instead of `core` + | +LL | use std::convert::{From, TryFrom}; + | ~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/rust-2018/async-ident-allowed.stderr b/tests/ui/rust-2018/async-ident-allowed.stderr index 378c81d3c770b..5dd946c232c78 100644 --- a/tests/ui/rust-2018/async-ident-allowed.stderr +++ b/tests/ui/rust-2018/async-ident-allowed.stderr @@ -2,7 +2,7 @@ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident-allowed.rs:9:9 | LL | let async = 3; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 @@ -12,6 +12,10 @@ note: the lint level is defined here LL | #![deny(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(keyword_idents_2018)]` implied by `#[deny(rust_2018_compatibility)]` +help: you can use a raw identifier to stay compatible + | +LL | let r#async = 3; + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/async-ident.stderr b/tests/ui/rust-2018/async-ident.stderr index 4ab061dd6f599..697baf2954f92 100644 --- a/tests/ui/rust-2018/async-ident.stderr +++ b/tests/ui/rust-2018/async-ident.stderr @@ -2,7 +2,7 @@ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:7:4 | LL | fn async() {} - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 @@ -12,123 +12,179 @@ note: the lint level is defined here LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ = note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]` +help: you can use a raw identifier to stay compatible + | +LL | fn r#async() {} + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:12:19 | LL | ($async:expr, async) => {}; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | ($async:expr, r#async) => {}; + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:17:6 | LL | foo!(async); - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | foo!(r#async); + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:26:11 | LL | trait async {} - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | trait r#async {} + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:30:10 | LL | impl async for MyStruct {} - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | impl r#async for MyStruct {} + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:36:12 | LL | static async: u32 = 0; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | static r#async: u32 = 0; + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:42:11 | LL | const async: u32 = 0; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | const r#async: u32 = 0; + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:48:15 | LL | impl Foo { fn async() {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | impl Foo { fn r#async() {} } + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:53:12 | LL | struct async {} - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | struct r#async {} + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:56:9 | LL | let async: async = async {}; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | let r#async: async = async {}; + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:56:16 | LL | let async: async = async {}; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | let async: r#async = async {}; + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:56:24 | LL | let async: async = async {}; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | let async: async = r#async {}; + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:67:19 | LL | () => (pub fn async() {}) - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | () => (pub fn r#async() {}) + | ~~~~~~~ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:74:6 | LL | (async) => (1) - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | (r#async) => (1) + | ~~~~~~~ error: aborting due to 14 previous errors diff --git a/tests/ui/rust-2018/dyn-keyword.stderr b/tests/ui/rust-2018/dyn-keyword.stderr index f8245bc88f573..2487d0899eb12 100644 --- a/tests/ui/rust-2018/dyn-keyword.stderr +++ b/tests/ui/rust-2018/dyn-keyword.stderr @@ -2,7 +2,7 @@ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-keyword.rs:8:9 | LL | let dyn = (); - | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 @@ -12,6 +12,10 @@ note: the lint level is defined here LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ = note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]` +help: you can use a raw identifier to stay compatible + | +LL | let r#dyn = (); + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr index 036b9ccab4f3b..0c98da7f7ca08 100644 --- a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr +++ b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr @@ -2,7 +2,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c --> $DIR/edition-lint-fully-qualified-paths.rs:18:25 | LL | let _: ::Bar = (); - | ^^^^^^^^^^ help: use `crate`: `crate::foo::Foo` + | ^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 @@ -11,25 +11,37 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `crate` + | +LL | let _: ::Bar = (); + | ~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-fully-qualified-paths.rs:18:25 | LL | let _: ::Bar = (); - | ^^^^^^^^^^ help: use `crate`: `crate::foo::Foo` + | ^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use `crate` + | +LL | let _: ::Bar = (); + | ~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-fully-qualified-paths.rs:24:13 | LL | let _: <::foo::Baz as foo::Foo>::Bar = (); - | ^^^^^^^^^^ help: use `crate`: `crate::foo::Baz` + | ^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | let _: ::Bar = (); + | ~~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr index d684911be3975..19650b4a371cf 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr @@ -2,124 +2,186 @@ error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:27:18 | LL | struct Bar<'a, 'b: 'a> { - | ^^^^ help: remove this bound + | ^^^^ | note: the lint level is defined here --> $DIR/edition-lint-infer-outlives-macro.rs:5:9 | LL | #![deny(explicit_outlives_requirements)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this bound + | +LL - struct Bar<'a, 'b: 'a> { +LL + struct Bar<'a, 'b> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:32:24 | LL | struct BarWhere<'a, 'b> where 'b: 'a { - | ^^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct BarWhere<'a, 'b> where 'b: 'a { +LL + struct BarWhere<'a, 'b> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:41:30 | LL | struct Foo<'a, 'b: 'a>(&'a &'b ()); - | ^^^^ help: remove this bound + | ^^^^ ... LL | m!('b: 'a); | ---------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this bound + | +LL - struct Foo<'a, 'b: 'a>(&'a &'b ()); +LL + struct Foo<'a, 'b>(&'a &'b ()); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:43:44 | LL | struct Bar<'a, 'b>(&'a &'b ()) where 'b: 'a; - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ ... LL | m!('b: 'a); | ---------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this bound + | +LL - struct Bar<'a, 'b>(&'a &'b ()) where 'b: 'a; +LL + struct Bar<'a, 'b>(&'a &'b ()) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:45:61 | LL | struct Baz<'a, 'b>(&'a &'b ()) where (): Sized, 'b: 'a; - | ^^^^^^ help: remove this bound + | ^^^^^^ ... LL | m!('b: 'a); | ---------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this bound + | +LL - struct Baz<'a, 'b>(&'a &'b ()) where (): Sized, 'b: 'a; +LL + struct Baz<'a, 'b>(&'a &'b ()) where (): Sized, ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:55:30 | LL | struct Foo<'a, $b: 'a>(&'a &$b ()); - | ^^^^ help: remove this bound + | ^^^^ ... LL | m!('b: 'a); | ---------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this bound + | +LL - struct Foo<'a, $b: 'a>(&'a &$b ()); +LL + struct Foo<'a, $b>(&'a &$b ()); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:57:44 | LL | struct Bar<'a, $b>(&'a &$b ()) where $b: 'a; - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ ... LL | m!('b: 'a); | ---------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this bound + | +LL - struct Bar<'a, $b>(&'a &$b ()) where $b: 'a; +LL + struct Bar<'a, $b>(&'a &$b ()) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:59:61 | LL | struct Baz<'a, $b>(&'a &$b ()) where (): Sized, $b: 'a; - | ^^^^^^ help: remove this bound + | ^^^^^^ ... LL | m!('b: 'a); | ---------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this bound + | +LL - struct Baz<'a, $b>(&'a &$b ()) where (): Sized, $b: 'a; +LL + struct Baz<'a, $b>(&'a &$b ()) where (): Sized, ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:117:44 | LL | struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; - | ^^^^^^^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^^^^^^^ ... LL | m!('b: 'a); | ---------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this bound + | +LL - struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; +LL + struct Bar<$a, $b>(&$a &$b ()) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:119:61 | LL | struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ ... LL | m!('b: 'a); | ---------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this bound + | +LL - struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; +LL + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:132:44 | LL | struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; - | ^^^^^^^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^^^^^^^ ... LL | m!('b: 'a); | ---------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this bound + | +LL - struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; +LL + struct Bar<$a, $b>(&$a &$b ()) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:134:61 | LL | struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; +LL + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, ; + | error: aborting due to 12 previous errors diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr index 1f4190665b9b0..fca9bd9ae4706 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr @@ -823,34 +823,49 @@ error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:372:38 | LL | struct Inline<'a, $($name: 'a,)+>(&'a ($($name,)+)); - | ^^^^ help: remove these bounds + | ^^^^ ... LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); | --------------------------------------------------------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove these bounds + | +LL - struct Inline<'a, $($name: 'a,)+>(&'a ($($name,)+)); +LL + struct Inline<'a, $($name,)+>(&'a ($($name,)+)); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:374:64 | LL | struct FullWhere<'a, $($name,)+>(&'a ($($name,)+)) where $($name: 'a,)+; - | ^^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^^ ... LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); | --------------------------------------------------------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove these bounds + | +LL - struct FullWhere<'a, $($name,)+>(&'a ($($name,)+)) where $($name: 'a,)+; +LL + struct FullWhere<'a, $($name,)+>(&'a ($($name,)+)) )+; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:376:86 | LL | struct PartialWhere<'a, $($name,)+>(&'a ($($name,)+)) where (): Sized, $($name: 'a,)+; - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ ... LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); | --------------------------------------------------------- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove these bounds + | +LL - struct PartialWhere<'a, $($name,)+>(&'a ($($name,)+)) where (): Sized, $($name: 'a,)+; +LL + struct PartialWhere<'a, $($name,)+>(&'a ($($name,)+)) where (): Sized, $(,)+; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:381:19 diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr index dbf301fd8a1b7..800516604cad9 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives.stderr +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr @@ -2,13 +2,17 @@ error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:797:5 | LL | U: 'a, - | ^^^^^^ help: remove this bound + | ^^^^^^ | note: the lint level is defined here --> $DIR/edition-lint-infer-outlives.rs:4:9 | LL | #![deny(explicit_outlives_requirements)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this bound + | +LL - U: 'a, + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:805:56 @@ -17,919 +21,1839 @@ LL | struct InferredWhereBoundWithInlineBound<'a, T: ?Sized> | ________________________________________________________^ LL | | LL | | where T: 'a, - | |________________^ help: remove this bound + | |________________^ + | +help: remove this bound + | +LL - struct InferredWhereBoundWithInlineBound<'a, T: ?Sized> +LL - +LL - where T: 'a, +LL + struct InferredWhereBoundWithInlineBound<'a, T: ?Sized> + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:26:31 | LL | struct TeeOutlivesAy<'a, T: 'a> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct TeeOutlivesAy<'a, T: 'a> { +LL + struct TeeOutlivesAy<'a, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:31:40 | LL | struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { +LL + struct TeeOutlivesAyIsDebug<'a, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:36:45 | LL | struct TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { +LL + struct TeeIsDebugOutlivesAy<'a, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:41:38 | LL | struct TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { +LL + struct TeeOutlivesAyBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:46:47 | LL | struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { +LL + struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:51:52 | LL | struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { +LL + struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:56:37 | LL | struct TeeWhereOutlivesAy<'a, T> where T: 'a { - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct TeeWhereOutlivesAy<'a, T> where T: 'a { +LL + struct TeeWhereOutlivesAy<'a, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:61:54 | LL | struct TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { +LL + struct TeeWhereOutlivesAyIsDebug<'a, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:66:59 | LL | struct TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { +LL + struct TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:71:44 | LL | struct TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { - | ^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { +LL + struct TeeWhereOutlivesAyBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:76:61 | LL | struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { +LL + struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:81:66 | LL | struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { +LL + struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:86:37 | LL | struct TeeYooOutlivesAy<'a, T, U: 'a> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct TeeYooOutlivesAy<'a, T, U: 'a> { +LL + struct TeeYooOutlivesAy<'a, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:92:46 | LL | struct TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { +LL + struct TeeYooOutlivesAyIsDebug<'a, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:98:51 | LL | struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { +LL + struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:104:41 | LL | struct TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { +LL + struct TeeOutlivesAyYooIsDebug<'a, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:110:44 | LL | struct TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { +LL + struct TeeYooOutlivesAyBee<'a, 'b, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:116:53 | LL | struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { +LL + struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:122:58 | LL | struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { +LL + struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:128:48 | LL | struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { +LL + struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:134:43 | LL | struct TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { +LL + struct TeeYooWhereOutlivesAy<'a, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:140:60 | LL | struct TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { +LL + struct TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:146:65 | LL | struct TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { +LL + struct TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:152:46 | LL | struct TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { +LL + struct TeeOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:158:50 | LL | struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { - | ^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { +LL + struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:164:67 | LL | struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { +LL + struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:170:72 | LL | struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { +LL + struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:176:53 | LL | struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { +LL + struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:182:62 | LL | struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { - | ^^^^^^^ help: remove this bound + | ^^^^^^^ + | +help: remove this bound + | +LL - struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { +LL + struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:188:69 | LL | struct TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { - | ^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { +LL + struct TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:194:32 | LL | struct BeeOutlivesAy<'a, 'b: 'a> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct BeeOutlivesAy<'a, 'b: 'a> { +LL + struct BeeOutlivesAy<'a, 'b> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:199:38 | LL | struct BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { - | ^^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { +LL + struct BeeWhereOutlivesAy<'a, 'b> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:204:35 | LL | struct BeeOutlivesAyTee<'a, 'b: 'a, T> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct BeeOutlivesAyTee<'a, 'b: 'a, T> { +LL + struct BeeOutlivesAyTee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:209:44 | LL | struct BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { - | ^^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { +LL + struct BeeWhereOutlivesAyTee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:214:52 | LL | struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { - | ^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { +LL + struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:219:54 | LL | struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { +LL + struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:224:40 | LL | struct BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { +LL + struct BeeOutlivesAyTeeDebug<'a, 'b, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:229:61 | LL | struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { - | ^^^^^^^^ help: remove this bound + | ^^^^^^^^ + | +help: remove this bound + | +LL - struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { +LL + struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:238:31 | LL | struct TeeOutlivesAy<'a, T: 'a>(&'a T); - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct TeeOutlivesAy<'a, T: 'a>(&'a T); +LL + struct TeeOutlivesAy<'a, T>(&'a T); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:241:40 | LL | struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug>(&'a T); - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug>(&'a T); +LL + struct TeeOutlivesAyIsDebug<'a, T: Debug>(&'a T); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:244:45 | LL | struct TeeIsDebugOutlivesAy<'a, T: Debug + 'a>(&'a T); - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeIsDebugOutlivesAy<'a, T: Debug + 'a>(&'a T); +LL + struct TeeIsDebugOutlivesAy<'a, T: Debug>(&'a T); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:247:38 | LL | struct TeeOutlivesAyBee<'a, 'b, T: 'a + 'b>(&'a &'b T); - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyBee<'a, 'b, T: 'a + 'b>(&'a &'b T); +LL + struct TeeOutlivesAyBee<'a, 'b, T>(&'a &'b T); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:250:47 | LL | struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug>(&'a &'b T); - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug>(&'a &'b T); +LL + struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: Debug>(&'a &'b T); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:253:52 | LL | struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b>(&'a &'b T); - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b>(&'a &'b T); +LL + struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug>(&'a &'b T); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:256:45 | LL | struct TeeWhereOutlivesAy<'a, T>(&'a T) where T: 'a; - | ^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct TeeWhereOutlivesAy<'a, T>(&'a T) where T: 'a; +LL + struct TeeWhereOutlivesAy<'a, T>(&'a T) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:259:61 | LL | struct TeeWhereOutlivesAyIsDebug<'a, T>(&'a T) where T: 'a + Debug; - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeWhereOutlivesAyIsDebug<'a, T>(&'a T) where T: 'a + Debug; +LL + struct TeeWhereOutlivesAyIsDebug<'a, T>(&'a T) where T: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:262:66 | LL | struct TeeWhereIsDebugOutlivesAy<'a, T>(&'a T) where T: Debug + 'a; - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeWhereIsDebugOutlivesAy<'a, T>(&'a T) where T: Debug + 'a; +LL + struct TeeWhereIsDebugOutlivesAy<'a, T>(&'a T) where T: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:265:56 | LL | struct TeeWhereOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: 'a + 'b; - | ^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: 'a + 'b; +LL + struct TeeWhereOutlivesAyBee<'a, 'b, T>(&'a &'b T) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:268:72 | LL | struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T>(&'a &'b T) where T: 'a + 'b + Debug; - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T>(&'a &'b T) where T: 'a + 'b + Debug; +LL + struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T>(&'a &'b T) where T: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:271:77 | LL | struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: Debug + 'a + 'b; - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: Debug + 'a + 'b; +LL + struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:274:37 | LL | struct TeeYooOutlivesAy<'a, T, U: 'a>(T, &'a U); - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct TeeYooOutlivesAy<'a, T, U: 'a>(T, &'a U); +LL + struct TeeYooOutlivesAy<'a, T, U>(T, &'a U); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:277:46 | LL | struct TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug>(T, &'a U); - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug>(T, &'a U); +LL + struct TeeYooOutlivesAyIsDebug<'a, T, U: Debug>(T, &'a U); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:280:51 | LL | struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a>(T, &'a U); - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a>(T, &'a U); +LL + struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug>(T, &'a U); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:283:41 | LL | struct TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug>(&'a T, U); - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug>(&'a T, U); +LL + struct TeeOutlivesAyYooIsDebug<'a, T, U: Debug>(&'a T, U); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:286:44 | LL | struct TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b>(T, &'a &'b U); - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b>(T, &'a &'b U); +LL + struct TeeYooOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:289:53 | LL | struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug>(T, &'a &'b U); - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug>(T, &'a &'b U); +LL + struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: Debug>(T, &'a &'b U); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:292:58 | LL | struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b>(T, &'a &'b U); - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b>(T, &'a &'b U); +LL + struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug>(T, &'a &'b U); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:295:48 | LL | struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug>(&'a &'b T, U); - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug>(&'a &'b T, U); +LL + struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T, U: Debug>(&'a &'b T, U); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:298:54 | LL | struct TeeYooWhereOutlivesAy<'a, T, U>(T, &'a U) where U: 'a; - | ^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct TeeYooWhereOutlivesAy<'a, T, U>(T, &'a U) where U: 'a; +LL + struct TeeYooWhereOutlivesAy<'a, T, U>(T, &'a U) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:301:70 | LL | struct TeeYooWhereOutlivesAyIsDebug<'a, T, U>(T, &'a U) where U: 'a + Debug; - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeYooWhereOutlivesAyIsDebug<'a, T, U>(T, &'a U) where U: 'a + Debug; +LL + struct TeeYooWhereOutlivesAyIsDebug<'a, T, U>(T, &'a U) where U: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:304:75 | LL | struct TeeYooWhereIsDebugOutlivesAy<'a, T, U>(T, &'a U) where U: Debug + 'a; - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - struct TeeYooWhereIsDebugOutlivesAy<'a, T, U>(T, &'a U) where U: Debug + 'a; +LL + struct TeeYooWhereIsDebugOutlivesAy<'a, T, U>(T, &'a U) where U: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:307:46 | LL | struct TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U>(&'a T, U) where U: Debug; - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U>(&'a T, U) where U: Debug; +LL + struct TeeOutlivesAyYooWhereIsDebug<'a, T, U>(&'a T, U) where U: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:310:65 | LL | struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + 'b; - | ^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + 'b; +LL + struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:313:81 | LL | struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + 'b + Debug; - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + 'b + Debug; +LL + struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U>(T, &'a &'b U) where U: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:316:86 | LL | struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug + 'a + 'b; - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug + 'a + 'b; +LL + struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:319:53 | LL | struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U>(&'a &'b T, U) where U: Debug; - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U>(&'a &'b T, U) where U: Debug; +LL + struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U>(&'a &'b T, U) where U: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:322:72 | LL | struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U>(&'a T, U) where T: 'a, U: Debug; - | ^^^^^^^ help: remove this bound + | ^^^^^^^ + | +help: remove this bound + | +LL - struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U>(&'a T, U) where T: 'a, U: Debug; +LL + struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U>(&'a T, U) where U: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:325:75 | LL | struct TeeWhereAyBeeYooWhereIsDebug<'a, 'b, T, U>(&'a &'b T, U) where T: 'a + 'b, U: Debug; - | ^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereAyBeeYooWhereIsDebug<'a, 'b, T, U>(&'a &'b T, U) where T: 'a + 'b, U: Debug; +LL + struct TeeWhereAyBeeYooWhereIsDebug<'a, 'b, T, U>(&'a &'b T, U) where U: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:328:32 | LL | struct BeeOutlivesAy<'a, 'b: 'a>(&'a &'b ()); - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct BeeOutlivesAy<'a, 'b: 'a>(&'a &'b ()); +LL + struct BeeOutlivesAy<'a, 'b>(&'a &'b ()); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:331:51 | LL | struct BeeWhereOutlivesAy<'a, 'b>(&'a &'b ()) where 'b: 'a; - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct BeeWhereOutlivesAy<'a, 'b>(&'a &'b ()) where 'b: 'a; +LL + struct BeeWhereOutlivesAy<'a, 'b>(&'a &'b ()) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:334:35 | LL | struct BeeOutlivesAyTee<'a, 'b: 'a, T>(&'a &'b T); - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct BeeOutlivesAyTee<'a, 'b: 'a, T>(&'a &'b T); +LL + struct BeeOutlivesAyTee<'a, 'b, T>(&'a &'b T); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:337:56 | LL | struct BeeWhereOutlivesAyTee<'a, 'b, T>(&'a &'b T) where 'b: 'a; - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ + | +help: remove this bound + | +LL - struct BeeWhereOutlivesAyTee<'a, 'b, T>(&'a &'b T) where 'b: 'a; +LL + struct BeeWhereOutlivesAyTee<'a, 'b, T>(&'a &'b T) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:340:64 | LL | struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'b; - | ^^^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'b; +LL + struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T>(&'a &'b T) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:343:66 | LL | struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + 'b; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + 'b; +LL + struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T>(&'a &'b T) ; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:346:40 | LL | struct BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug>(&'a &'b T); - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - struct BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug>(&'a &'b T); +LL + struct BeeOutlivesAyTeeDebug<'a, 'b, T: Debug>(&'a &'b T); + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:349:72 | LL | struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: Debug; - | ^^^^^^^^ help: remove this bound + | ^^^^^^^^ + | +help: remove this bound + | +LL - struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: Debug; +LL + struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T>(&'a &'b T) where T: Debug; + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:356:29 | LL | enum TeeOutlivesAy<'a, T: 'a> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - enum TeeOutlivesAy<'a, T: 'a> { +LL + enum TeeOutlivesAy<'a, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:361:38 | LL | enum TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - enum TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { +LL + enum TeeOutlivesAyIsDebug<'a, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:366:43 | LL | enum TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - enum TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { +LL + enum TeeIsDebugOutlivesAy<'a, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:372:36 | LL | enum TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { +LL + enum TeeOutlivesAyBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:378:45 | LL | enum TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { +LL + enum TeeOutlivesAyBeeIsDebug<'a, 'b, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:383:50 | LL | enum TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { +LL + enum TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:388:35 | LL | enum TeeWhereOutlivesAy<'a, T> where T: 'a { - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ + | +help: remove this bound + | +LL - enum TeeWhereOutlivesAy<'a, T> where T: 'a { +LL + enum TeeWhereOutlivesAy<'a, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:394:52 | LL | enum TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - enum TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { +LL + enum TeeWhereOutlivesAyIsDebug<'a, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:400:57 | LL | enum TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - enum TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { +LL + enum TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:405:42 | LL | enum TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { - | ^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { +LL + enum TeeWhereOutlivesAyBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:410:59 | LL | enum TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { +LL + enum TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:416:64 | LL | enum TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { +LL + enum TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:422:35 | LL | enum TeeYooOutlivesAy<'a, T, U: 'a> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - enum TeeYooOutlivesAy<'a, T, U: 'a> { +LL + enum TeeYooOutlivesAy<'a, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:428:44 | LL | enum TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - enum TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { +LL + enum TeeYooOutlivesAyIsDebug<'a, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:434:49 | LL | enum TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - enum TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { +LL + enum TeeYooIsDebugOutlivesAy<'a, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:440:39 | LL | enum TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - enum TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { +LL + enum TeeOutlivesAyYooIsDebug<'a, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:446:42 | LL | enum TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { +LL + enum TeeYooOutlivesAyBee<'a, 'b, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:452:51 | LL | enum TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { +LL + enum TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:458:56 | LL | enum TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { +LL + enum TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:464:46 | LL | enum TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { +LL + enum TeeOutlivesAyBeeYooIsDebug<'a, 'b, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:470:41 | LL | enum TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ + | +help: remove this bound + | +LL - enum TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { +LL + enum TeeYooWhereOutlivesAy<'a, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:476:58 | LL | enum TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - enum TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { +LL + enum TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:482:63 | LL | enum TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - enum TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { +LL + enum TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:488:44 | LL | enum TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - enum TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { +LL + enum TeeOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:494:48 | LL | enum TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { - | ^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { +LL + enum TeeYooWhereOutlivesAyBee<'a, 'b, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:500:65 | LL | enum TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { +LL + enum TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:506:70 | LL | enum TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { +LL + enum TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:512:51 | LL | enum TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { +LL + enum TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:518:60 | LL | enum TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { - | ^^^^^^^ help: remove this bound + | ^^^^^^^ + | +help: remove this bound + | +LL - enum TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { +LL + enum TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:524:67 | LL | enum TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { - | ^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { +LL + enum TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:530:30 | LL | enum BeeOutlivesAy<'a, 'b: 'a> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - enum BeeOutlivesAy<'a, 'b: 'a> { +LL + enum BeeOutlivesAy<'a, 'b> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:535:36 | LL | enum BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { - | ^^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^^ + | +help: remove this bound + | +LL - enum BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { +LL + enum BeeWhereOutlivesAy<'a, 'b> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:540:33 | LL | enum BeeOutlivesAyTee<'a, 'b: 'a, T> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - enum BeeOutlivesAyTee<'a, 'b: 'a, T> { +LL + enum BeeOutlivesAyTee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:546:42 | LL | enum BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { - | ^^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^^ + | +help: remove this bound + | +LL - enum BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { +LL + enum BeeWhereOutlivesAyTee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:552:50 | LL | enum BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { - | ^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { +LL + enum BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:557:52 | LL | enum BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { +LL + enum BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:563:38 | LL | enum BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - enum BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { +LL + enum BeeOutlivesAyTeeDebug<'a, 'b, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:568:59 | LL | enum BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { - | ^^^^^^^^ help: remove this bound + | ^^^^^^^^ + | +help: remove this bound + | +LL - enum BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { +LL + enum BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:577:30 | LL | union TeeOutlivesAy<'a, T: 'a> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - union TeeOutlivesAy<'a, T: 'a> { +LL + union TeeOutlivesAy<'a, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:582:39 | LL | union TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - union TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { +LL + union TeeOutlivesAyIsDebug<'a, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:587:44 | LL | union TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - union TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { +LL + union TeeIsDebugOutlivesAy<'a, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:592:37 | LL | union TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { +LL + union TeeOutlivesAyBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:597:46 | LL | union TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { +LL + union TeeOutlivesAyBeeIsDebug<'a, 'b, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:602:51 | LL | union TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { +LL + union TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:607:36 | LL | union TeeWhereOutlivesAy<'a, T> where T: 'a { - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ + | +help: remove this bound + | +LL - union TeeWhereOutlivesAy<'a, T> where T: 'a { +LL + union TeeWhereOutlivesAy<'a, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:612:53 | LL | union TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - union TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { +LL + union TeeWhereOutlivesAyIsDebug<'a, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:617:58 | LL | union TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - union TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { +LL + union TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:622:43 | LL | union TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { - | ^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { +LL + union TeeWhereOutlivesAyBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:627:60 | LL | union TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { +LL + union TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:632:65 | LL | union TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { +LL + union TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:637:36 | LL | union TeeYooOutlivesAy<'a, T, U: 'a> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - union TeeYooOutlivesAy<'a, T, U: 'a> { +LL + union TeeYooOutlivesAy<'a, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:643:45 | LL | union TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - union TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { +LL + union TeeYooOutlivesAyIsDebug<'a, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:649:50 | LL | union TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - union TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { +LL + union TeeYooIsDebugOutlivesAy<'a, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:655:40 | LL | union TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - union TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { +LL + union TeeOutlivesAyYooIsDebug<'a, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:661:43 | LL | union TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { +LL + union TeeYooOutlivesAyBee<'a, 'b, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:667:52 | LL | union TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { +LL + union TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:673:57 | LL | union TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { +LL + union TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:679:47 | LL | union TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { +LL + union TeeOutlivesAyBeeYooIsDebug<'a, 'b, T, U: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:685:42 | LL | union TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { - | ^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^ + | +help: remove this bound + | +LL - union TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { +LL + union TeeYooWhereOutlivesAy<'a, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:691:59 | LL | union TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - union TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { +LL + union TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:697:64 | LL | union TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { - | ^^^^^ help: remove this bound + | ^^^^^ + | +help: remove this bound + | +LL - union TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { +LL + union TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:703:45 | LL | union TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - union TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { +LL + union TeeOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:709:49 | LL | union TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { - | ^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { +LL + union TeeYooWhereOutlivesAyBee<'a, 'b, T, U> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:715:66 | LL | union TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { +LL + union TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:721:71 | LL | union TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { - | ^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { +LL + union TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:727:52 | LL | union TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { - | ^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { +LL + union TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:733:61 | LL | union TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { - | ^^^^^^^ help: remove this bound + | ^^^^^^^ + | +help: remove this bound + | +LL - union TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { +LL + union TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:739:68 | LL | union TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { - | ^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { +LL + union TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:745:31 | LL | union BeeOutlivesAy<'a, 'b: 'a> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - union BeeOutlivesAy<'a, 'b: 'a> { +LL + union BeeOutlivesAy<'a, 'b> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:750:37 | LL | union BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { - | ^^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^^ + | +help: remove this bound + | +LL - union BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { +LL + union BeeWhereOutlivesAy<'a, 'b> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:755:34 | LL | union BeeOutlivesAyTee<'a, 'b: 'a, T> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - union BeeOutlivesAyTee<'a, 'b: 'a, T> { +LL + union BeeOutlivesAyTee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:760:43 | LL | union BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { - | ^^^^^^^^^^^^^ help: remove this bound + | ^^^^^^^^^^^^^ + | +help: remove this bound + | +LL - union BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { +LL + union BeeWhereOutlivesAyTee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:765:51 | LL | union BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { - | ^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - union BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { +LL + union BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:770:53 | LL | union BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - union BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { +LL + union BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:775:39 | LL | union BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { - | ^^^^ help: remove this bound + | ^^^^ + | +help: remove this bound + | +LL - union BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { +LL + union BeeOutlivesAyTeeDebug<'a, 'b, T: Debug> { + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:780:60 | LL | union BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { - | ^^^^^^^^ help: remove this bound + | ^^^^^^^^ + | +help: remove this bound + | +LL - union BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { +LL + union BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where T: Debug { + | error: aborting due to 154 previous errors diff --git a/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr b/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr index 4174c2fa9adf2..315530af7dad3 100644 --- a/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr +++ b/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr @@ -2,7 +2,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c --> $DIR/edition-lint-nested-empty-paths.rs:16:5 | LL | use foo::{bar::{baz::{}}}; - | ^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}}}` + | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 @@ -11,44 +11,64 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `crate` + | +LL | use crate::foo::{bar::{baz::{}}}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-nested-empty-paths.rs:20:5 | LL | use foo::{bar::{XX, baz::{}}}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{XX, baz::{}}}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | use crate::foo::{bar::{XX, baz::{}}}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-nested-empty-paths.rs:20:5 | LL | use foo::{bar::{XX, baz::{}}}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{XX, baz::{}}}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use `crate` + | +LL | use crate::foo::{bar::{XX, baz::{}}}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-nested-empty-paths.rs:26:5 | LL | use foo::{bar::{baz::{}, baz1::{}}}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}, baz1::{}}}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | use crate::foo::{bar::{baz::{}, baz1::{}}}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-nested-empty-paths.rs:26:5 | LL | use foo::{bar::{baz::{}, baz1::{}}}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}, baz1::{}}}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use `crate` + | +LL | use crate::foo::{bar::{baz::{}, baz1::{}}}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/rust-2018/edition-lint-nested-paths.stderr b/tests/ui/rust-2018/edition-lint-nested-paths.stderr index d059a2533a903..57d31185d61d0 100644 --- a/tests/ui/rust-2018/edition-lint-nested-paths.stderr +++ b/tests/ui/rust-2018/edition-lint-nested-paths.stderr @@ -2,7 +2,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c --> $DIR/edition-lint-nested-paths.rs:5:5 | LL | use foo::{a, b}; - | ^^^^^^^^^^^ help: use `crate`: `crate::foo::{a, b}` + | ^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 @@ -11,35 +11,51 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `crate` + | +LL | use crate::foo::{a, b}; + | ~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-nested-paths.rs:5:5 | LL | use foo::{a, b}; - | ^^^^^^^^^^^ help: use `crate`: `crate::foo::{a, b}` + | ^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use `crate` + | +LL | use crate::foo::{a, b}; + | ~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-nested-paths.rs:22:13 | LL | use foo::{self as x, c}; - | ^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{self as x, c}` + | ^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | use crate::foo::{self as x, c}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-nested-paths.rs:22:13 | LL | use foo::{self as x, c}; - | ^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{self as x, c}` + | ^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use `crate` + | +LL | use crate::foo::{self as x, c}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/rust-2018/edition-lint-paths.stderr b/tests/ui/rust-2018/edition-lint-paths.stderr index 553a3bfdaa8c7..222fcc2859a49 100644 --- a/tests/ui/rust-2018/edition-lint-paths.stderr +++ b/tests/ui/rust-2018/edition-lint-paths.stderr @@ -2,7 +2,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c --> $DIR/edition-lint-paths.rs:11:9 | LL | use bar::Bar; - | ^^^^^^^^ help: use `crate`: `crate::bar::Bar` + | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 @@ -11,80 +11,116 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `crate` + | +LL | use crate::bar::Bar; + | ~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:18:9 | LL | use bar; - | ^^^ help: use `crate`: `crate::bar` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | use crate::bar; + | ~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:24:9 | LL | use {main, Bar as SomethingElse}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{main, Bar as SomethingElse}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | use crate::{main, Bar as SomethingElse}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:24:9 | LL | use {main, Bar as SomethingElse}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{main, Bar as SomethingElse}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use `crate` + | +LL | use crate::{main, Bar as SomethingElse}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:24:9 | LL | use {main, Bar as SomethingElse}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{main, Bar as SomethingElse}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: use `crate` + | +LL | use crate::{main, Bar as SomethingElse}; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:39:5 | LL | use bar::Bar; - | ^^^^^^^^ help: use `crate`: `crate::bar::Bar` + | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | use crate::bar::Bar; + | ~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:51:9 | LL | use *; - | ^ help: use `crate`: `crate::*` + | ^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | use crate::*; + | ~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:56:6 | LL | impl ::foo::SomeTrait for u32 {} - | ^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::SomeTrait` + | ^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | impl crate::foo::SomeTrait for u32 {} + | ~~~~~~~~~~~~~~~~~~~~~ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:61:13 | LL | let x = ::bar::Bar; - | ^^^^^^^^^^ help: use `crate`: `crate::bar::Bar` + | ^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 +help: use `crate` + | +LL | let x = crate::bar::Bar; + | ~~~~~~~~~~~~~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr index a68d99c14cead..9cad83f5d7ca4 100644 --- a/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr +++ b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr @@ -2,7 +2,7 @@ error: unused extern crate --> $DIR/extern-crate-idiomatic-in-2018.rs:12:1 | LL | extern crate edition_lint_paths; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/extern-crate-idiomatic-in-2018.rs:9:9 @@ -10,6 +10,10 @@ note: the lint level is defined here LL | #![deny(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[deny(unused_extern_crates)]` implied by `#[deny(rust_2018_idioms)]` +help: remove it + | +LL - extern crate edition_lint_paths; + | error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/extern-crate-rename.stderr b/tests/ui/rust-2018/extern-crate-rename.stderr index 6b2512080309c..846ec94d3cfe1 100644 --- a/tests/ui/rust-2018/extern-crate-rename.stderr +++ b/tests/ui/rust-2018/extern-crate-rename.stderr @@ -2,7 +2,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c --> $DIR/extern-crate-rename.rs:11:5 | LL | use my_crate::foo; - | ^^^^^^^^^^^^^ help: use `crate`: `crate::my_crate::foo` + | ^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 @@ -11,6 +11,10 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `crate` + | +LL | use crate::my_crate::foo; + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/extern-crate-submod.stderr b/tests/ui/rust-2018/extern-crate-submod.stderr index 0d45d32d568b2..27d75f7516e8d 100644 --- a/tests/ui/rust-2018/extern-crate-submod.stderr +++ b/tests/ui/rust-2018/extern-crate-submod.stderr @@ -2,7 +2,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c --> $DIR/extern-crate-submod.rs:18:5 | LL | use m::edition_lint_paths::foo; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::m::edition_lint_paths::foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 @@ -11,6 +11,10 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `crate` + | +LL | use crate::m::edition_lint_paths::foo; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/issue-54006.stderr b/tests/ui/rust-2018/issue-54006.stderr index 35d4c17d2c7f1..fb43309cbcb5e 100644 --- a/tests/ui/rust-2018/issue-54006.stderr +++ b/tests/ui/rust-2018/issue-54006.stderr @@ -2,7 +2,12 @@ error[E0432]: unresolved import `alloc` --> $DIR/issue-54006.rs:6:5 | LL | use alloc::vec; - | ^^^^^ help: a similar path exists: `core::alloc` + | ^^^^^ + | +help: a similar path exists + | +LL | use core::alloc::vec; + | ~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr index 038a9dd967b73..8a0c968efaf5a 100644 --- a/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr +++ b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr @@ -1,11 +1,8 @@ error: unused extern crate --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:12:1 | -LL | / #[cfg(not(FALSE))] -LL | | extern crate edition_lint_paths; - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | |________________________________| - | help: remove it +LL | extern crate edition_lint_paths; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:6:9 @@ -13,6 +10,11 @@ note: the lint level is defined here LL | #![deny(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[deny(unused_extern_crates)]` implied by `#[deny(rust_2018_idioms)]` +help: remove it + | +LL - #[cfg(not(FALSE))] +LL - extern crate edition_lint_paths; + | error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/local-path-suggestions-2015.stderr b/tests/ui/rust-2018/local-path-suggestions-2015.stderr index e726b1e3e8182..823001c8b77ee 100644 --- a/tests/ui/rust-2018/local-path-suggestions-2015.stderr +++ b/tests/ui/rust-2018/local-path-suggestions-2015.stderr @@ -2,10 +2,12 @@ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2015.rs:24:5 | LL | use foobar::Baz; - | ^^^^^^ - | | - | unresolved import - | help: a similar path exists: `aux_baz::foobar` + | ^^^^^^ unresolved import + | +help: a similar path exists + | +LL | use aux_baz::foobar::Baz; + | ~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/local-path-suggestions-2018.stderr b/tests/ui/rust-2018/local-path-suggestions-2018.stderr index 40f3d6bf1cf1e..01624b6b22679 100644 --- a/tests/ui/rust-2018/local-path-suggestions-2018.stderr +++ b/tests/ui/rust-2018/local-path-suggestions-2018.stderr @@ -2,15 +2,24 @@ error[E0432]: unresolved import `foo` --> $DIR/local-path-suggestions-2018.rs:10:9 | LL | use foo::Bar; - | ^^^ help: a similar path exists: `crate::foo` + | ^^^ | = note: `use` statements changed in Rust 2018; read more at +help: a similar path exists + | +LL | use crate::foo::Bar; + | ~~~~~~~~~~ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2018.rs:19:5 | LL | use foobar::Baz; - | ^^^^^^ help: a similar path exists: `baz::foobar` + | ^^^^^^ + | +help: a similar path exists + | +LL | use baz::foobar::Baz; + | ~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/rust-2018/remove-extern-crate.stderr b/tests/ui/rust-2018/remove-extern-crate.stderr index 020db9975c092..8ee2827e5d2ea 100644 --- a/tests/ui/rust-2018/remove-extern-crate.stderr +++ b/tests/ui/rust-2018/remove-extern-crate.stderr @@ -2,7 +2,7 @@ warning: unused extern crate --> $DIR/remove-extern-crate.rs:11:1 | LL | extern crate core; - | ^^^^^^^^^^^^^^^^^^ help: remove it + | ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/remove-extern-crate.rs:7:9 @@ -10,6 +10,11 @@ note: the lint level is defined here LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` +help: remove it + | +LL - extern crate core; +LL + + | warning: `extern crate` is not idiomatic in the new edition --> $DIR/remove-extern-crate.rs:35:5 diff --git a/tests/ui/rust-2018/try-ident.stderr b/tests/ui/rust-2018/try-ident.stderr index eaf4c235697c7..8d7374fd1968d 100644 --- a/tests/ui/rust-2018/try-ident.stderr +++ b/tests/ui/rust-2018/try-ident.stderr @@ -2,7 +2,7 @@ warning: `try` is a keyword in the 2018 edition --> $DIR/try-ident.rs:7:5 | LL | try(); - | ^^^ help: you can use a raw identifier to stay compatible: `r#try` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 @@ -12,15 +12,23 @@ note: the lint level is defined here LL | #![warn(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[warn(keyword_idents_2018)]` implied by `#[warn(rust_2018_compatibility)]` +help: you can use a raw identifier to stay compatible + | +LL | r#try(); + | ~~~~~ warning: `try` is a keyword in the 2018 edition --> $DIR/try-ident.rs:12:4 | LL | fn try() { - | ^^^ help: you can use a raw identifier to stay compatible: `r#try` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | fn r#try() { + | ~~~~~ warning: 2 warnings emitted diff --git a/tests/ui/rust-2018/try-macro.stderr b/tests/ui/rust-2018/try-macro.stderr index 095c755539db4..8dc11e6e6cc81 100644 --- a/tests/ui/rust-2018/try-macro.stderr +++ b/tests/ui/rust-2018/try-macro.stderr @@ -2,7 +2,7 @@ warning: `try` is a keyword in the 2018 edition --> $DIR/try-macro.rs:12:5 | LL | try!(x); - | ^^^ help: you can use a raw identifier to stay compatible: `r#try` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 @@ -12,6 +12,10 @@ note: the lint level is defined here LL | #![warn(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[warn(keyword_idents_2018)]` implied by `#[warn(rust_2018_compatibility)]` +help: you can use a raw identifier to stay compatible + | +LL | r#try!(x); + | ~~~~~ warning: 1 warning emitted diff --git a/tests/ui/rust-2021/array-into-iter-ambiguous.stderr b/tests/ui/rust-2021/array-into-iter-ambiguous.stderr index 2a724bd307200..c8c23b07373b6 100644 --- a/tests/ui/rust-2021/array-into-iter-ambiguous.stderr +++ b/tests/ui/rust-2021/array-into-iter-ambiguous.stderr @@ -2,7 +2,7 @@ warning: trait method `into_iter` will become ambiguous in Rust 2021 --> $DIR/array-into-iter-ambiguous.rs:24:13 | LL | let y = points.into_iter(); - | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `MyIntoIter::into_iter(points)` + | ^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2021 = note: for more information, see @@ -11,6 +11,10 @@ note: the lint level is defined here | LL | #![warn(array_into_iter)] | ^^^^^^^^^^^^^^^ +help: disambiguate the associated function + | +LL | let y = MyIntoIter::into_iter(points); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/rust-2021/future-prelude-collision-generic-trait.stderr b/tests/ui/rust-2021/future-prelude-collision-generic-trait.stderr index f38da132b5e87..517ddac966c6d 100644 --- a/tests/ui/rust-2021/future-prelude-collision-generic-trait.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-generic-trait.stderr @@ -2,7 +2,7 @@ warning: trait-associated function `try_from` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-generic-trait.rs:24:9 | LL | U::try_from(self) - | ^^^^^^^^^^^ help: disambiguate the associated function: `>::try_from` + | ^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see @@ -11,6 +11,10 @@ note: the lint level is defined here | LL | #![warn(rust_2021_prelude_collisions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function + | +LL | >::try_from(self) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/rust-2021/future-prelude-collision-generic.stderr b/tests/ui/rust-2021/future-prelude-collision-generic.stderr index 9893b3ebaa657..2cb1766b5666f 100644 --- a/tests/ui/rust-2021/future-prelude-collision-generic.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-generic.stderr @@ -2,7 +2,7 @@ warning: trait-associated function `from_iter` will become ambiguous in Rust 202 --> $DIR/future-prelude-collision-generic.rs:28:5 | LL | Generic::from_iter(1); - | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as MyFromIter>::from_iter` + | ^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see @@ -11,24 +11,36 @@ note: the lint level is defined here | LL | #![warn(rust_2021_prelude_collisions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function + | +LL | as MyFromIter>::from_iter(1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait-associated function `from_iter` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-generic.rs:31:5 | LL | Generic::<'static, i32>::from_iter(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as MyFromIter>::from_iter` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | as MyFromIter>::from_iter(1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait-associated function `from_iter` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-generic.rs:34:5 | LL | Generic::<'_, _>::from_iter(1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as MyFromIter>::from_iter` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | as MyFromIter>::from_iter(1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 3 warnings emitted diff --git a/tests/ui/rust-2021/future-prelude-collision-imported.stderr b/tests/ui/rust-2021/future-prelude-collision-imported.stderr index c1d72d0df2187..78bb665e2d7a5 100644 --- a/tests/ui/rust-2021/future-prelude-collision-imported.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-imported.stderr @@ -2,7 +2,7 @@ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-imported.rs:27:22 | LL | let _: u32 = 3u8.try_into().unwrap(); - | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)` + | ^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see @@ -11,33 +11,49 @@ note: the lint level is defined here | LL | #![warn(rust_2021_prelude_collisions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function + | +LL | let _: u32 = TryIntoU32::try_into(3u8).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-imported.rs:40:22 | LL | let _: u32 = 3u8.try_into().unwrap(); - | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `crate::m::TryIntoU32::try_into(3u8)` + | ^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _: u32 = crate::m::TryIntoU32::try_into(3u8).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-imported.rs:53:22 | LL | let _: u32 = 3u8.try_into().unwrap(); - | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `super::m::TryIntoU32::try_into(3u8)` + | ^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _: u32 = super::m::TryIntoU32::try_into(3u8).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-imported.rs:64:22 | LL | let _: u32 = 3u8.try_into().unwrap(); - | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)` + | ^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _: u32 = TryIntoU32::try_into(3u8).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 4 warnings emitted diff --git a/tests/ui/rust-2021/future-prelude-collision-macros.stderr b/tests/ui/rust-2021/future-prelude-collision-macros.stderr index 4d4a076995805..fa36edaa24f3b 100644 --- a/tests/ui/rust-2021/future-prelude-collision-macros.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-macros.stderr @@ -2,7 +2,7 @@ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-macros.rs:39:5 | LL | foo!().try_into(todo!()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `MyTry::try_into(foo!(), todo!())` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see @@ -11,15 +11,23 @@ note: the lint level is defined here | LL | #![warn(rust_2021_prelude_collisions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function + | +LL | MyTry::try_into(foo!(), todo!()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait-associated function `try_from` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-macros.rs:42:5 | LL | ::try_from(0); - | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `::try_from` + | ^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | ::try_from(0); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 2 warnings emitted diff --git a/tests/ui/rust-2021/future-prelude-collision-turbofish.stderr b/tests/ui/rust-2021/future-prelude-collision-turbofish.stderr index c0ef80fd84153..4bda9816b8309 100644 --- a/tests/ui/rust-2021/future-prelude-collision-turbofish.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-turbofish.stderr @@ -2,7 +2,7 @@ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-turbofish.rs:19:5 | LL | x.try_into::().or(Err("foo"))?.checked_sub(1); - | ^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `AnnotatableTryInto::try_into::(x)` + | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see @@ -11,15 +11,23 @@ note: the lint level is defined here | LL | #![warn(rust_2021_prelude_collisions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function + | +LL | AnnotatableTryInto::try_into::(x).or(Err("foo"))?.checked_sub(1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-turbofish.rs:23:5 | LL | x.try_into::().or(Err("foo"))?; - | ^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `AnnotatableTryInto::try_into::(x)` + | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | AnnotatableTryInto::try_into::(x).or(Err("foo"))?; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 2 warnings emitted diff --git a/tests/ui/rust-2021/future-prelude-collision.stderr b/tests/ui/rust-2021/future-prelude-collision.stderr index cae113ff7113b..49100e5ae3c15 100644 --- a/tests/ui/rust-2021/future-prelude-collision.stderr +++ b/tests/ui/rust-2021/future-prelude-collision.stderr @@ -2,7 +2,7 @@ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:56:18 | LL | let _: u32 = 3u8.try_into().unwrap(); - | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)` + | ^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see @@ -11,69 +11,101 @@ note: the lint level is defined here | LL | #![warn(rust_2021_prelude_collisions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function + | +LL | let _: u32 = TryIntoU32::try_into(3u8).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait-associated function `try_from` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:61:13 | LL | let _ = u32::try_from(3u8).unwrap(); - | ^^^^^^^^^^^^^ help: disambiguate the associated function: `::try_from` + | ^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _ = ::try_from(3u8).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait-associated function `from_iter` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:66:13 | LL | let _ = >::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter()); - | ^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as FromByteIterator>::from_iter` + | ^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _ = as FromByteIterator>::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait-associated function `try_from` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:74:18 | LL | let _: u32 = <_>::try_from(3u8).unwrap(); - | ^^^^^^^^^^^^^ help: disambiguate the associated function: `<_ as TryFromU8>::try_from` + | ^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _: u32 = <_ as TryFromU8>::try_from(3u8).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:79:18 | LL | let _: u32 = (&3u8).try_into().unwrap(); - | ^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(*(&3u8))` + | ^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _: u32 = TryIntoU32::try_into(*(&3u8)).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:84:18 | LL | let _: u32 = 3.0.try_into().unwrap(); - | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(&3.0)` + | ^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _: u32 = TryIntoU32::try_into(&3.0).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:90:18 | LL | let _: u32 = mut_ptr.try_into().unwrap(); - | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(mut_ptr as *const _)` + | ^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _: u32 = TryIntoU32::try_into(mut_ptr as *const _).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: trait-associated function `try_from` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:95:13 | LL | let _ = U32Alias::try_from(3u8).unwrap(); - | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `::try_from` + | ^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see +help: disambiguate the associated function + | +LL | let _ = ::try_from(3u8).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 8 warnings emitted diff --git a/tests/ui/rust-2021/generic-type-collision.stderr b/tests/ui/rust-2021/generic-type-collision.stderr index 1ec61044f4a57..ea56ce0d23f35 100644 --- a/tests/ui/rust-2021/generic-type-collision.stderr +++ b/tests/ui/rust-2021/generic-type-collision.stderr @@ -2,7 +2,7 @@ warning: trait-associated function `from_iter` will become ambiguous in Rust 202 --> $DIR/generic-type-collision.rs:15:5 | LL | >::from_iter(None); - | ^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as MyTrait<_>>::from_iter` + | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see @@ -11,6 +11,10 @@ note: the lint level is defined here | LL | #![warn(rust_2021_prelude_collisions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function + | +LL | as MyTrait<_>>::from_iter(None); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/rust-2021/inherent-dyn-collision.stderr b/tests/ui/rust-2021/inherent-dyn-collision.stderr index d9e720dd9af8f..26fdc1d525e44 100644 --- a/tests/ui/rust-2021/inherent-dyn-collision.stderr +++ b/tests/ui/rust-2021/inherent-dyn-collision.stderr @@ -2,7 +2,7 @@ warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/inherent-dyn-collision.rs:42:9 | LL | get_dyn_trait().try_into().unwrap() - | ^^^^^^^^^^^^^^^ help: disambiguate the method call: `(&*get_dyn_trait())` + | ^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see @@ -11,6 +11,10 @@ note: the lint level is defined here | LL | #![warn(rust_2021_prelude_collisions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the method call + | +LL | (&*get_dyn_trait()).try_into().unwrap() + | ~~~~~~~~~~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/rust-2024/box-slice-into-iter-ambiguous.stderr b/tests/ui/rust-2024/box-slice-into-iter-ambiguous.stderr index 9cc79a7b12947..19a86456421cf 100644 --- a/tests/ui/rust-2024/box-slice-into-iter-ambiguous.stderr +++ b/tests/ui/rust-2024/box-slice-into-iter-ambiguous.stderr @@ -2,7 +2,7 @@ warning: trait method `into_iter` will become ambiguous in Rust 2024 --> $DIR/box-slice-into-iter-ambiguous.rs:24:13 | LL | let y = points.into_iter(); - | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `MyIntoIter::into_iter(points)` + | ^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 note: the lint level is defined here @@ -10,6 +10,10 @@ note: the lint level is defined here | LL | #![warn(boxed_slice_into_iter)] | ^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function + | +LL | let y = MyIntoIter::into_iter(points); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/rust-2024/gen-kw.e2015.stderr b/tests/ui/rust-2024/gen-kw.e2015.stderr index b1074f77e0089..74ec616f7b681 100644 --- a/tests/ui/rust-2024/gen-kw.e2015.stderr +++ b/tests/ui/rust-2024/gen-kw.e2015.stderr @@ -2,7 +2,7 @@ error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:6:4 | LL | fn gen() {} - | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see issue #49716 @@ -12,24 +12,36 @@ note: the lint level is defined here LL | #![deny(rust_2024_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(keyword_idents_2024)]` implied by `#[deny(rust_2024_compatibility)]` +help: you can use a raw identifier to stay compatible + | +LL | fn r#gen() {} + | ~~~~~ error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:12:9 | LL | let gen = r#gen; - | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | let r#gen = r#gen; + | ~~~~~ error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:19:27 | LL | () => { mod test { fn gen() {} } } - | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` + | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | () => { mod test { fn r#gen() {} } } + | ~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/rust-2024/gen-kw.e2018.stderr b/tests/ui/rust-2024/gen-kw.e2018.stderr index b902cff7fdbc3..771aed181066a 100644 --- a/tests/ui/rust-2024/gen-kw.e2018.stderr +++ b/tests/ui/rust-2024/gen-kw.e2018.stderr @@ -2,7 +2,7 @@ error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:6:4 | LL | fn gen() {} - | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` + | ^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! = note: for more information, see issue #49716 @@ -12,24 +12,36 @@ note: the lint level is defined here LL | #![deny(rust_2024_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(keyword_idents_2024)]` implied by `#[deny(rust_2024_compatibility)]` +help: you can use a raw identifier to stay compatible + | +LL | fn r#gen() {} + | ~~~~~ error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:12:9 | LL | let gen = r#gen; - | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` + | ^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | let r#gen = r#gen; + | ~~~~~ error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:19:27 | LL | () => { mod test { fn gen() {} } } - | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` + | ^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! = note: for more information, see issue #49716 +help: you can use a raw identifier to stay compatible + | +LL | () => { mod test { fn r#gen() {} } } + | ~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/rust-2024/unsafe-extern-blocks/unsafe-extern-suggestion.stderr b/tests/ui/rust-2024/unsafe-extern-blocks/unsafe-extern-suggestion.stderr index 0a3c2cd25e3fe..f1d52bdfcfd77 100644 --- a/tests/ui/rust-2024/unsafe-extern-blocks/unsafe-extern-suggestion.stderr +++ b/tests/ui/rust-2024/unsafe-extern-blocks/unsafe-extern-suggestion.stderr @@ -1,11 +1,7 @@ error: extern blocks should be unsafe --> $DIR/unsafe-extern-suggestion.rs:7:1 | -LL | extern "C" { - | ^ - | | - | _help: needs `unsafe` before the extern keyword: `unsafe` - | | +LL | / extern "C" { LL | | LL | | LL | | static TEST1: i32; @@ -20,6 +16,10 @@ note: the lint level is defined here | LL | #![deny(missing_unsafe_on_extern)] | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: needs `unsafe` before the extern keyword + | +LL | unsafe extern "C" { + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/cfi-invalid-attr-cfi-encoding.stderr b/tests/ui/sanitizer/cfi-invalid-attr-cfi-encoding.stderr index 93ec134241e31..81b18dd5549a6 100644 --- a/tests/ui/sanitizer/cfi-invalid-attr-cfi-encoding.stderr +++ b/tests/ui/sanitizer/cfi-invalid-attr-cfi-encoding.stderr @@ -2,7 +2,12 @@ error: malformed `cfi_encoding` attribute input --> $DIR/cfi-invalid-attr-cfi-encoding.rs:10:1 | LL | #[cfi_encoding] - | ^^^^^^^^^^^^^^^ help: must be of the form: `#[cfi_encoding = "encoding"]` + | ^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[cfi_encoding = "encoding"] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr b/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr index fdd18c6b37b5c..003ba9615d779 100644 --- a/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr +++ b/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr @@ -1,9 +1,6 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/arbitrary-self-types-not-object-safe.rs:33:32 | -LL | fn foo(self: &Rc) -> usize; - | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` -... LL | let x = Rc::new(5usize) as Rc; | ^^^^^^^^^^^ `Foo` cannot be made into an object | @@ -15,13 +12,14 @@ LL | trait Foo { LL | fn foo(self: &Rc) -> usize; | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on = help: only type `usize` implements the trait, consider using it directly instead +help: consider changing method `foo`'s `self` parameter to be `&self` + | +LL | fn foo(self: &Self) -> usize; + | ~~~~~ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/arbitrary-self-types-not-object-safe.rs:33:13 | -LL | fn foo(self: &Rc) -> usize; - | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` -... LL | let x = Rc::new(5usize) as Rc; | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object | @@ -34,6 +32,10 @@ LL | fn foo(self: &Rc) -> usize; | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on = help: only type `usize` implements the trait, consider using it directly instead = note: required for the cast from `Rc` to `Rc` +help: consider changing method `foo`'s `self` parameter to be `&self` + | +LL | fn foo(self: &Self) -> usize; + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr b/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr index 363ba072c8169..d88271e0d1373 100644 --- a/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr +++ b/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr @@ -1,9 +1,6 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/arbitrary-self-types-not-object-safe.rs:33:13 | -LL | fn foo(self: &Rc) -> usize; - | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` -... LL | let x = Rc::new(5usize) as Rc; | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object | @@ -16,6 +13,10 @@ LL | fn foo(self: &Rc) -> usize; | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on = help: only type `usize` implements the trait, consider using it directly instead = note: required for the cast from `Rc` to `Rc` +help: consider changing method `foo`'s `self` parameter to be `&self` + | +LL | fn foo(self: &Self) -> usize; + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/self/self-ctor-nongeneric.stderr b/tests/ui/self/self-ctor-nongeneric.stderr index 6c03c6f3e38a4..82a51c12c5315 100644 --- a/tests/ui/self/self-ctor-nongeneric.stderr +++ b/tests/ui/self/self-ctor-nongeneric.stderr @@ -5,11 +5,15 @@ LL | impl S0 { | ------- the inner item doesn't inherit generics from this impl, so `Self` is invalid to reference LL | fn foo() { LL | const C: S0 = Self(0); - | ^^^^ help: replace `Self` with the actual type: `S0` + | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124186 = note: `#[warn(self_constructor_from_outer_item)]` on by default +help: replace `Self` with the actual type + | +LL | const C: S0 = S0(0); + | ~~ warning: can't reference `Self` constructor from outer item --> $DIR/self-ctor-nongeneric.rs:12:13 @@ -18,10 +22,14 @@ LL | impl S0 { | ------- the inner item doesn't inherit generics from this impl, so `Self` is invalid to reference ... LL | Self(0) - | ^^^^ help: replace `Self` with the actual type: `S0` + | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124186 +help: replace `Self` with the actual type + | +LL | S0(0) + | ~~ warning: 2 warnings emitted diff --git a/tests/ui/self/self-ctor.stderr b/tests/ui/self/self-ctor.stderr index 0cb22baaa1a05..f406b0197ffc9 100644 --- a/tests/ui/self/self-ctor.stderr +++ b/tests/ui/self/self-ctor.stderr @@ -5,7 +5,12 @@ LL | impl S0 { | ------------- the inner item doesn't inherit generics from this impl, so `Self` is invalid to reference LL | fn foo() { LL | const C: S0 = Self(0); - | ^^^^ help: replace `Self` with the actual type: `S0` + | ^^^^ + | +help: replace `Self` with the actual type + | +LL | const C: S0 = S0(0); + | ~~ error[E0401]: can't reference `Self` constructor from outer item --> $DIR/self-ctor.rs:8:13 @@ -14,7 +19,12 @@ LL | impl S0 { | ------------- the inner item doesn't inherit generics from this impl, so `Self` is invalid to reference ... LL | Self(0) - | ^^^^ help: replace `Self` with the actual type: `S0` + | ^^^^ + | +help: replace `Self` with the actual type + | +LL | S0(0) + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/self/self-impl.stderr b/tests/ui/self/self-impl.stderr index 18ffd15427f81..619e2e62abb08 100644 --- a/tests/ui/self/self-impl.stderr +++ b/tests/ui/self/self-impl.stderr @@ -2,13 +2,23 @@ error[E0223]: ambiguous associated type --> $DIR/self-impl.rs:23:16 | LL | let _: ::Baz = true; - | ^^^^^^^^^^^ help: use fully-qualified syntax: `::Baz` + | ^^^^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | let _: ::Baz = true; + | ~~~~~~~~~~~~~~~~~ error[E0223]: ambiguous associated type --> $DIR/self-impl.rs:25:16 | LL | let _: Self::Baz = true; - | ^^^^^^^^^ help: use fully-qualified syntax: `::Baz` + | ^^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | let _: ::Baz = true; + | ~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/self/self-vs-path-ambiguity.stderr b/tests/ui/self/self-vs-path-ambiguity.stderr index 9e140e21023f3..c2d846e2bb4ea 100644 --- a/tests/ui/self/self-vs-path-ambiguity.stderr +++ b/tests/ui/self/self-vs-path-ambiguity.stderr @@ -2,7 +2,13 @@ error: unexpected lifetime `'a` in pattern --> $DIR/self-vs-path-ambiguity.rs:9:11 | LL | fn i(&'a self::S: &S) {} - | ^^ help: remove the lifetime + | ^^ + | +help: remove the lifetime + | +LL - fn i(&'a self::S: &S) {} +LL + fn i(& self::S: &S) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/self/self_type_keyword.stderr b/tests/ui/self/self_type_keyword.stderr index 4909a9cdc7f5c..8298293a8cbbc 100644 --- a/tests/ui/self/self_type_keyword.stderr +++ b/tests/ui/self/self_type_keyword.stderr @@ -14,9 +14,14 @@ error: `mut` must be followed by a named binding --> $DIR/self_type_keyword.rs:16:9 | LL | mut Self => (), - | ^^^^ help: remove the `mut` prefix + | ^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: remove the `mut` prefix + | +LL - mut Self => (), +LL + Self => (), + | error: expected identifier, found keyword `Self` --> $DIR/self_type_keyword.rs:19:17 diff --git a/tests/ui/self/suggest-self-2.stderr b/tests/ui/self/suggest-self-2.stderr index 4bd025ea07630..80c29563ec73d 100644 --- a/tests/ui/self/suggest-self-2.stderr +++ b/tests/ui/self/suggest-self-2.stderr @@ -2,25 +2,34 @@ error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:5:9 | LL | bar(self); - | ^^^------ - | | - | help: try calling `bar` as a method: `self.bar()` + | ^^^ + | +help: try calling `bar` as a method + | +LL | self.bar(); + | ~~~~~~~~~~ error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:9:9 | LL | bar(&&self, 102); - | ^^^------------- - | | - | help: try calling `bar` as a method: `self.bar(102)` + | ^^^ + | +help: try calling `bar` as a method + | +LL | self.bar(102); + | ~~~~~~~~~~~~~ error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:13:9 | LL | bar(&mut self, 102, &"str"); - | ^^^------------------------ - | | - | help: try calling `bar` as a method: `self.bar(102, &"str")` + | ^^^ + | +help: try calling `bar` as a method + | +LL | self.bar(102, &"str"); + | ~~~~~~~~~~~~~~~~~~~~~ error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:17:9 diff --git a/tests/ui/self/suggest-self.stderr b/tests/ui/self/suggest-self.stderr index 0d38b9d87c5e8..8ad287f11958b 100644 --- a/tests/ui/self/suggest-self.stderr +++ b/tests/ui/self/suggest-self.stderr @@ -2,28 +2,34 @@ error[E0425]: cannot find value `this` in this scope --> $DIR/suggest-self.rs:21:9 | LL | this.x - | ^^^^ - | | - | not found in this scope - | help: you might have meant to use `self` here instead + | ^^^^ not found in this scope + | +help: you might have meant to use `self` here instead + | +LL | self.x + | ~~~~ error[E0425]: cannot find value `this` in this scope --> $DIR/suggest-self.rs:26:9 | LL | this.foo() - | ^^^^ - | | - | not found in this scope - | help: you might have meant to use `self` here instead + | ^^^^ not found in this scope + | +help: you might have meant to use `self` here instead + | +LL | self.foo() + | ~~~~ error[E0425]: cannot find value `my` in this scope --> $DIR/suggest-self.rs:31:9 | LL | my.bar() - | ^^ - | | - | not found in this scope - | help: you might have meant to use `self` here instead + | ^^ not found in this scope + | +help: you might have meant to use `self` here instead + | +LL | self.bar() + | ~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/seq-args.stderr b/tests/ui/seq-args.stderr index a5b0f8e98dca0..bb46a11d90262 100644 --- a/tests/ui/seq-args.stderr +++ b/tests/ui/seq-args.stderr @@ -2,29 +2,35 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/seq-args.rs:4:13 | LL | impl Seq for Vec { - | ^^^--- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/seq-args.rs:2:11 | LL | trait Seq { } | ^^^ +help: remove these generics + | +LL - impl Seq for Vec { +LL + impl Seq for Vec { + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/seq-args.rs:9:10 | LL | impl Seq for u32 { - | ^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/seq-args.rs:2:11 | LL | trait Seq { } | ^^^ +help: remove these generics + | +LL - impl Seq for u32 { +LL + impl Seq for u32 { + | error: aborting due to 2 previous errors diff --git a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr index a6f27af428b51..8a9dbfeac4ec1 100644 --- a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr +++ b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr @@ -2,10 +2,12 @@ error[E0433]: failed to resolve: maybe a missing crate `core`? --> $DIR/portable-intrinsics-arent-exposed.rs:4:5 | LL | use core::simd::intrinsics; - | ^^^^ - | | - | maybe a missing crate `core`? - | help: try using `std` instead of `core`: `std` + | ^^^^ maybe a missing crate `core`? + | +help: try using `std` instead of `core` + | +LL | use std::simd::intrinsics; + | ~~~ error[E0432]: unresolved import `std::simd::intrinsics` --> $DIR/portable-intrinsics-arent-exposed.rs:5:5 diff --git a/tests/ui/single-use-lifetime/issue-107998.stderr b/tests/ui/single-use-lifetime/issue-107998.stderr index e870351de9eae..8b5089a1afcd8 100644 --- a/tests/ui/single-use-lifetime/issue-107998.stderr +++ b/tests/ui/single-use-lifetime/issue-107998.stderr @@ -14,10 +14,8 @@ error: lifetime parameter `'a` only used once --> $DIR/issue-107998.rs:3:19 | LL | fn with(f: &fn<'a>(x: &'a i32) -> R) -> R { - | ^^ --- - | | | - | | ...is used only here - | | help: elide the single-use lifetime + | ^^ -- ...is used only here + | | | this lifetime... | note: the lint level is defined here @@ -25,6 +23,11 @@ note: the lint level is defined here | LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ +help: elide the single-use lifetime + | +LL - fn with(f: &fn<'a>(x: &'a i32) -> R) -> R { +LL + fn with(f: &fn<'a>(x: &i32) -> R) -> R { + | error: aborting due to 2 previous errors diff --git a/tests/ui/single-use-lifetime/zero-uses-in-fn.stderr b/tests/ui/single-use-lifetime/zero-uses-in-fn.stderr index 59c0164e32414..52b02cf06436b 100644 --- a/tests/ui/single-use-lifetime/zero-uses-in-fn.stderr +++ b/tests/ui/single-use-lifetime/zero-uses-in-fn.stderr @@ -2,29 +2,42 @@ error: lifetime parameter `'a` never used --> $DIR/zero-uses-in-fn.rs:8:14 | LL | fn september<'a>() {} - | -^^- help: elide the unused lifetime + | ^^ | note: the lint level is defined here --> $DIR/zero-uses-in-fn.rs:5:9 | LL | #![deny(unused_lifetimes)] | ^^^^^^^^^^^^^^^^ +help: elide the unused lifetime + | +LL - fn september<'a>() {} +LL + fn september() {} + | error: lifetime parameter `'a` never used --> $DIR/zero-uses-in-fn.rs:12:12 | LL | fn october<'a, 'b, T>(s: &'b T) -> &'b T { - | ^^-- - | | - | help: elide the unused lifetime + | ^^ + | +help: elide the unused lifetime + | +LL - fn october<'a, 'b, T>(s: &'b T) -> &'b T { +LL + fn october<'b, T>(s: &'b T) -> &'b T { + | error: lifetime parameter `'b` never used --> $DIR/zero-uses-in-fn.rs:18:17 | LL | fn november<'a, 'b>(s: &'a str) -> &'a str { - | --^^ - | | - | help: elide the unused lifetime + | ^^ + | +help: elide the unused lifetime + | +LL - fn november<'a, 'b>(s: &'a str) -> &'a str { +LL + fn november<'a>(s: &'a str) -> &'a str { + | error: aborting due to 3 previous errors diff --git a/tests/ui/single-use-lifetime/zero-uses-in-impl.stderr b/tests/ui/single-use-lifetime/zero-uses-in-impl.stderr index 554a19afbcd32..1fd33900b5669 100644 --- a/tests/ui/single-use-lifetime/zero-uses-in-impl.stderr +++ b/tests/ui/single-use-lifetime/zero-uses-in-impl.stderr @@ -2,13 +2,18 @@ error: lifetime parameter `'a` never used --> $DIR/zero-uses-in-impl.rs:8:6 | LL | impl<'a> Foo {} - | -^^- help: elide the unused lifetime + | ^^ | note: the lint level is defined here --> $DIR/zero-uses-in-impl.rs:3:9 | LL | #![deny(unused_lifetimes)] | ^^^^^^^^^^^^^^^^ +help: elide the unused lifetime + | +LL - impl<'a> Foo {} +LL + impl Foo {} + | error: aborting due to 1 previous error diff --git a/tests/ui/span/impl-wrong-item-for-trait.stderr b/tests/ui/span/impl-wrong-item-for-trait.stderr index f919092f9ee92..1fb17fbc04ae8 100644 --- a/tests/ui/span/impl-wrong-item-for-trait.stderr +++ b/tests/ui/span/impl-wrong-item-for-trait.stderr @@ -58,7 +58,10 @@ error[E0046]: not all trait items implemented, missing: `fmt` LL | impl Debug for FooTypeForMethod {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | - = help: implement the missing item: `fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { todo!() }` +help: implement the missing item + | +LL | impl Debug for FooTypeForMethod {fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { todo!() } + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 7 previous errors diff --git a/tests/ui/span/issue-23729.stderr b/tests/ui/span/issue-23729.stderr index 6baec60d50c6c..2d7c1de8f8840 100644 --- a/tests/ui/span/issue-23729.stderr +++ b/tests/ui/span/issue-23729.stderr @@ -4,7 +4,11 @@ error[E0046]: not all trait items implemented, missing: `Item` LL | impl Iterator for Recurrence { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Item` in implementation | - = help: implement the missing item: `type Item = /* Type */;` +help: implement the missing item + | +LL ~ type Item = /* Type */; +LL ~ } + | error: aborting due to 1 previous error diff --git a/tests/ui/span/issue-23827.stderr b/tests/ui/span/issue-23827.stderr index 56f449ab08bf5..1c6484d560b45 100644 --- a/tests/ui/span/issue-23827.stderr +++ b/tests/ui/span/issue-23827.stderr @@ -4,7 +4,10 @@ error[E0046]: not all trait items implemented, missing: `Output` LL | impl FnOnce<(C,)> for Prototype { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Output` in implementation | - = help: implement the missing item: `type Output = /* Type */;` +help: implement the missing item + | +LL + type Output = /* Type */; + | error: aborting due to 1 previous error diff --git a/tests/ui/span/issue-24356.stderr b/tests/ui/span/issue-24356.stderr index 609991f2b5b0f..93e2fa39b067c 100644 --- a/tests/ui/span/issue-24356.stderr +++ b/tests/ui/span/issue-24356.stderr @@ -4,7 +4,11 @@ error[E0046]: not all trait items implemented, missing: `Target` LL | impl Deref for Thing { | ^^^^^^^^^^^^^^^^^^^^ missing `Target` in implementation | - = help: implement the missing item: `type Target = /* Type */;` +help: implement the missing item + | +LL ~ type Target = /* Type */; +LL ~ } + | error: aborting due to 1 previous error diff --git a/tests/ui/span/issue-24690.stderr b/tests/ui/span/issue-24690.stderr index 73e166e6403e4..029673f2acaf2 100644 --- a/tests/ui/span/issue-24690.stderr +++ b/tests/ui/span/issue-24690.stderr @@ -2,7 +2,7 @@ warning: unused variable: `theOtherTwo` --> $DIR/issue-24690.rs:13:9 | LL | let theOtherTwo = 2; - | ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_theOtherTwo` + | ^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/issue-24690.rs:8:9 @@ -10,20 +10,33 @@ note: the lint level is defined here LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` +help: if this is intentional, prefix it with an underscore + | +LL | let _theOtherTwo = 2; + | ~~~~~~~~~~~~ warning: variable `theTwo` should have a snake case name --> $DIR/issue-24690.rs:12:9 | LL | let theTwo = 2; - | ^^^^^^ help: convert the identifier to snake case: `the_two` + | ^^^^^^ | = note: `#[warn(non_snake_case)]` on by default +help: convert the identifier to snake case + | +LL | let the_two = 2; + | ~~~~~~~ warning: variable `theOtherTwo` should have a snake case name --> $DIR/issue-24690.rs:13:9 | LL | let theOtherTwo = 2; - | ^^^^^^^^^^^ help: convert the identifier to snake case: `the_other_two` + | ^^^^^^^^^^^ + | +help: convert the identifier to snake case + | +LL | let the_other_two = 2; + | ~~~~~~~~~~~~~ warning: 3 warnings emitted diff --git a/tests/ui/span/issue-34264.stderr b/tests/ui/span/issue-34264.stderr index f0dea66f6128d..89c67719b5ae2 100644 --- a/tests/ui/span/issue-34264.stderr +++ b/tests/ui/span/issue-34264.stderr @@ -54,16 +54,18 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/issue-34264.rs:7:5 | LL | foo(Some(42), 2, ""); - | ^^^ ---- - | | | - | | unexpected argument of type `&'static str` - | help: remove the extra argument + | ^^^ -- unexpected argument of type `&'static str` | note: function defined here --> $DIR/issue-34264.rs:1:4 | LL | fn foo(Option, String) {} | ^^^ ----------- ------ +help: remove the extra argument + | +LL - foo(Some(42), 2, ""); +LL + foo(Some(42), 2); + | error[E0308]: mismatched types --> $DIR/issue-34264.rs:8:13 @@ -83,16 +85,18 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/issue-34264.rs:10:5 | LL | bar(1, 2, 3); - | ^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^ - unexpected argument of type `{integer}` | note: function defined here --> $DIR/issue-34264.rs:3:4 | LL | fn bar(x, y: usize) {} | ^^^ - -------- +help: remove the extra argument + | +LL - bar(1, 2, 3); +LL + bar(1, 2); + | error: aborting due to 6 previous errors diff --git a/tests/ui/span/suggestion-non-ascii.stderr b/tests/ui/span/suggestion-non-ascii.stderr index 6e6e31a5698b8..deccf6f2fff50 100644 --- a/tests/ui/span/suggestion-non-ascii.stderr +++ b/tests/ui/span/suggestion-non-ascii.stderr @@ -2,7 +2,12 @@ error[E0608]: cannot index into a value of type `({integer},)` --> $DIR/suggestion-non-ascii.rs:3:24 | LL | println!("☃{}", tup[0]); - | ^^^ help: to access tuple elements, use: `.0` + | ^^^ + | +help: to access tuple elements, use + | +LL | println!("☃{}", tup.0); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/span/suggestion-raw-68962.stderr b/tests/ui/span/suggestion-raw-68962.stderr index 2e25f5cbdf58d..220ddc1fe1f55 100644 --- a/tests/ui/span/suggestion-raw-68962.stderr +++ b/tests/ui/span/suggestion-raw-68962.stderr @@ -2,7 +2,12 @@ error[E0425]: cannot find value `fina` in this scope --> $DIR/suggestion-raw-68962.rs:7:5 | LL | fina; - | ^^^^ help: a local variable with a similar name exists: `r#final` + | ^^^^ + | +help: a local variable with a similar name exists + | +LL | r#final; + | ~~~~~~~ error[E0425]: cannot find function `f` in this scope --> $DIR/suggestion-raw-68962.rs:10:5 @@ -11,7 +16,12 @@ LL | fn r#fn() {} | --------- similarly named function `r#fn` defined here ... LL | f(); - | ^ help: a function with a similar name exists: `r#fn` + | ^ + | +help: a function with a similar name exists + | +LL | r#fn(); + | ~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/span/type-binding.stderr b/tests/ui/span/type-binding.stderr index 5df74fa2fa2da..416556968189d 100644 --- a/tests/ui/span/type-binding.stderr +++ b/tests/ui/span/type-binding.stderr @@ -2,7 +2,12 @@ error[E0220]: associated type `Trget` not found for `Deref` --> $DIR/type-binding.rs:6:20 | LL | fn homura>(_: T) {} - | ^^^^^ help: there is an associated type with a similar name: `Target` + | ^^^^^ + | +help: there is an associated type with a similar name + | +LL | fn homura>(_: T) {} + | ~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/span/typo-suggestion.stderr b/tests/ui/span/typo-suggestion.stderr index 61d4e06119c4f..107bfb7fb8968 100644 --- a/tests/ui/span/typo-suggestion.stderr +++ b/tests/ui/span/typo-suggestion.stderr @@ -8,7 +8,12 @@ error[E0425]: cannot find value `fob` in this scope --> $DIR/typo-suggestion.rs:8:26 | LL | println!("Hello {}", fob); - | ^^^ help: a local variable with a similar name exists: `foo` + | ^^^ + | +help: a local variable with a similar name exists + | +LL | println!("Hello {}", foo); + | ~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/specialization/specialization-default-projection.stderr b/tests/ui/specialization/specialization-default-projection.stderr index b8b81876d8131..38ef943ca78a6 100644 --- a/tests/ui/specialization/specialization-default-projection.stderr +++ b/tests/ui/specialization/specialization-default-projection.stderr @@ -29,14 +29,16 @@ LL | fn monomorphic() -> () { | -- expected `()` because of return type ... LL | generic::<()>() - | ^^^^^^^^^^^^^^^- help: consider using a semicolon here: `;` - | | - | expected `()`, found associated type + | ^^^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<() as Foo>::Assoc` = help: consider constraining the associated type `<() as Foo>::Assoc` to `()` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +help: consider using a semicolon here + | +LL | generic::<()>(); + | + error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/stability-attribute/issue-109177.stderr b/tests/ui/stability-attribute/issue-109177.stderr index 9c2ac591ace05..dab96a1ccb48a 100644 --- a/tests/ui/stability-attribute/issue-109177.stderr +++ b/tests/ui/stability-attribute/issue-109177.stderr @@ -2,12 +2,17 @@ error[E0425]: cannot find function `foo1` in crate `similar_unstable_method` --> $DIR/issue-109177.rs:7:30 | LL | similar_unstable_method::foo1(); - | ^^^^ help: a function with a similar name exists: `foo` + | ^^^^ | ::: $DIR/auxiliary/similar-unstable-method.rs:5:1 | LL | pub fn foo() {} | ------------ similarly named function `foo` defined here + | +help: a function with a similar name exists + | +LL | similar_unstable_method::foo(); + | ~~~ error[E0599]: no method named `foo1` found for struct `Foo` in the current scope --> $DIR/issue-109177.rs:11:9 diff --git a/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr b/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr index 8ead943ffe3a1..e2c8a099d234c 100644 --- a/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr +++ b/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr @@ -2,25 +2,45 @@ error: malformed `unstable` attribute input --> $DIR/stability-attribute-sanity-4.rs:8:5 | LL | #[unstable] - | ^^^^^^^^^^^ help: must be of the form: `#[unstable(feature = "name", reason = "...", issue = "N")]` + | ^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[unstable(feature = "name", reason = "...", issue = "N")] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `unstable` attribute input --> $DIR/stability-attribute-sanity-4.rs:11:5 | LL | #[unstable = "b"] - | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[unstable(feature = "name", reason = "...", issue = "N")]` + | ^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[unstable(feature = "name", reason = "...", issue = "N")] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `stable` attribute input --> $DIR/stability-attribute-sanity-4.rs:14:5 | LL | #[stable] - | ^^^^^^^^^ help: must be of the form: `#[stable(feature = "name", since = "version")]` + | ^^^^^^^^^ + | +help: must be of the form + | +LL | #[stable(feature = "name", since = "version")] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: malformed `stable` attribute input --> $DIR/stability-attribute-sanity-4.rs:17:5 | LL | #[stable = "a"] - | ^^^^^^^^^^^^^^^ help: must be of the form: `#[stable(feature = "name", since = "version")]` + | ^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[stable(feature = "name", since = "version")] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0542]: missing 'since' --> $DIR/stability-attribute-sanity-4.rs:21:5 diff --git a/tests/ui/stability-attribute/stability-attribute-sanity.stderr b/tests/ui/stability-attribute/stability-attribute-sanity.stderr index c614fc2b9f7fa..302f99e56a929 100644 --- a/tests/ui/stability-attribute/stability-attribute-sanity.stderr +++ b/tests/ui/stability-attribute/stability-attribute-sanity.stderr @@ -2,13 +2,18 @@ error: multiple `deprecated` attributes --> $DIR/stability-attribute-sanity.rs:62:1 | LL | #[deprecated(since = "5.5.5", note = "text")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: attribute also specified here --> $DIR/stability-attribute-sanity.rs:61:1 | LL | #[deprecated(since = "5.5.5", note = "text")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this attribute + | +LL - #[deprecated(since = "5.5.5", note = "text")] +LL + + | error[E0541]: unknown meta item 'reason' --> $DIR/stability-attribute-sanity.rs:8:46 diff --git a/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr b/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr index d7fcba4ced55d..11362ba518ed7 100644 --- a/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr +++ b/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr @@ -2,13 +2,15 @@ error[E0658]: use of unstable library feature 'allocator_api' --> $DIR/suggest-vec-allocator-api.rs:2:20 | LL | let _: Vec = vec![]; - | ----^ - | | - | help: consider wrapping the inner types in tuple: `(u8, _)` + | ^ | = note: see issue #32838 for more information = help: add `#![feature(allocator_api)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider wrapping the inner types in tuple + | +LL | let _: Vec<(u8, _)> = vec![]; + | ~~~~~~~ error[E0658]: use of unstable library feature 'allocator_api' --> $DIR/suggest-vec-allocator-api.rs:6:9 @@ -40,13 +42,15 @@ error[E0658]: use of unstable library feature 'allocator_api' --> $DIR/suggest-vec-allocator-api.rs:7:24 | LL | let _ = Vec::::new(); - | -----^ - | | - | help: consider wrapping the inner types in tuple: `(u16, _)` + | ^ | = note: see issue #32838 for more information = help: add `#![feature(allocator_api)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: consider wrapping the inner types in tuple + | +LL | let _ = Vec::<(u16, _)>::new(); + | ~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/static/bad-const-type.stderr b/tests/ui/static/bad-const-type.stderr index 807cd2f7a25a7..8573a11ef2912 100644 --- a/tests/ui/static/bad-const-type.stderr +++ b/tests/ui/static/bad-const-type.stderr @@ -2,9 +2,12 @@ error[E0308]: mismatched types --> $DIR/bad-const-type.rs:1:20 | LL | static i: String = 10; - | ^^- help: try using a conversion method: `.to_string()` - | | - | expected `String`, found integer + | ^^ expected `String`, found integer + | +help: try using a conversion method + | +LL | static i: String = 10.to_string(); + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/static/static-reference-to-fn-2.stderr b/tests/ui/static/static-reference-to-fn-2.stderr index 133d8ec2e1e51..15ae00c6527b9 100644 --- a/tests/ui/static/static-reference-to-fn-2.stderr +++ b/tests/ui/static/static-reference-to-fn-2.stderr @@ -41,7 +41,10 @@ LL | | statefn: &id(state1 as StateMachineFunc) LL | | } | |_____^ returns a value referencing data owned by the current function | - = help: use `.collect()` to allocate the iterator +help: use `.collect()` to allocate the iterator + | +LL | }.collect::>() + | ++++++++++++++++++++ error: aborting due to 4 previous errors diff --git a/tests/ui/structs/struct-duplicate-comma.stderr b/tests/ui/structs/struct-duplicate-comma.stderr index 4ac3fc9fe6b24..dc1c6ae871655 100644 --- a/tests/ui/structs/struct-duplicate-comma.stderr +++ b/tests/ui/structs/struct-duplicate-comma.stderr @@ -4,10 +4,13 @@ error: expected identifier, found `,` LL | let _ = Foo { | --- while parsing this struct LL | a: 0,, - | ^ - | | - | expected identifier - | help: remove this comma + | ^ expected identifier + | +help: remove this comma + | +LL - a: 0,, +LL + a: 0, + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-field-init-syntax.stderr b/tests/ui/structs/struct-field-init-syntax.stderr index 0b72c5cf734c6..66098d5f610ed 100644 --- a/tests/ui/structs/struct-field-init-syntax.stderr +++ b/tests/ui/structs/struct-field-init-syntax.stderr @@ -2,17 +2,27 @@ error: cannot use a comma after the base struct --> $DIR/struct-field-init-syntax.rs:11:9 | LL | ..Foo::default(), - | ^^^^^^^^^^^^^^^^- help: remove this comma + | ^^^^^^^^^^^^^^^^ | = note: the base struct must always be the last field +help: remove this comma + | +LL - ..Foo::default(), +LL + ..Foo::default() + | error: cannot use a comma after the base struct --> $DIR/struct-field-init-syntax.rs:16:9 | LL | ..Foo::default(), - | ^^^^^^^^^^^^^^^^- help: remove this comma + | ^^^^^^^^^^^^^^^^ | = note: the base struct must always be the last field +help: remove this comma + | +LL - ..Foo::default(), +LL + ..Foo::default() + | error: aborting due to 2 previous errors diff --git a/tests/ui/structs/struct-fields-shorthand-unresolved.stderr b/tests/ui/structs/struct-fields-shorthand-unresolved.stderr index b485c17c1b270..d20574e1d827e 100644 --- a/tests/ui/structs/struct-fields-shorthand-unresolved.stderr +++ b/tests/ui/structs/struct-fields-shorthand-unresolved.stderr @@ -2,7 +2,12 @@ error[E0425]: cannot find value `y` in this scope --> $DIR/struct-fields-shorthand-unresolved.rs:10:9 | LL | y - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL | x + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-missing-comma.stderr b/tests/ui/structs/struct-missing-comma.stderr index 4fdd47a480651..4f5c2a53cbab1 100644 --- a/tests/ui/structs/struct-missing-comma.stderr +++ b/tests/ui/structs/struct-missing-comma.stderr @@ -2,7 +2,12 @@ error: expected `,`, or `}`, found keyword `pub` --> $DIR/struct-missing-comma.rs:5:17 | LL | pub foo: u32 - | ^ help: try adding a comma: `,` + | ^ + | +help: try adding a comma + | +LL | pub foo: u32, + | + error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-path-associated-type.stderr b/tests/ui/structs/struct-path-associated-type.stderr index 0c9d2aad5d827..fab2178c60427 100644 --- a/tests/ui/structs/struct-path-associated-type.stderr +++ b/tests/ui/structs/struct-path-associated-type.stderr @@ -8,15 +8,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/struct-path-associated-type.rs:14:16 | LL | let z = T::A:: {}; - | ^------ help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/struct-path-associated-type.rs:4:10 | LL | type A; | ^ +help: remove these generics + | +LL - let z = T::A:: {}; +LL + let z = T::A {}; + | error[E0071]: expected struct, variant or union type, found associated type --> $DIR/struct-path-associated-type.rs:14:13 @@ -34,33 +37,51 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/struct-path-associated-type.rs:25:16 | LL | let z = T::A:: {}; - | ^------ help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/struct-path-associated-type.rs:4:10 | LL | type A; | ^ +help: remove these generics + | +LL - let z = T::A:: {}; +LL + let z = T::A {}; + | error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:32:13 | LL | let s = S::A {}; - | ^^^^ help: use fully-qualified syntax: `::A` + | ^^^^ + | +help: use fully-qualified syntax + | +LL | let s = ::A {}; + | ~~~~~~~~~~~~ error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:33:13 | LL | let z = S::A:: {}; - | ^^^^ help: use fully-qualified syntax: `::A` + | ^^^^ + | +help: use fully-qualified syntax + | +LL | let z = ::A:: {}; + | ~~~~~~~~~~~~ error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:35:9 | LL | S::A {} => {} - | ^^^^ help: use fully-qualified syntax: `::A` + | ^^^^ + | +help: use fully-qualified syntax + | +LL | ::A {} => {} + | ~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/structs/structure-constructor-type-mismatch.stderr b/tests/ui/structs/structure-constructor-type-mismatch.stderr index cb9574873473f..50ebd86a2166e 100644 --- a/tests/ui/structs/structure-constructor-type-mismatch.stderr +++ b/tests/ui/structs/structure-constructor-type-mismatch.stderr @@ -68,15 +68,18 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/structure-constructor-type-mismatch.rs:48:15 | LL | let pt3 = PointF:: { - | ^^^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/structure-constructor-type-mismatch.rs:6:6 | LL | type PointF = Point; | ^^^^^^ +help: remove these generics + | +LL - let pt3 = PointF:: { +LL + let pt3 = PointF { + | error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:49:12 @@ -104,15 +107,18 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/structure-constructor-type-mismatch.rs:54:9 | LL | PointF:: { .. } => {} - | ^^^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/structure-constructor-type-mismatch.rs:6:6 | LL | type PointF = Point; | ^^^^^^ +help: remove these generics + | +LL - PointF:: { .. } => {} +LL + PointF { .. } => {} + | error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:54:9 diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index e8503f540c288..9a883bbd81fe5 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -2,10 +2,12 @@ error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:10:23 | LL | Foo::Bar { a, aa: 1, c } => (), - | ^^ - | | - | variant `Foo::Bar` does not have this field - | help: `Foo::Bar` has a field named `b` + | ^^ variant `Foo::Bar` does not have this field + | +help: `Foo::Bar` has a field named `b` + | +LL | Foo::Bar { a, b: 1, c } => (), + | ~ error[E0027]: pattern does not mention field `b` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:10:9 @@ -26,10 +28,12 @@ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 | LL | Foo::Baz { bb: 1.0 } => (), - | ^^ - | | - | variant `Foo::Baz` does not have this field - | help: `Foo::Baz` has a field named `a` + | ^^ variant `Foo::Baz` does not have this field + | +help: `Foo::Baz` has a field named `a` + | +LL | Foo::Baz { a: 1.0 } => (), + | ~ error[E0027]: pattern does not mention field `a` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:9 diff --git a/tests/ui/suggestions/abi-typo.stderr b/tests/ui/suggestions/abi-typo.stderr index 5195c43220b41..a9d3432458fb6 100644 --- a/tests/ui/suggestions/abi-typo.stderr +++ b/tests/ui/suggestions/abi-typo.stderr @@ -2,12 +2,13 @@ error[E0703]: invalid ABI: found `cdedl` --> $DIR/abi-typo.rs:2:8 | LL | extern "cdedl" fn cdedl() {} - | ^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"cdecl"` + | ^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions +help: did you mean + | +LL | extern "cdecl" fn cdedl() {} + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/assoc-const-as-field.stderr b/tests/ui/suggestions/assoc-const-as-field.stderr index 0f58ce65049e9..6c095e52ac9e5 100644 --- a/tests/ui/suggestions/assoc-const-as-field.stderr +++ b/tests/ui/suggestions/assoc-const-as-field.stderr @@ -2,7 +2,12 @@ error[E0423]: expected value, found struct `Mod::Foo` --> $DIR/assoc-const-as-field.rs:11:9 | LL | foo(Mod::Foo.Bar); - | ^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | foo(Mod::Foo::Bar); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/attribute-typos.stderr b/tests/ui/suggestions/attribute-typos.stderr index b871c9b45a56c..acd6cbb0fb870 100644 --- a/tests/ui/suggestions/attribute-typos.stderr +++ b/tests/ui/suggestions/attribute-typos.stderr @@ -8,22 +8,37 @@ error: cannot find attribute `rustc_err` in this scope --> $DIR/attribute-typos.rs:7:3 | LL | #[rustc_err] - | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `rustc_error` + | ^^^^^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL | #[rustc_error] + | ~~~~~~~~~~~ error: cannot find attribute `tests` in this scope --> $DIR/attribute-typos.rs:4:3 | LL | #[tests] - | ^^^^^ help: an attribute macro with a similar name exists: `test` + | ^^^^^ --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named attribute macro `test` defined here + | +help: an attribute macro with a similar name exists + | +LL | #[test] + | ~~~~ error: cannot find attribute `deprcated` in this scope --> $DIR/attribute-typos.rs:1:3 | LL | #[deprcated] - | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `deprecated` + | ^^^^^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL | #[deprecated] + | ~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/const-no-type.stderr b/tests/ui/suggestions/const-no-type.stderr index bd703992fd4a6..b3773f8f2a56e 100644 --- a/tests/ui/suggestions/const-no-type.stderr +++ b/tests/ui/suggestions/const-no-type.stderr @@ -2,43 +2,78 @@ error: missing type for `const` item --> $DIR/const-no-type.rs:33:8 | LL | const C = 42; - | ^ help: provide a type for the constant: `: i32` + | ^ + | +help: provide a type for the constant + | +LL | const C: i32 = 42; + | +++++ error: missing type for `const` item --> $DIR/const-no-type.rs:38:8 | LL | const D = &&42; - | ^ help: provide a type for the constant: `: &&i32` + | ^ + | +help: provide a type for the constant + | +LL | const D: &&i32 = &&42; + | +++++++ error: missing type for `static` item --> $DIR/const-no-type.rs:43:9 | LL | static S = Vec::::new(); - | ^ help: provide a type for the static variable: `: Vec` + | ^ + | +help: provide a type for the static variable + | +LL | static S: Vec = Vec::::new(); + | +++++++++++++ error: missing type for `static mut` item --> $DIR/const-no-type.rs:48:14 | LL | static mut SM = "abc"; - | ^ help: provide a type for the static variable: `: &str` + | ^ + | +help: provide a type for the static variable + | +LL | static mut SM: &str = "abc"; + | ++++++ error: missing type for `const` item --> $DIR/const-no-type.rs:14:9 | LL | const C2 = 42; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | const C2: = 42; + | ++++++++ error: missing type for `static` item --> $DIR/const-no-type.rs:20:10 | LL | static S2 = "abc"; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | static S2: = "abc"; + | ++++++++ error: missing type for `static mut` item --> $DIR/const-no-type.rs:26:15 | LL | static mut SM2 = "abc"; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | static mut SM2: = "abc"; + | ++++++++ error: aborting due to 7 previous errors diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index b6c286128023d..00623ac19bc7d 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -6,11 +6,14 @@ LL | let A = 3; | | | patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered | missing patterns are not covered because `A` is interpreted as a constant pattern, not a new variable - | help: introduce a variable instead: `A_var` | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `i32` +help: introduce a variable instead + | +LL | let A_var = 3; + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/count2len.stderr b/tests/ui/suggestions/count2len.stderr index 6394a84dd47e1..4e77774db91e5 100644 --- a/tests/ui/suggestions/count2len.stderr +++ b/tests/ui/suggestions/count2len.stderr @@ -2,34 +2,37 @@ error[E0599]: no method named `count` found for array `[{integer}; 4]` in the cu --> $DIR/count2len.rs:5:11 | LL | slice.count(); - | ^^^^^ - | | - | method cannot be called on `[{integer}; 4]` due to unsatisfied trait bounds - | help: consider using `len` instead + | ^^^^^ method cannot be called on `[{integer}; 4]` due to unsatisfied trait bounds | = note: `count` is defined on `Iterator`, which `[{integer}; 4]` does not implement +help: consider using `len` instead + | +LL | slice.len(); + | ~~~ error[E0599]: no method named `count` found for struct `Vec<{integer}>` in the current scope --> $DIR/count2len.rs:6:9 | LL | vec.count(); - | ^^^^^ - | | - | method cannot be called on `Vec<{integer}>` due to unsatisfied trait bounds - | help: consider using `len` instead + | ^^^^^ method cannot be called on `Vec<{integer}>` due to unsatisfied trait bounds | = note: `count` is defined on `Iterator`, which `Vec<{integer}>` does not implement +help: consider using `len` instead + | +LL | vec.len(); + | ~~~ error[E0599]: no method named `count` found for reference `&[{integer}]` in the current scope --> $DIR/count2len.rs:7:20 | LL | vec.as_slice().count(); - | ^^^^^ - | | - | method cannot be called on `&[{integer}]` due to unsatisfied trait bounds - | help: consider using `len` instead + | ^^^^^ method cannot be called on `&[{integer}]` due to unsatisfied trait bounds | = note: `count` is defined on `Iterator`, which `&[{integer}]` does not implement +help: consider using `len` instead + | +LL | vec.as_slice().len(); + | ~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr b/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr index 0cd6267b3b313..5fde8146ef16d 100644 --- a/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr +++ b/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr @@ -2,10 +2,15 @@ error[E0573]: expected type, found module `result` --> $DIR/do-not-attempt-to-add-suggestions-with-no-changes.rs:2:6 | LL | impl result { - | ^^^^^^ help: an enum with a similar name exists: `Result` + | ^^^^^^ --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named enum `Result` defined here + | +help: an enum with a similar name exists + | +LL | impl Result { + | ~~~~~~ error[E0573]: expected type, found variant `Err` --> $DIR/do-not-attempt-to-add-suggestions-with-no-changes.rs:3:25 diff --git a/tests/ui/suggestions/dont-try-removing-the-field.stderr b/tests/ui/suggestions/dont-try-removing-the-field.stderr index 263171a4ac456..b163918ba273d 100644 --- a/tests/ui/suggestions/dont-try-removing-the-field.stderr +++ b/tests/ui/suggestions/dont-try-removing-the-field.stderr @@ -2,9 +2,13 @@ warning: unused variable: `baz` --> $DIR/dont-try-removing-the-field.rs:12:25 | LL | let Foo { foo, bar, baz } = x; - | ^^^ help: try ignoring the field: `baz: _` + | ^^^ | = note: `#[warn(unused_variables)]` on by default +help: try ignoring the field + | +LL | let Foo { foo, bar, baz: _ } = x; + | ~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index 42bc094859a97..533d6b29abdee 100644 --- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -35,12 +35,15 @@ LL | Pin::new(x) | -------- ^ expected `Box + Send>`, found type parameter `F` | | | arguments to this function are incorrect - | help: use `Box::pin` to pin and box this expression: `Box::pin` | = note: expected struct `Box + Send>` found type parameter `F` note: associated function defined here --> $SRC_DIR/core/src/pin.rs:LL:COL +help: use `Box::pin` to pin and box this expression + | +LL | Box::pin(x) + | ~~~~~~~~ error[E0277]: `dyn Future + Send` cannot be unpinned --> $DIR/expected-boxed-future-isnt-pinned.rs:19:14 diff --git a/tests/ui/suggestions/fn-trait-notation.stderr b/tests/ui/suggestions/fn-trait-notation.stderr index 9b47c8c02a782..9e539f517d3fb 100644 --- a/tests/ui/suggestions/fn-trait-notation.stderr +++ b/tests/ui/suggestions/fn-trait-notation.stderr @@ -2,31 +2,43 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subje --> $DIR/fn-trait-notation.rs:4:8 | LL | F: Fn, - | ^^^^^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(i32) -> i32` + | ^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #29625 for more information = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: use parenthetical notation instead + | +LL | F: Fn(i32) -> i32, + | ~~~~~~~~~~~~~~ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change --> $DIR/fn-trait-notation.rs:6:8 | LL | G: Fn<(i32, i32, ), Output = (i32, i32)>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(i32, i32) -> (i32, i32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #29625 for more information = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: use parenthetical notation instead + | +LL | G: Fn(i32, i32) -> (i32, i32), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change --> $DIR/fn-trait-notation.rs:7:8 | LL | H: Fn<(i32,), Output = i32>, - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(i32) -> i32` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #29625 for more information = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: use parenthetical notation instead + | +LL | H: Fn(i32) -> i32, + | ~~~~~~~~~~~~~~ error[E0059]: type parameter to bare `Fn` trait must be a tuple --> $DIR/fn-trait-notation.rs:4:8 diff --git a/tests/ui/suggestions/if-then-neeing-semi.stderr b/tests/ui/suggestions/if-then-neeing-semi.stderr index 6833e0bab2b83..768515a2e4099 100644 --- a/tests/ui/suggestions/if-then-neeing-semi.stderr +++ b/tests/ui/suggestions/if-then-neeing-semi.stderr @@ -97,10 +97,7 @@ LL | let _ = if true { | _____________- LL | | LL | | dummy(); - | | -------- - | | | | - | | | help: consider removing this semicolon - | | expected because of this + | | -------- expected because of this LL | | LL | | } else { LL | | dummy() @@ -108,6 +105,12 @@ LL | | dummy() LL | | LL | | }; | |_____- `if` and `else` have incompatible types + | +help: consider removing this semicolon + | +LL - dummy(); +LL + dummy() + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/ignore-nested-field-binding.stderr b/tests/ui/suggestions/ignore-nested-field-binding.stderr index b2936a22a22f1..6f164ed47382e 100644 --- a/tests/ui/suggestions/ignore-nested-field-binding.stderr +++ b/tests/ui/suggestions/ignore-nested-field-binding.stderr @@ -2,19 +2,28 @@ error: unused variable: `i` --> $DIR/ignore-nested-field-binding.rs:11:27 | LL | fn foo(Outer { o: Inner { i } }: Outer) {} - | ^ help: try ignoring the field: `i: _` + | ^ | note: the lint level is defined here --> $DIR/ignore-nested-field-binding.rs:6:11 | LL | #![forbid(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: try ignoring the field + | +LL | fn foo(Outer { o: Inner { i: _ } }: Outer) {} + | ~~~~ error: unused variable: `i` --> $DIR/ignore-nested-field-binding.rs:17:28 | LL | let Outer { o: Inner { i } } = s; - | ^ help: try ignoring the field: `i: _` + | ^ + | +help: try ignoring the field + | +LL | let Outer { o: Inner { i: _ } } = s; + | ~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/impl-trait-return-trailing-semicolon.stderr b/tests/ui/suggestions/impl-trait-return-trailing-semicolon.stderr index e74c2c4214fe2..32400a70ea089 100644 --- a/tests/ui/suggestions/impl-trait-return-trailing-semicolon.stderr +++ b/tests/ui/suggestions/impl-trait-return-trailing-semicolon.stderr @@ -5,9 +5,13 @@ LL | fn foo() -> impl Bar { | ^^^^^^^^ the trait `Bar` is not implemented for `()` LL | LL | 5; - | -- help: remove this semicolon - | | - | this expression has type `{integer}`, which implements `Bar` + | - this expression has type `{integer}`, which implements `Bar` + | +help: remove this semicolon + | +LL - 5; +LL + 5 + | error[E0277]: the trait bound `(): Bar` is not satisfied --> $DIR/impl-trait-return-trailing-semicolon.rs:15:13 diff --git a/tests/ui/suggestions/issue-101421.stderr b/tests/ui/suggestions/issue-101421.stderr index ececba5fb1baa..1a64f5313cf53 100644 --- a/tests/ui/suggestions/issue-101421.stderr +++ b/tests/ui/suggestions/issue-101421.stderr @@ -2,15 +2,18 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-101421.rs:10:8 | LL | ().f::<()>(()); - | ^------ help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/issue-101421.rs:2:8 | LL | fn f(&self, _: ()); | ^ +help: remove these generics + | +LL - ().f::<()>(()); +LL + ().f(()); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-102354.stderr b/tests/ui/suggestions/issue-102354.stderr index 8340d9340f9b2..9ca3bf3e7728d 100644 --- a/tests/ui/suggestions/issue-102354.stderr +++ b/tests/ui/suggestions/issue-102354.stderr @@ -2,10 +2,7 @@ error[E0599]: no method named `func` found for type `i32` in the current scope --> $DIR/issue-102354.rs:9:7 | LL | x.func(); - | --^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `i32::func()` + | ^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in the trait `Trait` @@ -13,6 +10,10 @@ note: the candidate is defined in the trait `Trait` | LL | fn func() {} | ^^^^^^^^^ +help: use associated function syntax instead + | +LL | i32::func(); + | ~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-103646.stderr b/tests/ui/suggestions/issue-103646.stderr index 8d0e8652392d6..c6c54fd589c12 100644 --- a/tests/ui/suggestions/issue-103646.stderr +++ b/tests/ui/suggestions/issue-103646.stderr @@ -4,10 +4,7 @@ error[E0599]: no method named `nya` found for type parameter `T` in the current LL | fn uwu(c: T) { | - method `nya` not found for this type parameter LL | c.nya(); - | --^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `T::nya()` + | ^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in the trait `Cat` @@ -15,6 +12,10 @@ note: the candidate is defined in the trait `Cat` | LL | fn nya() {} | ^^^^^^^^ +help: use associated function syntax instead + | +LL | T::nya(); + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-104287.stderr b/tests/ui/suggestions/issue-104287.stderr index ed59b2e7a2d3b..b65d3ad4d318a 100644 --- a/tests/ui/suggestions/issue-104287.stderr +++ b/tests/ui/suggestions/issue-104287.stderr @@ -2,15 +2,18 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-104287.rs:10:5 | LL | foo::<()>(x); - | ^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/issue-104287.rs:6:8 | LL | fn foo(&self) {} | ^^^ +help: remove these generics + | +LL - foo::<()>(x); +LL + foo(x); + | error[E0425]: cannot find function `foo` in this scope --> $DIR/issue-104287.rs:10:5 diff --git a/tests/ui/suggestions/issue-105226.stderr b/tests/ui/suggestions/issue-105226.stderr index f16a809010390..16fab758dd8aa 100644 --- a/tests/ui/suggestions/issue-105226.stderr +++ b/tests/ui/suggestions/issue-105226.stderr @@ -4,28 +4,38 @@ error: non-item in item list LL | impl S { | - item list starts here LL | fn hello

(&self, val: &P) where P: fmt::Display; { - | - ^ non-item starts here - | | - | help: consider removing this semicolon + | ^ non-item starts here ... LL | } | - item list ends here + | +help: consider removing this semicolon + | +LL - fn hello

(&self, val: &P) where P: fmt::Display; { +LL + fn hello

(&self, val: &P) where P: fmt::Display { + | error: associated function in `impl` without body --> $DIR/issue-105226.rs:7:5 | LL | fn hello

(&self, val: &P) where P: fmt::Display; { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the function + | +LL | fn hello

(&self, val: &P) where P: fmt::Display { } { + | ~~~~~~~~~~ error: associated function in `impl` without body --> $DIR/issue-105226.rs:15:5 | LL | fn hello_empty

(&self, val: &P) where P: fmt::Display; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: provide a definition for the function: `{ }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: provide a definition for the function + | +LL | fn hello_empty

(&self, val: &P) where P: fmt::Display { } + | ~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr b/tests/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr index 3c3bc2305e079..bf7fd85d53304 100644 --- a/tests/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr +++ b/tests/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr @@ -5,11 +5,14 @@ LL | fn vindictive() -> bool { true } | ----------------------- `vindictive` defined here returns `bool` ... LL | vindictive() - | -^^^^^^^^^^^- help: consider using a semicolon here to finish the statement: `;` - | _____| - | | + | _____-^^^^^^^^^^^ LL | | (1, 2) | |__________- call expression requires function + | +help: consider using a semicolon here to finish the statement + | +LL | vindictive(); + | + error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-52820.stderr b/tests/ui/suggestions/issue-52820.stderr index a67d75014171f..60441e997bbae 100644 --- a/tests/ui/suggestions/issue-52820.stderr +++ b/tests/ui/suggestions/issue-52820.stderr @@ -13,10 +13,12 @@ error[E0308]: mismatched types --> $DIR/issue-52820.rs:13:17 | LL | brains: guts.clone(), - | ^^^^^-----^^ - | | | - | | help: try using a conversion method: `to_string` - | expected `String`, found `&str` + | ^^^^^^^^^^^^ expected `String`, found `&str` + | +help: try using a conversion method + | +LL | brains: guts.to_string(), + | ~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/issue-53692.stderr b/tests/ui/suggestions/issue-53692.stderr index 469a538411fb1..9a075e5491032 100644 --- a/tests/ui/suggestions/issue-53692.stderr +++ b/tests/ui/suggestions/issue-53692.stderr @@ -2,24 +2,29 @@ error[E0308]: mismatched types --> $DIR/issue-53692.rs:7:33 | LL | let items_clone: Vec = ref_items.clone(); - | -------- ^^^^^^^^^^-----^^ - | | | | - | | | help: try using a conversion method: `to_vec` - | | expected `Vec`, found `&[i32]` + | -------- ^^^^^^^^^^^^^^^^^ expected `Vec`, found `&[i32]` + | | | expected due to this | = note: expected struct `Vec` found reference `&[i32]` +help: try using a conversion method + | +LL | let items_clone: Vec = ref_items.to_vec(); + | ~~~~~~ error[E0308]: mismatched types --> $DIR/issue-53692.rs:14:26 | LL | let string: String = s.clone(); - | ------ ^^-----^^ - | | | | - | | | help: try using a conversion method: `to_string` - | | expected `String`, found `&str` + | ------ ^^^^^^^^^ expected `String`, found `&str` + | | | expected due to this + | +help: try using a conversion method + | +LL | let string: String = s.to_string(); + | ~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/issue-59819.stderr b/tests/ui/suggestions/issue-59819.stderr index 43acf9549c29a..ab91961192ff5 100644 --- a/tests/ui/suggestions/issue-59819.stderr +++ b/tests/ui/suggestions/issue-59819.stderr @@ -28,10 +28,14 @@ error[E0308]: mismatched types --> $DIR/issue-59819.rs:34:21 | LL | let g: String = f; - | ------ ^- help: try using a conversion method: `.to_string()` - | | | - | | expected `String`, found `Bar` + | ------ ^ expected `String`, found `Bar` + | | | expected due to this + | +help: try using a conversion method + | +LL | let g: String = f.to_string(); + | ++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/issue-61226.stderr b/tests/ui/suggestions/issue-61226.stderr index 890950b1ae9db..cd541b7bc98d3 100644 --- a/tests/ui/suggestions/issue-61226.stderr +++ b/tests/ui/suggestions/issue-61226.stderr @@ -5,7 +5,12 @@ LL | struct X {} | ----------- `X` defined here LL | fn main() { LL | let _ = vec![X]; //… - | ^ help: use struct literal syntax instead: `X {}` + | ^ + | +help: use struct literal syntax instead + | +LL | let _ = vec![X {}]; //… + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-66968-suggest-sorted-words.stderr b/tests/ui/suggestions/issue-66968-suggest-sorted-words.stderr index ce0087fbfcbab..503893f07fc01 100644 --- a/tests/ui/suggestions/issue-66968-suggest-sorted-words.stderr +++ b/tests/ui/suggestions/issue-66968-suggest-sorted-words.stderr @@ -2,7 +2,12 @@ error[E0425]: cannot find value `a_variable_longer_name` in this scope --> $DIR/issue-66968-suggest-sorted-words.rs:3:20 | LL | println!("{}", a_variable_longer_name); - | ^^^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `a_longer_variable_name` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: a local variable with a similar name exists + | +LL | println!("{}", a_longer_variable_name); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-81098.stderr b/tests/ui/suggestions/issue-81098.stderr index 4dc47a2028243..c9bface2a7ccd 100644 --- a/tests/ui/suggestions/issue-81098.stderr +++ b/tests/ui/suggestions/issue-81098.stderr @@ -13,12 +13,15 @@ error[E0277]: `()` doesn't implement `std::fmt::Display` LL | fn ok() -> impl core::fmt::Display { | ^^^^^^^^^^^^^^^^^^^^^^^ `()` cannot be formatted with the default formatter LL | 1; - | -- help: remove this semicolon - | | - | this expression has type `{integer}`, which implements `std::fmt::Display` + | - this expression has type `{integer}`, which implements `std::fmt::Display` | = help: the trait `std::fmt::Display` is not implemented for `()` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +help: remove this semicolon + | +LL - 1; +LL + 1 + | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/issue-81839.stderr b/tests/ui/suggestions/issue-81839.stderr index 34ff16c653afa..940b76eba156d 100644 --- a/tests/ui/suggestions/issue-81839.stderr +++ b/tests/ui/suggestions/issue-81839.stderr @@ -4,15 +4,18 @@ error[E0308]: `match` arms have incompatible types LL | / match num { LL | | 1 => { LL | | cx.answer_str("hi"); - | | -------------------- - | | | | - | | | help: consider removing this semicolon - | | this is found to be of type `()` + | | -------------------- this is found to be of type `()` LL | | } LL | | _ => cx.answer_str("hi"), | | ^^^^^^^^^^^^^^^^^^^ expected `()`, found future LL | | } | |_____- `match` arms have incompatible types + | +help: consider removing this semicolon + | +LL - cx.answer_str("hi"); +LL + cx.answer_str("hi") + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-83892.stderr b/tests/ui/suggestions/issue-83892.stderr index 7dbffcfca4ede..0a17349f436dc 100644 --- a/tests/ui/suggestions/issue-83892.stderr +++ b/tests/ui/suggestions/issue-83892.stderr @@ -6,8 +6,11 @@ LL | fn main() { LL | match () { LL | () => func() | ^^^^^^ expected `()`, found `u8` -LL | } - | - help: consider using a semicolon here: `;` + | +help: consider using a semicolon here + | +LL | }; + | + error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-83943.stderr b/tests/ui/suggestions/issue-83943.stderr index 1a085368485cf..e714a126f4a69 100644 --- a/tests/ui/suggestions/issue-83943.stderr +++ b/tests/ui/suggestions/issue-83943.stderr @@ -6,11 +6,14 @@ LL | | "A".to_string() | | --------------- expected because of this LL | | } else { LL | | "B" - | | ^^^- help: try using a conversion method: `.to_string()` - | | | - | | expected `String`, found `&str` + | | ^^^ expected `String`, found `&str` LL | | }; | |_____- `if` and `else` have incompatible types + | +help: try using a conversion method + | +LL | "B".to_string() + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-84700.stderr b/tests/ui/suggestions/issue-84700.stderr index ac9f5ab0b0cbb..a818c231b8a7d 100644 --- a/tests/ui/suggestions/issue-84700.stderr +++ b/tests/ui/suggestions/issue-84700.stderr @@ -5,7 +5,12 @@ LL | Cow, | --- `FarmAnimal::Cow` defined here ... LL | FarmAnimal::Cow(_) => "moo".to_string(), - | ^^^^^^^^^^^^^^^^^^ help: use this syntax instead: `FarmAnimal::Cow` + | ^^^^^^^^^^^^^^^^^^ + | +help: use this syntax instead + | +LL | FarmAnimal::Cow => "moo".to_string(), + | ~~~~~~~~~~~~~~~ error[E0164]: expected tuple struct or tuple variant, found struct variant `FarmAnimal::Chicken` --> $DIR/issue-84700.rs:17:9 diff --git a/tests/ui/suggestions/issue-89064.stderr b/tests/ui/suggestions/issue-89064.stderr index be09dd8951208..f1bb3c2adc74f 100644 --- a/tests/ui/suggestions/issue-89064.stderr +++ b/tests/ui/suggestions/issue-89064.stderr @@ -46,15 +46,18 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume --> $DIR/issue-89064.rs:27:21 | LL | let _ = A::::foo::(); - | ^^^----- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: associated function defined here, with 0 generic parameters --> $DIR/issue-89064.rs:4:8 | LL | fn foo() {} | ^^^ +help: remove these generics + | +LL - let _ = A::::foo::(); +LL + let _ = A::::foo(); + | error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-89064.rs:31:16 diff --git a/tests/ui/suggestions/issue-98562.rs b/tests/ui/suggestions/issue-98562.rs index 443537ba39d17..22e416e0f4641 100644 --- a/tests/ui/suggestions/issue-98562.rs +++ b/tests/ui/suggestions/issue-98562.rs @@ -7,6 +7,6 @@ struct X; impl TraitA for X { //~^ ERROR not all trait items implemented } -//~^ HELP implement the missing item: `fn baz + TraitD, V: TraitD>(_: U, _: V) -> Self where U: TraitE, U: TraitB, ::Item: Copy { todo!() }` +//~^ HELP implement the missing item fn main() {} diff --git a/tests/ui/suggestions/issue-98562.stderr b/tests/ui/suggestions/issue-98562.stderr index 578eb284c2662..161dd24e9fe1f 100644 --- a/tests/ui/suggestions/issue-98562.stderr +++ b/tests/ui/suggestions/issue-98562.stderr @@ -4,7 +4,10 @@ error[E0046]: not all trait items implemented, missing: `baz` LL | impl TraitA for X { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `baz` in implementation | - = help: implement the missing item: `fn baz + TraitD, V: TraitD>(_: U, _: V) -> Self where U: TraitE, U: TraitB, ::Item: Copy { todo!() }` +help: implement the missing item + | +LL + fn baz + TraitD, V: TraitD>(_: U, _: V) -> Self where U: TraitE, U: TraitB, ::Item: Copy { todo!() } + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/js-style-comparison-op.stderr b/tests/ui/suggestions/js-style-comparison-op.stderr index 33f7a0844fd27..58b1fddd3dddf 100644 --- a/tests/ui/suggestions/js-style-comparison-op.stderr +++ b/tests/ui/suggestions/js-style-comparison-op.stderr @@ -2,13 +2,23 @@ error: invalid comparison operator `===` --> $DIR/js-style-comparison-op.rs:3:10 | LL | if 1 === 1 { - | ^^^ help: `===` is not a valid comparison operator, use `==` + | ^^^ + | +help: `===` is not a valid comparison operator, use `==` + | +LL | if 1 == 1 { + | ~~ error: invalid comparison operator `!==` --> $DIR/js-style-comparison-op.rs:5:17 | LL | } else if 1 !== 1 { - | ^^^ help: `!==` is not a valid comparison operator, use `!=` + | ^^^ + | +help: `!==` is not a valid comparison operator, use `!=` + | +LL | } else if 1 != 1 { + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr b/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr index b90ae051fb776..32f844e096107 100644 --- a/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr +++ b/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr @@ -2,9 +2,12 @@ error[E0573]: expected type, found local variable `num` --> $DIR/let-binding-init-expr-as-ty.rs:2:27 | LL | let foo: i32::from_be(num); - | -- ^^^ not a type - | | - | help: use `=` if you meant to assign + | ^^^ not a type + | +help: use `=` if you meant to assign + | +LL | let foo = i32::from_be(num); + | ~ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/let-binding-init-expr-as-ty.rs:2:19 diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index 64af17c830e2e..df22cd73fc66e 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -2,9 +2,12 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/missing-lifetimes-in-signature.rs:37:11 | LL | fn baz(g: G, dest: &mut T) -> impl FnOnce() + '_ - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `'a,` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn baz<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + | +++ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not appear in bounds --> $DIR/missing-lifetimes-in-signature.rs:19:5 @@ -98,15 +101,17 @@ LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b error[E0621]: explicit lifetime required in the type of `dest` --> $DIR/missing-lifetimes-in-signature.rs:73:5 | -LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a - | ------ help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T` -... LL | / move || { LL | | LL | | LL | | *dest = g.get(); LL | | } | |_____^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `dest` + | +LL | fn bat<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() + '_ + 'a + | ~~~~~~~~~ error[E0309]: the parameter type `G` may not live long enough --> $DIR/missing-lifetimes-in-signature.rs:85:5 diff --git a/tests/ui/suggestions/match-needing-semi.stderr b/tests/ui/suggestions/match-needing-semi.stderr index b5f01d7038c0d..861dfc515d848 100644 --- a/tests/ui/suggestions/match-needing-semi.stderr +++ b/tests/ui/suggestions/match-needing-semi.stderr @@ -28,9 +28,12 @@ LL | | 4 => 1, LL | | 3 => 2, LL | | _ => 2 LL | | } - | | ^- help: consider using a semicolon here - | |_____| - | expected `()`, found integer + | |_____^ expected `()`, found integer + | +help: consider using a semicolon here + | +LL | }; + | + error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr index cf3cf45ef402a..6a9c7f8e50091 100644 --- a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr +++ b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr @@ -94,10 +94,7 @@ LL | let _ = match true { | _____________- LL | | true => { LL | | dummy(); - | | -------- - | | | | - | | | help: consider removing this semicolon - | | this is found to be of type `()` + | | -------- this is found to be of type `()` LL | | LL | | } LL | | false => dummy(), @@ -105,6 +102,12 @@ LL | | false => dummy(), LL | | LL | | }; | |_____- `match` arms have incompatible types + | +help: consider removing this semicolon + | +LL - dummy(); +LL + dummy() + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr b/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr index 51ea5b35ae114..a6768de0ada94 100644 --- a/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr +++ b/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr @@ -5,9 +5,12 @@ LL | fn not_all_paths(a: &str) -> u32 { | ------------- ^^^ expected `u32`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -... -LL | }; - | - help: remove this semicolon to return this value + | +help: remove this semicolon to return this value + | +LL - }; +LL + } + | error[E0308]: `match` arms have incompatible types --> $DIR/match-with-different-arm-types-as-stmt-instead-of-expr.rs:26:14 diff --git a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.rs b/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.rs index ebe7e4574ca49..1228e623a0701 100644 --- a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.rs +++ b/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.rs @@ -7,9 +7,9 @@ struct S; impl TraitA<()> for S { //~^ ERROR not all trait items implemented } -//~^ HELP implement the missing item: `type Type = /* Type */;` -//~| HELP implement the missing item: `fn bar(_: T) -> Self { todo!() }` -//~| HELP implement the missing item: `fn baz(_: T) -> Self where T: TraitB, ::Item: Copy { todo!() }` -//~| HELP implement the missing item: `const A: usize = 42;` +//~^ HELP implement the missing item +//~| HELP implement the missing item +//~| HELP implement the missing item +//~| HELP implement the missing item fn main() {} diff --git a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr b/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr index 3cf5c6e7b7497..40609ec6540f4 100644 --- a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr +++ b/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr @@ -4,10 +4,22 @@ error[E0046]: not all trait items implemented, missing: `Type`, `bar`, `baz`, `A LL | impl TraitA<()> for S { | ^^^^^^^^^^^^^^^^^^^^^ missing `Type`, `bar`, `baz`, `A` in implementation | - = help: implement the missing item: `type Type = /* Type */;` - = help: implement the missing item: `fn bar(_: T) -> Self { todo!() }` - = help: implement the missing item: `fn baz(_: T) -> Self where T: TraitB, ::Item: Copy { todo!() }` - = help: implement the missing item: `const A: usize = 42;` +help: implement the missing item + | +LL + type Type = /* Type */; + | +help: implement the missing item + | +LL + fn bar(_: T) -> Self { todo!() } + | +help: implement the missing item + | +LL + fn baz(_: T) -> Self where T: TraitB, ::Item: Copy { todo!() } + | +help: implement the missing item + | +LL + const A: usize = 42; + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/missing-assoc-fn.stderr b/tests/ui/suggestions/missing-assoc-fn.stderr index d819f7e8bd2c4..97ebd2e3b6c31 100644 --- a/tests/ui/suggestions/missing-assoc-fn.stderr +++ b/tests/ui/suggestions/missing-assoc-fn.stderr @@ -19,7 +19,10 @@ error[E0046]: not all trait items implemented, missing: `from_iter` LL | impl FromIterator<()> for X { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_iter` in implementation | - = help: implement the missing item: `fn from_iter>(_: T) -> Self { todo!() }` +help: implement the missing item + | +LL + fn from_iter>(_: T) -> Self { todo!() } + | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/missing-impl-trait-block-but-not-ascii.stderr b/tests/ui/suggestions/missing-impl-trait-block-but-not-ascii.stderr index 56cdc11b62e6b..3815b633853d0 100644 --- a/tests/ui/suggestions/missing-impl-trait-block-but-not-ascii.stderr +++ b/tests/ui/suggestions/missing-impl-trait-block-but-not-ascii.stderr @@ -15,7 +15,10 @@ error: expected `{}`, found `;` LL | impl T for S; | ^^ | - = help: try using `{}` instead +help: try using `{}` instead + | +LL | impl T for S{} + | ~~ error[E0046]: not all trait items implemented, missing: `f` --> $DIR/missing-impl-trait-block-but-not-ascii.rs:8:1 diff --git a/tests/ui/suggestions/missing-semicolon.stderr b/tests/ui/suggestions/missing-semicolon.stderr index 54a64f664b501..b5ccc6eb636f2 100644 --- a/tests/ui/suggestions/missing-semicolon.stderr +++ b/tests/ui/suggestions/missing-semicolon.stderr @@ -2,17 +2,27 @@ error: expected `;`, found `}` --> $DIR/missing-semicolon.rs:6:7 | LL | () - | ^ help: add `;` here + | ^ LL | } | - unexpected token + | +help: add `;` here + | +LL | (); + | + error: expected `;`, found `}` --> $DIR/missing-semicolon.rs:32:7 | LL | () - | ^ help: add `;` here + | ^ LL | } | - unexpected token + | +help: add `;` here + | +LL | (); + | + error[E0618]: expected function, found `{integer}` --> $DIR/missing-semicolon.rs:5:13 @@ -20,11 +30,14 @@ error[E0618]: expected function, found `{integer}` LL | let x = 5; | - `x` has type `{integer}` LL | let y = x - | ^- help: consider using a semicolon here to finish the statement: `;` - | _____________| - | | + | _____________^ LL | | () | |______- call expression requires function + | +help: consider using a semicolon here to finish the statement + | +LL | let y = x; + | + error[E0618]: expected function, found `{integer}` --> $DIR/missing-semicolon.rs:11:13 @@ -32,11 +45,14 @@ error[E0618]: expected function, found `{integer}` LL | let x = 5; | - `x` has type `{integer}` LL | let y = x - | ^- help: consider using a semicolon here to finish the statement: `;` - | _____________| - | | + | _____________^ LL | | (); | |______- call expression requires function + | +help: consider using a semicolon here to finish the statement + | +LL | let y = x; + | + error[E0618]: expected function, found `{integer}` --> $DIR/missing-semicolon.rs:16:5 @@ -44,31 +60,40 @@ error[E0618]: expected function, found `{integer}` LL | let x = 5; | - `x` has type `{integer}` LL | x - | ^- help: consider using a semicolon here to finish the statement: `;` - | _____| - | | + | _____^ LL | | () | |______- call expression requires function + | +help: consider using a semicolon here to finish the statement + | +LL | x; + | + error[E0618]: expected function, found `{integer}` --> $DIR/missing-semicolon.rs:31:13 | LL | let y = 5 - | ^- help: consider using a semicolon here to finish the statement: `;` - | _____________| - | | + | _____________^ LL | | () | |______- call expression requires function + | +help: consider using a semicolon here to finish the statement + | +LL | let y = 5; + | + error[E0618]: expected function, found `{integer}` --> $DIR/missing-semicolon.rs:35:5 | LL | 5 - | ^- help: consider using a semicolon here to finish the statement: `;` - | _____| - | | + | _____^ LL | | (); | |______- call expression requires function + | +help: consider using a semicolon here to finish the statement + | +LL | 5; + | + error: aborting due to 7 previous errors diff --git a/tests/ui/suggestions/object-unsafe-trait-should-use-self-2021-without-dyn.stderr b/tests/ui/suggestions/object-unsafe-trait-should-use-self-2021-without-dyn.stderr index 60eb72ab4f768..30e3d53059b5d 100644 --- a/tests/ui/suggestions/object-unsafe-trait-should-use-self-2021-without-dyn.stderr +++ b/tests/ui/suggestions/object-unsafe-trait-should-use-self-2021-without-dyn.stderr @@ -77,9 +77,7 @@ error[E0038]: the trait `C` cannot be made into an object --> $DIR/object-unsafe-trait-should-use-self-2021-without-dyn.rs:18:20 | LL | fn f(&self, c: C) -> C; - | ----- ^ `C` cannot be made into an object - | | - | help: consider changing method `f`'s `self` parameter to be `&self` (notice the capitalization): `&Self` + | ^ `C` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-unsafe-trait-should-use-self-2021-without-dyn.rs:18:10 @@ -88,6 +86,10 @@ LL | trait C { | - this trait cannot be made into an object... LL | fn f(&self, c: C) -> C; | ^^^^^ ...because method `f`'s `self` parameter cannot be dispatched on +help: consider changing method `f`'s `self` parameter to be `&self` (notice the capitalization difference) + | +LL | fn f(&Self, c: C) -> C; + | ~~~~~ error[E0782]: trait objects must include the `dyn` keyword --> $DIR/object-unsafe-trait-should-use-self-2021-without-dyn.rs:4:13 diff --git a/tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.stderr b/tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.stderr index c721ceb11463f..ed94ebd27ffdf 100644 --- a/tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.stderr +++ b/tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.stderr @@ -5,9 +5,12 @@ LL | fn get_name() -> String { | ------ expected `String` because of return type ... LL | your_name.trim() - | ^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()` - | | - | expected `String`, found `&str` + | ^^^^^^^^^^^^^^^^ expected `String`, found `&str` + | +help: try using a conversion method + | +LL | your_name.trim().to_string() + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr b/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr index e068fdb5abac1..dd8f896d88e79 100644 --- a/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr +++ b/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr @@ -2,25 +2,40 @@ error: expected item, found `;` --> $DIR/recover-from-semicolon-trailing-item.rs:2:9 | LL | mod M {}; - | ^ help: remove this semicolon + | ^ | = help: module declarations are not followed by a semicolon +help: remove this semicolon + | +LL - mod M {}; +LL + mod M {} + | error: expected item, found `;` --> $DIR/recover-from-semicolon-trailing-item.rs:4:12 | LL | struct S {}; - | ^ help: remove this semicolon + | ^ | = help: braced struct declarations are not followed by a semicolon +help: remove this semicolon + | +LL - struct S {}; +LL + struct S {} + | error: expected item, found `;` --> $DIR/recover-from-semicolon-trailing-item.rs:6:20 | LL | fn foo(a: usize) {}; - | ^ help: remove this semicolon + | ^ | = help: function declarations are not followed by a semicolon +help: remove this semicolon + | +LL - fn foo(a: usize) {}; +LL + fn foo(a: usize) {} + | error[E0308]: mismatched types --> $DIR/recover-from-semicolon-trailing-item.rs:10:20 diff --git a/tests/ui/suggestions/recover-invalid-float.stderr b/tests/ui/suggestions/recover-invalid-float.stderr index dd24746eab80f..e5b3c910fc764 100644 --- a/tests/ui/suggestions/recover-invalid-float.stderr +++ b/tests/ui/suggestions/recover-invalid-float.stderr @@ -2,19 +2,34 @@ error: float literals must have an integer part --> $DIR/recover-invalid-float.rs:4:18 | LL | let _: f32 = .3; - | ^^ help: must have an integer part: `0.3` + | ^^ + | +help: must have an integer part + | +LL | let _: f32 = 0.3; + | ~~~ error: float literals must have an integer part --> $DIR/recover-invalid-float.rs:6:18 | LL | let _: f32 = .42f32; - | ^^^^^^ help: must have an integer part: `0.42f32` + | ^^^^^^ + | +help: must have an integer part + | +LL | let _: f32 = 0.42f32; + | ~~~~~~~ error: float literals must have an integer part --> $DIR/recover-invalid-float.rs:8:18 | LL | let _: f64 = .5f64; - | ^^^^^ help: must have an integer part: `0.5f64` + | ^^^^^ + | +help: must have an integer part + | +LL | let _: f64 = 0.5f64; + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/remove-as_str.stderr b/tests/ui/suggestions/remove-as_str.stderr index 534c497780a95..e7db19b94025c 100644 --- a/tests/ui/suggestions/remove-as_str.stderr +++ b/tests/ui/suggestions/remove-as_str.stderr @@ -2,25 +2,49 @@ error[E0599]: no method named `as_str` found for reference `&str` in the current --> $DIR/remove-as_str.rs:2:7 | LL | s.as_str(); - | -^^^^^^-- help: remove this method call + | ^^^^^^ + | +help: remove this method call + | +LL - s.as_str(); +LL + s; + | error[E0599]: no method named `as_str` found for reference `&'a str` in the current scope --> $DIR/remove-as_str.rs:7:7 | LL | s.as_str(); - | -^^^^^^-- help: remove this method call + | ^^^^^^ + | +help: remove this method call + | +LL - s.as_str(); +LL + s; + | error[E0599]: no method named `as_str` found for mutable reference `&mut str` in the current scope --> $DIR/remove-as_str.rs:12:7 | LL | s.as_str(); - | -^^^^^^-- help: remove this method call + | ^^^^^^ + | +help: remove this method call + | +LL - s.as_str(); +LL + s; + | error[E0599]: no method named `as_str` found for reference `&&str` in the current scope --> $DIR/remove-as_str.rs:17:7 | LL | s.as_str(); - | -^^^^^^-- help: remove this method call + | ^^^^^^ + | +help: remove this method call + | +LL - s.as_str(); +LL + s; + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/return-closures.stderr b/tests/ui/suggestions/return-closures.stderr index ef1f50b8a6ce8..0feb36691fb9e 100644 --- a/tests/ui/suggestions/return-closures.stderr +++ b/tests/ui/suggestions/return-closures.stderr @@ -1,26 +1,28 @@ error[E0308]: mismatched types --> $DIR/return-closures.rs:3:5 | -LL | fn foo() { - | - help: try adding a return type: `-> impl FnOnce(&i32) -> i32` -LL | LL | |x: &i32| 1i32 | ^^^^^^^^^^^^^^ expected `()`, found closure | = note: expected unit type `()` found closure `{closure@$DIR/return-closures.rs:3:5: 3:14}` +help: try adding a return type + | +LL | fn foo() -> impl FnOnce(&i32) -> i32 { + | +++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/return-closures.rs:9:5 | -LL | fn bar(i: impl Sized) { - | - help: a return type might be missing here: `-> _` -LL | LL | || i | ^^^^ expected `()`, found closure | = note: expected unit type `()` found closure `{closure@$DIR/return-closures.rs:9:5: 9:7}` +help: a return type might be missing here + | +LL | fn bar(i: impl Sized) -> _ { + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/return-cycle-2.stderr b/tests/ui/suggestions/return-cycle-2.stderr index 23de2309e8778..98949c2801d2d 100644 --- a/tests/ui/suggestions/return-cycle-2.stderr +++ b/tests/ui/suggestions/return-cycle-2.stderr @@ -2,10 +2,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/return-cycle-2.rs:6:34 | LL | fn as_ref(_: i32, _: i32) -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `Token<&'static T>` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn as_ref(_: i32, _: i32) -> Token<&'static T> { + | ~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/return-cycle.stderr b/tests/ui/suggestions/return-cycle.stderr index 604704904410b..f088474c10411 100644 --- a/tests/ui/suggestions/return-cycle.stderr +++ b/tests/ui/suggestions/return-cycle.stderr @@ -2,10 +2,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/return-cycle.rs:6:17 | LL | fn new() -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `Token<()>` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn new() -> Token<()> { + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/struct-initializer-comma.stderr b/tests/ui/suggestions/struct-initializer-comma.stderr index 5eff43f32cda1..33df141fe037c 100644 --- a/tests/ui/suggestions/struct-initializer-comma.stderr +++ b/tests/ui/suggestions/struct-initializer-comma.stderr @@ -5,12 +5,14 @@ LL | let _ = Foo { | --- while parsing this struct LL | LL | first: true - | - - | | - | expected one of `,`, `.`, `?`, `}`, or an operator - | help: try adding a comma: `,` + | - expected one of `,`, `.`, `?`, `}`, or an operator LL | second: 25 | ^^^^^^ unexpected token + | +help: try adding a comma + | +LL | first: true, + | + error[E0063]: missing field `second` in initializer of `Foo` --> $DIR/struct-initializer-comma.rs:9:13 diff --git a/tests/ui/suggestions/suggest-assoc-fn-call-deref.stderr b/tests/ui/suggestions/suggest-assoc-fn-call-deref.stderr index a30b78692146b..4d8ca68d01294 100644 --- a/tests/ui/suggestions/suggest-assoc-fn-call-deref.stderr +++ b/tests/ui/suggestions/suggest-assoc-fn-call-deref.stderr @@ -2,10 +2,7 @@ error[E0599]: no method named `test` found for struct `Box>` in the cur --> $DIR/suggest-assoc-fn-call-deref.rs:13:7 | LL | x.test(); - | --^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `Foo::::test()` + | ^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Foo` @@ -13,6 +10,10 @@ note: the candidate is defined in an impl for the type `Foo` | LL | fn test() -> i32 { 1 } | ^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | Foo::::test(); + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-assoc-fn-call-for-impl-trait.stderr b/tests/ui/suggestions/suggest-assoc-fn-call-for-impl-trait.stderr index 0df2b08d3be82..29d5ab3106988 100644 --- a/tests/ui/suggestions/suggest-assoc-fn-call-for-impl-trait.stderr +++ b/tests/ui/suggestions/suggest-assoc-fn-call-for-impl-trait.stderr @@ -5,10 +5,7 @@ LL | struct A { | -------- method `foo` not found for this struct ... LL | _a.foo(); - | ---^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `A::foo(_a)` + | ^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in the trait `M` @@ -16,6 +13,10 @@ note: the candidate is defined in the trait `M` | LL | fn foo(_a: Self); | ^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | A::foo(_a); + | ~~~~~~~~~~ error[E0599]: no method named `baz` found for struct `A` in the current scope --> $DIR/suggest-assoc-fn-call-for-impl-trait.rs:23:8 @@ -24,10 +25,7 @@ LL | struct A { | -------- method `baz` not found for this struct ... LL | _a.baz(0); - | ---^^^--- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `A::baz(0)` + | ^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in the trait `M` @@ -35,6 +33,10 @@ note: the candidate is defined in the trait `M` | LL | fn baz(_a: i32); | ^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | A::baz(0); + | ~~~~~~~~~ error[E0599]: no method named `bar` found for struct `A` in the current scope --> $DIR/suggest-assoc-fn-call-for-impl-trait.rs:27:8 @@ -43,10 +45,7 @@ LL | struct A { | -------- method `bar` not found for this struct ... LL | _b.bar(); - | ---^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `A::bar(_b)` + | ^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in the trait `M` @@ -54,6 +53,10 @@ note: the candidate is defined in the trait `M` | LL | fn bar(_a: Self); | ^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | A::bar(_b); + | ~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish-placeholder.stderr b/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish-placeholder.stderr index 6e4c77deac50f..5d89283cd6d18 100644 --- a/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish-placeholder.stderr +++ b/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish-placeholder.stderr @@ -5,10 +5,7 @@ LL | struct GenericAssocMethod(T); | ---------------------------- method `default_hello` not found for this struct ... LL | x.default_hello(); - | --^^^^^^^^^^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `GenericAssocMethod::<_>::default_hello()` + | ^^^^^^^^^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `GenericAssocMethod` @@ -16,6 +13,10 @@ note: the candidate is defined in an impl for the type `GenericAssocMethod` | LL | fn default_hello() {} | ^^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | GenericAssocMethod::<_>::default_hello(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish-through-deref.stderr b/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish-through-deref.stderr index 1bc2592944699..318c5817d203e 100644 --- a/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish-through-deref.stderr +++ b/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish-through-deref.stderr @@ -2,10 +2,7 @@ error[E0599]: no method named `hello` found for struct `RefMut<'_, HasAssocMetho --> $DIR/suggest-assoc-fn-call-with-turbofish-through-deref.rs:11:11 | LL | state.hello(); - | ------^^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `HasAssocMethod::hello()` + | ^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `HasAssocMethod` @@ -13,6 +10,10 @@ note: the candidate is defined in an impl for the type `HasAssocMethod` | LL | fn hello() {} | ^^^^^^^^^^ +help: use associated function syntax instead + | +LL | HasAssocMethod::hello(); + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish.stderr b/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish.stderr index 92b03fc77142c..45a74d7926d35 100644 --- a/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish.stderr +++ b/tests/ui/suggestions/suggest-assoc-fn-call-with-turbofish.stderr @@ -5,10 +5,7 @@ LL | struct GenericAssocMethod(T); | ---------------------------- method `self_ty_ref_hello` not found for this struct ... LL | x.self_ty_ref_hello(); - | --^^^^^^^^^^^^^^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `GenericAssocMethod::<_>::self_ty_ref_hello(&x)` + | ^^^^^^^^^^^^^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `GenericAssocMethod` @@ -16,6 +13,10 @@ note: the candidate is defined in an impl for the type `GenericAssocMethod` | LL | fn self_ty_ref_hello(_: &Self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | GenericAssocMethod::<_>::self_ty_ref_hello(&x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `self_ty_hello` found for struct `GenericAssocMethod<{integer}>` in the current scope --> $DIR/suggest-assoc-fn-call-with-turbofish.rs:16:7 @@ -24,10 +25,7 @@ LL | struct GenericAssocMethod(T); | ---------------------------- method `self_ty_hello` not found for this struct ... LL | x.self_ty_hello(); - | --^^^^^^^^^^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `GenericAssocMethod::<_>::self_ty_hello(x)` + | ^^^^^^^^^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `GenericAssocMethod` @@ -35,6 +33,10 @@ note: the candidate is defined in an impl for the type `GenericAssocMethod` | LL | fn self_ty_hello(_: Self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | GenericAssocMethod::<_>::self_ty_hello(x); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `default_hello` found for struct `GenericAssocMethod` in the current scope --> $DIR/suggest-assoc-fn-call-with-turbofish.rs:20:7 @@ -43,10 +45,7 @@ LL | struct GenericAssocMethod(T); | ---------------------------- method `default_hello` not found for this struct ... LL | y.default_hello(); - | --^^^^^^^^^^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `GenericAssocMethod::::default_hello()` + | ^^^^^^^^^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `GenericAssocMethod` @@ -54,6 +53,10 @@ note: the candidate is defined in an impl for the type `GenericAssocMethod` | LL | fn default_hello() {} | ^^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | GenericAssocMethod::::default_hello(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `self_ty_ref_hello` found for struct `GenericAssocMethod` in the current scope --> $DIR/suggest-assoc-fn-call-with-turbofish.rs:22:7 @@ -62,10 +65,7 @@ LL | struct GenericAssocMethod(T); | ---------------------------- method `self_ty_ref_hello` not found for this struct ... LL | y.self_ty_ref_hello(); - | --^^^^^^^^^^^^^^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `GenericAssocMethod::::self_ty_ref_hello(&y)` + | ^^^^^^^^^^^^^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `GenericAssocMethod` @@ -73,6 +73,10 @@ note: the candidate is defined in an impl for the type `GenericAssocMethod` | LL | fn self_ty_ref_hello(_: &Self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | GenericAssocMethod::::self_ty_ref_hello(&y); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `self_ty_hello` found for struct `GenericAssocMethod` in the current scope --> $DIR/suggest-assoc-fn-call-with-turbofish.rs:24:7 @@ -81,10 +85,7 @@ LL | struct GenericAssocMethod(T); | ---------------------------- method `self_ty_hello` not found for this struct ... LL | y.self_ty_hello(); - | --^^^^^^^^^^^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `GenericAssocMethod::::self_ty_hello(y)` + | ^^^^^^^^^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `GenericAssocMethod` @@ -92,6 +93,10 @@ note: the candidate is defined in an impl for the type `GenericAssocMethod` | LL | fn self_ty_hello(_: Self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | GenericAssocMethod::::self_ty_hello(y); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/suggestions/suggest-assoc-fn-call-without-receiver.stderr b/tests/ui/suggestions/suggest-assoc-fn-call-without-receiver.stderr index 793595784d937..2372aeb214588 100644 --- a/tests/ui/suggestions/suggest-assoc-fn-call-without-receiver.stderr +++ b/tests/ui/suggestions/suggest-assoc-fn-call-without-receiver.stderr @@ -5,10 +5,7 @@ LL | struct A {} | -------- method `hello` not found for this struct ... LL | _a.hello(1); - | ---^^^^^--- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `A::hello(1)` + | ^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `A` @@ -16,6 +13,10 @@ note: the candidate is defined in an impl for the type `A` | LL | fn hello(_a: i32) {} | ^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | A::hello(1); + | ~~~~~~~~~~~ error[E0599]: no method named `test` found for struct `A` in the current scope --> $DIR/suggest-assoc-fn-call-without-receiver.rs:22:8 @@ -24,10 +25,7 @@ LL | struct A {} | -------- method `test` not found for this struct ... LL | _a.test(1); - | ---^^^^--- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `A::test(_a, 1)` + | ^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `A` @@ -35,6 +33,10 @@ note: the candidate is defined in an impl for the type `A` | LL | fn test(_a: Self, _b: i32) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | A::test(_a, 1); + | ~~~~~~~~~~~~~~ error[E0599]: no method named `hello` found for struct `B<&str>` in the current scope --> $DIR/suggest-assoc-fn-call-without-receiver.rs:26:8 @@ -43,10 +45,7 @@ LL | struct B { | ----------- method `hello` not found for this struct ... LL | _b.hello(1); - | ---^^^^^--- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `B::<&str>::hello(1)` + | ^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `B` @@ -54,6 +53,10 @@ note: the candidate is defined in an impl for the type `B` | LL | fn hello(_a: i32) {} | ^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | B::<&str>::hello(1); + | ~~~~~~~~~~~~~~~~~~~ error[E0599]: no method named `test` found for struct `B<&str>` in the current scope --> $DIR/suggest-assoc-fn-call-without-receiver.rs:28:8 @@ -62,10 +65,7 @@ LL | struct B { | ----------- method `test` not found for this struct ... LL | _b.test(1); - | ---^^^^--- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `B::<&str>::test(_b, 1)` + | ^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `B` @@ -73,6 +73,10 @@ note: the candidate is defined in an impl for the type `B` | LL | fn test(_a: Self, _b: i32) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use associated function syntax instead + | +LL | B::<&str>::test(_b, 1); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr index bf7790e2307e0..55be1179d4193 100644 --- a/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr +++ b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr @@ -2,10 +2,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/suggest-fn-ptr-for-fn-item-in-fn-ret.rs:7:13 | LL | fn bar() -> _ { Wrapper(foo) } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `Wrapper` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn bar() -> Wrapper { Wrapper(foo) } + | ~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-labels.stderr b/tests/ui/suggestions/suggest-labels.stderr index aac6515b527c7..65544e9353520 100644 --- a/tests/ui/suggestions/suggest-labels.stderr +++ b/tests/ui/suggestions/suggest-labels.stderr @@ -4,10 +4,12 @@ error[E0426]: use of undeclared label `'fo` LL | 'foo: loop { | ---- a label with a similar name is reachable LL | break 'fo; - | ^^^ - | | - | undeclared label `'fo` - | help: try using similarly named label: `'foo` + | ^^^ undeclared label `'fo` + | +help: try using similarly named label + | +LL | break 'foo; + | ~~~~ error[E0426]: use of undeclared label `'bor` --> $DIR/suggest-labels.rs:8:18 @@ -15,10 +17,12 @@ error[E0426]: use of undeclared label `'bor` LL | 'bar: loop { | ---- a label with a similar name is reachable LL | continue 'bor; - | ^^^^ - | | - | undeclared label `'bor` - | help: try using similarly named label: `'bar` + | ^^^^ undeclared label `'bor` + | +help: try using similarly named label + | +LL | continue 'bar; + | ~~~~ error[E0426]: use of undeclared label `'longlable` --> $DIR/suggest-labels.rs:13:19 @@ -26,10 +30,12 @@ error[E0426]: use of undeclared label `'longlable` LL | 'longlabel1: loop { | ----------- a label with a similar name is reachable LL | break 'longlable; - | ^^^^^^^^^^ - | | - | undeclared label `'longlable` - | help: try using similarly named label: `'longlabel1` + | ^^^^^^^^^^ undeclared label `'longlable` + | +help: try using similarly named label + | +LL | break 'longlabel1; + | ~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/suggest-move-lifetimes.stderr b/tests/ui/suggestions/suggest-move-lifetimes.stderr index b1a49447d4601..250bd4e19ac06 100644 --- a/tests/ui/suggestions/suggest-move-lifetimes.stderr +++ b/tests/ui/suggestions/suggest-move-lifetimes.stderr @@ -2,25 +2,45 @@ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:1:13 | LL | struct A { - | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct A<'a, T> { + | ~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:5:13 | LL | struct B { - | ----^^---- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct B<'a, T, U> { + | ~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:10:16 | LL | struct C { - | -------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` + | ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct C<'a, T, U> { + | ~~~~~~~~~~ error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:15:16 | LL | struct D { - | -------^^--^^-----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, 'c, T, U, V>` + | ^^ ^^ ^^ + | +help: reorder the parameters: lifetimes, then consts and types + | +LL | struct D<'a, 'b, 'c, T, U, V> { + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr index 0bd286e0a6228..ea20048066af9 100644 --- a/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr +++ b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr @@ -2,13 +2,15 @@ error[E0594]: cannot assign to `t.v`, which is behind a `&` reference --> $DIR/suggest-mut-method-for-loop-closure.rs:15:13 | LL | for mut t in buzz.values() { - | ------------- - | | | - | | help: use mutable method: `values_mut()` - | this iterator yields `&` references + | ------------- this iterator yields `&` references ... LL | t.v += 1; | ^^^^^^^^ `t` is a `&` reference, so the data it refers to cannot be written + | +help: use mutable method + | +LL | for mut t in buzz.values_mut() { + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.stderr b/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.stderr index 1be14aa8f55d6..9fc569e356d4f 100644 --- a/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.stderr +++ b/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.stderr @@ -2,13 +2,15 @@ error[E0594]: cannot assign to `v.v`, which is behind a `&` reference --> $DIR/suggest-mut-method-for-loop-hashmap.rs:17:9 | LL | for (_k, v) in map.iter() { - | ---------- - | | | - | | help: use mutable method: `iter_mut()` - | this iterator yields `&` references + | ---------- this iterator yields `&` references ... LL | v.v += 1; | ^^^^^^^^ `v` is a `&` reference, so the data it refers to cannot be written + | +help: use mutable method + | +LL | for (_k, v) in map.iter_mut() { + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop.stderr b/tests/ui/suggestions/suggest-mut-method-for-loop.stderr index 37bb25b300f3b..f41c04d8fb495 100644 --- a/tests/ui/suggestions/suggest-mut-method-for-loop.stderr +++ b/tests/ui/suggestions/suggest-mut-method-for-loop.stderr @@ -2,13 +2,15 @@ error[E0594]: cannot assign to `t.v`, which is behind a `&` reference --> $DIR/suggest-mut-method-for-loop.rs:14:9 | LL | for mut t in buzz.values() { - | ------------- - | | | - | | help: use mutable method: `values_mut()` - | this iterator yields `&` references + | ------------- this iterator yields `&` references ... LL | t.v += 1; | ^^^^^^^^ `t` is a `&` reference, so the data it refers to cannot be written + | +help: use mutable method + | +LL | for mut t in buzz.values_mut() { + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr index 0da0241fe82c9..bdb3da37da481 100644 --- a/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr +++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr @@ -1,10 +1,13 @@ error[E0308]: mismatched types --> $DIR/suggest-ret-on-async-w-late.rs:10:5 | -LL | async fn ice(_: &i32) { - | - help: try adding a return type: `-> bool` LL | true | ^^^^ expected `()`, found `bool` + | +help: try adding a return type + | +LL | async fn ice(_: &i32) -> bool { + | +++++++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-semicolon-for-fn-in-extern-block.stderr b/tests/ui/suggestions/suggest-semicolon-for-fn-in-extern-block.stderr index 12da91c20b3c5..3d6983ec8f98e 100644 --- a/tests/ui/suggestions/suggest-semicolon-for-fn-in-extern-block.stderr +++ b/tests/ui/suggestions/suggest-semicolon-for-fn-in-extern-block.stderr @@ -2,9 +2,14 @@ error: expected `;`, found `}` --> $DIR/suggest-semicolon-for-fn-in-extern-block.rs:6:11 | LL | fn foo() - | ^ help: add `;` here + | ^ LL | } | - unexpected token + | +help: add `;` here + | +LL | fn foo(); + | + error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-trait-items.stderr b/tests/ui/suggestions/suggest-trait-items.stderr index 8bc3df7b817e3..9d76c2ed56cba 100644 --- a/tests/ui/suggestions/suggest-trait-items.stderr +++ b/tests/ui/suggestions/suggest-trait-items.stderr @@ -2,46 +2,56 @@ error[E0437]: type `Typ` is not a member of trait `Foo` --> $DIR/suggest-trait-items.rs:13:5 | LL | type Typ = (); - | ^^^^^---^^^^^^ - | | | - | | help: there is an associated type with a similar name: `Type` - | not a member of trait `Foo` + | ^^^^^^^^^^^^^^ not a member of trait `Foo` + | +help: there is an associated type with a similar name + | +LL | type Type = (); + | ~~~~ error[E0407]: method `fooo` is not a member of trait `Foo` --> $DIR/suggest-trait-items.rs:17:5 | LL | fn fooo() {} - | ^^^----^^^^^ - | | | - | | help: there is an associated function with a similar name: `foo` - | not a member of trait `Foo` + | ^^^^^^^^^^^^ not a member of trait `Foo` + | +help: there is an associated function with a similar name + | +LL | fn foo() {} + | ~~~ error[E0407]: method `barr` is not a member of trait `Foo` --> $DIR/suggest-trait-items.rs:21:5 | LL | fn barr() {} - | ^^^----^^^^^ - | | | - | | help: there is an associated function with a similar name: `bar` - | not a member of trait `Foo` + | ^^^^^^^^^^^^ not a member of trait `Foo` + | +help: there is an associated function with a similar name + | +LL | fn bar() {} + | ~~~ error[E0407]: method `quux` is not a member of trait `Foo` --> $DIR/suggest-trait-items.rs:25:5 | LL | fn quux() {} - | ^^^----^^^^^ - | | | - | | help: there is an associated function with a similar name: `qux` - | not a member of trait `Foo` + | ^^^^^^^^^^^^ not a member of trait `Foo` + | +help: there is an associated function with a similar name + | +LL | fn qux() {} + | ~~~ error[E0438]: const `Cnst` is not a member of trait `Bar` --> $DIR/suggest-trait-items.rs:42:5 | LL | const Cnst: i32 = 0; - | ^^^^^^----^^^^^^^^^^ - | | | - | | help: there is an associated constant with a similar name: `Const` - | not a member of trait `Bar` + | ^^^^^^^^^^^^^^^^^^^^ not a member of trait `Bar` + | +help: there is an associated constant with a similar name + | +LL | const Const: i32 = 0; + | ~~~~~ error[E0046]: not all trait items implemented, missing: `Type`, `foo`, `bar`, `qux` --> $DIR/suggest-trait-items.rs:11:1 diff --git a/tests/ui/suggestions/suggest-variants.stderr b/tests/ui/suggestions/suggest-variants.stderr index a422bc6563541..4f4dd3cddd5a5 100644 --- a/tests/ui/suggestions/suggest-variants.stderr +++ b/tests/ui/suggestions/suggest-variants.stderr @@ -5,7 +5,12 @@ LL | enum Shape { | ---------- variant `Squareee` not found here ... LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); - | ^^^^^^^^ help: there is a variant with a similar name: `Square` + | ^^^^^^^^ + | +help: there is a variant with a similar name + | +LL | println!("My shape is {:?}", Shape::Square { size: 5}); + | ~~~~~~ error[E0599]: no variant named `Circl` found for enum `Shape` --> $DIR/suggest-variants.rs:13:41 @@ -14,7 +19,12 @@ LL | enum Shape { | ---------- variant `Circl` not found here ... LL | println!("My shape is {:?}", Shape::Circl { size: 5}); - | ^^^^^ help: there is a variant with a similar name: `Circle` + | ^^^^^ + | +help: there is a variant with a similar name + | +LL | println!("My shape is {:?}", Shape::Circle { size: 5}); + | ~~~~~~ error[E0599]: no variant named `Rombus` found for enum `Shape` --> $DIR/suggest-variants.rs:14:41 @@ -32,10 +42,12 @@ LL | enum Shape { | ---------- variant or associated item `Squareee` not found for this enum ... LL | Shape::Squareee; - | ^^^^^^^^ - | | - | variant or associated item not found in `Shape` - | help: there is a variant with a similar name: `Square` + | ^^^^^^^^ variant or associated item not found in `Shape` + | +help: there is a variant with a similar name + | +LL | Shape::Square; + | ~~~~~~ error[E0599]: no variant or associated item named `Circl` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:16:12 @@ -44,10 +56,12 @@ LL | enum Shape { | ---------- variant or associated item `Circl` not found for this enum ... LL | Shape::Circl; - | ^^^^^ - | | - | variant or associated item not found in `Shape` - | help: there is a variant with a similar name: `Circle` + | ^^^^^ variant or associated item not found in `Shape` + | +help: there is a variant with a similar name + | +LL | Shape::Circle; + | ~~~~~~ error[E0599]: no variant or associated item named `Rombus` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:17:12 diff --git a/tests/ui/suggestions/trait-hidden-method.stderr b/tests/ui/suggestions/trait-hidden-method.stderr index 5dec20718467c..739c3793c6922 100644 --- a/tests/ui/suggestions/trait-hidden-method.stderr +++ b/tests/ui/suggestions/trait-hidden-method.stderr @@ -2,7 +2,12 @@ error[E0191]: the value of the associated type `Item` in `Iterator` must be spec --> $DIR/trait-hidden-method.rs:6:33 | LL | Box::new(1..=10) as Box - | ^^^^^^^^ help: specify the associated type: `Iterator` + | ^^^^^^^^ + | +help: specify the associated type + | +LL | Box::new(1..=10) as Box> + | ~~~~~~~~~~~~~~~~~~~~~ error[E0271]: expected `Box` to be an iterator that yields `u32`, but it yields `::Item` --> $DIR/trait-hidden-method.rs:3:32 diff --git a/tests/ui/suggestions/try-removing-the-field.stderr b/tests/ui/suggestions/try-removing-the-field.stderr index 7a6013d4a6eab..b9fc538976113 100644 --- a/tests/ui/suggestions/try-removing-the-field.stderr +++ b/tests/ui/suggestions/try-removing-the-field.stderr @@ -2,25 +2,37 @@ warning: unused variable: `bar` --> $DIR/try-removing-the-field.rs:12:20 | LL | let Foo { foo, bar, .. } = x; - | ^^^- - | | - | help: try removing the field + | ^^^ | = note: `#[warn(unused_variables)]` on by default +help: try removing the field + | +LL - let Foo { foo, bar, .. } = x; +LL + let Foo { foo, .. } = x; + | warning: unused variable: `unused` --> $DIR/try-removing-the-field.rs:20:20 | LL | Foo { foo: unused, .. } => { - | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + | ^^^^^^ + | +help: if this is intentional, prefix it with an underscore + | +LL | Foo { foo: _unused, .. } => { + | ~~~~~~~ warning: unused variable: `foo` --> $DIR/try-removing-the-field.rs:26:15 | LL | Foo { foo, .. } => { - | ^^^- - | | - | help: try removing the field + | ^^^ + | +help: try removing the field + | +LL - Foo { foo, .. } => { +LL + Foo { .. } => { + | warning: 3 warnings emitted diff --git a/tests/ui/suggestions/type-ascription-instead-of-method.stderr b/tests/ui/suggestions/type-ascription-instead-of-method.stderr index 3242b028d5d3e..06f806b90163f 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-method.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-method.stderr @@ -2,9 +2,13 @@ error: path separator must be a double colon --> $DIR/type-ascription-instead-of-method.rs:3:16 | LL | let _ = Box:new("foo".to_string()); - | ^ help: use a double colon instead: `::` + | ^ | = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 +help: use a double colon instead + | +LL | let _ = Box::new("foo".to_string()); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path.stderr b/tests/ui/suggestions/type-ascription-instead-of-path.stderr index 566b036e53e4d..9b09a60c16174 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path.stderr @@ -2,9 +2,13 @@ error: path separator must be a double colon --> $DIR/type-ascription-instead-of-path.rs:2:8 | LL | std:io::stdin(); - | ^ help: use a double colon instead: `::` + | ^ | = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 +help: use a double colon instead + | +LL | std::io::stdin(); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-variant.stderr b/tests/ui/suggestions/type-ascription-instead-of-variant.stderr index 6fea7f940523c..0ecdc82b5412f 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-variant.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-variant.stderr @@ -2,9 +2,13 @@ error: path separator must be a double colon --> $DIR/type-ascription-instead-of-variant.rs:3:19 | LL | let _ = Option:Some(""); - | ^ help: use a double colon instead: `::` + | ^ | = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 +help: use a double colon instead + | +LL | let _ = Option::Some(""); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/unnamable-types.stderr b/tests/ui/suggestions/unnamable-types.stderr index 6623678fd0c2d..0698c954b7a12 100644 --- a/tests/ui/suggestions/unnamable-types.stderr +++ b/tests/ui/suggestions/unnamable-types.stderr @@ -2,16 +2,23 @@ error: missing type for `const` item --> $DIR/unnamable-types.rs:6:8 | LL | const A = 5; - | ^ help: provide a type for the constant: `: i32` + | ^ + | +help: provide a type for the constant + | +LL | const A: i32 = 5; + | +++++ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/unnamable-types.rs:10:11 | LL | static B: _ = "abc"; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `&str` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | static B: &str = "abc"; + | ~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/unnamable-types.rs:17:10 @@ -41,13 +48,23 @@ error: missing type for `const` item --> $DIR/unnamable-types.rs:29:8 | LL | const E = foo; - | ^ help: provide a type for the constant: `: fn() -> i32` + | ^ + | +help: provide a type for the constant + | +LL | const E: fn() -> i32 = foo; + | +++++++++++++ error: missing type for `const` item --> $DIR/unnamable-types.rs:32:8 | LL | const F = S { t: foo }; - | ^ help: provide a type for the constant: `: S i32>` + | ^ + | +help: provide a type for the constant + | +LL | const F: S i32> = S { t: foo }; + | ++++++++++++++++ error: missing type for `const` item --> $DIR/unnamable-types.rs:37:8 diff --git a/tests/ui/suggestions/unused-closure-argument.stderr b/tests/ui/suggestions/unused-closure-argument.stderr index 55195ce50a13e..04f3b644b2fee 100644 --- a/tests/ui/suggestions/unused-closure-argument.stderr +++ b/tests/ui/suggestions/unused-closure-argument.stderr @@ -2,19 +2,28 @@ error: unused variable: `x` --> $DIR/unused-closure-argument.rs:12:23 | LL | .map(|Point { x, y }| y) - | ^ help: try ignoring the field: `x: _` + | ^ | note: the lint level is defined here --> $DIR/unused-closure-argument.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ +help: try ignoring the field + | +LL | .map(|Point { x: _, y }| y) + | ~~~~ error: unused variable: `x` --> $DIR/unused-closure-argument.rs:17:15 | LL | .map(|x| 4) - | ^ help: if this is intentional, prefix it with an underscore: `_x` + | ^ + | +help: if this is intentional, prefix it with an underscore + | +LL | .map(|_x| 4) + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/switched-expectations.stderr b/tests/ui/switched-expectations.stderr index cc57674740020..e235c2da1f736 100644 --- a/tests/ui/switched-expectations.stderr +++ b/tests/ui/switched-expectations.stderr @@ -2,9 +2,12 @@ error[E0308]: mismatched types --> $DIR/switched-expectations.rs:3:30 | LL | let ref string: String = var; - | ^^^- help: try using a conversion method: `.to_string()` - | | - | expected `String`, found `i32` + | ^^^ expected `String`, found `i32` + | +help: try using a conversion method + | +LL | let ref string: String = var.to_string(); + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/tag-variant-cast-non-nullary.stderr b/tests/ui/tag-variant-cast-non-nullary.stderr index 2e1dde27d0f98..4b022fcba526a 100644 --- a/tests/ui/tag-variant-cast-non-nullary.stderr +++ b/tests/ui/tag-variant-cast-non-nullary.stderr @@ -2,10 +2,14 @@ error[E0605]: non-primitive cast: `NonNullary` as `isize` --> $DIR/tag-variant-cast-non-nullary.rs:19:15 | LL | let val = v as isize; - | ^^^^^^^^^^ help: consider using the `From` trait instead: `isize::from(v)` + | ^^^^^^^^^^ | = note: an `as` expression can be used to convert enum types to numeric types only if the enum type is unit-only or field-less = note: see https://doc.rust-lang.org/reference/items/enumerations.html#casting for more information +help: consider using the `From` trait instead + | +LL | let val = isize::from(v); + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/target-feature/invalid-attribute.stderr b/tests/ui/target-feature/invalid-attribute.stderr index bf48911edec5f..8e17ca9414a77 100644 --- a/tests/ui/target-feature/invalid-attribute.stderr +++ b/tests/ui/target-feature/invalid-attribute.stderr @@ -2,7 +2,12 @@ error: malformed `target_feature` attribute input --> $DIR/invalid-attribute.rs:20:1 | LL | #[target_feature = "+sse2"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[target_feature(enable = "name")]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[target_feature(enable = "name")] + | error: attribute should be applied to a function definition --> $DIR/invalid-attribute.rs:5:1 @@ -156,13 +161,23 @@ error: malformed `target_feature` attribute input --> $DIR/invalid-attribute.rs:25:18 | LL | #[target_feature(bar)] - | ^^^ help: must be of the form: `enable = ".."` + | ^^^ + | +help: must be of the form + | +LL | #[target_feature(enable = "..")] + | ~~~~~~~~~~~~~ error: malformed `target_feature` attribute input --> $DIR/invalid-attribute.rs:27:18 | LL | #[target_feature(disable = "baz")] - | ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."` + | ^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[target_feature(enable = "..")] + | ~~~~~~~~~~~~~ error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions --> $DIR/invalid-attribute.rs:31:1 diff --git a/tests/ui/traits/alias/object-fail.stderr b/tests/ui/traits/alias/object-fail.stderr index a27a3ea0ec03e..8fbf06541c11c 100644 --- a/tests/ui/traits/alias/object-fail.stderr +++ b/tests/ui/traits/alias/object-fail.stderr @@ -13,7 +13,12 @@ error[E0191]: the value of the associated type `Item` in `Iterator` must be spec --> $DIR/object-fail.rs:9:17 | LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); - | ^^^^^^^^^^^^^ help: specify the associated type: `IteratorAlias` + | ^^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/alias/style_lint.stderr b/tests/ui/traits/alias/style_lint.stderr index 91e2ea90eb9e8..6a91212dbc349 100644 --- a/tests/ui/traits/alias/style_lint.stderr +++ b/tests/ui/traits/alias/style_lint.stderr @@ -2,9 +2,13 @@ warning: trait alias `bar` should have an upper camel case name --> $DIR/style_lint.rs:6:7 | LL | trait bar = std::fmt::Display + std::fmt::Debug; - | ^^^ help: convert the identifier to upper camel case: `Bar` + | ^^^ | = note: `#[warn(non_camel_case_types)]` on by default +help: convert the identifier to upper camel case + | +LL | trait Bar = std::fmt::Display + std::fmt::Debug; + | ~~~ warning: 1 warning emitted diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr index 06e2fa5d4d1fd..9193faeb1aa9a 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr @@ -117,15 +117,18 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:40:58 | LL | impl, U> YetAnotherTrait for Struct {} - | ^^^^^^ - help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:26:8 | LL | struct Struct> { | ^^^^^^ - +help: remove this generic argument + | +LL - impl, U> YetAnotherTrait for Struct {} +LL + impl, U> YetAnotherTrait for Struct {} + | error: aborting due to 9 previous errors diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 0020f9e416df2..16ad577248c10 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -80,10 +80,15 @@ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:19:51 | LL | fn issue_95327() where ::Assoc: String {} - | ^^^^^^ help: a trait with a similar name exists: `ToString` + | ^^^^^^ --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here + | +help: a trait with a similar name exists + | +LL | fn issue_95327() where ::Assoc: ToString {} + | ~~~~~~~~ error: aborting due to 6 previous errors diff --git a/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr b/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr index 38e692521ca23..afecb177cb83e 100644 --- a/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr +++ b/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr @@ -2,7 +2,12 @@ error: malformed `rustc_must_implement_one_of` attribute input --> $DIR/rustc_must_implement_one_of_misuse.rs:20:1 | LL | #[rustc_must_implement_one_of] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_must_implement_one_of(function1, function2, ...)]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: must be of the form + | +LL | #[rustc_must_implement_one_of(function1, function2, ...)] + | error: attribute should be applied to a trait --> $DIR/rustc_must_implement_one_of_misuse.rs:38:1 diff --git a/tests/ui/traits/impl-for-module.stderr b/tests/ui/traits/impl-for-module.stderr index b715c699e89f1..25b0e83d1154a 100644 --- a/tests/ui/traits/impl-for-module.stderr +++ b/tests/ui/traits/impl-for-module.stderr @@ -5,7 +5,12 @@ LL | trait A { | ------- similarly named trait `A` defined here ... LL | impl A for a { - | ^ help: a trait with a similar name exists: `A` + | ^ + | +help: a trait with a similar name exists + | +LL | impl A for A { + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr index 17fced307ed1f..bb7eb2727238d 100644 --- a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr +++ b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr @@ -2,9 +2,15 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/supertrait-auto-trait.rs:8:17 | LL | auto trait Magic: Copy {} - | -----^^^^^^ help: remove the super traits or lifetime bounds + | -----^^^^^^ | | | auto traits cannot have super traits or lifetime bounds + | +help: remove the super traits or lifetime bounds + | +LL - auto trait Magic: Copy {} +LL + auto trait Magic {} + | error[E0277]: the trait bound `NoClone: Magic` is not satisfied --> $DIR/supertrait-auto-trait.rs:16:23 diff --git a/tests/ui/traits/issue-35869.stderr b/tests/ui/traits/issue-35869.stderr index 6d985bdeaf859..503f9cee246e9 100644 --- a/tests/ui/traits/issue-35869.stderr +++ b/tests/ui/traits/issue-35869.stderr @@ -2,10 +2,7 @@ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/issue-35869.rs:11:15 | LL | fn foo(_: fn(u16) -> ()) {} - | ^^^^^^^^^^^^^ - | | - | expected `u8`, found `u16` - | help: change the parameter type to match the trait: `fn(u8)` + | ^^^^^^^^^^^^^ expected `u8`, found `u16` | note: type in trait --> $DIR/issue-35869.rs:2:15 @@ -14,15 +11,16 @@ LL | fn foo(_: fn(u8) -> ()); | ^^^^^^^^^^^^ = note: expected signature `fn(fn(u8))` found signature `fn(fn(u16))` +help: change the parameter type to match the trait + | +LL | fn foo(_: fn(u8)) {} + | ~~~~~~ error[E0053]: method `bar` has an incompatible type for trait --> $DIR/issue-35869.rs:13:15 | LL | fn bar(_: Option) {} - | ^^^^^^^^^^^ - | | - | expected `u8`, found `u16` - | help: change the parameter type to match the trait: `Option` + | ^^^^^^^^^^^ expected `u8`, found `u16` | note: type in trait --> $DIR/issue-35869.rs:3:15 @@ -31,15 +29,16 @@ LL | fn bar(_: Option); | ^^^^^^^^^^ = note: expected signature `fn(Option)` found signature `fn(Option)` +help: change the parameter type to match the trait + | +LL | fn bar(_: Option) {} + | ~~~~~~~~~~ error[E0053]: method `baz` has an incompatible type for trait --> $DIR/issue-35869.rs:15:15 | LL | fn baz(_: (u16, u16)) {} - | ^^^^^^^^^^ - | | - | expected `u8`, found `u16` - | help: change the parameter type to match the trait: `(u8, u16)` + | ^^^^^^^^^^ expected `u8`, found `u16` | note: type in trait --> $DIR/issue-35869.rs:4:15 @@ -48,15 +47,16 @@ LL | fn baz(_: (u8, u16)); | ^^^^^^^^^ = note: expected signature `fn((u8, _))` found signature `fn((u16, _))` +help: change the parameter type to match the trait + | +LL | fn baz(_: (u8, u16)) {} + | ~~~~~~~~~ error[E0053]: method `qux` has an incompatible type for trait --> $DIR/issue-35869.rs:17:17 | LL | fn qux() -> u16 { 5u16 } - | ^^^ - | | - | expected `u8`, found `u16` - | help: change the output type to match the trait: `u8` + | ^^^ expected `u8`, found `u16` | note: type in trait --> $DIR/issue-35869.rs:5:17 @@ -65,6 +65,10 @@ LL | fn qux() -> u8; | ^^ = note: expected signature `fn() -> u8` found signature `fn() -> u16` +help: change the output type to match the trait + | +LL | fn qux() -> u8 { 5u16 } + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr index cdcb0cdf2593d..8e5b1b54808c4 100644 --- a/tests/ui/traits/issue-78372.stderr +++ b/tests/ui/traits/issue-78372.stderr @@ -58,9 +58,6 @@ LL | impl DispatchFromDyn> for T {} error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/issue-78372.rs:12:17 | -LL | fn foo(self: Smaht); - | -------------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` -... LL | impl Marker for dyn Foo {} | ^^^^^^^ `Foo` cannot be made into an object | @@ -72,6 +69,10 @@ LL | trait Foo: X {} LL | trait X { LL | fn foo(self: Smaht); | ^^^^^^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on +help: consider changing method `foo`'s `self` parameter to be `&self` + | +LL | fn foo(self: &Self); + | ~~~~~ error[E0307]: invalid `self` parameter type: `Smaht` --> $DIR/issue-78372.rs:9:18 diff --git a/tests/ui/traits/issue-87558.stderr b/tests/ui/traits/issue-87558.stderr index 4cc3ec2ea8b9c..e7ec4543dbd00 100644 --- a/tests/ui/traits/issue-87558.stderr +++ b/tests/ui/traits/issue-87558.stderr @@ -40,7 +40,10 @@ error[E0046]: not all trait items implemented, missing: `call` LL | impl Fn(&isize) for Error { | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation | - = help: implement the missing item: `fn call(&self, _: (&isize,)) -> >::Output { todo!() }` +help: implement the missing item + | +LL + fn call(&self, _: (&isize,)) -> >::Output { todo!() } + | error: aborting due to 5 previous errors diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index fd474fac15589..a94419ef8daad 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -175,13 +175,23 @@ error[E0223]: ambiguous associated type --> $DIR/item-privacy.rs:116:12 | LL | let _: S::B; - | ^^^^ help: use fully-qualified syntax: `::B` + | ^^^^ + | +help: use fully-qualified syntax + | +LL | let _: ::B; + | ~~~~~~~~~~~~~~~~~~~~~ error[E0223]: ambiguous associated type --> $DIR/item-privacy.rs:117:12 | LL | let _: S::C; - | ^^^^ help: use fully-qualified syntax: `::C` + | ^^^^ + | +help: use fully-qualified syntax + | +LL | let _: ::C; + | ~~~~~~~~~~~~~~~~~~~~~ error[E0624]: associated type `A` is private --> $DIR/item-privacy.rs:119:12 diff --git a/tests/ui/traits/next-solver/dont-canonicalize-re-error.stderr b/tests/ui/traits/next-solver/dont-canonicalize-re-error.stderr index cf85c52fb42ee..989ee1c6d7c15 100644 --- a/tests/ui/traits/next-solver/dont-canonicalize-re-error.stderr +++ b/tests/ui/traits/next-solver/dont-canonicalize-re-error.stderr @@ -2,9 +2,12 @@ error[E0261]: use of undeclared lifetime name `'missing` --> $DIR/dont-canonicalize-re-error.rs:25:26 | LL | impl Constrain<'missing> for W {} - | - ^^^^^^^^ undeclared lifetime - | | - | help: consider introducing lifetime `'missing` here: `'missing,` + | ^^^^^^^^ undeclared lifetime + | +help: consider introducing lifetime `'missing` here + | +LL | impl<'missing, A: Sized> Constrain<'missing> for W {} + | +++++++++ error[E0119]: conflicting implementations of trait `Tr<'_>` for type `W<_>` --> $DIR/dont-canonicalize-re-error.rs:21:1 diff --git a/tests/ui/traits/object/pretty.stderr b/tests/ui/traits/object/pretty.stderr index bc645e5f9677d..ad027d74bb6ee 100644 --- a/tests/ui/traits/object/pretty.stderr +++ b/tests/ui/traits/object/pretty.stderr @@ -2,155 +2,183 @@ error[E0308]: mismatched types --> $DIR/pretty.rs:21:43 | LL | fn dyn_super(x: &dyn Super) { x } - | - ^ expected `()`, found `&dyn Super` - | | - | help: try adding a return type: `-> &dyn Super` + | ^ expected `()`, found `&dyn Super` | = note: expected unit type `()` found reference `&dyn Super` +help: try adding a return type + | +LL | fn dyn_super(x: &dyn Super) -> &dyn Super { x } + | +++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:22:39 | LL | fn dyn_any(x: &dyn Any) { x } - | - ^ expected `()`, found `&dyn Any` - | | - | help: try adding a return type: `-> &dyn Any` + | ^ expected `()`, found `&dyn Any` | = note: expected unit type `()` found reference `&dyn Any` +help: try adding a return type + | +LL | fn dyn_any(x: &dyn Any) -> &dyn Any { x } + | +++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:23:31 | LL | fn dyn_fixed(x: &dyn Fixed) { x } - | - ^ expected `()`, found `&dyn Fixed` - | | - | help: try adding a return type: `-> &dyn Fixed` + | ^ expected `()`, found `&dyn Fixed` | = note: expected unit type `()` found reference `&dyn Fixed` +help: try adding a return type + | +LL | fn dyn_fixed(x: &dyn Fixed) -> &dyn Fixed { x } + | +++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:24:50 | LL | fn dyn_fixed_multi(x: &dyn Fixed) { x } - | - ^ expected `()`, found `&dyn Fixed` - | | - | help: try adding a return type: `-> &dyn Fixed` + | ^ expected `()`, found `&dyn Fixed` | = note: expected unit type `()` found reference `&dyn Fixed` +help: try adding a return type + | +LL | fn dyn_fixed_multi(x: &dyn Fixed) -> &dyn Fixed { x } + | ++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:25:38 | LL | fn dyn_fixed_sub(x: &dyn FixedSub) { x } - | - ^ expected `()`, found `&dyn FixedSub` - | | - | help: try adding a return type: `-> &dyn FixedSub` + | ^ expected `()`, found `&dyn FixedSub` | = note: expected unit type `()` found reference `&dyn FixedSub` +help: try adding a return type + | +LL | fn dyn_fixed_sub(x: &dyn FixedSub) -> &dyn FixedSub { x } + | ++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:26:44 | LL | fn dyn_fixed_static(x: &dyn FixedStatic) { x } - | - ^ expected `()`, found `&dyn FixedStatic` - | | - | help: try adding a return type: `-> &dyn FixedStatic` + | ^ expected `()`, found `&dyn FixedStatic` | = note: expected unit type `()` found reference `&dyn FixedStatic` +help: try adding a return type + | +LL | fn dyn_fixed_static(x: &dyn FixedStatic) -> &dyn FixedStatic { x } + | +++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:28:75 | LL | fn dyn_super_generic(x: &dyn for<'a> SuperGeneric<'a, Assoc2 = &'a u8>) { x } - | - ^ expected `()`, found `&dyn SuperGeneric<'a, Assoc2 = &u8>` - | | - | help: try adding a return type: `-> &dyn for<'a> SuperGeneric<'a, Assoc2 = &'a u8>` + | ^ expected `()`, found `&dyn SuperGeneric<'a, Assoc2 = &u8>` | = note: expected unit type `()` found reference `&dyn for<'a> SuperGeneric<'a, Assoc2 = &'a u8>` +help: try adding a return type + | +LL | fn dyn_super_generic(x: &dyn for<'a> SuperGeneric<'a, Assoc2 = &'a u8>) -> &dyn for<'a> SuperGeneric<'a, Assoc2 = &'a u8> { x } + | +++++++++++++++++++++++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:29:71 | LL | fn dyn_any_generic(x: &dyn for<'a> AnyGeneric<'a, Assoc2 = &'a u8>) { x } - | - ^ expected `()`, found `&dyn AnyGeneric<'a, Assoc2 = &u8>` - | | - | help: try adding a return type: `-> &dyn for<'a> AnyGeneric<'a, Assoc2 = &'a u8>` + | ^ expected `()`, found `&dyn AnyGeneric<'a, Assoc2 = &u8>` | = note: expected unit type `()` found reference `&dyn for<'a> AnyGeneric<'a, Assoc2 = &'a u8>` +help: try adding a return type + | +LL | fn dyn_any_generic(x: &dyn for<'a> AnyGeneric<'a, Assoc2 = &'a u8>) -> &dyn for<'a> AnyGeneric<'a, Assoc2 = &'a u8> { x } + | +++++++++++++++++++++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:30:60 | LL | fn dyn_fixed_generic1(x: &dyn for<'a> FixedGeneric1<'a>) { x } - | - ^ expected `()`, found `&dyn FixedGeneric1<'a>` - | | - | help: try adding a return type: `-> &dyn for<'a> FixedGeneric1<'a>` + | ^ expected `()`, found `&dyn FixedGeneric1<'a>` | = note: expected unit type `()` found reference `&dyn for<'a> FixedGeneric1<'a>` +help: try adding a return type + | +LL | fn dyn_fixed_generic1(x: &dyn for<'a> FixedGeneric1<'a>) -> &dyn for<'a> FixedGeneric1<'a> { x } + | +++++++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:31:60 | LL | fn dyn_fixed_generic2(x: &dyn for<'a> FixedGeneric2<'a>) { x } - | - ^ expected `()`, found `&dyn FixedGeneric2<'a>` - | | - | help: try adding a return type: `-> &dyn for<'a> FixedGeneric2<'a>` + | ^ expected `()`, found `&dyn FixedGeneric2<'a>` | = note: expected unit type `()` found reference `&dyn for<'a> FixedGeneric2<'a>` +help: try adding a return type + | +LL | fn dyn_fixed_generic2(x: &dyn for<'a> FixedGeneric2<'a>) -> &dyn for<'a> FixedGeneric2<'a> { x } + | +++++++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:32:79 | LL | fn dyn_fixed_generic_multi(x: &dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8>) { x } - | - ^ expected `()`, found `&dyn FixedGeneric1<'a, Assoc2 = ...>` - | | - | help: try adding a return type: `-> &dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8>` + | ^ expected `()`, found `&dyn FixedGeneric1<'a, Assoc2 = ...>` | = note: expected unit type `()` found reference `&dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8>` +help: try adding a return type + | +LL | fn dyn_fixed_generic_multi(x: &dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8>) -> &dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8> { x } + | +++++++++++++++++++++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:33:40 | LL | fn dyn_fixed_hrtb(x: &dyn FixedHrtb) { x } - | - ^ expected `()`, found `&dyn FixedHrtb` - | | - | help: try adding a return type: `-> &dyn FixedHrtb` + | ^ expected `()`, found `&dyn FixedHrtb` | = note: expected unit type `()` found reference `&dyn FixedHrtb` +help: try adding a return type + | +LL | fn dyn_fixed_hrtb(x: &dyn FixedHrtb) -> &dyn FixedHrtb { x } + | +++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:34:73 | LL | fn dyn_any_different_binders(x: &dyn AnyDifferentBinders) { x } - | - ^ expected `()`, found `&dyn AnyDifferentBinders` - | | - | help: try adding a return type: `-> &dyn AnyDifferentBinders` + | ^ expected `()`, found `&dyn AnyDifferentBinders` | = note: expected unit type `()` found reference `&dyn AnyDifferentBinders` +help: try adding a return type + | +LL | fn dyn_any_different_binders(x: &dyn AnyDifferentBinders) -> &dyn AnyDifferentBinders { x } + | +++++++++++++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/pretty.rs:35:65 | LL | fn dyn_fixed_different_binders(x: &dyn FixedDifferentBinders) { x } - | - ^ expected `()`, found `&dyn FixedDifferentBinders` - | | - | help: try adding a return type: `-> &dyn FixedDifferentBinders` + | ^ expected `()`, found `&dyn FixedDifferentBinders` | = note: expected unit type `()` found reference `&dyn FixedDifferentBinders` +help: try adding a return type + | +LL | fn dyn_fixed_different_binders(x: &dyn FixedDifferentBinders) -> &dyn FixedDifferentBinders { x } + | +++++++++++++++++++++++++++++ error: aborting due to 14 previous errors diff --git a/tests/ui/traits/object/vs-lifetime.stderr b/tests/ui/traits/object/vs-lifetime.stderr index a69cd140807ff..aab4845a27420 100644 --- a/tests/ui/traits/object/vs-lifetime.stderr +++ b/tests/ui/traits/object/vs-lifetime.stderr @@ -8,15 +8,18 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/vs-lifetime.rs:11:12 | LL | let _: S<'static, 'static>; - | ^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/vs-lifetime.rs:4:8 | LL | struct S<'a, T>(&'a u8, T); | ^ -- +help: remove this lifetime argument + | +LL - let _: S<'static, 'static>; +LL + let _: S<'static, >; + | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/vs-lifetime.rs:11:12 diff --git a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr index c9b36e8d29de7..b1f8a19895c77 100644 --- a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr +++ b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr @@ -5,7 +5,12 @@ LL | type Output; | ----------- `Output` defined here ... LL | let _x: Box> = Box::new(2u32); - | ^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Helper` + | ^^^^^^^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let _x: Box> = Box::new(2u32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0191]: the value of the associated type `Output` in `Base` must be specified --> $DIR/with-self-in-projection-output-bad.rs:48:21 @@ -14,7 +19,12 @@ LL | type Output; | ----------- `Output` defined here ... LL | let _y: Box> = Box::new(2u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated type: `NormalizableHelper` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let _y: Box> = Box::new(2u32); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/question-mark-result-err-mismatch.stderr b/tests/ui/traits/question-mark-result-err-mismatch.stderr index 66276bcbe3bb0..fc65596b4f092 100644 --- a/tests/ui/traits/question-mark-result-err-mismatch.stderr +++ b/tests/ui/traits/question-mark-result-err-mismatch.stderr @@ -7,7 +7,6 @@ LL | fn foo() -> Result { LL | .map_err(|e| { | __________- LL | | e; - | | - help: remove this semicolon LL | | }) | |__________- this can't be annotated with `?` because it has type `Result<_, ()>` LL | .map(|()| "")?; @@ -15,6 +14,11 @@ LL | .map(|()| "")?; | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = note: required for `Result` to implement `FromResidual>` +help: remove this semicolon + | +LL - e; +LL + e + | error[E0277]: `?` couldn't convert the error to `String` --> $DIR/question-mark-result-err-mismatch.rs:28:25 @@ -48,7 +52,6 @@ LL | fn baz() -> Result { LL | .ok_or_else(|| { | __________- LL | | "Couldn't split the test string"; - | | - help: remove this semicolon LL | | })?; | | -^ the trait `From<()>` is not implemented for `String`, which is required by `Result: FromResidual>` | |__________| @@ -56,6 +59,11 @@ LL | | })?; | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = note: required for `Result` to implement `FromResidual>` +help: remove this semicolon + | +LL - "Couldn't split the test string"; +LL + "Couldn't split the test string" + | error: aborting due to 3 previous errors diff --git a/tests/ui/traits/span-bug-issue-121414.stderr b/tests/ui/traits/span-bug-issue-121414.stderr index e2ef6672cd57a..42ac608d7d3d1 100644 --- a/tests/ui/traits/span-bug-issue-121414.stderr +++ b/tests/ui/traits/span-bug-issue-121414.stderr @@ -2,9 +2,12 @@ error[E0261]: use of undeclared lifetime name `'f` --> $DIR/span-bug-issue-121414.rs:5:22 | LL | impl<'a> Bar for Foo<'f> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'f` here: `'f,` + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'f` here + | +LL | impl<'f, 'a> Bar for Foo<'f> { + | +++ error[E0277]: the trait bound `for<'a> Foo<'a>: Bar` is not satisfied --> $DIR/span-bug-issue-121414.rs:9:1 diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr index 3972e539776c4..9916cf97fca95 100644 --- a/tests/ui/traits/test-2.stderr +++ b/tests/ui/traits/test-2.stderr @@ -2,29 +2,35 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/test-2.rs:9:8 | LL | 10.dup::(); - | ^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/test-2.rs:4:16 | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^ +help: remove these generics + | +LL - 10.dup::(); +LL + 10.dup(); + | error[E0107]: method takes 1 generic argument but 2 generic arguments were supplied --> $DIR/test-2.rs:11:8 | LL | 10.blah::(); - | ^^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^ expected 1 generic argument | note: method defined here, with 1 generic parameter: `X` --> $DIR/test-2.rs:4:39 | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^^ - +help: remove this generic argument + | +LL - 10.blah::(); +LL + 10.blah::(); + | error[E0038]: the trait `bar` cannot be made into an object --> $DIR/test-2.rs:13:22 diff --git a/tests/ui/traits/trait-selection-ice-84727.stderr b/tests/ui/traits/trait-selection-ice-84727.stderr index d4bc4163897c4..6a47981edec25 100644 --- a/tests/ui/traits/trait-selection-ice-84727.stderr +++ b/tests/ui/traits/trait-selection-ice-84727.stderr @@ -34,12 +34,14 @@ LL | fn over(self) -> Cell { | ---- ^^^^^^^^^^^ expected `Cell`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -LL | -LL | self.over(); - | - help: remove this semicolon to return this value | = note: expected struct `Cell` found unit type `()` +help: remove this semicolon to return this value + | +LL - self.over(); +LL + self.over() + | error: aborting due to 5 previous errors diff --git a/tests/ui/traits/wrong-mul-method-signature.stderr b/tests/ui/traits/wrong-mul-method-signature.stderr index 91162cbc1231f..e30b61622ae01 100644 --- a/tests/ui/traits/wrong-mul-method-signature.stderr +++ b/tests/ui/traits/wrong-mul-method-signature.stderr @@ -2,37 +2,40 @@ error[E0053]: method `mul` has an incompatible type for trait --> $DIR/wrong-mul-method-signature.rs:16:21 | LL | fn mul(self, s: &f64) -> Vec1 { - | ^^^^ - | | - | expected `f64`, found `&f64` - | help: change the parameter type to match the trait: `f64` + | ^^^^ expected `f64`, found `&f64` | = note: expected signature `fn(Vec1, _) -> Vec1` found signature `fn(Vec1, &_) -> Vec1` +help: change the parameter type to match the trait + | +LL | fn mul(self, s: f64) -> Vec1 { + | ~~~ error[E0053]: method `mul` has an incompatible type for trait --> $DIR/wrong-mul-method-signature.rs:33:21 | LL | fn mul(self, s: f64) -> Vec2 { - | ^^^ - | | - | expected `Vec2`, found `f64` - | help: change the parameter type to match the trait: `Vec2` + | ^^^ expected `Vec2`, found `f64` | = note: expected signature `fn(Vec2, Vec2) -> f64` found signature `fn(Vec2, f64) -> Vec2` +help: change the parameter type to match the trait + | +LL | fn mul(self, s: Vec2) -> Vec2 { + | ~~~~ error[E0053]: method `mul` has an incompatible type for trait --> $DIR/wrong-mul-method-signature.rs:52:29 | LL | fn mul(self, s: f64) -> f64 { - | ^^^ - | | - | expected `i32`, found `f64` - | help: change the output type to match the trait: `i32` + | ^^^ expected `i32`, found `f64` | = note: expected signature `fn(Vec3, _) -> i32` found signature `fn(Vec3, _) -> f64` +help: change the output type to match the trait + | +LL | fn mul(self, s: f64) -> i32 { + | ~~~ error[E0308]: mismatched types --> $DIR/wrong-mul-method-signature.rs:63:45 diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index 38912696c18e3..69cc809e8eb73 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -1,13 +1,16 @@ error[E0107]: trait takes at most 2 generic arguments but 5 generic arguments were supplied --> $DIR/issue-101739-2.rs:17:14 | -LL | Dst: BikeshedIntrinsicFrom< - | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments -... -LL | / ASSUME_LIFETIMES, -LL | | ASSUME_VALIDITY, -LL | | ASSUME_VISIBILITY, - | |_____________________________- help: remove these generic arguments +LL | Dst: BikeshedIntrinsicFrom< + | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments + | +help: remove these generic arguments + | +LL - ASSUME_LIFETIMES, +LL - ASSUME_VALIDITY, +LL - ASSUME_VISIBILITY, +LL + , + | error[E0308]: mismatched types --> $DIR/issue-101739-2.rs:19:13 diff --git a/tests/ui/tuple/array-diagnostics.stderr b/tests/ui/tuple/array-diagnostics.stderr index 629ca2b37fa5a..e2dd49f0b76b6 100644 --- a/tests/ui/tuple/array-diagnostics.stderr +++ b/tests/ui/tuple/array-diagnostics.stderr @@ -2,7 +2,12 @@ error[E0618]: expected function, found `(&'static str, {integer})` --> $DIR/array-diagnostics.rs:4:9 | LL | ("C200B40A83", 4) - | ^^^^^^^^^^^^^^^^^- help: consider separating array elements with a comma: `,` + | ^^^^^^^^^^^^^^^^^ + | +help: consider separating array elements with a comma + | +LL | ("C200B40A83", 4), + | + error: aborting due to 1 previous error diff --git a/tests/ui/tuple/tuple-struct-fields/test.stderr b/tests/ui/tuple/tuple-struct-fields/test.stderr index bfa0b32fd458a..60887a3c153f4 100644 --- a/tests/ui/tuple/tuple-struct-fields/test.stderr +++ b/tests/ui/tuple/tuple-struct-fields/test.stderr @@ -2,9 +2,12 @@ error: expected one of `)` or `,`, found `(` --> $DIR/test.rs:4:26 | LL | struct S2(pub((foo)) ()); - | -^ expected one of `)` or `,` - | | - | help: missing `,` + | ^ expected one of `)` or `,` + | +help: missing `,` + | +LL | struct S2(pub((foo)), ()); + | + error[E0412]: cannot find type `foo` in this scope --> $DIR/test.rs:4:20 diff --git a/tests/ui/tuple/tuple-struct-fields/test2.stderr b/tests/ui/tuple/tuple-struct-fields/test2.stderr index 784411aba8f8a..1b4845c083808 100644 --- a/tests/ui/tuple/tuple-struct-fields/test2.stderr +++ b/tests/ui/tuple/tuple-struct-fields/test2.stderr @@ -2,14 +2,16 @@ error: expected one of `)` or `,`, found `(` --> $DIR/test2.rs:5:26 | LL | struct S3(pub $t ()); - | -^ expected one of `)` or `,` - | | - | help: missing `,` + | ^ expected one of `)` or `,` ... LL | define_struct! { (foo) } | ------------------------ in this macro invocation | = note: this error originates in the macro `define_struct` (in Nightly builds, run with -Z macro-backtrace for more info) +help: missing `,` + | +LL | struct S3(pub $t, ()); + | + error[E0412]: cannot find type `foo` in this scope --> $DIR/test2.rs:11:23 diff --git a/tests/ui/tuple/tuple-struct-fields/test3.stderr b/tests/ui/tuple/tuple-struct-fields/test3.stderr index 00b07c0315292..0e357d08e9e1d 100644 --- a/tests/ui/tuple/tuple-struct-fields/test3.stderr +++ b/tests/ui/tuple/tuple-struct-fields/test3.stderr @@ -2,14 +2,16 @@ error: expected one of `)` or `,`, found `(` --> $DIR/test3.rs:5:27 | LL | struct S3(pub($t) ()); - | -^ expected one of `)` or `,` - | | - | help: missing `,` + | ^ expected one of `)` or `,` ... LL | define_struct! { foo } | ---------------------- in this macro invocation | = note: this error originates in the macro `define_struct` (in Nightly builds, run with -Z macro-backtrace for more info) +help: missing `,` + | +LL | struct S3(pub($t), ()); + | + error[E0412]: cannot find type `foo` in this scope --> $DIR/test3.rs:11:22 diff --git a/tests/ui/tuple/wrong_argument_ice-4.stderr b/tests/ui/tuple/wrong_argument_ice-4.stderr index 3c7d6699be2b5..10191faf7bf03 100644 --- a/tests/ui/tuple/wrong_argument_ice-4.stderr +++ b/tests/ui/tuple/wrong_argument_ice-4.stderr @@ -6,16 +6,21 @@ LL | (|| {})(|| { LL | | LL | | let b = 1; LL | | }); - | | - - | | | - | |_____unexpected argument of type `{closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15}` - | help: remove the extra argument + | |_____- unexpected argument of type `{closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15}` | note: closure defined here --> $DIR/wrong_argument_ice-4.rs:2:6 | LL | (|| {})(|| { | ^^ +help: remove the extra argument + | +LL - (|| {})(|| { +LL - +LL - let b = 1; +LL - }); +LL + (|| {})(); + | error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index 96a5c13276331..a2dd6805f3d5c 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -308,29 +308,35 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:64:5 | LL | AliasFixed::<()>::TSVariant(()); - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::TSVariant(()); +LL + AliasFixed::TSVariant(()); + | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:66:5 | LL | AliasFixed::<()>::TSVariant::<()>(()); - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::TSVariant::<()>(()); +LL + AliasFixed::TSVariant::<()>(()); + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:66:35 @@ -399,29 +405,35 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:82:5 | LL | AliasFixed::<()>::SVariant { v: () }; - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::SVariant { v: () }; +LL + AliasFixed::SVariant { v: () }; + | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:84:5 | LL | AliasFixed::<()>::SVariant::<()> { v: () }; - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::SVariant::<()> { v: () }; +LL + AliasFixed::SVariant::<()> { v: () }; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:84:34 @@ -474,29 +486,35 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:100:5 | LL | AliasFixed::<()>::UVariant; - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::UVariant; +LL + AliasFixed::UVariant; + | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:102:5 | LL | AliasFixed::<()>::UVariant::<()>; - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::UVariant::<()>; +LL + AliasFixed::UVariant::<()>; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:102:34 diff --git a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr index 0f42fcbe04d0a..8c5ae3eee0a68 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr @@ -2,7 +2,7 @@ error: ambiguous associated item --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:32:15 | LL | fn f() -> Self::V { 0 } - | ^^^^^^^ help: use fully-qualified syntax: `::V` + | ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #57644 @@ -17,6 +17,10 @@ note: `V` could also refer to the associated type defined here LL | type V; | ^^^^^^ = note: `#[deny(ambiguous_associated_items)]` on by default +help: use fully-qualified syntax + | +LL | fn f() -> ::V { 0 } + | ~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr index 0d6eac4216bae..180aabab3adfe 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr @@ -2,7 +2,7 @@ error[E0283]: type annotations needed: cannot satisfy `Foo: Trait` --> $DIR/constrain_in_projection2.rs:27:14 | LL | let x = >::Assoc::default(); - | ^^^ help: use the fully qualified path to an implementation: `::Assoc` + | ^^^ | note: multiple `impl`s satisfying `Foo: Trait` found --> $DIR/constrain_in_projection2.rs:18:1 @@ -13,6 +13,10 @@ LL | impl Trait<()> for Foo { LL | impl Trait for Foo { | ^^^^^^^^^^^^^^^^^^^^^^^ = note: associated types cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` +help: use the fully qualified path to an implementation + | +LL | let x = <::Assoc as Trait>::Assoc::default(); + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/issue-77179.stderr b/tests/ui/type-alias-impl-trait/issue-77179.stderr index 85a943c26e2d5..8a77396421c23 100644 --- a/tests/ui/type-alias-impl-trait/issue-77179.stderr +++ b/tests/ui/type-alias-impl-trait/issue-77179.stderr @@ -28,10 +28,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/issue-77179.rs:18:25 | LL | fn bar() -> Pointer<_>; - | ^ - | | - | not allowed in type signatures - | help: use type parameters instead: `T` + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn bar() -> Pointer; + | ~ error: aborting due to 3 previous errors diff --git a/tests/ui/type-alias-impl-trait/unnameable_type.stderr b/tests/ui/type-alias-impl-trait/unnameable_type.stderr index f567b01d29a1b..5b331c5660d9c 100644 --- a/tests/ui/type-alias-impl-trait/unnameable_type.stderr +++ b/tests/ui/type-alias-impl-trait/unnameable_type.stderr @@ -5,10 +5,7 @@ LL | type MyPrivate = impl Sized; | ---------- the found opaque type LL | impl Trait for u32 { LL | fn dont_define_this(private: MyPrivate) { - | ^^^^^^^^^ - | | - | expected `Private`, found opaque type - | help: change the parameter type to match the trait: `Private` + | ^^^^^^^^^ expected `Private`, found opaque type | note: type in trait --> $DIR/unnameable_type.rs:10:39 @@ -17,6 +14,10 @@ LL | fn dont_define_this(_private: Private) {} | ^^^^^^^ = note: expected signature `fn(Private)` found signature `fn(MyPrivate)` +help: change the parameter type to match the trait + | +LL | fn dont_define_this(private: Private) { + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/type/ascription/issue-47666.stderr b/tests/ui/type/ascription/issue-47666.stderr index 562ce53052bd1..d76d591ec33f8 100644 --- a/tests/ui/type/ascription/issue-47666.stderr +++ b/tests/ui/type/ascription/issue-47666.stderr @@ -2,9 +2,13 @@ error: path separator must be a double colon --> $DIR/issue-47666.rs:3:19 | LL | let _ = Option:Some(vec![0, 1]); - | ^ help: use a double colon instead: `::` + | ^ | = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 +help: use a double colon instead + | +LL | let _ = Option::Some(vec![0, 1]); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/type/ascription/issue-54516.stderr b/tests/ui/type/ascription/issue-54516.stderr index 2c567a1a0ff61..bea2c0d85b3aa 100644 --- a/tests/ui/type/ascription/issue-54516.stderr +++ b/tests/ui/type/ascription/issue-54516.stderr @@ -2,9 +2,13 @@ error: path separator must be a double colon --> $DIR/issue-54516.rs:5:28 | LL | println!("{}", std::mem:size_of::>()); - | ^ help: use a double colon instead: `::` + | ^ | = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 +help: use a double colon instead + | +LL | println!("{}", std::mem::size_of::>()); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/type/ascription/issue-60933.stderr b/tests/ui/type/ascription/issue-60933.stderr index cd184ceba3313..a81238bd54007 100644 --- a/tests/ui/type/ascription/issue-60933.stderr +++ b/tests/ui/type/ascription/issue-60933.stderr @@ -2,9 +2,13 @@ error: path separator must be a double colon --> $DIR/issue-60933.rs:3:28 | LL | let _: usize = std::mem:size_of::(); - | ^ help: use a double colon instead: `::` + | ^ | = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 +help: use a double colon instead + | +LL | let _: usize = std::mem::size_of::(); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/type/binding-assigned-block-without-tail-expression.stderr b/tests/ui/type/binding-assigned-block-without-tail-expression.stderr index 3e96d7f317b4a..bf6d5fa581234 100644 --- a/tests/ui/type/binding-assigned-block-without-tail-expression.stderr +++ b/tests/ui/type/binding-assigned-block-without-tail-expression.stderr @@ -1,15 +1,17 @@ error[E0277]: `()` doesn't implement `std::fmt::Display` --> $DIR/binding-assigned-block-without-tail-expression.rs:14:20 | -LL | 42; - | - help: remove this semicolon -... LL | println!("{}", x); | ^ `()` cannot be formatted with the default formatter | = help: the trait `std::fmt::Display` is not implemented for `()` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this semicolon + | +LL - 42; +LL + 42 + | error[E0277]: `()` doesn't implement `std::fmt::Display` --> $DIR/binding-assigned-block-without-tail-expression.rs:15:20 @@ -27,15 +29,17 @@ LL | println!("{}", y); error[E0277]: `()` doesn't implement `std::fmt::Display` --> $DIR/binding-assigned-block-without-tail-expression.rs:16:20 | -LL | "hi"; - | - help: remove this semicolon -... LL | println!("{}", z); | ^ `()` cannot be formatted with the default formatter | = help: the trait `std::fmt::Display` is not implemented for `()` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove this semicolon + | +LL - "hi"; +LL + "hi" + | error[E0277]: `()` doesn't implement `std::fmt::Display` --> $DIR/binding-assigned-block-without-tail-expression.rs:17:20 @@ -56,13 +60,16 @@ LL | println!("{}", s); error[E0308]: mismatched types --> $DIR/binding-assigned-block-without-tail-expression.rs:18:18 | -LL | 42; - | - help: remove this semicolon -... LL | let _: i32 = x; | --- ^ expected `i32`, found `()` | | | expected due to this + | +help: remove this semicolon + | +LL - 42; +LL + 42 + | error[E0308]: mismatched types --> $DIR/binding-assigned-block-without-tail-expression.rs:19:18 diff --git a/tests/ui/type/issue-102598.stderr b/tests/ui/type/issue-102598.stderr index a232395cedb1d..ae82d15663b97 100644 --- a/tests/ui/type/issue-102598.stderr +++ b/tests/ui/type/issue-102598.stderr @@ -29,9 +29,12 @@ error: expected one of `)`, `+`, or `,`, found `Sized` --> $DIR/issue-102598.rs:1:23 | LL | fn foo<'a>(_: impl 'a Sized) {} - | -^^^^^ expected one of `)`, `+`, or `,` - | | - | help: missing `,` + | ^^^^^ expected one of `)`, `+`, or `,` + | +help: missing `,` + | +LL | fn foo<'a>(_: impl 'a, Sized) {} + | + error: at least one trait must be specified --> $DIR/issue-102598.rs:1:15 diff --git a/tests/ui/type/issue-7607-1.stderr b/tests/ui/type/issue-7607-1.stderr index db4c8f25dbc43..2fc6b43071069 100644 --- a/tests/ui/type/issue-7607-1.stderr +++ b/tests/ui/type/issue-7607-1.stderr @@ -2,10 +2,15 @@ error[E0412]: cannot find type `Fo` in this scope --> $DIR/issue-7607-1.rs:5:6 | LL | impl Fo { - | ^^ help: a trait with a similar name exists: `Fn` + | ^^ --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here + | +help: a trait with a similar name exists + | +LL | impl Fn { + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/type/pattern_types/bad_pat.stderr b/tests/ui/type/pattern_types/bad_pat.stderr index 2abf27100c1de..7a42df1843672 100644 --- a/tests/ui/type/pattern_types/bad_pat.stderr +++ b/tests/ui/type/pattern_types/bad_pat.stderr @@ -2,17 +2,25 @@ error[E0586]: inclusive range with no end --> $DIR/bad_pat.rs:7:43 | LL | type NonNullU32_2 = pattern_type!(u32 is 1..=); - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | type NonNullU32_2 = pattern_type!(u32 is 1..); + | ~~ error[E0586]: inclusive range with no end --> $DIR/bad_pat.rs:9:40 | LL | type Positive2 = pattern_type!(i32 is 0..=); - | ^^^ help: use `..` instead + | ^^^ | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) +help: use `..` instead + | +LL | type Positive2 = pattern_type!(i32 is 0..); + | ~~ error: wildcard patterns are not permitted for pattern types --> $DIR/bad_pat.rs:11:33 diff --git a/tests/ui/type/type-arg-out-of-scope.stderr b/tests/ui/type/type-arg-out-of-scope.stderr index 8665001e24319..23785fb2f0864 100644 --- a/tests/ui/type/type-arg-out-of-scope.stderr +++ b/tests/ui/type/type-arg-out-of-scope.stderr @@ -4,9 +4,12 @@ error[E0401]: can't use generic parameters from outer item LL | fn foo(x: T) { | - type parameter from outer item LL | fn bar(f: Box T>) { } - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | fn bar(f: Box T>) { } + | +++ error[E0401]: can't use generic parameters from outer item --> $DIR/type-arg-out-of-scope.rs:3:35 @@ -14,9 +17,12 @@ error[E0401]: can't use generic parameters from outer item LL | fn foo(x: T) { | - type parameter from outer item LL | fn bar(f: Box T>) { } - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` + | ^ use of generic parameter from outer item + | +help: try introducing a local generic parameter here + | +LL | fn bar(f: Box T>) { } + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/type/type-ascription-instead-of-initializer.stderr b/tests/ui/type/type-ascription-instead-of-initializer.stderr index efa917334bf0c..f14136ce76979 100644 --- a/tests/ui/type/type-ascription-instead-of-initializer.stderr +++ b/tests/ui/type/type-ascription-instead-of-initializer.stderr @@ -5,19 +5,25 @@ LL | let x: Vec::with_capacity(10, 20); | - ^^ expected type | | | while parsing the type for `x` - | help: use `=` if you meant to assign + | +help: use `=` if you meant to assign + | +LL | let x = Vec::with_capacity(10, 20); + | ~ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/type-ascription-instead-of-initializer.rs:2:12 | LL | let x: Vec::with_capacity(10, 20); - | ^^^^^^^^^^^^^^^^^^ ---- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^^^^^^^^^^^^ -- unexpected argument of type `{integer}` | note: associated function defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +help: remove the extra argument + | +LL - let x: Vec::with_capacity(10, 20); +LL + let x: Vec::with_capacity(10); + | error: aborting due to 2 previous errors diff --git a/tests/ui/type/type-ascription-instead-of-statement-end.stderr b/tests/ui/type/type-ascription-instead-of-statement-end.stderr index 8c09e78bc5fbc..34c8864232393 100644 --- a/tests/ui/type/type-ascription-instead-of-statement-end.stderr +++ b/tests/ui/type/type-ascription-instead-of-statement-end.stderr @@ -2,9 +2,13 @@ error: statements are terminated with a semicolon --> $DIR/type-ascription-instead-of-statement-end.rs:2:21 | LL | println!("test"): - | ^ help: use a semicolon instead: `;` + | ^ | = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 +help: use a semicolon instead + | +LL | println!("test"); + | ~ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` --> $DIR/type-ascription-instead-of-statement-end.rs:7:21 diff --git a/tests/ui/type/type-ascription-with-fn-call.stderr b/tests/ui/type/type-ascription-with-fn-call.stderr index 2ae5873c82421..2691f10cf3ed7 100644 --- a/tests/ui/type/type-ascription-with-fn-call.stderr +++ b/tests/ui/type/type-ascription-with-fn-call.stderr @@ -2,9 +2,13 @@ error: statements are terminated with a semicolon --> $DIR/type-ascription-with-fn-call.rs:3:10 | LL | f() : - | ^ help: use a semicolon instead: `;` + | ^ | = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 +help: use a semicolon instead + | +LL | f() ; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/type/type-dependent-def-issue-49241.stderr b/tests/ui/type/type-dependent-def-issue-49241.stderr index 15d47cca3d202..3c8943eb41b34 100644 --- a/tests/ui/type/type-dependent-def-issue-49241.stderr +++ b/tests/ui/type/type-dependent-def-issue-49241.stderr @@ -2,9 +2,12 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/type-dependent-def-issue-49241.rs:3:22 | LL | const l: usize = v.count(); - | ------- ^ non-constant value - | | - | help: consider using `let` instead of `const`: `let l` + | ^ non-constant value + | +help: consider using `let` instead of `const` + | +LL | let l: usize = v.count(); + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/conversion-methods.stderr b/tests/ui/typeck/conversion-methods.stderr index a9b5078ccdde3..fa8928f1454c0 100644 --- a/tests/ui/typeck/conversion-methods.stderr +++ b/tests/ui/typeck/conversion-methods.stderr @@ -2,28 +2,40 @@ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:5:41 | LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; - | ------ ^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()` - | | | - | | expected `String`, found `&str` + | ------ ^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `&str` + | | | expected due to this + | +help: try using a conversion method + | +LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—".to_string(); + | ++++++++++++ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:6:40 | LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); - | ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_path_buf()` - | | | - | | expected `PathBuf`, found `&Path` + | ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `PathBuf`, found `&Path` + | | | expected due to this + | +help: try using a conversion method + | +LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise").to_path_buf(); + | ++++++++++++++ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:9:40 | LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here - | ------ ^- help: try using a conversion method: `.to_string()` - | | | - | | expected `String`, found integer + | ------ ^ expected `String`, found integer + | | | expected due to this + | +help: try using a conversion method + | +LL | let _but_should_the_play: String = 2.to_string(); // Perhaps surprisingly, we suggest .to_string() here + | ++++++++++++ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:12:47 diff --git a/tests/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr b/tests/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr index 8982d6285617d..4450aa66c1322 100644 --- a/tests/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr +++ b/tests/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr @@ -8,13 +8,23 @@ error: missing type for `const` item --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:2:12 | LL | const A; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | const A: ; + | ++++++++ error: missing type for `static` item --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:3:13 | LL | static B; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | static B: ; + | ++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/typeck/issue-100164.stderr b/tests/ui/typeck/issue-100164.stderr index 06a132d651429..1fc4ae7cff66c 100644 --- a/tests/ui/typeck/issue-100164.stderr +++ b/tests/ui/typeck/issue-100164.stderr @@ -2,13 +2,23 @@ error: missing type for `const` item --> $DIR/issue-100164.rs:3:10 | LL | const _A: = 123; - | ^ help: provide a type for the constant: `i32` + | ^ + | +help: provide a type for the constant + | +LL | const _A: i32 = 123; + | +++ error: missing type for `const` item --> $DIR/issue-100164.rs:7:14 | LL | const _B: = 123; - | ^ help: provide a type for the constant: `i32` + | ^ + | +help: provide a type for the constant + | +LL | const _B: i32 = 123; + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-107087.stderr b/tests/ui/typeck/issue-107087.stderr index 289c8d161ae86..0fcc5b43e989c 100644 --- a/tests/ui/typeck/issue-107087.stderr +++ b/tests/ui/typeck/issue-107087.stderr @@ -2,7 +2,12 @@ error[E0223]: ambiguous associated type --> $DIR/issue-107087.rs:16:5 | LL | A::B::<>::C - | ^^^^^^^^ help: use fully-qualified syntax: ` as Foo>::B` + | ^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | as Foo>::B::C + | ~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr b/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr index 4ccfacfb00521..3a21fd4803843 100644 --- a/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr +++ b/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr @@ -14,7 +14,12 @@ error[E0425]: cannot find value `g` in this scope --> $DIR/issue-114423-ice-regression-in-suggestion.rs:11:22 | LL | let _ = RGB { r, g, b }; - | ^ help: a local variable with a similar name exists: `b` + | ^ + | +help: a local variable with a similar name exists + | +LL | let _ = RGB { r, b, b }; + | ~ error[E0308]: mismatched types --> $DIR/issue-114423-ice-regression-in-suggestion.rs:7:50 diff --git a/tests/ui/typeck/issue-120856.stderr b/tests/ui/typeck/issue-120856.stderr index 1fc8b20047355..1c42f3049ff75 100644 --- a/tests/ui/typeck/issue-120856.stderr +++ b/tests/ui/typeck/issue-120856.stderr @@ -2,19 +2,23 @@ error[E0433]: failed to resolve: use of undeclared crate or module `n` --> $DIR/issue-120856.rs:1:37 | LL | pub type Archived = ::Archived; - | ^ - | | - | use of undeclared crate or module `n` - | help: a trait with a similar name exists: `Fn` + | ^ use of undeclared crate or module `n` + | +help: a trait with a similar name exists + | +LL | pub type Archived = ::Archived; + | ~~ error[E0433]: failed to resolve: use of undeclared crate or module `m` --> $DIR/issue-120856.rs:1:25 | LL | pub type Archived = ::Archived; - | ^ - | | - | use of undeclared crate or module `m` - | help: a type parameter with a similar name exists: `T` + | ^ use of undeclared crate or module `m` + | +help: a type parameter with a similar name exists + | +LL | pub type Archived = ::Archived; + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr b/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr index 3018388806294..fb03e6f39d62f 100644 --- a/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr +++ b/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr @@ -1,13 +1,15 @@ error[E0308]: mismatched types --> $DIR/issue-57673-ice-on-deref-of-boxed-trait.rs:5:5 | -LL | fn ice(x: Box>) { - | - help: try adding a return type: `-> (dyn Iterator + 'static)` LL | *x | ^^ expected `()`, found `dyn Iterator` | = note: expected unit type `()` found trait object `(dyn Iterator + 'static)` +help: try adding a return type + | +LL | fn ice(x: Box>) -> (dyn Iterator + 'static) { + | ++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-73592-borrow_mut-through-deref.stderr b/tests/ui/typeck/issue-73592-borrow_mut-through-deref.stderr index 5f5f672c3843a..73cada9e44de1 100644 --- a/tests/ui/typeck/issue-73592-borrow_mut-through-deref.stderr +++ b/tests/ui/typeck/issue-73592-borrow_mut-through-deref.stderr @@ -2,23 +2,30 @@ warning: variable does not need to be mutable --> $DIR/issue-73592-borrow_mut-through-deref.rs:42:17 | LL | fn test_mut_pin(mut s: Pin<&S>) { - | ----^ - | | - | help: remove this `mut` + | ^^^^^ | note: the lint level is defined here --> $DIR/issue-73592-borrow_mut-through-deref.rs:20:9 | LL | #![warn(unused_mut)] | ^^^^^^^^^^ +help: remove this `mut` + | +LL - fn test_mut_pin(mut s: Pin<&S>) { +LL + fn test_mut_pin(s: Pin<&S>) { + | warning: variable does not need to be mutable --> $DIR/issue-73592-borrow_mut-through-deref.rs:47:21 | LL | fn test_mut_pin_mut(mut s: Pin<&mut S>) { - | ----^ - | | - | help: remove this `mut` + | ^^^^^ + | +help: remove this `mut` + | +LL - fn test_mut_pin_mut(mut s: Pin<&mut S>) { +LL + fn test_mut_pin_mut(s: Pin<&mut S>) { + | warning: 2 warnings emitted diff --git a/tests/ui/typeck/issue-79040.stderr b/tests/ui/typeck/issue-79040.stderr index ce6a4b3621708..39636db85a784 100644 --- a/tests/ui/typeck/issue-79040.stderr +++ b/tests/ui/typeck/issue-79040.stderr @@ -10,7 +10,12 @@ error: missing type for `const` item --> $DIR/issue-79040.rs:2:14 | LL | const FOO = "hello" + 1; - | ^ help: provide a type for the item: `: ` + | ^ + | +help: provide a type for the item + | +LL | const FOO: = "hello" + 1; + | ++++++++ error[E0369]: cannot add `{integer}` to `&str` --> $DIR/issue-79040.rs:2:25 diff --git a/tests/ui/typeck/issue-80779.stderr b/tests/ui/typeck/issue-80779.stderr index 2261ba616545f..2e27b128d89f6 100644 --- a/tests/ui/typeck/issue-80779.stderr +++ b/tests/ui/typeck/issue-80779.stderr @@ -2,19 +2,23 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/issue-80779.rs:10:28 | LL | pub fn g(_: T<'static>) -> _ {} - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `()` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | pub fn g(_: T<'static>) -> () {} + | ~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/issue-80779.rs:5:29 | LL | pub fn f<'a>(val: T<'a>) -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `()` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | pub fn f<'a>(val: T<'a>) -> () { + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-81943.stderr b/tests/ui/typeck/issue-81943.stderr index f8da9ef0d180f..94567a9508478 100644 --- a/tests/ui/typeck/issue-81943.stderr +++ b/tests/ui/typeck/issue-81943.stderr @@ -2,11 +2,13 @@ error[E0308]: mismatched types --> $DIR/issue-81943.rs:7:9 | LL | f(|x| lib::d!(x)); - | -^^^^^^^^^^ expected `()`, found `i32` - | | - | help: try adding a return type: `-> i32` + | ^^^^^^^^^^ expected `()`, found `i32` | = note: this error originates in the macro `lib::d` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try adding a return type + | +LL | f(|x| -> i32 lib::d!(x)); + | ++++++ error[E0308]: mismatched types --> $DIR/issue-81943.rs:8:28 diff --git a/tests/ui/typeck/issue-83693.stderr b/tests/ui/typeck/issue-83693.stderr index 34bca426116e5..ee8ab14d5923c 100644 --- a/tests/ui/typeck/issue-83693.stderr +++ b/tests/ui/typeck/issue-83693.stderr @@ -2,10 +2,15 @@ error[E0412]: cannot find type `F` in this scope --> $DIR/issue-83693.rs:6:6 | LL | impl F { - | ^ help: a trait with a similar name exists: `Fn` + | ^ --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here + | +help: a trait with a similar name exists + | +LL | impl Fn { + | ~~ error[E0412]: cannot find type `TestResult` in this scope --> $DIR/issue-83693.rs:9:22 diff --git a/tests/ui/typeck/issue-88844.stderr b/tests/ui/typeck/issue-88844.stderr index 68473f65dcf53..0f4e011faff5d 100644 --- a/tests/ui/typeck/issue-88844.stderr +++ b/tests/ui/typeck/issue-88844.stderr @@ -5,7 +5,12 @@ LL | struct Struct { value: i32 } | ------------- similarly named struct `Struct` defined here ... LL | impl Stuct { - | ^^^^^ help: a struct with a similar name exists: `Struct` + | ^^^^^ + | +help: a struct with a similar name exists + | +LL | impl Struct { + | ~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr index c46f4ec1ec301..3ca58c17dd60e 100644 --- a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr +++ b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr @@ -1,10 +1,13 @@ error[E0308]: mismatched types --> $DIR/issue-90027-async-fn-return-suggestion.rs:4:5 | -LL | async fn hello() { - | - help: try adding a return type: `-> i32` LL | 0 | ^ expected `()`, found integer + | +help: try adding a return type + | +LL | async fn hello() -> i32 { + | ++++++ error[E0308]: mismatched types --> $DIR/issue-90027-async-fn-return-suggestion.rs:9:5 diff --git a/tests/ui/typeck/issue-98260.stderr b/tests/ui/typeck/issue-98260.stderr index b7debd335b0fb..1a9834206c0fc 100644 --- a/tests/ui/typeck/issue-98260.stderr +++ b/tests/ui/typeck/issue-98260.stderr @@ -2,10 +2,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/issue-98260.rs:3:27 | LL | fn a(aa: B) -> Result<_, B> { - | -------^---- - | | | - | | not allowed in type signatures - | help: replace with the correct return type: `Result<(), B>` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn a(aa: B) -> Result<(), B> { + | ~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index 322bf349f92fc..59de00a58bbea 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -2,10 +2,7 @@ error[E0053]: method `values` has an incompatible type for trait --> $DIR/mismatched-map-under-self.rs:10:15 | LL | fn values(self) -> Self::Values { - | ^^^^ - | | - | expected `&Option`, found `Option` - | help: change the self-receiver type to match the trait: `&self` + | ^^^^ expected `&Option`, found `Option` | note: type in trait --> $DIR/mismatched-map-under-self.rs:4:15 @@ -14,6 +11,10 @@ LL | fn values(&self) -> Self::Values; | ^^^^^ = note: expected signature `fn(&Option<_>)` found signature `fn(Option<_>)` +help: change the self-receiver type to match the trait + | +LL | fn values(&self) -> Self::Values { + | ~~~~~ error[E0631]: type mismatch in function arguments --> $DIR/mismatched-map-under-self.rs:12:18 diff --git a/tests/ui/typeck/ptr-null-mutability-suggestions.stderr b/tests/ui/typeck/ptr-null-mutability-suggestions.stderr index b615d9fb45cbe..2912977a461a3 100644 --- a/tests/ui/typeck/ptr-null-mutability-suggestions.stderr +++ b/tests/ui/typeck/ptr-null-mutability-suggestions.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/ptr-null-mutability-suggestions.rs:9:24 | LL | expecting_null_mut(ptr::null()); - | ------------------ ^^^^^^^^^^^ - | | | - | | types differ in mutability - | | help: consider using `core::ptr::null_mut` instead: `core::ptr::null_mut()` + | ------------------ ^^^^^^^^^^^ types differ in mutability + | | | arguments to this function are incorrect | = note: expected raw pointer `*mut u8` @@ -15,6 +13,10 @@ note: function defined here | LL | fn expecting_null_mut(_: *mut u8) {} | ^^^^^^^^^^^^^^^^^^ ---------- +help: consider using `core::ptr::null_mut` instead + | +LL | expecting_null_mut(core::ptr::null_mut()); + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/remove-extra-argument.stderr b/tests/ui/typeck/remove-extra-argument.stderr index 9557c41457dcd..4bab2959651b7 100644 --- a/tests/ui/typeck/remove-extra-argument.stderr +++ b/tests/ui/typeck/remove-extra-argument.stderr @@ -2,16 +2,18 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/remove-extra-argument.rs:6:5 | LL | l(vec![], vec![]) - | ^ -------- - | | | - | | unexpected argument of type `Vec<_>` - | help: remove the extra argument + | ^ ------ unexpected argument of type `Vec<_>` | note: function defined here --> $DIR/remove-extra-argument.rs:3:4 | LL | fn l(_a: Vec) {} | ^ ----------- +help: remove the extra argument + | +LL - l(vec![], vec![]) +LL + l(vec![]) + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/remove-semi-but-confused-char.stderr b/tests/ui/typeck/remove-semi-but-confused-char.stderr index 2d0b53a60ce40..efd58e7a90d8e 100644 --- a/tests/ui/typeck/remove-semi-but-confused-char.stderr +++ b/tests/ui/typeck/remove-semi-but-confused-char.stderr @@ -16,9 +16,12 @@ LL | pub fn square(num: i32) -> i32 { | ------ ^^^ expected `i32`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -LL | -LL | num * num; - | - help: remove this semicolon to return this value + | +help: remove this semicolon to return this value + | +LL - num * num; +LL + num * num + | error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/struct-enum-wrong-args.stderr b/tests/ui/typeck/struct-enum-wrong-args.stderr index 57cbd1d2005c3..d005eca841ecb 100644 --- a/tests/ui/typeck/struct-enum-wrong-args.stderr +++ b/tests/ui/typeck/struct-enum-wrong-args.stderr @@ -2,13 +2,15 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:6:13 | LL | let _ = Some(3, 2); - | ^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^ - unexpected argument of type `{integer}` | note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL +help: remove the extra argument + | +LL - let _ = Some(3, 2); +LL + let _ = Some(3); + | error[E0061]: this enum variant takes 1 argument but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:7:13 @@ -59,16 +61,18 @@ error[E0061]: this struct takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:10:13 | LL | let _ = Wrapper(5, 2); - | ^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^ - unexpected argument of type `{integer}` | note: tuple struct defined here --> $DIR/struct-enum-wrong-args.rs:2:8 | LL | struct Wrapper(i32); | ^^^^^^^ +help: remove the extra argument + | +LL - let _ = Wrapper(5, 2); +LL + let _ = Wrapper(5); + | error[E0061]: this struct takes 2 arguments but 0 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:11:13 @@ -106,16 +110,18 @@ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:13:13 | LL | let _ = DoubleWrapper(5, 2, 7); - | ^^^^^^^^^^^^^ --- - | | | - | | unexpected argument of type `{integer}` - | help: remove the extra argument + | ^^^^^^^^^^^^^ - unexpected argument of type `{integer}` | note: tuple struct defined here --> $DIR/struct-enum-wrong-args.rs:3:8 | LL | struct DoubleWrapper(i32, i32); | ^^^^^^^^^^^^^ +help: remove the extra argument + | +LL - let _ = DoubleWrapper(5, 2, 7); +LL + let _ = DoubleWrapper(5, 2); + | error: aborting due to 8 previous errors diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 9a9b2a68dbed9..3be83682ec9aa 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -2,69 +2,99 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/typeck-builtin-bound-type-parameters.rs:1:11 | LL | fn foo1, U>(x: T) {} - | ^^^^--- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - fn foo1, U>(x: T) {} +LL + fn foo1(x: T) {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} - | ^^^^---------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - trait Trait: Copy {} +LL + trait Trait: Copy {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} - | ^^^^---------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - trait Trait: Copy {} +LL + trait Trait: Copy {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} - | ^^^^---------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - trait Trait: Copy {} +LL + trait Trait: Copy {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:9:21 | LL | struct MyStruct1>(T); - | ^^^^--- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - struct MyStruct1>(T); +LL + struct MyStruct1(T); + | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:12:25 | LL | struct MyStruct2<'a, T: Copy<'a>>(&'a T); - | ^^^^---- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^ expected 0 lifetime arguments + | +help: remove these generics + | +LL - struct MyStruct2<'a, T: Copy<'a>>(&'a T); +LL + struct MyStruct2<'a, T: Copy>(&'a T); + | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:15:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^^^ expected 0 lifetime arguments + | +help: remove this lifetime argument + | +LL - fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} +LL + fn foo2<'a, T:Copy<, U>, U>(x: T) {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:15:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ - help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments + | +help: remove this generic argument + | +LL - fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} +LL + fn foo2<'a, T:Copy<'a, >, U>(x: T) {} + | error: aborting due to 8 previous errors diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index 9d295f88da5aa..506dcaa408c7e 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -32,9 +32,12 @@ error: associated constant in `impl` without body --> $DIR/typeck_type_placeholder_item.rs:206:5 | LL | const C: _; - | ^^^^^^^^^^- - | | - | help: provide a definition for the constant: `= ;` + | ^^^^^^^^^^^ + | +help: provide a definition for the constant + | +LL | const C: _ = ; + | ~~~~~~~~~ error[E0403]: the name `_` is already used for a generic parameter in this item's generic parameters --> $DIR/typeck_type_placeholder_item.rs:167:22 @@ -48,38 +51,47 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:7:14 | LL | fn test() -> _ { 5 } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `i32` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn test() -> i32 { 5 } + | ~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:10:16 | LL | fn test2() -> (_, _) { (5, 5) } - | -^--^- - | || | - | || not allowed in type signatures - | |not allowed in type signatures - | help: replace with the correct return type: `(i32, i32)` + | ^ ^ not allowed in type signatures + | | + | not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn test2() -> (i32, i32) { (5, 5) } + | ~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:13:15 | LL | static TEST3: _ = "test"; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `&str` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | static TEST3: &str = "test"; + | ~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:16:15 | LL | static TEST4: _ = 145; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `i32` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | static TEST4: i32 = 145; + | ~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:19:15 @@ -135,10 +147,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:34:22 | LL | fn test8(_f: fn() -> _) { } - | ^ - | | - | not allowed in type signatures - | help: use type parameters instead: `T` + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn test8(_f: fn() -> T) { } + | ~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:34:22 @@ -155,19 +169,23 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:48:26 | LL | fn test11(x: &usize) -> &_ { - | -^ - | || - | |not allowed in type signatures - | help: replace with the correct return type: `&&usize` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn test11(x: &usize) -> &&usize { + | ~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:53:52 | LL | unsafe fn test12(x: *const usize) -> *const *const _ { - | --------------^ - | | | - | | not allowed in type signatures - | help: replace with the correct return type: `*const *const usize` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | unsafe fn test12(x: *const usize) -> *const *const usize { + | ~~~~~~~~~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:59:24 @@ -214,16 +232,23 @@ error: missing type for `static` item --> $DIR/typeck_type_placeholder_item.rs:73:13 | LL | static A = 42; - | ^ help: provide a type for the static variable: `: i32` + | ^ + | +help: provide a type for the static variable + | +LL | static A: i32 = 42; + | +++++ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:75:15 | LL | static B: _ = 42; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `i32` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | static B: i32 = 42; + | ~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:77:15 @@ -235,38 +260,47 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:79:21 | LL | fn fn_test() -> _ { 5 } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `i32` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn fn_test() -> i32 { 5 } + | ~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:82:23 | LL | fn fn_test2() -> (_, _) { (5, 5) } - | -^--^- - | || | - | || not allowed in type signatures - | |not allowed in type signatures - | help: replace with the correct return type: `(i32, i32)` + | ^ ^ not allowed in type signatures + | | + | not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn fn_test2() -> (i32, i32) { (5, 5) } + | ~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:85:22 | LL | static FN_TEST3: _ = "test"; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `&str` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | static FN_TEST3: &str = "test"; + | ~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:88:22 | LL | static FN_TEST4: _ = 145; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `i32` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | static FN_TEST4: i32 = 145; + | ~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:91:22 @@ -300,10 +334,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:100:29 | LL | fn fn_test8(_f: fn() -> _) { } - | ^ - | | - | not allowed in type signatures - | help: use type parameters instead: `T` + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn fn_test8(_f: fn() -> T) { } + | ~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:100:29 @@ -375,20 +411,25 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:132:30 | LL | fn fn_test12(x: i32) -> (_, _) { (x, x) } - | -^--^- - | || | - | || not allowed in type signatures - | |not allowed in type signatures - | help: replace with the correct return type: `(i32, i32)` + | ^ ^ not allowed in type signatures + | | + | not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn fn_test12(x: i32) -> (i32, i32) { (x, x) } + | ~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:135:33 | LL | fn fn_test13(x: _) -> (i32, _) { (x, x) } - | ------^- - | | | - | | not allowed in type signatures - | help: replace with the correct return type: `(i32, i32)` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn fn_test13(x: _) -> (i32, i32) { (x, x) } + | ~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:140:31 @@ -550,28 +591,34 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:194:14 | LL | const D: _ = 42; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `i32` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | const D: i32 = 42; + | ~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:217:31 | LL | fn value() -> Option<&'static _> { - | ----------------^- - | | | - | | not allowed in type signatures - | help: replace with the correct return type: `Option<&'static u8>` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn value() -> Option<&'static u8> { + | ~~~~~~~~~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item.rs:222:10 | LL | const _: Option<_> = map(value); - | ^^^^^^^^^ - | | - | not allowed in type signatures - | help: replace with the correct type: `Option` + | ^^^^^^^^^ not allowed in type signatures + | +help: replace with the correct type + | +LL | const _: Option = map(value); + | ~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants --> $DIR/typeck_type_placeholder_item.rs:206:14 @@ -598,10 +645,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:225:31 | LL | fn evens_squared(n: usize) -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with an appropriate return type: `impl Iterator` + | ^ not allowed in type signatures + | +help: replace with an appropriate return type + | +LL | fn evens_squared(n: usize) -> impl Iterator { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item.rs:230:10 @@ -619,19 +668,23 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:41:24 | LL | fn test9(&self) -> _ { () } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `()` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn test9(&self) -> () { () } + | ~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:107:31 | LL | fn fn_test9(&self) -> _ { () } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `()` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn fn_test9(&self) -> () { () } + | ~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types --> $DIR/typeck_type_placeholder_item.rs:202:14 diff --git a/tests/ui/typeck/typeck_type_placeholder_item_help.stderr b/tests/ui/typeck/typeck_type_placeholder_item_help.stderr index 32585e2937b77..a1a71aceb7be4 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item_help.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item_help.stderr @@ -2,28 +2,34 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item_help.rs:4:15 | LL | fn test1() -> _ { Some(42) } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `Option` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | fn test1() -> Option { Some(42) } + | ~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item_help.rs:7:14 | LL | const TEST2: _ = 42u32; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `u32` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | const TEST2: u32 = 42u32; + | ~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item_help.rs:10:14 | LL | const TEST3: _ = Some(42); - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `Option` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | const TEST3: Option = Some(42); + | ~~~~~~~~~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item_help.rs:13:22 @@ -41,19 +47,23 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item_help.rs:25:18 | LL | const TEST6: _ = 13; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `i32` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | const TEST6: i32 = 13; + | ~~~ error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants --> $DIR/typeck_type_placeholder_item_help.rs:18:18 | LL | const TEST5: _ = 42; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `i32` + | ^ not allowed in type signatures + | +help: replace with the correct type + | +LL | const TEST5: i32 = 42; + | ~~~ error[E0308]: mismatched types --> $DIR/typeck_type_placeholder_item_help.rs:30:28 diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr index e4b1c02c20149..65f07bb08320d 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/typeck_type_placeholder_lifetime_1.rs:9:12 | LL | let c: Foo<_, _> = Foo { r: &5 }; - | ^^^ - help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/typeck_type_placeholder_lifetime_1.rs:4:8 | LL | struct Foo<'a, T:'a> { | ^^^ - +help: remove this generic argument + | +LL - let c: Foo<_, _> = Foo { r: &5 }; +LL + let c: Foo<_, > = Foo { r: &5 }; + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr index fcb5ecc4042b0..b07cc225ba875 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/typeck_type_placeholder_lifetime_2.rs:9:12 | LL | let c: Foo<_, usize> = Foo { r: &5 }; - | ^^^ ----- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/typeck_type_placeholder_lifetime_2.rs:4:8 | LL | struct Foo<'a, T:'a> { | ^^^ - +help: remove this generic argument + | +LL - let c: Foo<_, usize> = Foo { r: &5 }; +LL + let c: Foo<_, > = Foo { r: &5 }; + | error: aborting due to 1 previous error diff --git a/tests/ui/typeof/issue-42060.stderr b/tests/ui/typeof/issue-42060.stderr index effcbe4d7f3e8..7b8e49cc2bd64 100644 --- a/tests/ui/typeof/issue-42060.stderr +++ b/tests/ui/typeof/issue-42060.stderr @@ -1,18 +1,24 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-42060.rs:3:23 | -LL | let thing = (); - | --------- help: consider using `const` instead of `let`: `const thing` LL | let other: typeof(thing) = thing; | ^^^^^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const thing = (); + | ~~~~~~~~~~~ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-42060.rs:9:13 | -LL | let q = 1; - | ----- help: consider using `const` instead of `let`: `const q` LL | ::N | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const q = 1; + | ~~~~~~~ error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/issue-42060.rs:3:16 diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr index c48d094daea20..2a8c4edbdb5f3 100644 --- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -2,10 +2,7 @@ error[E0053]: method `dummy2` has an incompatible type for trait --> $DIR/ufcs-explicit-self-bad.rs:37:21 | LL | fn dummy2(self: &Bar) {} - | ------^^^^^^^ - | | | - | | expected `&'a Bar`, found `Bar` - | help: change the self-receiver type to match the trait: `&self` + | ^^^^^^^ expected `&'a Bar`, found `Bar` | note: type in trait --> $DIR/ufcs-explicit-self-bad.rs:31:15 @@ -14,6 +11,10 @@ LL | fn dummy2(&self); | ^^^^^ = note: expected signature `fn(&&'a Bar<_>)` found signature `fn(&Bar<_>)` +help: change the self-receiver type to match the trait + | +LL | fn dummy2(&self) {} + | ~~~~~ error[E0307]: invalid `self` parameter type: `isize` --> $DIR/ufcs-explicit-self-bad.rs:8:18 diff --git a/tests/ui/ufcs/ufcs-partially-resolved.stderr b/tests/ui/ufcs/ufcs-partially-resolved.stderr index eef55c8dc686f..ae24a0ed46948 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.stderr +++ b/tests/ui/ufcs/ufcs-partially-resolved.stderr @@ -5,16 +5,26 @@ LL | type Y = u16; | ------------- similarly named associated type `Y` defined here ... LL | let _: ::N; - | ^ help: an associated type with a similar name exists: `Y` + | ^ + | +help: an associated type with a similar name exists + | +LL | let _: ::Y; + | ~ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:20:19 | LL | let _: ::N; - | ^ help: a trait with a similar name exists: `Eq` + | ^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here + | +help: a trait with a similar name exists + | +LL | let _: ::N; + | ~~ error[E0404]: expected trait, found type alias `A` --> $DIR/ufcs-partially-resolved.rs:21:19 @@ -34,16 +44,26 @@ LL | fn Y() {} | ------ similarly named associated function `Y` defined here ... LL | ::N; - | ^ help: an associated function with a similar name exists: `Y` + | ^ + | +help: an associated function with a similar name exists + | +LL | ::Y; + | ~ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:23:12 | LL | ::N; - | ^ help: a trait with a similar name exists: `Eq` + | ^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here + | +help: a trait with a similar name exists + | +LL | ::N; + | ~~ error[E0404]: expected trait, found type alias `A` --> $DIR/ufcs-partially-resolved.rs:24:12 @@ -60,19 +80,29 @@ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:26:19 | LL | let _: ::Y; - | ^ help: a trait with a similar name exists: `Eq` + | ^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here + | +help: a trait with a similar name exists + | +LL | let _: ::Y; + | ~~ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:28:12 | LL | ::Y; - | ^ help: a trait with a similar name exists: `Eq` + | ^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here + | +help: a trait with a similar name exists + | +LL | ::Y; + | ~~ error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:30:24 @@ -81,16 +111,26 @@ LL | type Y = u16; | ------------- similarly named associated type `Y` defined here ... LL | let _: ::N::NN; - | ^ help: an associated type with a similar name exists: `Y` + | ^ + | +help: an associated type with a similar name exists + | +LL | let _: ::Y::NN; + | ~ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:31:19 | LL | let _: ::N::NN; - | ^ help: a trait with a similar name exists: `Eq` + | ^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here + | +help: a trait with a similar name exists + | +LL | let _: ::N::NN; + | ~~ error[E0404]: expected trait, found type alias `A` --> $DIR/ufcs-partially-resolved.rs:32:19 @@ -110,16 +150,26 @@ LL | type Y = u16; | ------------- similarly named associated type `Y` defined here ... LL | ::N::NN; - | ^ help: an associated type with a similar name exists: `Y` + | ^ + | +help: an associated type with a similar name exists + | +LL | ::Y::NN; + | ~ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:34:12 | LL | ::N::NN; - | ^ help: a trait with a similar name exists: `Eq` + | ^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here + | +help: a trait with a similar name exists + | +LL | ::N::NN; + | ~~ error[E0404]: expected trait, found type alias `A` --> $DIR/ufcs-partially-resolved.rs:35:12 @@ -136,19 +186,29 @@ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:37:19 | LL | let _: ::Y::NN; - | ^ help: a trait with a similar name exists: `Eq` + | ^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here + | +help: a trait with a similar name exists + | +LL | let _: ::Y::NN; + | ~~ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:39:12 | LL | ::Y::NN; - | ^ help: a trait with a similar name exists: `Eq` + | ^ --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here + | +help: a trait with a similar name exists + | +LL | ::Y::NN; + | ~~ error[E0405]: cannot find trait `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:41:23 @@ -217,9 +277,12 @@ LL | type X = u16; | ------------- similarly named associated type `X` defined here ... LL | let _: ::Z; - | ^^^^^^^^^^^^- - | | - | help: an associated type with a similar name exists: `X` + | ^^^^^^^^^^^^^ + | +help: an associated type with a similar name exists + | +LL | let _: ::X; + | ~ error[E0575]: expected method or associated constant, found associated type `Dr::X` --> $DIR/ufcs-partially-resolved.rs:53:5 @@ -228,11 +291,13 @@ LL | fn Z() {} | ------ similarly named associated function `Z` defined here ... LL | ::X; - | ^^^^^^^^^^^^- - | | - | help: an associated function with a similar name exists: `Z` + | ^^^^^^^^^^^^^ | = note: can't use a type alias as a constructor +help: an associated function with a similar name exists + | +LL | ::Z; + | ~ error[E0575]: expected associated type, found associated function `Dr::Z` --> $DIR/ufcs-partially-resolved.rs:54:12 @@ -241,9 +306,12 @@ LL | type X = u16; | ------------- similarly named associated type `X` defined here ... LL | let _: ::Z::N; - | ^^^^^^^^^^^^-^^^ - | | - | help: an associated type with a similar name exists: `X` + | ^^^^^^^^^^^^^^^^ + | +help: an associated type with a similar name exists + | +LL | let _: ::X::N; + | ~ error[E0223]: ambiguous associated type --> $DIR/ufcs-partially-resolved.rs:36:12 diff --git a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr index 2338871218b1c..0ae92d204b6fb 100644 --- a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr +++ b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr @@ -34,15 +34,18 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/ufcs-qpath-missing-params.rs:17:26 | LL | ::into_cow::("foo".to_string()); - | ^^^^^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/ufcs-qpath-missing-params.rs:4:8 | LL | fn into_cow(self) -> Cow<'a, B>; | ^^^^^^^^ +help: remove these generics + | +LL - ::into_cow::("foo".to_string()); +LL + ::into_cow("foo".to_string()); + | error: aborting due to 3 previous errors diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr index e6f34d7e3b4b7..67380721c9f50 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr @@ -2,21 +2,29 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subje --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:3:17 | LL | fn bar1(x: &dyn Fn<(), Output=()>) { - | ^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn() -> ()` + | ^^^^^^^^^^^^^^^^^ | = note: see issue #29625 for more information = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: use parenthetical notation instead + | +LL | fn bar1(x: &dyn Fn() -> ()) { + | ~~~~~~~~~~ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:7:28 | LL | fn bar2(x: &T) where T: Fn<()> { - | ^^^^^^ help: use parenthetical notation instead: `Fn() -> ()` + | ^^^^^^ | = note: see issue #29625 for more information = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: use parenthetical notation instead + | +LL | fn bar2(x: &T) where T: Fn() -> () { + | ~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index 5a2de132d70e7..ac56d1d05fae5 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -2,15 +2,18 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:17 | LL | fn foo1(_: &dyn Zero()) { - | ^^^^-- help: remove these parenthetical generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these parenthetical generics + | +LL - fn foo1(_: &dyn Zero()) { +LL + fn foo1(_: &dyn Zero) { + | error[E0220]: associated type `Output` not found for `Zero` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:17 @@ -22,43 +25,52 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:10:17 | LL | fn foo2(_: &dyn Zero) { - | ^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these generics + | +LL - fn foo2(_: &dyn Zero) { +LL + fn foo2(_: &dyn Zero) { + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:14:17 | LL | fn foo3(_: &dyn Zero < usize >) { - | ^^^^-------------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these generics + | +LL - fn foo3(_: &dyn Zero < usize >) { +LL + fn foo3(_: &dyn Zero) { + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:17 | LL | fn foo4(_: &dyn Zero(usize)) { - | ^^^^------- help: remove these parenthetical generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these parenthetical generics + | +LL - fn foo4(_: &dyn Zero(usize)) { +LL + fn foo4(_: &dyn Zero) { + | error[E0220]: associated type `Output` not found for `Zero` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:17 @@ -70,15 +82,18 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:17 | LL | fn foo5(_: &dyn Zero ( usize )) { - | ^^^^-------------- help: remove these parenthetical generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these parenthetical generics + | +LL - fn foo5(_: &dyn Zero ( usize )) { +LL + fn foo5(_: &dyn Zero) { + | error[E0220]: associated type `Output` not found for `Zero` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:17 diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index 130b193d69c93..3736f25a51ff9 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -2,15 +2,18 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8 | LL | fn f isize>(x: F) {} - | ^^^^^------- help: remove these parenthetical generics - | | - | expected 0 generic arguments + | ^^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-trait.rs:3:7 | LL | trait Trait {} | ^^^^^ +help: remove these parenthetical generics + | +LL - fn f isize>(x: F) {} +LL + fn f isize>(x: F) {} + | error[E0220]: associated type `Output` not found for `Trait` --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:24 diff --git a/tests/ui/unboxed-closures/unboxed-closures-counter-not-moved.stderr b/tests/ui/unboxed-closures/unboxed-closures-counter-not-moved.stderr index 6450cc30ac05f..b3f6113d9808b 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-counter-not-moved.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-counter-not-moved.stderr @@ -2,9 +2,13 @@ warning: unused variable: `item` --> $DIR/unboxed-closures-counter-not-moved.rs:15:13 | LL | for item in y { - | ^^^^ help: if this is intentional, prefix it with an underscore: `_item` + | ^^^^ | = note: `#[warn(unused_variables)]` on by default +help: if this is intentional, prefix it with an underscore + | +LL | for _item in y { + | ~~~~~ warning: value assigned to `counter` is never read --> $DIR/unboxed-closures-counter-not-moved.rs:24:9 diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr index 5f22c781345ff..88ba4aa15b99c 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr @@ -8,7 +8,12 @@ error[E0425]: cannot find value `y` in this scope --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:9:26 | LL | closure(&mut p, &y); - | ^ help: a local variable with a similar name exists: `p` + | ^ + | +help: a local variable with a similar name exists + | +LL | closure(&mut p, &p); + | ~ error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:9:17 diff --git a/tests/ui/unresolved/unresolved-import.stderr b/tests/ui/unresolved/unresolved-import.stderr index 0dd928c8b6ffd..c23d6be22b464 100644 --- a/tests/ui/unresolved/unresolved-import.stderr +++ b/tests/ui/unresolved/unresolved-import.stderr @@ -10,40 +10,56 @@ error[E0432]: unresolved import `bar::Baz` --> $DIR/unresolved-import.rs:5:5 | LL | use bar::Baz as x; - | ^^^^^---^^^^^ - | | | - | | help: a similar name exists in the module: `Bar` - | no `Baz` in `bar` + | ^^^^^^^^^^^^^ no `Baz` in `bar` + | +help: a similar name exists in the module + | +LL | use bar::Bar as x; + | ~~~ error[E0432]: unresolved import `food::baz` --> $DIR/unresolved-import.rs:10:5 | LL | use food::baz; - | ^^^^^^--- - | | | - | | help: a similar name exists in the module: `bag` - | no `baz` in `food` + | ^^^^^^^^^ no `baz` in `food` + | +help: a similar name exists in the module + | +LL | use food::bag; + | ~~~ error[E0432]: unresolved import `food::beens` --> $DIR/unresolved-import.rs:15:12 | LL | use food::{beens as Foo}; - | -----^^^^^^^ - | | - | no `beens` in `food` - | help: a similar name exists in the module: `beans` + | ^^^^^^^^^^^^ no `beens` in `food` + | +help: a similar name exists in the module + | +LL | use food::{beans as Foo}; + | ~~~~~ error[E0432]: unresolved import `MyEnum` --> $DIR/unresolved-import.rs:39:9 | LL | use MyEnum::*; - | ^^^^^^ help: a similar path exists: `self::MyEnum` + | ^^^^^^ + | +help: a similar path exists + | +LL | use self::MyEnum::*; + | ~~~~~~~~~~~~ error[E0432]: unresolved import `Enum` --> $DIR/unresolved-import.rs:49:9 | LL | use Enum::*; - | ^^^^ help: a similar path exists: `self::Enum` + | ^^^^ + | +help: a similar path exists + | +LL | use self::Enum::*; + | ~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/tests/ui/unsigned-literal-negation.stderr b/tests/ui/unsigned-literal-negation.stderr index 0aaa8c3b72f9d..846d778d09dd7 100644 --- a/tests/ui/unsigned-literal-negation.stderr +++ b/tests/ui/unsigned-literal-negation.stderr @@ -2,34 +2,37 @@ error[E0600]: cannot apply unary operator `-` to type `usize` --> $DIR/unsigned-literal-negation.rs:2:13 | LL | let x = -1 as usize; - | ^^ - | | - | cannot apply unary operator `-` - | help: you may have meant the maximum value of `usize`: `usize::MAX` + | ^^ cannot apply unary operator `-` | = note: unsigned values cannot be negated +help: you may have meant the maximum value of `usize` + | +LL | let x = usize::MAX as usize; + | ~~~~~~~~~~ error[E0600]: cannot apply unary operator `-` to type `usize` --> $DIR/unsigned-literal-negation.rs:3:13 | LL | let x = (-1) as usize; - | ^^^^ - | | - | cannot apply unary operator `-` - | help: you may have meant the maximum value of `usize`: `usize::MAX` + | ^^^^ cannot apply unary operator `-` | = note: unsigned values cannot be negated +help: you may have meant the maximum value of `usize` + | +LL | let x = usize::MAX as usize; + | ~~~~~~~~~~ error[E0600]: cannot apply unary operator `-` to type `u32` --> $DIR/unsigned-literal-negation.rs:4:18 | LL | let x: u32 = -1; - | ^^ - | | - | cannot apply unary operator `-` - | help: you may have meant the maximum value of `u32`: `u32::MAX` + | ^^ cannot apply unary operator `-` | = note: unsigned values cannot be negated +help: you may have meant the maximum value of `u32` + | +LL | let x: u32 = u32::MAX; + | ~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/use/use-mod/use-mod.stderr b/tests/ui/use/use-mod/use-mod.stderr index 0cae5eb14aeeb..a4abce0c13b69 100644 --- a/tests/ui/use/use-mod/use-mod.stderr +++ b/tests/ui/use/use-mod/use-mod.stderr @@ -20,12 +20,13 @@ LL | self, | ---- previous import of the module `bar` here ... LL | self - | ^^^^ - | | - | `bar` reimported here - | help: remove unnecessary import + | ^^^^ `bar` reimported here | = note: `bar` must be defined only once in the type namespace of this module +help: remove unnecessary import + | +LL - self + | error: aborting due to 3 previous errors diff --git a/tests/ui/use/use-nested-groups-error.stderr b/tests/ui/use/use-nested-groups-error.stderr index d73754c6baa2d..3d4b6f061263c 100644 --- a/tests/ui/use/use-nested-groups-error.stderr +++ b/tests/ui/use/use-nested-groups-error.stderr @@ -2,10 +2,12 @@ error[E0432]: unresolved import `a::b1::C1` --> $DIR/use-nested-groups-error.rs:9:14 | LL | use a::{b1::{C1, C2}, B2}; - | ^^ - | | - | no `C1` in `a::b1` - | help: a similar name exists in the module: `C2` + | ^^ no `C1` in `a::b1` + | +help: a similar name exists in the module + | +LL | use a::{b1::{C2, C2}, B2}; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/variance/leaking-unnameables.stderr b/tests/ui/variance/leaking-unnameables.stderr index 92afe952801d0..70cf6afbfc57e 100644 --- a/tests/ui/variance/leaking-unnameables.stderr +++ b/tests/ui/variance/leaking-unnameables.stderr @@ -2,10 +2,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures --> $DIR/leaking-unnameables.rs:8:18 | LL | pub fn f() -> _ { - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `fn()` + | ^ not allowed in type signatures + | +help: replace with the correct return type + | +LL | pub fn f() -> fn() { + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/variance/variance-trait-matching.stderr b/tests/ui/variance/variance-trait-matching.stderr index 9c72fe239dde9..38bec9928474d 100644 --- a/tests/ui/variance/variance-trait-matching.stderr +++ b/tests/ui/variance/variance-trait-matching.stderr @@ -1,11 +1,13 @@ error[E0621]: explicit lifetime required in the type of `get` --> $DIR/variance-trait-matching.rs:24:5 | -LL | fn get<'a, G>(get: &G) -> i32 - | -- help: add explicit lifetime `'a` to the type of `get`: `&'a G` -... LL | pick(get, &22) | ^^^^^^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `get` + | +LL | fn get<'a, G>(get: &'a G) -> i32 + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/wf/issue-110157.stderr b/tests/ui/wf/issue-110157.stderr index e750ea47d515c..3145929860b97 100644 --- a/tests/ui/wf/issue-110157.stderr +++ b/tests/ui/wf/issue-110157.stderr @@ -21,8 +21,14 @@ LL | | LL | | I: Iterator, | |________________________________^ missing `Item`, `next` in implementation | - = help: implement the missing item: `type Item = /* Type */;` - = help: implement the missing item: `fn next(&mut self) -> Option<::Item> { todo!() }` +help: implement the missing item + | +LL | {type Item = /* Type */; + | +++++++++++++++++++++++ +help: implement the missing item + | +LL | {fn next(&mut self) -> Option<::Item> { todo!() } + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr index 5809ff8f80347..3e676267ddd39 100644 --- a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr +++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr @@ -55,9 +55,14 @@ warning: where clause not allowed here --> $DIR/where-clause-placement-assoc-type-in-impl.rs:32:17 | LL | type Assoc3 where = () where; - | ^^^^^ help: remove this `where` + | ^^^^^ | = note: see issue #89122 for more information +help: remove this `where` + | +LL - type Assoc3 where = () where; +LL + type Assoc3 = () where; + | warning: 5 warnings emitted