rust/compiler/rustc_lint/src
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
..
nonstandard_style mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
array_into_iter.rs lint: port array-into-iter diagnostics 2022-06-30 08:59:19 +01:00
builtin.rs Rollup merge of #94467 - ibraheemdev:master, r=pnkfelix 2022-09-01 21:37:07 +02:00
context.rs Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
early.rs Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
enum_intrinsics_non_enums.rs Update TypeVisitor paths 2022-07-06 06:41:53 +01:00
errors.rs refactor: migrate to kind-less SessionDiagnostic derives 2022-08-22 08:33:47 -04:00
expect.rs lint: port expectation diagnostics 2022-06-30 08:59:21 +01:00
hidden_unicode_codepoints.rs Rename some things related to literals. 2022-08-16 13:41:34 +10:00
internal.rs Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
late.rs Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
let_underscore.rs Fix imports. 2022-08-04 17:31:08 -04:00
levels.rs Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
lib.rs Rollup merge of #97739 - a2aaron:let_underscore, r=estebank 2022-09-02 11:34:45 +02:00
methods.rs lint: port CString ptr diagnostics 2022-06-30 08:59:21 +01:00
non_ascii_idents.rs lint: port non-ascii-idents diagnostics 2022-06-30 08:59:21 +01:00
non_fmt_panic.rs lint: port non-fmt-panic diagnostics 2022-06-30 08:59:21 +01:00
nonstandard_style.rs Add visitors for PatField and ExprField. 2022-08-11 21:48:39 -07:00
noop_method_call.rs Update TypeVisitor paths 2022-07-06 06:41:53 +01:00
pass_by_value.rs lint: port pass-by-value diagnostics 2022-06-30 08:59:21 +01:00
passes.rs Remove Sync requirement from lint pass objects as they are created on demand 2022-08-29 10:00:22 -04:00
redundant_semicolon.rs lint: port redundant semicolons diagnostics 2022-06-30 08:59:21 +01:00
tests.rs Update to last upstream version 2021-07-08 17:14:28 +02:00
traits.rs lint: port drop trait/glue diagnostics 2022-06-30 08:59:21 +01:00
types.rs Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
unused.rs Fix a bunch of typo 2022-08-31 18:24:55 +08:00