Suggest usage of array.as_slice()
(instead of &array[..]
) and array.as_mut_slice()
#7633
Labels
A-lint
Area: New lints
good-first-issue
These issues are a good way to get started with Clippy
L-restriction
Lint: Belongs in the restriction lint group
What it does
Lints for example this code:
and suggests
array::as_slice
:(same should be suggested for
&mut array[..]
, which can be replaced witharray.as_mut_slice()
)Categories (optional)
clippy::pedantic
orclippy::style
What is the advantage of the recommended code over the original code?
For example:
[..]
does)array::as_slice
exists? (see Add[T; N]::as_[mut_]slice
rust#76120)Drawbacks
Possibly related issues:
as_slice
will be stable in 1.7 #728&[char]
#5598Stabilization
At the time of writing this issue, the function is still unstable, but with the merging of rust-lang/rust#88353, this feature will be stabilized. (final-comment-period, so will be merged in the next few days)
The text was updated successfully, but these errors were encountered: