1 //@aux-build:proc_macros.rs
2 #![feature(let_chains)]
5 clippy
::assign_op_pattern
,
6 clippy
::blocks_in_conditions
,
7 clippy
::let_and_return
,
8 clippy
::let_unit_value
,
9 clippy
::nonminimal_bool
,
10 clippy
::uninlined_format_args
,
14 extern crate proc_macros
;
16 use std
::collections
::{BTreeMap, BTreeSet, HashMap, HashSet}
;
19 struct SignificantDrop
;
20 impl std
::ops
::Drop
for SignificantDrop
{
69 e
= format
!("{} {}", a
, b
);
87 // Drop order only matters if both are significant
89 let y
= SignificantDrop
;
97 // types that should be considered insignificant
100 let y
= String
::new();
102 let y
= HashMap
::<usize, usize>::new();
103 let y
= BTreeMap
::<usize, usize>::new();
104 let y
= HashSet
::<usize>::new();
105 let y
= BTreeSet
::<usize>::new();
110 async
fn in_async() -> &'
static str {
111 async
fn f() -> &'
static str {
127 const fn in_const() -> &'
static str {
128 const fn f() -> &'
static str {
144 #[proc_macros::inline_macros]
173 // using tuples would be possible, but not always preferable
184 // could match with a smarter heuristic to avoid multiple assignments
224 // ignore if-lets - https://github.com/rust-lang/rust-clippy/issues/8613
226 if let Some(n
) = Some("v") {
234 && 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,