Skip to content

Commit

Permalink
Auto merge of #9696 - Alexendoo:let-underscore-drop, r=flip1995
Browse files Browse the repository at this point in the history
Move `let_underscore_drop` to restriction

Because of things like #9314. `let _` is considered the idiomatic way to ignore `must_use`: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute

changelog: [`let_underscore_drop`]: move to restriction

r? `@flip1995`
  • Loading branch information
bors committed Oct 23, 2022
2 parents 4f142aa + b495d09 commit 932688c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions clippy_lints/src/let_underscore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ declare_clippy_lint! {

declare_clippy_lint! {
/// ### What it does
/// Checks for `let _ = <expr>`
/// where expr has a type that implements `Drop`
/// Checks for `let _ = <expr>` where expr has a type that implements `Drop`
///
/// ### Why is this bad?
/// This statement immediately drops the initializer
Expand Down Expand Up @@ -94,7 +93,7 @@ declare_clippy_lint! {
/// ```
#[clippy::version = "1.50.0"]
pub LET_UNDERSCORE_DROP,
pedantic,
restriction,
"non-binding let on a type that implements `Drop`"
}

Expand Down
1 change: 0 additions & 1 deletion clippy_lints/src/lib.register_pedantic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
LintId::of(items_after_statements::ITEMS_AFTER_STATEMENTS),
LintId::of(iter_not_returning_iterator::ITER_NOT_RETURNING_ITERATOR),
LintId::of(large_stack_arrays::LARGE_STACK_ARRAYS),
LintId::of(let_underscore::LET_UNDERSCORE_DROP),
LintId::of(literal_representation::LARGE_DIGIT_GROUPS),
LintId::of(literal_representation::UNREADABLE_LITERAL),
LintId::of(loops::EXPLICIT_INTO_ITER_LOOP),
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/lib.register_restriction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ store.register_group(true, "clippy::restriction", Some("clippy_restriction"), ve
LintId::of(indexing_slicing::INDEXING_SLICING),
LintId::of(inherent_impl::MULTIPLE_INHERENT_IMPL),
LintId::of(large_include_file::LARGE_INCLUDE_FILE),
LintId::of(let_underscore::LET_UNDERSCORE_DROP),
LintId::of(let_underscore::LET_UNDERSCORE_MUST_USE),
LintId::of(literal_representation::DECIMAL_LITERAL_REPRESENTATION),
LintId::of(matches::REST_PAT_IN_FULLY_BOUND_STRUCTS),
Expand Down
2 changes: 1 addition & 1 deletion lintcheck/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ fn main() {
.unwrap();

let server = config.recursive.then(|| {
fs::remove_dir_all("target/lintcheck/shared_target_dir/recursive").unwrap_or_default();
let _ = fs::remove_dir_all("target/lintcheck/shared_target_dir/recursive");

LintcheckServer::spawn(recursive_options)
});
Expand Down
3 changes: 1 addition & 2 deletions src/docs/let_underscore_drop.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
### What it does
Checks for `let _ = <expr>`
where expr has a type that implements `Drop`
Checks for `let _ = <expr>` where expr has a type that implements `Drop`

### Why is this bad?
This statement immediately drops the initializer
Expand Down

0 comments on commit 932688c

Please sign in to comment.