E0058#
警告名称:unused_non_capturing
正则表达式中存在不必要的非捕获分组。
当正则表达式包含不需要的非捕获分组时发出此警告。可删除多余分组以简化正则。
错误示例#
test {
let text = "xxabcyy"
lexmatch text {
(before, "a" "(?:b)" "c", after) => {
inspect(before, content="xx")
inspect(after, content="yy")
}
_ => fail("")
}
}
建议#
移除多余的非捕获分组:
test {
let text = "xxabcyy"
lexmatch text {
(before, "a" "b" "c", after) => {
inspect(before, content="xx")
inspect(after, content="yy")
}
_ => fail("")
}
}