1 #![feature(let_chains)]
2 #![allow(unused, clippy::nonminimal_bool, clippy::let_unit_value)]
4 use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
7 struct SignificantDrop;
8 impl std::ops::Drop for SignificantDrop {
41 e = format!("{} {}", a, b);
59 // Drop order only matters if both are significant
61 let y = SignificantDrop;
69 // types that should be considered insignificant
72 let y = String::new();
74 let y = HashMap::<usize, usize>::new();
75 let y = BTreeMap::<usize, usize>::new();
76 let y = HashSet::<usize>::new();
77 let y = BTreeSet::<usize>::new();
82 async fn in_async() -> &'static str {
83 async fn f() -> &'static str {
99 const fn in_const() -> &'static str {
100 const fn f() -> &'static str {
144 // using tuples would be possible, but not always preferable
155 // could match with a smarter heuristic to avoid multiple assignments
173 macro_rules! assign {
188 macro_rules! in_macro {
203 // ignore if-lets - https://github.com/rust-lang/rust-clippy/issues/8613
205 if let Some(n) = Some("v") {
212 if true && let Some(n) = Some("let chains too") {
218 // ignore mut bindings
219 // https://github.com/shepmaster/twox-hash/blob/b169c16d86eb8ea4a296b0acb9d00ca7e3c3005f/src/sixty_four.rs#L88-L93
220 // https://github.com/dtolnay/thiserror/blob/21c26903e29cb92ba1a7ff11e82ae2001646b60d/tests/test_generics.rs#L91-L100
226 // should not move the declaration if `x` has a significant drop, and there
227 // is another binding with a significant drop between it and the first usage
229 let y = SignificantDrop;