Skip to content

New lint: manual_slice_fill #13856

Open
Open
@sosthene-nitrokey

Description

What it does

Suggests using slice::fill instead of a manual loop

Advantage

  • Makes code simpler
  • Suggestion is better than that of needless_range_loop

Drawbacks

Uses a less known function (slice::fill)

Example

for i in 0..some_slice.len() {
    some_slice[i] = 0;
}

Could be written as:

some_slice.fill(0);

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions