Closed
Description
Now that we have rustfix integrated in our testsuite, we can use it to make sure that the suggestions we provide are valid rust code. This will also be useful once cargo fix --clippy
is available to users.
This tracking issue is meant to give an overview of how many lints currently provide incorrect suggestions.
Below is the list of tests that include MachineApplicable
but incorrect suggestions. For this issue to be closed, we need to add // run-rustfix
to all of them and have the tests execute successfully.
If you want to help out with this, feel free to select one file that is not fixed and leave a comment below. Smaller files are most likely easier to fix.
- Once you added
// run-rustfix
to the.rs
file runcargo test && tests/ui/update-all-references.sh && cargo test
. The tests for your file should fail and it should have generated a*.fixed
file - Run
rustc tests/ui/<your_test_file>.fixed
to see the exact compilation error - Fix the issue (Follow CONTRIBUTING.md and feel free to ask questions)
Files that test lints which need to be fixed
-
tests/ui/assign_ops.rs
-
tests/ui/assign_ops2.rs
-
tests/ui/cmp_owned.rs
-
tests/ui/deref_addrof_double_trigger.rs
-
tests/ui/entry.rs
-
tests/ui/eq_op.rs
-
tests/ui/float_cmp.rs
-
tests/ui/float_cmp_const.rs
-
tests/ui/for_loop.rs
-
tests/ui/identity_conversion.rs
-
tests/ui/implicit_return.rs
-
tests/ui/inline_fn_without_body.rs
-
tests/ui/int_plus_one.rs
-
tests/ui/literals.rs
-
tests/ui/map_flatten.rs
-
tests/ui/mem_discriminant.rs
-
tests/ui/needless_borrow.rs
-
tests/ui/needless_borrowed_ref.rs
-
tests/ui/needless_collect.rs
-
tests/ui/needless_return.rs
-
tests/ui/non_copy_const.rs
-
tests/ui/op_ref.rs
(op_ref false positive with deref coercions when comparing #2597) -
tests/ui/option_map_unit_fn.rs
-
tests/ui/or_fun_call.rs
-
tests/ui/outer_expn_data.rs
-
tests/ui/range_plus_minus_one.rs
-
tests/ui/redundant_closure_call.rs
-
tests/ui/redundant_pattern_matching.rs
-
tests/ui/rename.rs
-
tests/ui/renamed_builtin_attr.rs
-
tests/ui/redundant_static_lifetimes.rs
-
tests/ui/result_map_unit_fn.rs
Add run-rustfix for result_map_unit_fn lint #4571 -
tests/ui/short_circuit_statement.rs
-
tests/ui/strings.rs
-
tests/ui/toplevel_ref_arg.rs
Add run-rustfix for toplevel_ref_arg lint #4567 -
tests/ui/unnecessary_clone.rs
-
tests/ui/unnecessary_operation.rs
-
tests/ui/wildcard_enum_match_arm.rs
Add run-rustfix for wildcard_enum_match_arm lint #4562 -
tests/ui/useless_attribute.rs