2 #![feature(let_chains)]
5 clippy::assign_op_pattern,
6 clippy::blocks_in_if_conditions,
7 clippy::let_and_return,
8 clippy::let_unit_value,
9 clippy::nonminimal_bool
12 use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
15 struct SignificantDrop;
16 impl std::ops::Drop for SignificantDrop {
65 e = format!("{} {}", a, b);
83 // Drop order only matters if both are significant
85 let y = SignificantDrop;
93 // types that should be considered insignificant
96 let y = String::new();
98 let y = HashMap::<usize, usize>::new();
99 let y = BTreeMap::<usize, usize>::new();
100 let y = HashSet::<usize>::new();
101 let y = BTreeSet::<usize>::new();
106 async fn in_async() -> &'static str {
107 async fn f() -> &'static str {
123 const fn in_const() -> &'static str {
124 const fn f() -> &'static str {
168 // using tuples would be possible, but not always preferable
179 // could match with a smarter heuristic to avoid multiple assignments
197 macro_rules! assign {
212 macro_rules! in_macro {
227 // ignore if-lets - https://github.com/rust-lang/rust-clippy/issues/8613
229 if let Some(n) = Some("v") {
236 if true && let Some(n) = Some("let chains too") {
242 // ignore mut bindings
243 // https://github.com/shepmaster/twox-hash/blob/b169c16d86eb8ea4a296b0acb9d00ca7e3c3005f/src/sixty_four.rs#L88-L93
244 // https://github.com/dtolnay/thiserror/blob/21c26903e29cb92ba1a7ff11e82ae2001646b60d/tests/test_generics.rs#L91-L100
250 // should not move the declaration if `x` has a significant drop, and there
251 // is another binding with a significant drop between it and the first usage
253 let y = SignificantDrop;
258 fn issue8911() -> u32 {
261 _ if { x = 1; false } => return 1,