E0076#
Warning name: lexmatch_first_match
この警告は、first-match lexmatch の以前の実験的な形式を説明するものであり、現在のコンパイラでは発生しません。
現在の lexmatch 式は re"..." のケースパターンを使い、デフォルトの first-match 戦略を利用できます。1 回の真偽値チェックだけなら、通常は正規表現マッチ式の方が簡潔です。
Erroneous example#
///|
fn classify(input : String) -> String {
lexmatch input {
"if" => "keyword"
_ => "other"
}
}
///|
test {
ignore(classify)
}
Suggestion#
古い文字列断片パターン構文を re"..." のケースに書き換えてください。真偽値の結果だけが必要な場合は、正規表現マッチ式を使います。
///|
fn classify(input : String) -> String {
if input =~ re"^if$" {
"keyword"
} else {
"other"
}
}
///|
test {
ignore(classify)
}