2 The lint checks for slice bindings in patterns that are only used to
3 access individual slice values.
6 Accessing slice values using indices can lead to panics. Using refutable
7 patterns can avoid these. Binding to individual values also improves the
8 readability as they can be named.
11 This lint currently only checks for immutable access inside `if let`
16 let slice: Option<&[u32]> = Some(&[1, 2, 3]);
18 if let Some(slice) = slice {
19 println!("{}", slice[0]);
24 let slice: Option<&[u32]> = Some(&[1, 2, 3]);
26 if let Some(&[first, ..]) = slice {
27 println!("{}", first);