e444cbe5d6
* Finding pattern slices for `avoidable_slice_indexing` * `avoidable_slice_indexing` analysing slice usage * Add configuration to `avoidable_slice_indexing` * Emitting `avoidable_slice_indexing` with suggestions * Dogfooding and fixing bugs * Add ui-toml test for `avoidable_slice_indexing` * Correctly suggest `ref` keywords for `avoidable_slice_indexing` * Test and document `mut` for `avoid_slice_indexing` * Handle macros with `avoidable_slice_indexing` lint * Ignore slices with sub patterns in `avoidable_slice_indexing` * Update lint description for `avoidable_slice_indexing` * Move `avoidable_slice_indexing` to nursery * Added more tests for `avoidable_slice_indexing` * Update documentation and message for `avoidable_slice_indexing` * Teach `avoidable_slice_indexing` about `HirId`s and `Visitors` * Rename lint to `index_refutable_slice` and connected config
23 lines
661 B
Plaintext
23 lines
661 B
Plaintext
error: this binding can be a slice pattern to avoid indexing
|
|
--> $DIR/slice_indexing_in_macro.rs:23:21
|
|
|
|
|
LL | if let Some(slice) = slice;
|
|
| ^^^^^
|
|
|
|
|
note: the lint level is defined here
|
|
--> $DIR/slice_indexing_in_macro.rs:1:9
|
|
|
|
|
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: aborting due to previous error
|
|
|