2021-12-06 05:33:31 -06:00
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:16:17
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let Some(slice) = slice {
|
|
|
|
| ^^^^^
|
|
|
|
|
|
|
|
|
note: the lint level is defined here
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:1:9
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | #![deny(clippy::index_refutable_slice)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let Some([slice_0, ..]) = slice {
|
|
|
|
| ~~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL | println!("{}", slice_0);
|
|
|
|
| ~~~~~~~
|
|
|
|
|
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:23:17
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let Some(slice) = slice {
|
|
|
|
| ^^^^^
|
|
|
|
|
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let Some([slice_0, ..]) = slice {
|
|
|
|
| ~~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL | println!("{}", slice_0);
|
|
|
|
| ~~~~~~~
|
|
|
|
|
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:30:17
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let Some(slice) = slice {
|
|
|
|
| ^^^^^
|
|
|
|
|
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let Some([slice_0, _, slice_2, ..]) = slice {
|
|
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL ~ println!("{}", slice_2);
|
|
|
|
LL ~ println!("{}", slice_0);
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:38:26
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let SomeEnum::One(slice) | SomeEnum::Three(slice) = slice_wrapped {
|
|
|
|
| ^^^^^
|
|
|
|
|
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let SomeEnum::One([slice_0, ..]) | SomeEnum::Three([slice_0, ..]) = slice_wrapped {
|
|
|
|
| ~~~~~~~~~~~~~ ~~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL | println!("{}", slice_0);
|
|
|
|
| ~~~~~~~
|
|
|
|
|
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:46:29
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let (SomeEnum::Three(a), Some(b)) = (a_wrapped, b_wrapped) {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let (SomeEnum::Three([_, _, a_2, ..]), Some(b)) = (a_wrapped, b_wrapped) {
|
|
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL | println!("{} -> {}", a_2, b[1]);
|
|
|
|
| ~~~
|
|
|
|
|
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:46:38
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let (SomeEnum::Three(a), Some(b)) = (a_wrapped, b_wrapped) {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let (SomeEnum::Three(a), Some([_, b_1, ..])) = (a_wrapped, b_wrapped) {
|
|
|
|
| ~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL | println!("{} -> {}", a[2], b_1);
|
|
|
|
| ~~~
|
|
|
|
|
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:55:21
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let Some(ref slice) = slice {
|
|
|
|
| ^^^^^
|
|
|
|
|
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let Some([_, ref slice_1, ..]) = slice {
|
|
|
|
| ~~~~~~~~~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL | println!("{:?}", slice_1);
|
|
|
|
| ~~~~~~~
|
|
|
|
|
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:64:17
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let Some(slice) = &slice {
|
|
|
|
| ^^^^^
|
|
|
|
|
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let Some([slice_0, ..]) = &slice {
|
|
|
|
| ~~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL | println!("{:?}", slice_0);
|
|
|
|
| ~~~~~~~
|
|
|
|
|
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:134:17
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let Some(slice) = wrap.inner {
|
|
|
|
| ^^^^^
|
|
|
|
|
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let Some([slice_0, ..]) = wrap.inner {
|
|
|
|
| ~~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL | println!("This is awesome! {}", slice_0);
|
|
|
|
| ~~~~~~~
|
|
|
|
|
|
|
|
error: this binding can be a slice pattern to avoid indexing
|
2024-07-25 11:29:17 -05:00
|
|
|
--> tests/ui/index_refutable_slice/if_let_slice_binding.rs:142:17
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | if let Some(slice) = wrap.inner {
|
|
|
|
| ^^^^^
|
|
|
|
|
|
|
|
|
help: try using a slice pattern here
|
|
|
|
|
|
|
|
|
LL | if let Some([slice_0, ..]) = wrap.inner {
|
|
|
|
| ~~~~~~~~~~~~~
|
|
|
|
help: and replace the index expressions here
|
|
|
|
|
|
|
|
|
LL | println!("This is super awesome! {}", slice_0);
|
|
|
|
| ~~~~~~~
|
|
|
|
|
|
|
|
error: aborting due to 10 previous errors
|
|
|
|
|