4 clippy::assign_op_pattern,
5 clippy::blocks_in_if_conditions,
6 clippy::let_and_return,
7 clippy::let_unit_value,
8 clippy::nonminimal_bool
11 use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
14 struct SignificantDrop;
15 impl std::ops::Drop for SignificantDrop {
64 e = format!("{} {}", a, b);
82 // Drop order only matters if both are significant
84 let y = SignificantDrop;
92 // types that should be considered insignificant
95 let y = String::new();
97 let y = HashMap::<usize, usize>::new();
98 let y = BTreeMap::<usize, usize>::new();
99 let y = HashSet::<usize>::new();
100 let y = BTreeSet::<usize>::new();
105 async fn in_async() -> &'static str {
106 async fn f() -> &'static str {
122 const fn in_const() -> &'static str {
123 const fn f() -> &'static str {
167 // using tuples would be possible, but not always preferable
178 // could match with a smarter heuristic to avoid multiple assignments
196 macro_rules! assign {
211 macro_rules! in_macro {
226 // ignore if-lets - https://github.com/rust-lang/rust-clippy/issues/8613
228 if let Some(n) = Some("v") {
235 if true && let Some(n) = Some("let chains too") {
241 // ignore mut bindings
242 // https://github.com/shepmaster/twox-hash/blob/b169c16d86eb8ea4a296b0acb9d00ca7e3c3005f/src/sixty_four.rs#L88-L93
243 // https://github.com/dtolnay/thiserror/blob/21c26903e29cb92ba1a7ff11e82ae2001646b60d/tests/test_generics.rs#L91-L100
249 // should not move the declaration if `x` has a significant drop, and there
250 // is another binding with a significant drop between it and the first usage
252 let y = SignificantDrop;
257 fn issue8911() -> u32 {
260 _ if { x = 1; false } => return 1,