E0075#
Warning name: unnecessary_view_op
Unnecessary [:] view operation.
When the expected type is already a view type, MoonBit can insert the view
conversion automatically. Writing [:] explicitly in that context is redundant.
Erroneous example#
///|
fn length(view : ArrayView[Int]) -> Int {
view.length()
}
///|
test {
inspect(length([1, 2, 3][:]), content="3")
}
Suggestion#
Remove the redundant [:].
///|
fn length(view : ArrayView[Int]) -> Int {
view.length()
}
///|
test {
inspect(length([1, 2, 3]), content="3")
}