E3019#
Inclusive range pattern a..=b
cannot have _
as upper bound.
Writing a..=_
does not make sense, because _
is a wildcard that matches any
value. It is unclear what does "equals to any value" mean. If you want to
express the meaning of "greater than or equal to a
", you can use a..<_
instead.
Erroneous example#
fn main {
match 0 {
0..=_ => println("Big than or equal to 0")
// ^
// Error: Inclusive range pattern `a..=b` cannot have `_` as upper bound
_ => println("Less than 0")
}
}
Suggestion#
Replace =
with <
:
fn main {
match 0 {
0..<_ => println("Big than or equal to 0")
_ => println("Less than 0")
}
}