2 #![warn(clippy::manual_find)]
4 #![allow(clippy::needless_return, clippy::uninlined_format_args)]
6 use std::collections::HashMap;
8 const ARRAY: &[u32; 5] = &[2, 7, 1, 9, 3];
10 fn lookup(n: u32) -> Option<u32> {
19 fn with_pat(arr: Vec<(u32, u32)>) -> Option<u32> {
32 fn with_struct(arr: Vec<Data>) -> Option<Data> {
34 if el.name.len() == 10 {
41 struct Tuple(usize, usize);
42 fn with_tuple_struct(arr: Vec<Tuple>) -> Option<usize> {
43 for Tuple(a, _) in arr {
53 fn should_keep(&self) -> bool {
57 fn with_method_call(arr: Vec<A>) -> Option<A> {
66 fn with_closure(arr: Vec<u32>) -> Option<u32> {
67 let f = |el: u32| -> u32 { el + 10 };
76 fn with_closure2(arr: HashMap<String, i32>) -> Option<i32> {
77 let f = |el: i32| -> bool { el == 10 };
78 for &el in arr.values() {
86 fn with_bool(arr: Vec<Data>) -> Option<Data> {
95 fn with_side_effects(arr: Vec<u32>) -> Option<u32> {
98 println!("side effect");
105 fn with_else(arr: Vec<u32>) -> Option<u32> {
116 fn tuple_with_ref(v: [(u8, &u8); 3]) -> Option<u8> {
125 fn ref_to_tuple_with_ref(v: &[(u8, &u8)]) -> Option<u8> {
134 fn explicit_ret(arr: Vec<i32>) -> Option<i32> {
143 fn plus_one(a: i32) -> Option<i32> {
146 fn fn_instead_of_some(a: &[i32]) -> Option<i32> {
155 fn for_in_condition(a: &[i32], b: bool) -> Option<i32> {
166 fn intermediate_statements(a: &[i32]) -> Option<i32> {
173 println!("side effect");
178 fn mixed_binding_modes(arr: Vec<(i32, String)>) -> Option<i32> {
179 for (x, mut s) in arr {
180 if x == 1 && s.as_mut_str().len() == 2 {
189 let f = |arr: Vec<i32>| -> Option<i32> {
199 fn in_block(a: &[i32]) -> Option<i32> {
200 let should_be_none = {
209 assert!(should_be_none.is_none());
215 fn mut_binding(v: Vec<String>) -> Option<String> {
217 if s.as_mut_str().len() > 1 {
224 fn subpattern(v: Vec<[u32; 32]>) -> Option<[u32; 32]> {
225 for a @ [first, ..] in v {
233 fn two_bindings(v: Vec<(u8, u8)>) -> Option<u8> {