rust/compiler
Guillaume Gomez 07f43a1ca1
Rollup merge of #97739 - a2aaron:let_underscore, r=estebank
Uplift the `let_underscore` lints from clippy into rustc.

This PR resolves #97241.

This PR adds three lints from clippy--`let_underscore_drop`, `let_underscore_lock`, and `let_underscore_must_use`, which are meant to capture likely-incorrect uses of `let _ = ...` bindings (in particular, doing this on a type with a non-trivial `Drop` causes the `Drop` to occur immediately, instead of at the end of the scope. For a type like `MutexGuard`, this effectively releases the lock immediately, which is almost certainly the wrong behavior)

In porting the lints from clippy I had to copy over a bunch of utility functions from `clippy_util` that these lints also relied upon. Is that the right approach?

Note that I've set the `must_use` and `drop` lints to Allow by default and set `lock` to Deny by default (this matches the same settings that clippy has). In talking with `@estebank` he informed me to do a Crater run (I am not sure what type of Crater run to request here--I think it's just "check only"?)

On the linked issue, there's some discussion about using `must_use` and `Drop` together as a heuristic for when to warn--I did not implement this yet.

r? `@estebank`
2022-09-02 11:34:45 +02:00
..
rustc
rustc_apfloat Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_arena Make use of [wrapping_]byte_{add,sub} 2022-08-23 19:32:37 +04:00
rustc_ast Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_ast_lowering Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_ast_passes Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_ast_pretty Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_attr Revert let_chains stabilization 2022-08-29 19:34:11 +02:00
rustc_borrowck Rollup merge of #101285 - TaKO8Ki:do-not-suggest-adding-move-when-closure-is-already-marked-as-move, r=oli-obk 2022-09-01 21:37:21 +02:00
rustc_builtin_macros Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_codegen_cranelift Auto merge of #100707 - dzvon:fix-typo, r=davidtwco 2022-09-01 05:39:58 +00:00
rustc_codegen_gcc Rollup merge of #100653 - cuviper:fptoint_sat, r=michaelwoerister,antoyo 2022-08-30 16:56:09 +05:30
rustc_codegen_llvm Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_codegen_ssa Auto merge of #100958 - mikebenfield:workaround, r=nikic 2022-09-01 10:30:10 +00:00
rustc_const_eval tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_data_structures Auto merge of #100869 - nnethercote:replace-ThinVec, r=spastorino 2022-09-01 08:01:06 +00:00
rustc_driver tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_error_codes Stabilize #![feature(label_break_value)] 2022-08-23 21:14:12 -05:00
rustc_error_messages Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_errors Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_expand Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_feature Auto merge of #101183 - Dylan-DPC:rollup-6kewixv, r=Dylan-DPC 2022-08-30 08:29:42 +00:00
rustc_fs_util Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_graphviz Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_hir Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_hir_pretty Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_incremental Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
rustc_index Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_infer tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_interface Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_lexer Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_lint Rollup merge of #97739 - a2aaron:let_underscore, r=estebank 2022-09-02 11:34:45 +02:00
rustc_lint_defs Auto merge of #100707 - dzvon:fix-typo, r=davidtwco 2022-09-01 05:39:58 +00:00
rustc_llvm Rollup merge of #101025 - semarie:openbsd-archs, r=petrochenkov 2022-08-31 07:57:58 +02:00
rustc_log Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_macros Rollup merge of #101165 - ldm0:drain_to_iter, r=cjgillot 2022-08-31 21:30:13 +02:00
rustc_metadata Auto merge of #98960 - cjgillot:entry-kind, r=estebank 2022-09-01 19:31:14 +00:00
rustc_middle Auto merge of #98960 - cjgillot:entry-kind, r=estebank 2022-09-01 19:31:14 +00:00
rustc_mir_build tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_mir_dataflow Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obk 2022-08-29 06:34:43 +02:00
rustc_mir_transform Auto merge of #99102 - JakobDegen:reorder-generators, r=oli-obk 2022-08-30 23:43:33 +00:00
rustc_monomorphize tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_parse Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_parse_format Separate CountIsStar from CountIsParam in rustc_parse_format. 2022-08-25 14:49:09 +02:00
rustc_passes Directly use the instrument macro instead of its full path 2022-09-01 14:53:46 +00:00
rustc_plugin_impl Migrate rustc_plugin_impl to SessionDiagnostic 2022-08-22 16:35:05 +01:00
rustc_privacy Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_query_impl tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_query_system Auto merge of #100869 - nnethercote:replace-ThinVec, r=spastorino 2022-09-01 08:01:06 +00:00
rustc_resolve Auto merge of #98960 - cjgillot:entry-kind, r=estebank 2022-09-01 19:31:14 +00:00
rustc_save_analysis Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_serialize Replace rustc_data_structures::thin_vec::ThinVec with thin_vec::ThinVec. 2022-08-29 15:42:13 +10:00
rustc_session Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_smir Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_span Rollup merge of #97739 - a2aaron:let_underscore, r=estebank 2022-09-02 11:34:45 +02:00
rustc_symbol_mangling Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_target Auto merge of #100707 - dzvon:fix-typo, r=davidtwco 2022-09-01 05:39:58 +00:00
rustc_trait_selection tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_traits Fix a bunch of typo 2022-08-31 18:24:55 +08:00
rustc_transmute Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_ty_utils tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_type_ir ADD - diagnostic lints to type_ir 2022-08-18 13:33:03 -04:00
rustc_typeck tracing::instrument cleanup 2022-09-01 14:54:27 +00:00